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>
        javaSource - The Java source.
        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.

        onJavaSourceMoved in class JavaSourceFileProcessor<TestProcessorContainer>
        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.
      • onJavaSourceRemoved

        public void onJavaSourceRemoved​(org.eclipse.core.resources.IFile file)
        Called when a Java source has been removed.

        Subclasses can override this method to perform reference updates.

        onJavaSourceRemoved in class JavaSourceFileProcessor<TestProcessorContainer>
        file - The file.
      • 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.
        parse in class JavaSourceFileProcessor<TestProcessorContainer>
        compilationUnit - The compilation unit.
        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.
        reconcile in class JavaSourceFileProcessor<TestProcessorContainer>
        context - The reconcile context to act on.
      • isRefactorRequired

        public boolean isRefactorRequired()
        Checks if this parser needs to refactor something.
        isRefactorRequired in class JavaSourceFileProcessor<TestProcessorContainer>
        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);
        onRefactorCommit in class JavaSourceFileProcessor<TestProcessorContainer>
        fileChangeRootEdit - The root edit of the Java file change.