|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jet.transform.TransformContextExtender
public final class TransformContextExtender
Extender to the JET2Context for supporting JET2 Transforms
Constructor Summary | |
---|---|
TransformContextExtender(JET2Context context)
Deprecated. Since 0.9.0 use getInstance(JET2Context) . |
Method Summary | |
---|---|
void |
addListener(TransformContextListener listener)
Add a listener to the merge context events (commit, logStatistics, getSummary) |
void |
checkCanceled()
Check whether the transformation has been canceled and throw a OperationCanceledException
if so. |
void |
cleanup()
|
void |
commit(org.eclipse.core.runtime.IProgressMonitor monitor)
Commit changes. |
void |
execute(java.lang.String templatePath,
boolean useSuper,
JET2Writer writer)
Execute the named template, writing all template output to the passed writer. |
void |
execute(java.lang.String templatePath,
JET2Writer writer)
Execute the named template, writing all template output to the passed writer. |
java.net.URL |
getBaseURL(java.lang.String urlContext)
Return the base URL to use given an urlContext constant. |
IJETBundleDescriptor |
getBundleDescriptor()
Return the bundle descriptor of the JET transform bundle. |
java.lang.String |
getId()
|
static TransformContextExtender |
getInstance(JET2Context context)
Return the TransformContextExtender for the passed context. |
JET2TemplateLoader |
getLoader()
|
java.lang.Object |
getShellContext()
Return the current shell context or null if none is set |
java.lang.String |
getTemplatePath()
Return the path of the current executing template |
boolean |
isCanceled()
Test whether the transformation has been canceled. |
static java.lang.Object |
loadModel(java.net.URL modelURL,
java.lang.String modelLoaderID,
java.lang.String fileType)
Load a model, given an URL to a model, and optionally the model loader and the file type of the model. |
static java.lang.Object |
loadModelFromString(java.lang.String modelContent,
java.lang.String modelLoaderID,
java.lang.String fileType)
Load a model from a string form. |
void |
removeListener(TransformContextListener listener)
Remove a listener of merge context events. |
void |
runSubTransform(java.lang.String id)
Invoke another JET transformation |
void |
runSubTransform(java.lang.String id,
BodyContentWriter writer)
Invoke another JET transformation, recording the main template results in the specified writer |
void |
setBundleDescriptor(IJETBundleDescriptor descriptor)
Set the description of the transform bundle. |
void |
setLoader(JET2TemplateLoader loader)
Set the template loader |
void |
setOverride(java.lang.String id,
org.eclipse.core.runtime.IProgressMonitor monitor)
|
void |
setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
Provide a progress monitor for template execution. |
void |
setShellContext(java.lang.Object shellContext)
Set the org.eclipse.swt.widgets.Shell in which any dialogs
should be open. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TransformContextExtender(JET2Context context)
getInstance(JET2Context)
.
context
- the context.Method Detail |
---|
public java.lang.String getId()
public java.lang.String getTemplatePath()
public void execute(java.lang.String templatePath, JET2Writer writer) throws JET2TagException
templatePath
- the project relative path of the template to loadwriter
- the writer to which the template output will be written
JET2TagException
- if an execution error occursexecute(String, boolean, JET2Writer)
public void checkCanceled()
OperationCanceledException
if so.
public boolean isCanceled()
true
if the transformation has been canceled, false
otherwisepublic void setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
OperationCanceledException
.
Note that clients typically do not need to call this method as it is initialized from
JET2Platform.runTransform(String, JET2Context, IProgressMonitor)
and its variants.
monitor
- a progress monitor
java.lang.IllegalStateException
- if a progress monitor has already been installedexecute(String, JET2Writer)
,
execute(String, boolean, JET2Writer)
,
checkCanceled()
,
isCanceled()
public void execute(java.lang.String templatePath, boolean useSuper, JET2Writer writer) throws JET2TagException
templatePath
- the project relative path of the template to loaduseSuper
- if true, attempt to load the template from override transformation, if it existswriter
- the writer to which the template output will be written
JET2TagException
- if an execution error occurs or the template cannot be foundsetProgressMonitor(IProgressMonitor)
public JET2TemplateLoader getLoader()
public void setLoader(JET2TemplateLoader loader)
loader
- public void addListener(TransformContextListener listener)
listener
- public void removeListener(TransformContextListener listener)
listener
- addListener(TransformContextListener)
public void commit(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- a progress monitorpublic final java.lang.Object getShellContext()
null
if none is set
getShellContext()
public final void setShellContext(java.lang.Object shellContext)
org.eclipse.swt.widgets.Shell
in which any dialogs
should be open. If null
is passed, or if this method is
not called, then no dialogs will be displayed, and the transformation
will make suitable choices in lieu of displaying a dialog.
An Object
is passed to avoid dependencies on the SWT plugins. This method is used
primarily to support the use of IWorkspace.validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
although the shell context may be used by other task, too.
shellContext
- The shellContext to set, which must be null
or an instance of org.eclipse.swt.widgets.Shell.public void setBundleDescriptor(IJETBundleDescriptor descriptor)
descriptor
- the bundle descriptor.
java.lang.IllegalStateException
- if the bundle descriptor has already been set.public IJETBundleDescriptor getBundleDescriptor()
public java.net.URL getBaseURL(java.lang.String urlContext) throws JET2TagException
"transform"
- relative to the currently executing transform"workspace"
- relative to the current eclipse workspacenull
- equivalent to "transform"
urlContext
- one of "transform", "workspace" or null
JET2TagException
public static TransformContextExtender getInstance(JET2Context context)
context
- a JET context
public static java.lang.Object loadModel(java.net.URL modelURL, java.lang.String modelLoaderID, java.lang.String fileType) throws java.io.IOException, CoreJETException
modelURL
- the URL of the model to loadmodelLoaderID
- the model loader id, or null
if the model loader is to be determined
from the file type.fileType
- the file type to use in selecting the model loader, or null
if the file type
is to be extracted from the model URL (by finding a file extension).
java.io.IOException
- if the model could not be read.
CoreJETException
- if an appropriate model loader could not be found.public static java.lang.Object loadModelFromString(java.lang.String modelContent, java.lang.String modelLoaderID, java.lang.String fileType) throws CoreJETException, java.io.IOException
modelContent
- the model content, in its string form.modelLoaderID
- the model loader id, or null
if the loader is to be calculated from
the file type.fileType
- the type of the file to load, or null
if the type is irrelevant to the loader.
CoreJETException
- if an appropriate model loader could not be found.
java.io.IOException
- if the model could not be read.public void setOverride(java.lang.String id, org.eclipse.core.runtime.IProgressMonitor monitor) throws JET2TagException
JET2TagException
public void cleanup()
public void runSubTransform(java.lang.String id) throws JET2TagException
id
- the JET transformation ID
JET2TagException
- if an execution error occurspublic void runSubTransform(java.lang.String id, BodyContentWriter writer) throws JET2TagException
id
- the JET transformation IDwriter
- a template writer
JET2TagException
- if an execution error occurs
|
Copyright 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |