common "invert boolean" quickfix

This commit is contained in:
Bas Leijdekkers
2013-11-07 20:45:45 +01:00
parent 9a5bfa9e7e
commit 9005acd75a
5 changed files with 96 additions and 96 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package com.intellij.refactoring.invertBoolean;
import com.intellij.ide.util.SuperMethodWarningUtil;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.project.Project;
@@ -70,8 +69,13 @@ public class InvertBooleanHandler implements RefactoringActionHandler {
}
public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, @NotNull DataContext dataContext) {
if (elements.length == 1 && elements[0] instanceof PsiMethod) {
invoke((PsiMethod)elements[0], project, null);
if (elements.length == 1) {
if (elements[0] instanceof PsiMethod) {
invoke((PsiMethod)elements[0], project, null);
}
else if (elements[0] instanceof PsiVariable) {
invoke((PsiVariable)elements[0], project, null);
}
}
}