Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Carbide.c++
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.nokia.carbide.templatewizard.process
Class AbstractProcess

    java.lang.Object
      com.nokia.carbide.templatewizard.process.AbstractProcess

All Implemented Interfaces:
  IProcess

Direct Known Subclasses:
  AbstractProjectProcess, CreateTemplateVariable

    public abstract class AbstractProcess

extends java.lang.Object
implements IProcess

An abstract base class to enable implementing `com.nokia.carbide.templatewizard.process.IProcess` Includes methods for initialization, failure handling and accessing parameters.

Constructor Summary
`AbstractProcess()`

Method Summary
`protected void` | `fail(java.lang.String message)` Called by subclasses to encapsulate throwing a CoreException from `IProcess.process(ITemplate, List, IProgressMonitor)`
`protected void` | `fail(java.lang.String message, java.lang.Throwable t)` Called by subclasses to encapsulate throwing a CoreException from `IProcess.process(ITemplate, List, IProgressMonitor)`
`protected void` | `failIfFalse(boolean condition, java.lang.String message)` Called by subclasses to encapsulate throwing a CoreException from `IProcess.process(ITemplate, List, IProgressMonitor)`
`protected void` | `failIfNull(java.lang.Object object, java.lang.String message)` Called by subclasses to encapsulate throwing a CoreException from `IProcess.process(ITemplate, List, IProgressMonitor)`
`protected IParameter` | `findParameterByName(java.lang.String parameterName, java.util.List<IParameter> parameters)` Encapsulates getting a singleton `IParameter` that may or may not exist, returning `null` if none is found.
`protected abstract Plugin` | `getPlugin()` Must be implemented by subclasses to provide the `Plugin` needed to construct a `CoreException`.
`protected java.lang.String` | `getProcessName()` The class attribute of the <process> element.
`protected java.lang.String` | `getRequiredAttributeFromParameter(IParameter parameter, java.lang.String attributeName)` Encapsulates getting a required attribute from an `IParameter` by name, or throwing a `CoreException`, if none is found.
`protected IParameter` | `getRequiredParameterByName(java.lang.String parameterName, java.util.List<IParameter> parameters)` Encapsulates getting a singleton `IParameter` that is required to exist, or throwing a `CoreException`, if none is found.
`protected abstract void` | `init(ITemplate template, java.util.List<IParameter> parameters)` Must be implemented by subclasses.
`boolean` | `mustRunInUIThread()` This method is called before executing this process, to determine whether it should be executed in the UI thread.
`void` | `process(ITemplate template, java.util.List<IParameter> parameters, IProgressMonitor monitor)` The main method called to execute this process.
`void` | `setRunInUIThread(boolean runInUIThread)` Can be called in constructor to set the return value of `IProcess.mustRunInUIThread()`

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

Constructor Detail

### AbstractProcess

    public AbstractProcess()

Method Detail

### getProcessName

    protected java.lang.String getProcessName()

  The class attribute of the <process> element.

  Returns:
    `java.lang.String`

### getPlugin

    protected abstract Plugin getPlugin()

  Must be implemented by subclasses to provide the `Plugin` needed to construct a `CoreException`.

  Returns:
    `org.eclipse.core.runtime.Plugin`

### fail

    protected void fail(java.lang.String message,
                        java.lang.Throwable t)
                 throws CoreException

  Called by subclasses to encapsulate throwing a CoreException from `IProcess.process(ITemplate, List, IProgressMonitor)`

  Parameters:
    `message` - the String message of the exception
    `t` - a Throwable
  Throws:
    `CoreException`

### fail

    protected void fail(java.lang.String message)
                 throws CoreException

  Called by subclasses to encapsulate throwing a CoreException from `IProcess.process(ITemplate, List, IProgressMonitor)`

  Parameters:
    `message` - the String message of the exception
  Throws:
    `CoreException`

### failIfFalse

    protected void failIfFalse(boolean condition,
                               java.lang.String message)
                        throws CoreException

  Called by subclasses to encapsulate throwing a CoreException from `IProcess.process(ITemplate, List, IProgressMonitor)`

  Parameters:
    `condition` - throws CoreException if false
    `message` - the String message of the exception
  Throws:
    `CoreException`

### failIfNull

    protected void failIfNull(java.lang.Object object,
                              java.lang.String message)
                       throws CoreException

  Called by subclasses to encapsulate throwing a CoreException from `IProcess.process(ITemplate, List, IProgressMonitor)`

  Parameters:
    `object` - throws CoreException if null
    `message` - the String message of the exception
  Throws:
    `CoreException`

### init

    protected abstract void init(ITemplate template,
                                 java.util.List<IParameter> parameters)
                          throws CoreException

  Must be implemented by subclasses.
  Called by `IProcess.process(ITemplate, List, IProgressMonitor)` to separate initialization from processing code.

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

### 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`
  Parameters:
    `template` - the `ITemplate` for this process
    `parameters` - a list of `IParameter`
    `monitor` - the `IProgressMonitor`
  Throws:
    `CoreException` - if the process fails

### mustRunInUIThread

    public boolean mustRunInUIThread()

  Description copied from interface: `IProcess`
  This method is called before executing this process, to determine whether it should be executed in the UI thread.

  Specified by:
    `mustRunInUIThread` in interface `IProcess`
  Returns:
    `true` to ensure this process is executed in the UI thread.
  See Also:
    `org.eclipse.swt.widgets.Display#syncExec(Runnable)`

### setRunInUIThread

    public void setRunInUIThread(boolean runInUIThread)

  Can be called in constructor to set the return value of `IProcess.mustRunInUIThread()`

  Parameters:
    `runInUIThread` - the return value of `IProcess.mustRunInUIThread()`

### findParameterByName

    protected IParameter findParameterByName(java.lang.String parameterName,
                                             java.util.List<IParameter> parameters)
                                      throws CoreException

  Encapsulates getting a singleton `IParameter` that may or may not exist,
  returning `null` if none is found.
  Returns the first `IParameter` found by name. Optional parameters can be accessed via the parameters list.

  Parameters:
    `parameterName` - the name of the parameter
    `parameters` - the list of parameters
  Returns:
    the first IParameter with name parameterName or `null`
  Throws:
    `CoreException`

### getRequiredParameterByName

    protected IParameter getRequiredParameterByName(java.lang.String parameterName,
                                                    java.util.List<IParameter> parameters)
                                             throws CoreException

  Encapsulates getting a singleton `IParameter` that is required to exist,
  or throwing a `CoreException`, if none is found.
  Returns the first `IParameter` found by name. Optional parameters can be accessed via the parameters list.

  Parameters:
    `parameterName` - the name of the parameter
    `parameters` - the list of parameters
  Returns:
    the first IParameter with name parameterName
  Throws:
    `CoreException` - if parameter is not found

### getRequiredAttributeFromParameter

    protected java.lang.String getRequiredAttributeFromParameter(IParameter parameter,
                                                                 java.lang.String attributeName)
                                                          throws CoreException

  Encapsulates getting a required attribute from an `IParameter` by name,
  or throwing a `CoreException`, if none is found.
  Optional attributes can be accessed via `IParameter.getAttributeValue(String)`

  Parameters:
    `parameter` - the IParameter
    `attributeName` - the attribute name
  Returns:
    the String attribute from parameter with attributeName
  Throws:
    `CoreException` - if attribute is not found

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Carbide.c++
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD