Java Doc for WorkspaceAction.java in  » IDE-Eclipse » ui-ide » org » eclipse » ui » actions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » ui ide » org.eclipse.ui.actions 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.eclipse.ui.actions.SelectionListenerAction
   org.eclipse.ui.actions.WorkspaceAction

All known Subclasses:   org.eclipse.ui.actions.RefreshAction,  org.eclipse.ui.actions.OpenResourceAction,  org.eclipse.ui.actions.CloseResourceAction,  org.eclipse.ui.actions.ScrubLocalAction,  org.eclipse.ui.actions.RenameResourceAction,  org.eclipse.ui.actions.BuildAction,
WorkspaceAction
abstract public class WorkspaceAction extends SelectionListenerAction (Code)
The abstract superclass for actions which invoke commands implemented in org.eclipse.core.* on a set of selected resources. It iterates over all selected resources; errors are collected and displayed to the user via a problems dialog at the end of the operation. User requests to cancel the operation are passed along to the core.

Subclasses must implement the following methods:

  • invokeOperation - to perform the operation on one of the selected resources
  • getOperationMessage - to furnish a title for the progress dialog

Subclasses may override the following methods:

  • shouldPerformResourcePruning - reimplement to turn off
  • updateSelection - extend to refine enablement criteria
  • getProblemsTitle - reimplement to furnish a title for the problems dialog
  • getProblemsMessage - reimplement to furnish a message for the problems dialog
  • run - extend to




Constructor Summary
protected  WorkspaceAction(Shell shell, String text)
     Creates a new action with the given text.

Method Summary
protected  IRunnableWithProgresscreateOperation(IStatus[] errorStatus)
     Returns the operation to perform when this action runs.
 voiddisplayError(String message)
     Opens an error dialog to display the given message.
final  IStatusexecute(List resources, IProgressMonitor monitor)
     Runs invokeOperation on each of the selected resources, reporting progress and fielding cancel requests from the given progress monitor.

Note that if an action is running in the background, the same action instance can be executed multiple times concurrently.

protected  ListgetActionResources()
     Returns the elements that the action is to be performed on.
abstract protected  StringgetOperationMessage()
     Returns the string to display for this action's operation.
protected  StringgetProblemsMessage()
     Returns the string to display for this action's problems dialog.

The WorkspaceAction implementation of this method returns a vague message (localized counterpart of something like "The following problems occurred.").

protected  StringgetProblemsTitle()
     Returns the title for this action's problems dialog.

The WorkspaceAction implementation of this method returns a generic title (localized counterpart of "Problems").

 ShellgetShell()
     Returns the shell for this action.
abstract protected  voidinvokeOperation(IResource resource, IProgressMonitor monitor)
     Performs this action's operation on each of the selected resources, reporting progress to, and fielding cancel requests from, the given progress monitor.
 booleanisDescendent(List resources, IResource child)
     Returns whether the given resource is a descendent of any of the resources in the given list.
 ListpruneResources(List resourceCollection)
     Performs pruning on the given list of resources, as described in shouldPerformResourcePruning.
 MultiStatusrecordError(MultiStatus errors, CoreException error)
     Records the core exception to be displayed to the user once the action is finished.
public  voidrun()
     The CoreWrapperAction implementation of this IAction method uses a ProgressMonitorDialog to run the operation.
public  voidrunInBackground(ISchedulingRule rule)
     Run the action in the background rather than with the progress dialog.
public  voidrunInBackground(ISchedulingRule rule, Object jobFamily)
     Run the action in the background rather than with the progress dialog.
public  voidrunInBackground(ISchedulingRule rule, Object[] jobFamilies)
     Run the action in the background rather than with the progress dialog.
protected  booleanshouldPerformResourcePruning()
     Returns whether this action should attempt to optimize the resources being operated on.
protected  booleanupdateSelection(IStructuredSelection selection)
     The WorkspaceAction implementation of this SelectionListenerAction method ensures that this action is disabled if any of the selected resources are inaccessible.


Constructor Detail
WorkspaceAction
protected WorkspaceAction(Shell shell, String text)(Code)
Creates a new action with the given text.
Parameters:
  shell - the shell (for the modal progress dialog and error messages)
Parameters:
  text - the string used as the text for the action, ornull if there is no text




Method Detail
createOperation
protected IRunnableWithProgress createOperation(IStatus[] errorStatus)(Code)
Returns the operation to perform when this action runs. The returned operation must be an IRunnableWithProgress that will perform the action's work. The default implementation returns an operation that will iterate over the selected resources and call WorkspaceAction.invokeOperation(IResource,IProgressMonitor) for each resource. Subclasses must either implement WorkspaceAction.invokeOperation(IResource,IProgressMonitor) or override this method to provide a different operation. Subclasses typically override this method when an undoable operation is to be provided.
Parameters:
  errorStatus - an array of error status objects to which the result ofrunning the operation should be added. the operation to perform when this action runs.
since:
   3.3



displayError
void displayError(String message)(Code)
Opens an error dialog to display the given message.

Note that this method must be called from UI thread.


Parameters:
  message - the message



execute
final IStatus execute(List resources, IProgressMonitor monitor)(Code)
Runs invokeOperation on each of the selected resources, reporting progress and fielding cancel requests from the given progress monitor.

Note that if an action is running in the background, the same action instance can be executed multiple times concurrently. This method must not access or modify any mutable state on action class.
Parameters:
  monitor - a progress monitor The result of the execution




getActionResources
protected List getActionResources()(Code)
Returns the elements that the action is to be performed on. By default return the selected resources.

Subclasses may override this method. list of resource elements (element type: IResource)




getOperationMessage
abstract protected String getOperationMessage()(Code)
Returns the string to display for this action's operation.

Note that this hook method is invoked in a non-UI thread.

Subclasses must implement this method.

the message
since:
   3.1



getProblemsMessage
protected String getProblemsMessage()(Code)
Returns the string to display for this action's problems dialog.

The WorkspaceAction implementation of this method returns a vague message (localized counterpart of something like "The following problems occurred."). Subclasses may reimplement to provide something more suited to the particular action.

the problems message
since:
   3.1



getProblemsTitle
protected String getProblemsTitle()(Code)
Returns the title for this action's problems dialog.

The WorkspaceAction implementation of this method returns a generic title (localized counterpart of "Problems"). Subclasses may reimplement to provide something more suited to the particular action.

the problems dialog title
since:
   3.1



getShell
Shell getShell()(Code)
Returns the shell for this action. This shell is used for the modal progress and error dialogs. the shell



invokeOperation
abstract protected void invokeOperation(IResource resource, IProgressMonitor monitor) throws CoreException(Code)
Performs this action's operation on each of the selected resources, reporting progress to, and fielding cancel requests from, the given progress monitor.

Note that this method is invoked in a non-UI thread.

Subclasses must implement this method.

WorkspaceAction.createOperation(IStatus[])
Parameters:
  resource - one of the selected resources
Parameters:
  monitor - a progress monitor
exception:
  CoreException - if the operation fails
since:
   3.1




isDescendent
boolean isDescendent(List resources, IResource child)(Code)
Returns whether the given resource is a descendent of any of the resources in the given list.
Parameters:
  resources - the list of resources (element type: IResource)
Parameters:
  child - the resource to check true if child is a descendent ofany of the elements of resources



pruneResources
List pruneResources(List resourceCollection)(Code)
Performs pruning on the given list of resources, as described in shouldPerformResourcePruning.
Parameters:
  resourceCollection - the list of resources (element type: IResource) the list of resources (element type: IResource)after pruning.
See Also:   WorkspaceAction.shouldPerformResourcePruning



recordError
MultiStatus recordError(MultiStatus errors, CoreException error)(Code)
Records the core exception to be displayed to the user once the action is finished.
Parameters:
  error - a CoreException



run
public void run()(Code)
The CoreWrapperAction implementation of this IAction method uses a ProgressMonitorDialog to run the operation. The operation calls execute (which, in turn, calls invokeOperation). Afterwards, any CoreExceptions encountered while running the operation are reported to the user via a problems dialog.

Subclasses may extend this method.




runInBackground
public void runInBackground(ISchedulingRule rule)(Code)
Run the action in the background rather than with the progress dialog.
Parameters:
  rule - The rule to apply to the background job or nullif there isn't one.



runInBackground
public void runInBackground(ISchedulingRule rule, Object jobFamily)(Code)
Run the action in the background rather than with the progress dialog.
Parameters:
  rule - The rule to apply to the background job or nullif there isn't one.
Parameters:
  jobFamily - a single family that the job should belong to ornull if none.
since:
   3.1



runInBackground
public void runInBackground(ISchedulingRule rule, Object[] jobFamilies)(Code)
Run the action in the background rather than with the progress dialog.
Parameters:
  rule - The rule to apply to the background job or nullif there isn't one.
Parameters:
  jobFamilies - the families the job should belong to or nullif none.
since:
   3.1



shouldPerformResourcePruning
protected boolean shouldPerformResourcePruning()(Code)
Returns whether this action should attempt to optimize the resources being operated on. This kind of pruning makes sense when the operation has depth infinity semantics (when the operation is applied explicitly to a resource then it is also applied implicitly to all the resource's descendents).

The WorkspaceAction implementation of this method returns true. Subclasses should reimplement to return false if pruning is not required.

true if pruning should be performed, andfalse if pruning is not desired
since:
   3.1



updateSelection
protected boolean updateSelection(IStructuredSelection selection)(Code)
The WorkspaceAction implementation of this SelectionListenerAction method ensures that this action is disabled if any of the selected resources are inaccessible. Subclasses may extend to react to selection changes; however, if the super method returns false, the overriding method should also return false.



Methods inherited from org.eclipse.ui.actions.SelectionListenerAction
protected void clearCache()(Code)(Java Doc)
protected List getSelectedNonResources()(Code)(Java Doc)
protected List getSelectedResources()(Code)(Java Doc)
protected boolean resourceIsType(IResource resource, int resourceMask)(Code)(Java Doc)
protected boolean selectionIsOfType(int resourceMask)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.