Search in sources :

Example 6 with RenameDialog

use of com.intellij.refactoring.rename.RenameDialog in project intellij-community by JetBrains.

the class MavenPropertyRenameHandler method invoke.

@Override
public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
    PsiElement element = elements.length == 1 ? elements[0] : null;
    if (element == null)
        element = findTarget(dataContext);
    RenameDialog.showRenameDialog(dataContext, new RenameDialog(project, element, null, CommonDataKeys.EDITOR.getData(dataContext)));
}
Also used : RenameDialog(com.intellij.refactoring.rename.RenameDialog) PsiElement(com.intellij.psi.PsiElement)

Example 7 with RenameDialog

use of com.intellij.refactoring.rename.RenameDialog in project intellij by bazelbuild.

the class RenameRefactoringTest method testRenameSuggestionForSkylarkFile.

@Test
public void testRenameSuggestionForSkylarkFile() {
    BuildFile buildFile = createBuildFile(new WorkspacePath("java/com/google/tools/build_defs.bzl"));
    RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(buildFile);
    RenameDialog dialog = processor.createRenameDialog(getProject(), buildFile, buildFile, null);
    String[] suggestions = dialog.getSuggestedNames();
    assertThat(suggestions[0]).isEqualTo("build_defs.bzl");
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) RenamePsiElementProcessor(com.intellij.refactoring.rename.RenamePsiElementProcessor) RenameDialog(com.intellij.refactoring.rename.RenameDialog) Test(org.junit.Test)

Aggregations

RenameDialog (com.intellij.refactoring.rename.RenameDialog)7 PsiElement (com.intellij.psi.PsiElement)4 BuildFile (com.google.idea.blaze.base.lang.buildfile.psi.BuildFile)2 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)2 RenamePsiElementProcessor (com.intellij.refactoring.rename.RenamePsiElementProcessor)2 Test (org.junit.Test)2 ConfiguredThemeEditorStyle (com.android.tools.idea.editors.theme.datamodels.ConfiguredThemeEditorStyle)1 Module (com.intellij.openapi.module.Module)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 ValueResourceElementWrapper (org.jetbrains.android.dom.wrappers.ValueResourceElementWrapper)1 NotNull (org.jetbrains.annotations.NotNull)1