avoid duplication

This commit is contained in:
peter
2012-07-30 22:35:51 +02:00
parent 9a6733be27
commit 9ff611fa15
2 changed files with 9 additions and 4 deletions
@@ -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();