Class DefaultTreeViewerCustomization

    • Constructor Detail

      • DefaultTreeViewerCustomization

        public DefaultTreeViewerCustomization()
        Default constructor.
    • Method Detail

      • getComposedAdapterFactory

        protected org.eclipse.emf.edit.provider.ComposedAdapterFactory getComposedAdapterFactory()
        Gives access to the composed adapter factory.
        Returns:
        the adapter factory
      • getAdapterFactoryContentProvider

        protected org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider getAdapterFactoryContentProvider()
        Returns the AdapterFactoryContentProvider.
        Returns:
        the content provider
      • createTree

        public org.eclipse.jface.viewers.TreeViewer createTree​(org.eclipse.swt.widgets.Composite parent)
        Description copied from interface: TreeViewerBuilder
        This method is called to create the TreeViewer.
        Specified by:
        createTree in interface TreeViewerBuilder
        Parameters:
        parent - the parent composite
        Returns:
        the viewer
      • hasDND

        public boolean hasDND()
        Description copied from interface: DNDProvider
        Whether DND support should be added to the tree.
        Specified by:
        hasDND in interface DNDProvider
        Returns:
        true if DND will be added, based on the other methods of this interface, or false if DND should not be added
      • getDragOperations

        public int getDragOperations()
        Description copied from interface: DNDProvider
        Returns the drag operations bits used to setup the drag support for the viewer.
        Specified by:
        getDragOperations in interface DNDProvider
        Returns:
        the drag operations
      • getDragTransferTypes

        public org.eclipse.swt.dnd.Transfer[] getDragTransferTypes()
        Description copied from interface: DNDProvider
        Returns the drag transfer types used to setup the drag support for the viewer.
        Specified by:
        getDragTransferTypes in interface DNDProvider
        Returns:
        the drag transfer types
      • getDragListener

        public org.eclipse.swt.dnd.DragSourceListener getDragListener​(org.eclipse.jface.viewers.TreeViewer treeViewer)
        Description copied from interface: DNDProvider
        Returns the DragSourceListener used to setup the drag support for the viewer.
        Specified by:
        getDragListener in interface DNDProvider
        Parameters:
        treeViewer - the treeviewer
        Returns:
        the listener
      • getDropOperations

        public int getDropOperations()
        Description copied from interface: DNDProvider
        Returns the drag operations bits used to setup the drop support for the viewer.
        Specified by:
        getDropOperations in interface DNDProvider
        Returns:
        the drop operations
      • getDropTransferTypes

        public org.eclipse.swt.dnd.Transfer[] getDropTransferTypes()
        Description copied from interface: DNDProvider
        Returns the drag transfer types used to setup the drop support for the viewer.
        Specified by:
        getDropTransferTypes in interface DNDProvider
        Returns:
        the drop transfer types
      • getDropListener

        public org.eclipse.swt.dnd.DropTargetListener getDropListener​(org.eclipse.emf.edit.domain.EditingDomain editingDomain,
                                                                      org.eclipse.jface.viewers.TreeViewer treeViewer)
        Description copied from interface: DNDProvider
        Returns the DragSourceListener used to setup the drop support for the viewer.
        Specified by:
        getDropListener in interface DNDProvider
        Parameters:
        editingDomain - the editing domain
        treeViewer - the treeviewer
        Returns:
        the listener
      • getLabelProvider

        public org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()
        Description copied from interface: LabelProviderProvider
        Creates the label provider added to the treeviewer.
        Specified by:
        getLabelProvider in interface LabelProviderProvider
        Returns:
        the label provider
      • getLabelDecorator

        public Optional<org.eclipse.jface.viewers.ILabelDecorator> getLabelDecorator​(org.eclipse.jface.viewers.TreeViewer viewer)
        Description copied from interface: LabelDecoratorProvider
        Returns the ILabelDecorator to use.
        Specified by:
        getLabelDecorator in interface LabelDecoratorProvider
        Parameters:
        viewer - the TreeViewer
        Returns:
        the decorator or empty
      • getViewerFilters

        public org.eclipse.jface.viewers.ViewerFilter[] getViewerFilters()
        Description copied from interface: ViewerFilterProvider
        Creates the viewer filters added to the treeviewer.
        Specified by:
        getViewerFilters in interface ViewerFilterProvider
        Returns:
        the filters
      • getInitialSelection

        public org.eclipse.emf.ecore.EObject getInitialSelection​(java.lang.Object input)
        Description copied from interface: InitialSelectionProvider
        Called to set the initial selection on the tree. This may be null if no specific default selection should be set.
        Specified by:
        getInitialSelection in interface InitialSelectionProvider
        Parameters:
        input - the input
        Returns:
        the object to select or null
      • getMenu

        public org.eclipse.swt.widgets.Menu getMenu​(org.eclipse.jface.viewers.TreeViewer treeViewer,
                                                    org.eclipse.emf.edit.domain.EditingDomain editingDomain)
        Description copied from interface: MenuProvider
        Returns the menu which will be added to the tree.
        Specified by:
        getMenu in interface MenuProvider
        Parameters:
        treeViewer - the treeviewer
        editingDomain - the editing domain
        Returns:
        the menu
      • dispose

        public void dispose()
        Description copied from interface: Disposeable
        Disposes the element.
        Specified by:
        dispose in interface Disposeable
      • setContentProvider

        public void setContentProvider​(ContentProviderProvider contentProvider)
        Sets the content provider provider.
        Parameters:
        contentProvider - the content provider
      • setDragAndDrop

        public void setDragAndDrop​(DNDProvider dnd)
        Sets the d&d support.
        Parameters:
        dnd - the dnd
      • setLabelProvider

        public void setLabelProvider​(LabelProviderProvider labelProvider)
        Sets the label provider provider.
        Parameters:
        labelProvider - the provider
      • setLabelDecorator

        public void setLabelDecorator​(LabelDecoratorProvider decorator)
        Sets the label decorator provider.
        Parameters:
        decorator - the provider
      • setMenu

        public void setMenu​(MenuProvider menu)
        Sets the menu provider.
        Parameters:
        menu - the provider
      • customizeMenu

        public void customizeMenu​(java.util.Collection<MasterDetailAction> rightClickActions)
        Sets the right click actions of the menu.
        Parameters:
        rightClickActions - the actions
      • customizeMenu

        public void customizeMenu​(DeleteActionBuilder deleteActionBuilder)
        Sets the delete action.
        Parameters:
        deleteActionBuilder - the builder
      • setInitialSelection

        public void setInitialSelection​(InitialSelectionProvider selection)
        Sets the initial selection provider.
        Parameters:
        selection - the provider
      • setTree

        public void setTree​(TreeViewerBuilder tree)
        Sets the tree builder.
        Parameters:
        tree - the tree builder
      • setViewerFilters

        public void setViewerFilters​(ViewerFilterProvider filters)
        Sets the viewer filter provider.
        Parameters:
        filters - the provider
      • setReadOnly

        public void setReadOnly​(boolean readOnly)
        Allows to set the tree as read-only. Default is false. Setting the tree as read-only has two consequences:
        1. The tree's context menu is disabled
        2. Drag and drop is disabled
        Parameters:
        readOnly - true to set as read-only