Class TreeViewerSWTBuilder


  • public class TreeViewerSWTBuilder
    extends java.lang.Object
    The TreeViewerSWTBuilder is initialized with a default behavior. It offers methods to customize certain aspects of a TreeViewer.
    Since:
    1.8
    Author:
    Johannes Faltermeier
    • Method Detail

      • customizeContentProvider

        public TreeViewerSWTBuilder customizeContentProvider​(ContentProviderProvider contentProvider)
        Use this method to set a custom IContentProvider on the tree viewer. The default implementation will use an AdapterFactoryContentProvider.
        Parameters:
        contentProvider - the desired behavior
        Returns:
        self
      • customizeContentProvider

        public TreeViewerSWTBuilder customizeContentProvider​(org.eclipse.jface.viewers.IContentProvider contentProvider)
        Use this method to set a custom IContentProvider on the tree viewer. If the content provider requires more dispose code than calling IContentProvider.dispose() use customizeContentProvider(ContentProviderProvider) instead. The default implementation will use an AdapterFactoryContentProvider.
        Parameters:
        contentProvider - the content provider to add
        Returns:
        self
      • customizeDragAndDrop

        public TreeViewerSWTBuilder customizeDragAndDrop​(DNDProvider dnd)
        Use this method to add a customized drag and drop behaviour to the tree or to remove drag and drop functionality. The default implementation supports DND#DROP_COPY, DND#DROP_MOVE and DND#DROP_LINK based on EMF Edit.
        Parameters:
        dnd - the desired behavior
        Returns:
        self
      • customizeLabelProvider

        public TreeViewerSWTBuilder customizeLabelProvider​(LabelProviderProvider provider)
        Use this method a add a custom IBaseLabelProvider to the tree. The default implementation uses an AdapterFactoryLabelProvider.
        Parameters:
        provider - the desired behavior
        Returns:
        self
      • customizeLabelProvider

        public TreeViewerSWTBuilder customizeLabelProvider​(org.eclipse.jface.viewers.IBaseLabelProvider provider)
        Use this method a add a custom IBaseLabelProvider to the tree. If the label provider requires more dispose code than a call to IBaseLabelProvider.dispose() use customizeLabelProvider(LabelProviderProvider) instead. The default implementation uses an AdapterFactoryLabelProvider.
        Parameters:
        provider - the label provider to add
        Returns:
        self
      • customizeLabelDecorator

        public TreeViewerSWTBuilder customizeLabelDecorator​(LabelDecoratorProvider provider)
        Use this method to add a ILabelDecorator for decorating the labels of the label provider. The default implementation does not use a decorator.
        Parameters:
        provider - the LabelDecoratorProvider which will be used to create the decorator
        Returns:
        self
        Since:
        1.9
      • customizeLabelDecorator

        public TreeViewerSWTBuilder customizeLabelDecorator​(org.eclipse.jface.viewers.ILabelDecorator decorator)
        Use this method to add a ILabelDecorator for decorating the labels of the label provider. The default implementation does not use a decorator.
        Parameters:
        decorator - the decorator instance to be used
        Returns:
        self
        Since:
        1.9
      • customizeMenu

        public TreeViewerSWTBuilder customizeMenu​(MenuProvider menu)
        Use this method to customize the Menu which is shown when an element in the tree is right-clicked. The default implementation will offer menu entries to create new elements based on EMF Edit and to delete elements.
        Parameters:
        menu - the desired behavior
        Returns:
        self
      • customizeMenuItems

        public TreeViewerSWTBuilder customizeMenuItems​(java.util.Collection<MasterDetailAction> rightClickActions)
        Use this method to customize the Menu which is shown when an element in the tree is right-clicked. Use this method to add additional menu entries.
        Parameters:
        rightClickActions - the additional right click actions which will be shown in the context menu
        Returns:
        self
        Since:
        1.8
      • customizeCildCreation

        public TreeViewerSWTBuilder customizeCildCreation​(CreateElementCallback createElementCallback)
        Use this method to customize the Menu which is shown when an element in the tree is right-clicked. Use this method to influence the way new children are created.
        Parameters:
        createElementCallback - a callback which gets notified when a new child is created. this allows to veto the creation or to change the object to be added
        Returns:
        self
        Since:
        1.8
      • customizeDelete

        public TreeViewerSWTBuilder customizeDelete​(DeleteActionBuilder deleteActionBuilder)
        Use this method to customize the Menu which is shown when an element in the tree is right-clicked. Use this method to change the way elements are deleted.
        Parameters:
        deleteActionBuilder - the delete action which will be added to the context menu
        Returns:
        self
        Since:
        1.8
      • customizeInitialSelection

        public TreeViewerSWTBuilder customizeInitialSelection​(InitialSelectionProvider selection)
        Use this method to customize which element should be selected after the initial rendering. The default bahviour is to select the root node, if it is displayed in the tree.
        Parameters:
        selection - the desired behavior
        Returns:
        self
      • customizeTree

        public TreeViewerSWTBuilder customizeTree​(TreeViewerBuilder tree)
        Use this method to create the TreeViewer which is part of the tree master detail. The default implementation creates a regular TreeViewer with an expand level of 3.
        Parameters:
        tree - the desired behavior
        Returns:
        self
      • customizeViewerFilters

        public TreeViewerSWTBuilder customizeViewerFilters​(org.eclipse.jface.viewers.ViewerFilter[] filters)
        Use this method to add ViewerFilters on the tree. The default implementation does not add filters.
        Parameters:
        filters - the filters to add
        Returns:
        self
      • create

        public org.eclipse.jface.viewers.TreeViewer create()
        Call this method after all desired customizations have been passed to the builder. The will create a new TreeMasterDetailComposite with the desired customizations.
        Returns:
        the TreeMasterDetailComposite