|
|
|
|
org.eclipse.rse.ui.view
Class AbstractSystemViewAdapter
java.lang.Object
org.eclipse.rse.ui.view.AbstractSystemViewAdapter
-
All Implemented Interfaces:
-
IRemoteObjectIdentifier,
ISystemDragDropAdapter,
ISystemViewElementAdapter,
IActionFilter,
IWorkbenchAdapter,
IDeferredWorkbenchAdapter,
IPropertySource
-
Direct Known Subclasses:
-
SystemViewRemoteOutputAdapter
-
public abstract class AbstractSystemViewAdapter
- extends
Object
- implements
ISystemViewElementAdapter,
IWorkbenchAdapter,
IDeferredWorkbenchAdapter
Base class for adapters needed for the SystemView viewer.
It implements the ISystemViewElementAdapter interface.
-
See Also:
-
AbstractSystemRemoteAdapterFactory
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)
Returns any framework-supplied remote object actions that should be contributed to the popup menu
for the given selection list. |
void
|
addDynamicPopupMenuActions
(
SystemMenuManager menu,
IStructuredSelection selection,
Shell shell,
String menuGroup)
Add or remove custom actions dynamically to a context menu. |
boolean
|
canDelete
(
Object element)
Return true if this object is deletable by the user. |
boolean
|
canDrag
(
Object element)
Return true if this object can be copied to another location. |
boolean
|
canDrag
(
SystemRemoteResourceSet elements)
Return true if this object can be copied to another location. |
boolean
|
canDrop
(
Object element)
Return true if another object can be copied into this object. |
boolean
|
canEdit
(
Object object)
Indicates whether the specified object can be edited or not. |
boolean
|
canRename
(
Object element)
Return true if this object is renameable by the user. |
protected
Object[]
|
checkForEmptyList
(
Object[] children,
Object parent,
boolean returnNullMsg)
In getChildren, return checkForEmptyList(children, parent,
true/false)<.samp> versus your array directly. |
protected
Object[]
|
checkForNull
(
Object[] children,
boolean returnNullMsg)
Deprecated. Use
checkForEmptyList(Object[], Object, boolean)
instead.
|
protected static
PropertyDescriptor
|
createSimplePropertyDescriptor
(
String propertyKey,
String label,
String description)
Create and return a simple string read-only property descriptor. |
boolean
|
doDelete
(
Shell shell,
Object element,
IProgressMonitor monitor)
Perform the delete action on single item.
By default does nothing. |
boolean
|
doDeleteBatch
(
Shell shell,
List resourceSet,
IProgressMonitor monitor)
Perform the delete on the given set of items.
By default just calls the doDelete method for each item in the
resourceSet. |
Object
|
doDrag
(
Object element,
boolean sameSystemType,
IProgressMonitor monitor)
Perform the drag on the given object. |
ISystemResourceSet
|
doDrag
(
SystemRemoteResourceSet set,
IProgressMonitor monitor)
Perform the drag on the given objects. |
ISystemResourceSet
|
doDrop
(
ISystemResourceSet fromSet,
Object to,
boolean sameSystemType,
boolean sameSystem,
int srcType,
IProgressMonitor monitor)
Perform drop from the "fromSet" of objects to the "to" 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. |
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,
IProgressMonitor monitor)
Perform the rename action. |
boolean
|
exists
(
Object element)
{inheritDoc} By default, this method returns true - override this method
to customize the behavior. |
void
|
fetchDeferredChildren
(
Object o,
IElementCollector collector,
IProgressMonitor monitor)
|
String
|
getAlternateText
(
Object element)
Return the alternate label for this object. |
protected
Object[]
|
getCancelledMessageObject
()
Return the "Operation cancelled by user" message as an object array so
can be used to answer getChildren(). |
String
|
getCanonicalNewName
(
Object element,
String newName)
Form and return a new canonical (unique) name for this object, given a
candidate for the new name. |
abstract
Object[]
|
getChildren
(
IAdaptable element,
IProgressMonitor monitor)
Return the children of this model object. This should be overridden by subclasses in order to provide
deferred query support via the Eclipse Jobs mechanism. |
Object[]
|
getChildren
(
IContextObject element,
IProgressMonitor monitor)
Return the children of this object. This should be overridden by subclasses in order to provide
deferred query support via the Eclipse Jobs mechanism, if your adapter
supports context objects. |
Object[]
|
getChildren
(
Object object)
Rather than overriding this, adapter implementors should
override the getChildren() methods that take a progress monitor. |
Object[]
|
getChildrenUsingExpandToFilter
(
Object element,
String expandToFilter)
Return the children of this object, using the given Expand-To filter. |
protected
ISystemTree
|
getCurrentTreeView
()
Return the current viewer as an ISystemTree if it is one, or null
otherwise. |
protected static
IPropertyDescriptor[]
|
getDefaultDescriptors
()
Return the default descriptors for all system elements. |
ISystemEditableRemoteObject
|
getEditableRemoteObject
(
Object object)
Return the remote edit wrapper for this object. |
Object
|
getEditableValue
()
Returns a value for this object that can be edited in a property sheet. |
protected
Object[]
|
getEmptyMessageObject
()
Deprecated. Use
checkForEmptyList(Object[], Object, boolean)
instead.
|
protected
Object[]
|
getFailedMessageObject
()
Return the "Operation failed" message as an object array so can be used
to answer getChildren(). |
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)
Get the first selected object of the given selection. |
abstract
ImageDescriptor
|
getImageDescriptor
(
Object element)
Returns an image descriptor for the image.
Abstract. |
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
|
getLabel
(
Object element)
{inheritDoc} We map to getText(element). |
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)}. By default, returns getText(element);, but
child classes can override if display name doesn't equal real name. |
ISystemValidator
|
getNameValidator
(
Object element)
Return a validator for verifying the new name is correct. |
abstract
Object
|
getParent
(
Object element)
Return the parent of this object.
Abstract. |
IPropertyDescriptor[]
|
getPropertyDescriptors
()
Returns the property descriptors defining what properties are seen in the
property sheet. |
Object
|
getPropertyValue
(
Object key)
Returns the current value for the named property. |
Object
|
getPropertyValue
(
Object key,
boolean formatted)
Similar to getPropertyValue(Object key) but takes an argument for
determining whether to return a raw value or formatted value. |
protected
ISystemRemoteElementAdapter
|
getRemoteAdapter
(
Object o)
Deprecated. use SystemAdapterHelpers.getRemoteAdapter(o, getViewer())
instead
|
String
|
getRemoteSourceType
(
Object element)
From
(Object) . |
String
|
getRemoteSubSubType
(
Object element)
From
(Object) . |
ISchedulingRule
|
getRule
(
Object element)
|
Shell
|
getShell
()
Get the shell currently hosting the objects in this adapter. |
String
|
getStatusLineText
(
Object element)
Return the string to display in the status line when the given object is
selected. The default is:
getType(): getName()
Overridable by subclasses, but rarely needs to be. |
ISubSystem
|
getSubSystem
(
Object element)
Returns the subsystem that contains this object. |
protected
SystemFetchOperation
|
getSystemFetchOperation
(
Object o,
IElementCollector collector)
Returns the SystemFetchOperation to be used in performing a query. |
protected
ISystemTree
|
getSystemTree
()
Return the current viewer as an ISystemTree if the viewer is set and it
implements this interface (SystemView does). |
protected
ISystemViewElementAdapter
|
getSystemViewElementAdapter
(
Object o)
Deprecated. use SystemAdapterHelpers.getViewAdapter(o, getViewer())
instead
|
protected
String
|
getTranslatedFalse
()
Return "False" translated. |
protected
String
|
getTranslatedNo
()
Return "No" translated. |
protected
String
|
getTranslatedNotApplicable
()
Return "Not applicable" translated. |
protected
String
|
getTranslatedNotAvailable
()
Return "Not available" translated. |
protected
String
|
getTranslatedTrue
()
Return "True" translated. |
String
|
getTranslatedYes
()
Return "Yes" translated. |
abstract
String
|
getType
(
Object element)
Return a value for the type property for this object.
Abstract. |
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. |
abstract boolean
|
hasChildren
(
IAdaptable element)
Return true if this object has children.
Abstract. |
boolean
|
hasChildren
(
IContextObject element)
Return true if this object has children. Override this to provide context-specific support. |
protected void
|
initMsgObjects
()
Deprecated. Internal use. Do not call this method.
|
protected abstract
IPropertyDescriptor[]
|
internalGetPropertyDescriptors
()
Implement this to return the property descriptors for the properties in
the property sheet. |
protected abstract
Object
|
internalGetPropertyValue
(
Object key)
Implement this to return the property descriptors for the properties in
the property sheet. |
boolean
|
isContainer
()
|
boolean
|
isPromptable
(
Object element)
Return true if this object is a "prompting" object that prompts the user
when expanded. |
boolean
|
isPropertySet
(
Object key)
Returns whether the property value has changed from the default. |
boolean
|
isRemote
(
Object element)
Return true if this object is remote. |
boolean
|
namesAreEqual
(
Object element,
String newName)
Compare the name of the given element to the given new name to decide if
they are equal. |
void
|
resetPropertyValue
(
Object key)
Resets the specified property's value to its default value. |
boolean
|
saveExpansionState
(
Object element)
Sometimes we don't want to remember an element's expansion state, such as
for temporarily inserted messages. |
void
|
selectionChanged
(
Object element)
Selection has changed in the Remote Systems view. |
void
|
setFilterString
(
String filterString)
Sets filter context for querying. |
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
|
setPropertyValue
(
Object key,
Object value)
Sets the named property to the given value. |
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 Called by label and content
provider. |
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 Go Into; and Open In New
Window and Go To actions 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. |
static
String
|
sub
(
String msg,
String subOld,
String subNew)
Deprecated. Clients should use Eclipse
NLS
or Java
MessageFormat
or
String.replaceAll(String, String)
to do
substring replacement and variable substitution.
|
boolean
|
supportsDeferredQueries
(
ISubSystem subSys)
Return whether deferred queries are supported. |
boolean
|
testAttribute
(
Object target,
String name,
String value)
From IActionFilter so the popupMenus extension point can use <filter>, <enablement>
or <visibility>. |
boolean
|
validateDrop
(
ISystemResourceSet set,
Object target,
boolean sameSystem)
Return true if it is valid for the src objects to be dropped in the target |
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 java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
viewer
protected
Viewer viewer
-
Deprecated. use
getViewer() and
setViewer(Viewer)
- Current viewer. Set by content provider.
propertySourceInput
protected
Object propertySourceInput
- Current input provider. Set by content provider.
shell
protected
Shell shell
-
Deprecated. Use
getShell() and
setShell(Shell)
- Current shell, set by the content provider.
emptyList
protected
Object[] emptyList
-
Deprecated. Do not use directly. Use
checkForEmptyList(Object[], Object, boolean) when needed.
- An empty object list instance, for returning an empty list from
getChildren: new Object[0].
msgList
protected
Object[] msgList
-
Deprecated. Do not use directly. Use
getCancelledMessageObject()
or
getFailedMessageObject() or
checkForEmptyList(Object[], Object, boolean) when needed.
- For returning a message object from getChildren. Will be an array with
one item, one of nullObject, cancelledObject or errorObject.
nullObject
protected
SystemMessageObject nullObject
-
Deprecated. Use
checkForEmptyList(Object[], Object, boolean)
instead.
- Frequently returned message object from getChildren: "empty list"
cancelledObject
protected
SystemMessageObject cancelledObject
-
Deprecated. Use
getCancelledMessageObject() instead.
- Frequently returned message object from getChildren: "operation
cancelled".
This field was renamed from "canceledObject" in RSE 3.0.
-
Since:
- org.eclipse.rse.ui 3.0
errorObject
protected
SystemMessageObject errorObject
-
Deprecated. Use
getFailedMessageObject() instead.
- Frequently returned message object from getChildren: "operation ended in
error"
MSG_SUB_PREFIX
protected static final
String MSG_SUB_PREFIX
-
Deprecated. use Eclipse NLS or Java Messageformat for String
substitution.
- Message substitution prefix: "&"
-
See Also:
-
Constant Field Values
MSG_SUB1
protected static final
String MSG_SUB1
-
Deprecated. use Eclipse NLS or Java Messageformat for String
substitution.
- Message substitution variable 1: "&1"
-
See Also:
-
Constant Field Values
MSG_SUB2
protected static final
String MSG_SUB2
-
Deprecated. use Eclipse NLS or Java Messageformat for String
substitution.
- 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
AbstractSystemViewAdapter
public AbstractSystemViewAdapter()
setViewer
public final void setViewer(
Viewer viewer)
- Set the viewer that is driving this adapter Called by label and content
provider.
Configuration method. Typically called by content provider, viewer or
action. Do not override.
-
-
Specified by:
-
setViewer
in interface
ISystemViewElementAdapter
-
setShell
public final void setShell(
Shell shell)
- Set the shell to be used by any method that requires it.
Configuration method. Typically called by content provider, viewer or
action. Do not override.
-
-
Specified by:
-
setShell
in interface
ISystemViewElementAdapter
-
setInput
public final 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.
Configuration method. Typically called by content provider, viewer or
action. Do not override.
-
-
Specified by:
-
setInput
in interface
ISystemViewElementAdapter
-
getShell
public
Shell getShell()
- Get the shell currently hosting the objects in this adapter.
Getter method. Callable by subclasses. Do not override.
-
-
Specified by:
-
getShell
in interface
ISystemViewElementAdapter
-
getViewer
public
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.
Getter method. Callable by subclasses. Do not override.
-
-
Specified by:
-
getViewer
in interface
ISystemViewElementAdapter
-
getCurrentTreeView
protected
ISystemTree getCurrentTreeView()
- Return the current viewer as an ISystemTree if it is one, or null
otherwise.
Getter method. Callable by subclasses. Do not override.
-
-
getInput
public
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.
Getter method. Callable by subclasses. Do not override.
-
-
Specified by:
-
getInput
in interface
ISystemViewElementAdapter
-
getSubSystem
public
ISubSystem getSubSystem(
Object element)
- Returns the subsystem that contains this object. By default, if the given
element is an instance of
AbstractResource , it
calls getSubSystem on it, else returns null.
Overridable by subclasses. You should override if not using
AbstractResource.
-
-
Specified by:
-
getSubSystem
in interface
ISystemDragDropAdapter
-
Specified by:
-
getSubSystem
in interface
ISystemViewElementAdapter
-
-
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.
addCommonRemoteActions
public void addCommonRemoteActions(
SystemMenuManager menu,
IStructuredSelection selection,
Shell shell,
String menuGroup)
- 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.
Called by SystemView viewer. No need to override or call.
-
-
-
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)
- Add or remove custom actions dynamically to a context menu.
This method is called by the system viewers. Extenders may
override this method in order to modify the context menu
shown for elements of the type they adapt to.
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 rse.ui.SystemMenuManager#add(String,org.eclipse.jface.action.IAction)
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 predefined 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)
- Returns an image descriptor for the image. More efficient than getting
the image. Implements
IWorkbenchAdapter.getImageDescriptor(Object) .
Abstract. Must be overridden by subclasses.
-
-
Specified by:
-
getImageDescriptor
in interface
ISystemViewElementAdapter
-
Specified by:
-
getImageDescriptor
in interface
IWorkbenchAdapter
-
-
Parameters:
-
element - The element for which an image is desired
getAlternateText
public
String getAlternateText(
Object element)
- Return the alternate label for this object. By default this
just returns the regular label. If a custom label is required,
this provides the means to it.
-
-
Specified by:
-
getAlternateText
in interface
ISystemViewElementAdapter
-
-
See Also:
-
getName(Object) ,
IRemoteObjectIdentifier.getAbsoluteName(Object)
getName
public
String getName(
Object element)
- 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.
Overridable by subclasses, but rarely needs to be.
-
-
Specified by:
-
getName
in interface
ISystemViewElementAdapter
-
-
See Also:
-
ISystemViewElementAdapter.getText(Object) ,
IRemoteObjectIdentifier.getAbsoluteName(Object)
getLabel
public
String getLabel(
Object element)
- {inheritDoc} We map to getText(element).
Internal use. Can be safely ignored.
-
-
Specified by:
-
getLabel
in interface
IWorkbenchAdapter
-
getType
public abstract
String getType(
Object element)
- Return a value for the type property for this object.
Abstract. Must be overridden by subclasses.
-
-
Specified by:
-
getType
in interface
ISystemViewElementAdapter
-
getStatusLineText
public
String getStatusLineText(
Object element)
- Return the string to display in the status line when the given object is
selected. The default is:
getType(): getName()
Overridable by subclasses, but rarely needs to be.
-
-
Specified by:
-
getStatusLineText
in interface
ISystemViewElementAdapter
-
exists
public boolean exists(
Object element)
- {inheritDoc} By default, this method returns true - override this method
to customize the behavior.
-
-
Specified by:
-
exists
in interface
ISystemViewElementAdapter
-
-
Parameters:
-
element - the element to check
-
Returns:
- true if the element exists
-
Since:
- 3.0
getParent
public abstract
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.
Abstract. Must be overridden by subclasses.
-
-
Specified by:
-
getParent
in interface
ISystemViewElementAdapter
-
Specified by:
-
getParent
in interface
IWorkbenchAdapter
-
hasChildren
public abstract boolean hasChildren(
IAdaptable element)
- Return true if this object has children.
In case this adapter returns true for
ISystemViewElementAdapter.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
ISystemViewElementAdapter.getChildren(IAdaptable, IProgressMonitor)
call is still allowed to return an empty array indicating no children.
Abstract. Must be overridden by subclasses.
-
-
Specified by:
-
hasChildren
in interface
ISystemViewElementAdapter
-
-
Parameters:
-
element - the element to check
-
Returns:
-
true if this element can have children.
hasChildren
public boolean hasChildren(
IContextObject element)
- Return true if this object has children. Override this to provide context-specific support.
-
-
Specified by:
-
hasChildren
in interface
ISystemViewElementAdapter
-
-
Parameters:
-
element - the context object
-
Returns:
- whether the context has children
-
See Also:
-
ISystemViewElementAdapter.hasChildren(IAdaptable)
getChildren
public final
Object[] getChildren(
Object object)
- Rather than overriding this, adapter implementors should
override the getChildren() methods that take a progress monitor.
-
-
Specified by:
-
getChildren
in interface
IWorkbenchAdapter
-
getChildren
public abstract
Object[] getChildren(
IAdaptable element,
IProgressMonitor monitor)
- Return the children of this model object.
When
ISystemViewElementAdapter.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. 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
-
-
Parameters:
-
element - the model object to get children from -
monitor - the progress monitor
-
Returns:
- the children of element
getChildren
public
Object[] getChildren(
IContextObject element,
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
ISystemViewElementAdapter.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. This should be overridden by subclasses in order to provide
deferred query support via the Eclipse Jobs mechanism, if your adapter
supports context objects. If not, this will fall back to the model object
version of the method.
The context object is passed in in place of the model object. By default,
we just fall back to the original mechanism Return the children of this
object. Return null if children not supported.
-
-
Specified by:
-
getChildren
in interface
ISystemViewElementAdapter
-
-
Parameters:
-
element - the context object that wrappers a model object, it's
subsystem and filter reference -
monitor - the progress monitor
-
Returns:
- the children of the model object within the context object that
matches the containing filter reference criteria.
getChildrenUsingExpandToFilter
public
Object[] getChildrenUsingExpandToFilter(
Object element,
String expandToFilter)
- 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.
Overridable by subclasses, but rarely needs to be.
-
-
Specified by:
-
getChildrenUsingExpandToFilter
in interface
ISystemViewElementAdapter
-
getDefaultDescriptors
protected static
IPropertyDescriptor[] getDefaultDescriptors()
- Return the default descriptors for all system elements. Callable by
subclasses.
-
-
createSimplePropertyDescriptor
protected static
PropertyDescriptor createSimplePropertyDescriptor(
String propertyKey,
String label,
String description)
- Create and return a simple string read-only property descriptor.
Callable by subclasses.
-
-
-
Parameters:
-
propertyKey - Key for this property, sent back in getPropertyValue. -
label - A user-readable translated label for the Property. -
description - A description for the Property (to be displayed as a
tooltip).
getEditableValue
public
Object getEditableValue()
- Returns a value for this object that can be edited in a property sheet.
Needed by framework for property sheet. No need to call or
override.
-
-
Specified by:
-
getEditableValue
in interface
IPropertySource
-
-
Returns:
- a value that can be edited.
getPropertyDescriptors
public
IPropertyDescriptor[] getPropertyDescriptors()
- 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().
Implemented. Do not override typically. See
internalGetPropertyDescriptors() .
-
-
Specified by:
-
getPropertyDescriptors
in interface
IPropertySource
-
-
Returns:
- an array containing all descriptors.
-
See Also:
-
internalGetPropertyDescriptors()
internalGetPropertyDescriptors
protected abstract
IPropertyDescriptor[] internalGetPropertyDescriptors()
- 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 read-only 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, String, String)
getUniquePropertyDescriptors
public
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.
If internalGetPropertyDescriptors() returns non-null, then returns that,
else computes the difference. This is called by the table views like
SystemTableView .
Callable by subclasses. Do not override.
-
-
Specified by:
-
getUniquePropertyDescriptors
in interface
ISystemViewElementAdapter
-
getPropertyValue
public
Object getPropertyValue(
Object key,
boolean formatted)
- 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.
Overridable by subclasses, but usually is not.
-
-
Specified by:
-
getPropertyValue
in interface
ISystemViewElementAdapter
-
-
Parameters:
-
key - the name or key of the property as named by its property
descriptor -
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)
- 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.
Implemented. Do not override typically. See
internalGetPropertyValue(Object) .
-
-
Specified by:
-
getPropertyValue
in interface
IPropertySource
-
-
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)
- 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)
- Returns whether the property value has changed from the default. Only
applicable for editable properties.
Overridable by subclasses. Must be overridden only if editable
properties are supported.
RETURNS FALSE BY DEFAULT.
-
-
Specified by:
-
isPropertySet
in interface
IPropertySource
-
-
Returns:
-
true if the value of the specified property has
changed from its original default value; false otherwise.
resetPropertyValue
public void resetPropertyValue(
Object key)
- Resets the specified property's value to its default value. Called on
editable property when user presses reset button in property sheet
viewer.
Overridable by subclasses. Must be overridden only if editable
properties are supported.
DOES NOTHING BY DEFAULT.
-
-
Specified by:
-
resetPropertyValue
in interface
IPropertySource
-
-
Parameters:
-
key - the key identifying property to reset
setPropertyValue
public void setPropertyValue(
Object key,
Object value)
- Sets the named property to the given value. Called after an editable
property is changed by the user.
Overridable by subclasses. Must be overridden only if editable
properties are supported.
DOES NOTHING BY DEFAULT.
-
-
Specified by:
-
setPropertyValue
in interface
IPropertySource
-
-
Parameters:
-
key - the key identifying property to reset -
value - the new value for the property
setPropertySourceInput
public void setPropertySourceInput(
Object propertySourceInput)
- Set input object for property source queries. This must be called
by your XXXAdaptorFactory before returning this adapter object.
Called from adapter factories. Do not override.
-
-
Specified by:
-
setPropertySourceInput
in interface
ISystemViewElementAdapter
-
handleDoubleClick
public 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.
Overridable by subclasses, but usually is not.
-
-
Specified by:
-
handleDoubleClick
in interface
ISystemViewElementAdapter
-
showDelete
public 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.
Overridable by subclasses, but usually is not.
By default, returns true.
-
-
Specified by:
-
showDelete
in interface
ISystemViewElementAdapter
-
-
See Also:
-
canDelete(Object)
canDelete
public 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.
Overridable by subclasses, and usually is.
By default, returns false. Override if your object is deletable.
-
-
Specified by:
-
canDelete
in interface
ISystemViewElementAdapter
-
-
See Also:
-
showDelete(Object)
doDelete
public 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.
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
message. Throw an exception if it failed and you want to use the generic
message. In case of cancellation, either return false or
throw a
SystemOperationCancelledException .
Overridable by subclasses, and usually is.
-
-
Specified by:
-
doDelete
in interface
ISystemViewElementAdapter
-
-
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
public boolean doDeleteBatch(
Shell shell,
List resourceSet,
IProgressMonitor monitor)
throws
Exception
- Perform the delete on the given set of items.
See
ISystemViewElementAdapter.doDelete(Shell, Object, IProgressMonitor) for semantics of
error handling and cancellation.
By default just calls the doDelete method for each item in the
resourceSet. Override if you wish to perform some sort of optimization
for the batch delete. Return true if this was successful. Return false if
ANY delete operation failed and a message was issued. Throw an exception
if ANY failed and you want to use the generic message.
In case of cancellation, either return false or throw a
SystemOperationCancelledException .
Overridable by subclasses, and usually is.
-
-
Specified by:
-
doDeleteBatch
in interface
ISystemViewElementAdapter
-
-
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
public 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.
Overridable by subclasses, but usually is 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, IProgressMonitor)
canRename
public boolean canRename(
Object element)
- Return true if this object is renameable by the user. If so, when
selected, the Rename popup menu item will be enabled.
Overridable by subclasses, and usually is.
By default, returns false. Override if your object can be renamed.
-
-
Specified by:
-
canRename
in interface
ISystemViewElementAdapter
-
-
Returns:
- true if this object is renameable by the user
-
See Also:
-
showRename(Object) ,
doRename(Shell,Object,String,IProgressMonitor) ,
getNameValidator(Object) ,
getCanonicalNewName(Object,String) ,
namesAreEqual(Object,String)
doRename
public boolean doRename(
Shell shell,
Object element,
String name,
IProgressMonitor monitor)
throws
Exception
- Perform the rename action. By default does nothing.
Overridable by subclasses, and usually is.
Override if your object can be renamed. Return true if this was
successful. Return false if it failed and you issued a message. Throw an
exception if it failed and you want to use the generic message.
-
-
Specified by:
-
doRename
in interface
ISystemViewElementAdapter
-
-
Returns:
- true if the rename was successful
-
Throws:
-
Exception
-
Since:
- 3.0
-
See Also:
-
showRename(Object) ,
canRename(Object)
getNameValidator
public
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 in the common rename
dialog!!
Used in the common rename dialogs, and only if you return true to
canRename(Object) .
Overridable by subclasses, and usually is if canRename is.
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)
- 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.
Overridable by subclasses, and usually is if canRename is.
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)
- 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) .
Overridable by subclasses, but usually is not.
By default does an equalsIgnoreCase comparison
-
-
Specified by:
-
namesAreEqual
in interface
ISystemViewElementAdapter
-
-
See Also:
-
canRename(Object)
showRefresh
public boolean showRefresh(
Object element)
- 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.
Overridable by subclasses, and usually is.
Default is true.
-
-
Specified by:
-
showRefresh
in interface
ISystemViewElementAdapter
-
showProperties
public boolean showProperties(
Object element)
- Return true if we should show the properties action in the popup for the
given element. Note the actual work to show the properties dialog is
handled for you.
Overridable by subclasses, and usually is.
Default is true.
-
-
Specified by:
-
showProperties
in interface
ISystemViewElementAdapter
-
showOpenViewActions
public boolean showOpenViewActions(
Object element)
- 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.
Overridable by subclasses, and usually is NOT.
Only applicable for non-remote resources. Remote always show Go To
only.
-
-
Specified by:
-
showOpenViewActions
in interface
ISystemViewElementAdapter
-
showGenericShowInTableAction
public boolean showGenericShowInTableAction(
Object element)
- Return true if we should show the generic show in table action in the
popup for the given element.
Overridable by subclasses, and usually is NOT.
-
-
Specified by:
-
showGenericShowInTableAction
in interface
ISystemViewElementAdapter
-
canDrag
public boolean canDrag(
Object element)
- Return true if this object can be copied to another location.
Overridable by subclasses, and is only if drag and drop
supported.
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)
canDrag
public boolean canDrag(
SystemRemoteResourceSet elements)
- Return true if this object can be copied to another location.
Overridable by subclasses, and is only if drag and drop
supported.
By default, we return false. Extenders may decide whether or not certain
objects can be dragged with this method. Return true if these objects can
be copied to another location via drag and drop, or clipboard copy.
-
-
Specified by:
-
canDrag
in interface
ISystemDragDropAdapter
-
doDrag
public
Object doDrag(
Object element,
boolean sameSystemType,
IProgressMonitor monitor)
- Perform the drag on the given object.
Overridable by subclasses, and is only if drag and drop
supported.
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)
- Return true if another object can be copied into this object.
Overridable by subclasses, and is only if drag and drop
supported.
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)
doDrag
public
ISystemResourceSet doDrag(
SystemRemoteResourceSet set,
IProgressMonitor monitor)
- Perform the drag on the given objects.
Overridable by subclasses, and is only if drag and drop
supported.
This default implementation simply iterates through the set. For optimal
performance, this should be overridden.
-
-
Specified by:
-
doDrag
in interface
ISystemDragDropAdapter
-
-
Parameters:
-
set - the set of objects to copy -
monitor - the progress monitor
-
Returns:
- the set of objects as a result of the drag
doDrop
public
ISystemResourceSet doDrop(
ISystemResourceSet fromSet,
Object to,
boolean sameSystemType,
boolean sameSystem,
int srcType,
IProgressMonitor monitor)
- Perform drop from the "fromSet" of objects to the "to" object.
Overridable by subclasses, and is only if drag and drop
supported.
-
-
Specified by:
-
doDrop
in interface
ISystemDragDropAdapter
-
-
Parameters:
-
fromSet - the source objects 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 objects to be dropped -
monitor - the progress monitor
-
Returns:
- the set of new objects created from the drop
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)
- Perform drop from the "from" object to the "to" object.
Overridable by subclasses, and is only if drag and drop
supported.
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
- Perform drop from the "from" object to the "to" object.
Overridable by subclasses, and is only if drag and drop
supported.
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.
-
-
-
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)
- Return true if it is valid for the src object to be dropped in the
target.
Overridable by subclasses, and usually is only if drag and drop
supported.
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)
validateDrop
public boolean validateDrop(
ISystemResourceSet set,
Object target,
boolean sameSystem)
-
Description copied from interface:
ISystemDragDropAdapter
- Return true if it is valid for the src objects to be dropped in the target
-
-
Specified by:
-
validateDrop
in interface
ISystemDragDropAdapter
-
-
Parameters:
-
set - set of resources to drop on the target -
target - the object which src is dropped in -
sameSystem - whether this is the same system
-
Returns:
- whether this is a valid operation
getMementoHandle
public
String getMementoHandle(
Object element)
- Return what to save to disk to identify this element in the persisted
list of expanded elements.
Overridable by subclasses, but usually is not.
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)
- Return what to save to disk to identify this element when it is the input
object to a secondary Remote System Explorer perspective.
Overridable by subclasses, but usually is not.
Defaults to getMementoHandle(element).
-
-
Specified by:
-
getInputMementoHandle
in interface
ISystemViewElementAdapter
-
getMementoHandleKey
public
String getMementoHandleKey(
Object element)
- Return a short string to uniquely identify the type of resource. Eg
"conn" for connection.
Overridable by subclasses, but usually is not.
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)
- Sometimes 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.
Overridable by subclasses, but usually is not.
-
-
Specified by:
-
saveExpansionState
in interface
ISystemViewElementAdapter
-
isPromptable
public 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.
Overridable by subclasses, but usually is not.
Default is false unless element implements ISystemPromptable object.
Override as appropriate.
-
-
Specified by:
-
isPromptable
in interface
ISystemViewElementAdapter
-
isRemote
public boolean isRemote(
Object element)
- Return true if this object is remote. In this case, the default is true.
Overridable by subclasses, but usually is not.
-
-
Specified by:
-
isRemote
in interface
ISystemViewElementAdapter
-
-
Parameters:
-
element - the object to check
-
Returns:
- true if the object is remote
selectionChanged
public void selectionChanged(
Object element)
- 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.
Overridable by subclasses, but usually is not.
-
-
Specified by:
-
selectionChanged
in interface
ISystemViewElementAdapter
-
-
Parameters:
-
element - - first selected object
testAttribute
public boolean testAttribute(
Object target,
String name,
String value)
- From IActionFilter so the popupMenus extension point can use <filter>, <enablement>
or <visibility>. The support is for the following:
- name="value". The given value must match getName(target) exactly, or if ends with asterisk must match the beginning.
- name="type". The given value must match getType(target) exactly. Be careful, as this is usually translated.
- 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.
- 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.
- 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.
- 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.
- name="subsystemConfigurationId". 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.
- name="subsystemConfigurationCategory". 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.
Overridable by subclasses, typically if additional properties are supported.
If desired, override, and call super(), to support additional filter criteria for <filter>, <enablement> and <visibility>.
-
-
Specified by:
-
testAttribute
in interface
IActionFilter
-
-
See Also:
-
IActionFilter.testAttribute(Object, String, String)
getRemoteSubSubType
public
String getRemoteSubSubType(
Object element)
- From
(Object) . Pre-supplied for convenience for subclasses that want to
implement this interface for remote object adapters.
Overridable by subclasses, but usually is not.
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)
- From
(Object) . Pre-supplied for convenience for subclasses that want to
implement this interface for remote object adapters.
Overridable by subclasses, but usually is not.
Returns null. Override if the remote resource is compilable.
-
-
getEditableRemoteObject
public
ISystemEditableRemoteObject getEditableRemoteObject(
Object object)
- Return the remote edit wrapper for this object.
Overridable by subclasses, and must be for editable
objects.
-
-
-
Parameters:
-
object - the object to edit
-
Returns:
- the editor wrapper for this object
canEdit
public boolean canEdit(
Object object)
- Indicates whether the specified object can be edited or not.
Overridable by subclasses, and must be for editable
objects.
-
-
-
Parameters:
-
object - the object to edit
-
Returns:
- true if the object can be edited. Returns false by default.
getSystemViewElementAdapter
protected
ISystemViewElementAdapter getSystemViewElementAdapter(
Object o)
-
Deprecated. use SystemAdapterHelpers.getViewAdapter(o, getViewer())
instead
- Returns the implementation of ISystemViewElement for the given object.
Returns null if the adapter is not defined or the object is not
adaptable.
Callable by subclasses.
Just a convenient shortcut to
SystemAdapterHelpers.getViewAdapter(Object, Viewer) Should we allow clients to override this in order to
provide an optimized implementation for their models? But it's being
called by subclasses only anyways...
-
-
getRemoteAdapter
protected
ISystemRemoteElementAdapter getRemoteAdapter(
Object o)
-
Deprecated. use SystemAdapterHelpers.getRemoteAdapter(o, getViewer())
instead
- Returns the implementation of ISystemRemoteElement for the given object.
Returns null if this object does not adaptable to this.
Callable by subclasses.
Just a convenient shortcut to
SystemAdapterHelpers.getRemoteAdapter(Object, Viewer) Should we allow clients to override this in order to
provide an optimized implementation for their models? But it's being
called by subclasses only anyways...
-
-
sub
public static
String sub(
String msg,
String subOld,
String subNew)
-
Deprecated. Clients should use Eclipse
NLS
or Java
MessageFormat
or
String.replaceAll(String, String)
to do
substring replacement and variable substitution.
- Substitute all occurrences of a given String with another String.
Callable by subclasses. This method does message variable
substitution. Using you are replacing &1 (say) with a string.
-
-
-
Parameters:
-
msg - message containing substitution variable. Eg "Connect failed
with return code &1" -
subOld - substitution variable. Eg "%1" -
subNew - substitution data. Eg "001"
-
Returns:
- message with all occurrences of variable substituted with data.
getSystemTree
protected
ISystemTree getSystemTree()
- 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.
Callable by subclasses. Do not override.
-
-
getTranslatedYes
public
String getTranslatedYes()
- Return "Yes" translated. Callable by subclasses. Do not override
-
-
getTranslatedNo
protected
String getTranslatedNo()
- Return "No" translated. Callable by subclasses. Do not override.
-
-
getTranslatedTrue
protected
String getTranslatedTrue()
- Return "True" translated. Callable by subclasses. Do not override.
-
-
getTranslatedFalse
protected
String getTranslatedFalse()
- Return "False" translated. Callable by subclasses. Do not
override.
-
-
getTranslatedNotApplicable
protected
String getTranslatedNotApplicable()
- Return "Not applicable" translated. Callable by subclasses. Do not
override.
-
-
getTranslatedNotAvailable
protected
String getTranslatedNotAvailable()
- Return "Not available" translated. Callable by subclasses. Do not
override.
-
-
initMsgObjects
protected final void initMsgObjects()
-
Deprecated. Internal use. Do not call this method.
- Initialize Message Objects. Internal use. Do not call or override.
-
-
checkForEmptyList
protected
Object[] checkForEmptyList(
Object[] children,
Object parent,
boolean returnNullMsg)
- In getChildren, return checkForEmptyList(children, parent,
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.
Callable by subclasses. Do not override.
-
-
-
Parameters:
-
children - The list of children. -
parent - The parent for the children. -
returnNullMsg - true if an "Empty List" message should
be returned.
-
Returns:
- The list of children, a list with the "Empty List" message object
or an empty list.
checkForNull
protected
Object[] checkForNull(
Object[] children,
boolean returnNullMsg)
-
Deprecated. Use
checkForEmptyList(Object[], Object, boolean)
instead.
- In getChildren, return checkForNull(children, true/false)
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.
Callable by subclasses. Do not override.
-
-
getCancelledMessageObject
protected final
Object[] getCancelledMessageObject()
- Return the "Operation cancelled by user" message as an object array so
can be used to answer getChildren().
Callable by subclasses. Do not override.
-
-
getFailedMessageObject
protected final
Object[] getFailedMessageObject()
- Return the "Operation failed" message as an object array so can be used
to answer getChildren().
Callable by subclasses. Do not override.
-
-
getEmptyMessageObject
protected final
Object[] getEmptyMessageObject()
-
Deprecated. Use
checkForEmptyList(Object[], Object, boolean)
instead.
- Return the "Empty list" message as an object array so can be used to
answer getChildren().
Callable by subclasses. Do not override.
-
-
getFirstSelection
protected
Object getFirstSelection(
IStructuredSelection selection)
- Get the first selected object of the given selection.
Callable by subclasses. Do not override.
-
-
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(
ISubSystem subSys)
-
Description copied from interface:
ISystemViewElementAdapter
- 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.
-
-
Specified by:
-
supportsDeferredQueries
in interface
ISystemViewElementAdapter
-
-
Parameters:
-
subSys - subsystem to use for deferred queries.
-
Returns:
-
true if it supports deferred queries, false otherwise.
fetchDeferredChildren
public void fetchDeferredChildren(
Object o,
IElementCollector collector,
IProgressMonitor monitor)
-
-
Specified by:
-
fetchDeferredChildren
in interface
IDeferredWorkbenchAdapter
-
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()
-
-
Specified by:
-
isContainer
in interface
IDeferredWorkbenchAdapter
-
getRule
public
ISchedulingRule getRule(
Object element)
-
-
Specified by:
-
getRule
in interface
IDeferredWorkbenchAdapter
-
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.
|
|
|