mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
all the state concerning restart is now covered by the phase
This commit is contained in:
+1
-1
@@ -309,7 +309,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
|
||||
final ApplicationAdapter listener = new ApplicationAdapter() {
|
||||
@Override
|
||||
public void beforeWriteActionStart(Object action) {
|
||||
indicator.cancelByWriteAction();
|
||||
indicator.scheduleRestart();
|
||||
}
|
||||
};
|
||||
ApplicationManager.getApplication().addApplicationListener(listener);
|
||||
|
||||
+3
-17
@@ -413,7 +413,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
|
||||
private void finishCompletionProcess() {
|
||||
myState.setToRestart(false);
|
||||
cancel();
|
||||
|
||||
myState.setCompletionDisposed(true);
|
||||
@@ -450,8 +449,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
if (isOutdated()) return;
|
||||
if (!isBackgrounded()) return;
|
||||
|
||||
if (isCanceled() && myState.isRestartScheduled()) {
|
||||
CompletionServiceImpl.assertPhase(CompletionPhase.Restarted.class);
|
||||
if (CompletionServiceImpl.isPhase(CompletionPhase.Restarted.class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -511,13 +509,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
return false;
|
||||
}
|
||||
|
||||
public void cancelByWriteAction() {
|
||||
myState.setToRestart(true);
|
||||
cancel();
|
||||
|
||||
scheduleRestart();
|
||||
}
|
||||
|
||||
public boolean fillInCommonPrefix(final boolean explicit) {
|
||||
if (isInsideIdentifier()) {
|
||||
return false;
|
||||
@@ -608,12 +599,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
|
||||
public void prefixUpdated() {
|
||||
if (myState.isToRestart()) {
|
||||
scheduleRestart();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final CharSequence text = myEditor.getDocument().getCharsSequence();
|
||||
final int caretOffset = myEditor.getCaretModel().getOffset();
|
||||
for (Pair<Integer, ElementPattern<String>> pair : myRestartingPrefixConditions) {
|
||||
@@ -629,8 +614,9 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
|
||||
public void scheduleRestart() {
|
||||
cancel();
|
||||
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
myState.scheduleRestart();
|
||||
final CompletionPhase phase = new CompletionPhase.Restarted();
|
||||
CompletionServiceImpl.setCompletionPhase(phase);
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ public class CompletionState {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.CompletionState");
|
||||
private boolean myCompletionDisposed;
|
||||
private boolean myShownLookup;
|
||||
private Boolean myToRestart;
|
||||
private boolean myRestartScheduled;
|
||||
private boolean myModifiersChanged;
|
||||
private boolean myBackgrounded;
|
||||
private volatile boolean myFocusLookupWhenDone;
|
||||
@@ -40,27 +38,6 @@ public class CompletionState {
|
||||
myShownLookup = shownLookup;
|
||||
}
|
||||
|
||||
public boolean isToRestart() {
|
||||
return myToRestart == Boolean.TRUE;
|
||||
}
|
||||
|
||||
public void setToRestart(boolean toRestart) {
|
||||
if (toRestart && myToRestart != null) {
|
||||
LOG.assertTrue(myToRestart == Boolean.FALSE, this); //explicit completionFinished was invoked before this write action
|
||||
return;
|
||||
}
|
||||
|
||||
myToRestart = toRestart;
|
||||
}
|
||||
|
||||
public boolean isRestartScheduled() {
|
||||
return myRestartScheduled;
|
||||
}
|
||||
|
||||
public void scheduleRestart() {
|
||||
myRestartScheduled = true;
|
||||
}
|
||||
|
||||
public boolean areModifiersChanged() {
|
||||
return myModifiersChanged;
|
||||
}
|
||||
@@ -118,8 +95,6 @@ public class CompletionState {
|
||||
"phase=" + CompletionServiceImpl.getCompletionPhase() +
|
||||
", myCompletionDisposed=" + myCompletionDisposed +
|
||||
", myShownLookup=" + myShownLookup +
|
||||
", myToRestart=" + myToRestart +
|
||||
", myRestartScheduled=" + myRestartScheduled +
|
||||
", myModifiersReleased=" + myModifiersChanged +
|
||||
", myBackgrounded=" + myBackgrounded +
|
||||
", myFocusLookupWhenDone=" + myFocusLookupWhenDone +
|
||||
|
||||
Reference in New Issue
Block a user