dsto.dfc.swt.viewers
Class AbstractCreateItemCommand
java.lang.Object
dsto.dfc.util.BasicPropertyEventSource
dsto.dfc.swt.commands.AbstractCommand
dsto.dfc.swt.viewers.AbstractCreateItemCommand
- All Implemented Interfaces:
- Command, Copyable, JavaBean, PropertyEventSource, Serializable, Cloneable
public abstract class AbstractCreateItemCommand
- extends AbstractCommand
Abstract base class for commands that create new items in a collection
being viewed by a JFace StructuredViewer. Handles common behaviour of
creating then selecting new items. Subclasses can simply implement
createItem()
.
- Version:
- $Revision$
- Author:
- mpp
- See Also:
- Serialized Form
Field Summary |
protected Collection |
items
|
protected org.eclipse.jface.viewers.StructuredViewer |
view
|
Methods inherited from class dsto.dfc.swt.commands.AbstractCommand |
addCommandListener, clone, createDefaultDisplayName, fireCommandExecuted, fireCommandExecuted, getAccelerator, getContextMenuGroup, getDescription, getDisplayName, getGroupInView, getIcon, getLogString, getMainMenuGroup, getMnemonic, getName, getToolbarGroup, isEnabled, isInteractive, removeCommandListener, setAccelerator, setContextMenuGroup, setDescription, setDisplayName, setEnabled, setIcon, setInteractive, setMainMenuGroup, setMnemonic, setName, setToolbarGroup |
Methods inherited from class dsto.dfc.util.BasicPropertyEventSource |
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener, setPropertyChangeSource |
view
protected org.eclipse.jface.viewers.StructuredViewer view
items
protected Collection items
AbstractCreateItemCommand
public AbstractCreateItemCommand(org.eclipse.jface.viewers.StructuredViewer view)
AbstractCreateItemCommand
public AbstractCreateItemCommand(org.eclipse.jface.viewers.StructuredViewer view,
Collection items)
- Create a new instance.
- Parameters:
view
- The viewer that is showing the groups.items
- The collection to add new items to. It is assumed that the
viewer is listening for changes.
getView
public org.eclipse.jface.viewers.StructuredViewer getView()
getItems
public Collection getItems()
execute
public void execute()
- Description copied from interface:
Command
- Execute the command. Commands should fire
CommandListener.commandExecuted(CommandEvent)
when executed.
- Specified by:
execute
in interface Command
- Specified by:
execute
in class AbstractCommand
addItem
protected void addItem(Object item)
createItem
protected abstract Object createItem()
- Subclasses should implement this to create a new item.
- Returns:
- The new item, or null if no item to be added (eg dialog was
cancelled).
Copyright © 2008 Commonwealth of Australia