Example #1
0
 public IAccumulatingLexer createLexer(IFile file, ISourceForm sourceForm)
     throws CoreException, IOException {
   return createLexer(
       new BufferedReader(new InputStreamReader(file.getContents(true), file.getCharset())),
       file,
       SourceForm.determineFilename(file),
       sourceForm);
 }
  @Override
  protected final void preCheckInitialConditions(RefactoringStatus status, IProgressMonitor pm)
      throws PreconditionFailure {
    // status.addWarning("C preprocessor directives are IGNORED by the refactoring engine.  Use at
    // your own risk.");

    if (FIXED_FORM_REFACTORING_ENABLED) {
      for (IFile file : this.selectedFiles) {
        if (org.eclipse.photran.internal.core.sourceform.SourceForm.isFixedForm(file)) {
          status.addWarning(
              Messages.FortranResourceRefactoring_IndentationAndLineLengthAreNotChecked);
          return;
        }
      }
    }
  }
  protected void removeCpreprocessedFilesFrom(Collection<IFile> files, RefactoringStatus status) {
    Set<IFile> filesToRemove = new HashSet<IFile>();

    for (IFile file : files) {
      if (!filesToRemove.contains(file)
          && org.eclipse.photran.internal.core.sourceform.SourceForm.isCPreprocessed(file)) {
        status.addError(
            Messages.bind(
                Messages.FortranResourceRefactoring_CPreprocessedFileWillNotBeRefactored,
                file.getName()));
        filesToRemove.add(file);
      }
    }

    files.removeAll(filesToRemove);
  }
  protected void removeFixedFormFilesFrom(Collection<IFile> files, RefactoringStatus status) {
    if (FIXED_FORM_REFACTORING_ENABLED) return;

    Set<IFile> filesToRemove = new HashSet<IFile>();

    for (IFile file : files) {
      if (!filesToRemove.contains(file)
          && org.eclipse.photran.internal.core.sourceform.SourceForm.isFixedForm(file)) {
        status.addError(
            Messages.bind(
                Messages.FortranResourceRefactoring_FixedFormFileWillNotBeRefactored,
                file.getName()));
        filesToRemove.add(file);
      }
    }

    files.removeAll(filesToRemove);
  }
Example #5
0
 public IAccumulatingLexer createLexer(Reader in, IFile file, String filename) throws IOException {
   return createLexer(in, file, filename, SourceForm.of(file, filename));
 }