|
Remote Systems v6.4.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.etools.systems.core.ui.uda.SystemUDActionSubsystem
Provide the interface to customize and implement the user-defined actions support for the subsystems which implement it. Subsystems are expected to override these methods as required.
For some subsystem factories, actions and types can be partitioned/scoped by "domain". Eg, for iSeries actions are scoped by object and member, and each has unique lists of actions and types. This base class offers all the support for supporting domains, but it is triggered by the method supportsDomains() which is overridden by child classes appropriately.
Some subsystems will support named types by which actions can be scoped. This support is triggered by supportsTypes(), which returns true by default but can be overridden by childclasses.
Field Summary | |
---|---|
protected SubSystem |
_subsystem
|
static String |
Copyright
|
protected SystemUDActionElement |
currentAction
|
static int |
DOMAIN_NONE
|
protected SubSystemFactory |
subsystemFactory
|
protected boolean |
testAction
|
protected SystemUDActionManager |
udActionManager
|
protected SystemUDAResolvedTypes |
udaResolvedTypes
|
protected SystemUDTypeManager |
udTypeManager
|
Fields inherited from interface com.ibm.etools.systems.core.ui.commands.ISystemSubstitutor |
---|
copyright |
Constructor Summary | |
---|---|
SystemUDActionSubsystem()
Constructor |
Method Summary | |
---|---|
void |
addUserActions(IMenuManager menu,
IStructuredSelection selection,
SystemProfile profile,
Shell shell)
Populate context menu ("User Actions->" cascading action) with user actions that meet their type-scoping criteria for given selection. |
protected boolean |
checkDirtyEditors(IStructuredSelection selection)
|
protected Object |
collectNames(Shell shell,
Iterator elements,
StringBuffer collectedNames)
When processing an action that has elected to be invoked only once, versus once per selected object, we call this method to collect the names of the selected objects into a single string buffer. |
protected Object |
collectNamesDefaultMethod(Shell shell,
Iterator elements,
StringBuffer collectedNames)
Allows subclasses to call it even if their immediate parent overrides |
protected abstract boolean |
doActionsMigration(SystemProfile profile,
String oldRelease)
Overridable method for child classes to do migration of their actions. |
protected String |
doCommandSubstitutions(SystemUDActionElement action,
String cmd,
Object selectedObject)
Called when user selects a user action to run, from the base user action class. |
protected abstract boolean |
doTypesMigration(SystemProfile profile,
String oldRelease)
Overridable method for child classes to do migration of their types. |
boolean |
eligibleUserActionsForSelection(IStructuredSelection selection,
SystemProfile profile)
Check to see it any actions will apply to this selection. |
abstract SystemCmdSubstVarList |
getActionSubstVarList(int actionDomainType)
Return the list of substitution variables for the given domain type. |
protected SystemProfile[] |
getActiveSystemProfiles()
Get the active system profiles |
protected String |
getAllNamesSubstitutionVariable()
When processing an action that has elected to be invoked only once, versus once per selected object, we call this method to get the "all names" substitution variable so that we can substitute it with the collection of names of all selected objects. |
protected static RemoteCmdSubSystem |
getCommandSubSystem(Object selectedObject)
Get the command subsystem associated the given remote object |
String |
getCommonSubstitutionValues(String subvar,
Object context)
This abstraction allows child subclasses to override getSubstitutionValues, yet grandchild subclasses to still call this common class if needed. |
protected SystemUDActionEditPane |
getCustomUDActionEditPane(SubSystemFactory ssFactory,
SystemProfile profile,
ISystemUDAEditPaneHoster parent,
ISystemUDTreeView tv)
Historical. |
protected SystemUDActionEditPane |
getCustomUDActionEditPane(SubSystem ss,
ISystemUDAEditPaneHoster parent,
ISystemUDTreeView tv)
Historical. |
SystemUDActionEditPane |
getCustomUDActionEditPane(SubSystem ss,
SubSystemFactory ssFactory,
SystemProfile profile,
ISystemUDAEditPaneHoster parent,
ISystemUDTreeView tv)
Return the action's edit pane. |
SystemUDTypeEditPane |
getCustomUDTypeEditPane(SubSystemFactory ssFactory,
SystemProfile profile,
ISystemUDAEditPaneHoster parent,
ISystemUDTreeView tv)
Historical. |
protected SystemUDTypeEditPane |
getCustomUDTypeEditPane(SubSystem ss,
ISystemUDAEditPaneHoster parent,
ISystemUDTreeView tv)
Historical. |
SystemUDTypeEditPane |
getCustomUDTypeEditPane(SubSystem ss,
SubSystemFactory ssf,
SystemProfile profile,
ISystemUDAEditPaneHoster parent,
ISystemUDTreeView tv)
Subclasses may override to provide a custom type edit pane subclass. |
protected List |
getDirtyEditors(IStructuredSelection sel)
|
protected abstract int |
getDomainFromSelection(IStructuredSelection selection)
Determine domain, given the selection. |
Image |
getDomainImage(int domain)
Get the domain icon to show in the tree views |
String[] |
getDomainNames()
Get the list of untranslated domain names |
Image |
getDomainNewImage(int domain)
Get the domain icon to show in the tree views, for the new item for this domain |
Image |
getDomainNewTypeImage(int domain)
Get the domain icon to show in the named type tree view, for the new item for this domain |
protected ISystemEditableRemoteObject |
getEditableFor(IAdaptable selected)
|
protected static RemoteFileSubSystem |
getFileSubSystem(Object selectedObject)
Get the first file subsystem associated the given remote object. |
int |
getMaximumDomain()
For efficiency reasons, internally we use an integer to represent a domain. |
protected char |
getNameDelimiter()
When processing an action that has elected to be invoked only once, versus once per selected object, we call this method to get the delimiter character to surround each name in. |
protected String |
getNewNodeActionLabel()
Overridable method for child classes to supply the label to display in the "New" node for actions. |
protected String |
getNewNodeTypeLabel()
Overridable method for child classes to supply the label to display in the "New" node for type. |
protected static ISystemRemoteElementAdapter |
getRemoteAdapter(Object o)
Returns the implementation of ISystemRemoteElement for the given object. |
SystemUDAResolvedTypes |
getResolvedTypesHelper()
|
int |
getSingleDomain(SystemUDBaseManager docManager)
In some cases, we supports domains in general, but only want to expose one of those domains to the user. |
String |
getSubstitutionValue(String subvar,
Object context)
From the interface ISystemSubstitutor. |
SubSystem |
getSubsystem()
Retrieve current subsystem |
SubSystemFactory |
getSubSystemFactory()
Retrieve current subsystem factory. |
String |
getTestActionName()
Return the command name that tells us this is an action for testing substitution variables. |
String |
getTestFileName()
Return the default name of the test file in test mode. |
String |
getTestFilePath()
Return the default path of the test file in test mode The test file is generated at action run-time when the action name is getTestActionName() .
|
protected String |
getTypesDelimiter()
Get the delimiter used to delimiter the types in a type string. |
SystemUDActionManager |
getUDActionManager()
Get the singleton manager of user-defined actions for this subsystem factory |
SystemUDTypeManager |
getUDTypeManager()
Get the singleton manager of named file types for this subsystem factory |
boolean |
getWorkingOfflineMode()
We disable user defined actions if we are in work-offline mode. |
String[] |
getXlatedDomainNames()
Get the list of translated domain names |
String[] |
getXlatedDomainNewNames()
Get the list of translated domain names for use in the tree view, for the "New" nodes, in the Work With User Actions dialog. |
String[] |
getXlatedDomainNewTypeNames()
Get the list of translated domain names for use in the tree view, for the "New" nodes, in the Work With User Types dialog. |
boolean |
hasUnsupportedSubstitutionVars(Object action,
int domain)
|
abstract String |
internalGetSubstitutionValue(SystemUDActionElement currentAction,
String substitutionVariable,
Object context)
Overridable extension point for child class to do variable substitution for variables unique to them. |
protected abstract boolean |
isMatch(Object actionType,
Object selectedObject,
int domainType)
Compares a particular file type (not named, but actual scalar/generic type) to a specific user-selected remote object. |
String |
mapDomainName(int domainInteger)
For efficiency reasons, internally we use an integer to represent a domain. |
int |
mapDomainName(String domainName)
Map a given untranslated domain name to its integer value |
String |
mapDomainXlatedName(int domainInteger)
For efficiency reasons, internally we use an integer to represent a domain. |
String |
mapDomainXlatedNewName(int domainInteger)
Same as above but specifically for what is shown in the work with user actions dialog for the new element |
String |
mapDomainXlatedNewTypeName(int domainInteger)
Same as above but specifically for what is shown in the work with named types dialog for the new element |
protected boolean |
meetsSelection(SystemUDActionElement action,
IStructuredSelection selection,
int domainType)
Given an action, and the currently selected remote objects, and the domain of those, return true if ALL of the selected remote objects matches any of the type criteria for this action |
abstract SystemUDActionElement[] |
primeDefaultActions(SystemUDActionManager udad,
SystemProfile profile)
Prime the user data with the default actions. |
abstract SystemUDTypeElement[] |
primeDefaultTypes(SystemUDTypeManager udtd)
Prime the user data with the default types. |
protected void |
printTestActionInvokeOnceInformation(Shell shell,
PrintWriter writer)
Overriddable method for printing out information about the collected names for "invoke once" actions, when in test mode. |
protected void |
processingSelection(boolean processingSelection)
Method called at the start and end of running user actions This allows children a chance to perform some action before and after the actions are run by overriding this method. |
protected String |
promptCommand(Shell shell,
String command)
Called when processing user action that has the "prompt" attribute set. |
protected String |
promptCommandDefault(Shell shell,
String command)
This allows child classes to call this directly |
void |
resetResolvedTypes()
|
protected String[] |
resolveTypes(String[] p_types,
int domainType)
Given a list of names that represent named types, resolve that into a concatenated list of all types for the given type names. |
boolean |
restoreDefaultAction(SystemUDActionElement element,
int domain,
String actionName)
Given this IBM-supplied user action, restore it to its IBM-supplied state. |
boolean |
restoreDefaultType(SystemUDTypeElement element,
int domain,
String typeName)
Given this IBM-supplied named type, restore it to its IBM-supplied state |
void |
run(Shell shell,
SystemUDActionElement action,
IStructuredSelection selection,
ISystemResourceChangeListener viewer)
When the user selects one or more objects in the RSE, then right clicks and selects a user action, this method is called (by the SystemUDAsBaseAction class). |
protected boolean |
runCommand(Shell shell,
SystemUDActionElement action,
String cmdString,
RemoteCmdSubSystem cmdSubSystem,
Object context,
Viewer viewer)
After an action's command has been resolved (vars substituted) this method is called to actually do the remote command execution |
void |
setSubsystem(SubSystem ss)
Set current subsystem |
void |
setSubSystemFactory(SubSystemFactory ssf)
Set current subsystem factory. |
boolean |
supportsDomains()
Return true if the action/type manager supports domains. |
boolean |
supportsTypes()
Return true if actions can be scoped by file types Default is true |
boolean |
supportsTypes(int domain)
Return true if actions can be scoped by file types for the given domain. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String Copyright
public static final int DOMAIN_NONE
protected SubSystem _subsystem
protected SubSystemFactory subsystemFactory
protected SystemUDActionManager udActionManager
protected SystemUDTypeManager udTypeManager
protected SystemUDAResolvedTypes udaResolvedTypes
protected SystemUDActionElement currentAction
protected boolean testAction
Constructor Detail |
public SystemUDActionSubsystem()
Method Detail |
protected abstract boolean doActionsMigration(SystemProfile profile, String oldRelease)
protected abstract boolean doTypesMigration(SystemProfile profile, String oldRelease)
protected String getNewNodeActionLabel()
protected String getNewNodeTypeLabel()
public SystemUDActionManager getUDActionManager()
public SystemUDTypeManager getUDTypeManager()
public abstract SystemCmdSubstVarList getActionSubstVarList(int actionDomainType)
public SubSystem getSubsystem()
public void setSubsystem(SubSystem ss)
public SubSystemFactory getSubSystemFactory()
public void setSubSystemFactory(SubSystemFactory ssf)
public boolean supportsTypes()
public boolean supportsTypes(int domain)
public boolean supportsDomains()
public int getSingleDomain(SystemUDBaseManager docManager)
Default is -1
public SystemUDActionEditPane getCustomUDActionEditPane(SubSystem ss, SubSystemFactory ssFactory, SystemProfile profile, ISystemUDAEditPaneHoster parent, ISystemUDTreeView tv)
ss
- - the subsystem if you have it. If you don't have it, pass null.ssFactory
- - the subsystem factory, if you don't have the subsystem.profile
- - the subsystem factory, if you don't have the subsystem.parent
- - the hosting dialog/property pageprotected final SystemUDActionEditPane getCustomUDActionEditPane(SubSystem ss, ISystemUDAEditPaneHoster parent, ISystemUDTreeView tv)
getCustomUDActionEditPane(SubSystem, SubSystemFactory, SystemProfile, ISystemUDAEditPaneHoster, ISystemUDTreeView)
protected final SystemUDActionEditPane getCustomUDActionEditPane(SubSystemFactory ssFactory, SystemProfile profile, ISystemUDAEditPaneHoster parent, ISystemUDTreeView tv)
getCustomUDActionEditPane(SubSystem, SubSystemFactory, SystemProfile, ISystemUDAEditPaneHoster, ISystemUDTreeView)
public SystemUDTypeEditPane getCustomUDTypeEditPane(SubSystem ss, SubSystemFactory ssf, SystemProfile profile, ISystemUDAEditPaneHoster parent, ISystemUDTreeView tv)
ss
- - the subsystem if you have it. If you don't have it, pass null.profile
- - the subsystem factory, if you don't have the subsystem.parent
- - the hosting dialog/property pageprotected final SystemUDTypeEditPane getCustomUDTypeEditPane(SubSystem ss, ISystemUDAEditPaneHoster parent, ISystemUDTreeView tv)
getCustomUDTypeEditPane(SubSystem, SubSystemFactory, SystemProfile, ISystemUDAEditPaneHoster, ISystemUDTreeView)
public SystemUDTypeEditPane getCustomUDTypeEditPane(SubSystemFactory ssFactory, SystemProfile profile, ISystemUDAEditPaneHoster parent, ISystemUDTreeView tv)
getCustomUDTypeEditPane(SubSystem, SubSystemFactory, SystemProfile, ISystemUDAEditPaneHoster, ISystemUDTreeView)
public abstract SystemUDTypeElement[] primeDefaultTypes(SystemUDTypeManager udtd)
public abstract SystemUDActionElement[] primeDefaultActions(SystemUDActionManager udad, SystemProfile profile)
public boolean restoreDefaultAction(SystemUDActionElement element, int domain, String actionName)
public boolean restoreDefaultType(SystemUDTypeElement element, int domain, String typeName)
public String getTestActionName()
Returns "ibm test action"
public String getTestFileName()
getTestActionName()
.
Returns "TESTUSERACTION.TXT"
public String getTestFilePath()
getTestActionName()
.
Returns "c:\\Test_RSE_User_Actions"
protected void printTestActionInvokeOnceInformation(Shell shell, PrintWriter writer)
public void run(Shell shell, SystemUDActionElement action, IStructuredSelection selection, ISystemResourceChangeListener viewer)
For each selected object, the action's command is resolved (variable substitution done) by calling doCommandSubstitution, and then run by calling runCommand(...).
shell
- - the shell to use for display the prompt, if appropriateaction
- - the user action to runviewer
- - the viewer we are running this from. Used to do the refresh if requested in this action. Can be null.protected boolean runCommand(Shell shell, SystemUDActionElement action, String cmdString, RemoteCmdSubSystem cmdSubSystem, Object context, Viewer viewer)
shell
- - the shell to use if need to prompt for password or show msg dialogaction
- - the action being processed, in case attributes of it need to be queriedcmdString
- - the resolved commandcmdSubSystem
- - this connection's command subsystem, which will run the commandcontext
- - any context information the subsystem's runCommand might need
protected String doCommandSubstitutions(SystemUDActionElement action, String cmd, Object selectedObject)
protected Object collectNames(Shell shell, Iterator elements, StringBuffer collectedNames)
This can be overridden if need be. The default behaviour is to concatenate the quoted absolute name of each selected object.
protected Object collectNamesDefaultMethod(Shell shell, Iterator elements, StringBuffer collectedNames)
protected String getAllNamesSubstitutionVariable()
The default is "${resource_name}", but can be overridden.
protected char getNameDelimiter()
The default is a double quote, but can be overridden. For example, for iSeries native file systems, this is overridden with a single quote.
protected String promptCommand(Shell shell, String command)
shell
- - the shell to host the modal dialogcommand
- - the fully resolved (variables substituted) command
protected String promptCommandDefault(Shell shell, String command)
protected static RemoteCmdSubSystem getCommandSubSystem(Object selectedObject)
protected static RemoteFileSubSystem getFileSubSystem(Object selectedObject)
protected static ISystemRemoteElementAdapter getRemoteAdapter(Object o)
public String getSubstitutionValue(String subvar, Object context)
Return the string to substitute for the given substitution variable, given the current context object. This object will be passed whatever was passed into the doSubstitution method.
It is VERY IMPORTANT to return null if you can't do the substitution for some reason! This is a clue to the algorithm that no change was made and increases performance.
We try to handle common substitutions here in the base class, and pass on any other requests to the child classes via a call to internalGetSubstitutionValue(String var, Object context)
getSubstitutionValue
in interface ISystemSubstitutor
public String getCommonSubstitutionValues(String subvar, Object context)
public abstract String internalGetSubstitutionValue(SystemUDActionElement currentAction, String substitutionVariable, Object context)
public boolean hasUnsupportedSubstitutionVars(Object action, int domain)
public boolean eligibleUserActionsForSelection(IStructuredSelection selection, SystemProfile profile)
public void addUserActions(IMenuManager menu, IStructuredSelection selection, SystemProfile profile, Shell shell)
If given a profile, the list is scoped to that, else it includes actions for all active profiles.
public boolean getWorkingOfflineMode()
protected abstract int getDomainFromSelection(IStructuredSelection selection)
protected boolean meetsSelection(SystemUDActionElement action, IStructuredSelection selection, int domainType)
protected String[] resolveTypes(String[] p_types, int domainType)
Basically, this concatenates all the subtypes together. However, it also weeds out any redundancies
protected abstract boolean isMatch(Object actionType, Object selectedObject, int domainType)
Must be overridden, but only called if supportsTypes() returns true. Else, just return true!
actionType
- - an unnamed file type, as in "*.cpp"selectedObject
- - one of the currently selected remote objectsdomainType
- - integer representation of current domainprotected String getTypesDelimiter()
public void resetResolvedTypes()
public SystemUDAResolvedTypes getResolvedTypesHelper()
public int getMaximumDomain()
public String mapDomainName(int domainInteger)
XML ATTRIBUTE SYNTAX FOR A DOMAIN:
This maps the given integer to its domain name.
Returns null by default.
Needs to be overridden by children that support domains
public int mapDomainName(String domainName)
public String mapDomainXlatedName(int domainInteger)
XML ATTRIBUTE SYNTAX FOR A DOMAIN:
This maps the given integer to its translated domain name.
Returns null by default.
Needs to be overridden by children that support domains
public String mapDomainXlatedNewName(int domainInteger)
public String mapDomainXlatedNewTypeName(int domainInteger)
public String[] getDomainNames()
public String[] getXlatedDomainNames()
public String[] getXlatedDomainNewNames()
public String[] getXlatedDomainNewTypeNames()
public Image getDomainImage(int domain)
public Image getDomainNewImage(int domain)
public Image getDomainNewTypeImage(int domain)
protected SystemProfile[] getActiveSystemProfiles()
protected List getDirtyEditors(IStructuredSelection sel)
protected ISystemEditableRemoteObject getEditableFor(IAdaptable selected)
protected boolean checkDirtyEditors(IStructuredSelection selection)
protected void processingSelection(boolean processingSelection)
|
Remote Systems v6.4.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |