Exemplo n.º 1
0
 @Override
 protected RefactoringStatus checkConditionsAfterNameSetting(IProgressMonitor pm) {
   RefactoringStatus status = new RefactoringStatus();
   ProjectUtil projectUtil = getProjectUtil();
   newFileName = projectUtil.appendFileExtension(info.getNewName());
   NesCComponentNameCollissionDetector detector = new NesCComponentNameCollissionDetector();
   detector.handleCollisions4NewFileName(
       newFileName, declaringIdentifier, declaringFile, getProjectUtil(), status, pm);
   try { // Handle Collisions in affected configurations.
     for (IFile file : affectedIdentifiers.keySet()) {
       if (!declaringFile.equals(file)) { // The component itself cannot reference itself.
         AstAnalyzerFactory factory = new AstAnalyzerFactory(file, projectUtil, pm);
         if (factory
             .hasConfigurationAnalyzerCreated()) { // Only configurations can reference other
                                                   // modules.
           detector.handleCollisions4NewComponentNameWithConfigurationLocalName(
               factory.getConfigurationAnalyzer(),
               file,
               info.getOldName(),
               info.getNewName(),
               status);
         }
       }
     }
   } catch (Exception e) {
     status.addFatalError(
         "Exception during condition checking. See project log for more information.");
     projectUtil.log("Exception during condition checking.", e);
   }
   return status;
 }
Exemplo n.º 2
0
  @Override
  public RefactoringStatus initializeRefactoring(IProgressMonitor pm) {
    RefactoringStatus ret = new RefactoringStatus();
    ProjectUtil projectUtil = getProjectUtil();
    try {
      if (!isApplicable()) {
        ret.addFatalError("The Refactoring is no Accessable");
      }
      if (!findComponentDefinition(ret)) {
        return ret;
      }
      declaringFile = getIFile4ParseFile(componentDefinition.getParseFile());
      affectedIdentifiers = gatherAffectedIdentifiers(pm);

    } catch (Exception e) {
      ret.addFatalError("Exception during initialization. See project log for more information.");
      projectUtil.log("Exception during initialization.", e);
    }
    return ret;
  }