fix for annotations repackaging
diff --git a/plugins/org.eclipse.wst.common.emf/.classpath b/plugins/org.eclipse.wst.common.emf/.classpath
index de9605d..677c4b5 100644
--- a/plugins/org.eclipse.wst.common.emf/.classpath
+++ b/plugins/org.eclipse.wst.common.emf/.classpath
@@ -4,5 +4,6 @@
<classpathentry kind="src" path="workbench/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="property_files"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
index 472cff0..e46026b 100644
--- a/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
Export-Package: .,
+ org.eclipse.jst.common.internal.annotations.core,
org.eclipse.wst.common.internal.emf.plugin,
org.eclipse.wst.common.internal.emf.resource,
org.eclipse.wst.common.internal.emf.utilities
diff --git a/plugins/org.eclipse.wst.common.emf/build.properties b/plugins/org.eclipse.wst.common.emf/build.properties
index b37b0c5..1513af8 100644
--- a/plugins/org.eclipse.wst.common.emf/build.properties
+++ b/plugins/org.eclipse.wst.common.emf/build.properties
@@ -13,10 +13,12 @@
about.html,\
plugin.properties,\
.,\
- schema/
+ schema/,\
+ property_files/
jars.compile.order = .
src.includes = component.xml,\
- schema/
+ schema/,\
+ property_files/
output.. = bin/
source.. = wtpemf/,\
workbench/
diff --git a/plugins/org.eclipse.wst.common.emf/property_files/annotationcore.properties b/plugins/org.eclipse.wst.common.emf/property_files/annotationcore.properties
new file mode 100644
index 0000000..19a34cc
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.emf/property_files/annotationcore.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2003, 2004 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+TagSpec_3=Unknown tag scope:
+TagSpec_4=Null tag scope.
+TagAttribSpec_6=
+AnnotationTagParser_0=Null event handler.
+AnnotationTagParser_1=
+AnnotationTagRegistry_0=More than one 'AnnotationTagInfo' tag for the tag '
+AnnotationTagRegistry_9=parseTagAttribs: unknown 'use' value:
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotatedCommentHandler.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotatedCommentHandler.java
new file mode 100644
index 0000000..47767e3
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotatedCommentHandler.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.common.internal.annotations.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+/**
+ * @author mdelder
+ *
+ */
+public class AnnotatedCommentHandler implements TagParseEventHandler {
+
+ private Map annotations;
+
+ private Token annotationToken;
+
+ /**
+ *
+ */
+ public AnnotatedCommentHandler() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.internal.annotations.core.TagParseEventHandler#annotationTag(org.eclipse.wst.common.internal.annotations.core.Token)
+ */
+ public void annotationTag(Token tag) {
+ this.annotationToken = tag;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.internal.annotations.core.TagParseEventHandler#endOfTag(int)
+ */
+ public void endOfTag(int pos) {
+ // Do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.internal.annotations.core.TagParseEventHandler#attribute(org.eclipse.wst.common.internal.annotations.core.Token,
+ * int, org.eclipse.wst.common.internal.annotations.core.Token)
+ */
+ public void attribute(Token name, int equalsPosition, Token value) {
+ if (value.getText() == null || value.getText().length() == 0)
+ getAnnotations().put(this.annotationToken.getText(), name.getText());
+ else
+ getAnnotations().put(name.getText(), value.getText());
+ }
+
+ /**
+ * @return Returns the annotations.
+ */
+ public Map getAnnotations() {
+ if (annotations == null)
+ annotations = new HashMap();
+ return annotations;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java
new file mode 100644
index 0000000..6196693
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Nov 11, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.common.internal.annotations.core;
+
+/**
+ * @author Pat Kelley
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class AnnotationTagParser {
+
+ private TagParseEventHandler handler;
+
+ private char[] input;
+
+ int pos;
+
+ int endOfLastGoodAttParse;
+
+ public AnnotationTagParser(TagParseEventHandler tp) {
+ if (tp == null) {
+ throw new IllegalArgumentException(AnnotationsCoreResources.AnnotationTagParser_0);
+ }
+ handler = tp;
+ }
+
+ private boolean eos() {
+ return pos >= input.length;
+ }
+
+ private boolean isWS(char c) {
+ return c == ' ' || c == '\n' || c == '\r' || c == '\t';
+ }
+
+ private void skipWS() {
+ while (pos < input.length && (isWS(input[pos]) || input[pos] == '*')) {
+ pos++;
+ }
+ }
+
+ // Caller is expected to make sure the eos has not been reached.
+ private char peek() {
+ return input[pos];
+ }
+
+ // Caller is expected to check for EOS.
+ private char nextChar() {
+ return input[pos++];
+ }
+
+ private boolean isNextChar(char c) {
+ if (eos())
+ return false;
+ return peek() == c;
+ }
+
+ private boolean isIDChar(char c) {
+ return !isWS(c) && c != '=' && c != '@' && c != '\"';
+ }
+
+ private Token collectID() {
+ StringBuffer b = new StringBuffer(16);
+ Token t = new Token();
+
+ t.setBeginning(pos);
+ while (!eos() && isIDChar(peek())) {
+ b.append(nextChar());
+ }
+ t.setEnd(pos - 1);
+ t.setText(b.toString());
+ return t;
+ }
+
+ private Token expectAttribName() {
+ if (eos()) {
+ return null;
+ }
+ int save = pos;
+
+ Token retval = collectID();
+ if (retval.length() == 0) {
+ pos = save;
+ return null;
+ }
+ return retval;
+ }
+
+ private Token expectTag() {
+ if (eos()) {
+ return null;
+ }
+ int savePos = pos;
+
+ if (nextChar() != '@') {
+ return null;
+ }
+
+ if (eos() || isWS(peek())) {
+ return null;
+ }
+
+ Token retval = expectAttribName();
+
+ if (retval.length() == 0) {
+ pos = savePos + 1;
+ }
+ retval.setBeginning(savePos);
+
+ // Save end of parse so we can pass it as the end of the parsed tag.
+ endOfLastGoodAttParse = pos;
+ return retval;
+ }
+
+ private Token expectQuotedValue() {
+ skipWS();
+ if (eos()) {
+ return null;
+ }
+
+ Token tok = new Token();
+
+ tok.setBeginning(pos);
+ if (peek() != '\"') {
+ return null;
+ }
+ nextChar();
+
+ if (eos()) {
+ return null;
+ }
+
+ StringBuffer b = new StringBuffer(64);
+
+ while (!eos() && peek() != '\"') {
+ b.append(nextChar());
+ }
+ if (!eos()) {
+ nextChar();
+ }
+
+ tok.setEnd(pos - 1);
+ tok.setText(b.toString());
+ return tok;
+ }
+
+ private boolean expectAssign() {
+ if (eos()) {
+ return false;
+ }
+
+ if (nextChar() == '=') {
+ return true;
+ }
+ pos--;
+ return false;
+ }
+
+ private Token mkNullToken() {
+ Token retval = new Token();
+
+ retval.setBeginning(pos);
+ retval.setEnd(pos - 1);
+ retval.setText(""); //$NON-NLS-1$
+ return retval;
+ }
+
+ private boolean parseNextAttribute() {
+ skipWS();
+ if (eos()) {
+ return false;
+ }
+ Token key = collectID();
+
+ if (key == null || key.length() == 0) {
+ return false;
+ }
+
+ skipWS();
+ if (eos()) {
+ // Go ahead and report it, even though it is a partial attribute. (
+ // we still fail here )
+ handler.attribute(key, -1, mkNullToken());
+ return false;
+ }
+
+ int eqPos = pos;
+
+ if (!expectAssign()) {
+ // Even though we won't parse this as a full attribute, go ahead and
+ // call the handler with it. Some clients want to see partial
+ // attributes.
+ handler.attribute(key, -1, mkNullToken());
+ return false;
+ }
+ skipWS();
+
+ if (eos()) {
+ // Same here - we fail on it, but we report it anyway
+ handler.attribute(key, eqPos, mkNullToken());
+ return false;
+ }
+ Token value = expectQuotedValue();
+
+ if (value == null) {
+ value = collectID();
+ if (isNextChar('=')) {
+ pos = value.getBeginning();
+ value = mkNullToken();
+ }
+ }
+ endOfLastGoodAttParse = pos;
+ handler.attribute(key, eqPos, value);
+ return true;
+ }
+
+ private void parseAttributes() {
+ while (!eos() && parseNextAttribute()) {
+ // loop while not end of string
+ }
+ }
+
+ private void skipToTagChar() {
+ while (!eos() && peek() != '@') {
+ nextChar();
+ }
+ }
+
+ public void setParserInput(char[] text) {
+ input = text;
+ pos = 0;
+ endOfLastGoodAttParse = 0;
+ }
+
+ public void setParserInput(String text) {
+ setParserInput(text.toCharArray());
+ }
+
+ public void parse() {
+ while (!eos()) {
+ skipToTagChar();
+ Token tag = expectTag();
+ if (tag == null) {
+ break;
+ }
+ handler.annotationTag(tag);
+ parseAttributes();
+ handler.endOfTag(endOfLastGoodAttParse);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsAdapter.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsAdapter.java
new file mode 100644
index 0000000..d9431cf
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsAdapter.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.common.internal.annotations.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.EStructuralFeatureImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.wst.common.internal.emf.utilities.CloneablePublic;
+
+
+
+/**
+ * @author mdelder
+ *
+ */
+public class AnnotationsAdapter extends AdapterImpl implements CloneablePublic {
+
+ public static final String GENERATED = "generated"; //$NON-NLS-1$
+
+ protected final static String ADAPTER_TYPE = AnnotationsAdapter.class.getName();
+
+ public final static EStructuralFeature NOTIFICATION_FEATURE = new EStructuralFeatureImpl() {
+ // anonymous inner class
+ };
+
+ private Map annotationsMap;
+
+ /**
+ *
+ */
+ public AnnotationsAdapter() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#clone()
+ */
+ public Object clone() { // throws CloneNotSupportedException {
+ //return super.clone();
+ return null;
+ }
+
+ /**
+ * @param emfObject
+ * @param string
+ */
+ public static void addAnnotations(EObject emfObject, String name, Object value) {
+ if (emfObject == null)
+ return;
+ AnnotationsAdapter adapter = getAdapter(emfObject);
+ adapter.addAnnotations(name, value);
+ }
+
+
+ /**
+ * @param emfObject
+ * @param string
+ */
+ public static Object getAnnotations(EObject emfObject, String name) {
+ if (emfObject == null)
+ return null;
+ return internalGetAnnotations(emfObject, name);
+ }
+
+ protected static Object internalGetAnnotations(EObject emfObject, String name) {
+ if (emfObject == null)
+ return null;
+ AnnotationsAdapter adapter = getAdapter(emfObject);
+ return (adapter == null) ? internalGetAnnotations(emfObject.eContainer(), name) : adapter.getAnnotations(name);
+ }
+
+
+ /**
+ * @param emfObject
+ * @param string
+ */
+ public static Object removeAnnotations(EObject emfObject, String name) {
+ if (emfObject == null)
+ return null;
+ AnnotationsAdapter adapter = getAdapter(emfObject);
+ return adapter.removeAnnotations(name);
+ }
+
+ /**
+ * @param name
+ * @param value
+ */
+ protected void addAnnotations(String name, Object value) {
+ getAnnnotations().put(name, value);
+ }
+
+ protected Object getAnnotations(String name) {
+ return getAnnnotations().get(name);
+ }
+
+ protected Object removeAnnotations(String name) {
+ return getAnnnotations().remove(name);
+ }
+
+ /**
+ * @return
+ */
+ protected Map getAnnnotations() {
+ if (annotationsMap == null)
+ annotationsMap = new HashMap();
+ return annotationsMap;
+ }
+
+ /**
+ * @param emfObject
+ * @return
+ */
+ protected static AnnotationsAdapter getAdapter(EObject emfObject) {
+ AnnotationsAdapter adapter = retrieveExistingAdapter(emfObject);
+ return adapter == null ? createAdapter(emfObject) : adapter;
+ }
+
+ /**
+ * @param emfObject
+ * @return
+ */
+ protected static AnnotationsAdapter createAdapter(EObject emfObject) {
+ AnnotationsAdapter adapter = new AnnotationsAdapter();
+ adapter.setTarget(emfObject);
+ emfObject.eAdapters().add(adapter);
+ return adapter;
+ }
+
+ /**
+ * @param emfObject
+ * @return
+ */
+ protected static AnnotationsAdapter retrieveExistingAdapter(EObject emfObject) {
+ return (AnnotationsAdapter) EcoreUtil.getExistingAdapter(emfObject, ADAPTER_TYPE);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.notify.impl.AdapterImpl#isAdapterForType(java.lang.Object)
+ */
+ public boolean isAdapterForType(Object type) {
+ return ADAPTER_TYPE.equals(type);
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsCoreResources.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsCoreResources.java
new file mode 100644
index 0000000..81b8276
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsCoreResources.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.common.internal.annotations.core;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class AnnotationsCoreResources extends NLS {
+
+ private static final String BUNDLE_NAME = "annotationcore";//$NON-NLS-1$
+
+ private AnnotationsCoreResources() {
+ // Do not instantiate
+ }
+
+ public static String TagSpec_3;
+ public static String TagSpec_4;
+ public static String TagAttribSpec_6;
+ public static String AnnotationTagParser_0;
+ public static String AnnotationTagParser_1;
+ public static String AnnotationTagRegistry_0;
+ public static String AnnotationTagRegistry_9;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, AnnotationsCoreResources.class);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsTranslator.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsTranslator.java
new file mode 100644
index 0000000..f110ad3
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/AnnotationsTranslator.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.common.internal.annotations.core;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+
+
+/**
+ * @author mdelder
+ *
+ */
+public class AnnotationsTranslator extends Translator {
+
+ private AnnotatedCommentHandler handler;
+
+ private AnnotationTagParser parser;
+
+ public static final AnnotationsTranslator INSTANCE = new AnnotationsTranslator();
+
+ /**
+ * @param domNameAndPath
+ * @param aFeature
+ */
+ public AnnotationsTranslator() {
+ super("#comment", AnnotationsAdapter.NOTIFICATION_FEATURE, Translator.COMMENT_FEATURE); //$NON-NLS-1$
+ }
+
+ /**
+ * @param domNameAndPath
+ * @param aFeature
+ */
+ public AnnotationsTranslator(String domNameAndPath) {
+ super(domNameAndPath, AnnotationsAdapter.NOTIFICATION_FEATURE, Translator.COMMENT_FEATURE);
+ }
+
+ /**
+ * @param domNameAndPath
+ * @param aFeature
+ * @param style
+ */
+ public AnnotationsTranslator(String domNameAndPath, int style) {
+ super(domNameAndPath, AnnotationsAdapter.NOTIFICATION_FEATURE, style | Translator.COMMENT_FEATURE);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.wtp.emf.xml.Translator#setMOFValue(org.eclipse.emf.ecore.EObject,
+ * java.lang.Object)
+ */
+ public void setMOFValue(EObject emfObject, Object value) {
+ if (value == null)
+ return;
+ getHandler().getAnnotations().clear();
+ getParser().setParserInput(value.toString());
+ getParser().parse();
+ String name;
+ Map annotations = getHandler().getAnnotations();
+ for (Iterator keys = annotations.keySet().iterator(); keys.hasNext();) {
+ name = (String) keys.next();
+ AnnotationsAdapter.addAnnotations(emfObject, name, annotations.get(name));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.etools.emf2xml.impl.Translator#isSetMOFValue(org.eclipse.emf.ecore.EObject)
+ */
+ public boolean isSetMOFValue(EObject emfObject) {
+ return getMOFValue(emfObject) != null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.etools.emf2xml.impl.Translator#getMOFValue(org.eclipse.emf.ecore.EObject)
+ */
+ public Object getMOFValue(EObject emfObject) {
+ return AnnotationsAdapter.getAnnotations(emfObject, AnnotationsAdapter.GENERATED);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.etools.emf2xml.impl.Translator#unSetMOFValue(org.eclipse.emf.ecore.EObject)
+ */
+ public void unSetMOFValue(EObject emfObject) {
+ AnnotationsAdapter.removeAnnotations(emfObject, AnnotationsAdapter.GENERATED);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.etools.emf2xml.impl.Translator#featureExists(org.eclipse.emf.ecore.EObject)
+ */
+ public boolean featureExists(EObject emfObject) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.etools.emf2xml.impl.Translator#isDataType()
+ */
+ public boolean isDataType() {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.etools.emf2xml.impl.Translator#isMapFor(java.lang.Object, java.lang.Object,
+ * java.lang.Object)
+ */
+ public boolean isMapFor(Object aFeature, Object oldValue, Object newValue) {
+ return (aFeature == feature);
+ }
+
+ /**
+ * @return Returns the handler.
+ */
+ protected AnnotatedCommentHandler getHandler() {
+ if (handler == null)
+ handler = new AnnotatedCommentHandler();
+ return handler;
+ }
+
+ /**
+ * @return Returns the parser.
+ */
+ protected AnnotationTagParser getParser() {
+ if (parser == null)
+ parser = new AnnotationTagParser(getHandler());
+ return parser;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/TagParseEventHandler.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/TagParseEventHandler.java
new file mode 100644
index 0000000..f979415
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/TagParseEventHandler.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Nov 11, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.common.internal.annotations.core;
+
+
+/**
+ * Parser and interface for objects that want to receive parsing events. When parsing is started
+ * through the <code>parse()</code> method, event methods are called for interesting features in
+ * the parse. ( like a SAX ContentHandler )
+ *
+ * @author Pat Kelley
+ */
+public interface TagParseEventHandler {
+
+ /**
+ * Called when the annotation tag is encountered. This will always be the first piece of content
+ * encountered. Followed by a endOfTag( ) call when the end of the tag is reached.
+ */
+ public void annotationTag(Token tag);
+
+ /**
+ * Called when the entire annotation for a single tag has been parsed.
+ *
+ * @param pos
+ * Position in the stream of the end of the annotation.
+ */
+ public void endOfTag(int pos);
+
+ /**
+ * Called for every attribute setting encountered for an annotation tag.
+ *
+ * @param name
+ * Name of the attribute.
+ * @param equalsPosition
+ * Source position of the equals sign, or -1 if no equals sign was found.
+ * @param value
+ * Value of the attribute, with any quotes stripped off. Will be zero length token if
+ * no attribute was found.
+ */
+ public void attribute(Token name, int equalsPosition, Token value);
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/Token.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/Token.java
new file mode 100644
index 0000000..9d03102
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/jst/common/internal/annotations/core/Token.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Nov 11, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.common.internal.annotations.core;
+
+/**
+ * A string, and the range it was taken from in the source file. The range is inclusive. (ie, with
+ * source "ABCD", the beginning and end for the Token "BC" would be (1,2) )
+ *
+ * @author Pat Kelley
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class Token {
+ private String text;
+ private int beginning;
+ private int end;
+
+
+
+ /**
+ * @return Position in original source of the first character of this token.
+ */
+ public int getBeginning() {
+ return beginning;
+ }
+
+ /**
+ * @return Position in the original source of the last character of this token.
+ */
+ public int getEnd() {
+ return end;
+ }
+
+ /**
+ * @return The token string.
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param i
+ * A source position
+ */
+ public void setBeginning(int i) {
+ beginning = i;
+ }
+
+ /**
+ * @param i
+ * A source position.
+ */
+ public void setEnd(int i) {
+ end = i;
+ }
+
+ /**
+ * @param string
+ */
+ public void setText(String string) {
+ text = string;
+ }
+
+ public int length() {
+ return text.length();
+ }
+
+ /**
+ * Tests whether <code>srcPos</code> comes immediately after the last character in this token.
+ *
+ * @param srcPos
+ * A position in the original source the token came from.
+ * @return true if srcPos comes immediately after this token.
+ */
+ public boolean immediatelyPrecedes(int srcPos) {
+ return end + 1 == srcPos;
+ }
+
+ /**
+ * Tests whether srcPos is within the original source range range of the token.
+ *
+ * @param srcPos
+ * @return
+ */
+ public boolean contains(int srcPos) {
+ return srcPos >= beginning && srcPos <= end;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
index c5c7287..20229c6 100644
--- a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
@@ -26,6 +26,7 @@
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jst.common.internal.annotations.core.AnnotationsTranslator;
import org.eclipse.wst.common.internal.emf.utilities.Assert;
import org.eclipse.wst.common.internal.emf.utilities.DOMUtilities;
import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopySession;
@@ -125,8 +126,7 @@
protected void initChildTranslators() {
List children = new ArrayList();
- // TODO come up with translator extension mechanism
- //children.add(AnnotationsTranslator.INSTANCE);
+ children.add(AnnotationsTranslator.INSTANCE);
children.addAll(Arrays.asList(fTranslator.getChildren(getTarget(), fRenderer.getVersionID())));
VariableTranslatorFactory factory = fTranslator.getVariableTranslatorFactory();