|
RSE Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.rse.ui.view.AbstractSystemViewAdapter
public abstract class AbstractSystemViewAdapter
Base class for adapters needed for the SystemView viewer. It implements the ISystemViewElementAdapter interface.
AbstractSystemRemoteAdapterFactory
Field Summary | |
---|---|
protected Object[] |
_lastResults
A variable that can be used in getChildren to cache last returned results, if desired |
protected Object |
_lastSelected
A variable that can be used to cache last selection, if desired |
protected SystemMessageObject |
cancelledObject
Deprecated. Use getCancelledMessageObject() instead. |
protected static String[] |
EMPTY_STRING_LIST
A handy constant of "new String[0]" |
protected Object[] |
emptyList
Deprecated. Do not use directly. Use checkForEmptyList(Object[],
Object, boolean) when needed. |
protected SystemMessageObject |
errorObject
Deprecated. Use getFailedMessageObject() instead. |
static String |
MEMENTO_DELIM
Delimiter for each object's key in a memento, used to persist tree view expansion state: "///" |
protected static String |
MSG_SUB_PREFIX
Deprecated. use Eclipse NLS or Java Messageformat for String substitution. |
protected static String |
MSG_SUB1
Deprecated. use Eclipse NLS or Java Messageformat for String substitution. |
protected static String |
MSG_SUB2
Deprecated. use Eclipse NLS or Java Messageformat for String substitution. |
protected Object[] |
msgList
Deprecated. Do not use directly. Use getCancelledMessageObject()
or getFailedMessageObject() or checkForEmptyList(Object[], Object, boolean) when needed. |
protected SystemMessageObject |
nullObject
Deprecated. Use checkForEmptyList(Object[], Object, boolean)
instead. |
protected Object |
propertySourceInput
Current input provider. |
protected Shell |
shell
Deprecated. Use getShell() and setShell(Shell) |
protected Viewer |
viewer
Deprecated. use getViewer() and setViewer(Viewer) |
Fields inherited from interface org.eclipse.rse.ui.view.ISystemViewElementAdapter |
---|
noActions |
Constructor Summary | |
---|---|
AbstractSystemViewAdapter()
|
Method Summary | |
---|---|
abstract void |
addActions(SystemMenuManager menu,
IStructuredSelection selection,
Shell parent,
String menuGroup)
This is your opportunity to add actions to the popup menu for the given selection. |
void |
addCommonRemoteActions(SystemMenuManager menu,
IStructuredSelection selection,
Shell shell,
String menuGroup)
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 |
Methods inherited from interface org.eclipse.rse.ui.view.ISystemViewElementAdapter |
---|
getText |
Methods inherited from interface org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier |
---|
getAbsoluteName |
Field Detail |
---|
protected Viewer viewer
getViewer()
and setViewer(Viewer)
protected Object propertySourceInput
protected Shell shell
getShell()
and setShell(Shell)
protected Object[] emptyList
checkForEmptyList(Object[],
Object, boolean)
when needed.
protected Object[] msgList
getCancelledMessageObject()
or getFailedMessageObject()
or checkForEmptyList(Object[], Object, boolean)
when needed.
protected SystemMessageObject nullObject
checkForEmptyList(Object[], Object, boolean)
instead.
protected SystemMessageObject cancelledObject
getCancelledMessageObject()
instead.
protected SystemMessageObject errorObject
getFailedMessageObject()
instead.
protected static final String MSG_SUB_PREFIX
protected static final String MSG_SUB1
protected static final String MSG_SUB2
public static final String MEMENTO_DELIM
protected static final String[] EMPTY_STRING_LIST
protected Object[] _lastResults
protected Object _lastSelected
Constructor Detail |
---|
public AbstractSystemViewAdapter()
Method Detail |
---|
public final void setViewer(Viewer viewer)
Configuration method. Typically called by content provider, viewer or action. Do not override.
setViewer
in interface ISystemViewElementAdapter
public final void setShell(Shell shell)
Configuration method. Typically called by content provider, viewer or action. Do not override.
setShell
in interface ISystemViewElementAdapter
public final void setInput(ISystemViewInputProvider input)
Configuration method. Typically called by content provider, viewer or action. Do not override.
setInput
in interface ISystemViewElementAdapter
public Shell getShell()
Getter method. Callable by subclasses. Do not override.
getShell
in interface ISystemViewElementAdapter
public Viewer getViewer()
Getter method. Callable by subclasses. Do not override.
getViewer
in interface ISystemViewElementAdapter
protected ISystemTree getCurrentTreeView()
Getter method. Callable by subclasses. Do not override.
public ISystemViewInputProvider getInput()
Getter method. Callable by subclasses. Do not override.
getInput
in interface ISystemViewElementAdapter
public ISubSystem getSubSystem(Object element)
AbstractResource
, it
calls getSubSystem on it, else returns null.
Overridable by subclasses. You should override if not using
AbstractResource.
getSubSystem
in interface ISystemDragDropAdapter
getSubSystem
in interface ISystemViewElementAdapter
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.public void addCommonRemoteActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
Called by SystemView viewer. No need to override or call.
menu
- The menu to contribute actions toselection
- 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.public void addDynamicPopupMenuActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
menu
- The menu to contribute actions toselection
- 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.public abstract void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup)
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:
SystemBaseAction
. For a simple action doesn't present any UI.
SystemBaseDialogAction
. For an action that presents a dialog
.
SystemBaseWizardAction
. For an action that presents a wizard
.
SystemBaseSubMenuAction
. For an action that cascades into a submenu
with other actions.
addActions
in interface ISystemViewElementAdapter
menu
- the popup menu you can contribute toselection
- the current selection in the calling tree or table viewparent
- the shell of the calling tree or table viewmenuGroup
- the default menu group to place actions into if you
don't care where they. Pass this to the SystemMenuManager add
method.ISystemViewElementAdapter.addActions(
SystemMenuManager, IStructuredSelection, Shell, String)
public abstract ImageDescriptor getImageDescriptor(Object element)
IWorkbenchAdapter.getImageDescriptor(Object)
. Abstract. Must be overridden by subclasses.
getImageDescriptor
in interface ISystemViewElementAdapter
getImageDescriptor
in interface IWorkbenchAdapter
element
- The element for which an image is desiredpublic String getAlternateText(Object element)
getAlternateText
in interface ISystemViewElementAdapter
getName(Object)
,
IRemoteObjectIdentifier.getAbsoluteName(Object)
public String getName(Object element)
Called by common rename and delete actions, and used to populate property sheet.
Overridable by subclasses, but rarely needs to be.
getName
in interface ISystemViewElementAdapter
ISystemViewElementAdapter.getText(Object)
,
IRemoteObjectIdentifier.getAbsoluteName(Object)
public String getLabel(Object element)
Internal use. Can be safely ignored.
getLabel
in interface IWorkbenchAdapter
public abstract String getType(Object element)
Abstract. Must be overridden by subclasses.
getType
in interface ISystemViewElementAdapter
public String getStatusLineText(Object element)
getType(): getName()
Overridable by subclasses, but rarely needs to be.
getStatusLineText
in interface ISystemViewElementAdapter
public boolean exists(Object element)
exists
in interface ISystemViewElementAdapter
element
- the element to check
public abstract Object getParent(Object element)
getParent
in interface ISystemViewElementAdapter
getParent
in interface IWorkbenchAdapter
public abstract boolean hasChildren(IAdaptable element)
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.
hasChildren
in interface ISystemViewElementAdapter
element
- the element to check
true
if this element can have children.public boolean hasChildren(IContextObject element)
hasChildren
in interface ISystemViewElementAdapter
element
- the context object
ISystemViewElementAdapter.hasChildren(IAdaptable)
public final Object[] getChildren(Object object)
getChildren
in interface IWorkbenchAdapter
public abstract Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
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.
getChildren
in interface ISystemViewElementAdapter
element
- the model object to get children frommonitor
- the progress monitor
public Object[] getChildren(IContextObject element, IProgressMonitor monitor)
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.
getChildren
in interface ISystemViewElementAdapter
element
- the context object that wrappers a model object, it's
subsystem and filter referencemonitor
- the progress monitor
public Object[] getChildrenUsingExpandToFilter(Object element, String expandToFilter)
Overridable by subclasses, but rarely needs to be.
getChildrenUsingExpandToFilter
in interface ISystemViewElementAdapter
protected static IPropertyDescriptor[] getDefaultDescriptors()
protected static PropertyDescriptor createSimplePropertyDescriptor(String propertyKey, String label, String description)
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).public Object getEditableValue()
getEditableValue
in interface IPropertySource
public IPropertyDescriptor[] getPropertyDescriptors()
Implemented. Do not override typically. See internalGetPropertyDescriptors()
.
getPropertyDescriptors
in interface IPropertySource
internalGetPropertyDescriptors()
protected abstract IPropertyDescriptor[] internalGetPropertyDescriptors()
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:
createSimplePropertyDescriptor(String, String, String)
public IPropertyDescriptor[] getUniquePropertyDescriptors()
If internalGetPropertyDescriptors() returns non-null, then returns that,
else computes the difference. This is called by the table views like
SystemTableView
.
getUniquePropertyDescriptors
in interface ISystemViewElementAdapter
public Object getPropertyValue(Object key, boolean formatted)
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.
getPropertyValue
in interface ISystemViewElementAdapter
key
- the name or key of the property as named by its property
descriptorformatted
- indication of whether to return the value in formatted
or raw form
public Object getPropertyValue(Object key)
internalGetPropertyValue(Object)
for subclasses. 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)
.
getPropertyValue
in interface IPropertySource
key
- the name of the property as named by its property descriptor
protected abstract Object internalGetPropertyValue(Object key)
key
- the name of the property as named by its property descriptor
public boolean isPropertySet(Object key)
Overridable by subclasses. Must be overridden only if editable
properties are supported.
RETURNS FALSE BY DEFAULT.
isPropertySet
in interface IPropertySource
true
if the value of the specified property has
changed from its original default value; false
otherwise.public void resetPropertyValue(Object key)
Overridable by subclasses. Must be overridden only if editable
properties are supported.
DOES NOTHING BY DEFAULT.
resetPropertyValue
in interface IPropertySource
key
- the key identifying property to resetpublic void setPropertyValue(Object key, Object value)
Overridable by subclasses. Must be overridden only if editable
properties are supported.
DOES NOTHING BY DEFAULT.
setPropertyValue
in interface IPropertySource
key
- the key identifying property to resetvalue
- the new value for the propertypublic void setPropertySourceInput(Object propertySourceInput)
Called from adapter factories. Do not override.
setPropertySourceInput
in interface ISystemViewElementAdapter
public boolean handleDoubleClick(Object element)
Overridable by subclasses, but usually is not.
handleDoubleClick
in interface ISystemViewElementAdapter
public boolean showDelete(Object element)
Overridable by subclasses, but usually is not.
By default, returns true.
showDelete
in interface ISystemViewElementAdapter
canDelete(Object)
public boolean canDelete(Object element)
Overridable by subclasses, and usually is.
By default, returns false. Override if your object is deletable.
canDelete
in interface ISystemViewElementAdapter
showDelete(Object)
public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
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.
doDelete
in interface ISystemViewElementAdapter
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
.
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.
Exception
- if the deletion failed and the adapter did not show a
message dialog.showDelete(Object)
,
canDelete(Object)
public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor) throws Exception
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.
doDeleteBatch
in interface ISystemViewElementAdapter
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
.
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.
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.public boolean showRename(Object element)
Overridable by subclasses, but usually is not.
By default, returns true.
showRename
in interface ISystemViewElementAdapter
canRename(Object)
,
doRename(Shell,Object,String, IProgressMonitor)
public boolean canRename(Object element)
Overridable by subclasses, and usually is.
By default, returns false. Override if your object can be renamed.
canRename
in interface ISystemViewElementAdapter
showRename(Object)
,
doRename(Shell,Object,String,IProgressMonitor)
,
getNameValidator(Object)
,
getCanonicalNewName(Object,String)
,
namesAreEqual(Object,String)
public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
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.
doRename
in interface ISystemViewElementAdapter
Exception
showRename(Object)
,
canRename(Object)
public ISystemValidator getNameValidator(Object element)
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.
getNameValidator
in interface ISystemViewElementAdapter
canRename(Object)
public String getCanonicalNewName(Object element, String newName)
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.
getCanonicalNewName
in interface ISystemViewElementAdapter
canRename(Object)
public boolean namesAreEqual(Object element, String newName)
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
namesAreEqual
in interface ISystemViewElementAdapter
canRename(Object)
public boolean showRefresh(Object element)
Overridable by subclasses, and usually is.
Default is true.
showRefresh
in interface ISystemViewElementAdapter
public boolean showProperties(Object element)
Overridable by subclasses, and usually is.
Default is true.
showProperties
in interface ISystemViewElementAdapter
public boolean showOpenViewActions(Object element)
Overridable by subclasses, and usually is NOT.
Only applicable for non-remote resources. Remote always show Go To
only.
showOpenViewActions
in interface ISystemViewElementAdapter
public boolean showGenericShowInTableAction(Object element)
Overridable by subclasses, and usually is NOT.
showGenericShowInTableAction
in interface ISystemViewElementAdapter
public boolean canDrag(Object element)
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.
canDrag
in interface ISystemDragDropAdapter
doDrag(Object,boolean,IProgressMonitor)
,
canDrop(Object)
,
doDrop(Object,Object,boolean,boolean,IProgressMonitor)
,
validateDrop(Object,Object,boolean)
public boolean canDrag(SystemRemoteResourceSet elements)
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.
canDrag
in interface ISystemDragDropAdapter
public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
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.
doDrag
in interface ISystemDragDropAdapter
element
- the object to copysameSystemType
- indication of whether the source and target reside on the same type of systemmonitor
- the progress monitor
canDrag(Object)
,
canDrop(Object)
,
doDrop(Object,Object,boolean,boolean,IProgressMonitor)
,
validateDrop(Object,Object,boolean)
public boolean canDrop(Object element)
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.
canDrop
in interface ISystemDragDropAdapter
element
- the target of a drop operation
canDrag(Object)
,
doDrag(Object,boolean,IProgressMonitor)
,
doDrop(Object,Object,boolean,boolean,IProgressMonitor)
,
validateDrop(Object,Object,boolean)
public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor)
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.
doDrag
in interface ISystemDragDropAdapter
set
- the set of objects to copymonitor
- the progress monitor
public ISystemResourceSet doDrop(ISystemResourceSet fromSet, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
Overridable by subclasses, and is only if drag and drop
supported.
doDrop
in interface ISystemDragDropAdapter
fromSet
- the source objects for the dropto
- the target object for the dropsameSystemType
- indication of whether the source and target reside
of the same type of systemsameSystem
- indication of whether the source and target are on the
same systemsrcType
- the type of objects to be droppedmonitor
- the progress monitor
public void setFilterString(String filterString)
setFilterString
in interface ISystemViewElementAdapter
public String getFilterString()
getFilterString
in interface ISystemViewElementAdapter
public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
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.
doDrop
in interface ISystemDragDropAdapter
from
- the source object for the dropto
- the target object for the dropsameSystemType
- indication of whether the source and target reside of the same type of systemsameSystem
- indication of whether the source and target are on the same systemsrcType
- the type of object to be dropped.monitor
- the progress monitor
canDrag(Object)
,
doDrag(Object,boolean,IProgressMonitor)
,
canDrop(Object)
,
validateDrop(Object,Object,boolean)
public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, IProgressMonitor monitor)
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.
canDrag(Object)
,
doDrag(Object,boolean,IProgressMonitor)
,
canDrop(Object)
,
validateDrop(Object,Object,boolean)
public boolean validateDrop(Object src, Object target, boolean sameSystem)
Overridable by subclasses, and usually is only if drag and drop
supported.
We return false by default.
validateDrop
in interface ISystemDragDropAdapter
src
- the object to droptarget
- the object which src is dropped insameSystem
- whether this is the same system or not
canDrag(Object)
,
doDrag(Object,boolean,IProgressMonitor)
,
canDrop(Object)
,
doDrop(Object,Object,boolean,boolean,IProgressMonitor)
public boolean validateDrop(ISystemResourceSet set, Object target, boolean sameSystem)
ISystemDragDropAdapter
validateDrop
in interface ISystemDragDropAdapter
set
- set of resources to drop on the targettarget
- the object which src is dropped insameSystem
- whether this is the same system
public String getMementoHandle(Object element)
Overridable by subclasses, but usually is not.
This just defaults to getName, but if that is not sufficient override it
here.
getMementoHandle
in interface ISystemViewElementAdapter
public String getInputMementoHandle(Object element)
Overridable by subclasses, but usually is not.
Defaults to getMementoHandle(element).
getInputMementoHandle
in interface ISystemViewElementAdapter
public String getMementoHandleKey(Object element)
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.
getMementoHandleKey
in interface ISystemViewElementAdapter
public boolean saveExpansionState(Object element)
Overridable by subclasses, but usually is not.
saveExpansionState
in interface ISystemViewElementAdapter
public boolean isPromptable(Object element)
Overridable by subclasses, but usually is not.
Default is false unless element implements ISystemPromptable object.
Override as appropriate.
isPromptable
in interface ISystemViewElementAdapter
public boolean isRemote(Object element)
Overridable by subclasses, but usually is not.
isRemote
in interface ISystemViewElementAdapter
element
- the object to check
public void selectionChanged(Object element)
Overridable by subclasses, but usually is not.
selectionChanged
in interface ISystemViewElementAdapter
element
- - first selected objectpublic boolean testAttribute(Object target, String name, String value)
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>.
testAttribute
in interface IActionFilter
IActionFilter.testAttribute(Object, String, String)
public String getRemoteSubSubType(Object element)
(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.
public String getRemoteSourceType(Object element)
(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.
public ISystemEditableRemoteObject getEditableRemoteObject(Object object)
Overridable by subclasses, and must be for editable
objects.
object
- the object to edit
public boolean canEdit(Object object)
object
- the object to edit
protected ISystemViewElementAdapter getSystemViewElementAdapter(Object o)
Callable by subclasses.
Just a convenient shortcut to SystemAdapterHelpers.getViewAdapter(Object,
Viewer)
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
Callable by subclasses.
Just a convenient shortcut to SystemAdapterHelpers.getRemoteAdapter(Object,
Viewer)
public static String sub(String msg, String subOld, String subNew)
NLS
or Java MessageFormat
or
String.replaceAll(String, String)
to do
substring replacement and variable substitution.
msg
- message containing substitution variable. Eg "Connect failed
with return code &1"subOld
- substitution variable. Eg "%1"subNew
- substitution data. Eg "001"
protected ISystemTree getSystemTree()
Callable by subclasses. Do not override.
public String getTranslatedYes()
protected String getTranslatedNo()
protected String getTranslatedTrue()
protected String getTranslatedFalse()
protected String getTranslatedNotApplicable()
protected String getTranslatedNotAvailable()
protected final void initMsgObjects()
protected Object[] checkForEmptyList(Object[] children, Object parent, boolean returnNullMsg)
Callable by subclasses. Do not override.
children
- The list of children.parent
- The parent for the children.returnNullMsg
- true
if an "Empty List" message should
be returned.
protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
checkForEmptyList(Object[], Object, boolean)
instead.
Callable by subclasses. Do not override.
protected final Object[] getCancelledMessageObject()
Callable by subclasses. Do not override.
protected final Object[] getFailedMessageObject()
Callable by subclasses. Do not override.
protected final Object[] getEmptyMessageObject()
checkForEmptyList(Object[], Object, boolean)
instead.
Callable by subclasses. Do not override.
protected Object getFirstSelection(IStructuredSelection selection)
Callable by subclasses. Do not override.
public String getFilterStringFor(Object object)
object
- the object to obtain a filter string for
public boolean supportsDeferredQueries(ISubSystem subSys)
ISystemViewElementAdapter
supportsDeferredQueries
in interface ISystemViewElementAdapter
subSys
- subsystem to use for deferred queries.
true
if it supports deferred queries, false
otherwise.public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor)
fetchDeferredChildren
in interface IDeferredWorkbenchAdapter
protected SystemFetchOperation getSystemFetchOperation(Object o, IElementCollector collector)
o
- collector
-
public boolean isContainer()
isContainer
in interface IDeferredWorkbenchAdapter
public ISchedulingRule getRule(Object element)
getRule
in interface IDeferredWorkbenchAdapter
|
RSE Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |