@Nullable
  private MoveDestination selectDestination() {
    final String packageName = getTargetPackage().trim();
    if (packageName.length() > 0
        && !JavaPsiFacade.getInstance(myManager.getProject())
            .getNameHelper()
            .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 != 0) return null;
    }

    return ((DestinationFolderComboBox) myDestinationFolderCB).selectDirectory(targetPackage, true);
  }
Exemplo n.º 2
0
 public void addCachingContext(String path, String cacheKey, CachingContext ctx) {
   PackageWrapper packageWrapper = getPackage(path);
   if (packageWrapper == null) {
     packageWrapper = new PackageWrapper();
     addPackage(path, packageWrapper);
   }
   packageWrapper.addCachingContext(cacheKey, ctx);
 }
Exemplo n.º 3
0
 private static String getClassName(TenantWrapper tenant, ScriptCachingContext sctx)
     throws ScriptException {
   String filteredPath = getPackage(sctx.getContext(), sctx.getPath());
   PackageWrapper packageWrapper = tenant.getPath(sctx);
   long classIndex = packageWrapper.getClassIndex();
   packageWrapper.setClassIndex(classIndex + 1);
   return PACKAGE_NAME + filteredPath + ".c" + classIndex;
 }
Exemplo n.º 4
0
 public void removeCachingContext(String path, String cacheKey) {
   PackageWrapper packageWrapper = getPackage(path);
   if (packageWrapper == null) {
     return;
   }
   packageWrapper.removeCachingContext(cacheKey);
   if (packageWrapper.getCachingContextCount() == 0) {
     removePackage(path);
   }
 }