|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jet.AbstractContextExtender
org.eclipse.jet.taglib.workspace.WorkspaceContextExtender
public class WorkspaceContextExtender
An extension to the JET2Context for collecting workspace actions (file writes etc) and performing them at the end of a JET2 transformation.
Field Summary | |
---|---|
static java.lang.String |
VAR_RAW_LOCATION
Name of the context variable referencing the raw location of the resource. |
static java.lang.String |
VAR_RESOURCE_FILE_EXTENSION
Name of the context variable referencing the file extension of the resource. |
static java.lang.String |
VAR_RESOURCE_FILE_NAME
Name of the context variable referencing file name (with extension removed) of the resource. |
static java.lang.String |
VAR_RESOURCE_FULL_PATH
Name of the context variable referencing the full path of the resource. |
static java.lang.String |
VAR_RESOURCE_LOCATION
Name of the context variable referencing the location of the resource. |
static java.lang.String |
VAR_RESOURCE_NAME
Name of the context variable referencing the name of the resource. |
static java.lang.String |
VAR_RESOURCE_PARENT_FULL_PATH
Name of the context variable referencing the full path of the resource's parent. |
static java.lang.String |
VAR_RESOURCE_PARENT_LOCATION
Name of the context variable referencing the location of the resource's parent. |
static java.lang.String |
VAR_RESOURCE_PARENT_NAME
Name of the context variable referencing the name of the resource's parent. |
static java.lang.String |
VAR_RESOURCE_PARENT_PROJECT_RELATIVE_PATH
Name of the context variable referencing the project relative path of the resource's parent. |
static java.lang.String |
VAR_RESOURCE_PARENT_RAW_LOCATION
Name of the context variable referencing the raw location of the resource's parent. |
static java.lang.String |
VAR_RESOURCE_PROJECT_NAME
Name of the context variable referencing the name of the project containing the resource. |
static java.lang.String |
VAR_RESOURCE_PROJECT_RELATIVE_PATH
Name of the context variable referencing the project relative path of the resource. |
static java.lang.String |
VAR_RESOURCE_TYPE
Name of the context variable referencing the type of the resource. |
Constructor Summary | |
---|---|
WorkspaceContextExtender(JET2Context context)
Create a workspace context extender on the passed context. |
Method Summary | |
---|---|
void |
addAction(IWorkspaceAction action)
Add a new action to be executed when the JET2 transform commits. |
void |
addFinalAction(IWorkspaceAction action)
Add a new action to be executed after all actions added view addAction(IWorkspaceAction)
are executed when the JET2 transform commits. |
protected java.lang.Object |
createExtendedData(JET2Context context)
Called by the AbstractContextExtender constructor if the extender's data has not yet been created in the context. |
boolean |
existsContainer()
Test whether the container stack has an entry for resolving relative paths. |
org.eclipse.core.resources.IContainer |
getContainer()
Get the top most container from the default containers stack without doing a pop. |
static WorkspaceContextExtender |
getInstance(JET2Context context)
Return the workspace context extender for the given JET context. |
static void |
loadResourceAsSource(JET2Context context,
org.eclipse.core.resources.IResource resource,
java.lang.String resourceLoaderId,
java.lang.String resourceType)
Load the passed IResource, and set it as the source of the passed JET2Context. |
void |
popContainer()
Remove the top-most container on the default containers stack. |
void |
pushContainer(org.eclipse.core.resources.IContainer container)
Push a default container onto the stack of default containers. |
Methods inherited from class org.eclipse.jet.AbstractContextExtender |
---|
getContext, getExtendedData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VAR_RESOURCE_PARENT_PROJECT_RELATIVE_PATH
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getParent()
,
IResource.getProject()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_PARENT_FULL_PATH
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getParent()
,
IResource.getFullPath()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_PARENT_RAW_LOCATION
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getParent()
,
IResource.getRawLocation()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_PARENT_LOCATION
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getParent()
,
IResource.getLocation()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_PARENT_NAME
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getParent()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_FILE_NAME
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getName()
,
IResource.getFileExtension()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_FILE_EXTENSION
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getFileExtension()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_PROJECT_RELATIVE_PATH
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getProjectRelativePath()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_FULL_PATH
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getFullPath()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_PROJECT_NAME
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getProject()
,
Constant Field Valuespublic static final java.lang.String VAR_RAW_LOCATION
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getRawLocation()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_LOCATION
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getLocation()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_TYPE
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getType()
,
Constant Field Valuespublic static final java.lang.String VAR_RESOURCE_NAME
loadResourceAsSource(JET2Context, IResource, String, String)
,
IResource.getName()
,
Constant Field ValuesConstructor Detail |
---|
public WorkspaceContextExtender(JET2Context context)
context
- a JET2Context. Cannot be null
.Method Detail |
---|
protected java.lang.Object createExtendedData(JET2Context context)
AbstractContextExtender
createExtendedData
in class AbstractContextExtender
context
- the context in which the data will be created.
public void addAction(IWorkspaceAction action)
action
- the action to executepublic void addFinalAction(IWorkspaceAction action)
addAction(IWorkspaceAction)
are executed when the JET2 transform commits. Final actions behave identically to other actions,
except that the occur after all 'normal' actions. In particular, final actions:
action
- the action to executepublic void pushContainer(org.eclipse.core.resources.IContainer container)
container
- public void popContainer() throws JET2TagException
JET2TagException
- if the container stack is empty.public boolean existsContainer()
true
if the container stack is not empty, false
otherwise.public org.eclipse.core.resources.IContainer getContainer() throws JET2TagException
JET2TagException
- if the container stack is empty.public static WorkspaceContextExtender getInstance(JET2Context context)
context
- the JET context.
public static void loadResourceAsSource(JET2Context context, org.eclipse.core.resources.IResource resource, java.lang.String resourceLoaderId, java.lang.String resourceType) throws CoreJETException, java.io.IOException
TransformContextExtender.loadModel(URL, String, String)
and then
sets a number of context variables describing the loaded resource. Finally, the root of the loaded
resource is set as the context source by invoking JET2Context.setSource(Object)
.
The following context variables are set for all resources:
VAR_RESOURCE_NAME
.VAR_RESOURCE_TYPE
.VAR_RESOURCE_LOCATION
.VAR_RAW_LOCATION
.VAR_RESOURCE_PROJECT_NAME
.VAR_RESOURCE_FULL_PATH
.VAR_RESOURCE_PROJECT_RELATIVE_PATH
.VAR_RESOURCE_FILE_EXTENSION
.VAR_RESOURCE_FILE_NAME
.
The following variables are set for resources of type file and folder only:
VAR_RESOURCE_NAME
.VAR_RESOURCE_LOCATION
.VAR_RAW_LOCATION
.VAR_RESOURCE_FULL_PATH
.VAR_RESOURCE_PROJECT_RELATIVE_PATH
.
In general, the names of the properties correspond to getX() functions of IResource
.
context
- the JET2Context into which the loaded model will be set as source.resource
- the resource to loadresourceLoaderId
- the id of the model loader to use, or null
.resourceType
- the type of the resource, or null
.
CoreJETException
- if the resource cannot be loaded
java.io.IOException
- if the loader fails to load the resource.IResource.getName()
,
IResource.getType()
,
IResource.getLocation()
,
IResource.getRawLocation()
,
IResource.getProject()
,
IResource.getFullPath()
,
IResource.getProjectRelativePath()
,
IResource.getFileExtension()
,
IResource.getParent()
|
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 |