Class TestProcessor

    • Method Detail

      • initialize

        public static void initialize()
      • createPropertyContainer

        public TestProcessorContainer createPropertyContainer​(ParsedJavaSource javaSource)
        Creates the property container for the data required by the processor when no saved XML is present at load-time. The container should NOT be added to any other property container, it should remain orphan, and it is NOT required to have an Atom name, i.e. it can be unnamed.

        The processor should save the reference to JavaSource in this call.

        Specified by:
        createPropertyContainer in class JavaSourceFileProcessor<TestProcessorContainer>
        Parameters:
        javaSource - The Java source.
        Returns:
        The container instance, or null if non is required.
      • onInitialize

        public void onInitialize()
        Called when the property container has been loaded from XML and should be initiated for specialized data for the processor, e.g. setting up instance references to the children properties, reference to the processor itself.

        The processor should save the reference to JavaSource in this call.

        Specified by:
        onInitialize in class JavaSourceFileProcessor<TestProcessorContainer>
      • onJavaSourceMoved

        public void onJavaSourceMoved​(org.eclipse.core.resources.IFile oldFile,
                                      org.eclipse.core.resources.IFile newFile,
                                      java.lang.String oldPKG,
                                      java.lang.String newPKG)
        Called when a Java source has been moved or renamed. The getSourceFile() method in JavaSource is already moved or renamed when this method is called.

        Subclasses can override this method to perform reference updates.

        Overrides:
        onJavaSourceMoved in class JavaSourceFileProcessor<TestProcessorContainer>
        Parameters:
        oldFile - The old file name.
        newFile - The new file name.
        oldPKG - The old package name of the main class.
        newPKG - The new package name of the main class.
      • parse

        public void parse​(org.eclipse.jdt.core.dom.CompilationUnit compilationUnit)
                   throws org.eclipse.core.runtime.CoreException
        Called to parse the Java source at load and when the Java compiler runs, using an AST compilation unit and a flag indicating if the compilation unit contains annotations.
        Overrides:
        parse in class JavaSourceFileProcessor<TestProcessorContainer>
        Parameters:
        compilationUnit - The compilation unit.
        Throws:
        org.eclipse.core.runtime.CoreException - For errors with e.g. removing markers.
      • reconcile

        public void reconcile​(org.eclipse.jdt.core.compiler.ReconcileContext context,
                              org.eclipse.jdt.core.dom.CompilationUnit cu)
        Called by the Java compilation participant let the processor handle the reconciled working copy.
        Overrides:
        reconcile in class JavaSourceFileProcessor<TestProcessorContainer>
        Parameters:
        context - The reconcile context to act on.
      • isRefactorRequired

        public boolean isRefactorRequired()
        Checks if this parser needs to refactor something.
        Overrides:
        isRefactorRequired in class JavaSourceFileProcessor<TestProcessorContainer>
        Returns:
        true to let the framework perform a grouped refactoring when the RefactorCommit event is received and processed by it.
      • onRefactorCommit

        public void onRefactorCommit​(org.eclipse.text.edits.MultiTextEdit fileChangeRootEdit)
        Called when the refactoring on each source is to be performed.

        When this method is called, refactoring the code for a plain text file using positions would look like:

           ReplaceEdit edit=new ReplaceEdit(offset,length,string);
           fileChangeRootEdit.addChild(edit);
         

        Overrides:
        onRefactorCommit in class JavaSourceFileProcessor<TestProcessorContainer>
        Parameters:
        fileChangeRootEdit - The root edit of the Java file change.