Search in sources :

Example 1 with JavaFxPropertyRenameHandler

use of org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyRenameHandler in project intellij-community by JetBrains.

the class JavaFXRenameTest method doTestPropertyRenameHandler.

public void doTestPropertyRenameHandler(String... files) throws Exception {
    myFixture.configureByFiles(files);
    final MapDataContext dataContext = new MapDataContext();
    dataContext.put(CommonDataKeys.EDITOR, getEditor());
    final RenameHandler renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(dataContext);
    assertTrue(renameHandler instanceof JavaFxPropertyRenameHandler);
}
Also used : JavaFxPropertyRenameHandler(org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyRenameHandler) MapDataContext(com.intellij.testFramework.MapDataContext) PsiElementRenameHandler(com.intellij.refactoring.rename.PsiElementRenameHandler) JavaFxPropertyRenameHandler(org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyRenameHandler) MemberInplaceRenameHandler(com.intellij.refactoring.rename.inplace.MemberInplaceRenameHandler) RenameHandler(com.intellij.refactoring.rename.RenameHandler)

Example 2 with JavaFxPropertyRenameHandler

use of org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyRenameHandler in project intellij-community by JetBrains.

the class JavaFXRenameTest method doTestStaticProperty.

public void doTestStaticProperty(@NonNls String newName, String className) throws Exception {
    myFixture.configureByFiles(getTestName(true) + ".fxml", className.replace('.', '/') + ".java");
    final MapDataContext dataContext = new MapDataContext();
    dataContext.put(CommonDataKeys.EDITOR, getEditor());
    dataContext.put(PsiElementRenameHandler.DEFAULT_NAME, newName);
    final JavaFxPropertyRenameHandler renameHandler = new JavaFxPropertyRenameHandler();
    assertTrue(renameHandler.isAvailableOnDataContext(dataContext));
    renameHandler.invoke(getProject(), getEditor(), null, dataContext);
    myFixture.checkResultByFile(getTestName(true) + "_after.fxml");
    final PsiClass psiClass = myFixture.findClass(className);
    assertNotNull(psiClass);
    final String propName = newName.substring(0, 1).toUpperCase() + newName.substring(1);
    assertMethodExists(psiClass, "set" + propName);
}
Also used : JavaFxPropertyRenameHandler(org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyRenameHandler) MapDataContext(com.intellij.testFramework.MapDataContext) PsiClass(com.intellij.psi.PsiClass)

Example 3 with JavaFxPropertyRenameHandler

use of org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyRenameHandler in project intellij-community by JetBrains.

the class JavaFXRenameTest method doTestHandler.

@NotNull
public PsiClass doTestHandler(String newName, String className) throws Exception {
    if (className == null) {
        className = getTestName(false);
        myFixture.configureByFiles(getTestName(true) + ".fxml", getTestName(false) + ".java");
    } else {
        myFixture.configureByFiles(getTestName(true) + ".fxml", getTestName(false) + ".java", className.replace('.', '/') + ".java");
    }
    final MapDataContext dataContext = new MapDataContext();
    dataContext.put(CommonDataKeys.EDITOR, getEditor());
    dataContext.put(PsiElementRenameHandler.DEFAULT_NAME, newName);
    final JavaFxPropertyRenameHandler renameHandler = new JavaFxPropertyRenameHandler();
    assertTrue(renameHandler.isAvailableOnDataContext(dataContext));
    renameHandler.invoke(getProject(), getEditor(), null, dataContext);
    myFixture.checkResultByFile(getTestName(true) + "_after.fxml");
    final PsiClass psiClass = myFixture.findClass(className);
    assertNotNull(psiClass);
    return psiClass;
}
Also used : JavaFxPropertyRenameHandler(org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyRenameHandler) MapDataContext(com.intellij.testFramework.MapDataContext) PsiClass(com.intellij.psi.PsiClass) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

MapDataContext (com.intellij.testFramework.MapDataContext)3 JavaFxPropertyRenameHandler (org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyRenameHandler)3 PsiClass (com.intellij.psi.PsiClass)2 PsiElementRenameHandler (com.intellij.refactoring.rename.PsiElementRenameHandler)1 RenameHandler (com.intellij.refactoring.rename.RenameHandler)1 MemberInplaceRenameHandler (com.intellij.refactoring.rename.inplace.MemberInplaceRenameHandler)1 NotNull (org.jetbrains.annotations.NotNull)1