## org.eclipse.emf.cheatsheets.actions
Class CopyFileFromPluginAction

    java.lang.Object
      org.eclipse.core.commands.common.EventManager
          org.eclipse.jface.action.AbstractAction
              org.eclipse.jface.action.Action
                  org.eclipse.emf.cheatsheets.actions.CopyFileFromPluginAction

All Implemented Interfaces:
  IAction, ICheatSheetAction

    public class CopyFileFromPluginAction

extends Action
implements ICheatSheetAction

Action that copies a file from plugin to project.

Since:
  2.2.0

Field Summary
`protected java.lang.String` `javaPackageName`
`protected java.lang.String` `projectName`
`protected IWorkspaceRoot` `root`
`protected java.lang.String` `sourceFile`

Fields inherited from interface org.eclipse.jface.action.IAction
`AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT`

Constructor Summary
`CopyFileFromPluginAction()`

Method Summary
`protected IFile` `copyFileToProject(IProject project, java.lang.String javaPackageName, java.lang.String sourceFile, IProgressMonitor monitor)` Copy a file from plugin to project
`protected void` `copyFileToWorkspaceFolder(java.lang.String sourceFile)`
`protected IPath` `getFolderPath(IProject project, java.lang.String javaPackageName, IProgressMonitor monitor)` Get folder path derived from Java package name
`protected IProject` `getProject(java.lang.String projectName, boolean isJavaProject, IProgressMonitor monitor)` Get the project from workspace
`protected boolean` `isNullString(java.lang.String value)`
`void` `run()` Run the action
`void` `run(java.lang.String[] params, ICheatSheetManager manager)` Execution of the action
`protected void` `runWithProgress(IRunnableWithProgress runnable)` Run with progress

Methods inherited from class org.eclipse.jface.action.Action

`convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText`

Methods inherited from class org.eclipse.jface.action.AbstractAction
`addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener`

Methods inherited from class org.eclipse.core.commands.common.EventManager
`addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.jface.action.IAction
`addPropertyChangeListener, removePropertyChangeListener`

Field Detail

### projectName

    protected java.lang.String projectName

### javaPackageName

    protected java.lang.String javaPackageName

### sourceFile

    protected java.lang.String sourceFile

### root

    protected IWorkspaceRoot root

Constructor Detail

### CopyFileFromPluginAction

    public CopyFileFromPluginAction()

Method Detail

### run

    public void run(java.lang.String[] params,
                    ICheatSheetManager manager)

  Execution of the action

  Specified by:
    `run` in interface `ICheatSheetAction`
  Parameters:
    `params` - Array of parameters - index 0: projectName, index 1: javaPackageName, index 2: sourceFile
    `manager` - Cheatsheet Manager

### run

    public void run()

  Run the action

  Specified by:
    `run` in interface `IAction`
  Overrides:
    `run` in class `Action`

### runWithProgress

    protected void runWithProgress(IRunnableWithProgress runnable)
                            throws java.lang.reflect.InvocationTargetException,
                                   java.lang.InterruptedException

  Run with progress

  Parameters:
    `runnable` -
  Throws:
    `java.lang.reflect.InvocationTargetException`
    `java.lang.InterruptedException`

### getProject

    protected IProject getProject(java.lang.String projectName,
                                  boolean isJavaProject,
                                  IProgressMonitor monitor)
                           throws CoreException

  Get the project from workspace

  Parameters:
    `projectName` - Name of project
    `isJavaProject` - Boolean if the project is a Java project
    `monitor` - Monitoring the action
  Returns:
    Project with projectName
  Throws:
    `CoreException`

### copyFileToProject

    protected IFile copyFileToProject(IProject project,
                                      java.lang.String javaPackageName,
                                      java.lang.String sourceFile,
                                      IProgressMonitor monitor)
                               throws CoreException

  Copy a file from plugin to project

  Parameters:
    `project` - Target Project
    `javaPackageName` - Java package name
    `sourceFile` - Source file name - plugin id + folders + file
    `monitor` - Monitoring the action
  Returns:
    Target file
  Throws:
    `CoreException`

### copyFileToWorkspaceFolder

    protected void copyFileToWorkspaceFolder(java.lang.String sourceFile)
                                      throws CoreException

  Throws:
    `CoreException`

### getFolderPath

    protected IPath getFolderPath(IProject project,
                                  java.lang.String javaPackageName,
                                  IProgressMonitor monitor)
                           throws CoreException

  Get folder path derived from Java package name

  Parameters:
    `project` - Target project
    `javaPackageName` - Java package name
    `monitor` - Monitor the action
  Returns:
    Path of the folder
  Throws:
    `CoreException`

### isNullString

    protected boolean isNullString(java.lang.String value)

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.