com.ibm.jdg2e.resources.programming.interact
Class StructureProjectAction

java.lang.Object
  extended bycom.ibm.jdg2e.resources.programming.interact.ActionResourceAction
      extended bycom.ibm.jdg2e.resources.programming.interact.StructureProjectAction
All Implemented Interfaces:
org.eclipse.ui.IActionDelegate, org.eclipse.ui.IObjectActionDelegate, org.eclipse.ui.IViewActionDelegate, org.eclipse.core.resources.IWorkspaceRunnable

public class StructureProjectAction
extends ActionResourceAction
implements org.eclipse.ui.IViewActionDelegate, org.eclipse.core.resources.IWorkspaceRunnable

Multi-headed action where the processing depends on invocation point as determined by the UI action that triggered the request. Processing paths include:

Demonstrates the workspace get of a handle and existence checking with respect to the workspace and event management using a workspace runnable.

See Also:
IFile, IFolder, IProject, IMarker, IResource, IWorkspaceRoot, IWorkspaceRunnable

Field Summary
 
Fields inherited from class com.ibm.jdg2e.resources.programming.interact.ActionResourceAction
selection, traceEnabled
 
Constructor Summary
StructureProjectAction()
          ActionProcessResourceTree default constructor.
 
Method Summary
(package private)  void addMarkers(org.eclipse.core.resources.IResource resource)
          Add markers to identified resource.
(package private)  void createDirectly()
          Creates project structure; no event management.
(package private)  boolean createFolder(org.eclipse.core.resources.IFolder newFolder)
          Creates a folder if it does not exist, returns true if a folder was created.
(package private)  void createUsingRunnable()
          Creates project structure using an IWorkspaceRunnable.
(package private)  void createUsingRunnableAndRule()
           
(package private)  java.lang.String fileStatus(java.lang.String fileName, boolean fileAdded)
           
(package private)  java.lang.String folderStatus(java.lang.String folderName, boolean folderAdded)
          Returns string that describes if the folder was created or already existed.
(package private)  java.io.InputStream getInitialContents()
           
 void init(org.eclipse.ui.IViewPart view)
          Not used in this action - implemented per IViewActionDelegate interface.
(package private)  void reportResults()
          Create result message and show results.
 void run(org.eclipse.jface.action.IAction action)
          Uses saved reference to selected project to call custom logic that processes the resource tree.
 void run(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void structureProject(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.jobs.Job job)
          Create resources required to structure project.
 
Methods inherited from class com.ibm.jdg2e.resources.programming.interact.ActionResourceAction
resultError, resultInformation, selectionChanged, setActivePart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IActionDelegate
selectionChanged
 

Constructor Detail

StructureProjectAction

public StructureProjectAction()
ActionProcessResourceTree default constructor.

Method Detail

addMarkers

void addMarkers(org.eclipse.core.resources.IResource resource)
Add markers to identified resource. Markers are added using predefined CHAR_START,CHAR_END, and MESSAGE values.

Parameters:
resource -

createDirectly

void createDirectly()
Creates project structure; no event management.


createFolder

boolean createFolder(org.eclipse.core.resources.IFolder newFolder)
Creates a folder if it does not exist, returns true if a folder was created.

Parameters:
newFolder -
Returns:
boolean

createUsingRunnable

void createUsingRunnable()
Creates project structure using an IWorkspaceRunnable. The interface is implemented by ActionProcessResource so a reference to this is passed.


createUsingRunnableAndRule

void createUsingRunnableAndRule()

fileStatus

java.lang.String fileStatus(java.lang.String fileName,
                            boolean fileAdded)
Parameters:
fileName -
fileAdded -
Returns:
String that describes if the file was created or already existed.

folderStatus

java.lang.String folderStatus(java.lang.String folderName,
                              boolean folderAdded)
Returns string that describes if the folder was created or already existed.

Parameters:
folderName -
folderAdded -
Returns:
String message about result

getInitialContents

java.io.InputStream getInitialContents()
Returns:
input stream used to create initial file contents.

init

public void init(org.eclipse.ui.IViewPart view)
Not used in this action - implemented per IViewActionDelegate interface.

Specified by:
init in interface org.eclipse.ui.IViewActionDelegate
See Also:
IViewActionDelegate.init(IViewPart)

reportResults

void reportResults()
Create result message and show results.


run

public void run(org.eclipse.jface.action.IAction action)
Uses saved reference to selected project to call custom logic that processes the resource tree. Multiple plugin.xml defined actions map to this implementation. The current action is detected and the appropriate logic is triggered based on the plugin.xml defined action id.

Specified by:
run in interface org.eclipse.ui.IActionDelegate
Parameters:
action - proxy that handles the presentation portion of the plugin action
See Also:
IActionDelegate.run(IAction)

run

public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
         throws org.eclipse.core.runtime.CoreException
Specified by:
run in interface org.eclipse.core.resources.IWorkspaceRunnable
Throws:
org.eclipse.core.runtime.CoreException
See Also:
IWorkspaceRunnable.run(IProgressMonitor)

structureProject

public void structureProject(org.eclipse.core.resources.IProject project,
                             org.eclipse.core.runtime.IProgressMonitor monitor,
                             org.eclipse.core.runtime.jobs.Job job)
Create resources required to structure project.

Parameters:
project -
monitor -
job -