Eclipse GEF
2.1

org.eclipse.gef.ui.palette
Class PaletteViewer

java.lang.Object
  |
  +--org.eclipse.gef.ui.parts.AbstractEditPartViewer
        |
        +--org.eclipse.gef.ui.parts.GraphicalViewerImpl
              |
              +--org.eclipse.gef.ui.parts.ScrollingGraphicalViewer
                    |
                    +--org.eclipse.gef.ui.palette.PaletteViewer
All Implemented Interfaces:
EditPartViewer, GraphicalViewer, ISelectionProvider

public class PaletteViewer
extends ScrollingGraphicalViewer

Graphical viewer for the GEF palette.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.gef.EditPartViewer
EditPartViewer.Conditional
 
Field Summary
 
Fields inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewer
constantSelection, selection, selectionListeners
 
Constructor Summary
PaletteViewer()
          Constructor
 
Method Summary
 void addPaletteListener(PaletteListener paletteListener)
          Adds the given PaletteListener as the one to be notified when the active tool on the palette changes
protected  void createDefaultRoot()
           
 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.
protected  void fireModeChanged()
          Notifies registered listeners of change in the active tool on the palette
 ToolEntry getActiveTool()
           
 PaletteCustomizer getCustomizer()
           
 PaletteCustomizerDialog getCustomizerDialog()
          NOTE: A PaletteCustomizer must be set for this viewer using the setCustomizer(PaletteCustomizer) method before this method is invoked.
 PaletteViewerPreferences getPaletteViewerPreferences()
           
protected  void handleDispose(DisposeEvent e)
          Called if and when the Control is disposed.
protected  void hookControl()
           
 void removePaletteListener(PaletteListener paletteListener)
          The given PaletteListener will not be notified of active tool changes in the palette
 void setActiveTool(ToolEntry newMode)
          Sets the active entry for this palette.
 void setCustomizer(PaletteCustomizer customizer)
          Sets the customizer.
 void setPaletteRoot(PaletteRoot root)
          Sets the root for this palette
 void setPaletteViewerPreferences(PaletteViewerPreferences prefs)
          This palette will use the given PaletteViewerPreferences to store all its preferences.
protected  void unhookControl()
           
 
Methods inherited from class org.eclipse.gef.ui.parts.ScrollingGraphicalViewer
createControl, getFigureCanvas, reveal, setRootFigure
 
Methods inherited from class org.eclipse.gef.ui.parts.GraphicalViewerImpl
createLightweightSystem, findHandleAt, findObjectAtExcluding, flush, getEventDispatcher, getLayerManager, getLightweightSystem, getRootFigure, hookDropTarget, registerAccessibleEditPart, setContextMenu, setCursor, setDragSource, setEditDomain, setRootEditPart, setRouteEventsToEditDomain, unregisterAccessibleEditPart
 
Methods inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewer
addDragSourceListener, addDropTargetListener, addSelectionChangedListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, fireSelectionChanged, getContents, getContextMenu, getControl, getDelegatingDragAdapter, getDelegatingDropAdapter, getDragSource, getDropTarget, getEditDomain, getEditPartFactory, getEditPartRegistry, getFocusEditPart, getKeyHandler, getRootEditPart, getSelectedEditParts, getSelection, getVisualPartMap, hookDragSource, init, primGetSelectedEditParts, refreshDragSourceAdapter, refreshDropTargetAdapter, removeDragSourceListener, removeDropTargetListener, removeSelectionChangedListener, select, setContents, setContents, setControl, setDropTarget, setEditPartFactory, setFocus, setKeyHandler, setSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef.EditPartViewer
addDragSourceListener, addDropTargetListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, getContents, getContextMenu, getControl, getEditDomain, getEditPartFactory, getEditPartRegistry, getFocusEditPart, getKeyHandler, getRootEditPart, getSelectedEditParts, getVisualPartMap, select, setContents, setContents, setControl, setEditPartFactory, setFocus, setKeyHandler
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, getSelection, removeSelectionChangedListener, setSelection
 

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. * @param paletteListener The listener that needs to be notified of active tool changes on the palette


createDefaultRoot

protected void createDefaultRoot()
Overrides:
createDefaultRoot in class GraphicalViewerImpl
See Also:
GraphicalViewerImpl.createDefaultRoot()

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(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


getCustomizer

public PaletteCustomizer getCustomizer()
Returns:
the customizer

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

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)

handleDispose

protected void handleDispose(DisposeEvent e)
Description copied from class: AbstractEditPartViewer
Called if and when the Control is disposed. Subclasses may extend this method to perform additional cleanup.

Overrides:
handleDispose in class GraphicalViewerImpl
Parameters:
e - the disposeevent
See Also:
org.eclipse.gef.EditPartViewer#dispose()

hookControl

protected void hookControl()
Overrides:
hookControl in class GraphicalViewerImpl
See Also:
GraphicalViewerImpl.hookControl()

removePaletteListener

public void removePaletteListener(PaletteListener paletteListener)
The given PaletteListener will not be notified of active tool changes in the palette. * @param paletteListener the PaletteListener which doesn't want to be notified of active tool changes in the palette anymore


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). * @param 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. * @param 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 #getPaletteViewerPreferencesSource() 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

unhookControl

protected void unhookControl()
Overrides:
unhookControl in class AbstractEditPartViewer
See Also:
AbstractEditPartViewer.unhookControl()

Eclipse GEF
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.