Remote Systems
v6.4.1

com.ibm.etools.systems.core.ui.view
Class AbstractSystemViewAdapter

java.lang.Object
  extended bycom.ibm.etools.systems.core.ui.view.AbstractSystemViewAdapter
All Implemented Interfaces:
IRemoteObjectIdentifier, ISystemDragDropAdapter, ISystemPropertyConstants, ISystemViewActionFilter, ISystemViewElementAdapter
Direct Known Subclasses:
SystemTeamViewCategoryAdapter, SystemTeamViewCompileCommandAdapter, SystemTeamViewCompileTypeAdapter, SystemTeamViewProfileAdapter, SystemTeamViewSubSystemFactoryAdapter, SystemTeamViewUserActionAdapter, SystemViewConnectionAdapter, SystemViewFilterAdapter, SystemViewFilterPoolAdapter, SystemViewFilterPoolReferenceAdapter, SystemViewFilterReferenceAdapter, SystemViewFilterStringAdapter, SystemViewMessageAdapter, SystemViewPromptableAdapter, SystemViewRemoteFileAdapter, SystemViewRemoteOutputAdapter, SystemViewRemoteSearchResultAdapter, SystemViewRemoteSearchResultSetAdapter, SystemViewRootInputAdapter, SystemViewScratchpadAdapter, SystemViewSubSystemAdapter

public abstract class AbstractSystemViewAdapter
extends Object
implements ISystemViewElementAdapter, ISystemPropertyConstants, ISystemViewActionFilter

Base class for adapters needed for the SystemView viewer. It implements the ISystemViewElementAdapter interface.

See Also:
AbstractSystemRemoteAdapterFactory

Field Summary
protected  Object[] _lastResults
          A variable that can be used in getChildren to cache last returned results, if desired
protected  Object _lastSelected
          A variable that can be used to cache last selection, if desired
protected  SystemMessageObject canceledObject
          Frequently returned msg object from getChildren: "operation canceled"
static String copyright
           
protected static String[] EMPTY_STRING_LIST
          A handy constant of "new String[0]"
protected  Object[] emptyList
          For returning an empty list from getChildren: new Object[0]
protected  SystemMessageObject errorObject
          Frequently returned msg object from getChildren: "operation ended in error"
protected  String filterString
           
static String MEMENTO_DELIM
          Delimiter for each object's key in a memento, used to persist tree view expansion state: "///"
protected static String MSG_SUB_PREFIX
          Message substitution prefix: "&"
protected static String MSG_SUB1
          Message substitution variable 1: "&1"
protected static String MSG_SUB2
          Message substitution variable 2: "&2"
protected  Object[] msgList
          For returning a msg object from getChildren.
protected  SystemMessageObject nullObject
          Frequently returned msg object from getChildren: "empty list"
protected  Object propertySourceInput
          Current input provider.
protected  Shell shell
          Current shell, set by the content provider
protected  Viewer viewer
          Current viewer.
 
Fields inherited from interface com.ibm.etools.systems.core.ui.view.ISystemViewElementAdapter
noActions
 
Fields inherited from interface com.ibm.etools.systems.subsystems.IRemoteObjectIdentifier
Copyright
 
Fields inherited from interface com.ibm.etools.systems.core.ui.view.ISystemPropertyConstants
P_ARCHIVE_COMMENT, P_ARCHIVE_EXPANDEDSIZE, P_CCSID, P_COMMAND, P_COMMENT, P_COMPILETYPE_TYPES, P_DEFAULTUSERID, P_DESCRIPTION, P_ENVLIST, P_ERROR, P_ERROR_FILENAME, P_ERROR_LINENO, P_FILE_CANONICAL_PATH, P_FILE_CLASSIFICATION, P_FILE_HIDDEN, P_FILE_LASTMODIFIED, P_FILE_PATH, P_FILE_READABLE, P_FILE_READONLY, P_FILE_SIZE, P_FILE_WRITABLE, P_FILTER, P_FILTERS, P_FILTERSTRING, P_FILTERSTRINGS, P_FILTERSTRINGS_COUNT, P_HAS_CHILDREN, P_HOSTNAME, P_IS_ACTIVE, P_IS_CONNECTED, P_IS_CONNECTION_PRIVATE, P_NBRCHILDREN, P_NEWNAME, P_OK, P_ORIGIN, P_PARENT_FILTER, P_PARENT_FILTERPOOL, P_PASSWORD, P_PORT, P_PREFIX, P_PROFILE, P_RELATED_CONNECTION, P_SEARCH_LINE, P_SHELL_CONTEXT, P_SHELL_STATUS, P_SYSTEMTYPE, P_TYPE, P_USERACTION_DOMAIN, P_USERID, P_VENDOR, P_VIRTUAL_COMMENT, P_VIRTUAL_COMPRESSEDSIZE, P_VIRTUAL_COMPRESSIONMETHOD, P_VIRTUAL_COMPRESSIONRATIO, P_VRM
 
Constructor Summary
AbstractSystemViewAdapter()
           
 
Method Summary
abstract  void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup)
          This is your opportunity to add actions to the popup menu for the given selection.
 void addCommonRemoteActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
          Called by SystemView viewer.
 void addDynamicPopupMenuActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
          Called by system viewers.
 boolean canDelete(Object element)
          Overridable by subclasses, and usually is.
 boolean canDrag(Object element)
          Overridable by subclasses, and is iff drag and drop supported.
 boolean canDrop(Object element)
          Overridable by subclasses, and is iff drag and drop supported.
 boolean canEdit(Object object)
          Overridable by subclasses, and must be for editable objects.
 boolean canRename(Object element)
          Overridable by subclasses, and usually is.
protected  Object[] checkForNull(Object[] children, boolean returnNullMsg)
          Callable by subclasses.
protected static PropertyDescriptor createSimplePropertyDescriptor(String propertyKey, ResourceBundle bundle, String rootForLabelAndDescription)
          Callable by subclasses.
protected static PropertyDescriptor createSimplePropertyDescriptor(String propertyKey, String rootForLabelAndDescription)
          Callable by subclasses.
 boolean doDelete(Shell shell, Object element)
          Overridable by subclasses, and usually is.
 Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
          Overridable by subclasses, and is iff drag and drop supported.
 Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
          Overridable by subclasses, and is iff drag and drop supported.
 Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, IProgressMonitor monitor)
          Deprecated. use doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor) instead
 boolean doRename(Shell shell, Object element, String name)
          Overridable by subclasses, and usually is.
 void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor)
           
abstract  String getAbsoluteName(Object object)
          Abstract.
protected  ISystemViewElementAdapter getAdapter(Object o)
          Callable by subclasses.
protected  Object[] getCancelledMessageObject()
          Callable by subclasses.
 String getCanonicalNewName(Object element, String newName)
          Overridable by subclasses, and usually is iff canRename is.
 Object[] getChildren(IProgressMonitor monitor, Object element)
          This should be overridden by subclasses in order to provide deferred query support via the Eclipse Jobs mechanism Return the children of this object.
abstract  Object[] getChildren(Object element)
          Abstract.
 Object[] getChildrenUsingExpandToFilter(Object element, String expandToFilter)
          Overridable by subclasses, but rarely needs to be.
protected  ISystemTree getCurrentTreeView()
          Getter method.
protected static IPropertyDescriptor[] getDefaultDescriptors()
          Callable by subclasses.
 ISystemEditableRemoteObject getEditableRemoteObject(Object object)
          Overridable by subclasses, and must be for editable objects.
 Object getEditableValue()
          Needed by framework for property sheet.
protected  Object[] getEmptyMessageObject()
          Callable by subclasses.
protected  Object[] getFailedMessageObject()
          Callable by subclasses.
 String getFilterString()
          Gets filter context for querying.
 String getFilterStringFor(Object object)
          Return a filter string that corresponds to this object.
protected  Object getFirstSelection(IStructuredSelection selection)
          Callable by subclasses.
abstract  ImageDescriptor getImageDescriptor(Object element)
          Abstract.
 ISystemViewInputProvider getInput()
          Getter method.
 String getInputMementoHandle(Object element)
          Overridable by subclasses, but usually is not.
 String getLabel(Object element)
          Internal use.
 String getMementoHandle(Object element)
          Overridable by subclasses, but usually is not.
 String getMementoHandleKey(Object element)
          Overridable by subclasses, but usually is not.
 String getName(Object element)
          Overridable by subclasses, but rarely needs to be.
 ISystemValidator getNameValidator(Object element)
          Overridable by subclasses, and usually is iff canRename is.
abstract  Object getParent(Object element)
          Abstract.
 IPropertyDescriptor[] getPropertyDescriptors()
          Implemented.
 Object getPropertyValue(Object key)
          Implemented.
 Object getPropertyValue(Object key, boolean formatted)
          Overridable by subclasses, but usually is not.
protected  ISystemRemoteElementAdapter getRemoteAdapter(Object o)
          Callable by subclasses.
 String getRemoteSourceType(Object element)
          Overridable by subclasses, but usually is not.
 String getRemoteSubSubType(Object element)
          Overridable by subclasses, but usually is not.
 ISchedulingRule getRule(Object element)
           
 Shell getShell()
          Getter method.
 String getStatusLineText(Object element)
          Overridable by subclasses, but rarely needs to be.
 SubSystem getSubSystem(Object element)
          Overridable by subclasses.
protected  SystemFetchOperation getSystemFetchOperation(Object o, IElementCollector collector)
          Returns the SystemFetchOperation to be used in performing a query.
protected  ISystemTree getSystemTree()
          Callable by subclasses.
abstract  String getText(Object element)
          Abstract.
protected  String getTranslatedFalse()
          Callable by subclasses.
protected  String getTranslatedNo()
          Callable by subclasses.
protected  String getTranslatedNotApplicable()
          Callable by subclasses.
protected  String getTranslatedNotAvailable()
          Callable by subclasses.
protected  String getTranslatedTrue()
          Callable by subclasses.
 String getTranslatedYes()
          Callable by subclasses.
abstract  String getType(Object element)
          Abstract.
 IPropertyDescriptor[] getUniquePropertyDescriptors()
          Callable by subclasses.
 Viewer getViewer()
          Getter method.
 boolean handleDoubleClick(Object element)
          Overridable by subclasses, but usually is not.
abstract  boolean hasChildren(Object element)
          Abstract.
protected  void initMsgObjects()
          Internal use.
protected abstract  IPropertyDescriptor[] internalGetPropertyDescriptors()
          Abstract.
protected abstract  Object internalGetPropertyValue(Object key)
          Abstract.
 boolean isContainer()
           
 boolean isPromptable(Object element)
          Overridable by subclasses, but usually is not.
 boolean isPropertySet(Object key)
          Overridable by subclasses.
 boolean namesAreEqual(Object element, String newName)
          Overridable by subclasses, but usually is not.
 void resetPropertyValue(Object key)
          Overridable by subclasses.
 boolean saveExpansionState(Object element)
          Overridable by subclasses, but usually is not.
 void selectionChanged(Object element)
          Overridable by subclasses, but usually is not.
 void setFilterString(String filterString)
          Sets filter context for querying.
 void setInput(ISystemViewInputProvider input)
          Configuration method.
 void setPropertySourceInput(Object propertySourceInput)
          Called from adapter factories.
 void setPropertyValue(Object key, Object value)
          Overridable by subclasses.
 void setShell(Shell shell)
          Configuration method.
 void setViewer(Viewer viewer)
          Configuration method.
 boolean showDelete(Object element)
          Overridable by subclasses, but usually is not.
 boolean showGenericShowInTableAction(Object element)
          Overridable by subclasses, and usually is NOT.
 boolean showOpenViewActions(Object element)
          Overridable by subclasses, and usually is NOT.
 boolean showRefresh(Object element)
          Overridable by subclasses, and usually is.
 boolean showRename(Object element)
          Overridable by subclasses, but usually is not.
static String sub(String msg, String subOld, String subNew)
          Callable by subclasses.
 boolean supportsDeferredQueries()
          these methods are for deferred fetch operations
 boolean testAttribute(Object target, String name, String value)
          Overridable by subclasses, typically if additional properties are supported.
 boolean validateDrop(Object src, Object target, boolean sameSystem)
          Overridable by subclasses, and usually is iff drag and drop supported..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values

filterString

protected String filterString

viewer

protected Viewer viewer
Current viewer. Set by content provider


propertySourceInput

protected Object propertySourceInput
Current input provider. Set by content provider


shell

protected Shell shell
Current shell, set by the content provider


emptyList

protected Object[] emptyList
For returning an empty list from getChildren: new Object[0]


msgList

protected Object[] msgList
For returning a msg object from getChildren. Will be an array with one item, one of nullObject, canceledObject or errorObject


nullObject

protected SystemMessageObject nullObject
Frequently returned msg object from getChildren: "empty list"


canceledObject

protected SystemMessageObject canceledObject
Frequently returned msg object from getChildren: "operation canceled"


errorObject

protected SystemMessageObject errorObject
Frequently returned msg object from getChildren: "operation ended in error"


MSG_SUB_PREFIX

protected static final String MSG_SUB_PREFIX
Message substitution prefix: "&"

See Also:
Constant Field Values

MSG_SUB1

protected static final String MSG_SUB1
Message substitution variable 1: "&1"

See Also:
Constant Field Values

MSG_SUB2

protected static final String MSG_SUB2
Message substitution variable 2: "&2"

See Also:
Constant Field Values

MEMENTO_DELIM

public static final String MEMENTO_DELIM
Delimiter for each object's key in a memento, used to persist tree view expansion state: "///"

See Also:
Constant Field Values

EMPTY_STRING_LIST

protected static final String[] EMPTY_STRING_LIST
A handy constant of "new String[0]"


_lastResults

protected Object[] _lastResults
A variable that can be used in getChildren to cache last returned results, if desired


_lastSelected

protected Object _lastSelected
A variable that can be used to cache last selection, if desired

Constructor Detail

AbstractSystemViewAdapter

public AbstractSystemViewAdapter()
Method Detail

setViewer

public void setViewer(Viewer viewer)
Configuration method. Typically called by content provider, viewer or action. Do not override.
Set the viewer that is driving this adapter Called by label and content provider.

Specified by:
setViewer in interface ISystemViewElementAdapter

setShell

public void setShell(Shell shell)
Configuration method. Typically called by content provider, viewer or action. Do not override.
Set the shell to be used by any method that requires it.

Specified by:
setShell in interface ISystemViewElementAdapter

setInput

public void setInput(ISystemViewInputProvider input)
Configuration method. Typically called by content provider, viewer or action. Do not override.
Set the input object used to populate the viewer with the roots. May be used by an adapter to retrieve context-sensitive information. This is set by the Label and Content providers that retrieve this adapter.

Specified by:
setInput in interface ISystemViewElementAdapter

getShell

public Shell getShell()
Getter method. Callable by subclasses. Do not override.
Get the shell currently hosting the objects in this adapter

Specified by:
getShell in interface ISystemViewElementAdapter

getViewer

public Viewer getViewer()
Getter method. Callable by subclasses. Do not override.
Return the current viewer, as set via setViewer or its deduced from the setInput input object if set. May be null so test it.

Specified by:
getViewer in interface ISystemViewElementAdapter

getCurrentTreeView

protected ISystemTree getCurrentTreeView()
Getter method. Callable by subclasses. Do not override.
Return the current viewer as an ISystemTree if it is one, or null otherwise


getInput

public ISystemViewInputProvider getInput()
Getter method. Callable by subclasses. Do not override.
Get the input object used to populate the viewer with the roots. May be used by an adapter to retrieve context-sensitive information.

Specified by:
getInput in interface ISystemViewElementAdapter

getSubSystem

public SubSystem getSubSystem(Object element)
Overridable by subclasses. You should override if not using AbstractResource.
Returns the subsystem that contains this object. By default, if the given element is instanceof AbstractResource, it calls getSubSystem on it, else returns null.

Specified by:
getSubSystem in interface ISystemViewElementAdapter

addCommonRemoteActions

public void addCommonRemoteActions(SystemMenuManager menu,
                                   IStructuredSelection selection,
                                   Shell shell,
                                   String menuGroup)
Called by SystemView viewer. No need to override or call.
Returns any framework-supplied remote object actions that should be contributed to the popup menu for the given selection list. This does nothing if this adapter does not implement ISystemViewRemoteElementAdapter, else it potentially adds menu items for "User Actions" and Compile", for example. It queries the subsystem factory of the selected objects to determine if these actions are appropriate to add.

Parameters:
menu - The menu to contribute actions to
selection - The window's current selection.
shell - of viewer calling this. Most dialogs require a shell.
menuGroup - recommended menu group to add actions to. If added to another group, you must be sure to create that group first.

addDynamicPopupMenuActions

public void addDynamicPopupMenuActions(SystemMenuManager menu,
                                       IStructuredSelection selection,
                                       Shell shell,
                                       String menuGroup)
Called by system viewers. No need to override or call.
Contributes actions provided via the dynamicPopupMenuExtensions extension point. Unlike addCommonRemoteActions(), these contributions are for any artifact in the RSE views and are contributed independently of subsystem factories.

Parameters:
menu - The menu to contribute actions to
selection - The window's current selection.
shell - of viewer calling this. Most dialogs require a shell.
menuGroup - recommended menu group to add actions to. If added to another group, you must be sure to create that group first.

addActions

public abstract void addActions(SystemMenuManager menu,
                                IStructuredSelection selection,
                                Shell parent,
                                String menuGroup)
This is your opportunity to add actions to the popup menu for the given selection.

To put your action into the given menu, use the menu's add method. If you don't care where it goes within the popup, just pass the given menuGroup location id, otherwise pass one of the GROUP_XXX values from ISystemContextMenuConstants. If you pass one that identifies a pre-defined cascading menu, such as GROUP_OPENWITH, your action will magically appear in that cascading menu, even if it was otherwise empty.

For the actions themselves, you will probably use one of the base action classes:

Specified by:
addActions in interface ISystemViewElementAdapter
Parameters:
menu - the popup menu you can contribute to
selection - the current selection in the calling tree or table view
parent - the shell of the calling tree or table view
menuGroup - the default menu group to place actions into if you don't care where they. Pass this to the SystemMenuManager add method.
See Also:
ISystemViewElementAdapter.addActions(SystemMenuManager, IStructuredSelection, Shell, String)

getImageDescriptor

public abstract ImageDescriptor getImageDescriptor(Object element)
Abstract. Must be overridden by subclasses.
IWorkbenchAdapter method. Returns an image descriptor for the image. More efficient than getting the image.

Specified by:
getImageDescriptor in interface ISystemViewElementAdapter
Parameters:
element - The element for which an image is desired

getText

public abstract String getText(Object element)
Abstract. Must be overridden by subclasses.
Return the label for this object.

Specified by:
getText in interface ISystemViewElementAdapter
See Also:
getName(Object), getAbsoluteName(Object)

getName

public String getName(Object element)
Overridable by subclasses, but rarely needs to be.
Return the name of this object, which may be different than the display text ({#link #getText(Object)}. By default, returns getText(element);, but child classes can override if display name doesn't equal real name.

Called by common rename and delete actions, and used to populate property sheet.

Specified by:
getName in interface ISystemViewElementAdapter
See Also:
getText(Object), getAbsoluteName(Object)

getAbsoluteName

public abstract String getAbsoluteName(Object object)
Abstract. Must be overridden.
. Return the fully-qualified name, versus just the displayable name, for this object. For remote objects, this should be sufficient to uniquely identify this object within its subsystem.

Specified by:
getAbsoluteName in interface IRemoteObjectIdentifier
See Also:
getText(Object), getName(Object)

getLabel

public String getLabel(Object element)
Internal use. Can be safely ignored.
Return the name for this object. Unique requirement for IWorkbenchAdapter. We map to getText(element).


getType

public abstract String getType(Object element)
Abstract. Must be overridden by subclasses.
Return the type label for this object.

Specified by:
getType in interface ISystemViewElementAdapter

getStatusLineText

public String getStatusLineText(Object element)
Overridable by subclasses, but rarely needs to be.
Return the string to display in the status line when the given object is selected. The default is:

   getType(): getName()
 

Specified by:
getStatusLineText in interface ISystemViewElementAdapter

getParent

public abstract Object getParent(Object element)
Abstract. Must be overridden by subclasses.
Return the parent of this object. This is required by eclipse UI adapters, but we try desperately not to use in the RSE. So, you are probably safe returning null, but if can return a parent, why not, go for it.

Specified by:
getParent in interface ISystemViewElementAdapter

hasChildren

public abstract boolean hasChildren(Object element)
Abstract. Must be overridden by subclasses.
Return true if this object has children.

Specified by:
hasChildren in interface ISystemViewElementAdapter

getChildren

public abstract Object[] getChildren(Object element)
Abstract. Must be overridden by subclasses.
Return the children of this object. Return null if children not supported.

Specified by:
getChildren in interface ISystemViewElementAdapter

getChildren

public Object[] getChildren(IProgressMonitor monitor,
                            Object element)
This should be overridden by subclasses in order to provide deferred query support via the Eclipse Jobs mechanism Return the children of this object. Return null if children not supported.

Specified by:
getChildren in interface ISystemViewElementAdapter

getChildrenUsingExpandToFilter

public Object[] getChildrenUsingExpandToFilter(Object element,
                                               String expandToFilter)
Overridable by subclasses, but rarely needs to be.
Return the children of this object, using the given Expand-To filter. By default, this calls getChildren(element). Override only if you support Expand-To menu actions.

Specified by:
getChildrenUsingExpandToFilter in interface ISystemViewElementAdapter

getDefaultDescriptors

protected static IPropertyDescriptor[] getDefaultDescriptors()
Callable by subclasses.
Return the default descriptors for all system elements.


createSimplePropertyDescriptor

protected static PropertyDescriptor createSimplePropertyDescriptor(String propertyKey,
                                                                   String rootForLabelAndDescription)
Callable by subclasses.
Create and return a simple string readonly property descriptor.

Parameters:
propertyKey - Key for this property, sent back in getPropertyValue.
rootForLabelAndDescription - key into the system resource bundle for the label (+"label") and description (+"description")

createSimplePropertyDescriptor

protected static PropertyDescriptor createSimplePropertyDescriptor(String propertyKey,
                                                                   ResourceBundle bundle,
                                                                   String rootForLabelAndDescription)
Callable by subclasses.
Create and return a simple string readonly property descriptor.

Parameters:
propertyKey - Key for this property, sent back in getPropertyValue.
bundle - the resource bundle containing translatable label and description
rootForLabelAndDescription - key into the system resource bundle for the label (+"label") and description (+"description")

getEditableValue

public Object getEditableValue()
Needed by framework for property sheet. No need to call or override.
Returns a value for this object that can be edited in a property sheet.

Returns:
a value that can be editted

getPropertyDescriptors

public IPropertyDescriptor[] getPropertyDescriptors()
Implemented. Do not override typically. See internalGetPropertyDescriptors().
Returns the property descriptors defining what properties are seen in the property sheet. By default returns descriptors for name, type and number-of-children only plus whatever is returned from internalGetPropertyDescriptors().

Returns:
an array containing all descriptors.
See Also:
internalGetPropertyDescriptors()

internalGetPropertyDescriptors

protected abstract IPropertyDescriptor[] internalGetPropertyDescriptors()
Abstract.
Implement this to return the property descriptors for the properties in the property sheet. This is beyond the Name, Type and NbrOfChildren properties which already implemented and done for you.

Override if want to include more properties in the property sheet,

If you override this for readonly properties, you must also override:

If you override this for editable properties, you must also override:

Returns:
an array containing all descriptors to be added to the default set of descriptors, or null if no additional properties desired.
See Also:
createSimplePropertyDescriptor(String,ResourceBundle,String)

getUniquePropertyDescriptors

public IPropertyDescriptor[] getUniquePropertyDescriptors()
Callable by subclasses. Do not override.
Returns the list of property descriptors that are unique for this particular adapter - that is the difference between the default property descriptors and the total list of property descriptors.

If internalGetPropertyDescriptors() returns non-null, then returns that, else computes the difference.

This is called by the table views like SystemTableView.

Specified by:
getUniquePropertyDescriptors in interface ISystemViewElementAdapter

getPropertyValue

public Object getPropertyValue(Object key,
                               boolean formatted)
Overridable by subclasses, but usually is not.
Similar to getPropertyValue(Object key) but takes an argument for determining whether to return a raw value or formatted value. By default, simply calls getPropertyValue(key).

This is called by the table views in order to get values that can be sorted when the user clicks on the column heading. To support this for a numeric property say, return a Long/Integer object if false, versus returning string.

Specified by:
getPropertyValue in interface ISystemViewElementAdapter
Parameters:
formatted - indication of whether to return the value in formatted or raw form
Returns:
the current value of the given property

getPropertyValue

public Object getPropertyValue(Object key)
Implemented. Do not override typically. See internalGetPropertyValue(Object).
Returns the current value for the named property.
By default handles ISystemPropertyConstants.P_TEXT, P_TYPE and P_NBRCHILDREN only, then defers to internalGetPropertyValue(Object) for subclasses.
Note: you will need to reference propertySourceInput, which is the currently selected object. Just case it to what you expect the selected object's type to be.

Parameters:
key - the name of the property as named by its property descriptor
Returns:
the current value of the property

internalGetPropertyValue

protected abstract Object internalGetPropertyValue(Object key)
Abstract.
Implement this to return the property descriptors for the properties in the property sheet. This is beyond the Name, Type and NbrOfChildren properties which already implemented and done for you.

Parameters:
key - the name of the property as named by its property descriptor
Returns:
the current value of the property or null if not a known property.

isPropertySet

public boolean isPropertySet(Object key)
Overridable by subclasses. Must be iff editable properties are supported.
Returns whether the property value has changed from the default. Only applicable for editable properties.
RETURNS FALSE BY DEFAULT.

Returns:
true if the value of the specified property has changed from its original default value; false otherwise.

resetPropertyValue

public void resetPropertyValue(Object key)
Overridable by subclasses. Must be iff editable properties are supported.
Resets the specified property's value to its default value. Called on editable property when user presses reset button in property sheet viewer. DOES NOTHING BY DEFAULT.

Parameters:
key - the key identifying property to reset

setPropertyValue

public void setPropertyValue(Object key,
                             Object value)
Overridable by subclasses. Must be iff editable properties are supported.
Sets the named property to the given value. Called after an editable property is changed by the user. DOES NOTHING BY DEFAULT.

Parameters:
key - the key identifying property to reset
value - the new value for the property

setPropertySourceInput

public void setPropertySourceInput(Object propertySourceInput)
Called from adapter factories. Do not override.
Set input object for property source queries. This must be called by your XXXAdaptorFactory before returning this adapter object.

Specified by:
setPropertySourceInput in interface ISystemViewElementAdapter

handleDoubleClick

public boolean handleDoubleClick(Object element)
Overridable by subclasses, but usually is not.
User has double clicked on an object. If you want to do something special, do it and return true. Otherwise return false to have the viewer do the default behaviour.

Specified by:
handleDoubleClick in interface ISystemViewElementAdapter

showDelete

public boolean showDelete(Object element)
Overridable by subclasses, but usually is not.
Return true if we should show the delete action in the popup for the given element. If true, then canDelete will be called to decide whether to enable delete or not.

By default, returns true.

Specified by:
showDelete in interface ISystemViewElementAdapter
See Also:
canDelete(Object), doDelete(Shell,Object)

canDelete

public boolean canDelete(Object element)
Overridable by subclasses, and usually is.
Return true if this object is deletable by the user. If so, when selected, the Edit->Delete menu item will be enabled.

By default, returns false. Override if your object is deletable.

Specified by:
canDelete in interface ISystemViewElementAdapter
See Also:
showDelete(Object), doDelete(Shell,Object)

doDelete

public boolean doDelete(Shell shell,
                        Object element)
                 throws Exception
Overridable by subclasses, and usually is.
Perform the delete action. By default does nothing. Override if your object is deletable. Return true if this was successful. Return false if it failed and you issued a msg. Throw an exception if it failed and you want to use the generic msg.

Specified by:
doDelete in interface ISystemViewElementAdapter
Throws:
Exception
See Also:
showDelete(Object), canDelete(Object)

showRename

public boolean showRename(Object element)
Overridable by subclasses, but usually is not.
Return true if we should show the rename action in the popup for the given element. If true, then canRename will be called to decide whether to enable rename or not.

By default, returns true.

Specified by:
showRename in interface ISystemViewElementAdapter
Returns:
true if we should show the rename action in the popup for the given element.
See Also:
canRename(Object), doRename(Shell,Object,String)

canRename

public boolean canRename(Object element)
Overridable by subclasses, and usually is.
Return true if this object is renamable by the user. If so, when selected, the Rename popup menu item will be enabled. By default, returns false. Override if your object is renamable.

Specified by:
canRename in interface ISystemViewElementAdapter
Returns:
true if this object is renamable by the user
See Also:
showRename(Object), doRename(Shell,Object,String), getNameValidator(Object), getCanonicalNewName(Object,String), namesAreEqual(Object,String)

doRename

public boolean doRename(Shell shell,
                        Object element,
                        String name)
                 throws Exception
Overridable by subclasses, and usually is.
Perform the rename action. By default does nothing. Override if your object is renamable. Return true if this was successful. Return false if it failed and you issued a msg. Throw an exception if it failed and you want to use the generic msg.

Specified by:
doRename in interface ISystemViewElementAdapter
Returns:
true if the rename was successful
Throws:
Exception
See Also:
showRename(Object), canRename(Object)

getNameValidator

public ISystemValidator getNameValidator(Object element)
Overridable by subclasses, and usually is iff canRename is.
Return a validator for verifying the new name is correct. If you return null, no error checking is done on the new name in the common rename dialog!!

Used in the common rename dialogs, and only if you return true to canRename(Object).

Suggest you use at least UniqueStringValidator or a subclass to ensure new name is at least unique.

Specified by:
getNameValidator in interface ISystemViewElementAdapter
See Also:
canRename(Object)

getCanonicalNewName

public String getCanonicalNewName(Object element,
                                  String newName)
Overridable by subclasses, and usually is iff canRename is.
Form and return a new canonical (unique) name for this object, given a candidate for the new name. This is called by the generic multi-rename dialog to test that all new names are unique. To do this right, sometimes more than the raw name itself is required to do uniqueness checking.

For example, two connections or filter pools can have the same name if they are in different profiles. Two iSeries QSYS objects can have the same name if their object types are different.

Used in the common rename dialogs, and only if you return true to canRename(Object).

This method returns a name that can be used for uniqueness checking because it is qualified sufficiently to make it unique.

By default, this simply returns the given name. It is overridden by child classes when appropriate.

Specified by:
getCanonicalNewName in interface ISystemViewElementAdapter
See Also:
canRename(Object)

namesAreEqual

public boolean namesAreEqual(Object element,
                             String newName)
Overridable by subclasses, but usually is not.
Compare the name of the given element to the given new name to decide if they are equal. Allows adapters to consider case and quotes as appropriate.

Used in the common rename dialogs, and only if you return true to canRename(Object).

By default does an equalsIgnoreCase comparison

Specified by:
namesAreEqual in interface ISystemViewElementAdapter
See Also:
canRename(Object)

showRefresh

public boolean showRefresh(Object element)
Overridable by subclasses, and usually is.
Return true if we should show the refresh action in the popup for the given element. Note the actual work to do the refresh is handled for you.

Default is true.

Specified by:
showRefresh in interface ISystemViewElementAdapter

showOpenViewActions

public boolean showOpenViewActions(Object element)
Overridable by subclasses, and usually is NOT.
Return true if we should show the Go Into; and Open In New Window and Go To actions in the popup for the given element.

Only applicable for non-remote resources. Remote always show Go To only.

Specified by:
showOpenViewActions in interface ISystemViewElementAdapter

showGenericShowInTableAction

public boolean showGenericShowInTableAction(Object element)
Overridable by subclasses, and usually is NOT.
Return true if we should show the generic show in table action in the popup for the given element.

Specified by:
showGenericShowInTableAction in interface ISystemViewElementAdapter

canDrag

public boolean canDrag(Object element)
Overridable by subclasses, and is iff drag and drop supported.
Return true if this object can be copied to another location. By default, we return false. Extenders may decide whether or not certain objects can be dragged with this method.

Specified by:
canDrag in interface ISystemDragDropAdapter
See Also:
doDrag(Object,boolean,IProgressMonitor), canDrop(Object), doDrop(Object,Object,boolean,boolean,IProgressMonitor), validateDrop(Object,Object,boolean)

doDrag

public Object doDrag(Object element,
                     boolean sameSystemType,
                     IProgressMonitor monitor)
Overridable by subclasses, and is iff drag and drop supported.
Perform the drag on the given object. By default this does nothing and returns nothing. Extenders supporting DnD are expected to implement this method to perform a copy to a temporary object, the return value.

Specified by:
doDrag in interface ISystemDragDropAdapter
Parameters:
element - the object to copy
sameSystemType - indication of whether the source and target reside on the same type of system
monitor - the progress monitor
Returns:
a temporary local copy of the object that was copied
See Also:
canDrag(Object), canDrop(Object), doDrop(Object,Object,boolean,boolean,IProgressMonitor), validateDrop(Object,Object,boolean)

canDrop

public boolean canDrop(Object element)
Overridable by subclasses, and is iff drag and drop supported.
Return true if another object can be copied into this object. By default we return false. Extenders may decide whether or not certain objects can accept other objects with this method.

Specified by:
canDrop in interface ISystemDragDropAdapter
Parameters:
element - the target of a drop operation
Returns:
whether this object may be dropped on
See Also:
canDrag(Object), doDrag(Object,boolean,IProgressMonitor), doDrop(Object,Object,boolean,boolean,IProgressMonitor), validateDrop(Object,Object,boolean)

setFilterString

public void setFilterString(String filterString)
Sets filter context for querying. Override to provide specialized behaviour.

Specified by:
setFilterString in interface ISystemViewElementAdapter

getFilterString

public String getFilterString()
Gets filter context for querying. Override to provide specialized behaviour.

Specified by:
getFilterString in interface ISystemViewElementAdapter

doDrop

public Object doDrop(Object from,
                     Object to,
                     boolean sameSystemType,
                     boolean sameSystem,
                     int srcType,
                     IProgressMonitor monitor)
Overridable by subclasses, and is iff drag and drop supported.
Perform drop from the "from" object to the "to" object. By default this does nothing and we return false. Extenders supporting DnD are expected to implement this method to perform a "paste" into an object.

Specified by:
doDrop in interface ISystemDragDropAdapter
Parameters:
from - the source object for the drop
to - the target object for the drop
sameSystemType - indication of whether the source and target reside of the same type of system
sameSystem - indication of whether the source and target are on the same system
srcType - the type of object to be dropped.
monitor - the progress monitor
Returns:
the new object that was copied
See Also:
canDrag(Object), doDrag(Object,boolean,IProgressMonitor), canDrop(Object), validateDrop(Object,Object,boolean)

doDrop

public Object doDrop(Object from,
                     Object to,
                     boolean sameSystemType,
                     boolean sameSystem,
                     IProgressMonitor monitor)
Deprecated. use doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor) instead

Overridable by subclasses, and is iff drag and drop supported.
Perform drop from the "from" object to the "to" object. By default this does nothing and we return false. Extenders supporting DnD are expected to implement this method to perform a "paste" into an object.

Specified by:
doDrop in interface ISystemDragDropAdapter
Parameters:
from - the source object for the drop
to - the target object for the drop
sameSystemType - indication of whether the source and target reside of the same type of system
sameSystem - indication of whether the source and target are on the same system
monitor - the progress monitor
Returns:
the new object that was copied
See Also:
canDrag(Object), doDrag(Object,boolean,IProgressMonitor), canDrop(Object), validateDrop(Object,Object,boolean)

validateDrop

public boolean validateDrop(Object src,
                            Object target,
                            boolean sameSystem)
Overridable by subclasses, and usually is iff drag and drop supported..
Return true if it is valid for the src object to be dropped in the target. We return false by default.

Specified by:
validateDrop in interface ISystemDragDropAdapter
Parameters:
src - the object to drop
target - the object which src is dropped in
sameSystem - whether this is the same system or not
Returns:
whether this is a valid operation
See Also:
canDrag(Object), doDrag(Object,boolean,IProgressMonitor), canDrop(Object), doDrop(Object,Object,boolean,boolean,IProgressMonitor)

getMementoHandle

public String getMementoHandle(Object element)
Overridable by subclasses, but usually is not.
Return what to save to disk to identify this element in the persisted list of expanded elements. This just defaults to getName, but if that is not sufficient override it here.

Specified by:
getMementoHandle in interface ISystemViewElementAdapter

getInputMementoHandle

public String getInputMementoHandle(Object element)
Overridable by subclasses, but usually is not.
Return what to save to disk to identify this element when it is the input object to a secondary Remote Systems Explorer perspective. Defaults to getMementoHandle(element).

Specified by:
getInputMementoHandle in interface ISystemViewElementAdapter

getMementoHandleKey

public String getMementoHandleKey(Object element)
Overridable by subclasses, but usually is not.
Return a short string to uniquely identify the type of resource. Eg "conn" for connection. This just defaults to getType, but if that is not sufficient override it here, since that is a translated string.

Specified by:
getMementoHandleKey in interface ISystemViewElementAdapter

saveExpansionState

public boolean saveExpansionState(Object element)
Overridable by subclasses, but usually is not.
Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted messages. In these cases return false from this method. The default is true

Specified by:
saveExpansionState in interface ISystemViewElementAdapter

isPromptable

public boolean isPromptable(Object element)
Overridable by subclasses, but usually is not.
Return true if this object is a "prompting" object that prompts the user when expanded. For such objects, we do not try to save and restore their expansion state on F5 or between sessions.

Default is false unless element implements ISystemPromptable object. Override as appropriate.

Specified by:
isPromptable in interface ISystemViewElementAdapter

selectionChanged

public void selectionChanged(Object element)
Overridable by subclasses, but usually is not.
Selection has changed in the Remote Systems view. Empty by default, but override if you need to track selection changed. For example, this is used to drive table views that respond to selection.

Specified by:
selectionChanged in interface ISystemViewElementAdapter
Parameters:
element - - first selected object

testAttribute

public boolean testAttribute(Object target,
                             String name,
                             String value)
Overridable by subclasses, typically if additional properties are supported.
From IActionFilter so the popupMenus extension point can use <filter>, <enablement> or <visibility>. The support is for the following:
  1. name="value". The given value must match getName(target) exactly, or if ends with asterisk must match the beginning.
  2. name="type". The given value must match getType(target) exactly. Be careful, as this is usually translated.
  3. name="hasChildren". If the given value is "true", returns true if hasChildren(target) returns true. If given "false", returns true if the hasChildren returns false.
  4. name="connection". If the given value is "true", returns true if the subsystem is connected. If given "false", returns true if the subsystem is not connected.
  5. name="offline". If the given value is "true", returns true if the subsystem is offline. If given "false", returns true if the subsystem is offline.
  6. name="systemType". The given value is a system type, and this returns true if this object's connection is of that type. You can specify multiple values by comma-separating them, and this returns if there is a match on any them.
  7. name="subsystemFactoryId". The given value is a subsystem factory Id, and this returns true if this object's subsystem is from that subsystem factory. For connections, returns false. You can specify multiple values by comma-separating them, and this returns if there is a match on any them.
  8. name="subsystemFactoryCategory". The given value is a subsystem category, and this returns true if this object's subsystem is from a subsystem factory of that category. For connections, returns false. You can specify multiple values by comma-separating them, and this returns if there is a match on any them.

If desired, override, and call super(), to support additional filter criteria for <filter>, <enablement> and <visibility>.

See Also:
IActionFilter

getRemoteSubSubType

public String getRemoteSubSubType(Object element)
Overridable by subclasses, but usually is not.
From ISystemRemoteElementAdapter.getRemoteSubSubType(Object). Pre-supplied for convenience for subclasses that want to implement this interface for remote object adapters.

Returns null. Override if you want to supply a sub-sub-type for filtering in the popupMenus extension point.


getRemoteSourceType

public String getRemoteSourceType(Object element)
Overridable by subclasses, but usually is not.
From ISystemRemoteElementAdapter.getRemoteSubSubType(Object). Pre-supplied for convenience for subclasses that want to implement this interface for remote object adapters.

Returns null. Override if the remote resource is compilable.


getEditableRemoteObject

public ISystemEditableRemoteObject getEditableRemoteObject(Object object)
Overridable by subclasses, and must be for editable objects.
Return the remote edit wrapper for this object.

Parameters:
object - the object to edit
Returns:
the editor wrapper for this object

canEdit

public boolean canEdit(Object object)
Overridable by subclasses, and must be for editable objects.
Indicates whether the specified object can be edited or not.

Parameters:
object - the object to edit
Returns:
true if the object can be edited. Returns false by default.

getAdapter

protected ISystemViewElementAdapter getAdapter(Object o)
Callable by subclasses.
Returns the implementation of ISystemViewElement for the given object. Returns null if the adapter is not defined or the object is not adaptable.

Just a convenient shortcut to SystemAdapterHelpers.getAdapter(Object, Viewer)


getRemoteAdapter

protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
Callable by subclasses.
Returns the implementation of ISystemRemoteElement for the given object. Returns null if this object does not adaptable to this.

Just a convenient shortcut to SystemAdapterHelpers.getRemoteAdapter(Object, Viewer)


sub

public static String sub(String msg,
                         String subOld,
                         String subNew)
Callable by subclasses.
Do message variable substitution. Using you are replacing &1 (say) with a string.

Returns:
message with all occurrences of variable substituted with data.

getSystemTree

protected ISystemTree getSystemTree()
Callable by subclasses. Do not override
Return the current viewer as an ISystemTree if the viewer is set and it implements this interface (SystemView does). May be null so test it.


getTranslatedYes

public String getTranslatedYes()
Callable by subclasses. Do not override
Return "Yes" translated


getTranslatedNo

protected String getTranslatedNo()
Callable by subclasses. Do not override
Return "No" translated


getTranslatedTrue

protected String getTranslatedTrue()
Callable by subclasses. Do not override
Return "True" translated


getTranslatedFalse

protected String getTranslatedFalse()
Callable by subclasses. Do not override
Return "False" translated


getTranslatedNotApplicable

protected String getTranslatedNotApplicable()
Callable by subclasses. Do not override
Return "Not application" translated


getTranslatedNotAvailable

protected String getTranslatedNotAvailable()
Callable by subclasses. Do not override
Return "Not available" translated


initMsgObjects

protected void initMsgObjects()
Internal use. Do not override


checkForNull

protected Object[] checkForNull(Object[] children,
                                boolean returnNullMsg)
Callable by subclasses. Do not override
In getChildren, return checkForNull(children, true/false)<.samp> versus your array directly. This method checks for a null array which is not allowed and replaces it with an empty array. If true is passed then it returns the "Empty list" message object if the array is null or empty


getCancelledMessageObject

protected Object[] getCancelledMessageObject()
Callable by subclasses. Do not override
Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren()


getFailedMessageObject

protected Object[] getFailedMessageObject()
Callable by subclasses. Do not override
Return the "Operation failed" msg as an object array so can be used to answer getChildren()


getEmptyMessageObject

protected Object[] getEmptyMessageObject()
Callable by subclasses. Do not override
Return the "Empty list" msg as an object array so can be used to answer getChildren()


getFirstSelection

protected Object getFirstSelection(IStructuredSelection selection)
Callable by subclasses. Do not override
Get the first selected object of the given selection


getFilterStringFor

public String getFilterStringFor(Object object)
Return a filter string that corresponds to this object.

Parameters:
object - the object to obtain a filter string for
Returns:
the corresponding filter string if applicable

supportsDeferredQueries

public boolean supportsDeferredQueries()
these methods are for deferred fetch operations

Specified by:
supportsDeferredQueries in interface ISystemViewElementAdapter
Returns:
true if it supports deferred queries, false otherwise.

fetchDeferredChildren

public void fetchDeferredChildren(Object o,
                                  IElementCollector collector,
                                  IProgressMonitor monitor)

getSystemFetchOperation

protected SystemFetchOperation getSystemFetchOperation(Object o,
                                                       IElementCollector collector)
Returns the SystemFetchOperation to be used in performing a query. Adapters should override this to provide customizations where appropriate.

Parameters:
o -
collector -
Returns:
the fetch operation. By default it returns the base implementation

isContainer

public boolean isContainer()

getRule

public ISchedulingRule getRule(Object element)

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.