|
RSE Release 3.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.rse.ui.actions.SystemBaseAction
public class SystemBaseAction
A suggested base class for remote systems related actions.
What this offers beyond the basic Action class:
To use this dialog, subclass it and override the following methods
:run()
, where you place the code to do the actual work when this action is invoked.
updateSelection(IStructuredSelection)
, for selection sensitive actions. This is your first
opporunity to enable/disable the action when the selection changes, by looking at the given selection
and returning true or false. The default implementation calls checkObjectType for each selected object.
checkObjectType(Object)
, for selection sensitive actions. This is your second
opporunity to enable/disable the action when the selection changes, by looking at each individual
selected object, and returning true or false.
In addition to the methods you must override, you can optionally call various methods to configure this action:
setInputs(Shell, Viewer,ISelection)
or setShell(Shell)
and setViewer(Viewer)
and
setSelection(ISelection)
. These methods are called by the RSE viewers for context menu actions, and
can be called directly for actions used in other contexts.
setSelectionProvider(ISelectionProvider)
, for those cases when your action monitors for selection
changes (pull) versus being told about them (push) via setSelection. This is less efficient, and should only
be used for selection-dependent actions in toolbars and pull-down menus, versus popup menus.
setHelp(String)
to set the ID of the F1 context help for this action.
setContextMenuGroup(String)
to set the menu group in which to place this action, when used in menus.
allowOnMultipleSelection(boolean)
to specify if this action is to be enabled or disabled when multiple
objects are selected. The default is disabled.
setSelectionSensitive(boolean)
to specify if this action's enabled state is not sensitive to what
is currently selected.
Further, the code you write can use the properties captured by this action and retrievable by the getter methods supplied by this class.
ISystemAction
,
SystemBaseDialogAction
,
SystemBaseWizardAction
Field Summary | |
---|---|
protected boolean |
allowOnMultipleSelection
|
protected Cursor |
arrowCursor
|
protected String |
helpId
|
protected boolean |
selectionSensitive
|
protected Shell |
shell
|
protected IStructuredSelection |
sSelection
|
protected boolean |
traceSelections
|
protected String |
traceTarget
|
protected Viewer |
viewer
|
protected Cursor |
waitCursor
|
Fields inherited from interface org.eclipse.jface.action.IAction |
---|
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT |
Constructor Summary | |
---|---|
SystemBaseAction(String text,
ImageDescriptor image,
Shell shell)
Constructor for SystemBaseAction when translated label is known. |
|
SystemBaseAction(String text,
Shell shell)
Used for actions with no image icon. |
|
SystemBaseAction(String text,
String tooltip,
ImageDescriptor image,
Shell parent)
Constructor for SystemBaseAction when translated label and tooltip are known. |
|
SystemBaseAction(String text,
String tooltip,
Shell shell)
Used for actions with no image icon. |
|
SystemBaseAction(String text,
String tooltip,
String description,
ImageDescriptor image,
int style,
Shell shell)
Constructor for SystemBaseAction when translated label and tooltip and description are all known. |
|
SystemBaseAction(String text,
String tooltip,
String description,
ImageDescriptor image,
Shell shell)
Constructor for SystemBaseAction when translated label and tooltip and description are all known. |
|
SystemBaseAction(String text,
String tooltip,
String description,
Shell shell)
Used for actions with no image icon. |
Method Summary | |
---|---|
void |
allowOnMultipleSelection(boolean allow)
This method is supplied for actions that are to be enable even when more than one item is selected. |
boolean |
checkObjectType(Object selectedObject)
Second and easiest opportunity to decide if the action should be enabled or not based on the current selection. |
String |
getContextMenuGroup()
Get the context menu group this action is to go into, for popup menus. |
protected ISystemTree |
getCurrentTreeView()
Return the current viewer as an ISystemTree if it is one, or null otherwise |
protected Object |
getFirstSelection()
Return first item currently selected, as per last call to selectionChanged. |
String |
getHelpContextId()
Retrieve the help id for this action |
protected Object |
getNextSelection()
Return next item currently selection, as per last call to selectionChanged. |
protected ISystemRemoteElementAdapter |
getRemoteAdapter(Object o)
Returns the implementation of ISystemRemoteElement for the given object. |
IStructuredSelection |
getSelection()
Return current selection, as per last call to selectionChanged. |
ISelectionProvider |
getSelectionProvider()
Return value of last call to getSelectionProvider. |
Shell |
getShell()
Retrieves the parent shell for this action. |
protected Shell |
getShell(boolean doTest)
Retrieves the parent shell for this action. |
IHost |
getSystemConnection()
Return the system connection which is the parent of whatever is currently selected. |
protected ISystemViewElementAdapter |
getViewAdapter(Object o)
Returns the implementation of ISystemViewElement for the given object. |
Viewer |
getViewer()
Get the Viewer that called this action. |
boolean |
isDummy()
Return if true if this is a dummy action |
boolean |
isEnabled()
Disables this action if offline mode, otherwise delegates to the super class. |
boolean |
isSelectionSensitive()
Return whether this action is selection-sensitive. |
protected void |
issueTraceMessage(String msg)
Issue trace message |
void |
run()
This is the method called when the user selects this action. |
void |
selectionChanged(SelectionChangedEvent event)
This is called when the user selects something in the tree. |
void |
setAvailableOffline(boolean availableOffline)
If this is one of those rare actions that is to be made available in offline mode, then call this during or immediately after constructing to state that. |
void |
setBusyCursor(boolean setBusy)
Set the cursor to the wait cursor (true) or restores it to the normal cursor (false). |
void |
setContextMenuGroup(String group)
Set the context menu group this action is to go into, for popup menus. |
protected void |
setDisplayCursor(Cursor c)
Sets the given cursor for all shells currently active for this window's display. |
static void |
setDisplayCursor(Shell shell,
Cursor c)
Sets the given cursor for all shells currently active for the given shell's display. |
void |
setHelp(String id)
Set the help id for the action |
void |
setHost(IHost connection)
Set the SystemConnection used by this action for disabling the action in offline mode, or for whatever reason subclasses may need it. |
void |
setInputs(Shell shell,
Viewer v,
ISelection selection)
An optimization for performance reasons that allows all inputs to be set in one call |
void |
setSelection(ISelection selection)
This is called by the UI calling the action, if that UI is not a selection provider. |
void |
setSelectionProvider(ISelectionProvider provider)
Identify the UI object that will be used to get the selection list from. |
void |
setSelectionSensitive(boolean sensitive)
Specify whether this action is selection-sensitive. |
void |
setShell(Shell shell)
Sets the parent shell for this action. |
protected void |
setTracing(boolean tracing)
Turn on tracing for selections, shell and viewer to watch as it is set |
protected void |
setTracing(String tracingClassTarget)
Turn on tracing for selections, shell and viewer to watch as it is set, scoped to a particular class name (will use indexOf('xxx') to match). |
void |
setViewer(Viewer v)
Set the Viewer that called this action. |
boolean |
updateSelection(IStructuredSelection selection)
First opportunity to decide if the action should be enabled or not based on the current selection. |
Methods inherited from class org.eclipse.jface.action.AbstractAction |
---|
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener |
Methods inherited from class org.eclipse.core.commands.common.EventManager |
---|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.jface.action.IAction |
---|
addPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isHandled, removePropertyChangeListener, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText |
Field Detail |
---|
protected Shell shell
protected boolean allowOnMultipleSelection
protected IStructuredSelection sSelection
protected boolean selectionSensitive
protected boolean traceSelections
protected String traceTarget
protected Viewer viewer
protected String helpId
protected Cursor waitCursor
protected Cursor arrowCursor
Constructor Detail |
---|
public SystemBaseAction(String text, ImageDescriptor image, Shell shell)
text
- string to display in menu or toolbarimage
- icon to display in menu or toolbar. Can be null.shell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.public SystemBaseAction(String text, String tooltip, ImageDescriptor image, Shell parent)
text
- string to display in menu or toolbartooltip
- string to display when user hovers mouse over action.image
- icon to display in menu or toolbar. Can be null.parent
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.public SystemBaseAction(String text, String tooltip, String description, ImageDescriptor image, Shell shell)
text
- string to display in menu or toolbartooltip
- string to display when user hovers mouse over action.description
- string displayed in status bar of some displays. Longer than tooltip.image
- icon to display in menu or toolbar. Can be null.shell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.public SystemBaseAction(String text, String tooltip, String description, ImageDescriptor image, int style, Shell shell)
text
- string to display in menu or toolbartooltip
- string to display when user hovers mouse over action.description
- string displayed in status bar of some displays. Longer than tooltip.image
- icon to display in menu or toolbar. Can be null.style
- one of AS_PUSH_BUTTON
, AS_CHECK_BOX
,
AS_DROP_DOWN_MENU
, AS_RADIO_BUTTON
, and AS_UNSPECIFIED
.shell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.public SystemBaseAction(String text, Shell shell)
text
- string to display in menu or toolbarshell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.public SystemBaseAction(String text, String tooltip, Shell shell)
text
- string to display in menu or toolbartooltip
- string to display when user hovers mouse over action.shell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.public SystemBaseAction(String text, String tooltip, String description, Shell shell)
text
- string to display in menu or toolbartooltip
- string to display when user hovers mouse over action.description
- string displayed in status bar of some displays. Longer than tooltip.shell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.Method Detail |
---|
public void setBusyCursor(boolean setBusy)
protected void setDisplayCursor(Cursor c)
c
- the cursorpublic static void setDisplayCursor(Shell shell, Cursor c)
c
- the cursorprotected void setTracing(boolean tracing)
protected void setTracing(String tracingClassTarget)
protected void issueTraceMessage(String msg)
protected ISystemViewElementAdapter getViewAdapter(Object o)
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
public void setInputs(Shell shell, Viewer v, ISelection selection)
setInputs
in interface ISystemAction
public void setShell(Shell shell)
setShell
in interface ISystemAction
public void setViewer(Viewer v)
setViewer
in interface ISystemAction
public void selectionChanged(SelectionChangedEvent event)
selectionChanged
in interface ISelectionChangedListener
public void setSelection(ISelection selection)
setSelection
in interface ISystemAction
selectionChanged(SelectionChangedEvent event)
public void setSelectionProvider(ISelectionProvider provider)
public void setHelp(String id)
setHelp
in interface ISystemAction
public void setContextMenuGroup(String group)
setContextMenuGroup
in interface ISystemAction
public void allowOnMultipleSelection(boolean allow)
allowOnMultipleSelection
in interface ISystemAction
public void setSelectionSensitive(boolean sensitive)
setSelectionSensitive
in interface ISystemAction
public boolean updateSelection(IStructuredSelection selection)
The default implementation of this method:
public boolean checkObjectType(Object selectedObject)
public void run()
run
in interface IAction
run
in class Action
Action.run()
public boolean isDummy()
isDummy
in interface ISystemAction
public String getHelpContextId()
getHelpContextId
in interface ISystemAction
public Shell getShell()
getShell
in interface ISystemAction
protected Shell getShell(boolean doTest)
public Viewer getViewer()
getViewer
in interface ISystemAction
protected ISystemTree getCurrentTreeView()
public String getContextMenuGroup()
getContextMenuGroup
in interface ISystemAction
public boolean isSelectionSensitive()
isSelectionSensitive
in interface ISystemAction
public ISelectionProvider getSelectionProvider()
public IStructuredSelection getSelection()
getSelection
in interface ISystemAction
protected Object getFirstSelection()
getNextSelection()
protected Object getNextSelection()
getFirstSelection()
public boolean isEnabled()
isEnabled
in interface IAction
isEnabled
in class Action
IAction.isEnabled()
public void setAvailableOffline(boolean availableOffline)
public void setHost(IHost connection)
public IHost getSystemConnection()
|
RSE Release 3.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |