org.eclipse.rse.ui.view
Interface ISystemViewElementAdapter
-
All Superinterfaces:
-
IActionFilter,
IPropertySource,
IRemoteObjectIdentifier,
ISystemDragDropAdapter
-
All Known Implementing Classes:
-
AbstractSystemViewAdapter,
SystemViewRemoteOutputAdapter
-
public interface ISystemViewElementAdapter
- extends
IPropertySource,
ISystemDragDropAdapter,
IActionFilter
This is the interface for an adapter on objects in the system viewer.
Any input into the system viewer must register an adapter that implements this interface.
This interface supports a union of all the methods needed to support a TreeViewer
content provider and label provider. The SystemViewLabelAndContentProvider
delegates to objects of this interface almost completely. It gets such an
object by calling:
isve = object.getAdapter(ISystemViewElementAdapter.class);
interestingInfo = isve.getXXXX(object);
This interface also supports IPropertySource via inheritance, so we can feed the
PropertySheet.
For remote resource objects, their adapter should also implement
ISystemRemoteElementAdapter
-
See Also:
-
AbstractSystemViewAdapter
Method Summary
|
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. |
boolean
|
canDelete
(
Object element)
Return true if this object is deletable by the user. |
boolean
|
canRename
(
Object element)
Return true if this object is renamable by the user. |
boolean
|
doDelete
(
Shell shell,
Object element,
IProgressMonitor monitor)
Perform the delete action on single item. |
boolean
|
doDeleteBatch
(
Shell shell,
List resourceSet,
IProgressMonitor monitor)
Perform the delete on the given set of items. |
boolean
|
doRename
(
Shell shell,
Object element,
String name,
IProgressMonitor monitor)
Perform the rename on the given item. |
boolean
|
exists
(
Object element)
Returns whether the specified element is represented as existing. |
String
|
getAlternateText
(
Object element)
Return the alternate label for this object. |
String
|
getCanonicalNewName
(
Object element,
String newName)
Form and return a new canonical (unique) name for this object, given a candidate for the new
name. |
Object[]
|
getChildren
(
IAdaptable element,
IProgressMonitor monitor)
Return the children of this model object. |
Object[]
|
getChildren
(
IContextObject contextObject,
IProgressMonitor monitor)
Return the children of this object. |
Object[]
|
getChildrenUsingExpandToFilter
(
Object element,
String expandToFilter)
Return the children of this object, using the given Expand-To filter |
String
|
getFilterString
()
|
ImageDescriptor
|
getImageDescriptor
(
Object element)
Returns an image descriptor for the image. |
ISystemViewInputProvider
|
getInput
()
Get the input object used to populate the viewer with the roots. |
String
|
getInputMementoHandle
(
Object element)
Return what to save to disk to identify this element when it is the input object to a secondary
Remote System Explorer perspective. |
String
|
getMementoHandle
(
Object element)
Return what to save to disk to identify this element in the persisted list of expanded elements. |
String
|
getMementoHandleKey
(
Object element)
Return a short string to uniquely identify the type of resource. |
String
|
getName
(
Object element)
Return the name of this object, which may be different than the display text ({#link #getText(Object)}. |
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
|
getPropertyValue
(
Object key,
boolean formatted)
Wrapper to getPropertyValue(Object key) that takes an argument
for determining whether to return a raw value or formatted value. |
Shell
|
getShell
()
Get the shell currently hosting the objects in this adapter, as last set
by the label or content provider that retrieved this adapter. |
String
|
getStatusLineText
(
Object element)
Return the string to display in the status line when the given object is
selected. |
ISubSystem
|
getSubSystem
(
Object element)
Get the subsystem that corresponds to this object if one exists. |
String
|
getText
(
Object element)
Return the label for this object. |
String
|
getType
(
Object element)
Return a value for the type property for this object. |
IPropertyDescriptor[]
|
getUniquePropertyDescriptors
()
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. |
Viewer
|
getViewer
()
Return the current viewer, as set via setViewer or its deduced from the
setInput input object if set. |
boolean
|
handleDoubleClick
(
Object element)
User has double clicked on an object. |
boolean
|
hasChildren
(
IAdaptable element)
Return true if this object has children. |
boolean
|
hasChildren
(
IContextObject element)
Return true if this object has children. |
boolean
|
isPromptable
(
Object element)
Return true if this object is a "prompting" object that prompts the user when expanded. |
boolean
|
isRemote
(
Object element)
Return true if this object is a "remote" object. |
boolean
|
namesAreEqual
(
Object element,
String newName)
Compare the name of the given element to the given new name to decide if they are equal. |
boolean
|
saveExpansionState
(
Object element)
Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
messages. |
void
|
selectionChanged
(
Object element)
|
void
|
setFilterString
(
String filterString)
|
void
|
setInput
(
ISystemViewInputProvider input)
Set the input object used to populate the viewer with the roots. |
void
|
setPropertySourceInput
(
Object propertySourceInput)
Set input object for property source queries. |
void
|
setShell
(
Shell shell)
Set the shell to be used by any method that requires it. |
void
|
setViewer
(
Viewer viewer)
Set the viewer that is driving this adapter. |
boolean
|
showDelete
(
Object element)
Return true if we should show the delete action in the popup for the given element. |
boolean
|
showGenericShowInTableAction
(
Object element)
Return true if we should show the generic show in table action in the popup for the given element. |
boolean
|
showOpenViewActions
(
Object element)
Return true if we should show the refresh action in the popup for the given element. |
boolean
|
showProperties
(
Object element)
Return true if we should show the properties action in the popup for the given element. |
boolean
|
showRefresh
(
Object element)
Return true if we should show the refresh action in the popup for the given element. |
boolean
|
showRename
(
Object element)
Return true if we should show the rename action in the popup for the given element. |
boolean
|
supportsDeferredQueries
(
ISubSystem subSys)
Return whether deferred queries are supported. |
noActions
static final
IAction[] noActions
setShell
void setShell(
Shell shell)
- Set the shell to be used by any method that requires it.
This is set by the Label and Content providers that retrieve this adapter.
-
-
setViewer
void setViewer(
Viewer viewer)
- Set the viewer that is driving this adapter. Used adapters that implements to access current viewer.
This is set by the Label and Content providers that retrieve this adapter.
-
-
setInput
void setInput(
ISystemViewInputProvider input)
- 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.
-
-
getShell
Shell getShell()
- Get the shell currently hosting the objects in this adapter, as last set
by the label or content provider that retrieved this adapter.
-
-
getViewer
Viewer getViewer()
- Return the current viewer, as set via setViewer or its deduced from the
setInput input object if set. May be null so test it.
-
-
getInput
ISystemViewInputProvider getInput()
- Get the input object used to populate the viewer with the roots.
May be used by an adapter to retrieve context-sensitive information.
-
-
getSubSystem
ISubSystem getSubSystem(
Object element)
- Get the subsystem that corresponds to this object if one exists.
-
-
Specified by:
-
getSubSystem
in interface
ISystemDragDropAdapter
-
-
Parameters:
-
element
- The element to be identified. May be of type
IContextObject
(including the context of the element),
String
(giving the absolute path of a remote object),
or the actual remote data element itself.
getPropertyValue
Object getPropertyValue(
Object key,
boolean formatted)
- Wrapper to getPropertyValue(Object key) that takes an argument
for determining whether to return a raw value or formatted value.
-
-
getUniquePropertyDescriptors
IPropertyDescriptor[] getUniquePropertyDescriptors()
- 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.
-
-
addActions
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:
-
-
-
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.
getImageDescriptor
ImageDescriptor getImageDescriptor(
Object element)
- Returns an image descriptor for the image. More efficient than getting
the image. Implements
IWorkbenchAdapter.getImageDescriptor(Object)
.
-
-
-
Parameters:
-
element
- The element for which an image is desired
getText
String getText(
Object element)
- Return the label for this object.
-
-
getAlternateText
String getAlternateText(
Object element)
- Return the alternate label for this object.
-
-
getName
String getName(
Object element)
- Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
-
-
getType
String getType(
Object element)
- Return a value for the type property for this object.
-
-
getStatusLineText
String getStatusLineText(
Object element)
- Return the string to display in the status line when the given object is
selected.
-
-
exists
boolean exists(
Object element)
- Returns whether the specified element is represented as existing. Note that
it's possible that the represented element will been seen to exist when on
a remote host it may not - that is because this call does not query the host.
-
-
-
Parameters:
-
element
- the element to check
-
Returns:
- true if the element exists
-
Since:
- 3.0
getParent
Object getParent(
Object element)
- 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 you can return a parent, why not, go
for it.
-
-
getChildren
Object[] getChildren(
IAdaptable element,
IProgressMonitor monitor)
- Return the children of this model object.
When
supportsDeferredQueries(ISubSystem)
returns false,
this query will be called in the dispatch thread, so the implementation
needs to make sure that SWT thread exceptions are avoided.
-
-
-
Parameters:
-
element
- the model object to query -
monitor
- the progress monitor
-
Returns:
- the children of element
getChildren
Object[] getChildren(
IContextObject contextObject,
IProgressMonitor monitor)
- Return the children of this object.
When a contextObject is passed in instead of an adaptable model
object, the adapter needs handle both the model object as well
as the associated filter.
When
supportsDeferredQueries(ISubSystem)
returns false,
this query will be called in the dispatch thread, so the implementation
needs to make sure that SWT thread exceptions are avoided.
-
-
-
Parameters:
-
contextObject
- a wrapper object that contains the model object plus context information -
monitor
- the progress monitor
-
Returns:
- the children of the model object in contextObject that matches the filter in contextObject
getChildrenUsingExpandToFilter
Object[] getChildrenUsingExpandToFilter(
Object element,
String expandToFilter)
- Return the children of this object, using the given Expand-To filter
-
-
hasChildren
boolean hasChildren(
IAdaptable element)
- Return true if this object has children.
In case this adapter returns true for
supportsDeferredQueries(ISubSystem)
,
it is expected that the underlying subsystem caches the hasChildren() attribute
such that it does not necessarily perform a server round trip. In this case, it
has more the semantics of "can have children". In that case,
a deferred
getChildren(IAdaptable, IProgressMonitor)
call is still allowed to return an empty array indicating no children.
-
-
-
Parameters:
-
element
- the element to check
-
Returns:
-
true
if this element can have children.
hasChildren
boolean hasChildren(
IContextObject element)
- Return true if this object has children.
-
-
-
Parameters:
-
element
- the element to check
-
Returns:
-
true
if this element can have children. -
See Also:
-
hasChildren(IAdaptable)
isPromptable
boolean isPromptable(
Object element)
- 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
-
-
isRemote
boolean isRemote(
Object element)
- Return true if this object is a "remote" object. A remote object is defined as an object
that is not part of the base RSE artifacts (hosts, subsystems, filters). This method is used
to decide whether certain actions will be available from views, and how views should handle refreshing
such objects. Remote objects can appear more than once in the same view, while non-remote objects
are more confined and can be handled very clearly by the RSE UI framework.
-
-
-
Parameters:
-
element
- the object to check
-
Returns:
- true if the object is remote
setPropertySourceInput
void setPropertySourceInput(
Object propertySourceInput)
- Set input object for property source queries. This is called by the
SystemViewAdaptorFactory before returning this adapter object.
Handled automatically if you start with AbstractSystemViewAdaptor.
-
-
handleDoubleClick
boolean handleDoubleClick(
Object element)
- 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.
-
-
showDelete
boolean showDelete(
Object element)
- 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.
-
-
canDelete
boolean canDelete(
Object element)
- Return true if this object is deletable by the user. If so, when selected,
the Edit->Delete menu item will be enabled.
-
-
doDelete
boolean doDelete(
Shell shell,
Object element,
IProgressMonitor monitor)
throws
Exception
- Perform the delete action on single item. Implement if the object is
deletable.
Implementers have two choices of dealing with error conditions:
handle the error themselves (for example, by showing an error dialog) and returning
false
; or by throwing an Exception and having the framework
handle the error.
If the operation is cancelled, the implementation is free to either
return false
or throw a
SystemOperationCancelledException
, since in both cases the
framework will refresh the element to see whether it has
actually been deleted or not, but not show any other message.
-
-
-
Parameters:
-
shell
- The shell that can act as a parent for an adapter-issued
message dialog. -
element
- The element that should be deleted. -
monitor
- The progress monitor for progress and cancellation. May be
null
.
-
Returns:
-
true
indicates that the deletion succeeded,
false
indicates that the deletion failed but no user
feedback is required by the framework because the implementation
has already handled the error or cancellation.
-
Throws:
-
Exception
- if the deletion failed and the adapter did not show a
message dialog. -
See Also:
-
showDelete(Object)
,
canDelete(Object)
doDeleteBatch
boolean doDeleteBatch(
Shell shell,
List resourceSet,
IProgressMonitor monitor)
throws
Exception
- Perform the delete on the given set of items.
See
doDelete(Shell, Object, IProgressMonitor)
for semantics of
error handling and cancellation.
-
-
-
Parameters:
-
shell
- the shell that can act as a parent for an adapter-issued
message dialog. -
resourceSet
- a list of resources that should be deleted. -
monitor
- The progress monitor for progress and cancellation. May be
null
.
-
Returns:
-
true
if all deletions were successful,
false
if any deletion was not successful but proper
error reporting has been done by the adapter already. The
framework will only refresh the items to see which ones have
actually been deleted.
-
Throws:
-
Exception
- if any deletion was not successful and the adapter did
not perform any error reporting. If this is a
SystemMessageException
then the caller should examine
the results and fire any necessary events.
showRename
boolean showRename(
Object element)
- 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.
-
-
canRename
boolean canRename(
Object element)
- Return true if this object is renamable by the user. If so, when selected,
the Rename popup menu item will be enabled.
-
-
doRename
boolean doRename(
Shell shell,
Object element,
String name,
IProgressMonitor monitor)
throws
Exception
- Perform the rename on the given item.
-
-
-
Throws:
-
Exception
-
Since:
- 3.0
getNameValidator
ISystemValidator getNameValidator(
Object element)
- Return a validator for verifying the new name is correct.
If you return null, no error checking is done on the new name!!
Suggest you use at least UniqueStringValidator or a subclass to ensure
new name is at least unique.
-
-
getCanonicalNewName
String getCanonicalNewName(
Object element,
String newName)
- 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.
This method returns a name that can be used for uniqueness checking because it is qualified
sufficiently to make it unique.
-
-
namesAreEqual
boolean namesAreEqual(
Object element,
String newName)
- 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.
-
-
showRefresh
boolean showRefresh(
Object element)
- Return true if we should show the refresh action in the popup for the given element.
-
-
showProperties
boolean showProperties(
Object element)
- Return true if we should show the properties action in the popup for the given element.
-
-
showOpenViewActions
boolean showOpenViewActions(
Object element)
- Return true if we should show the refresh action in the popup for the given element.
-
-
showGenericShowInTableAction
boolean showGenericShowInTableAction(
Object element)
- Return true if we should show the generic show in table action in the popup for the given element.
-
-
getMementoHandle
String getMementoHandle(
Object element)
- 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.
-
-
getInputMementoHandle
String getInputMementoHandle(
Object element)
- Return what to save to disk to identify this element when it is the input object to a secondary
Remote System Explorer perspective.
-
-
getMementoHandleKey
String getMementoHandleKey(
Object element)
- 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.
-
-
saveExpansionState
boolean saveExpansionState(
Object element)
- 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
-
-
selectionChanged
void selectionChanged(
Object element)
-
-
setFilterString
void setFilterString(
String filterString)
-
-
getFilterString
String getFilterString()
-
-
supportsDeferredQueries
boolean supportsDeferredQueries(
ISubSystem subSys)
- Return whether deferred queries are supported. By default
they are not supported. Subclasses must override this to
return true if they are to support this.
-
-
-
Parameters:
-
subSys
- subsystem to use for deferred queries.
-
Returns:
-
true
if it supports deferred queries, false
otherwise.
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.