diff options
author | nhauge | 2011-11-17 03:53:53 +0000 |
---|---|---|
committer | nhauge | 2011-11-17 03:53:53 +0000 |
commit | 5fedc4a4c3c03f63d8c1dc4383961b45a9ad7484 (patch) | |
tree | ec26e98d8e1036926290d311660100b12a3edefb /common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility | |
parent | 58d9b83b245ca24fe87de81452d56257de1c9a02 (diff) | |
download | webtools.dali-201111160000.tar.gz webtools.dali-201111160000.tar.xz webtools.dali-201111160000.zip |
This commit was manufactured by cvs2svn to create tag 'v201111160000'.v201111160000
Diffstat (limited to 'common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility')
24 files changed, 0 insertions, 1549 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/AbstractTextRange.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/AbstractTextRange.java deleted file mode 100644 index 266e65366a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/AbstractTextRange.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility; - -import org.eclipse.jpt.common.core.internal.utility.SimpleTextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Partial implementation of text range. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public abstract class AbstractTextRange - implements TextRange -{ - protected AbstractTextRange() { - super(); - } - - public boolean includes(int index) { - return (this.getOffset() <= index) && (index < this.getEnd()); - } - - public boolean touches(int index) { - return (this.getOffset() <= index) && (index <= this.getEnd()); - } - - /** - * The end offset is <em>exclusive</em>, i.e. the element at the end offset - * is not included in the range. - */ - protected int getEnd() { - return this.getOffset() + this.getLength(); - } - - public TextRange buildTextRange(int offset, int length, int lineNumber) { - return ((offset == this.getOffset()) && - (length == this.getLength()) && - (lineNumber == this.getLineNumber())) ? - this : - new SimpleTextRange(offset, length, lineNumber); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if ( ! (o instanceof TextRange)) { - return false; - } - TextRange other = (TextRange) o; - return (other.getOffset() == this.getOffset()) - && (other.getLength() == this.getLength()) - && (other.getLineNumber() == this.getLineNumber()); - } - - @Override - public int hashCode() { - return this.getOffset() ^ this.getLength() ^ this.getLineNumber(); - } - - @Override - public String toString() { - String start = String.valueOf(this.getOffset()); - String end = String.valueOf(this.getEnd()); - String line = String.valueOf(this.getLineNumber()); - return StringTools.buildToStringFor(this, start + ", " + end + " [" + line + ']'); //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/BodySourceWriter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/BodySourceWriter.java deleted file mode 100644 index 9aabeebdd5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/BodySourceWriter.java +++ /dev/null @@ -1,303 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility; - -import java.io.Serializable; -import java.io.StringWriter; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeSet; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.IndentingPrintWriter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; - -import com.ibm.icu.text.Collator; - -/** - * Extend {@link IndentingPrintWriter} with some methods that facilitate - * building class source code. - */ -@SuppressWarnings("nls") -public class BodySourceWriter - extends IndentingPrintWriter -{ - protected final String packageName; - protected final String className; - // key = short class name; value = import package - protected final HashMap<String, ImportPackage> imports = new HashMap<String, ImportPackage>(); - - public BodySourceWriter(String packageName, String className) { - super(new StringWriter(2000)); - this.packageName = packageName; - this.className = className; - } - - public String getSource() { - return this.out.toString(); - } - - public int getLength() { - return ((StringWriter) this.out).getBuffer().length(); - } - - protected void printVisibility(String visibilityModifier) { - if (visibilityModifier.length() != 0) { - this.print(visibilityModifier); - this.print(' '); - } - } - - public void printAnnotation(String annotationName) { - this.print('@'); - this.printTypeDeclaration(annotationName); - } - - public void printTypeDeclaration(String typeDeclaration) { - this.print(this.buildImportedTypeDeclaration(typeDeclaration)); - } - - protected void printField(String fieldName, String typeDeclaration, String visibility) { - this.printVisibility(visibility); - this.printTypeDeclaration(typeDeclaration); - this.print(' '); - this.print(fieldName); - this.print(';'); - this.println(); - this.println(); - } - - protected void printParameterizedField(String fieldName, String typeDeclaration, String parameterTypeDeclaration, String visibility) { - this.printVisibility(visibility); - this.printTypeDeclaration(typeDeclaration); - this.print('<'); - this.printTypeDeclaration(parameterTypeDeclaration); - this.print('>'); - this.print(' '); - this.print(fieldName); - this.print(';'); - this.println(); - this.println(); - } - - /** - * Convert the specified string to a <em>String Literal</em> and print it, - * adding the surrounding double-quotes and escaping characters - * as necessary. - */ - public void printStringLiteral(String string) { - StringTools.convertToJavaStringLiteralOn(string, this); - } - - - // ********** imports ********** - - // ***** writing - /** - * Return the specified class's "imported" name. - * The class declaration must be of the form: - * "int" - * "int[]" (not "[I") - * "java.lang.Object" - * "java.lang.Object[]" (not "[Ljava.lang.Object;") - * "java.util.Map.Entry" (not "java.util.Map$Entry") - * "java.util.Map.Entry[][]" (not "[[Ljava.util.Map$Entry;") - * - * To really do this right, we would need to gather all the types from - * the "unamed" (default) package that were referenced in the - * compilation unit beforehand. *Any* collisions with one of these - * types would have to be fully qualified (whether it was from - * 'java.lang' or the same package as the current compilation unit). - * In other words, if we have any types from the "unnamed" package, - * results are unpredictable.... - */ - protected String buildImportedTypeDeclaration(String typeDeclaration) { - if (this.typeDeclarationIsMemberClass(typeDeclaration)) { - // no need for an import, just return the partially-qualified name - return this.buildMemberClassTypeDeclaration(typeDeclaration); - } - int last = typeDeclaration.lastIndexOf('.'); - String currentPackageName = (last == -1) ? "" : typeDeclaration.substring(0, last); - String shortTypeDeclaration = typeDeclaration.substring(last + 1); - String shortElementTypeName = shortTypeDeclaration; - while (shortElementTypeName.endsWith("[]")) { - shortElementTypeName = shortElementTypeName.substring(0, shortElementTypeName.length() - 2); - } - ImportPackage prev = this.imports.get(shortElementTypeName); - if (prev == null) { - // this is the first class with this short element type name - this.imports.put(shortElementTypeName, new ImportPackage(currentPackageName)); - return shortTypeDeclaration; - } - if (prev.packageName.equals(currentPackageName)) { - // this element type has already been imported - return shortTypeDeclaration; - } - if (currentPackageName.equals(this.packageName) && - prev.packageName.equals("java.lang")) { - // we force the 'java.lang' class to be explicitly imported - prev.collision = true; - } - // another class with the same short element type name has been - // previously imported, so this one must be used fully-qualified - return typeDeclaration; - } - - /** - * e.g. "foo.bar.Employee.PK" will return true - */ - protected boolean typeDeclarationIsMemberClass(String typeDeclaration) { - return (typeDeclaration.length() > this.className.length()) - && typeDeclaration.startsWith(this.className) - && (typeDeclaration.charAt(this.className.length()) == '.'); - } - - /** - * e.g. "foo.bar.Employee.PK" will return "Employee.PK" - * this prevents collisions with other imported classes (e.g. "joo.jar.PK") - */ - protected String buildMemberClassTypeDeclaration(String typeDeclaration) { - int index = this.packageName.length(); - if (index != 0) { - index++; // bump past the '.' - } - return typeDeclaration.substring(index); - } - - // ***** reading - public Iterable<String> getImports() { - return this.getSortedRequiredImports(); - } - - /** - * transform our map entries to class names - */ - protected Iterable<String> getSortedRequiredImports() { - return new TransformationIterable<Map.Entry<String, ImportPackage>, String>(this.getSortedRequiredImportEntries(), this.buildImportEntriesTransformer()); - } - - protected Transformer<Map.Entry<String, ImportPackage>, String> buildImportEntriesTransformer() { - return IMPORT_ENTRIES_TRANSFORMER; - } - - protected static final Transformer<Map.Entry<String, ImportPackage>, String> IMPORT_ENTRIES_TRANSFORMER = new ImportEntriesTransformer(); - - protected static class ImportEntriesTransformer - implements Transformer<Map.Entry<String, ImportPackage>, String> - { - public String transform(Entry<String, ImportPackage> importEntry) { - String pkg = importEntry.getValue().packageName; - String type = importEntry.getKey(); - StringBuilder sb = new StringBuilder(pkg.length() + 1 + type.length()); - sb.append(pkg); - sb.append('.'); - sb.append(type); - return sb.toString(); - } - } - - /** - * sort by package first, then class (*not* by fully-qualified class name) - */ - protected Iterable<Map.Entry<String, ImportPackage>> getSortedRequiredImportEntries() { - TreeSet<Map.Entry<String, ImportPackage>> sortedEntries = new TreeSet<Map.Entry<String, ImportPackage>>(this.buildImportEntriesComparator()); - CollectionTools.addAll(sortedEntries, this.getRequiredImportEntries()); - return sortedEntries; - } - - protected Comparator<Map.Entry<String, ImportPackage>> buildImportEntriesComparator() { - return IMPORT_ENTRIES_COMPARATOR; - } - - protected static final Comparator<Map.Entry<String, ImportPackage>> IMPORT_ENTRIES_COMPARATOR = new ImportEntriesComparator(); - - protected static class ImportEntriesComparator - implements Comparator<Map.Entry<String, ImportPackage>>, Serializable - { - public int compare(Map.Entry<String, ImportPackage> e1, Map.Entry<String, ImportPackage> e2) { - Collator collator = Collator.getInstance(); - int pkg = collator.compare(e1.getValue().packageName, e2.getValue().packageName); - return (pkg == 0) ? collator.compare(e1.getKey(), e2.getKey()) : pkg; - } - } - - /** - * strip off any non-required imports (e.g. "java.lang.Object') - */ - protected Iterable<Map.Entry<String, ImportPackage>> getRequiredImportEntries() { - return new FilteringIterable<Map.Entry<String, ImportPackage>>(this.imports.entrySet(), this.buildRequiredImportEntriesFilter()); - } - - protected Filter<Map.Entry<String, ImportPackage>> buildRequiredImportEntriesFilter() { - return new RequiredImportEntriesFilter(); - } - - protected class RequiredImportEntriesFilter - implements Filter<Map.Entry<String, ImportPackage>> - { - public boolean accept(Map.Entry<String, ImportPackage> importEntry) { - return this.packageMustBeImported(importEntry.getValue()); - } - - protected boolean packageMustBeImported(ImportPackage importPackage) { - String pkg = importPackage.packageName; - if (pkg.equals("")) { - // cannot import a type from the "unnamed" package - return false; - } - if (pkg.equals("java.lang")) { - // we must import from 'java.lang' if we also have a class in the same package - return importPackage.collision; - } - if (pkg.equals(BodySourceWriter.this.packageName)) { - // we never need to import a class from the same package - return false; - } - return true; - } - } - - /** - * We need a 'collision' flag for when we encounter a class from - * 'java.lang' followed by a class from the current compilation unit's - * package. We will need to include the explicit import of the - * 'java.lang' class and all the references to the other class will - * have to be fully-qualified. - * - * If the classes are encountered in the opposite order (i.e. the class - * from the current compilation unit's package followed by the class - * from 'java.lang'), we do *not* need to import the first class while - * all the references to the 'java.lang' class will be fully-qualified. - * - * Unfortunately, we still have a problem: if we reference a class from - * 'java.lang' and there is a conflicting class from the current - * compilation unit's package (but that class is *not* revealed to us - * here), the simple name will be resolved to the non-'java.lang' class. - * Unless we simply force an import of *all* 'java.lang' classes.... :-( - * - * This shouldn't happen very often. :-) - */ - protected static class ImportPackage { - protected final String packageName; - protected boolean collision = false; - - protected ImportPackage(String packageName) { - super(); - this.packageName = packageName; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/TextRange.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/TextRange.java deleted file mode 100644 index f31dd77adf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/TextRange.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2011 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * A text range defines the offset into, length of, and line of a piece - * of text. - * <p> - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * <p> - * This interface is not intended to be implemented by clients. - * - * @version 2.0 - * @since 2.0 - */ -public interface TextRange { - - /** - * Return the offset of the text. - */ - int getOffset(); - - /** - * Return the length of the text. - */ - int getLength(); - - /** - * Return whether the range includes the character at the specified index. - */ - boolean includes(int index); - - /** - * Return whether the range touches an insertion cursor at the - * specified index. - */ - boolean touches(int index); - - /** - * Return the line number of the text. - */ - int getLineNumber(); - - /** - * Build and return a new text range for the specified values if they differ - * from the text range. If the specified values match the - * text range, simply return the text range unchanged. - */ - TextRange buildTextRange(int offset, int length, int lineNumber); - - /** - * Return whether the offsets, lengths, and line numbers are the same. - */ - boolean equals(Object obj); - - /** - * Return a hash code that corresponds to the {@link Object#equals(Object)} - * contract. - */ - int hashCode(); - - - /** - * Empty implementation of text range. - */ - final class Empty extends AbstractTextRange { - public static final TextRange INSTANCE = new Empty(); - public static TextRange instance() { - return INSTANCE; - } - // ensure single instance - private Empty() { - super(); - } - public int getLineNumber() { - return IMessage.LINENO_UNSET; - } - public int getOffset() { - return IMessage.OFFSET_UNSET; - } - public int getLength() { - return IMessage.OFFSET_UNSET; - } - @Override - public String toString() { - return StringTools.buildSingletonToString(this); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AbstractType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AbstractType.java deleted file mode 100644 index 8be7a07d97..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AbstractType.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.ITypeBinding; - -/** - * AbstractType: just some covariant overrides. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AbstractType extends Member { - - /** - * Covariant override. - */ - ITypeBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - AbstractTypeDeclaration getBodyDeclaration(CompilationUnit astRoot); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedElement.java deleted file mode 100644 index 8ce99cf49c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedElement.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IBinding; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Dali manipulates annotations on elements (packages, types, fields, and methods). - * This interface simplifies those manipulations. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotatedElement { - - String getName(); - - /** - * Return the annotated element's body declaration from the specified AST. - * This can be null if the annotated element is no longer present in the AST - * because the source has been changed in another thread. - */ - ASTNode getBodyDeclaration(CompilationUnit astRoot); - - /** - * Return the annotated element's binding from the specified AST. - */ - IBinding getBinding(CompilationUnit astRoot); - - /** - * Return the annotated element's "modified" declaration from the specified AST. - */ - ModifiedDeclaration getModifiedDeclaration(CompilationUnit astRoot); - - /** - * Return the annotated element's "modified" declaration from a newly-generated AST. - */ - ModifiedDeclaration getModifiedDeclaration(); - - /** - * Return the annotated element's name text range from the specified AST. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Edit the annotated element's declaration using the specified editor. - */ - void edit(Editor editor); - - - // ********** "editor" interface ********** - - /** - * This interface defines a callback that is invoked when the annotated element's - * compilation unit/AST is in a state to be manipulated. - */ - public interface Editor { - - /** - * Edit the specified declaration. Any changes made to the declaration - * will be captured and applied to the annotated element's compilation unit. - */ - void edit(ModifiedDeclaration declaration); - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedPackage.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedPackage.java deleted file mode 100644 index c0a3ccc098..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedPackage.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * Distributed under license by Red Hat, Inc. All rights reserved. - * This program is 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 - * - * Contributor: - * Red Hat, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IPackageBinding; -import org.eclipse.jdt.core.dom.PackageDeclaration; - -/** - * @author Dmitry Geraskov - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotatedPackage extends AnnotatedElement { - - /** - * Covariant override. - */ - IPackageBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - PackageDeclaration getBodyDeclaration(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationAdapter.java deleted file mode 100644 index b0b04c4938..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationAdapter.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; - -/** - * Adapt a Java annotation with a simple-to-use interface. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotationAdapter { - - /** - * Given the specified compilation unit, return the value of the - * adapter's annotation. - * @see #getAnnotation() - */ - Annotation getAnnotation(CompilationUnit astRoot); - - /** - * Build a new marker annotation, replacing the original annotation if present. - */ - void newMarkerAnnotation(); - - /** - * Build a new single member annotation, replacing the original annotation if present. - */ - void newSingleMemberAnnotation(); - - /** - * Build a new normal annotation, replacing the original annotation if present. - */ - void newNormalAnnotation(); - - /** - * Remove the annotation. - */ - void removeAnnotation(); - - /** - * Return the AST node corresponding to the annotation. - * If the annotation is missing, return the annotation's parent node. - * @see #getAstNode() - */ - ASTNode getAstNode(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationEditFormatter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationEditFormatter.java deleted file mode 100644 index 77b3ac0682..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationEditFormatter.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.TextEdit; - -/** - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotationEditFormatter { - - /** - * Review the specified edits and format the specified document as needed. - */ - void format(IDocument doc, TextEdit editTree) throws MalformedTreeException, BadLocationException; - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationElementAdapter.java deleted file mode 100644 index 3fc6e95434..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationElementAdapter.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; - -/** - * Adapt a Java annotation element with a simple-to-use interface. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotationElementAdapter<T> { - - /** - * Return the value of the adapter's annotation element. - * Return null if the element is not present. - * If the compilation unit is available, #value(CompilationUnit) - * might be more performant. - * @see #getValue(org.eclipse.jdt.core.dom.CompilationUnit) - */ - T getValue(); - - /** - * Given the specified compilation unit, return the value of the - * adapter's annotation element. - * Return null if the element is not present. - * @see #getValue() - */ - T getValue(CompilationUnit astRoot); - - /** - * Set the value of the adapter's annotation element. - * Setting the value of the element to null will cause - * the element to be removed from its annotation. - */ - void setValue(T value); - - /** - * Given the specified compilation unit, return the expression value of the - * adapter's annotation element. - * Return null if the element is not present. - * @see #getExpression() - */ - Expression getExpression(CompilationUnit astRoot); - - /** - * Return the AST node corresponding to the element. - * If the element is missing, return the annotation's node. - * @see #getAstNode() - */ - ASTNode getAstNode(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Attribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Attribute.java deleted file mode 100644 index cce19d5abc..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Attribute.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.ITypeBinding; - -/** - * Attributes are either represented by fields ('foo') or properties/method - * pairs ('getFoo()'/'setFoo()'). - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface Attribute extends Member { - - /** - * Return the attribute's name, as opposed to the member's name - * (e.g. "getFoo()" returns "foo"). - */ - String getAttributeName(); - - /** - * Return the type binding for the attribute's declared type, - * as opposed to its declaring type. - */ - ITypeBinding getTypeBinding(CompilationUnit astRoot); - - /** - * Return whether the attribute is a field. - */ - boolean isField(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationAdapter.java deleted file mode 100644 index 9f93a16ffd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; - -/** - * Provide clients with a pluggable way to manipulate an - * annotation modifying a "declaration". - * - * TODO specify how multiple annotations with the same name are to be handled - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface DeclarationAnnotationAdapter { - - /** - * Given the specified declaration, return the annotation. - */ - Annotation getAnnotation(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, modify it with - * a new marker annotation, replacing the original annotation if present. - * Return the new annotation. - */ - MarkerAnnotation newMarkerAnnotation(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, modify it with - * a new single member annotation, replacing the original annotation if present. - * Return the new annotation. - */ - SingleMemberAnnotation newSingleMemberAnnotation(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, modify it with - * a new normal annotation, replacing the original annotation if present. - * Return the new annotation. - */ - NormalAnnotation newNormalAnnotation(ModifiedDeclaration declaration); - - /** - * Remove the annotation from the specified declaration. - */ - void removeAnnotation(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, return the AST node - * corresponding to the annotation. - * If the annotation is missing, return its parent node. - */ - ASTNode getAstNode(ModifiedDeclaration declaration); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationElementAdapter.java deleted file mode 100644 index 1d5e4ff250..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationElementAdapter.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Expression; - -/** - * Provide clients with a pluggable way to manipulate an - * annotation element modifying a "declaration". - * T is the type of the object to be passed to and returned by the adapter. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface DeclarationAnnotationElementAdapter<T> { - - /** - * Reduce the number of NLS warnings. - */ - String VALUE = "value"; //$NON-NLS-1$ - - /** - * Given the specified declaration, return the value of the - * annotation element. Return null or an empty array - * if the element is not present. - */ - T getValue(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, set the value of the - * annotation element. Setting the value of the element - * to null will cause the element to be removed from its - * annotation. - */ - void setValue(T value, ModifiedDeclaration declaration); - - /** - * Given the specified declaration, return the element's value expression. - * Return null if the element is not present. - */ - Expression getExpression(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, return the AST node - * corresponding to the element's value. - * If the element is missing, return the annotation's node. - */ - ASTNode getAstNode(ModifiedDeclaration declaration); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Enum.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Enum.java deleted file mode 100644 index da690b148b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Enum.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.EnumDeclaration; - -/** - * Enum: some covariant overrides plus enumConstants - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface Enum extends AbstractType { - - /** - * Covariant override. - */ - EnumDeclaration getBodyDeclaration(CompilationUnit astRoot); - - /** - * Return the enum's constants - */ - EnumConstantDeclaration[] getEnumConstants(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/EnumConstant.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/EnumConstant.java deleted file mode 100644 index 88693d415a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/EnumConstant.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.IVariableBinding; - -/** - * Enum constants are part of Enums - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface EnumConstant extends Member { - - String getName(); - - /** - * Covariant override. - */ - IVariableBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - EnumConstantDeclaration getBodyDeclaration(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ExpressionConverter.java deleted file mode 100644 index c5d7ed10e2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ExpressionConverter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Expression; - -/** - * Define the protocol for converting an AST expression back and forth - * from an arbitrary type (e.g. StringLiteral <=> String). - * T is the type of the object to be converted to and from an expression. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface ExpressionConverter<T> { - - /** - * Convert the specified object to an - * expression that is owned by the specified AST. - * The type of the object is determined by the - * contract specified by the client. - */ - Expression convert(T object, AST ast); - - /** - * Convert the specified expression to an object of some - * pre-determined type. - */ - T convert(Expression expression); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/FieldAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/FieldAttribute.java deleted file mode 100644 index 4e014ac72b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/FieldAttribute.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.IVariableBinding; - -/** - * Field attribute: just some covariant overrides. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface FieldAttribute extends Attribute { - - /** - * Covariant override. - */ - IVariableBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - FieldDeclaration getBodyDeclaration(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedAnnotationAdapter.java deleted file mode 100644 index a55e9cbc77..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedAnnotationAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - - -/** - * Adapt an indexed Java annotation with a simple-to-use interface. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface IndexedAnnotationAdapter extends AnnotationAdapter { - - /** - * Return the the index at which the annotation is situated. - */ - int getIndex(); - - /** - * Move the annotation to the specified index, leaving its original - * position cleared out. - */ - void moveAnnotation(int newIndex); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationAdapter.java deleted file mode 100644 index 438f21e1e6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - - -/** - * Allow clients to manipulate an annotation within an array of annotations. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface IndexedDeclarationAnnotationAdapter extends DeclarationAnnotationAdapter { - - /** - * Return the the index at which the annotation is situated. - */ - int getIndex(); - - /** - * Move the annotation to the specified index, leaving its original - * position cleared out. - */ - void moveAnnotation(int newIndex, ModifiedDeclaration declaration); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationElementAdapter.java deleted file mode 100644 index ae9f83ada8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationElementAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. 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: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.Expression; - -/** - * Provide clients with a pluggable way to manipulate an <i>indexed</i> annotation - * element modifying a "declaration". - * T[] is the type of the object to be passed to and returned by the adapter. - * T is the sub-value of the value object. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface IndexedDeclarationAnnotationElementAdapter<T> - extends DeclarationAnnotationElementAdapter<T[]> { - - /** - * Given the specified declaration, return the expression for the element's subvalue - * at the given index. - * @throws IndexOutOfBoundsException if the index is out of range - */ - Expression getSubvalueExpression(int index, ModifiedDeclaration declaration); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedExpressionConverter.java deleted file mode 100644 index a25ab674fb..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedExpressionConverter.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. 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: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.Expression; - -/** - * A type of {@link ExpressionConverter} that can further retrieve sub-expressions - * based on indices. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface IndexedExpressionConverter<T> - extends ExpressionConverter<T[]> { - - /** - * Return the expression for the sub-value at the given index. - * @throws ArrayIndexOutOfBoundsException if the index is out of range - */ - Expression getSubexpression(int index, Expression expression); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Member.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Member.java deleted file mode 100644 index 8b9f398ea0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Member.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; - -/** - * Dali manipulates annotations on members (types, fields, and methods). - * This interface simplifies those manipulations. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface Member extends AnnotatedElement { - - /** - * Return whether the member is persistable. - */ - boolean isPersistable(CompilationUnit astRoot); - - /** - * Return whether the member matches the specified member - * and occurrence. - */ - boolean matches(String memberName, int occurrence); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/MethodAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/MethodAttribute.java deleted file mode 100644 index 2eca93d773..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/MethodAttribute.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jpt.common.utility.MethodSignature; - -/** - * Method attribute: just some covariant overrides. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface MethodAttribute extends Attribute { - - /** - * Covariant override. - */ - IMethodBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - MethodDeclaration getBodyDeclaration(CompilationUnit astRoot); - - /** - * This method must be used instead of Member#matches(String, int). - */ - boolean matches(MethodSignature signature, int occurrence); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ModifiedDeclaration.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ModifiedDeclaration.java deleted file mode 100644 index 331e5391a0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ModifiedDeclaration.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; - -/** - * Define a wrapper that provides a common protocol for all the various AST - * declarations that have modifiers (i.e. there are a number of AST node - * classes that implement the method #modifiers(), but they do not implement - * a common interface): - * BodyDeclaration - * SingleVariableDeclaration - * VariableDeclarationExpression - * VariableDeclarationStatement - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface ModifiedDeclaration { - - /** - * Return the "declaration" AST node. - */ - ASTNode getDeclaration(); - - /** - * Return the "declaration" AST. - */ - AST getAst(); - - /** - * Return the *first* annotation with the specified name. - * Return null if the declaration has no such annotation. - */ - Annotation getAnnotationNamed(String annotationName); - - /** - * Remove the *first* annotation with the specified name from the declaration. - */ - void removeAnnotationNamed(String annotationName); - - /** - * Replace the specified old annotation with the specified new annotation. - * If there is no annotation with the specified name, simply add the new - * annotation to the declaration's modifiers. - */ - void replaceAnnotationNamed(String oldAnnotationName, Annotation newAnnotation); - - /** - * Add the specified import to the declaration's compilation unit. - * Return whether the appropriate import was added to or already present in - * the declaration's compilation unit (i.e. the specified class can be - * subsequently referenced using a "short" name). - * Also return true if an import was unnecessary (i.e. the specified class - * is part of the "default" package). - * This does not support adding a "wildcard" import (e.g. "java.util.*"). - */ - boolean addImport(String className); - - /** - * Add the specified static import to the declaration's compilation unit. - * Return whether the appropriate import was added to or already present in - * the declaration's compilation unit (i.e. the specified constant can be - * subsequently referenced using a "short" name). - * Also return true if an import was unnecessary (i.e. the specified enum - * is part of the "default" package). - * This does not support adding a "wildcard" import (e.g. "java.lang.annotation.ElementType.*"). - */ - boolean addStaticImport(String enumConstantName); - - /** - * Add the specified import to the declaration's compilation unit. - * Return whether the appropriate import was added to or already present in - * the declaration's compilation unit (i.e. the specified name can be - * subsequently referenced using a "short" name). - * Also return true if an import was unnecessary (i.e. the specified class - * or enum is part of the "default" package). - * This does not support adding a "wildcard" import (e.g. "java.util.*"). - */ - boolean addImport(String importName, boolean static_); - - /** - * Return whether the specified annotation has the specified - * (fully-qualified) name within the declaration's context; i.e. attempt - * to resolve the annotation's name (using imports etc.) and return - * whether it matches the specified name. - */ - boolean annotationIsNamed(Annotation annotation, String name); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Type.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Type.java deleted file mode 100644 index 5a3a6a5a98..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Type.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; - -/** - * Type: nestedTypes, nestedEnums, fields, and methods. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface Type extends AbstractType { - - /** - * Covariant override. - */ - TypeDeclaration getBodyDeclaration(CompilationUnit astRoot); - - /** - * Return the type's nested types (does not include annotations or enums). - */ - TypeDeclaration[] getTypes(CompilationUnit astRoot); - - /** - * Return the type's nested enums. - */ - EnumDeclaration[] getEnums(CompilationUnit astRoot); - - /** - * Return the type's fields. - */ - FieldDeclaration[] getFields(CompilationUnit astRoot); - - /** - * Return the type's methods. - */ - MethodDeclaration[] getMethods(CompilationUnit astRoot); - -} |