当前位置: 首页>>代码示例>>Java>>正文


Java MoveClassesOrPackagesCallback类代码示例

本文整理汇总了Java中com.intellij.refactoring.move.MoveClassesOrPackagesCallback的典型用法代码示例。如果您正苦于以下问题:Java MoveClassesOrPackagesCallback类的具体用法?Java MoveClassesOrPackagesCallback怎么用?Java MoveClassesOrPackagesCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MoveClassesOrPackagesCallback类属于com.intellij.refactoring.move包,在下文中一共展示了MoveClassesOrPackagesCallback类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performPsiSpoilingRefactoring

import com.intellij.refactoring.move.MoveClassesOrPackagesCallback; //导入依赖的package包/类
protected void performPsiSpoilingRefactoring() {
  RenameUtil.renameNonCodeUsages(myProject, myNonCodeUsages);
  if (myMoveCallback != null) {
    if (myMoveCallback instanceof MoveClassesOrPackagesCallback) {
      ((MoveClassesOrPackagesCallback) myMoveCallback).classesOrPackagesMoved(myMoveDestination);
    }
    myMoveCallback.refactoringCompleted();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MoveClassesOrPackagesProcessor.java

示例2: performPsiSpoilingRefactoring

import com.intellij.refactoring.move.MoveClassesOrPackagesCallback; //导入依赖的package包/类
protected void performPsiSpoilingRefactoring() {
  if (myNonCodeUsages != null) {
    RenameUtil.renameNonCodeUsages(myProject, myNonCodeUsages);
  }
  if (myMoveCallback != null) {
    if (myMoveCallback instanceof MoveClassesOrPackagesCallback) {
      ((MoveClassesOrPackagesCallback) myMoveCallback).classesMovedToInner(myTargetClass);
    }
    myMoveCallback.refactoringCompleted();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MoveClassToInnerProcessor.java

示例3: setData

import com.intellij.refactoring.move.MoveClassesOrPackagesCallback; //导入依赖的package包/类
public void setData(PsiElement[] psiElements,
                    String targetPackageName,
                    PsiDirectory initialTargetDirectory,
                    boolean isTargetDirectoryFixed,
                    boolean suggestToMoveToAnotherRoot,
                    boolean searchInComments,
                    boolean searchForTextOccurences,
                    String helpID) {
  myTargetDirectoryFixed = isTargetDirectoryFixed;
  mySuggestToMoveToAnotherRoot = suggestToMoveToAnotherRoot;
  if (targetPackageName.length() != 0) {
    myWithBrowseButtonReference.prependItem(targetPackageName);
    myClassPackageChooser.prependItem(targetPackageName);
  }

  String nameFromCallback = myMoveCallback instanceof MoveClassesOrPackagesCallback
                            ? ((MoveClassesOrPackagesCallback)myMoveCallback).getElementsToMoveName()
                            : null;
  if (nameFromCallback != null) {
    myNameLabel.setText(nameFromCallback);
  }
  else if (psiElements.length == 1) {
    PsiElement firstElement = psiElements[0];
    if (firstElement instanceof PsiClass) {
      LOG.assertTrue(!MoveClassesOrPackagesImpl.isClassInnerOrLocal((PsiClass)firstElement));
    }
    else {
      PsiElement parent = firstElement.getParent();
      LOG.assertTrue(parent != null);
    }
    myNameLabel.setText(RefactoringBundle.message("move.single.class.or.package.name.label", UsageViewUtil.getType(firstElement),
                                                  UsageViewUtil.getLongName(firstElement)));
  }
  else if (psiElements.length > 1) {
    myNameLabel.setText(psiElements[0] instanceof PsiClass
                        ? RefactoringBundle.message("move.specified.classes")
                        : RefactoringBundle.message("move.specified.packages"));
  }
  selectInitialCard();

  myCbSearchInComments.setSelected(searchInComments);
  myCbSearchTextOccurences.setSelected(searchForTextOccurences);

  if (initialTargetDirectory != null && 
      JavaMoveClassesOrPackagesHandler.packageHasMultipleDirectoriesInModule(myProject, initialTargetDirectory)) {
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
    final Set<VirtualFile> initialRoots = new HashSet<VirtualFile>();
    collectSourceRoots(psiElements, fileIndex, initialRoots);
    if (initialRoots.size() > 1) {
      initialTargetDirectory = null;
    }
  }
  ((DestinationFolderComboBox)myDestinationFolderCB).setData(myProject, initialTargetDirectory,
                                                             new Pass<String>() {
                                                               @Override
                                                               public void pass(String s) {
                                                                 setErrorText(s);
                                                               }
                                                             }, myHavePackages ? myWithBrowseButtonReference.getChildComponent() : myClassPackageChooser.getChildComponent());
  UIUtil.setEnabled(myTargetPanel, !getSourceRoots().isEmpty() && isMoveToPackage() && !isTargetDirectoryFixed, true);
  validateButtons();
  myHelpID = helpID;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:64,代码来源:MoveClassesOrPackagesDialog.java

示例4: setData

import com.intellij.refactoring.move.MoveClassesOrPackagesCallback; //导入依赖的package包/类
public void setData(PsiElement[] psiElements,
                    String targetPackageName,
                    PsiDirectory initialTargetDirectory,
                    boolean isTargetDirectoryFixed,
                    boolean suggestToMoveToAnotherRoot,
                    boolean searchInComments,
                    boolean searchForTextOccurences,
                    String helpID) {
  myTargetDirectoryFixed = isTargetDirectoryFixed;
  mySuggestToMoveToAnotherRoot = suggestToMoveToAnotherRoot;
  if (targetPackageName.length() != 0) {
    myWithBrowseButtonReference.prependItem(targetPackageName);
    myClassPackageChooser.prependItem(targetPackageName);
  }

  String nameFromCallback = myMoveCallback instanceof MoveClassesOrPackagesCallback
                            ? ((MoveClassesOrPackagesCallback)myMoveCallback).getElementsToMoveName()
                            : null;
  if (nameFromCallback != null) {
    myNameLabel.setText(nameFromCallback);
  }
  else if (psiElements.length == 1) {
    PsiElement firstElement = psiElements[0];
    if (firstElement instanceof PsiClass) {
      LOG.assertTrue(!MoveClassesOrPackagesImpl.isClassInnerOrLocal((PsiClass)firstElement));
    }
    else {
      PsiElement parent = firstElement.getParent();
      LOG.assertTrue(parent != null);
    }
    myNameLabel.setText(RefactoringBundle.message("move.single.class.or.package.name.label", UsageViewUtil.getType(firstElement),
                                                  UsageViewUtil.getLongName(firstElement)));
  }
  else if (psiElements.length > 1) {
    myNameLabel.setText(psiElements[0] instanceof PsiClass
                        ? RefactoringBundle.message("move.specified.classes")
                        : RefactoringBundle.message("move.specified.packages"));
  }
  selectInitialCard();

  myCbSearchInComments.setSelected(searchInComments);
  myCbSearchTextOccurences.setSelected(searchForTextOccurences);

  if (initialTargetDirectory != null && 
      JavaMoveClassesOrPackagesHandler.packageHasMultipleDirectoriesInModule(myProject, initialTargetDirectory)) {
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
    final Set<VirtualFile> initialRoots = new HashSet<VirtualFile>();
    collectSourceRoots(psiElements, fileIndex, initialRoots);
    if (initialRoots.size() > 1) {
      initialTargetDirectory = null;
    }
  }
  ((DestinationFolderComboBox)myDestinationFolderCB).setData(myProject, initialTargetDirectory,
                                                             new Pass<String>() {
                                                               @Override
                                                               public void pass(String s) {
                                                                 setErrorText(s);
                                                               }
                                                             }, myHavePackages ? myWithBrowseButtonReference.getChildComponent() : myClassPackageChooser.getChildComponent());
  UIUtil.setEnabled(myTargetPanel, getSourceRoots().length > 0 && isMoveToPackage() && !isTargetDirectoryFixed, true);
  validateButtons();
  myHelpID = helpID;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:64,代码来源:MoveClassesOrPackagesDialog.java

示例5: setData

import com.intellij.refactoring.move.MoveClassesOrPackagesCallback; //导入依赖的package包/类
public void setData(PsiElement[] psiElements,
                    String targetPackageName,
                    PsiDirectory initialTargetDirectory,
                    boolean isTargetDirectoryFixed,
                    boolean suggestToMoveToAnotherRoot,
                    boolean searchInComments,
                    boolean searchForTextOccurences,
                    String helpID) {
  myTargetDirectoryFixed = isTargetDirectoryFixed;
  mySuggestToMoveToAnotherRoot = suggestToMoveToAnotherRoot;
  if (targetPackageName.length() != 0) {
    myWithBrowseButtonReference.prependItem(targetPackageName);
    myClassPackageChooser.prependItem(targetPackageName);
  }

  String nameFromCallback = myMoveCallback instanceof MoveClassesOrPackagesCallback
                            ? ((MoveClassesOrPackagesCallback)myMoveCallback).getElementsToMoveName()
                            : null;
  if (nameFromCallback != null) {
    myNameLabel.setText(nameFromCallback);
  }
  else if (psiElements.length == 1) {
    PsiElement firstElement = psiElements[0];
    if (firstElement instanceof PsiClass) {
      LOG.assertTrue(!MoveClassesOrPackagesImpl.isClassInnerOrLocal((PsiClass)firstElement));
    }
    else {
      PsiElement parent = firstElement.getParent();
      LOG.assertTrue(parent != null);
    }
    myNameLabel.setText(RefactoringBundle.message("move.single.class.or.package.name.label", UsageViewUtil.getType(firstElement),
                                                  UsageViewUtil.getLongName(firstElement)));
  }
  else if (psiElements.length > 1) {
    myNameLabel.setText(psiElements[0] instanceof PsiClass
                        ? RefactoringBundle.message("move.specified.classes")
                        : RefactoringBundle.message("move.specified.packages"));
  }
  selectInitialCard();

  myCbSearchInComments.setSelected(searchInComments);
  myCbSearchTextOccurences.setSelected(searchForTextOccurences);

  if (initialTargetDirectory != null && 
      JavaMoveClassesOrPackagesHandler.packageHasMultipleDirectoriesInModule(myProject, initialTargetDirectory)) {
    initialTargetDirectory = null;
  }
  ((DestinationFolderComboBox)myDestinationFolderCB).setData(myProject, initialTargetDirectory,
                                                             new Pass<String>() {
                                                               @Override
                                                               public void pass(String s) {
                                                                 setErrorText(s);
                                                               }
                                                             }, myHavePackages ? myWithBrowseButtonReference.getChildComponent() : myClassPackageChooser.getChildComponent());
  UIUtil.setEnabled(myTargetPanel, getSourceRoots().length > 0 && isMoveToPackage() && !isTargetDirectoryFixed, true);
  validateButtons();
  myHelpID = helpID;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:59,代码来源:MoveClassesOrPackagesDialog.java


注:本文中的com.intellij.refactoring.move.MoveClassesOrPackagesCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。