mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduced core-dependent interface
This commit is contained in:
+25
-8
@@ -28,7 +28,7 @@ import com.intellij.util.containers.Stack;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AbstractProgressIndicatorBase extends UserDataHolderBase implements ProgressIndicator {
|
||||
public class AbstractProgressIndicatorBase extends UserDataHolderBase implements ProgressIndicatorStacked {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.progress.util.ProgressIndicatorBase");
|
||||
|
||||
private volatile String myText;
|
||||
@@ -41,10 +41,10 @@ public class AbstractProgressIndicatorBase extends UserDataHolderBase implements
|
||||
|
||||
private volatile boolean myIndeterminate;
|
||||
|
||||
protected Stack<String> myTextStack;
|
||||
protected DoubleArrayList myFractionStack;
|
||||
protected Stack<String> myText2Stack;
|
||||
protected volatile int myNonCancelableCount;
|
||||
private Stack<String> myTextStack;
|
||||
private DoubleArrayList myFractionStack;
|
||||
private Stack<String> myText2Stack;
|
||||
private volatile int myNonCancelableCount;
|
||||
|
||||
protected ProgressIndicator myModalityProgress;
|
||||
private volatile ModalityState myModalityState = ModalityState.NON_MODAL;
|
||||
@@ -214,6 +214,7 @@ public class AbstractProgressIndicatorBase extends UserDataHolderBase implements
|
||||
return isModal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void initStateFrom(@NotNull final ProgressIndicator indicator) {
|
||||
myRunning = indicator.isRunning();
|
||||
myCanceled = indicator.isCanceled();
|
||||
@@ -224,26 +225,42 @@ public class AbstractProgressIndicatorBase extends UserDataHolderBase implements
|
||||
myText2 = indicator.getText2();
|
||||
|
||||
myFraction = indicator.getFraction();
|
||||
|
||||
if (indicator instanceof ProgressIndicatorStacked) {
|
||||
ProgressIndicatorStacked stacked = (ProgressIndicatorStacked)indicator;
|
||||
|
||||
myNonCancelableCount = stacked.getNonCancelableCount();
|
||||
|
||||
myTextStack = new Stack<String>(stacked.getTextStack());
|
||||
|
||||
myText2Stack = new Stack<String>(stacked.getText2Stack());
|
||||
|
||||
myFractionStack = new DoubleArrayList(stacked.getFractionStack());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Stack<String> getTextStack() {
|
||||
public synchronized Stack<String> getTextStack() {
|
||||
if (myTextStack == null) myTextStack = new Stack<String>(2);
|
||||
return myTextStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public DoubleArrayList getFractionStack() {
|
||||
public synchronized DoubleArrayList getFractionStack() {
|
||||
if (myFractionStack == null) myFractionStack = new DoubleArrayList(2);
|
||||
return myFractionStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Stack<String> getText2Stack() {
|
||||
public synchronized Stack<String> getText2Stack() {
|
||||
if (myText2Stack == null) myText2Stack = new Stack<String>(2);
|
||||
return myText2Stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNonCancelableCount() {
|
||||
return myNonCancelableCount;
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.progress.util;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.util.containers.DoubleArrayList;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ProgressIndicatorStacked extends ProgressIndicator {
|
||||
void initStateFrom(@NotNull ProgressIndicator indicator);
|
||||
|
||||
@NotNull
|
||||
Stack<String> getTextStack();
|
||||
|
||||
@NotNull
|
||||
DoubleArrayList getFractionStack();
|
||||
|
||||
@NotNull
|
||||
Stack<String> getText2Stack();
|
||||
|
||||
int getNonCancelableCount();
|
||||
}
|
||||
+5
-11
@@ -17,12 +17,11 @@ package com.intellij.openapi.progress.util;
|
||||
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.TaskInfo;
|
||||
import com.intellij.openapi.progress.impl.ProgressManagerImpl;
|
||||
import com.intellij.openapi.wm.ex.ProgressIndicatorEx;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.DoubleArrayList;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import com.intellij.util.containers.WeakList;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -330,16 +329,11 @@ public class ProgressIndicatorBase extends AbstractProgressIndicatorBase impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void initStateFrom(@NotNull final ProgressIndicatorEx indicator) {
|
||||
public synchronized void initStateFrom(@NotNull final ProgressIndicator indicator) {
|
||||
super.initStateFrom(indicator);
|
||||
myModalityEntered = indicator.isModalityEntered();
|
||||
myNonCancelableCount = indicator.getNonCancelableCount();
|
||||
|
||||
myTextStack = new Stack<String>(indicator.getTextStack());
|
||||
|
||||
myText2Stack = new Stack<String>(indicator.getText2Stack());
|
||||
|
||||
myFractionStack = new DoubleArrayList(indicator.getFractionStack());
|
||||
if (indicator instanceof ProgressIndicatorEx) {
|
||||
myModalityEntered = ((ProgressIndicatorEx)indicator).isModalityEntered();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,30 +15,17 @@
|
||||
*/
|
||||
package com.intellij.openapi.wm.ex;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.TaskInfo;
|
||||
import com.intellij.util.containers.DoubleArrayList;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorStacked;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ProgressIndicatorEx extends ProgressIndicator {
|
||||
|
||||
public interface ProgressIndicatorEx extends ProgressIndicatorStacked {
|
||||
void addStateDelegate(@NotNull ProgressIndicatorEx delegate);
|
||||
|
||||
void initStateFrom(@NotNull ProgressIndicatorEx indicator);
|
||||
|
||||
@NotNull Stack<String> getTextStack();
|
||||
|
||||
@NotNull DoubleArrayList getFractionStack();
|
||||
|
||||
@NotNull Stack<String> getText2Stack();
|
||||
|
||||
int getNonCancelableCount();
|
||||
|
||||
boolean isModalityEntered();
|
||||
|
||||
void finish(@NotNull TaskInfo task);
|
||||
|
||||
|
||||
boolean isFinished(@NotNull TaskInfo task);
|
||||
|
||||
boolean wasStarted();
|
||||
|
||||
Reference in New Issue
Block a user