Class StructureDiffViewer

    • Constructor Detail

      • StructureDiffViewer

        public StructureDiffViewer​(Tree tree,
                                   CompareConfiguration configuration)
        Creates a new viewer for the given SWT tree control with the specified configuration.
        Parameters:
        tree - the tree control
        configuration - the configuration for this viewer
      • StructureDiffViewer

        public StructureDiffViewer​(Composite parent,
                                   CompareConfiguration configuration)
        Creates a new viewer under the given SWT parent with the specified configuration.
        Parameters:
        parent - the SWT control under which to create the viewer
        configuration - the configuration for this viewer
    • Method Detail

      • setStructureCreator

        public void setStructureCreator​(IStructureCreator structureCreator)
        Configures the StructureDiffViewer with a structure creator. The structure creator is used to create a hierarchical structure for each side of the viewer's input element of type ICompareInput.
        Parameters:
        structureCreator - the new structure creator
      • getStructureCreator

        public IStructureCreator getStructureCreator()
        Returns the structure creator or null if no structure creator has been set with setStructureCreator.
        Returns:
        the structure creator or null
      • getTitle

        public String getTitle()
        Reimplemented to get the descriptive title for this viewer from the IStructureCreator.
        Overrides:
        getTitle in class DiffTreeViewer
        Returns:
        the viewer's name
      • getRoot

        protected Object getRoot()
        Overridden because the input of this viewer is not identical to the root of the tree. The tree's root is a IDiffContainer that was returned from the method diff.
        Overrides:
        getRoot in class StructuredViewer
        Returns:
        the root of the diff tree produced by method diff
      • inputChanged

        protected void inputChanged​(Object input,
                                    Object oldInput)
        Description copied from class: Viewer
        Internal hook method called when the input to this viewer is initially set or subsequently changed.

        The default implementation does nothing. Subclassers may override this method to do something when a viewer's input is set. A typical use is populate the viewer.

        Overrides:
        inputChanged in class DiffTreeViewer
        Parameters:
        input - the new input of this viewer, or null if none
        oldInput - the old input element or null if there was previously no input
      • initialSelection

        protected void initialSelection()
        Description copied from class: DiffTreeViewer
        This hook method is called from within inputChanged after a new input has been set but before any controls are updated. This default implementation calls navigate(true) to select and expand the first leaf node. Clients can override this method and are free to decide whether they want to call the inherited method.
        Overrides:
        initialSelection in class DiffTreeViewer
      • handleDispose

        protected void handleDispose​(DisposeEvent event)
        Description copied from class: DiffTreeViewer
        Called on the viewer disposal. Unregisters from the compare configuration. Clients may extend if they have to do additional cleanup.
        Overrides:
        handleDispose in class DiffTreeViewer
        Parameters:
        event - dispose event that triggered call to this method
      • compareInputChanged

        protected void compareInputChanged​(ICompareInput input)
        Recreates the comparable structures for the input sides.
        Parameters:
        input - this viewer's new input
      • contentChanged

        protected void contentChanged​(IContentChangeNotifier changed)
        Calls diff whenever the byte contents changes.
        Parameters:
        changed - the object that sent out the notification
      • diff

        protected void diff​(IProgressMonitor monitor)
        Runs the difference engine and refreshes the tree. This method may be called from a background (non-UI) thread).
        Parameters:
        monitor - a progress monitor or null if progress in not required
      • diff

        protected void diff()
        Runs the difference engine and refreshes the tree.
      • postDiffHook

        @Deprecated
        protected void postDiffHook​(Differencer differencer,
                                    IDiffContainer root)
        Deprecated.
        This method is called from within diff() after the difference tree has been built. Clients may override this method to perform their own post-processing. This default implementation does nothing.
        Parameters:
        differencer - the differencer used to perform the differencing
        root - the non-null root node of the difference tree
        Since:
        2.0
      • postDiffHook

        protected void postDiffHook​(Differencer differencer,
                                    IDiffContainer root,
                                    IProgressMonitor monitor)
        This method is called from within diff(IProgressMonitor) after the difference tree has been built. This method may be called from a background (non-UI) thread).

        For backwards compatibility, this default implementation calls postDiffHook(Differencer, IDiffContainer) from the UI thread. Clients should override this method even if they don't perform post processing to avoid the call to the UI thread.

        Parameters:
        differencer - the differencer used to perform the differencing
        root - the non-null root node of the difference tree
        monitor - a progress monitor or null if progress is not required
        Since:
        3.3
      • propertyChange

        protected void propertyChange​(PropertyChangeEvent event)
        Tracks property changes of the configuration object. Clients may override to track their own property changes. In this case they must call the inherited method.
        Overrides:
        propertyChange in class DiffTreeViewer
        Parameters:
        event - the property changed event that triggered the call to this method
      • copySelected

        protected void copySelected​(boolean leftToRight)
        Overridden to call the save method on the structure creator after nodes have been copied from one side to the other side of an input object.
        Overrides:
        copySelected in class DiffTreeViewer
        Parameters:
        leftToRight - if true the left side is copied to the right side. If false the right side is copied to the left side