Class ComparisonTreeControl

  • All Implemented Interfaces:
    ISelectionProvider, org.eclipse.swt.graphics.Drawable

    public class ComparisonTreeControl
    extends org.eclipse.swt.widgets.Composite
    implements ISelectionProvider
    Control representing a comparison tree.
    • Field Summary

      • Fields inherited from class org.eclipse.swt.widgets.Control

        handle
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addColumn​(String text, CellLabelProvider labelProvider, int columnWidth, EditingSupport editingSupport, Consumer<IPartialModelNode> onMouseClick)
      Adds new column to the control.
      void addFilter​(ViewerFilter filter)
      Adds the specified filter.
      void addSelectionChangedListener​(ISelectionChangedListener listener)  
      void expandToLevel​(int level)
      Expands the comparison tree up to the specified level.
      ViewerFilter[] getFilters()
      Returns the viewer's filters.
      ISelection getSelection()  
      TreeViewer getTreeViewer()
      Returns the tree viewer.
      boolean isReadOnly()
      Checks whether the control is in read-only mode.
      void refresh​(IPartialModelNode node)
      Refreshes the specified node in the tree.
      void removeFilter​(ViewerFilter filter)
      Removes the specified filter.
      void removeSelectionChangedListener​(ISelectionChangedListener listener)  
      void resetFilters()
      Resets all filters.
      void setFilters​(ViewerFilter... filters)
      Sets the specified filters.
      void setInput​(Object input)
      Sets tree viewer's input.
      void setReadOnly​(boolean value)
      Sets the read-only mode according to the specified flag.
      void setSelection​(ISelection selection)  
      void update​(IPartialModelNode node)
      Updates the specified node in the tree.
      void update​(Collection<IPartialModelNode> nodes)
      Updates the given collection of nodes in the comparison tree.
      • Methods inherited from class org.eclipse.swt.widgets.Composite

        changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
      • Methods inherited from class org.eclipse.swt.widgets.Scrollable

        computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
      • Methods inherited from class org.eclipse.swt.widgets.Control

        addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
      • Methods inherited from class org.eclipse.swt.widgets.Widget

        addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
      • Methods inherited from interface org.eclipse.swt.graphics.Drawable

        isAutoScalable
    • Constructor Detail

      • ComparisonTreeControl

        public ComparisonTreeControl​(org.eclipse.swt.widgets.Composite parent,
                                     ITreeContentProvider contentProvider,
                                     IComparisonTreeControlListener listener,
                                     boolean readOnly,
                                     ISelectionProviderDelegate selectionProviderDelegate)
        Creates new control.
        Parameters:
        parent - the parent control, cannot be null
        contentProvider - the content provider, cannot be null
        listener - the listener of the control's events, cannot be null
        readOnly - value true to turn the read-only mode on, and false to turn it off
        selectionProviderDelegate - the selection provider delegate, cannot be null
    • Method Detail

      • addColumn

        public void addColumn​(String text,
                              CellLabelProvider labelProvider,
                              int columnWidth,
                              EditingSupport editingSupport,
                              Consumer<IPartialModelNode> onMouseClick)
        Adds new column to the control.
        Parameters:
        text - the column title, can be null
        labelProvider - column label provider, cannot be null
        columnWidth - column width in pixels
        editingSupport - column editing support, can be null
        onMouseClick - runnable to be called when use clicks in a column's cell, can be null
      • getTreeViewer

        public TreeViewer getTreeViewer()
        Returns the tree viewer.
        Returns:
        the tree viewer instance, never null
      • update

        public void update​(Collection<IPartialModelNode> nodes)
        Updates the given collection of nodes in the comparison tree.
        Parameters:
        nodes - the nodes to update
      • update

        public void update​(IPartialModelNode node)
        Updates the specified node in the tree.
        Parameters:
        node - the node to update
      • refresh

        public void refresh​(IPartialModelNode node)
        Refreshes the specified node in the tree.
        Parameters:
        node - the partial model node to refresh, can not be null
      • resetFilters

        public void resetFilters()
        Resets all filters.
      • setFilters

        public void setFilters​(ViewerFilter... filters)
        Sets the specified filters.
        Parameters:
        filtes - the filters to set, cannot be null
      • addFilter

        public void addFilter​(ViewerFilter filter)
        Adds the specified filter.
        Parameters:
        filtes - the filter to add, cannot be null
      • removeFilter

        public void removeFilter​(ViewerFilter filter)
        Removes the specified filter.
        Parameters:
        filtes - the filter to removed, cannot be null
      • getFilters

        public ViewerFilter[] getFilters()
        Returns the viewer's filters.
        Returns:
        the viewer's filters, may be null
      • setInput

        public void setInput​(Object input)
        Sets tree viewer's input.
        Parameters:
        input -
      • expandToLevel

        public void expandToLevel​(int level)
        Expands the comparison tree up to the specified level.
        Parameters:
        level - the non-negative level
      • setReadOnly

        public void setReadOnly​(boolean value)
        Sets the read-only mode according to the specified flag.
        Parameters:
        value - true to turn the read-only mode on, and false to turn it off
      • isReadOnly

        public boolean isReadOnly()
        Checks whether the control is in read-only mode.
        Returns:
        true if the control is in read-only mode, and false otherwise