mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
avoid duplication
This commit is contained in:
+7
-3
@@ -23,15 +23,19 @@ import com.intellij.openapi.util.registry.Registry;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class ShowHideIntentionIconLookupAction extends LookupElementAction {
|
||||
private static final String KEY = "completion.show.intention.icon";
|
||||
static final String KEY = "completion.show.intention.icon";
|
||||
|
||||
public ShowHideIntentionIconLookupAction() {
|
||||
super(AllIcons.Actions.IntentionBulb, (Registry.is(KEY) ? "Never show" : "Show") + " intention icon");
|
||||
super(AllIcons.Actions.IntentionBulb, (shouldShowLookupHint() ? "Never show" : "Show") + " intention icon");
|
||||
}
|
||||
|
||||
public static boolean shouldShowLookupHint() {
|
||||
return Registry.is(KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result performLookupAction() {
|
||||
Registry.get(KEY).setValue(!Registry.is(KEY));
|
||||
Registry.get(KEY).setValue(!shouldShowLookupHint());
|
||||
return Result.REFRESH_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -950,7 +950,8 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
@Override
|
||||
public void run() {
|
||||
assert !myDisposed;
|
||||
if (!Registry.is("completion.show.intention.icon") || ((CompletionExtender)myList.getExpandableItemsHandler()).isShowing()) {
|
||||
if (!ShowHideIntentionIconLookupAction.shouldShowLookupHint() ||
|
||||
((CompletionExtender)myList.getExpandableItemsHandler()).isShowing()) {
|
||||
return;
|
||||
}
|
||||
myElementHint = new LookupHint();
|
||||
|
||||
Reference in New Issue
Block a user