mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't execute empty command
This commit is contained in:
@@ -28,6 +28,7 @@ import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -94,9 +95,13 @@ public class ConsoleExecuteAction extends DumbAwareAction {
|
||||
@Override
|
||||
public final void update(AnActionEvent e) {
|
||||
EditorEx editor = myConsole.getConsoleEditor();
|
||||
Lookup lookup = LookupManager.getActiveLookup(editor);
|
||||
e.getPresentation().setEnabled(!editor.isRendererMode() && isEnabled() &&
|
||||
(lookup == null || !lookup.isCompletion()));
|
||||
boolean enabled = !editor.isRendererMode() && isEnabled() && !StringUtil.isEmptyOrSpaces(editor.getDocument().getCharsSequence());
|
||||
if (enabled) {
|
||||
Lookup lookup = LookupManager.getActiveLookup(editor);
|
||||
enabled = lookup == null || !lookup.isCompletion();
|
||||
}
|
||||
|
||||
e.getPresentation().setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user