Carbide.c++

com.nokia.carbide.templatewizard.processes
Class CopyFiles

java.lang.Object
  extended by com.nokia.carbide.templatewizard.process.AbstractProcess
      extended by com.nokia.carbide.templatewizard.process.AbstractProjectProcess
          extended by com.nokia.carbide.templatewizard.processes.CopyFiles
All Implemented Interfaces:
IProcess
Direct Known Subclasses:
CopyFilesAndFormatAsCpp, CopyFileTree

public class CopyFiles
extends AbstractProjectProcess

Process used in templates to files in a project.

See the documentation for Creating Wizard Templates.


Field Summary
protected  java.net.URL baseSourceUrl
           
protected static java.lang.String FILE_PARAMETER
           
protected static java.lang.String LOWER_SUFFIX
           
protected static java.lang.String OVERWRITE_ATTRIBUTE
           
protected  IProject project
           
protected static java.lang.String SOURCE_PATH_ATTRIBUTE
           
protected static java.lang.String SUBSTITUTE_ATTRIBUTE
           
protected static java.lang.String TARGET_PATH_ATTRIBUTE
           
protected  java.util.Map templateValues
           
protected static java.lang.String TITLE_SUFFIX
           
protected static java.lang.String TITLELOWER_SUFFIX
           
protected static java.lang.String UPPER_SUFFIX
           
 
Fields inherited from class com.nokia.carbide.templatewizard.process.AbstractProjectProcess
projectParameter
 
Constructor Summary
CopyFiles()
           
 
Method Summary
protected  void copyFile(java.net.URL sourceFileUrl, IFile targetFile, boolean substitute, IProgressMonitor monitor)
          Copy a file from the given source URL to the given workspace file.
protected  Plugin getPlugin()
          Must be implemented by subclasses to provide the Plugin needed to construct a CoreException.
protected  void init(ITemplate template, java.util.List<IParameter> parameters)
          Must be implemented by subclasses.
 java.lang.String postProcessContent(java.lang.String input)
           
 void process(ITemplate template, java.util.List<IParameter> parameters, IProgressMonitor monitor)
          The main method called to execute this process.
 
Methods inherited from class com.nokia.carbide.templatewizard.process.AbstractProjectProcess
getProjectName
 
Methods inherited from class com.nokia.carbide.templatewizard.process.AbstractProcess
fail, fail, failIfFalse, failIfNull, findParameterByName, getProcessName, getRequiredAttributeFromParameter, getRequiredParameterByName, mustRunInUIThread, setRunInUIThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UPPER_SUFFIX

protected static final java.lang.String UPPER_SUFFIX
See Also:
Constant Field Values

LOWER_SUFFIX

protected static final java.lang.String LOWER_SUFFIX
See Also:
Constant Field Values

TITLE_SUFFIX

protected static final java.lang.String TITLE_SUFFIX
See Also:
Constant Field Values

TITLELOWER_SUFFIX

protected static final java.lang.String TITLELOWER_SUFFIX
See Also:
Constant Field Values

SOURCE_PATH_ATTRIBUTE

protected static final java.lang.String SOURCE_PATH_ATTRIBUTE
See Also:
Constant Field Values

TARGET_PATH_ATTRIBUTE

protected static final java.lang.String TARGET_PATH_ATTRIBUTE
See Also:
Constant Field Values

SUBSTITUTE_ATTRIBUTE

protected static final java.lang.String SUBSTITUTE_ATTRIBUTE
See Also:
Constant Field Values

OVERWRITE_ATTRIBUTE

protected static final java.lang.String OVERWRITE_ATTRIBUTE
Since:
1.4
See Also:
Constant Field Values

FILE_PARAMETER

protected static final java.lang.String FILE_PARAMETER
See Also:
Constant Field Values

project

protected IProject project

baseSourceUrl

protected java.net.URL baseSourceUrl

templateValues

protected java.util.Map templateValues
Constructor Detail

CopyFiles

public CopyFiles()
Method Detail

process

public void process(ITemplate template,
                    java.util.List<IParameter> parameters,
                    IProgressMonitor monitor)
             throws CoreException
Description copied from interface: IProcess
The main method called to execute this process.

Specified by:
process in interface IProcess
Overrides:
process in class AbstractProcess
Parameters:
template - the ITemplate for this process
parameters - a list of IParameter
monitor - the IProgressMonitor
Throws:
CoreException - if the process fails

init

protected void init(ITemplate template,
                    java.util.List<IParameter> parameters)
             throws CoreException
Description copied from class: AbstractProcess
Must be implemented by subclasses.
Called by IProcess.process(ITemplate, List, IProgressMonitor) to separate initialization from processing code.

Overrides:
init in class AbstractProjectProcess
Parameters:
template - the ITemplate argument to process
parameters - the parameter list argument to process
Throws:
CoreException
See Also:
com.nokia.carbide.templatewizard.process.IProcess#process(com.nokia.carbide.template.engine.ITemplate, java.util.List, org.eclipse.core.runtime.IProgressMonitor)

copyFile

protected void copyFile(java.net.URL sourceFileUrl,
                        IFile targetFile,
                        boolean substitute,
                        IProgressMonitor monitor)
                 throws CoreException
Copy a file from the given source URL to the given workspace file. This overwrites the target without complaint.

Parameters:
sourceFileUrl - URL for source (file, jar, etc)
targetFile - target file, need not exist
substitute - if true, apply variable substitution to contents
monitor - progress monitor
Throws:
CoreException - if file copying fails

postProcessContent

public java.lang.String postProcessContent(java.lang.String input)
Parameters:
input - the content of the file after all replacements made
Returns:
the input after any post-processing

getPlugin

protected Plugin getPlugin()
Description copied from class: AbstractProcess
Must be implemented by subclasses to provide the Plugin needed to construct a CoreException.

Specified by:
getPlugin in class AbstractProcess
Returns:
org.eclipse.core.runtime.Plugin

Carbide.c++