generify: JavaDocPolicy -> DocCommentPolicy
authorKirill Safonov <kirill.safonov@swiftteams.com>
Fri, 11 Sep 2009 11:56:11 +0000 (15:56 +0400)
committerKirill Safonov <kirill.safonov@swiftteams.com>
Fri, 11 Sep 2009 11:56:11 +0000 (15:56 +0400)
20 files changed:
java/java-impl/src/com/intellij/refactoring/extractInterface/ExtractInterfaceDialog.java
java/java-impl/src/com/intellij/refactoring/extractInterface/ExtractInterfaceHandler.java
java/java-impl/src/com/intellij/refactoring/extractInterface/ExtractInterfaceProcessor.java
java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperBaseDialog.java
java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperBaseProcessor.java
java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperClassProcessor.java
java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperClassUtil.java
java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperclassDialog.java
java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperclassHandler.java
java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringProcessor.java
java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHandler.java
java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpDialog.java
java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpHelper.java
java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownDialog.java
java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java
java/java-tests/testSrc/com/intellij/refactoring/ExtractSuperClassTest.java
java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java
platform/lang-impl/src/com/intellij/refactoring/ui/DocCommentPanel.java [moved from java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaDocPanel.java with 84% similarity]
platform/lang-impl/src/com/intellij/refactoring/util/DocCommentPolicy.java [moved from java/java-impl/src/com/intellij/refactoring/util/JavaDocPolicy.java with 69% similarity]
refactoring/tests/com/intellij/refactoring/PushDownTest.java

index 4bf06e690f43bdcc326b57f5f0e896580baa3097..80b14abfbf07fdf3392d463b40963b888bb5ce1f 100644 (file)
@@ -11,7 +11,7 @@ import com.intellij.refactoring.classMembers.MemberInfoBase;
 import com.intellij.refactoring.extractSuperclass.ExtractSuperBaseDialog;
 import com.intellij.refactoring.extractSuperclass.ExtractSuperBaseProcessor;
 import com.intellij.refactoring.ui.MemberSelectionPanel;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 
 import javax.swing.*;
@@ -191,11 +191,11 @@ class ExtractInterfaceDialog extends ExtractSuperBaseDialog {
   protected ExtractSuperBaseProcessor createProcessor() {
     return new ExtractInterfaceProcessor(myProject, false, getTargetDirectory(), getExtractedSuperName(),
                                          mySourceClass, getSelectedMembers(),
-                                         new JavaDocPolicy(getJavaDocPolicy()));
+                                         new DocCommentPolicy(getJavaDocPolicy()));
   }
 
   @Override
   protected String getHelpId() {
     return HelpID.EXTRACT_INTERFACE;
   }
-}
\ No newline at end of file
+}
index 5b634f2bcc09a317d7be69e7f8f8c5fa0145d5f5..1bb22c32b850cc5322618226c4eb76f65cf1792e 100644 (file)
@@ -17,7 +17,7 @@ import com.intellij.refactoring.extractSuperclass.ExtractSuperClassUtil;
 import com.intellij.refactoring.lang.ElementsHandler;
 import com.intellij.refactoring.memberPullUp.PullUpHelper;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.usageView.UsageViewUtil;
 import com.intellij.util.IncorrectOperationException;
@@ -35,7 +35,7 @@ public class ExtractInterfaceHandler implements RefactoringActionHandler, Elemen
   private String myInterfaceName;
   private MemberInfo[] mySelectedMembers;
   private PsiDirectory myTargetDir;
-  private JavaDocPolicy myJavaDocPolicy;
+  private DocCommentPolicy myJavaDocPolicy;
 
   public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
     int offset = editor.getCaretModel().getOffset();
@@ -75,7 +75,7 @@ public class ExtractInterfaceHandler implements RefactoringActionHandler, Elemen
             myInterfaceName = dialog.getExtractedSuperName();
             mySelectedMembers = dialog.getSelectedMembers();
             myTargetDir = dialog.getTargetDirectory();
-            myJavaDocPolicy = new JavaDocPolicy(dialog.getJavaDocPolicy());
+            myJavaDocPolicy = new DocCommentPolicy(dialog.getJavaDocPolicy());
             try {
               doRefactoring();
             }
@@ -109,7 +109,7 @@ public class ExtractInterfaceHandler implements RefactoringActionHandler, Elemen
                                    PsiClass aClass,
                                    String interfaceName,
                                    MemberInfo[] selectedMembers,
-                                   JavaDocPolicy javaDocPolicy) throws IncorrectOperationException {
+                                   DocCommentPolicy javaDocPolicy) throws IncorrectOperationException {
     PsiClass anInterface = JavaDirectoryService.getInstance().createInterface(targetDir, interfaceName);
     PsiJavaCodeReferenceElement ref = ExtractSuperClassUtil.createExtendingReference(anInterface, aClass, selectedMembers);
     final PsiReferenceList referenceList = aClass.isInterface() ? aClass.getExtendsList() : aClass.getImplementsList();
@@ -127,4 +127,4 @@ public class ExtractInterfaceHandler implements RefactoringActionHandler, Elemen
   public boolean isEnabledOnElements(PsiElement[] elements) {
     return elements.length == 1 && elements[0] instanceof PsiClass;
   }
-}
\ No newline at end of file
+}
index 28d4f111c047ee6b44c74408f98a7f9c62b42ff2..9530114662d646c43ccda9cb23d74f40f7113030 100644 (file)
@@ -3,7 +3,7 @@ package com.intellij.refactoring.extractInterface;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
 import com.intellij.refactoring.extractSuperclass.ExtractSuperBaseProcessor;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.util.IncorrectOperationException;
 
@@ -17,7 +17,7 @@ public class ExtractInterfaceProcessor extends ExtractSuperBaseProcessor {
                String newClassName,
                PsiClass aClass,
                MemberInfo[] memberInfos,
-               JavaDocPolicy javaDocPolicy) {
+               DocCommentPolicy javaDocPolicy) {
     super(project, replaceInstanceOf, targetDirectory, newClassName, aClass, memberInfos, javaDocPolicy);
   }
 
index 49d82831a95bea59ed9c8c2059b0686f58679590..e5515ef2697a5955904f0a4fecf1895faf7dad3e 100644 (file)
@@ -10,7 +10,7 @@ import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.refactoring.RefactoringBundle;
-import com.intellij.refactoring.memberPullUp.JavaDocPanel;
+import com.intellij.refactoring.ui.DocCommentPanel;
 import com.intellij.refactoring.ui.RefactoringDialog;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
 import com.intellij.refactoring.util.RefactoringMessageUtil;
@@ -39,7 +39,7 @@ public abstract class ExtractSuperBaseDialog extends RefactoringDialog {
   protected JTextField mySourceClassField;
   protected JTextField myExtractedSuperNameField;
   protected ReferenceEditorWithBrowseButton myPackageNameField;
-  protected JavaDocPanel myJavaDocPanel;
+  protected DocCommentPanel myJavaDocPanel;
 
 
   public ExtractSuperBaseDialog(Project project, PsiClass sourceClass, List<MemberInfo> members, String refactoringName) {
@@ -59,7 +59,7 @@ public abstract class ExtractSuperBaseDialog extends RefactoringDialog {
     initSourceClassField();
     myExtractedSuperNameField = new JTextField();
 
-    myJavaDocPanel = new JavaDocPanel(getJavaDocPanelName());
+    myJavaDocPanel = new DocCommentPanel(getJavaDocPanelName());
     myJavaDocPanel.setPolicy(getJavaDocPolicySetting());
 
     super.init();
index 0298900533b2cf5b0c5a4e925509b4556c867916..95a8b5ed9b90e389e0c47970370adf8540406063 100644 (file)
@@ -12,7 +12,7 @@ import com.intellij.psi.util.MethodSignatureUtil;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.turnRefsToSuper.TurnRefsToSuperProcessorBase;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.usageView.UsageInfo;
 import com.intellij.usageView.UsageViewDescriptor;
@@ -31,14 +31,14 @@ public abstract class ExtractSuperBaseProcessor extends TurnRefsToSuperProcessor
   protected PsiDirectory myTargetDirectory;
   protected final String myNewClassName;
   protected MemberInfo[] myMemberInfos;
-  protected final JavaDocPolicy myJavaDocPolicy;
+  protected final DocCommentPolicy myJavaDocPolicy;
 
 
   public ExtractSuperBaseProcessor(Project project,
                                    boolean replaceInstanceOf,
                                    PsiDirectory targetDirectory,
                                    String newClassName,
-                                   PsiClass aClass, MemberInfo[] memberInfos, JavaDocPolicy javaDocPolicy) {
+                                   PsiClass aClass, MemberInfo[] memberInfos, DocCommentPolicy javaDocPolicy) {
     super(project, replaceInstanceOf, newClassName);
     myTargetDirectory = targetDirectory;
     myNewClassName = newClassName;
index c226d3fc36b5c9da61943196303ca35998eb447a..638943e36b995e392a60c9ab9c13ed0010921884 100644 (file)
@@ -2,7 +2,7 @@ package com.intellij.refactoring.extractSuperclass;
 
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.util.IncorrectOperationException;
 
@@ -13,7 +13,7 @@ public class ExtractSuperClassProcessor extends ExtractSuperBaseProcessor {
 
   public ExtractSuperClassProcessor(Project project,
                                     PsiDirectory targetDirectory, String newClassName, PsiClass aClass, MemberInfo[] memberInfos, boolean replaceInstanceOf,
-                                    JavaDocPolicy javaDocPolicy) {
+                                    DocCommentPolicy javaDocPolicy) {
     super(project, replaceInstanceOf, targetDirectory, newClassName, aClass, memberInfos, javaDocPolicy);
   }
 
index 327713fe392a97f50ffca81ee7d6225f088571cf..b2e9a8c8153ec72fe9091f628b397f3668d24b86 100644 (file)
@@ -8,7 +8,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
 import com.intellij.psi.util.MethodSignature;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.refactoring.memberPullUp.PullUpHelper;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.RefactoringUtil;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.util.IncorrectOperationException;
@@ -29,7 +29,7 @@ public class ExtractSuperClassUtil {
                                            final String superclassName,
                                            final PsiClass subclass,
                                            final MemberInfo[] selectedMemberInfos,
-                                           final JavaDocPolicy javaDocPolicy)
+                                           final DocCommentPolicy javaDocPolicy)
     throws IncorrectOperationException {
     PsiClass superclass = JavaDirectoryService.getInstance().createClass(targetDirectory, superclassName);
     final PsiModifierList superClassModifierList = superclass.getModifierList();
index 9fcfea5f6d22db7f7ad02f0da1e66cb9f3861877..4054ae20e48f61bcf961171097dbbaa24671f8b4 100644 (file)
@@ -13,7 +13,7 @@ import com.intellij.refactoring.classMembers.MemberInfoChange;
 import com.intellij.refactoring.classMembers.MemberInfoModel;
 import com.intellij.refactoring.memberPullUp.PullUpHelper;
 import com.intellij.refactoring.ui.MemberSelectionPanel;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.InterfaceContainmentVerifier;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.refactoring.util.classMembers.UsesAndInterfacesDependencyMemberInfoModel;
@@ -173,7 +173,7 @@ class ExtractSuperclassDialog extends ExtractSuperBaseDialog {
   protected ExtractSuperBaseProcessor createProcessor() {
     return new ExtractSuperClassProcessor(myProject, getTargetDirectory(), getExtractedSuperName(),
                                           mySourceClass, getSelectedMemberInfos(), false,
-                                          new JavaDocPolicy(getJavaDocPolicy()));
+                                          new DocCommentPolicy(getJavaDocPolicy()));
   }
 
   @Override
index 0751df7799e5be1167247b22b8b285903f49050e..442c9431a9f4b3df63f12ff0ca6ded8693a241f0 100644 (file)
@@ -18,12 +18,12 @@ import com.intellij.psi.*;
 import com.intellij.refactoring.HelpID;
 import com.intellij.refactoring.RefactoringActionHandler;
 import com.intellij.refactoring.RefactoringBundle;
-import com.intellij.refactoring.lang.ElementsHandler;
 import com.intellij.refactoring.extractInterface.ExtractClassUtil;
+import com.intellij.refactoring.lang.ElementsHandler;
 import com.intellij.refactoring.memberPullUp.PullUpConflictsUtil;
 import com.intellij.refactoring.ui.ConflictsDialog;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.usageView.UsageViewUtil;
 import com.intellij.util.IncorrectOperationException;
@@ -130,7 +130,7 @@ public class ExtractSuperclassHandler implements RefactoringActionHandler, Extra
     final String superclassName = dialog.getExtractedSuperName();
     final PsiDirectory targetDirectory = dialog.getTargetDirectory();
     final MemberInfo[] selectedMemberInfos = dialog.getSelectedMemberInfos();
-    final JavaDocPolicy javaDocPolicy = new JavaDocPolicy(dialog.getJavaDocPolicy());
+    final DocCommentPolicy javaDocPolicy = new DocCommentPolicy(dialog.getJavaDocPolicy());
     LocalHistoryAction a = LocalHistory.startAction(myProject, getCommandName(subclass, superclassName));
     try {
       PsiClass superclass = null;
index 5bd6787781f970f424cdd6fe5daf75a71da1af0c..23d5a66e8484f92a08ba79a25c2a8bd13b357314 100644 (file)
@@ -19,7 +19,7 @@ import com.intellij.refactoring.memberPushDown.PushDownConflicts;
 import com.intellij.refactoring.memberPushDown.PushDownProcessor;
 import com.intellij.refactoring.util.FixableUsageInfo;
 import com.intellij.refactoring.util.FixableUsagesRefactoringProcessor;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.refactoring.util.classMembers.MemberInfoStorage;
 import com.intellij.usageView.UsageInfo;
@@ -154,7 +154,7 @@ public class InlineSuperClassRefactoringProcessor extends FixableUsagesRefactori
 
 
   protected void performRefactoring(final UsageInfo[] usages) {
-    new PushDownProcessor(mySuperClass.getProject(), myMemberInfos, mySuperClass, new JavaDocPolicy(JavaDocPolicy.ASIS)).run();
+    new PushDownProcessor(mySuperClass.getProject(), myMemberInfos, mySuperClass, new DocCommentPolicy(DocCommentPolicy.ASIS)).run();
     replaceInnerTypeUsages();
     super.performRefactoring(usages);
     try {
index 018fa8b47a790c531ad7a3f2c9f3d66d8c26f924..d5cdc429d54aba8a78c9c6177a0c90a521a7664d 100644 (file)
@@ -26,7 +26,7 @@ import com.intellij.refactoring.classMembers.MemberInfoBase;
 import com.intellij.refactoring.lang.ElementsHandler;
 import com.intellij.refactoring.ui.ConflictsDialog;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.RefactoringHierarchyUtil;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.refactoring.util.classMembers.MemberInfoStorage;
@@ -149,7 +149,7 @@ public class JavaPullUpHandler implements RefactoringActionHandler, PullUpDialog
     try {
       try {
         PullUpHelper helper = new PullUpHelper(mySubclass, dialog.getSuperClass(), dialog.getSelectedMemberInfos(),
-                                               new JavaDocPolicy(dialog.getJavaDocPolicy()));
+                                               new DocCommentPolicy(dialog.getJavaDocPolicy()));
         helper.moveMembersToBase();
         helper.moveFieldInitializations();
       }
index 11101dd92d472b7768702ebc16c830b5231f7070..9aab99378f5269c4235f66bc7052041d261c0627 100644 (file)
@@ -17,6 +17,7 @@ import com.intellij.refactoring.JavaRefactoringSettings;
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.classMembers.MemberInfoChange;
 import com.intellij.refactoring.ui.ClassCellRenderer;
+import com.intellij.refactoring.ui.DocCommentPanel;
 import com.intellij.refactoring.ui.MemberSelectionPanel;
 import com.intellij.refactoring.util.RefactoringHierarchyUtil;
 import com.intellij.refactoring.util.classMembers.InterfaceContainmentVerifier;
@@ -42,7 +43,7 @@ public class PullUpDialog extends DialogWrapper {
   private final List<PsiClass> mySuperClasses;
   private final MemberInfoStorage myMemberInfoStorage;
   private List<MemberInfo> myMemberInfos;
-  private JavaDocPanel myJavaDocPanel;
+  private DocCommentPanel myJavaDocPanel;
 
   private JComboBox myClassCombo;
 
@@ -172,7 +173,7 @@ public class PullUpDialog extends DialogWrapper {
     myMemberSelectionPanel.getTable().addMemberInfoChangeListener(myMemberInfoModel);
     panel.add(myMemberSelectionPanel, BorderLayout.CENTER);
 
-    myJavaDocPanel = new JavaDocPanel(RefactoringBundle.message("javadoc.for.abstracts"));
+    myJavaDocPanel = new DocCommentPanel(RefactoringBundle.message("javadoc.for.abstracts"));
     myJavaDocPanel.setPolicy(JavaRefactoringSettings.getInstance().PULL_UP_MEMBERS_JAVADOC);
     panel.add(myJavaDocPanel, BorderLayout.EAST);
     return panel;
index 146a67d0a905823b06d036b5659cfefce81f0be8..b5d809ebcdfb6db242237cd0cb844a63bb2f4f0e 100644 (file)
@@ -27,7 +27,7 @@ import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.refactoring.listeners.JavaRefactoringListenerManager;
 import com.intellij.refactoring.listeners.impl.JavaRefactoringListenerManagerImpl;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.RefactoringHierarchyUtil;
 import com.intellij.refactoring.util.RefactoringUtil;
 import com.intellij.util.VisibilityUtil;
@@ -45,13 +45,13 @@ public class PullUpHelper {
   private final PsiClass myTargetSuperClass;
   private final boolean myIsTargetInterface;
   private final MemberInfo[] myMembersToMove;
-  private final JavaDocPolicy myJavaDocPolicy;
+  private final DocCommentPolicy myJavaDocPolicy;
   private HashSet<PsiMember> myMembersAfterMove = null;
   private final PsiManager myManager;
 
 
   public PullUpHelper(PsiClass sourceClass, PsiClass targetSuperClass, MemberInfo[] membersToMove,
-                      JavaDocPolicy javaDocPolicy) {
+                      DocCommentPolicy javaDocPolicy) {
     mySourceClass = sourceClass;
     myTargetSuperClass = targetSuperClass;
     myMembersToMove = membersToMove;
index a4c44a7446ed28759b5eb54552714213b53c8a5e..10d689b693c58f225fabbf807a16bb9347886f06 100644 (file)
@@ -10,10 +10,10 @@ import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.classMembers.MemberInfoChange;
 import com.intellij.refactoring.classMembers.MemberInfoModel;
 import com.intellij.refactoring.classMembers.UsedByDependencyMemberInfoModel;
-import com.intellij.refactoring.memberPullUp.JavaDocPanel;
+import com.intellij.refactoring.ui.DocCommentPanel;
 import com.intellij.refactoring.ui.MemberSelectionPanel;
 import com.intellij.refactoring.ui.RefactoringDialog;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 
 import javax.swing.*;
@@ -25,7 +25,7 @@ import java.util.List;
 public class PushDownDialog extends RefactoringDialog {
   private final List<MemberInfo> myMemberInfos;
   private final PsiClass myClass;
-  private JavaDocPanel myJavaDocPanel;
+  private DocCommentPanel myJavaDocPanel;
   private MemberInfoModel<PsiMember, MemberInfo> myMemberInfoModel;
 
   public PushDownDialog(Project project, MemberInfo[] memberInfos, PsiClass aClass) {
@@ -91,7 +91,7 @@ public class PushDownDialog extends RefactoringDialog {
     memberSelectionPanel.getTable().addMemberInfoChangeListener(myMemberInfoModel);
 
 
-    myJavaDocPanel = new JavaDocPanel(RefactoringBundle.message("push.down.javadoc.panel.title"));
+    myJavaDocPanel = new DocCommentPanel(RefactoringBundle.message("push.down.javadoc.panel.title"));
     myJavaDocPanel.setPolicy(JavaRefactoringSettings.getInstance().PULL_UP_MEMBERS_JAVADOC);
     panel.add(myJavaDocPanel, BorderLayout.EAST);
     return panel;
@@ -104,7 +104,7 @@ public class PushDownDialog extends RefactoringDialog {
 
     invokeRefactoring (new PushDownProcessor(
             getProject(), getSelectedMemberInfos(), myClass,
-            new JavaDocPolicy(getJavaDocPolicy())));
+            new DocCommentPolicy(getJavaDocPolicy())));
   }
 
   private class MyMemberInfoModel extends UsedByDependencyMemberInfoModel<PsiMember, PsiClass, MemberInfo> {
index 615785ac14871fa59e76e731cde1f1d7c1ebc281..163ebd4c40ae5fc903b30c69b2d2970d31cf9422 100644 (file)
@@ -17,7 +17,7 @@ import com.intellij.refactoring.BaseRefactoringProcessor;
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.listeners.JavaRefactoringListenerManager;
 import com.intellij.refactoring.listeners.impl.JavaRefactoringListenerManagerImpl;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.RefactoringUtil;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.usageView.UsageInfo;
@@ -32,12 +32,12 @@ public class PushDownProcessor extends BaseRefactoringProcessor {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.memberPushDown.PushDownProcessor");
   private final MemberInfo[] myMemberInfos;
   private PsiClass myClass;
-  private final JavaDocPolicy myJavaDocPolicy;
+  private final DocCommentPolicy myJavaDocPolicy;
 
   public PushDownProcessor(Project project,
                            MemberInfo[] memberInfos,
                            PsiClass aClass,
-                           JavaDocPolicy javaDocPolicy) {
+                           DocCommentPolicy javaDocPolicy) {
     super(project);
     myMemberInfos = memberInfos;
     myClass = aClass;
index c7de553b165cdc098ca01e0c7f73bb18acf8c995..1d91d9530158ea7de2b03a5533373109d8544004 100644 (file)
@@ -11,8 +11,8 @@ import com.intellij.psi.*;
 import com.intellij.psi.impl.source.PostprocessReformattingAspect;
 import com.intellij.psi.search.ProjectScope;
 import com.intellij.refactoring.extractSuperclass.ExtractSuperClassProcessor;
-import com.intellij.refactoring.util.JavaDocPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.PsiTestUtil;
 import org.jetbrains.annotations.NonNls;
@@ -58,7 +58,7 @@ public class ExtractSuperClassTest extends CodeInsightTestCase {
                                                                           newClassName,
                                                                           psiClass, members,
                                                                           false,
-                                                                          new JavaDocPolicy(JavaDocPolicy.ASIS));
+                                                                          new DocCommentPolicy(DocCommentPolicy.ASIS));
     processor.run();
     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
     FileDocumentManager.getInstance().saveAllDocuments();
index be02c8e4ed2451bab3443ca16e03dfb97f4fbe77..9edab2002147d9212e46cfe8127f0b748b26879b 100644 (file)
@@ -11,8 +11,8 @@ import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.listeners.JavaRefactoringListenerManager;
 import com.intellij.refactoring.listeners.MoveMemberListener;
 import com.intellij.refactoring.memberPullUp.PullUpHelper;
-import com.intellij.refactoring.util.JavaDocPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.testFramework.LightCodeInsightTestCase;
 import com.intellij.JavaTestUtil;
 
@@ -65,7 +65,7 @@ public class PullUpTest extends LightCodeInsightTestCase {
       }
     };
     JavaRefactoringListenerManager.getInstance(getProject()).addMoveMembersListener(listener);
-    new PullUpHelper(sourceClass, targetClass, infos, new JavaDocPolicy(JavaDocPolicy.ASIS)).moveMembersToBase();
+    new PullUpHelper(sourceClass, targetClass, infos, new DocCommentPolicy(DocCommentPolicy.ASIS)).moveMembersToBase();
     JavaRefactoringListenerManager.getInstance(getProject()).removeMoveMembersListener(listener);
     assertEquals(countMoved[0], membersToFind.length);
     checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
similarity index 84%
rename from java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaDocPanel.java
rename to platform/lang-impl/src/com/intellij/refactoring/ui/DocCommentPanel.java
index b8327a8a2bed3488a728641d133d1a55e491fa8e..eec5a1ce88f76c7b9f797cbb7b68fb3a2046defd 100644 (file)
@@ -6,9 +6,9 @@
  * To change template for new class use
  * Code Style | Class Templates options (Tools | IDE Options).
  */
-package com.intellij.refactoring.memberPullUp;
+package com.intellij.refactoring.ui;
 
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.ui.IdeBorderFactory;
 
@@ -16,13 +16,13 @@ import javax.swing.*;
 import javax.swing.border.TitledBorder;
 import java.awt.*;
 
-public class JavaDocPanel extends JPanel {
+public class DocCommentPanel extends JPanel {
   private JRadioButton myRbJavaDocAsIs = null;
   private JRadioButton myRbJavaDocMove = null;
   private JRadioButton myRbJavaDocCopy = null;
   private final TitledBorder myBorder;
 
-  public JavaDocPanel(String title) {
+  public DocCommentPanel(String title) {
     setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
     myBorder = IdeBorderFactory.createTitledBorder(title);
     this.setBorder(myBorder);
@@ -59,10 +59,10 @@ public class JavaDocPanel extends JPanel {
   }
 
   public void setPolicy(final int javaDocPolicy) {
-    if (javaDocPolicy == JavaDocPolicy.COPY) {
+    if (javaDocPolicy == DocCommentPolicy.COPY) {
       myRbJavaDocCopy.setSelected(true);
     }
-    else if (javaDocPolicy == JavaDocPolicy.MOVE) {
+    else if (javaDocPolicy == DocCommentPolicy.MOVE) {
       myRbJavaDocMove.setSelected(true);
     }
     else {
@@ -72,12 +72,12 @@ public class JavaDocPanel extends JPanel {
 
   public int getPolicy() {
     if (myRbJavaDocCopy != null && myRbJavaDocCopy.isSelected()) {
-      return JavaDocPolicy.COPY;
+      return DocCommentPolicy.COPY;
     }
     if (myRbJavaDocMove != null && myRbJavaDocMove.isSelected()) {
-      return JavaDocPolicy.MOVE;
+      return DocCommentPolicy.MOVE;
     }
 
-    return JavaDocPolicy.ASIS;
+    return DocCommentPolicy.ASIS;
   }
 }
similarity index 69%
rename from java/java-impl/src/com/intellij/refactoring/util/JavaDocPolicy.java
rename to platform/lang-impl/src/com/intellij/refactoring/util/DocCommentPolicy.java
index 5b2de7043072e3b63ee11ff6c1784ac6b1cbbff2..7c2686ce50c513a7f6697138c952adf997ac0dd4 100644 (file)
@@ -8,21 +8,21 @@
  */
 package com.intellij.refactoring.util;
 
-import com.intellij.psi.javadoc.PsiDocComment;
+import com.intellij.psi.PsiComment;
 import com.intellij.util.IncorrectOperationException;
 
-public class JavaDocPolicy {
+public class DocCommentPolicy<T extends PsiComment> {
   public static final int ASIS = 0;
   public static final int MOVE = 1;
   public static final int COPY = 2;
 
   private final int myJavaDocPolicy;
 
-  public JavaDocPolicy(int javaDocPolicy) {
+  public DocCommentPolicy(int javaDocPolicy) {
     myJavaDocPolicy = javaDocPolicy;
   }
 
-  public void processCopiedJavaDoc(PsiDocComment newDocComment, PsiDocComment docComment, boolean willOldBeDeletedAnyway)
+  public void processCopiedJavaDoc(T newDocComment, T docComment, boolean willOldBeDeletedAnyway)
           throws IncorrectOperationException{
     if(myJavaDocPolicy == COPY || docComment == null) return;
 
@@ -34,13 +34,13 @@ public class JavaDocPolicy {
     }
   }
 
-  public void processNewJavaDoc(PsiDocComment newDocComment) throws IncorrectOperationException {
+  public void processNewJavaDoc(T newDocComment) throws IncorrectOperationException {
     if(myJavaDocPolicy == ASIS && newDocComment != null) {
       newDocComment.delete();
     }
   }
 
-  public void processOldJavaDoc(PsiDocComment oldDocComment) throws IncorrectOperationException {
+  public void processOldJavaDoc(T oldDocComment) throws IncorrectOperationException {
     if(myJavaDocPolicy == MOVE && oldDocComment != null) {
       oldDocComment.delete();
     }
index 7c9a5ab8919330c75b36f0753a93eb8aa057a0a1..70a78a4021bb4d1dce631f218e2661479c13ef7a 100644 (file)
@@ -7,7 +7,7 @@ package com.intellij.refactoring;
 import com.intellij.codeInsight.TargetElementUtilBase;
 import com.intellij.psi.*;
 import com.intellij.refactoring.memberPushDown.PushDownProcessor;
-import com.intellij.refactoring.util.JavaDocPolicy;
+import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.testFramework.LightCodeInsightTestCase;
 
@@ -45,7 +45,8 @@ public class PushDownTest extends LightCodeInsightTestCase {
     memberInfo.setChecked(true);
     membersToMove.add(memberInfo);
 
-    new PushDownProcessor(getProject(), membersToMove.toArray(new MemberInfo[membersToMove.size()]), classes[0], new JavaDocPolicy(JavaDocPolicy.ASIS)){
+    new PushDownProcessor(getProject(), membersToMove.toArray(new MemberInfo[membersToMove.size()]), classes[0], new DocCommentPolicy(
+      DocCommentPolicy.ASIS)){
       @Override
       protected boolean showConflicts(final List<String> conflicts) {
         if (failure ? conflicts.isEmpty() : !conflicts.isEmpty()) {
@@ -81,4 +82,4 @@ public class PushDownTest extends LightCodeInsightTestCase {
   public void testFieldAndStaticReferencedClass() throws Exception {
     doTest();
   }
-}
\ No newline at end of file
+}