com.ibm.carma.ui.action
Class CarmaObjectActionDelegate

java.lang.Object
  extended by org.eclipse.ui.actions.ActionDelegate
      extended by com.ibm.carma.ui.action.CarmaObjectActionDelegate
All Implemented Interfaces:
org.eclipse.ui.IActionDelegate, org.eclipse.ui.IActionDelegate2, org.eclipse.ui.IObjectActionDelegate, org.eclipse.ui.IViewActionDelegate
Direct Known Subclasses:
CarmaCustomActionMenuDelegate, CheckinDelegate, CheckoutDelegate, CreateObjectActionDelegate, DownloadDelegate, ExtractDelegate, LockDelegate, UnlockDelegate, UpdateViewDelegate, UploadDelegate

public abstract class CarmaObjectActionDelegate
extends org.eclipse.ui.actions.ActionDelegate
implements org.eclipse.ui.IObjectActionDelegate, org.eclipse.ui.IViewActionDelegate

This abstract class can be extended by clients hoping to implement an IObjectActionDelegate to act against CARMAResources or IResources which map to CARMAResources, and had that association stored through ResourceUtils.


Nested Class Summary
static interface CarmaObjectActionDelegate.CarmaAction
          Indicates the Carma action which the IObjectActionDelegate references.
 
Field Summary
static java.lang.String COPYRIGHT
           
 
Method Summary
 java.util.Collection<CARMAResource> getBasicSelectedCarmaResources()
          Same as getSelectedCarmaResources() except that it does not catch and handle with a dialog NotSynchronizedExceptions, but instead hands them back to the caller
 java.util.List<ICARMAResourceReference> getSelectedCarmaReferences()
          The convience method loops through the selected items.
 java.util.Collection<CARMAResource> getSelectedCarmaResources()
          The convience method loops through the selected items.
 org.eclipse.jface.viewers.ISelection getSelection()
          Returns the currently selected item
 org.eclipse.swt.widgets.Shell getShell()
           
 org.eclipse.ui.IWorkbenchPart getTargetPart()
           
 void init(org.eclipse.ui.IViewPart view)
           
 boolean isUnsupported(CARMAResource resource, java.lang.String actionId)
          This method will check the correct preferences and return whether or not to display the specified action for the selected items.
 boolean isUnsupported(java.lang.String actionId)
          This method will check the correct preferences and return whether or not to display the specified action for the selected items.
 void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection)
           
 void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart)
           
 
Methods inherited from class org.eclipse.ui.actions.ActionDelegate
dispose, init, run, runWithEvent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IActionDelegate
run
 
Methods inherited from interface org.eclipse.ui.IActionDelegate
run
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Method Detail

setActivePart

public void setActivePart(org.eclipse.jface.action.IAction action,
                          org.eclipse.ui.IWorkbenchPart targetPart)
Specified by:
setActivePart in interface org.eclipse.ui.IObjectActionDelegate

isUnsupported

public boolean isUnsupported(java.lang.String actionId)
This method will check the correct preferences and return whether or not to display the specified action for the selected items. If a selected item is an IResource, we will attempt to find the associated CARMAResource, if we cannot (due to NotSynchronizedExceptions or other reasons) false will be returned.

Parameters:
actionId - the actionId to check for the supported-ness of.
Returns:
whether or not to disable the displaying of the item (this checks the preferences settings)

isUnsupported

public boolean isUnsupported(CARMAResource resource,
                             java.lang.String actionId)
This method will check the correct preferences and return whether or not to display the specified action for the selected items. If we cannot (due to NotSynchronizedExceptions or other reasons) false will be returned.

Parameters:
resource - the resource to check for support of the action Id
actionId - the actionId to check for the supported-ness of.
Returns:
whether or not to disable the displaying of the item (this checks the preferences settings)

init

public void init(org.eclipse.ui.IViewPart view)
Specified by:
init in interface org.eclipse.ui.IViewActionDelegate

selectionChanged

public void selectionChanged(org.eclipse.jface.action.IAction action,
                             org.eclipse.jface.viewers.ISelection selection)
Specified by:
selectionChanged in interface org.eclipse.ui.IActionDelegate
Overrides:
selectionChanged in class org.eclipse.ui.actions.ActionDelegate

getSelection

public org.eclipse.jface.viewers.ISelection getSelection()
Returns the currently selected item

Returns:
ISelection currently selected item

getShell

public org.eclipse.swt.widgets.Shell getShell()
Returns:
shell the current Shell object.

getTargetPart

public org.eclipse.ui.IWorkbenchPart getTargetPart()

getBasicSelectedCarmaResources

public java.util.Collection<CARMAResource> getBasicSelectedCarmaResources()
                                                                   throws NotSynchronizedException
Same as getSelectedCarmaResources() except that it does not catch and handle with a dialog NotSynchronizedExceptions, but instead hands them back to the caller

Returns:
Collection the selected items translated into CARMAResources if necessary or null if the user was prompted and decided to cancel
Throws:
NotSynchronizedException - If we cannot translate an the selection object(s) into an associated CARMAResource due to the model being unsynchronized.

getSelectedCarmaResources

public java.util.Collection<CARMAResource> getSelectedCarmaResources()
The convience method loops through the selected items. The method uses the ResourceUtils framework to associate the selected objects with CARMAResources and add the associated CARMAResources to the returned Collection.

Care should be used when calling this method, as it will open dialogs and be time consuming if the model is not synchronized.

Returns:
Collection the selected items translated into CARMAResources if necessary or null if the user was prompted and decided to cancel

getSelectedCarmaReferences

public java.util.List<ICARMAResourceReference> getSelectedCarmaReferences()
The convience method loops through the selected items. The method uses the ResourceUtils framework to associate the selected objects with ICARMAResourceReferences and add the associated references to the returned Collection.

Care should be used when calling this method, as it will open dialogs and be time consuming if the model is not synchronized.

Returns:
Collection the selected items translated into CARMAResources if necessary or null if the user was prompted and decided to cancel