Remote Systems
v6.4.1

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

java.lang.Object
  extended bycom.ibm.etools.systems.core.ui.view.AbstractSystemViewAdapter
      extended bycom.ibm.etools.systems.core.ui.view.SystemViewScratchpadAdapter
All Implemented Interfaces:
IRemoteObjectIdentifier, ISystemDragDropAdapter, ISystemPropertyConstants, ISystemRemoteElementAdapter, ISystemViewActionFilter, ISystemViewElementAdapter

public class SystemViewScratchpadAdapter
extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, ISystemRemoteElementAdapter, ISystemDragDropAdapter

Adapter for the root-providing object of the SystemView tree viewer.


Field Summary
static String copyright
           
 
Fields inherited from class com.ibm.etools.systems.core.ui.view.AbstractSystemViewAdapter
_lastResults, _lastSelected, canceledObject, EMPTY_STRING_LIST, emptyList, errorObject, filterString, MEMENTO_DELIM, MSG_SUB_PREFIX, MSG_SUB1, MSG_SUB2, msgList, nullObject, propertySourceInput, shell, 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
SystemViewScratchpadAdapter()
          Ctor.
 
Method Summary
 void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
          Returns any actions that should be contributed to the popup menu for the given element.
 boolean canDrop(Object element)
          Return true if another object can be copied into this object
 Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
          Perform drop from the "from" object to the "to" object
 String getAbsoluteName(Object element)
          Return the absolute name, versus just display name, of this object.
 String getAbsoluteParentName(Object element)
          Return fully qualified name that uniquely identifies this remote object's remote parent within its subsystem.
 Object[] getChildren(Object element)
          Return the children of this object
 ImageDescriptor getImageDescriptor(Object element)
          Returns an image descriptor for the image.
 ISystemValidator getNameValidator(Object element)
          Return a validator for verifying the new name is correct.
 Object getParent(Object element)
          Return the parent of this object
 Object getRemoteParent(Shell shell, Object element)
          Given a remote object, returns it remote parent object.
 String[] getRemoteParentNamesInUse(Shell shell, Object element)
          Given a remote object, return the unqualified names of the objects contained in that parent.
 String getRemoteSubType(Object element)
          Return a value for the subtype property for this object.
 String getRemoteType(Object element)
          Return a value for the type property for this object The value must not be translated, so that property pages registered via xml can subset by it.
 String getRemoteTypeCategory(Object element)
          Return a value for the type category property for this object The value must not be translated, so that property pages registered via xml can subset by it.
 String getSubSystemFactoryId(Object element)
          Return the subsystem factory id that owns this remote object The value must not be translated, so that property pages registered via xml can subset by it.
 String getText(Object element)
          Return the label for this object
 String getType(Object element)
          Return the type label for this object
 boolean hasChildren(Object element)
          Return true if this object has children
protected  org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
          Return our unique property descriptors
 Object internalGetPropertyValue(Object key)
          Return our unique property values
 boolean refreshRemoteObject(Object oldElement, Object newElement)
          Short answer: treat this like clone(), and just copy any important instance variables Imagine the same remote resource is shown multiple times in the same tree view.... say because multiple filters resolve to it, or there are two connections to the same host.
 boolean showDelete(Object element)
          We don't support delete at all.
 boolean showRename(Object element)
          We don't support rename at all.
 boolean supportsUserDefinedActions(Object object)
          Returns false.
 boolean validateDrop(Object src, Object target, boolean sameSystem)
          Return true if it is valid for the src object to be dropped in the target
 
Methods inherited from class com.ibm.etools.systems.core.ui.view.AbstractSystemViewAdapter
addCommonRemoteActions, addDynamicPopupMenuActions, canDelete, canDrag, canEdit, canRename, checkForNull, createSimplePropertyDescriptor, createSimplePropertyDescriptor, doDelete, doDrag, doDrop, doRename, fetchDeferredChildren, getAdapter, getCancelledMessageObject, getCanonicalNewName, getChildren, getChildrenUsingExpandToFilter, getCurrentTreeView, getDefaultDescriptors, getEditableRemoteObject, getEditableValue, getEmptyMessageObject, getFailedMessageObject, getFilterString, getFilterStringFor, getFirstSelection, getInput, getInputMementoHandle, getLabel, getMementoHandle, getMementoHandleKey, getName, getPropertyDescriptors, getPropertyValue, getPropertyValue, getRemoteAdapter, getRemoteSourceType, getRemoteSubSubType, getRule, getShell, getStatusLineText, getSubSystem, getSystemFetchOperation, getSystemTree, getTranslatedFalse, getTranslatedNo, getTranslatedNotApplicable, getTranslatedNotAvailable, getTranslatedTrue, getTranslatedYes, getUniquePropertyDescriptors, getViewer, handleDoubleClick, initMsgObjects, isContainer, isPromptable, isPropertySet, namesAreEqual, resetPropertyValue, saveExpansionState, selectionChanged, setFilterString, setInput, setPropertySourceInput, setPropertyValue, setShell, setViewer, showGenericShowInTableAction, showOpenViewActions, showRefresh, sub, supportsDeferredQueries, testAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.etools.systems.core.ui.view.ISystemViewElementAdapter
canDelete, canRename, doDelete, doRename, getCanonicalNewName, getChildren, getChildrenUsingExpandToFilter, getFilterString, getInput, getInputMementoHandle, getMementoHandle, getMementoHandleKey, getName, getPropertyValue, getShell, getStatusLineText, getSubSystem, getUniquePropertyDescriptors, getViewer, handleDoubleClick, isPromptable, namesAreEqual, saveExpansionState, selectionChanged, setFilterString, setInput, setPropertySourceInput, setShell, setViewer, showGenericShowInTableAction, showOpenViewActions, showRefresh, supportsDeferredQueries
 
Methods inherited from interface com.ibm.etools.systems.core.ui.view.ISystemDragDropAdapter
canDrag, doDrag, doDrop
 
Methods inherited from interface com.ibm.etools.systems.core.ui.view.ISystemRemoteElementAdapter
canEdit, getEditableRemoteObject, getFilterStringFor, getName, getRemoteSourceType, getRemoteSubSubType, getSubSystem
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values
Constructor Detail

SystemViewScratchpadAdapter

public SystemViewScratchpadAdapter()
Ctor.

Method Detail

addActions

public void addActions(SystemMenuManager menu,
                       IStructuredSelection selection,
                       Shell shell,
                       String menuGroup)
Returns any actions that should be contributed to the popup menu for the given element.

Specified by:
addActions in interface ISystemViewElementAdapter
Specified by:
addActions in class AbstractSystemViewAdapter
Parameters:
menu - The menu to contribute actions to
selection - The window's current selection.
shell - Shell of viewer
menuGroup - recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
See Also:
ISystemViewElementAdapter.addActions(SystemMenuManager, IStructuredSelection, Shell, String)

getImageDescriptor

public ImageDescriptor getImageDescriptor(Object element)
Returns an image descriptor for the image. More efficient than getting the image.

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

getText

public String getText(Object element)
Return the label for this object

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

getAbsoluteName

public String getAbsoluteName(Object element)
Return the absolute name, versus just display name, of this object. Just uses getText(element);

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

getType

public String getType(Object element)
Return the type label for this object

Specified by:
getType in interface ISystemViewElementAdapter
Specified by:
getType in class AbstractSystemViewAdapter

getParent

public Object getParent(Object element)
Return the parent of this object

Specified by:
getParent in interface ISystemViewElementAdapter
Specified by:
getParent in class AbstractSystemViewAdapter

getChildren

public Object[] getChildren(Object element)
Return the children of this object

Specified by:
getChildren in interface ISystemViewElementAdapter
Specified by:
getChildren in class AbstractSystemViewAdapter

hasChildren

public boolean hasChildren(Object element)
Return true if this object has children

Specified by:
hasChildren in interface ISystemViewElementAdapter
Specified by:
hasChildren in class AbstractSystemViewAdapter

showDelete

public boolean showDelete(Object element)
We don't support delete at all.

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

showRename

public boolean showRename(Object element)
We don't support rename at all.

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

getNameValidator

public ISystemValidator getNameValidator(Object element)
Return a validator for verifying the new name is correct.

Specified by:
getNameValidator in interface ISystemViewElementAdapter
Overrides:
getNameValidator in class AbstractSystemViewAdapter
See Also:
AbstractSystemViewAdapter.canRename(Object)

internalGetPropertyDescriptors

protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
Return our unique property descriptors

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

internalGetPropertyValue

public Object internalGetPropertyValue(Object key)
Return our unique property values

Specified by:
internalGetPropertyValue in class AbstractSystemViewAdapter
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.

canDrop

public boolean canDrop(Object element)
Description copied from interface: ISystemDragDropAdapter
Return true if another object can be copied into this object

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

doDrop

public Object doDrop(Object from,
                     Object to,
                     boolean sameSystemType,
                     boolean sameSystem,
                     int srcType,
                     IProgressMonitor monitor)
Description copied from interface: ISystemDragDropAdapter
Perform drop from the "from" object to the "to" object

Specified by:
doDrop in interface ISystemDragDropAdapter
Overrides:
doDrop in class AbstractSystemViewAdapter
Returns:
the new object that was copied
See Also:
AbstractSystemViewAdapter.canDrag(Object), AbstractSystemViewAdapter.doDrag(Object,boolean,IProgressMonitor), AbstractSystemViewAdapter.canDrop(Object), AbstractSystemViewAdapter.validateDrop(Object,Object,boolean)

getAbsoluteParentName

public String getAbsoluteParentName(Object element)
Description copied from interface: ISystemRemoteElementAdapter
Return fully qualified name that uniquely identifies this remote object's remote parent within its subsystem. This is used when deleting a remote resource for example, all occurrences of its parent are found and refreshed in the RSE views.

Specified by:
getAbsoluteParentName in interface ISystemRemoteElementAdapter

getSubSystemFactoryId

public String getSubSystemFactoryId(Object element)
Description copied from interface: ISystemRemoteElementAdapter
Return the subsystem factory id that owns this remote object The value must not be translated, so that property pages registered via xml can subset by it.

Specified by:
getSubSystemFactoryId in interface ISystemRemoteElementAdapter

getRemoteTypeCategory

public String getRemoteTypeCategory(Object element)
Description copied from interface: ISystemRemoteElementAdapter
Return a value for the type category property for this object The value must not be translated, so that property pages registered via xml can subset by it.

Specified by:
getRemoteTypeCategory in interface ISystemRemoteElementAdapter

getRemoteType

public String getRemoteType(Object element)
Description copied from interface: ISystemRemoteElementAdapter
Return a value for the type property for this object The value must not be translated, so that property pages registered via xml can subset by it.

Specified by:
getRemoteType in interface ISystemRemoteElementAdapter

getRemoteSubType

public String getRemoteSubType(Object element)
Description copied from interface: ISystemRemoteElementAdapter
Return a value for the subtype property for this object. Not all object types support a subtype, so returning null is ok. The value must not be translated, so that property pages registered via xml can subset by it.

Specified by:
getRemoteSubType in interface ISystemRemoteElementAdapter

refreshRemoteObject

public boolean refreshRemoteObject(Object oldElement,
                                   Object newElement)
Description copied from interface: ISystemRemoteElementAdapter

Short answer: treat this like clone(), and just copy any important instance variables

Imagine the same remote resource is shown multiple times in the same tree view.... say because multiple filters resolve to it, or there are two connections to the same host. Typically it is a different object in memory within the tree, but it refers to the same remote resource.
Now imagine one of the references is selected by the user and renamed via the rename action. This might only update the selected reference. What about the other objects which refer to the same remote resource... they need to update their in-memory "name" variable too.
That is what this method. Every reference to the same remote resource is found (they have the same absolute name and come from a system with the same hostname) and this method is called on those other references. This is your opportunity to copy the attributes from the new element to the old element.

Some view has updated the name or properties of this remote object. As a result, the remote object's contents need to be refreshed. You are given the old remote object that has old data, and you are given the new remote object that has the new data. For example, on a rename the old object still has the old name attribute while the new object has the new new attribute. You can copy the new name into the old object. Similar for any properties you allow the user to edit via the property sheet.

This is called by viewers like SystemView in response to rename and property change events.

Specified by:
refreshRemoteObject in interface ISystemRemoteElementAdapter
Parameters:
oldElement - the element that was found in the tree
newElement - the updated element that was passed in the REFRESH_REMOTE event
Returns:
true if you want the viewer that called this to refresh the children of this object, such as is needed on a rename of a folder, say, if the child object cache the parent folder name or an absolute file name.

getRemoteParent

public Object getRemoteParent(Shell shell,
                              Object element)
                       throws Exception
Description copied from interface: ISystemRemoteElementAdapter
Given a remote object, returns it remote parent object. Eg, given a file, return the folder it is contained in.

Specified by:
getRemoteParent in interface ISystemRemoteElementAdapter
Throws:
Exception

getRemoteParentNamesInUse

public String[] getRemoteParentNamesInUse(Shell shell,
                                          Object element)
                                   throws Exception
Description copied from interface: ISystemRemoteElementAdapter
Given a remote object, return the unqualified names of the objects contained in that parent. This is used for testing for uniqueness on a rename operation, for example. Sometimes, it is not enough to just enumerate all the objects in the parent for this purpose, because duplicate names are allowed if the types are different, such as on iSeries. In this case return only the names which should be used to do name-uniqueness validation on a rename operation.

Specified by:
getRemoteParentNamesInUse in interface ISystemRemoteElementAdapter
Throws:
Exception

validateDrop

public boolean validateDrop(Object src,
                            Object target,
                            boolean sameSystem)
Description copied from interface: ISystemDragDropAdapter
Return true if it is valid for the src object to be dropped in the target

Specified by:
validateDrop in interface ISystemDragDropAdapter
Overrides:
validateDrop in class AbstractSystemViewAdapter
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:
AbstractSystemViewAdapter.canDrag(Object), AbstractSystemViewAdapter.doDrag(Object,boolean,IProgressMonitor), AbstractSystemViewAdapter.canDrop(Object), AbstractSystemViewAdapter.doDrop(Object,Object,boolean,boolean,IProgressMonitor)

supportsUserDefinedActions

public boolean supportsUserDefinedActions(Object object)
Returns false.

Specified by:
supportsUserDefinedActions in interface ISystemRemoteElementAdapter
Parameters:
object - the object.
Returns:
true if the object supports user defined actions, false otherwise.
See Also:
ISystemRemoteElementAdapter.supportsUserDefinedActions(java.lang.Object)

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.