rename file: move to java/groovy
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Tue, 31 Jan 2012 14:10:45 +0000 (18:10 +0400)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Tue, 31 Jan 2012 15:55:50 +0000 (19:55 +0400)
java/java-impl/src/com/intellij/refactoring/actions/RenameFileAction.java [moved from platform/lang-impl/src/com/intellij/refactoring/rename/RenameFileAction.java with 82% similarity]
platform/platform-resources/src/idea/LangActions.xml
resources/src/idea/JavaActions.xml

similarity index 82%
rename from platform/lang-impl/src/com/intellij/refactoring/rename/RenameFileAction.java
rename to java/java-impl/src/com/intellij/refactoring/actions/RenameFileAction.java
index a0aa127ec7b17f9db4a77168331a42fab287ea57..1e0008cb867df82a4c5a1c3f2c77702f4f06c4b3 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.refactoring.rename;
+package com.intellij.refactoring.actions;
 
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiClassOwner;
 import com.intellij.psi.PsiFile;
+import com.intellij.refactoring.rename.PsiElementRenameHandler;
 
 /**
  * @author ven
@@ -34,13 +36,13 @@ public class RenameFileAction extends AnAction implements DumbAware {
     assert virtualFile != null;
     final Project project = e.getData(PlatformDataKeys.PROJECT);
     assert project != null;
-    new RenameDialog(project, file, file, null).show();
+    PsiElementRenameHandler.invoke(file, project, file, null);
   }
 
   public void update(AnActionEvent e) {
     PsiFile file = e.getData(LangDataKeys.PSI_FILE);
     Presentation presentation = e.getPresentation();
-    boolean enabled = file != null && e.getPlace() != ActionPlaces.EDITOR_POPUP && e.getData(PlatformDataKeys.PROJECT) != null;
+    boolean enabled = file instanceof PsiClassOwner && e.getPlace() != ActionPlaces.EDITOR_POPUP && e.getData(PlatformDataKeys.PROJECT) != null;
     presentation.setEnabled(enabled);
     presentation.setVisible(enabled);
     if (enabled) {
index 4e5cd27f0bfdc34327679166387b33342e356424..55c7d4b531c0a1d1ca3f3c1e6442aeaa953e6892 100644 (file)
               class = "com.intellij.refactoring.actions.RefactoringQuickListPopupAction"
               text = "Refactor This..." description="Context aware popup with list of refactoring actions"/>
       <action id="RenameElement" class="com.intellij.refactoring.actions.RenameElementAction"/>
-      <action id="RenameFile" class="com.intellij.refactoring.rename.RenameFileAction"/>
       <action id="ChangeSignature" class="com.intellij.refactoring.actions.ChangeSignatureAction"/>
       <separator/>
       <action id="Move" class="com.intellij.refactoring.actions.MoveAction"/>
       <separator/>
       <reference ref="AddToFavorites"/>
       <reference ref="AddAllToFavorites"/>
-      <separator/>
-      <reference ref="RenameFile"/>
-      <separator/>
       <reference ref="MoveToChangeList"/>
       <separator/>
       <reference ref="RunContextPopupGroup"/>
index 9ba1550421eee14f62eecbded71d1437e5f55d5c..675fcf4d20225bdff65201269f9b5f71e9d2a66c 100644 (file)
       <add-to-group group-id="IntroduceActionsGroup" anchor="after" relative-to-action="IntroduceParameter"/>
     </action>
 
+    <action id="RenameFile" class="com.intellij.refactoring.actions.RenameFileAction">
+      <add-to-group group-id="RefactoringMenu" anchor="after" relative-to-action="RenameElement"/>
+      <add-to-group group-id="EditorTabPopupMenuEx" anchor="after" relative-to-action="AddAllToFavorites"/>
+    </action>
+
     <group id="RefactoringMenu4">
       <action id="TurnRefsToSuper" class="com.intellij.refactoring.actions.TurnRefsToSuperAction"/>
       <action id="InheritanceToDelegation" class="com.intellij.refactoring.actions.InheritanceToDelegationAction"/>