Class PaletteViewer

    • Constructor Detail

      • PaletteViewer

        public PaletteViewer()
        Constructor
    • Method Detail

      • addPaletteListener

        public void addPaletteListener​(PaletteListener paletteListener)
        Adds the given PaletteListener as the one to be notified when the active tool on the palette changes.
        Parameters:
        paletteListener - The listener that needs to be notified of active tool changes on the palette
      • enableVerticalScrollbar

        public void enableVerticalScrollbar​(boolean value)
        Indicates that the palette should scroll using a native vertical scrollbar as opposed to individual lightweight buttons that appear dynamically on each drawer. The default settings is false. Enabling this setting requires additional horizontal screen space for the scrollbar. Therefore, its use is discouraged.

        This setting must be changed prior to calling ScrollingGraphicalViewer.createControl(org.eclipse.swt.widgets.Composite) . After the control is created, changing this setting will have no effect.

        Parameters:
        value - true if a vertical scrollbar should be displayed
      • fireModeChanged

        protected void fireModeChanged()
        Notifies registered listeners of change in the active tool on the palette
      • getCustomizerDialog

        public PaletteCustomizerDialog getCustomizerDialog()
        NOTE: A PaletteCustomizer must be set for this viewer using the setCustomizer(PaletteCustomizer) method before this method is invoked.
        Returns:
        The dialog that can be used to customize entries on the palette
      • getActiveTool

        public ToolEntry getActiveTool()
        Returns:
        the entry for the currently active tool
      • getPaletteRoot

        public PaletteRoot getPaletteRoot()
        Returns the palette's root model.
        Returns:
        the palette root
      • getPaletteViewerPreferences

        public PaletteViewerPreferences getPaletteViewerPreferences()
        Returns:
        The PaletteViewerPreferences that this palette is using to store its preferences (if none has been set, it returns the default one, which uses the GEF preference store)
      • isExpanded

        public boolean isExpanded​(PaletteDrawer drawer)
        Returns true if the given PaletteDrawer is expanded
        Parameters:
        drawer - the PaletteDrawer
        Returns:
        true if expanded
      • isPinned

        public boolean isPinned​(PaletteDrawer drawer)
        Returns true if the given PaletteDrawer is pinned
        Parameters:
        drawer - the PaletteDrawer
        Returns:
        true if pinned
      • removePaletteListener

        public void removePaletteListener​(PaletteListener paletteListener)
        The given PaletteListener will not be notified of active tool changes in the palette.
        Parameters:
        paletteListener - the PaletteListener which doesn't want to be notified of active tool changes in the palette anymore
      • restoreState

        public boolean restoreState​(IMemento memento)
        Tries to apply the state of the given IMemento to the contents of this viewer. It fails silently, i.e. no exceptions are thrown if the given state could not be applied.
        Parameters:
        memento - The memento that has the state to be applied to the contents of this viewer
        Returns:
        a boolean indicating whether or not the given memento was successfully applied
        Since:
        3.0
      • saveState

        public void saveState​(IMemento memento)
        Captures the state of the contents of this viewer in the given memento
        Parameters:
        memento - the IMemento in which the state is to be saved
        Since:
        3.0
      • setCustomizer

        public void setCustomizer​(PaletteCustomizer customizer)
        Sets the customizer.
        Parameters:
        customizer - the customizer to be set
      • setActiveTool

        public void setActiveTool​(ToolEntry newMode)
        Sets the active entry for this palette. The Editpart for the given entry will be activated (selected).
        Parameters:
        newMode - the ToolEntry whose EditPart has to be set as the active tool in this palette
      • setPaletteRoot

        public void setPaletteRoot​(PaletteRoot root)
        Sets the root for this palette.
        Parameters:
        root - the PaletteRoot for this palette
      • setPaletteViewerPreferences

        public void setPaletteViewerPreferences​(PaletteViewerPreferences prefs)
        This palette will use the given PaletteViewerPreferences to store all its preferences.

        NOTE: This method should be invoked by a client only once (before the first time getPaletteViewerPreferences() is invoked). Trying to invoke this method after that could lead to problems where some preferences would still be stored in the old preference store.

        Parameters:
        prefs - the PaletteViewerPreferences that is to be used to store all the preferences for this palette