mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
choose item actions shouldn't be available for invisible lookups (even if they're shown) (EA-30883)
This commit is contained in:
+2
-2
@@ -150,7 +150,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myLookup.isShown()) {
|
||||
if (!myLookup.isAvailableToUser()) {
|
||||
scheduleAdvertising();
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
myLookup.setAdvertisementText(s);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (isAutopopupCompletion() && !myLookup.isShown()) {
|
||||
if (isAutopopupCompletion() && !myLookup.isAvailableToUser()) {
|
||||
return;
|
||||
}
|
||||
if (!CompletionServiceImpl.isPhase(CompletionPhase.BgCalculation.class, CompletionPhase.ItemsCalculated.class)) {
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public abstract class LookupActionHandler extends EditorActionHandler {
|
||||
|
||||
public void execute(Editor editor, DataContext dataContext){
|
||||
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
|
||||
if (lookup == null || !lookup.isShown() || myRequireFocusedLookup && !lookup.isFocused()) {
|
||||
if (lookup == null || !lookup.isAvailableToUser() || myRequireFocusedLookup && !lookup.isFocused()) {
|
||||
Project project = editor.getProject();
|
||||
if (project != null) {
|
||||
LookupManager.getInstance(project).hideActiveLookup();
|
||||
|
||||
@@ -884,6 +884,13 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
return myChangeGuard || myDisposed;
|
||||
}
|
||||
|
||||
public boolean isAvailableToUser() {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return myShown;
|
||||
}
|
||||
return isVisible();
|
||||
}
|
||||
|
||||
public boolean isShown() {
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public abstract class ChooseItemAction extends EditorAction {
|
||||
public boolean isEnabled(Editor editor, DataContext dataContext) {
|
||||
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
|
||||
if (lookup == null) return false;
|
||||
if (!lookup.isShown()) return false;
|
||||
if (!lookup.isAvailableToUser()) return false;
|
||||
if (focusedOnly && !lookup.isFocused()) return false;
|
||||
if (ChooseItemReplaceAction.hasTemplatePrefix(lookup, TemplateSettings.ENTER_CHAR)) return false;
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public class ChooseItemCompleteStatementAction extends EditorAction {
|
||||
@Override
|
||||
public boolean isEnabled(Editor editor, DataContext dataContext) {
|
||||
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
|
||||
return lookup != null && lookup.isFocused() && lookup.isShown();
|
||||
return lookup != null && lookup.isFocused() && lookup.isAvailableToUser();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class ChooseItemReplaceAction extends EditorAction {
|
||||
public boolean isEnabled(Editor editor, DataContext dataContext) {
|
||||
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
|
||||
if (lookup != null) {
|
||||
if (!lookup.isShown()) {
|
||||
if (!lookup.isAvailableToUser()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user