@Nullable
  private MoveDestination selectDestination() {
    final String packageName = getTargetPackage().trim();
    if (packageName.length() > 0
        && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(packageName)) {
      Messages.showErrorDialog(
          myProject,
          RefactoringBundle.message("please.enter.a.valid.target.package.name"),
          RefactoringBundle.message("move.title"));
      return null;
    }
    RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, packageName);
    PackageWrapper targetPackage = new PackageWrapper(myManager, packageName);
    if (!targetPackage.exists()) {
      final int ret =
          Messages.showYesNoDialog(
              myProject,
              RefactoringBundle.message("package.does.not.exist", packageName),
              RefactoringBundle.message("move.title"),
              Messages.getQuestionIcon());
      if (ret != Messages.YES) return null;
    }

    return ((DestinationFolderComboBox) myDestinationFolderCB)
        .selectDirectory(targetPackage, mySuggestToMoveToAnotherRoot);
  }
Exemple #2
0
 public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
   switch (columnIndex) {
     case CHECKMARK_COLUMN:
       {
         getVariableData()[rowIndex].passAsParameter = ((Boolean) aValue).booleanValue();
         fireTableRowsUpdated(rowIndex, rowIndex);
         myTable.getSelectionModel().setSelectionInterval(rowIndex, rowIndex);
         updateSignature();
         break;
       }
     case PARAMETER_NAME_COLUMN:
       {
         VariableData data = getVariableData()[rowIndex];
         String name = (String) aValue;
         if (PsiNameHelper.getInstance(myProject).isIdentifier(name)) {
           data.name = name;
         }
         updateSignature();
         break;
       }
     case PARAMETER_TYPE_COLUMN:
       {
         VariableData data = getVariableData()[rowIndex];
         data.type = (PsiType) aValue;
         updateSignature();
         break;
       }
   }
 }
Exemple #3
0
 @Override
 protected void canRun() throws ConfigurationException {
   String name = getParameterName();
   if (name == null || !PsiNameHelper.getInstance(myProject).isIdentifier(name)) {
     throw new ConfigurationException(
         "\'" + (name != null ? name : "") + "\' is invalid parameter name");
   }
 }
 @Override
 protected void canRun() throws ConfigurationException {
   if (isMoveToPackage()) {
     String name = getTargetPackage().trim();
     if (name.length() != 0
         && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(name)) {
       throw new ConfigurationException("\'" + name + "\' is invalid destination package name");
     }
   } else {
     if (findTargetClass() == null)
       throw new ConfigurationException("Destination class not found");
     final String validationError = verifyInnerClassDestination();
     if (validationError != null) throw new ConfigurationException(validationError);
   }
 }