Search in sources :

Example 1 with InvertBooleanProcessor

use of com.intellij.refactoring.invertBoolean.InvertBooleanProcessor in project intellij-community by JetBrains.

the class InvertBooleanTest method perform.

@Override
protected void perform() {
    PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED);
    assertTrue(element instanceof PsiNamedElement);
    final PsiNamedElement namedElement = (PsiNamedElement) element;
    final String name = namedElement.getName();
    new InvertBooleanProcessor(namedElement, name + "Inverted").run();
}
Also used : PsiNamedElement(com.intellij.psi.PsiNamedElement) InvertBooleanProcessor(com.intellij.refactoring.invertBoolean.InvertBooleanProcessor) PsiElement(com.intellij.psi.PsiElement)

Example 2 with InvertBooleanProcessor

use of com.intellij.refactoring.invertBoolean.InvertBooleanProcessor in project intellij-community by JetBrains.

the class PyInvertBooleanTest method doTest.

private void doTest(List<String> files) {
    files.add(0, "refactoring/invertBoolean/" + getTestName(true) + ".before.py");
    myFixture.configureByFiles(files.toArray(new String[files.size()]));
    final PsiElement element = myFixture.getElementAtCaret();
    assertTrue(element instanceof PsiNamedElement);
    final PsiNamedElement target = (PsiNamedElement) element;
    final String name = target.getName();
    assertNotNull(name);
    new InvertBooleanProcessor(target, "not" + StringUtil.toTitleCase(name)).run();
    myFixture.checkResultByFile("refactoring/invertBoolean/" + getTestName(true) + ".after.py");
}
Also used : PsiNamedElement(com.intellij.psi.PsiNamedElement) InvertBooleanProcessor(com.intellij.refactoring.invertBoolean.InvertBooleanProcessor) PsiElement(com.intellij.psi.PsiElement)

Aggregations

PsiElement (com.intellij.psi.PsiElement)2 PsiNamedElement (com.intellij.psi.PsiNamedElement)2 InvertBooleanProcessor (com.intellij.refactoring.invertBoolean.InvertBooleanProcessor)2