|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.ui.parts.AbstractEditPartViewer
public abstract class AbstractEditPartViewer
The base implementation for EditPartViewer.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.gef.EditPartViewer |
---|
EditPartViewer.Conditional |
Field Summary | |
---|---|
protected List |
constantSelection
The unmodifiable list of selected editparts. |
protected EditPart |
focusPart
Deprecated. |
protected List |
selection
The raw list of selected editparts. |
protected List |
selectionListeners
Deprecated. |
Constructor Summary | |
---|---|
AbstractEditPartViewer()
Constructs the viewer and calls init() . |
Method Summary | |
---|---|
void |
addDragSourceListener(TransferDragSourceListener listener)
Provided for compatibility with existing code. |
void |
addDragSourceListener(TransferDragSourceListener listener)
Adds a TransferDragSourceListener to this viewer. |
void |
addDropTargetListener(TransferDropTargetListener listener)
Provided for compatibility with existing code. |
void |
addDropTargetListener(TransferDropTargetListener listener)
Adds a TransferDropTargetListener to this viewer. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to be notified of viewer property changes. |
void |
addSelectionChangedListener(ISelectionChangedListener listener)
|
void |
appendSelection(EditPart editpart)
Appends the specified EditPart to the viewer's
selection. |
abstract Control |
createControl(Composite parent)
Optionally creates the default Control using the default style. |
void |
deselect(EditPart editpart)
Removes the specified EditPart from the current selection. |
void |
deselectAll()
Deselects all EditParts. |
EditPart |
findObjectAt(Point pt)
Returns null or the EditPart associated with
the specified location. |
EditPart |
findObjectAtExcluding(Point pt,
Collection exclude)
Returns null or the EditPart at the specified
location, excluding the specified set. |
protected void |
fireSelectionChanged()
Fires selection changed to the registered listeners at the time called. |
void |
flush()
Flushes all pending updates to the Viewer. |
EditPart |
getContents()
Returns the contents of this Viewer. |
MenuManager |
getContextMenu()
Returns null or the MenuManager for this viewer. |
Control |
getControl()
Returns null or the SWT Control for this
viewer. |
protected DelegatingDragAdapter |
getDelegatingDragAdapter()
Returns null or the DelegatingDragAdapater. |
protected DelegatingDropAdapter |
getDelegatingDropAdapter()
Returns null or the DelegatingDropAdapater. |
protected DragSource |
getDragSource()
Returns null or the DragSource. |
protected DropTarget |
getDropTarget()
Returns null or the DropTarget. |
EditDomain |
getEditDomain()
Returns the EditDomain to which this viewer belongs. |
EditPartFactory |
getEditPartFactory()
Returns the EditPartFactory for this viewer. |
Map |
getEditPartRegistry()
Returns the Map for registering EditParts by
Keys. |
EditPart |
getFocusEditPart()
Returns the focus EditPart . |
KeyHandler |
getKeyHandler()
Returns the KeyHandler for this viewer. |
Object |
getProperty(String key)
Returns the value of the given property. |
ResourceManager |
getResourceManager()
Returns null , or the ResourceManager for this Viewer. |
RootEditPart |
getRootEditPart()
Returns the RootEditPart . |
List |
getSelectedEditParts()
Returns an unmodifiable List containing zero or more
selected editparts. |
ISelection |
getSelection()
Returns an ISelection containing a list of one or more EditPart. |
SelectionManager |
getSelectionManager()
Returns the viewer's selection manager. |
Map |
getVisualPartMap()
Returns the Map for associating visual parts with their
EditParts . |
protected void |
handleDispose(DisposeEvent e)
Called if and when the Control is disposed. |
protected void |
hookControl()
Called once the control has been set. |
protected void |
hookDragSource()
Called whenever the drag source is automatically
created. |
protected void |
hookDropTarget()
Called whenever the drop target is automatically
created. |
protected void |
init()
Called from the constructor. |
protected List |
primGetSelectedEditParts()
Returns the modifiable List of selected EditParts. |
protected void |
refreshDragSourceAdapter()
Creates or disposes a DragSource as needed, and sets the supported transfer types. |
protected void |
refreshDropTargetAdapter()
Creates or disposes a DropTarget as needed, and sets the supported transfer types. |
void |
registerAccessibleEditPart(AccessibleEditPart acc)
Used for accessibility purposes. |
void |
removeDragSourceListener(TransferDragSourceListener listener)
Deprecated. |
void |
removeDragSourceListener(TransferDragSourceListener listener)
Removes the specified drag source listener. |
void |
removeDropTargetListener(TransferDropTargetListener listener)
Deprecated. |
void |
removeDropTargetListener(TransferDropTargetListener listener)
Removes the specified drop target listener. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
removes the first instance of the specified property listener. |
void |
removeSelectionChangedListener(ISelectionChangedListener l)
|
void |
reveal(EditPart part)
Reveals the given EditPart if it is not visible. |
void |
select(EditPart editpart)
Replaces the current selection with the specified EditPart . |
void |
setContents(EditPart editpart)
Sets the contents for this Viewer. |
void |
setContents(Object contents)
Creates an EditPart for the provided model object using the
EditPartFactory . |
void |
setContextMenu(MenuManager manager)
Sets the context MenuManager for this viewer. |
void |
setControl(Control control)
Sets the Control for this viewer. |
void |
setCursor(Cursor cursor)
Sets the cursor for the viewer's Control . |
protected void |
setDragSource(DragSource source)
Sets the drag source. |
protected void |
setDropTarget(DropTarget target)
Sets the drop target. |
void |
setEditDomain(EditDomain editdomain)
Sets the EditDomain for this viewer. |
void |
setEditPartFactory(EditPartFactory factory)
Sets the EditPartFactory. |
void |
setFocus(EditPart part)
Sets the focus EditPart. |
void |
setKeyHandler(KeyHandler handler)
Sets the KeyHandler . |
void |
setProperty(String key,
Object value)
Sets a property on this viewer. |
void |
setRootEditPart(RootEditPart editpart)
Sets the root of this viewer. |
void |
setRouteEventsToEditDomain(boolean value)
Turns on/off the routing of events directly to the Editor. |
void |
setSelection(ISelection newSelection)
Sets the selection to the given selection and fires selection changed. |
void |
setSelectionManager(SelectionManager model)
Sets the selection manager for this viewer. |
protected void |
unhookControl()
Called when the control is being set to null , but before it
is null. |
void |
unregisterAccessibleEditPart(AccessibleEditPart acc)
Does nothing by default. |
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 |
---|
findObjectAtExcluding |
Field Detail |
---|
protected final List selection
protected final List constantSelection
protected List selectionListeners
protected EditPart focusPart
null
, the focus editpart is still implied to be the part
with primary selection. Subclasses should call the accessor:
getFocusEditPart()
whenever possible.
Constructor Detail |
---|
public AbstractEditPartViewer()
init()
.
Method Detail |
---|
public void setSelectionManager(SelectionManager model)
EditPartViewer
setSelectionManager
in interface EditPartViewer
model
- the new selection managerEditPartViewer.setSelectionManager(SelectionManager)
public void addDragSourceListener(TransferDragSourceListener listener)
EditPartViewer
addDragSourceListener
in interface EditPartViewer
listener
- a drag source listenerEditPartViewer.addDragSourceListener(org.eclipse.gef.dnd.TransferDragSourceListener)
public void addDragSourceListener(TransferDragSourceListener listener)
EditPartViewer
TransferDragSourceListener
to this viewer. This has
the side-effect of creating a DragSource
on
the viewer's Control. A Control can only have a single DragSource.
Clients must not create their own DragSource when using this method.
addDragSourceListener
in interface EditPartViewer
listener
- the listenerEditPartViewer.addDragSourceListener(TransferDragSourceListener)
public void addDropTargetListener(TransferDropTargetListener listener)
EditPartViewer
addDropTargetListener
in interface EditPartViewer
listener
- the listenerEditPartViewer.addDropTargetListener(org.eclipse.gef.dnd.TransferDropTargetListener)
public void addDropTargetListener(TransferDropTargetListener listener)
EditPartViewer
TransferDropTargetListener
to this viewer. This has
the side-effect of creating a DropTarget
on
the viewer's Control. A Control can only have a single DropTarget.
Clients must not create their own DropTarget when using this method.
addDropTargetListener
in interface EditPartViewer
listener
- the listenerEditPartViewer.addDropTargetListener(TransferDropTargetListener)
public void addPropertyChangeListener(PropertyChangeListener listener)
EditPartViewer
addPropertyChangeListener
in interface EditPartViewer
listener
- the listenerEditPartViewer.addPropertyChangeListener(PropertyChangeListener)
public void addSelectionChangedListener(ISelectionChangedListener listener)
addSelectionChangedListener
in interface ISelectionProvider
ISelectionProvider.addSelectionChangedListener(ISelectionChangedListener)
public void appendSelection(EditPart editpart)
EditPartViewer
EditPart
to the viewer's
selection. The EditPart becomes the new primary selection. Fires
selection changed to all
ISelectionChangedListener
s.
appendSelection
in interface EditPartViewer
editpart
- the EditPart to appendEditPartViewer.appendSelection(EditPart)
public abstract Control createControl(Composite parent)
EditPartViewer
Control
using the default style. The Control can also be created
externally and then set into the Viewer.
createControl
in interface EditPartViewer
parent
- the parent in which create the SWT Control
EditPartViewer.createControl(Composite)
public void deselect(EditPart editpart)
EditPartViewer
EditPart
from the current selection.
If the selection becomes empty, the viewer's contents
becomes the current selected part. The last EditPart in the new
selection is made primary
.
Fires selection changed to
ISelectionChangedListener
s.
deselect
in interface EditPartViewer
editpart
- the EditPart
to deselectEditPartViewer.deselect(EditPart)
public void deselectAll()
EditPartViewer
contents
becomes the current selection. Fires selection changed to
ISelectionChangedListener
s.
deselectAll
in interface EditPartViewer
EditPartViewer.deselectAll()
protected void handleDispose(DisposeEvent e)
Control
is disposed. Subclasses may
extend this method to perform additional cleanup.
e
- the disposeeventpublic final EditPart findObjectAt(Point pt)
EditPartViewer
null
or the EditPart
associated with
the specified location. The location is relative to the client area of
the Viewer's Control
. An EditPart is not directly visible.
It is targeted using its visual part which it registered using the
visual part map
. What constitutes a visual
part is viewer-specific. Examples include Figures and TreeItems.
findObjectAt
in interface EditPartViewer
pt
- The location
null
or an EditPartEditPartViewer.findObjectAt(Point)
public final EditPart findObjectAtExcluding(Point pt, Collection exclude)
EditPartViewer
null
or the EditPart
at the specified
location, excluding the specified set. This method behaves similarly to
EditPartViewer.findObjectAt(Point)
.
findObjectAtExcluding
in interface EditPartViewer
pt
- The mouse locationexclude
- The set of EditParts to be excluded
null
or an EditPartEditPartViewer.findObjectAtExcluding(Point, Collection)
protected void fireSelectionChanged()
public void flush()
EditPartViewer
flush
in interface EditPartViewer
EditPartViewer.flush()
public MenuManager getContextMenu()
EditPartViewer
null
or the MenuManager for this viewer. The menu
manager is set using EditPartViewer.setContextMenu(MenuManager)
.
getContextMenu
in interface EditPartViewer
null
or a MenuManagerEditPartViewer.getContextMenu()
public EditPart getContents()
EditPartViewer
The Root of the Viewer is different. By constrast, the root is never selected or targeted, and does not correspond to something in the model.
getContents
in interface EditPartViewer
EditPart
EditPartViewer.getContents()
public Control getControl()
EditPartViewer
null
or the SWT Control
for this
viewer. The control is either set explicitly or can be created by the
viewer.
getControl
in interface EditPartViewer
Control
EditPartViewer.getControl()
protected DelegatingDragAdapter getDelegatingDragAdapter()
null
or the DelegatingDragAdapater. The adapter is
created automatically when
addDragSourceListener(TransferDragSourceListener)
is called.
null
or the adapterprotected DelegatingDropAdapter getDelegatingDropAdapter()
null
or the DelegatingDropAdapater. The adapter is
created automatically when
addDropTargetListener(TransferDropTargetListener)
is called.
null
or the adapterprotected DragSource getDragSource()
null
or the DragSource. The drag source is created
automatically when
addDragSourceListener(TransferDragSourceListener)
is called.
null
or the drag sourceprotected DropTarget getDropTarget()
null
or the DropTarget. The drop target is created
automatically when
addDropTargetListener(TransferDropTargetListener)
is called.
null
or the drop targetpublic EditDomain getEditDomain()
EditPartViewer
EditDomain
to which this viewer belongs.
getEditDomain
in interface EditPartViewer
EditPartViewer.getEditDomain()
public EditPartFactory getEditPartFactory()
EditPartViewer
EditPartFactory
for this viewer. The
EditPartFactory is used to create the contents EditPart when
EditPartViewer.setContents(Object)
is called. It is made available so that
other EditParts can use it to create their children or connection
editparts.
getEditPartFactory
in interface EditPartViewer
EditPartViewer.getEditPartFactory()
public Map getEditPartRegistry()
EditPartViewer
Map
for registering EditParts
by
Keys. EditParts may register themselves using any method, and may
register themselves with multiple keys. The purpose of such registration
is to allow an EditPart to be found by other EditParts, or by listeners
of domain notifiers. By default, EditParts are registered by their model.
Some models use a "domain" notification system, in which all changes are dispatched to a single listener. Such a listener might use this map to lookup editparts for a given model, and then ask the editpart to update.
getEditPartRegistry
in interface EditPartViewer
EditPartViewer.getEditPartRegistry()
public EditPart getFocusEditPart()
EditPartViewer
EditPart
. Focus refers to keyboard
focus. This is the same concept as focus in a native Tree or Table. The
User can change focus using the keyboard without affecting the currently
selected objects. Never returns null
.
getFocusEditPart
in interface EditPartViewer
EditPart
EditPartViewer.getFocusEditPart()
public KeyHandler getKeyHandler()
EditPartViewer
KeyHandler
for this viewer. The KeyHandler is
sent KeyEvents by the currently active Tool
. This is
important, because only the current tool knows if it is in a state in
which keys should be ignored, such as during a drag. By default, only the
SelectionTool
forwards keysrokes. It does
not do so during a drag.
getKeyHandler
in interface EditPartViewer
null
or a KeyHandlerEditPartViewer.getKeyHandler()
public Object getProperty(String key)
EditPartViewer
null
if the
property has not been set, or has been set to null.
getProperty
in interface EditPartViewer
key
- the property's key
null
.EditPartViewer.getProperty(String)
public ResourceManager getResourceManager()
EditPartViewer
null
, or the ResourceManager for this Viewer. Once a
viewer has a Control, clients may access the viewer's resource manager.
Any resources constructed using this manager, but not freed, will be
freed when the viewer's control is disposed. This does not mean that
clients should be lazy about deallocating resources. If a resource is no
longer needed but the viewer is still in use, the client must deallocate
the resource.
Typical usage is by EditParts contained inside the viewer. EditParts
which are removed from the viewer should free their resources during
EditPart.removeNotify()
. When the viewer is disposed,
removeNotify()
is not called, but the viewer's resource
manager will be disposed anyway.
The viewer's default resource manager is linked to JFace's
global shared resources
.
getResourceManager
in interface EditPartViewer
EditPartViewer.getResourceManager()
public RootEditPart getRootEditPart()
EditPartViewer
RootEditPart
. The RootEditPart is a special
EditPart that serves as the parent to the contents editpart. The
root is never selected. The root does not correspond to anything
in the model. The User does not interact with the root.
The RootEditPart has a single child: the contents
.
By defining the concept of "root", GEF allows the application's "real" EditParts to be more homogeneous. For example, all non-root EditParts have a parent. Also, it allows applications to change the type of root being used without affecting their own editpart implementation hierarchy.
getRootEditPart
in interface EditPartViewer
EditPartViewer.getRootEditPart()
public List getSelectedEditParts()
EditPartViewer
List
containing zero or more
selected editparts. This list may be empty. In contrast, the inherited
method
ISelectionProvider.getSelection()
should not return an empty selection. When no editparts are selected,
generally the contents editpart is considered to be selected. This list
can be modified indirectly by calling other methods on the viewer.
getSelectedEditParts
in interface EditPartViewer
EditPartViewer.getSelectedEditParts()
public ISelection getSelection()
getSelectedEditParts()
returns an empty list, the
contents editpart (getContents()
) is returned as the
current selection.
getSelection
in interface EditPartViewer
getSelection
in interface ISelectionProvider
ISelectionProvider.getSelection()
public SelectionManager getSelectionManager()
EditPartViewer
ISelection
for the viewer, and manages all changes
to the current selection.
getSelectionManager
in interface EditPartViewer
EditPartViewer.getSelectionManager()
public Map getVisualPartMap()
EditPartViewer
Map
for associating visual parts with their
EditParts
. This map is used for hit-testing. Hit testing is
performed by first determining which visual part is hit, and then mapping
that part to an EditPart
. What consistutes a visual
part is viewer-specific. Examples include Figures
and
TreeItems
.
getVisualPartMap
in interface EditPartViewer
EditPartViewer.getVisualPartMap()
protected void hookControl()
unhookControl()
protected void hookDragSource()
drag source
is automatically
created.
protected void hookDropTarget()
drop target
is automatically
created.
protected void init()
protected List primGetSelectedEditParts()
protected void refreshDragSourceAdapter()
protected void refreshDropTargetAdapter()
public void registerAccessibleEditPart(AccessibleEditPart acc)
EditPartViewer
registerAccessibleEditPart
in interface EditPartViewer
acc
- the AccessibleEditPartEditPartViewer.registerAccessibleEditPart(AccessibleEditPart)
public void removeDragSourceListener(TransferDragSourceListener listener)
EditPartViewer
removeDragSourceListener
in interface EditPartViewer
listener
- the listenerEditPartViewer.removeDragSourceListener(org.eclipse.gef.dnd.TransferDragSourceListener)
public void removeDragSourceListener(TransferDragSourceListener listener)
EditPartViewer
removeDragSourceListener
in interface EditPartViewer
listener
- the listenerEditPartViewer.removeDragSourceListener(TransferDragSourceListener)
public void removeDropTargetListener(TransferDropTargetListener listener)
EditPartViewer
removeDropTargetListener
in interface EditPartViewer
EditPartViewer.removeDropTargetListener(org.eclipse.gef.dnd.TransferDropTargetListener)
public void removeDropTargetListener(TransferDropTargetListener listener)
EditPartViewer
removeDropTargetListener
in interface EditPartViewer
listener
- the listenerEditPartViewer.removeDropTargetListener(TransferDropTargetListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
EditPartViewer
removePropertyChangeListener
in interface EditPartViewer
listener
- the listener to removeEditPartViewer.removePropertyChangeListener(PropertyChangeListener)
public void removeSelectionChangedListener(ISelectionChangedListener l)
removeSelectionChangedListener
in interface ISelectionProvider
ISelectionProvider.removeSelectionChangedListener(ISelectionChangedListener)
public void reveal(EditPart part)
EditPartViewer
reveal
in interface EditPartViewer
part
- the EditPart to revealEditPartViewer.reveal(EditPart)
public void select(EditPart editpart)
EditPartViewer
EditPart
.
That part becomes the primary selection. Fires selection changed to
ISelectionChangedListener
s.
select
in interface EditPartViewer
editpart
- the new selectionEditPartViewer.select(EditPart)
public void setContextMenu(MenuManager manager)
EditPartViewer
MenuManager
for this viewer. The
MenuManager will be asked to create a Menu, which will be used as the
context menu for this viewer's Control.
setContextMenu
in interface EditPartViewer
manager
- the ContextMenuProvider
EditPartViewer.setContextMenu(MenuManager)
public void setContents(EditPart editpart)
EditPartViewer
EditPartViewer.setContents(Object)
.
setContents
in interface EditPartViewer
editpart
- the contentsEditPartViewer.setContents(EditPart)
public void setContents(Object contents)
EditPartViewer
EditPart
for the provided model object using the
EditPartFactory
. That EditPart is then added to the
RootEditPart
, and becomes the viewer's
contents editpart.
setContents
in interface EditPartViewer
contents
- the contents model objectEditPartViewer.setContents(Object)
public void setControl(Control control)
EditPartViewer
Control
for this viewer. The viewer's control is
also set automatically if EditPartViewer.createControl(Composite)
is called.
setControl
in interface EditPartViewer
control
- the ControlEditPartViewer.setControl(Control)
public void setCursor(Cursor cursor)
EditPartViewer
Control
. This method should
only be called by Tools
. null
can be used to
indicate that the default cursor should be restored.
setCursor
in interface EditPartViewer
cursor
- null
or a CursorEditPartViewer.setCursor(Cursor)
protected void setDragSource(DragSource source)
refreshDragSourceAdapter()
.
source
- null
or a drag sourceprotected void setDropTarget(DropTarget target)
refreshDropTargetAdapter()
.
target
- dropTarget null
or a drop targetpublic void setEditDomain(EditDomain editdomain)
EditPartViewer
EditDomain
for this viewer. The Viewer will route
all mouse and keyboard events to the EditDomain.
setEditDomain
in interface EditPartViewer
editdomain
- The EditDomainEditPartViewer.setEditDomain(EditDomain)
public void setEditPartFactory(EditPartFactory factory)
EditPartViewer
setEditPartFactory
in interface EditPartViewer
factory
- the factoryEditPartViewer.setEditPartFactory(org.eclipse.gef.EditPartFactory)
public void setFocus(EditPart part)
EditPartViewer
setFocus
in interface EditPartViewer
part
- the FocusPart.EditPartViewer.setFocus(EditPart)
public void setKeyHandler(KeyHandler handler)
EditPartViewer
KeyHandler
.
setKeyHandler
in interface EditPartViewer
handler
- the KeyHandlerEditPartViewer.setKeyHandler(KeyHandler)
public void setProperty(String key, Object value)
EditPartViewer
EditPartViewer.addPropertyChangeListener(PropertyChangeListener)
. A
null
value will remove the property from the viewer.
setProperty
in interface EditPartViewer
key
- a unique string identifying the propertyvalue
- the properties new value or null
to removeEditPartViewer.setProperty(String, Object)
public void setRootEditPart(RootEditPart editpart)
EditPartViewer
setRootEditPart
in interface EditPartViewer
editpart
- the RootEditPartEditPartViewer.setRootEditPart(RootEditPart)
public void setRouteEventsToEditDomain(boolean value)
EditPartViewer
EditDomain
rather than handled in the default way.
setRouteEventsToEditDomain
in interface EditPartViewer
value
- true if the viewer should route events to the EditDomainEditPartViewer.setRouteEventsToEditDomain(boolean)
public void setSelection(ISelection newSelection)
IStructuredSelection
or it will be
ignored.
setSelection
in interface ISelectionProvider
ISelectionProvider.setSelection(ISelection)
protected void unhookControl()
null
, but before it
is null.
public void unregisterAccessibleEditPart(AccessibleEditPart acc)
unregisterAccessibleEditPart
in interface EditPartViewer
acc
- the accessible partEditPartViewer.unregisterAccessibleEditPart(AccessibleEditPart)
|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |