summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-06-01 11:59:23 (EDT)
committerpelder2006-06-01 11:59:23 (EDT)
commit9e09e543bbcb52913574eea98ac556e998aa20bf (patch)
treebdc4f886c2cbd3a53284daac8f4cc834e7734708
parent760fa0da6aa11913e1c0ab161799827d19a5181f (diff)
downloadorg.eclipse.jet-9e09e543bbcb52913574eea98ac556e998aa20bf.zip
org.eclipse.jet-9e09e543bbcb52913574eea98ac556e998aa20bf.tar.gz
org.eclipse.jet-9e09e543bbcb52913574eea98ac556e998aa20bf.tar.bz2
[144901] Update org.eclipse.jet.transform extension point.
-rw-r--r--plugins/org.eclipse.jet/plugin.xml3
-rw-r--r--plugins/org.eclipse.jet/schema/transform.exsd17
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformData.java24
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformDataFactory.java23
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/DeployedJETBundleProvider.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/IJETBundleProvider.java3
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleDescriptor.java17
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java12
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/TagInfo.java5
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/transform/IJETBundleDescriptor.java16
12 files changed, 129 insertions, 9 deletions
diff --git a/plugins/org.eclipse.jet/plugin.xml b/plugins/org.eclipse.jet/plugin.xml
index 6080df5..69ccae7 100644
--- a/plugins/org.eclipse.jet/plugin.xml
+++ b/plugins/org.eclipse.jet/plugin.xml
@@ -1411,7 +1411,8 @@ if 'length' is specified, convert only the specified number of characters, other
<extension
point="org.eclipse.jet.transform">
<transform
- startTemplate="org.eclipse.jet.transform1"
+ private="true"
+ startTemplate="templates/main.jet"
templateLoaderClass="org.eclipse.jet.internal.compiler.templates.CodeGenTemplateLoader">
<tagLibraries>
<importLibrary id="org.eclipse.jet.controlTags" usePrefix="c" autoImport="true"/>
diff --git a/plugins/org.eclipse.jet/schema/transform.exsd b/plugins/org.eclipse.jet/schema/transform.exsd
index a19f912..4e735e3 100644
--- a/plugins/org.eclipse.jet/schema/transform.exsd
+++ b/plugins/org.eclipse.jet/schema/transform.exsd
@@ -102,6 +102,23 @@ A typical use would be to force model loading to treat inputs as a specific type
</documentation>
</annotation>
</attribute>
+ <attribute name="private" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ Indicate whether the transform should appear in any JET UIs, or be enumerated by any JET APIs that search for available transforms. The default is &lt;code&gt;false&lt;/code&gt;, indicating that the transform will appear in all UIs and APIs.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="modelSchema" type="string">
+ <annotation>
+ <documentation>
+ An optional project relative path or a URL to a file that serves as a schema for transform inputs. JET APIs makes no use of this information, but a schema can help users in creating valid models for the transform.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
</complexType>
</element>
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformData.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformData.java
index 1ebe7bd..6b8d421 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformData.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformData.java
@@ -33,6 +33,8 @@ public class TransformData
private final String mainTemplate;
private final TagLibraryReference[] tlRefs;
private final String description;
+ private final boolean privateTransform;
+ private final String modelSchema;
/**
* Construct a TransformData object.
@@ -47,9 +49,12 @@ public class TransformData
*/
public TransformData(String transformId, String overridesId,
String modelLoaderId, String modelExtension, String templateLoaderClassName,
- String mainTemplate, TagLibraryReference[] tlRefs, String description)
+ String mainTemplate, TagLibraryReference[] tlRefs, String description,
+ boolean privateTransform, String modelSchema)
{
this.transformId = transformId;
+ this.privateTransform = privateTransform;
+ this.modelSchema = modelSchema;
this.overridesId = overridesId == null || overridesId.length() == 0 ? null : overridesId;
this.modelLoaderId = modelLoaderId == null || modelLoaderId.length() == 0 ? null : modelLoaderId;
this.modelExtension = modelExtension == null || modelExtension.length() == 0 ? null : modelExtension;
@@ -123,4 +128,21 @@ public class TransformData
return description;
}
+ /**
+ * @return the model schema or <code>null</code> if none was specified.
+ */
+ public final String getModelSchema()
+ {
+ return modelSchema;
+ }
+
+ /**
+ *
+ * @return <code>true</code> if the transform is private.
+ */
+ public final boolean isPrivateTransform()
+ {
+ return privateTransform;
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformDataFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformDataFactory.java
index afa3286..78d00d6 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformDataFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/TransformDataFactory.java
@@ -68,6 +68,10 @@ public class TransformDataFactory
public static final TransformDataFactory INSTANCE = new TransformDataFactory();
+ private static final String A_TRANSFORM_PRIVATE = "private"; //$NON-NLS-1$
+
+ private static final String A_TRANSFORM_MODELSCHEMA = "modelSchema"; //$NON-NLS-1$
+
private boolean expresionsInitialized = false;
private XPathExpression xTransform;
@@ -81,6 +85,10 @@ public class TransformDataFactory
private XPathExpression xTransformStartTemplate;
private XPathExpression xTransformTemplateLoaderClass;
+
+ private XPathExpression xTransformPrivate;
+
+ private XPathExpression xTransformModelSchema;
private XPathExpression xDescription;
@@ -109,6 +117,8 @@ public class TransformDataFactory
xTransformOverrides = xpath.compile("@" + A_TRANSFORM_OVERRIDES); //$NON-NLS-1$
xTransformStartTemplate = xpath.compile("@" + A_TRANSFORM_STARTTEMPLATE); //$NON-NLS-1$
xTransformTemplateLoaderClass = xpath.compile("@" + A_TRANSFORM_TEMPLATELOADERCLASS); //$NON-NLS-1$
+ xTransformPrivate = xpath.compile("@" + A_TRANSFORM_PRIVATE); //$NON-NLS-1$
+ xTransformModelSchema = xpath.compile("@" + A_TRANSFORM_MODELSCHEMA); //$NON-NLS-1$
xDescription = xpath.compile(E_DESCRIPTION);
xTagLibrariesImportLibrary = xpath.compile("tagLibraries/importLibrary"); //$NON-NLS-1$
@@ -167,6 +177,8 @@ public class TransformDataFactory
String mainTemplate = xTransformStartTemplate.evaluateAsString(transform);
String templateLoaderClassName = xTransformTemplateLoaderClass.evaluateAsString(transform);
String description = xDescription.evaluateAsString(transform);
+ String privateTransform = xTransformPrivate.evaluateAsString(transform);
+ String modelSchema = xTransformModelSchema.evaluateAsString(transform);
final NodeSet importNodes = xTagLibrariesImportLibrary.evaluateAsNodeSet(transform);
@@ -191,7 +203,9 @@ public class TransformDataFactory
templateLoaderClassName,
mainTemplate,
(TagLibraryReference[])tlRefs.toArray(new TagLibraryReference [tlRefs.size()]),
- description);
+ description,
+ Boolean.valueOf(privateTransform).booleanValue(),
+ modelSchema );
return transformData;
}
@@ -212,7 +226,8 @@ public class TransformDataFactory
String overridesId = element.getAttribute(A_TRANSFORM_OVERRIDES);
String mainTemplate = element.getAttribute(A_TRANSFORM_STARTTEMPLATE);
String templateLoaderClassName = element.getAttribute(A_TRANSFORM_TEMPLATELOADERCLASS);
-
+ String privateTransform = element.getAttribute(A_TRANSFORM_PRIVATE);
+ String modelSchema = element.getAttribute(A_TRANSFORM_MODELSCHEMA);
TagLibraryReference[] tlRefs = getTagLibraryReferences(element);
String description = getDescription(element);
@@ -225,7 +240,9 @@ public class TransformDataFactory
templateLoaderClassName,
mainTemplate,
tlRefs,
- description);
+ description,
+ privateTransform == null ? false : Boolean.valueOf(privateTransform).booleanValue(),
+ modelSchema);
}
return transformData;
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/DeployedJETBundleProvider.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/DeployedJETBundleProvider.java
index 0dd3e64..18bd661 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/DeployedJETBundleProvider.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/DeployedJETBundleProvider.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -224,4 +225,9 @@ public class DeployedJETBundleProvider implements IJETBundleProvider, IRegistryC
}
}
+ public Collection getAllJETBundleDescriptors()
+ {
+ return descriptorsById.values();
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/IJETBundleProvider.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/IJETBundleProvider.java
index aae123d..714652e 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/IJETBundleProvider.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/IJETBundleProvider.java
@@ -16,6 +16,7 @@
*/
package org.eclipse.jet.internal.runtime;
+import java.util.Collection;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -33,6 +34,8 @@ public interface IJETBundleProvider
public abstract Set getAllJETBundleIds();
+ public abstract Collection getAllJETBundleDescriptors();
+
public abstract void startup();
public abstract void shutdown();
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java
index 2d012d0..b5127f2 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java
@@ -19,6 +19,7 @@ package org.eclipse.jet.internal.runtime;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -191,4 +192,9 @@ public final class InstalledJETBundleProvider implements IRegistryChangeListener
// nothing to do...
}
+ public Collection getAllJETBundleDescriptors()
+ {
+ return pluginBundleDescriptorsById.values();
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleDescriptor.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleDescriptor.java
index 68f4a37..f2cc147 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleDescriptor.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleDescriptor.java
@@ -16,6 +16,7 @@
*/
package org.eclipse.jet.internal.runtime;
+import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jet.internal.extensionpoints.TransformData;
@@ -40,6 +41,8 @@ public class JETBundleDescriptor implements IJETBundleDescriptor
private final String provider;
private final String templateLoaderClass;
private final String mainTemplate;
+ private final boolean privateTransform;
+ private final String modelSchema;
private final TagLibraryReference[] tagLibraryReferences;
private final URL baseURL;
@@ -61,6 +64,8 @@ public class JETBundleDescriptor implements IJETBundleDescriptor
this.modelLoaderId = null;
this.modelExtension = null;
this.tagLibraryReferences = new TagLibraryReference[0];
+ this.privateTransform = false;
+ this.modelSchema = null;
}
else
{
@@ -71,6 +76,8 @@ public class JETBundleDescriptor implements IJETBundleDescriptor
this.modelLoaderId = transformData.getModelLoaderId();
this.modelExtension = transformData.getModelExtension();
this.tagLibraryReferences = transformData.getTagLibraryReferences();
+ this.privateTransform = transformData.isPrivateTransform();
+ this.modelSchema = transformData.getModelSchema();
}
}
@@ -168,4 +175,14 @@ public class JETBundleDescriptor implements IJETBundleDescriptor
return baseURL;
}
+ public URL getModelSchema() throws MalformedURLException
+ {
+ return modelSchema == null ? null : new URL(baseURL, modelSchema);
+ }
+
+ public boolean isPrivate()
+ {
+ return privateTransform;
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java
index eda550b..93723c7 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java
@@ -19,6 +19,7 @@ package org.eclipse.jet.internal.runtime;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -162,7 +163,6 @@ public class JETBundleManager implements IJETBundleManager
for (int i = 0; i < allIds.length; i++)
{
result[i] = getDescriptor(allIds[i]);
-
}
return result;
}
@@ -493,7 +493,15 @@ public class JETBundleManager implements IJETBundleManager
{
IJETBundleProvider provider = providerSearchOrder[i];
- allIds.addAll(provider.getAllJETBundleIds());
+ Collection descriptors = provider.getAllJETBundleDescriptors();
+ for (Iterator j = descriptors.iterator(); j.hasNext();)
+ {
+ IJETBundleDescriptor descriptor = (IJETBundleDescriptor)j.next();
+ if(!descriptor.isPrivate())
+ {
+ allIds.add(descriptor.getId());
+ }
+ }
}
return (String[])allIds.toArray(new String[allIds.size()]);
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java
index bd6c31a..87551ce 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java
@@ -19,6 +19,7 @@ package org.eclipse.jet.internal.runtime;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -328,4 +329,9 @@ public class ProjectJETBundleProvider implements IResourceChangeListener, IJETBu
}
}
+ public Collection getAllJETBundleDescriptors()
+ {
+ return descriptorsById.values();
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/TagInfo.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/TagInfo.java
index 939b82b..109f509 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/TagInfo.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/TagInfo.java
@@ -18,7 +18,7 @@
package org.eclipse.jet.taglib;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
@@ -60,7 +60,8 @@ public final class TagInfo
{
throw new IllegalArgumentException();
}
- this.attrMap = new HashMap(attrNames.length);
+ // use Linked has map so that attributes retain their original order.
+ this.attrMap = new LinkedHashMap(attrNames.length);
for (int i = 0; i < attrNames.length; i++)
{
attrMap.put(attrNames[i], attrValues[i]);
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/transform/IJETBundleDescriptor.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/transform/IJETBundleDescriptor.java
index 10c2912..b1cc0b3 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/transform/IJETBundleDescriptor.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/transform/IJETBundleDescriptor.java
@@ -16,6 +16,7 @@
*/
package org.eclipse.jet.transform;
+import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jet.taglib.TagLibraryReference;
@@ -97,4 +98,19 @@ public interface IJETBundleDescriptor
* @return a URL
*/
public abstract URL getBaseURL();
+
+ /**
+ * Tests whether the transform is declared to be private. Private
+ * transforms are not shown in JET UIs, or returned from JET APIs that
+ * return lists of available transforms.
+ * @return <code>true</code> for private, <code>false</code> otherwise.
+ */
+ public abstract boolean isPrivate();
+
+ /**
+ * Return the URL of model schema defined by the transform.
+ * @return the URL for the model schema, or <code>null</code> if no schema is provided
+ * @throws MalformedURLException if the model schema URL is malformed.
+ */
+ public abstract URL getModelSchema() throws MalformedURLException;
}