diff options
Diffstat (limited to 'plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal')
9 files changed, 0 insertions, 968 deletions
diff --git a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotatedCommentHandler.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotatedCommentHandler.java deleted file mode 100644 index 47767e3c6..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotatedCommentHandler.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * 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.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java deleted file mode 100644 index 61966933a..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java +++ /dev/null @@ -1,266 +0,0 @@ -/******************************************************************************* - * 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.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsAdapter.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsAdapter.java deleted file mode 100644 index d9431cf2a..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsAdapter.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * 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.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsCoreResources.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsCoreResources.java deleted file mode 100644 index 81b8276fa..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsCoreResources.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * 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.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsProviderManager.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsProviderManager.java deleted file mode 100644 index 0f98b62ab..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsProviderManager.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.eclipse.jst.common.internal.annotations.core; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jem.util.RegistryReader; -import org.eclipse.jem.util.logger.proxy.Logger; - -public class AnnotationsProviderManager extends RegistryReader { - - public static final AnnotationsProviderManager INSTANCE = new AnnotationsProviderManager(); - - static { - INSTANCE.readRegistry(); - } - - public static class Descriptor { - - public static final String EXTENSION_PT_PLUGIN = "org.eclipse.jst.common.annotations.core"; //$NON-NLS-1$ - public static final String ANNOTATIONS_PROVIDER = "annotationsProvider"; //$NON-NLS-1$ - public static final String CLASSNAME = "className"; //$NON-NLS-1$ - - private final IConfigurationElement configElement; - - public Descriptor(IConfigurationElement aConfigElement) { - super(); - configElement = aConfigElement; - } - - public IAnnotationsProvider createInstance() { - IAnnotationsProvider instance = null; - try { - instance = (IAnnotationsProvider) configElement.createExecutableExtension(CLASSNAME); - } catch (CoreException e) { - Logger.getLogger().logError(e); - } - return instance; - } - } - - private List annotationsProviders; - - /** - * Default constructor - */ - public AnnotationsProviderManager() { - super(Descriptor.EXTENSION_PT_PLUGIN, Descriptor.ANNOTATIONS_PROVIDER); - } - - public boolean readElement(IConfigurationElement element) { - if (!element.getName().equals(Descriptor.ANNOTATIONS_PROVIDER)) - return false; - addAnnotationsProvider(new Descriptor(element)); - return true; - } - - /** - * @param descriptor - */ - protected void addAnnotationsProvider(Descriptor descriptor) { - IAnnotationsProvider provider = descriptor.createInstance(); - if (provider != null) - getAnnotationsProviders().add(provider); - } - - /** - * @return Returns the annotationsProviders. - */ - public List getAnnotationsProviders() { - if (annotationsProviders == null) - annotationsProviders = new ArrayList(); - return annotationsProviders; - } - -} diff --git a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsTranslator.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsTranslator.java deleted file mode 100644 index f110ad3c8..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationsTranslator.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * 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.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/IAnnotationsProvider.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/IAnnotationsProvider.java deleted file mode 100644 index 1d1f3b134..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/IAnnotationsProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.eclipse.jst.common.internal.annotations.core; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jdt.core.ICompilationUnit; - -/** - * This interface is used by clients to allow their own annotation provider to detail information - * on whether or not a given EObject is annotated for one of their tag sets. - * - * @author jlanuti - * @planned for 2.0 - */ -public interface IAnnotationsProvider { - - /** - * Return whether or not the passed EObject is annotated by your annotation provider - * - * @planned for 2.0 - * @param eObject - * @return boolean value of isAnnotated - */ - public boolean isAnnotated(EObject eObject); - - /** - * The passed eObject may have been annoted. If true, it is desired to - * determine which {@link ICompilationUnit} has the tag or tags that created - * this object. - * - * @planned for 2.0 - * @param eObject - An {@link EObject} that may be annotated. - * @return the {@link ICompilationUnit} that has the tag that created this eObject. - * - * @see #getPrimaryTagset(EObject) - */ - public ICompilationUnit getPrimaryAnnotatedCompilationUnit(EObject eObject); - - /** - * It is desired to obtain the tagset name which is used to create the passed - * eObject. - * - * @planned for 2.0 - * @param eObject An {@link EObject} which may be annotated. - * @return The name of the tagset which creates the passed eObject. - * - * @see #getPrimaryAnnotatedCompilationUnit(EObject) - */ - public String getPrimaryTagset(EObject eObject); -} diff --git a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/TagParseEventHandler.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/TagParseEventHandler.java deleted file mode 100644 index f9794150c..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/TagParseEventHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * 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.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/Token.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/Token.java deleted file mode 100644 index 9d0310236..000000000 --- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/Token.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * 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 |