|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdsto.dfc.util.BasicPropertyEventSource
dsto.dfc.swt.commands.AbstractCommand
dsto.dfc.swt.viewers.CmdDeleteItem
public class CmdDeleteItem
Generic "Delete Items" command for JFace Viewer's showing a Collection
(although could be subclassed for non Collection's). The default behaviour
is to remove () the selected items from the collection. Subclasses may
choose to override canDelete(List)
, confirmDelete
,
deleteItems(List)
and updateEnabled()
to customize
behaviour.
Field Summary | |
---|---|
protected boolean |
confirmDelete
|
protected String |
confirmMessage
|
protected Collection |
items
|
protected org.eclipse.jface.viewers.Viewer |
viewer
|
Fields inherited from class dsto.dfc.swt.commands.AbstractCommand |
---|
NO_ICON |
Constructor Summary | |
---|---|
CmdDeleteItem(org.eclipse.jface.viewers.Viewer viewer)
Create a new instance. |
|
CmdDeleteItem(org.eclipse.jface.viewers.Viewer viewer,
Collection items)
Create a new instance. |
Method Summary | |
---|---|
protected boolean |
canDelete(List toDelete)
Check if all the items in the list can be deleted (eg some items may be undeletable). |
protected boolean |
confirmDelete(List toDelete)
Confirm with the user that it's OK to delete the given items. |
protected void |
deleteItems(List toDelete)
Delete the given items. |
void |
dispose()
Dispose of the object (unregister listeners, close open resources etc). |
void |
execute()
Execute the command. |
String |
getConfirmMessage()
|
protected Collection |
getItems()
|
boolean |
isConfirmDelete()
|
void |
selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent e)
|
void |
setConfirmDelete(boolean confirmDelete)
Set whether the default confirmDelete () method will ask the user to confirm the operation. |
void |
setConfirmMessage(String message)
Set the message that is displayed in the confirm dialog. |
protected void |
updateEnabled()
Update the enabled status of the command given the current selected items. |
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 |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface dsto.dfc.util.PropertyEventSource |
---|
addPropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
protected org.eclipse.jface.viewers.Viewer viewer
protected Collection items
protected boolean confirmDelete
protected String confirmMessage
Constructor Detail |
---|
public CmdDeleteItem(org.eclipse.jface.viewers.Viewer viewer)
public CmdDeleteItem(org.eclipse.jface.viewers.Viewer viewer, Collection items)
viewer
- The viewer.items
- The items to delete from.Method Detail |
---|
public void dispose()
Disposable
dispose
in interface Disposable
public boolean isConfirmDelete()
public void setConfirmDelete(boolean confirmDelete)
public void setConfirmMessage(String message)
public String getConfirmMessage()
public void execute()
Command
CommandListener.commandExecuted(CommandEvent)
when executed.
execute
in interface Command
execute
in class AbstractCommand
protected Collection getItems()
protected void deleteItems(List toDelete)
protected boolean confirmDelete(List toDelete)
protected boolean canDelete(List toDelete)
protected void updateEnabled()
public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent e)
selectionChanged
in interface org.eclipse.jface.viewers.ISelectionChangedListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |