From 49e24aa545087ed6c7e2d335186e0f5054cd9494 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Wed, 4 Feb 2009 08:01:37 +0000 Subject: [PATCH] API tags for org.eclipse.cdt.core.browser.*, bug 260830. --- .../cdt/core/browser/AllTypesCache.java | 33 +- .../cdt/core/browser/IFunctionInfo.java | 9 +- .../cdt/core/browser/IQualifiedTypeName.java | 6 +- .../eclipse/cdt/core/browser/ITypeInfo.java | 272 +++++----- .../cdt/core/browser/ITypeInfoVisitor.java | 8 +- .../cdt/core/browser/ITypeReference.java | 6 +- .../cdt/core/browser/ITypeSearchScope.java | 6 +- .../core/browser/IWorkingCopyProvider.java | 7 +- .../cdt/core/browser/IndexTypeInfo.java | 369 +++++++++----- .../eclipse/cdt/core/browser/PathUtil.java | 11 +- .../cdt/core/browser/QualifiedTypeName.java | 5 +- .../eclipse/cdt/core/browser/TypeInfo.java | 469 +++++++++--------- .../cdt/core/browser/TypeReference.java | 8 +- .../cdt/core/browser/TypeSearchScope.java | 5 +- .../eclipse/cdt/core/browser/TypeUtil.java | 6 +- .../cdt/core/browser/UnknownTypeInfo.java | 34 +- .../internal/core/browser/ASTTypeInfo.java | 309 ++++++------ .../typeinfo/TypeInfoLabelProvider.java | 4 - .../browser/typeinfo/TypeSelectionDialog.java | 4 +- 19 files changed, 883 insertions(+), 688 deletions(-) diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java index 6222f1922f6..a0b2c390503 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -30,7 +30,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; /** * Manages a search cache for types in the workspace. Instead of returning * objects of type ICElement the methods of this class returns a - * list of the lightweight objects TypeInfo. + * list of the lightweight objects ITypeInfo. *

* AllTypesCache runs asynchronously using a background job to rebuild the cache * as needed. If the cache becomes dirty again while the background job is @@ -39,6 +39,9 @@ import org.eclipse.core.runtime.NullProgressMonitor; * If getTypes is called in response to a user action, a progress * dialog is shown. If called before the background job has finished, getTypes * waits for the completion of the background job. + * + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. */ public class AllTypesCache { private static final boolean DEBUG = false; @@ -135,33 +138,21 @@ public class AllTypesCache { } } - /** Returns first type in the cache which matches the given - * type and name. If no type is found, null - * is returned. - * - * @param project the enclosing project - * @param type the ICElement type - * @param qualifiedName the qualified type name to match - * @return the matching type + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated never worked. */ + @Deprecated public static ITypeInfo getType(ICProject project, int type, IQualifiedTypeName qualifiedName) { - // TODO - seems to be only used when a namespace name is changed - // which would be pretty slow against the PDOM. return null; } /** - * Returns all types matching name in the given project. - * - * @param project the enclosing project - * @param qualifiedName The qualified type name - * @param matchEnclosed true if enclosed types count as matches (foo::bar == bar) - * @param ignoreCase true if case-insensitive - * @return Array of types + * @noreference This method is not intended to be referenced by clients. + * @deprecated never worked. */ + @Deprecated public static ITypeInfo[] getTypes(ICProject project, IQualifiedTypeName qualifiedName, boolean matchEnclosed, boolean ignoreCase) { - // TODO - seems to be only used when a class or namespace name is changed - // which would be pretty slow against the PDOM. return new ITypeInfo[0]; } diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IFunctionInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IFunctionInfo.java index ca900fed035..ad75ec28cae 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IFunctionInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IFunctionInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2009 Wind River Systems, Inc. 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 @@ -14,11 +14,10 @@ package org.eclipse.cdt.core.browser; /** * Provide function related information. * - *

- * Not intended to be implemented by clients. - *

- * * @since 4.0 + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. */ public interface IFunctionInfo { diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java index 87bb7bf6a5c..f6513939d94 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -10,6 +10,10 @@ *******************************************************************************/ package org.eclipse.cdt.core.browser; +/** + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ public interface IQualifiedTypeName extends Comparable { public final static String QUALIFIER = "::"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java index 9ef714ed04f..f497895d19c 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -15,7 +15,8 @@ import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; /** - * Type information. + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. */ public interface ITypeInfo { @@ -35,11 +36,6 @@ public interface ITypeInfo { */ public int getCElementType(); - /** - * Sets the CElement type. - */ - public void setCElementType(int type); - /** * Gets the type name. */ @@ -50,156 +46,180 @@ public interface ITypeInfo { */ public IQualifiedTypeName getQualifiedTypeName(); - /** - * Returns true if the type exists. - */ - public boolean exists(); - - /** - * Returns true if the element type is unknown. - */ - public boolean isUndefinedType(); - - /** - * Returns true if this type is enclosed by other types, - * i.e. declared an inside another namespace or class. - */ - public boolean isEnclosedType(); - - /** Gets the enclosing type, i.e. the outer class or namespace which contains this type. - * @return the enclosing type, or null if not found. - */ - public ITypeInfo getEnclosingType(); - - /** Gets the enclosing namespace for this type. - * @return the enclosing namespace, or null if none exists. - */ - public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace); - - /** Gets the first enclosing type which matches one of the given kinds. - * @param kinds Array containing CElement types: C_NAMESPACE, C_CLASS, C_STRUCT - * @return the enclosing type, or null if not found. - */ - public ITypeInfo getEnclosingType(int[] kinds); - - /** Gets the root namespace, i.e. the outermost namespace - * which contains this type. - * @param includeGlobalNamespace true if the global (default) namespace should be returned - * @return the namespace, or null if not found. - */ - public ITypeInfo getRootNamespace(boolean includeGlobalNamespace); - - /** - * Returns true if this type is capable of enclosing other types, - * i.e. it is a namespace, class, or struct. - */ - public boolean isEnclosingType(); - - /** - * Returns true if this type encloses other types, i.e. contains - * inner classes or namespaces. - */ - public boolean hasEnclosedTypes(); - - /** - * Returns true if this type encloses the given type. - */ - public boolean encloses(ITypeInfo info); - - /** - * Returns true if this type is enclosed by the given type. - */ - public boolean isEnclosed(ITypeInfo info); - - /** Gets the enclosed types, i.e. inner classes or classes inside this namespace. - * @return array of inner types, or empty array if not found. - */ - public ITypeInfo[] getEnclosedTypes(); - - /** Gets the enclosed types, i.e. inner classes or classes inside this namespace. - * @param kinds Array containing CElement types: C_NAMESPACE, C_CLASS, C_STRUCT, - * C_UNION, C_ENUMERATION, C_TYPEDEF - * @return array of inner types, or empty array if not found. - */ - public ITypeInfo[] getEnclosedTypes(int kinds[]); - - /** - * Gets the enclosing project. - */ - public ICProject getEnclosingProject(); - - /** - * Returns true if type is enclosed in the given scope. - */ - public boolean isEnclosed(ITypeSearchScope scope); - - /** - * Adds a source reference. - */ - public void addReference(ITypeReference location); - - /** Gets the originating locations where this type was declared. + /** + * Gets the originating locations where this type was declared. * @return all known source references, or an empty * array if none found. */ public ITypeReference[] getReferences(); - /** Gets the real location where type was declared. - * @return the parsed source reference (with offset and length), + /** + * Gets the real location where type was declared. + * + * @return the parsed source reference (with offset and length), * or null if not found. */ public ITypeReference getResolvedReference(); - + /** - * Returns true if the type can be substituted. + * Gets the enclosing project. */ + public ICProject getEnclosingProject(); + + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public void setCElementType(int type); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public boolean exists(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public boolean isUndefinedType(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public boolean isEnclosedType(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public ITypeInfo getEnclosingType(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public ITypeInfo getEnclosingType(int[] kinds); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public ITypeInfo getRootNamespace(boolean includeGlobalNamespace); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public boolean isEnclosingType(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public boolean hasEnclosedTypes(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public boolean encloses(ITypeInfo info); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public boolean isEnclosed(ITypeInfo info); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public ITypeInfo[] getEnclosedTypes(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public ITypeInfo[] getEnclosedTypes(int kinds[]); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public boolean isEnclosed(ITypeSearchScope scope); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated + public void addReference(ITypeReference location); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated public boolean canSubstituteFor(ITypeInfo info); - /** - * Returns true if other types extend this type. + * @noreference This method is not intended to be referenced by clients. + * @deprecated */ + @Deprecated public boolean hasSubTypes(); - - /** Gets all types which extend this type. - * @return array of types, or null if none found. - */ - public ITypeInfo[] getSubTypes(); - /** - * Returns true if this type has base classes. + * @noreference This method is not intended to be referenced by clients. + * @deprecated */ + @Deprecated public boolean hasSuperTypes(); - - /** Gets the base classes. - * @return array of types, or null if none found. + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated */ + @Deprecated + public ITypeInfo[] getSubTypes(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated + */ + @Deprecated public ITypeInfo[] getSuperTypes(); - /** - * Gets the base class access visibility (PRIVATE, PROTECTED, PUBLIC) + * @noreference This method is not intended to be referenced by clients. + * @deprecated */ + @Deprecated public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType); - /** - * Adds a derived class reference, i.e. this type is used as - * a base class at the given location. + * @noreference This method is not intended to be referenced by clients. + * @deprecated */ + @Deprecated public void addDerivedReference(ITypeReference location); - - /** Gets the originating locations where this type was - * used as a base class. - * @return all known source references, or an empty - * array if none found. + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated */ + @Deprecated public ITypeReference[] getDerivedReferences(); - /** - * Returns true if the type is a class or struct. + * @noreference This method is not intended to be referenced by clients. + * @deprecated */ + @Deprecated public boolean isClass(); - /** - * Returns true if type is referenced in the given scope. + * @noreference This method is not intended to be referenced by clients. + * @deprecated */ + @Deprecated public boolean isReferenced(ITypeSearchScope scope); } diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfoVisitor.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfoVisitor.java index 20700cc9054..d202fbb2903 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfoVisitor.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfoVisitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -10,6 +10,12 @@ *******************************************************************************/ package org.eclipse.cdt.core.browser; +/** + * @deprecated not used anywhere + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +@Deprecated public interface ITypeInfoVisitor { public boolean visit(ITypeInfo info); diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeReference.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeReference.java index 2165d02918e..1704fcffc5e 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeReference.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -17,6 +17,10 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; +/** + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ public interface ITypeReference { /** diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java index 340ec167480..b21b335d2f8 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -17,6 +17,10 @@ import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.core.runtime.IPath; +/** + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ public interface ITypeSearchScope { public boolean isPathScope(); diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IWorkingCopyProvider.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IWorkingCopyProvider.java index ebac085daad..c78f6ff373e 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IWorkingCopyProvider.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IWorkingCopyProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -13,10 +13,9 @@ package org.eclipse.cdt.core.browser; import org.eclipse.cdt.core.model.IWorkingCopy; /** - * Defines a simple interface in order to provide - * a level of abstraction between the Core and UI - * code. + * @deprecated use {@link org.eclipse.cdt.core.model.IWorkingCopyProvider}, instead. */ +@Deprecated public interface IWorkingCopyProvider { public IWorkingCopy[] getWorkingCopies(); } diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java index 502c22990ea..dffea585819 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java @@ -1,12 +1,12 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 QNX Software Systems and others. + * Copyright (c) 2006, 2009 QNX Software Systems 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: - * QNX - Initial API and implementation + * Doug Schaefer (QNX) - Initial API and implementation * IBM Corporation * Andrew Ferguson (Symbian) * Anton Leherbauer (Wind River Systems) @@ -50,8 +50,8 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; /** - * @author Doug Schaefer - * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + * @noextend This interface is not intended to be extended by clients. */ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { private static int hashCode(String[] array) { @@ -116,7 +116,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { return new IndexTypeInfo(fqn, flsq, elementType, index, null, null, null); } - + /** * Creates a type info object suitable for a macro. * @param index a non-null index in which to locate references @@ -137,6 +137,13 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { return new IndexTypeInfo(new String[] {new String(name)}, ICElement.C_MACRO, params, null, index); } + /** + * @since 5.1 + */ + public static IndexTypeInfo create(IndexTypeInfo rhs, ITypeReference ref) { + return new IndexTypeInfo(rhs, ref); + } + private IndexTypeInfo(String[] fqn, IIndexFileLocation fileLocal, int elementType, IIndex index, String[] params, String returnType, ITypeReference reference) { Assert.isTrue(index != null); this.fqn= fqn; @@ -148,64 +155,18 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { this.reference= reference; } - /** - * @deprecated, use {@link #create(IIndex, IIndexBinding)}. - */ - public IndexTypeInfo(String[] fqn, int elementType, IIndex index) { - this(fqn, null, elementType, index, null, null, null); - } - - /** - * @deprecated, use {@link #create(IIndex, IIndexBinding)}. - */ - public IndexTypeInfo(String[] fqn, int elementType, String[] params, String returnType, IIndex index) { + private IndexTypeInfo(String[] fqn, int elementType, String[] params, String returnType, IIndex index) { this(fqn, null, elementType, index, params, returnType, null); } - public IndexTypeInfo(IndexTypeInfo rhs, ITypeReference ref) { + private IndexTypeInfo(IndexTypeInfo rhs, ITypeReference ref) { this(rhs.fqn, rhs.fileLocal, rhs.elementType, rhs.index, rhs.params, rhs.returnType, ref); } - public void addDerivedReference(ITypeReference location) { - throw new PDOMNotImplementedError(); - } - - public void addReference(ITypeReference location) { - throw new PDOMNotImplementedError(); - } - - public boolean canSubstituteFor(ITypeInfo info) { - throw new PDOMNotImplementedError(); - } - - public boolean encloses(ITypeInfo info) { - throw new PDOMNotImplementedError(); - } - - public boolean exists() { - throw new PDOMNotImplementedError(); - } - public int getCElementType() { return elementType; } - public ITypeReference[] getDerivedReferences() { - throw new PDOMNotImplementedError(); - } - - public ITypeInfo[] getEnclosedTypes() { - throw new PDOMNotImplementedError(); - } - - public ITypeInfo[] getEnclosedTypes(int[] kinds) { - throw new PDOMNotImplementedError(); - } - - public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) { - throw new PDOMNotImplementedError(); - } - public ICProject getEnclosingProject() { if(getResolvedReference()!=null) { IProject project = reference.getProject(); @@ -216,15 +177,6 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { return null; } - public ITypeInfo getEnclosingType() { - // TODO not sure - return null; - } - - public ITypeInfo getEnclosingType(int[] kinds) { - throw new PDOMNotImplementedError(); - } - public String getName() { return fqn[fqn.length-1]; } @@ -233,6 +185,64 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { return new QualifiedTypeName(fqn); } + /* + * @see org.eclipse.cdt.internal.core.browser.IFunctionInfo#getParameters() + */ + public String[] getParameters() { + return params; + } + + /* + * @see org.eclipse.cdt.internal.core.browser.IFunctionInfo#getReturnType() + */ + public String getReturnType() { + return returnType; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + elementType; + result = prime * result + ((fileLocal == null) ? 0 : fileLocal.hashCode()); + result = prime * result + IndexTypeInfo.hashCode(fqn); + result = prime * result + IndexTypeInfo.hashCode(params); + return result; + } + + /** + * Type info objects are equal if they compute the same references. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + IndexTypeInfo other = (IndexTypeInfo) obj; + if (elementType != other.elementType) + return false; + if (fileLocal == null) { + if (other.fileLocal != null) + return false; + } else if (!fileLocal.equals(other.fileLocal)) + return false; + if (!Arrays.equals(fqn, other.fqn)) + return false; + if (!Arrays.equals(params, other.params)) + return false; + return true; + } + + /** + * @since 5.1 + */ + public boolean isFileLocal() { + return fileLocal != null; + } + public ITypeReference getResolvedReference() { if(reference==null) { if (elementType == ICElement.C_MACRO) { @@ -452,121 +462,240 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { return otherFile.equals(file); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public void addDerivedReference(ITypeReference location) { + throw new PDOMNotImplementedError(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public void addReference(ITypeReference location) { + throw new PDOMNotImplementedError(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public boolean canSubstituteFor(ITypeInfo info) { + throw new PDOMNotImplementedError(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public boolean encloses(ITypeInfo info) { + throw new PDOMNotImplementedError(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public boolean exists() { + throw new PDOMNotImplementedError(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public ITypeReference[] getDerivedReferences() { + throw new PDOMNotImplementedError(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public ITypeInfo[] getEnclosedTypes() { + throw new PDOMNotImplementedError(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public ITypeInfo[] getEnclosedTypes(int[] kinds) { + throw new PDOMNotImplementedError(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) { + throw new PDOMNotImplementedError(); + } + + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public ITypeInfo getEnclosingType() { + // TODO not sure + return null; + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public ITypeInfo getEnclosingType(int[] kinds) { + throw new PDOMNotImplementedError(); + } + + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo[] getSubTypes() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType) { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo[] getSuperTypes() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean hasEnclosedTypes() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean hasSubTypes() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean hasSuperTypes() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isClass() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isEnclosed(ITypeInfo info) { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isEnclosed(ITypeSearchScope scope) { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isEnclosedType() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isEnclosingType() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isReferenced(ITypeSearchScope scope) { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isUndefinedType() { throw new PDOMNotImplementedError(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public void setCElementType(int type) { throw new PDOMNotImplementedError(); } - - /* - * @see org.eclipse.cdt.internal.core.browser.IFunctionInfo#getParameters() - */ - public String[] getParameters() { - return params; - } - - /* - * @see org.eclipse.cdt.internal.core.browser.IFunctionInfo#getReturnType() - */ - public String getReturnType() { - return returnType; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + elementType; - result = prime * result + ((fileLocal == null) ? 0 : fileLocal.hashCode()); - result = prime * result + IndexTypeInfo.hashCode(fqn); - result = prime * result + IndexTypeInfo.hashCode(params); - return result; - } - - /** - * Type info objects are equal if they compute the same references. - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - IndexTypeInfo other = (IndexTypeInfo) obj; - if (elementType != other.elementType) - return false; - if (fileLocal == null) { - if (other.fileLocal != null) - return false; - } else if (!fileLocal.equals(other.fileLocal)) - return false; - if (!Arrays.equals(fqn, other.fqn)) - return false; - if (!Arrays.equals(params, other.params)) - return false; - return true; - } - - /** - * @since 5.1 - */ - public boolean isFileLocal() { - return fileLocal != null; - } } diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/PathUtil.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/PathUtil.java index 74bfe98a276..9c0153776b0 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/PathUtil.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/PathUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -27,6 +27,12 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +/** + * @deprecated use {@link org.eclipse.cdt.utils.PathUtil}, instead. + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ +@Deprecated public class PathUtil { public static boolean isWindowsFileSystem() { @@ -133,6 +139,9 @@ public class PathUtil { return relativePath; } + /** + * @noreference This method is not intended to be referenced by clients. + */ public static ICProject getEnclosingProject(IPath fullPath) { IWorkspaceRoot root = getWorkspaceRoot(); if (root != null) { diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java index aeec20793dc..bc924e93fe8 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -13,6 +13,9 @@ package org.eclipse.cdt.core.browser; import org.eclipse.cdt.core.CConventions; import org.eclipse.core.runtime.IStatus; +/** + * @noextend This class is not intended to be subclassed by clients. + */ public class QualifiedTypeName implements IQualifiedTypeName { private static final String[] NO_SEGMENTS = new String[0]; diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java index d0c89f9f05c..b2058fb5738 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -10,319 +10,336 @@ *******************************************************************************/ package org.eclipse.cdt.core.browser; -import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; -public class TypeInfo implements ITypeInfo -{ -// protected ITypeCache fTypeCache; - protected int fElementType; - protected IQualifiedTypeName fQualifiedName; - protected ITypeReference[] fSourceRefs = null; - protected int fSourceRefsCount = 0; - protected ITypeReference[] fDerivedSourceRefs = null; - protected int fDerivedSourceRefsCount = 0; +/** + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public class TypeInfo implements ITypeInfo { - protected final static int INITIAL_REFS_SIZE = 1; - protected final static int REFS_GROW_BY = 2; - protected final static ITypeInfo[] EMPTY_TYPES = new ITypeInfo[0]; - - public TypeInfo(int elementType, IQualifiedTypeName typeName) { - fElementType = elementType; - fQualifiedName = typeName; + /** + * @since 5.1 + */ + protected TypeInfo() { } - + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public void addReference(ITypeReference location) { - if (fSourceRefs == null) { - fSourceRefs = new ITypeReference[INITIAL_REFS_SIZE]; - fSourceRefsCount = 0; - } else if (fSourceRefsCount == fSourceRefs.length) { - ITypeReference[] refs = new ITypeReference[fSourceRefs.length + REFS_GROW_BY]; - System.arraycopy(fSourceRefs, 0, refs, 0, fSourceRefsCount); - fSourceRefs = refs; - } - fSourceRefs[fSourceRefsCount] = location; - ++fSourceRefsCount; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeReference[] getReferences() { - if (fSourceRefs != null) { - ITypeReference[] refs = new ITypeReference[fSourceRefsCount]; - System.arraycopy(fSourceRefs, 0, refs, 0, fSourceRefsCount); - return refs; - } - return null; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeReference getResolvedReference() { - for (int i = 0; i < fSourceRefsCount; ++i) { - ITypeReference location = fSourceRefs[i]; - if (location.isLineNumber() ) - return location; - if( location.getLength() != 0) { - return location; - } - } - return null; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isReferenced() { - return (fSourceRefs != null || fDerivedSourceRefs != null); + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isReferenced(ITypeSearchScope scope) { - if (scope == null || scope.isWorkspaceScope()) - return true; - - // check if path is in scope - for (int i = 0; i < fSourceRefsCount; ++i) { - ITypeReference location = fSourceRefs[i]; - if (scope.encloses(location.getPath())) - return true; - } - for (int i = 0; i < fDerivedSourceRefsCount; ++i) { - ITypeReference location = fDerivedSourceRefs[i]; - if (scope.encloses(location.getPath())) - return true; - } - - return false; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isUndefinedType() { - return fElementType == 0; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean canSubstituteFor(ITypeInfo info) { - return isExactMatch(info); + throw new UnsupportedOperationException(); } - + protected boolean isExactMatch(ITypeInfo info) { - if (hashCode() != info.hashCode()) - return false; - if (fElementType == info.getCElementType() - && fQualifiedName.equals(info.getQualifiedTypeName())) { - ICProject project1 = getEnclosingProject(); - ICProject project2 = info.getEnclosingProject(); - if (project1 == null && project2 == null) - return true; - if (project1 == null || project2 == null) - return false; - return project1.equals(project2); - } - return false; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean exists() { -// return fTypeCache != null; - return true; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public int getCElementType() { - return fElementType; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public void setCElementType(int type) { - fElementType = type; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public IQualifiedTypeName getQualifiedTypeName() { - return fQualifiedName; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public String getName() { - return fQualifiedName.getName(); + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isEnclosedType() { - return (fQualifiedName.isQualified()); + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo getEnclosingType(int kinds[]) { -// if (fTypeCache != null) { -// return fTypeCache.getEnclosingType(this, kinds); -// } - return null; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo getEnclosingType() { - return getEnclosingType(KNOWN_TYPES); + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) { -// if (fTypeCache != null) { -// return fTypeCache.getEnclosingNamespace(this, includeGlobalNamespace); -// } - return null; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) { -// if (fTypeCache != null) { -// return fTypeCache.getRootNamespace(this, includeGlobalNamespace); -// } - return null; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isEnclosingType() { - return (fElementType == ICElement.C_NAMESPACE - || fElementType == ICElement.C_CLASS - || fElementType == ICElement.C_STRUCT); + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean encloses(ITypeInfo info) { -// if (isEnclosingType() && fTypeCache == info.getCache()) { -// return fQualifiedName.isPrefixOf(info.getQualifiedTypeName()); -// } - return false; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isEnclosed(ITypeInfo info) { - return info.encloses(this); + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean hasEnclosedTypes() { -// if (isEnclosingType() && fTypeCache != null) { -// return fTypeCache.hasEnclosedTypes(this); -// } - return false; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo[] getEnclosedTypes() { - return getEnclosedTypes(KNOWN_TYPES); + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo[] getEnclosedTypes(int kinds[]) { -// if (fTypeCache != null) { -// return fTypeCache.getEnclosedTypes(this, kinds); -// } - return EMPTY_TYPES; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ICProject getEnclosingProject() { -// if (fTypeCache != null) { -// return fTypeCache.getProject(); -// } - return null; + throw new UnsupportedOperationException(); } - @Override - public String toString() { - return fQualifiedName.toString(); - } - + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isEnclosed(ITypeSearchScope scope) { - if (scope == null || scope.isWorkspaceScope()) - return true; - - // check if path is in scope - for (int i = 0; i < fSourceRefsCount; ++i) { - ITypeReference location = fSourceRefs[i]; - if (scope.encloses(location.getPath())) - return true; - } - - return false; - } - - @Override - public int hashCode() { - int hashCode = fQualifiedName.hashCode() + fElementType; - ICProject project = getEnclosingProject(); - if (project != null) - hashCode += project.hashCode(); - return hashCode; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof TypeInfo)) { - return false; - } - return isExactMatch((TypeInfo)obj); - } - - public int compareTo(Object obj) { - if (obj == this) { - return 0; - } - if( !(obj instanceof TypeInfo)) { - throw new ClassCastException(); - } - TypeInfo info= (TypeInfo)obj; - if (fElementType != info.fElementType) - return (fElementType < info.fElementType) ? -1 : 1; - return fQualifiedName.compareTo(info.getQualifiedTypeName()); + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public static boolean isValidType(int type) { - for (int i= 0; i < KNOWN_TYPES.length; ++i) { - if (KNOWN_TYPES[i] == type) - return true; - } - return false; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public void addDerivedReference(ITypeReference location) { - if (fDerivedSourceRefs == null) { - fDerivedSourceRefs = new ITypeReference[INITIAL_REFS_SIZE]; - fDerivedSourceRefsCount = 0; - } else if (fDerivedSourceRefsCount == fDerivedSourceRefs.length) { - ITypeReference[] refs = new ITypeReference[fDerivedSourceRefs.length + REFS_GROW_BY]; - System.arraycopy(fDerivedSourceRefs, 0, refs, 0, fDerivedSourceRefsCount); - fDerivedSourceRefs = refs; - } - fDerivedSourceRefs[fDerivedSourceRefsCount] = location; - ++fDerivedSourceRefsCount; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeReference[] getDerivedReferences() { - if (fDerivedSourceRefs != null) { - ITypeReference[] refs = new ITypeReference[fDerivedSourceRefsCount]; - System.arraycopy(fDerivedSourceRefs, 0, refs, 0, fDerivedSourceRefsCount); - return refs; - } - return null; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean hasSubTypes() { - return (fDerivedSourceRefs != null); + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo[] getSubTypes() { -// if (fTypeCache != null) { -// return fTypeCache.getSubtypes(this); -// } - return null; + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean hasSuperTypes() { -// if (fTypeCache != null) { -// return (fTypeCache.getSupertypes(this) != null); -// } - return false; -// return true; //TODO can't know this until we parse + throw new UnsupportedOperationException(); } - + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ITypeInfo[] getSuperTypes() { -// if (fTypeCache != null) { -// return fTypeCache.getSupertypes(this); -// } - return null; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public ASTAccessVisibility getSuperTypeAccess(ITypeInfo superType) { -// if (fTypeCache != null) { -// return fTypeCache.getSupertypeAccess(this, superType); -// } - return null; + throw new UnsupportedOperationException(); } + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated public boolean isClass() { - return (fElementType == ICElement.C_CLASS - || fElementType == ICElement.C_STRUCT); + throw new UnsupportedOperationException(); + } + + /** + * @deprecated + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public int compareTo(Object obj) { + throw new UnsupportedOperationException(); } } diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeReference.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeReference.java index 52912f07fc3..4fcbd1f18a3 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeReference.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -19,11 +19,15 @@ import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IWorkingCopy; +import org.eclipse.cdt.utils.PathUtil; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; - +/** + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ public class TypeReference implements ITypeReference { private IPath fPath; private IProject fProject; diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java index c6373418e7b..1d3a9c8e02a 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -26,6 +26,9 @@ import org.eclipse.cdt.core.parser.IScannerInfoProvider; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +/** + * @noextend This class is not intended to be subclassed by clients. + */ public class TypeSearchScope implements ITypeSearchScope { private Set fPathSet = new HashSet(); diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java index 4e2b4fa996c..c3f2e4afe0c 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -21,6 +21,10 @@ import org.eclipse.cdt.core.model.IParent; import org.eclipse.cdt.core.model.IStructure; import org.eclipse.cdt.core.model.ITranslationUnit; +/** + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ public class TypeUtil { public static boolean isDeclaringType(ICElement elem) { diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/UnknownTypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/UnknownTypeInfo.java index cc1ba924bd1..cf2f4f493b5 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/UnknownTypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/UnknownTypeInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2009 QNX Software Systems 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 @@ -10,32 +10,14 @@ *******************************************************************************/ package org.eclipse.cdt.core.browser; -import org.eclipse.core.runtime.IPath; +/** + * @deprecated not used anywhere. + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ +@Deprecated public class UnknownTypeInfo extends TypeInfo { - - public UnknownTypeInfo(String name, IPath path) { - this(new QualifiedTypeName(name)); - if (path != null) { - addReference(new TypeReference(path, null)); - } - } - - public UnknownTypeInfo(IQualifiedTypeName typeName) { - super(0, typeName); - } - @Override - public boolean isUndefinedType() { - return true; - } - - @Override - public boolean canSubstituteFor(ITypeInfo info) { - int compareType = info.getCElementType(); - if (fElementType == 0 || compareType == 0 || fElementType == compareType) { - return fQualifiedName.equals(info.getQualifiedTypeName()); - } - return false; - } + private UnknownTypeInfo() {} } diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/ASTTypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/ASTTypeInfo.java index d7a5bd8b9ab..358197a586f 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/ASTTypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/ASTTypeInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc and others. + * Copyright (c) 2008, 2009 Wind River Systems, Inc 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 @@ -107,66 +107,11 @@ public class ASTTypeInfo implements ITypeInfo, IFunctionInfo { this.returnType= returnType; this.reference= reference; } - - public void addDerivedReference(ITypeReference location) { - throw new PDOMNotImplementedError(); - } - - public void addReference(ITypeReference location) { - throw new PDOMNotImplementedError(); - } - - public boolean canSubstituteFor(ITypeInfo info) { - throw new PDOMNotImplementedError(); - } - - public boolean encloses(ITypeInfo info) { - throw new PDOMNotImplementedError(); - } - - public boolean exists() { - throw new PDOMNotImplementedError(); - } - + public int getCElementType() { return elementType; } - public ITypeReference[] getDerivedReferences() { - throw new PDOMNotImplementedError(); - } - - public ITypeInfo[] getEnclosedTypes() { - throw new PDOMNotImplementedError(); - } - - public ITypeInfo[] getEnclosedTypes(int[] kinds) { - throw new PDOMNotImplementedError(); - } - - public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) { - throw new PDOMNotImplementedError(); - } - - public ICProject getEnclosingProject() { - if(getResolvedReference()!=null) { - IProject project = reference.getProject(); - if(project!=null) { - return CCorePlugin.getDefault().getCoreModel().getCModel().getCProject(project.getName()); - } - } - return null; - } - - public ITypeInfo getEnclosingType() { - // TODO not sure - return null; - } - - public ITypeInfo getEnclosingType(int[] kinds) { - throw new PDOMNotImplementedError(); - } - public String getName() { return fqn[fqn.length-1]; } @@ -179,97 +124,20 @@ public class ASTTypeInfo implements ITypeInfo, IFunctionInfo { return reference; } - private static ASTTypeReference createReference(IASTName name) { - IASTFileLocation floc= name.getFileLocation(); - if (floc != null) { - String filename= floc.getFileName(); - IIndexFileLocation ifl= IndexLocationFactory.getIFLExpensive(filename); - String fullPath= ifl.getFullPath(); - if (fullPath != null) { - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullPath)); - if(file!=null) { - return new ASTTypeReference(ifl, name.resolveBinding(), file, - floc.getNodeOffset(), floc.getNodeLength()); - } - } else { - IPath path = URIUtil.toPath(ifl.getURI()); - if (path!=null) { - return new ASTTypeReference(ifl, name.resolveBinding(), path, - floc.getNodeOffset(), floc.getNodeLength()); - } + public ITypeReference[] getReferences() { + return new ITypeReference[] {reference}; + } + + public ICProject getEnclosingProject() { + if(getResolvedReference()!=null) { + IProject project = reference.getProject(); + if(project!=null) { + return CCorePlugin.getDefault().getCoreModel().getCModel().getCProject(project.getName()); } } return null; } - - public ITypeReference[] getReferences() { - throw new UnsupportedOperationException(); - } - - public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) { - throw new PDOMNotImplementedError(); - } - - public ITypeInfo[] getSubTypes() { - throw new PDOMNotImplementedError(); - } - - public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType) { - throw new PDOMNotImplementedError(); - } - - public ITypeInfo[] getSuperTypes() { - throw new PDOMNotImplementedError(); - } - - public boolean hasEnclosedTypes() { - throw new PDOMNotImplementedError(); - } - - public boolean hasSubTypes() { - throw new PDOMNotImplementedError(); - } - - public boolean hasSuperTypes() { - throw new PDOMNotImplementedError(); - } - - public boolean isClass() { - throw new PDOMNotImplementedError(); - } - - public boolean isEnclosed(ITypeInfo info) { - throw new PDOMNotImplementedError(); - } - - public boolean isEnclosed(ITypeSearchScope scope) { - throw new PDOMNotImplementedError(); - } - - public boolean isEnclosedType() { - throw new PDOMNotImplementedError(); - } - - public boolean isEnclosingType() { - throw new PDOMNotImplementedError(); - } - - public boolean isReferenced(ITypeSearchScope scope) { - throw new PDOMNotImplementedError(); - } - - public boolean isUndefinedType() { - throw new PDOMNotImplementedError(); - } - - public void setCElementType(int type) { - throw new PDOMNotImplementedError(); - } - - /* - * @see org.eclipse.cdt.internal.core.browser.IFunctionInfo#getParameters() - */ public String[] getParameters() { return params; } @@ -312,8 +180,161 @@ public class ASTTypeInfo implements ITypeInfo, IFunctionInfo { return true; } - public IIndexFileLocation getIFL() { return reference.getIFL(); } + + private static ASTTypeReference createReference(IASTName name) { + IASTFileLocation floc= name.getFileLocation(); + if (floc != null) { + String filename= floc.getFileName(); + IIndexFileLocation ifl= IndexLocationFactory.getIFLExpensive(filename); + String fullPath= ifl.getFullPath(); + if (fullPath != null) { + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullPath)); + if(file!=null) { + return new ASTTypeReference(ifl, name.resolveBinding(), file, + floc.getNodeOffset(), floc.getNodeLength()); + } + } else { + IPath path = URIUtil.toPath(ifl.getURI()); + if (path!=null) { + return new ASTTypeReference(ifl, name.resolveBinding(), path, + floc.getNodeOffset(), floc.getNodeLength()); + } + } + } + return null; + } + + @Deprecated + public void addDerivedReference(ITypeReference location) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public void addReference(ITypeReference location) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean canSubstituteFor(ITypeInfo info) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean encloses(ITypeInfo info) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean exists() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ITypeReference[] getDerivedReferences() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ITypeInfo[] getEnclosedTypes() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ITypeInfo[] getEnclosedTypes(int[] kinds) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ITypeInfo getEnclosingType() { + // TODO not sure + return null; + } + + @Deprecated + public ITypeInfo getEnclosingType(int[] kinds) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ITypeInfo[] getSubTypes() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public ITypeInfo[] getSuperTypes() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean hasEnclosedTypes() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean hasSubTypes() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean hasSuperTypes() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean isClass() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean isEnclosed(ITypeInfo info) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean isEnclosed(ITypeSearchScope scope) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean isEnclosedType() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean isEnclosingType() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean isReferenced(ITypeSearchScope scope) { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public boolean isUndefinedType() { + throw new PDOMNotImplementedError(); + } + + @Deprecated + public void setCElementType(int type) { + throw new PDOMNotImplementedError(); + } } diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeInfoLabelProvider.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeInfoLabelProvider.java index 1e51ba7428b..96e647d69da 100644 --- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeInfoLabelProvider.java +++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeInfoLabelProvider.java @@ -179,10 +179,6 @@ public class TypeInfoLabelProvider extends LabelProvider { ITypeInfo typeRef= (ITypeInfo) element; if (isSet(SHOW_ENCLOSING_TYPE_ONLY)) { - ITypeInfo parentInfo = typeRef.getEnclosingType(); - if (parentInfo != null) { - return getTypeIcon(parentInfo.getCElementType()); - } IPath path = null; ITypeReference ref = typeRef.getResolvedReference(); if (ref != null) { diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java index d4029c295a9..e5a18982e29 100644 --- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java +++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java @@ -155,7 +155,7 @@ public class TypeSelectionDialog extends TwoPaneElementSelector { if (fMatchGlobalNamespace) { // must match global namespace (eg ::foo) - if (info.getRootNamespace(false) != null) + if (qualifiedName.segment(0).length() > 0) return false; } @@ -687,7 +687,7 @@ public class TypeSelectionDialog extends TwoPaneElementSelector { private void addFoldedElements(IndexTypeInfo typeInfo, ArrayList result) { ITypeReference[] refs= typeInfo.getReferences(); for (ITypeReference ref : refs) { - result.add(new IndexTypeInfo(typeInfo, ref)); + result.add(IndexTypeInfo.create(typeInfo, ref)); } } }