mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-128661 NPE during inplace renaming variable
This commit is contained in:
+7
-6
@@ -28,12 +28,12 @@ import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
|
||||
import com.intellij.codeInsight.template.impl.TemplateState;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class NextVariableAction extends EditorAction {
|
||||
@@ -46,14 +46,15 @@ public class NextVariableAction extends EditorAction {
|
||||
@Override
|
||||
public void executeWriteAction(Editor editor, @Nullable Caret caret, DataContext dataContext) {
|
||||
TemplateState templateState = TemplateManagerImpl.getTemplateState(editor);
|
||||
assert templateState != null;
|
||||
CommandProcessor.getInstance().setCurrentCommandName(CodeInsightBundle.message("template.next.variable.command"));
|
||||
templateState.nextTab();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Editor editor, Presentation presentation, DataContext dataContext) {
|
||||
TemplateState templateState = TemplateManagerImpl.getTemplateState(editor);
|
||||
presentation.setEnabled(templateState != null && !templateState.isFinished() && templateState.isToProcessTab());
|
||||
@Override
|
||||
protected boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) {
|
||||
TemplateState templateState = TemplateManagerImpl.getTemplateState(editor);
|
||||
return templateState != null && !templateState.isFinished() && templateState.isToProcessTab();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user