## com.ibm.lab.soln.resources
Class ActionProcessResourceTree

    java.lang.Object
      |
      +--com.ibm.lab.soln.resources.ActionResourceAction
            |
            +--com.ibm.lab.soln.resources.ActionProcessResourceTree

All Implemented Interfaces:
  org.eclipse.ui.IActionDelegate, org.eclipse.ui.IObjectActionDelegate, org.eclipse.ui.IViewActionDelegate, org.eclipse.core.resources.IWorkspaceRunnable

public class ActionProcessResourceTree
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:

- ProjectDetails request - lists data for all projects.
- ProjectStructure request - creates a folder/file structure and adds a BOOKMARK marker to the file.
- ProjectStructure request as runnable - the basic structure limits the number of events triggered by performing the workspace updates as part of an `IWorkspaceRunnable`.

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`

Fields inherited from class com.ibm.lab.soln.resources.ActionResourceAction
`selection`

Constructor Summary
`ActionProcessResourceTree()` ActionProcessResourceTree default constructor.

Method Summary
`void` | `addMarker(org.eclipse.core.resources.IResource resource)` Add marker to identified resource.
`org.eclipse.core.resources.IFile` | `copyBasics(org.eclipse.core.resources.IFolder folder)` Creates a file in the passed folder using content copied from a standard file found in the plug-in's install directory.
`boolean` | `createFolder(org.eclipse.core.resources.IFolder newFolder)` Creates a folder if it does not exist, returns true if a folder was created.
`void` | `createFolderFile(org.eclipse.core.resources.IProject project)` Resource processing logic to add resources to a given project one step at a time.
`java.lang.String` | `fileStatus(org.eclipse.core.resources.IFile txtFile, boolean txtFileAdded)` Returns string that describes if the file was created or already existed.
`java.lang.String` | `folderStatus(org.eclipse.core.resources.IFolder imageFolder, boolean imageFolderAdded)` Returns string that describes if the folder was created or already existed.
`java.io.InputStream` | `getInitialContents()` Return input stream used to create initial file contents.
`void` | `init(org.eclipse.ui.IViewPart view)` Not used in this action - implemented per `IViewActionDelegate` interface.
`void` | `pathPlay()` Produces a list of path values based on the selected resource.
`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` | `showProjectDetails()` Finds all projects in the workspace and produces a short list of project details (such as path location).

Methods inherited from class com.ibm.lab.soln.resources.ActionResourceAction
`resultError, resultInformation, resultQuestion, 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

### ActionProcessResourceTree

    public ActionProcessResourceTree()

  ActionProcessResourceTree default constructor.

Method Detail

### addMarker

    public void addMarker(org.eclipse.core.resources.IResource resource)

  Add marker to identified resource. Bookmark marker is added using predefined `CHAR_START`, `CHAR_END`, and `MESSAGE` values.

### copyBasics

    public org.eclipse.core.resources.IFile copyBasics(org.eclipse.core.resources.IFolder folder)

  Creates a file in the passed folder using content copied from a standard file found in the plug-in's install directory.
  Parameters:
    `folder` - - folder where standard image file should be created

### createFolder

    public 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

### createFolderFile

    public void createFolderFile(org.eclipse.core.resources.IProject project)

  Resource processing logic to add resources to a given project one step at a time. Steps are:
  - 1. Get folder named images.
  - 1.a If folder does not exist, create it.
  - 1.b If folder exists, move on.

  - 2. Get a file named image_list.txt in the new folder.
  - 2.a If file does not exist, create the file with predefined content.
  - 2.b If file exists, add a marker to the file.

  - 3. Get a file named getstart_b.GIF in the new folder.
  - 3.a If file does not exist, create the file from a file in the plugin install directory.
  - 3.b If file exists, move on.

  - 4. Get folder named images.
  - 4.a If folder does not exist, create it.
  - 4.b If folder exists, move on.

  - 5. Report results.

### fileStatus

    public java.lang.String fileStatus(org.eclipse.core.resources.IFile txtFile,
                                       boolean txtFileAdded)

  Returns string that describes if the file was created or already existed.
  Parameters:
    `txtFile` -
    `txtFileAdded` -
  Returns:
    String

### folderStatus

    public java.lang.String folderStatus(org.eclipse.core.resources.IFolder imageFolder,
                                         boolean imageFolderAdded)

  Returns string that describes if the folder was created or already existed.
  Parameters:
    `imageFolder` -
    `imageFolderAdded` -
  Returns:
    String

### getInitialContents

    public java.io.InputStream getInitialContents()

  Return 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)`

### pathPlay

    public void pathPlay()

  Produces a list of path values based on the selected resource.

### 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` - 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`
  See Also:
    `IWorkspaceRunnable.run(IProgressMonitor)`

### showProjectDetails

    public void showProjectDetails()

  Finds all projects in the workspace and produces a short list of project details (such as path location).