mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
no more CompletionState
This commit is contained in:
-1
@@ -487,7 +487,6 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
|
||||
else if (decision instanceof AutoCompletionDecision.InsertItem) {
|
||||
final LookupElement item = ((AutoCompletionDecision.InsertItem)decision).getElement();
|
||||
indicator.closeAndFinish(true);
|
||||
indicator.getCompletionState().assertDisposed();
|
||||
final Runnable restorePrefix = rememberDocumentState(indicator.getEditor());
|
||||
indicator.getOffsetMap()
|
||||
.addOffset(CompletionInitializationContext.START_OFFSET, (offset1 - item.getPrefixMatcher().getPrefix().length()));
|
||||
|
||||
+2
-26
@@ -102,7 +102,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
};
|
||||
private final Semaphore myDuringCompletionSemaphore = new Semaphore();
|
||||
private final CompletionState myState;
|
||||
|
||||
private volatile int myCount;
|
||||
|
||||
@@ -116,7 +115,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
myLookup = lookup;
|
||||
|
||||
myLookup.setArranger(new CompletionLookupArranger(parameters));
|
||||
myState = new CompletionState();
|
||||
|
||||
myLookup.addLookupListener(myLookupListener);
|
||||
myLookup.setCalculating(true);
|
||||
@@ -191,10 +189,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
}
|
||||
|
||||
public CompletionState getCompletionState() {
|
||||
return myState;
|
||||
}
|
||||
|
||||
private static int findReplacementOffset(int selectionEndOffset, PsiReference reference) {
|
||||
final List<TextRange> ranges = ReferenceRange.getAbsoluteRanges(reference);
|
||||
for (TextRange range : ranges) {
|
||||
@@ -240,9 +234,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
myLookup.setAdvertisementText(s);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (isOutdated()) {
|
||||
return;
|
||||
}
|
||||
if (isAutopopupCompletion() && !myLookup.isShown()) {
|
||||
return;
|
||||
}
|
||||
@@ -264,11 +255,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
|
||||
private boolean isOutdated() {
|
||||
if (!myState.isCompletionDisposed()) {
|
||||
CompletionProgressIndicator current = CompletionServiceImpl.getCompletionService().getCurrentCompletion();
|
||||
LOG.assertTrue(this == current, current + " != " + this);
|
||||
}
|
||||
return myState.isCompletionDisposed() || myEditor.isDisposed() || getProject().isDisposed();
|
||||
return CompletionServiceImpl.getCompletionPhase().indicator != this;
|
||||
}
|
||||
|
||||
private void trackModifiers() {
|
||||
@@ -321,10 +308,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
CompletionServiceImpl.getCompletionService().setCurrentCompletion(this);
|
||||
}
|
||||
|
||||
void assertDisposed() {
|
||||
myState.assertDisposed();
|
||||
}
|
||||
|
||||
public CodeCompletionHandlerBase getHandler() {
|
||||
return myHandler;
|
||||
}
|
||||
@@ -400,7 +383,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
LOG.assertTrue(lookup == myLookup);
|
||||
myLookup.removeLookupListener(myLookupListener);
|
||||
finishCompletionProcess();
|
||||
myState.assertDisposed();
|
||||
CompletionServiceImpl.assertPhase(CompletionPhase.NoCompletion.getClass());
|
||||
|
||||
if (hideLookup) {
|
||||
@@ -411,8 +393,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
private void finishCompletionProcess() {
|
||||
cancel();
|
||||
|
||||
myState.setCompletionDisposed(true);
|
||||
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
Disposer.dispose(myQueue);
|
||||
|
||||
@@ -584,9 +564,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isOutdated()) {
|
||||
return;
|
||||
}
|
||||
if (phase != CompletionServiceImpl.getCompletionPhase()) {
|
||||
return;
|
||||
}
|
||||
@@ -606,11 +583,10 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CompletionProgressIndicator[count=" + myCount + "," + myState.toString() + "]";
|
||||
return "CompletionProgressIndicator[count=" + myCount + ",phase=" + CompletionServiceImpl.getCompletionPhase() + "]";
|
||||
}
|
||||
|
||||
protected void handleEmptyLookup(final boolean awaitSecondInvocation) {
|
||||
assertDisposed();
|
||||
assert !isAutopopupCompletion();
|
||||
|
||||
if (ApplicationManager.getApplication().isUnitTestMode() || !myHandler.invokedExplicitly) {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class CompletionState {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.CompletionState");
|
||||
private boolean myCompletionDisposed;
|
||||
|
||||
public boolean isCompletionDisposed() {
|
||||
return myCompletionDisposed;
|
||||
}
|
||||
|
||||
public void setCompletionDisposed(boolean completionDisposed) {
|
||||
LOG.assertTrue(!myCompletionDisposed, this);
|
||||
myCompletionDisposed = completionDisposed;
|
||||
}
|
||||
|
||||
public void assertDisposed() {
|
||||
LOG.assertTrue(myCompletionDisposed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CompletionState{" +
|
||||
"phase=" + CompletionServiceImpl.getCompletionPhase() +
|
||||
", myCompletionDisposed=" + myCompletionDisposed +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user