當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。