mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
2771aee44d
commit
920b26a152
2 changed files with 83 additions and 83 deletions
|
@ -6,12 +6,12 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
|
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.index;
|
package org.eclipse.cdt.core.index;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -24,56 +24,56 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for accessing the index for one or more projects.
|
* Interface for accessing the index for one or more projects.
|
||||||
*
|
*
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*
|
*
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public interface IIndex {
|
public interface IIndex {
|
||||||
/**
|
/**
|
||||||
* Constant to specify infinite depth.
|
* Constant to specify infinite depth.
|
||||||
* @see #findIncludedBy(IIndexFile, int)
|
* @see #findIncludedBy(IIndexFile, int)
|
||||||
* @see #findIncludes(IIndexFile, int)
|
* @see #findIncludes(IIndexFile, int)
|
||||||
*/
|
*/
|
||||||
final int DEPTH_INFINITE = -1;
|
final int DEPTH_INFINITE = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant to find direct includes, only.
|
* Constant to find direct includes, only.
|
||||||
* @see #findIncludedBy(IIndexFile, int)
|
* @see #findIncludedBy(IIndexFile, int)
|
||||||
* @see #findIncludes(IIndexFile, int)
|
* @see #findIncludes(IIndexFile, int)
|
||||||
*/
|
*/
|
||||||
final int DEPTH_ZERO = 0;
|
final int DEPTH_ZERO = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant to search for declarations. This does not include definitions.
|
* Constant to search for declarations. This does not include definitions.
|
||||||
*/
|
*/
|
||||||
final int FIND_DECLARATIONS = 0x1;
|
final int FIND_DECLARATIONS = 0x1;
|
||||||
/**
|
/**
|
||||||
* Constant to search for definitions. This does not include declarations.
|
* Constant to search for definitions. This does not include declarations.
|
||||||
*/
|
*/
|
||||||
final int FIND_DEFINITIONS = 0x2;
|
final int FIND_DEFINITIONS = 0x2;
|
||||||
/**
|
/**
|
||||||
* Constant to search for references. This does not include declarations or definitions.
|
* Constant to search for references. This does not include declarations or definitions.
|
||||||
*/
|
*/
|
||||||
final int FIND_REFERENCES = 0x4;
|
final int FIND_REFERENCES = 0x4;
|
||||||
/**
|
/**
|
||||||
* Constant to search for occurrences across language boundaries.
|
* Constant to search for occurrences across language boundaries.
|
||||||
* You can use it to find the occurrences of a c++-function declared with 'extern "C"' within
|
* You can use it to find the occurrences of a c++-function declared with 'extern "C"' within
|
||||||
* the c-linkage.
|
* the c-linkage.
|
||||||
*/
|
*/
|
||||||
final int SEARCH_ACROSS_LANGUAGE_BOUNDARIES= 0x8;
|
final int SEARCH_ACROSS_LANGUAGE_BOUNDARIES= 0x8;
|
||||||
/**
|
/**
|
||||||
* Constant to search for all declarations including definitions.
|
* Constant to search for all declarations including definitions.
|
||||||
*/
|
*/
|
||||||
final int FIND_DECLARATIONS_DEFINITIONS = FIND_DECLARATIONS | FIND_DEFINITIONS;
|
final int FIND_DECLARATIONS_DEFINITIONS = FIND_DECLARATIONS | FIND_DEFINITIONS;
|
||||||
/**
|
/**
|
||||||
* Constant to search for all occurrences of a binding. This includes declarations, definitions and references.
|
* Constant to search for all occurrences of a binding. This includes declarations, definitions and references.
|
||||||
*/
|
*/
|
||||||
final int FIND_ALL_OCCURRENCES = FIND_DECLARATIONS | FIND_DEFINITIONS | FIND_REFERENCES;
|
final int FIND_ALL_OCCURRENCES = FIND_DECLARATIONS | FIND_DEFINITIONS | FIND_REFERENCES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before making calls to an index you have to obtain a lock. The objects
|
* Before making calls to an index you have to obtain a lock. The objects
|
||||||
* returned by an index become invalid as soon as the indexer writes to the
|
* returned by an index become invalid as soon as the indexer writes to the
|
||||||
* index. You may obtain nested read locks. Make sure you release the lock.
|
* index. You may obtain nested read locks. Make sure you release the lock.
|
||||||
* @see #getLastWriteAccess()
|
* @see #getLastWriteAccess()
|
||||||
|
@ -88,12 +88,12 @@ public interface IIndex {
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public void acquireReadLock() throws InterruptedException;
|
public void acquireReadLock() throws InterruptedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any lock obtained by {@link #acquireReadLock()} must be released.
|
* Any lock obtained by {@link #acquireReadLock()} must be released.
|
||||||
*/
|
*/
|
||||||
public void releaseReadLock();
|
public void releaseReadLock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return <code>true</code> if there are threads waiting for read locks.
|
* @return <code>true</code> if there are threads waiting for read locks.
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
@ -102,7 +102,7 @@ public interface IIndex {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a timestamp of when the index was last written to. This can
|
* Returns a timestamp of when the index was last written to. This can
|
||||||
* be used to figure out whether information read from the index is
|
* be used to figure out whether information read from the index is
|
||||||
* still reliable or not.
|
* still reliable or not.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -131,9 +131,9 @@ public interface IIndex {
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
public long getLastWriteAccess();
|
public long getLastWriteAccess();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file-object for the given location and linkage or returns
|
* Returns the file-object for the given location and linkage or returns
|
||||||
* <code>null</code> if the file was not indexed in this linkage.
|
* <code>null</code> if the file was not indexed in this linkage.
|
||||||
* @param location an IIndexFileLocation representing the location of the file
|
* @param location an IIndexFileLocation representing the location of the file
|
||||||
* @return the file in the index or <code>null</code>
|
* @return the file in the index or <code>null</code>
|
||||||
|
@ -142,7 +142,7 @@ public interface IIndex {
|
||||||
public IIndexFile getFile(int linkageID, IIndexFileLocation location) throws CoreException;
|
public IIndexFile getFile(int linkageID, IIndexFileLocation location) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file-objects for the given location in any linkage.
|
* Returns the file-objects for the given location in any linkage.
|
||||||
* @param location an IIndexFileLocation representing the location of the file
|
* @param location an IIndexFileLocation representing the location of the file
|
||||||
* @return an array of file-objects.
|
* @return an array of file-objects.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -151,7 +151,7 @@ public interface IIndex {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks for include relations originated by the given file.
|
* Looks for include relations originated by the given file.
|
||||||
* This is the same as <pre> findIncludes(file, DEPTH_ZERO); </pre>
|
* This is the same as <pre> findIncludes(file, DEPTH_ZERO); </pre>
|
||||||
* @param file the file containing the include directives
|
* @param file the file containing the include directives
|
||||||
* @return an array of include relations
|
* @return an array of include relations
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -159,8 +159,8 @@ public interface IIndex {
|
||||||
public IIndexInclude[] findIncludes(IIndexFile file) throws CoreException;
|
public IIndexInclude[] findIncludes(IIndexFile file) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks for include relations pointing to the given file.
|
* Looks for include relations pointing to the given file.
|
||||||
* This is the same as <pre> findIncludedBy(file, DEPTH_ZERO); </pre>
|
* This is the same as <pre> findIncludedBy(file, DEPTH_ZERO); </pre>
|
||||||
* @param file the file included by the directives to be found
|
* @param file the file included by the directives to be found
|
||||||
* @return an array of include relations
|
* @return an array of include relations
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -170,7 +170,7 @@ public interface IIndex {
|
||||||
/**
|
/**
|
||||||
* Looks recursively for include relations originated by the given file.
|
* Looks recursively for include relations originated by the given file.
|
||||||
* @param file the file containing the include directives
|
* @param file the file containing the include directives
|
||||||
* @param depth depth to which includes are followed, should be one of
|
* @param depth depth to which includes are followed, should be one of
|
||||||
* {@link #DEPTH_ZERO} or {@link #DEPTH_INFINITE}
|
* {@link #DEPTH_ZERO} or {@link #DEPTH_INFINITE}
|
||||||
* @return an array of include relations
|
* @return an array of include relations
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -180,7 +180,7 @@ public interface IIndex {
|
||||||
/**
|
/**
|
||||||
* Looks recursively for include relations pointing to the given file.
|
* Looks recursively for include relations pointing to the given file.
|
||||||
* @param file the file the include directives point to
|
* @param file the file the include directives point to
|
||||||
* @param depth depth to which includes are followed, should be one of
|
* @param depth depth to which includes are followed, should be one of
|
||||||
* {@link #DEPTH_ZERO} or {@link #DEPTH_INFINITE}
|
* {@link #DEPTH_ZERO} or {@link #DEPTH_INFINITE}
|
||||||
* @return an array of include relations
|
* @return an array of include relations
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -199,12 +199,12 @@ public interface IIndex {
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public IIndexFile resolveInclude(IIndexInclude include) throws CoreException;
|
public IIndexFile resolveInclude(IIndexInclude include) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all macros with a given name.
|
* Searches for all macros with a given name.
|
||||||
*
|
*
|
||||||
* @param name a name, that has to be matched by the macros.
|
* @param name a name, that has to be matched by the macros.
|
||||||
* @param filter a filter that allows for skipping parts of the index
|
* @param filter a filter that allows for skipping parts of the index
|
||||||
* @param monitor a monitor to report progress, may be <code>null</code>.
|
* @param monitor a monitor to report progress, may be <code>null</code>.
|
||||||
* @return an array of macros matching the name.
|
* @return an array of macros matching the name.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -214,7 +214,7 @@ public interface IIndex {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all macros with names that start with the given prefix.
|
* Searches for all macros with names that start with the given prefix.
|
||||||
*
|
*
|
||||||
* @param prefix the prefix with which all returned macros must start
|
* @param prefix the prefix with which all returned macros must start
|
||||||
* @param filter a filter that allows for skipping parts of the index
|
* @param filter a filter that allows for skipping parts of the index
|
||||||
* @param monitor a monitor for progress reporting and cancellation, may be <code>null</code>
|
* @param monitor a monitor for progress reporting and cancellation, may be <code>null</code>
|
||||||
|
@ -232,17 +232,17 @@ public interface IIndex {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public IIndexBinding findBinding(IName name) throws CoreException;
|
public IIndexBinding findBinding(IName name) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all bindings with simple names that match the given pattern. In case a binding exists
|
* Searches for all bindings with simple names that match the given pattern. In case a binding exists
|
||||||
* in multiple projects, no duplicate bindings are returned.
|
* in multiple projects, no duplicate bindings are returned.
|
||||||
* This is fully equivalent to
|
* This is fully equivalent to
|
||||||
* <pre>
|
* <pre>
|
||||||
* findBindings(new Pattern[]{pattern}, isFullyQualified, filter, monitor);
|
* findBindings(new Pattern[]{pattern}, isFullyQualified, filter, monitor);
|
||||||
* </pre>
|
* </pre>
|
||||||
* @param pattern the pattern the name of the binding has to match.
|
* @param pattern the pattern the name of the binding has to match.
|
||||||
* @param isFullyQualified if <code>true</code>, binding must be in global scope
|
* @param isFullyQualified if <code>true</code>, binding must be in global scope
|
||||||
* @param filter a filter that allows for skipping parts of the index
|
* @param filter a filter that allows for skipping parts of the index
|
||||||
* @param monitor a monitor to report progress, may be <code>null</code>.
|
* @param monitor a monitor to report progress, may be <code>null</code>.
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -250,24 +250,24 @@ public interface IIndex {
|
||||||
public IIndexBinding[] findBindings(Pattern pattern, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexBinding[] findBindings(Pattern pattern, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all bindings with qualified names that seen as an array of simple names match the given array
|
* Searches for all bindings with qualified names that seen as an array of simple names match the given array
|
||||||
* of patterns. In case a binding exists in multiple projects, no duplicate bindings are returned.
|
* of patterns. In case a binding exists in multiple projects, no duplicate bindings are returned.
|
||||||
* You can search with an array of patterns that specifies a partial qualification only.
|
* You can search with an array of patterns that specifies a partial qualification only.
|
||||||
* @param patterns an array of patterns the names of the qualified name of the bindings have to match.
|
* @param patterns an array of patterns the names of the qualified name of the bindings have to match.
|
||||||
* @param isFullyQualified if <code>true</code>, the array of pattern specifies the fully qualified name
|
* @param isFullyQualified if <code>true</code>, the array of pattern specifies the fully qualified name
|
||||||
* @param filter a filter that allows for skipping parts of the index
|
* @param filter a filter that allows for skipping parts of the index
|
||||||
* @param monitor a monitor to report progress, may be <code>null</code>.
|
* @param monitor a monitor to report progress, may be <code>null</code>.
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public IIndexBinding[] findBindings(Pattern[] patterns, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexBinding[] findBindings(Pattern[] patterns, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all macro containers (one for macros with the same name) with names that
|
* Searches for all macro containers (one for macros with the same name) with names that
|
||||||
* match the given pattern. In case a binding exists in multiple projects, no duplicate bindings
|
* match the given pattern. In case a binding exists in multiple projects, no duplicate bindings
|
||||||
* are returned.
|
* are returned.
|
||||||
* @param pattern a pattern the name of the bindings have to match.
|
* @param pattern a pattern the name of the bindings have to match.
|
||||||
* @param filter a filter that allows for skipping parts of the index
|
* @param filter a filter that allows for skipping parts of the index
|
||||||
* @param monitor a monitor to report progress, may be <code>null</code>
|
* @param monitor a monitor to report progress, may be <code>null</code>
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -279,7 +279,7 @@ public interface IIndex {
|
||||||
* This method makes use of the BTree and is faster than the methods using patterns.
|
* This method makes use of the BTree and is faster than the methods using patterns.
|
||||||
* <p>
|
* <p>
|
||||||
* @param names an array of names, which has to be matched by the qualified name of the bindings.
|
* @param names an array of names, which has to be matched by the qualified name of the bindings.
|
||||||
* @param filter a filter that allows for skipping parts of the index
|
* @param filter a filter that allows for skipping parts of the index
|
||||||
* @param monitor a monitor to report progress, may be <code>null</code>.
|
* @param monitor a monitor to report progress, may be <code>null</code>.
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -291,12 +291,12 @@ public interface IIndex {
|
||||||
* In case a binding exists in multiple projects, no duplicate bindings are returned.
|
* In case a binding exists in multiple projects, no duplicate bindings are returned.
|
||||||
* This method makes use of the BTree and is faster than the methods using patterns.
|
* This method makes use of the BTree and is faster than the methods using patterns.
|
||||||
*
|
*
|
||||||
* This is fully equivalent to
|
* This is fully equivalent to
|
||||||
* <pre>
|
* <pre>
|
||||||
* findBindings(name, true, filter, monitor);
|
* findBindings(name, true, filter, monitor);
|
||||||
* </pre>
|
* </pre>
|
||||||
* @param name a name, which has to be matched by the qualified name of the bindings.
|
* @param name a name, which has to be matched by the qualified name of the bindings.
|
||||||
* @param filter a filter that allows for skipping parts of the index
|
* @param filter a filter that allows for skipping parts of the index
|
||||||
* @param monitor a monitor to report progress, may be <code>null</code>.
|
* @param monitor a monitor to report progress, may be <code>null</code>.
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -310,7 +310,7 @@ public interface IIndex {
|
||||||
*
|
*
|
||||||
* @param name a name, which has to be matched by the qualified name of the bindings.
|
* @param name a name, which has to be matched by the qualified name of the bindings.
|
||||||
* @param fileScopeOnly if true, only bindings at file scope are returned
|
* @param fileScopeOnly if true, only bindings at file scope are returned
|
||||||
* @param filter a filter that allows for skipping parts of the index
|
* @param filter a filter that allows for skipping parts of the index
|
||||||
* @param monitor a monitor to report progress, may be <code>null</code>.
|
* @param monitor a monitor to report progress, may be <code>null</code>.
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -345,11 +345,11 @@ public interface IIndex {
|
||||||
public IIndexName[] findNames(IBinding binding, int flags) throws CoreException;
|
public IIndexName[] findNames(IBinding binding, int flags) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all references that resolve to the given binding.
|
* Searches for all references that resolve to the given binding.
|
||||||
* This is fully equivalent to
|
* This is fully equivalent to
|
||||||
* <pre>
|
* <pre>
|
||||||
* findNames(binding, IIndex.FIND_REFERENCES);
|
* findNames(binding, IIndex.FIND_REFERENCES);
|
||||||
* </pre>
|
* </pre>
|
||||||
* @param binding a binding for which references are searched for
|
* @param binding a binding for which references are searched for
|
||||||
* @return an array of names
|
* @return an array of names
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -357,11 +357,11 @@ public interface IIndex {
|
||||||
public IIndexName[] findReferences(IBinding binding) throws CoreException;
|
public IIndexName[] findReferences(IBinding binding) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all declarations and definitions that resolve to the given binding.
|
* Searches for all declarations and definitions that resolve to the given binding.
|
||||||
* This is fully equivalent to
|
* This is fully equivalent to
|
||||||
* <pre>
|
* <pre>
|
||||||
* findNames(binding, IIndex.FIND_DECLARATIONS_DEFINITIONS);
|
* findNames(binding, IIndex.FIND_DECLARATIONS_DEFINITIONS);
|
||||||
* </pre>
|
* </pre>
|
||||||
* @param binding a binding for which declarations are searched for
|
* @param binding a binding for which declarations are searched for
|
||||||
* @return an array of names
|
* @return an array of names
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -369,11 +369,11 @@ public interface IIndex {
|
||||||
public IIndexName[] findDeclarations(IBinding binding) throws CoreException;
|
public IIndexName[] findDeclarations(IBinding binding) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all definitions that resolve to the given binding.
|
* Searches for all definitions that resolve to the given binding.
|
||||||
* This is fully equivalent to
|
* This is fully equivalent to
|
||||||
* <pre>
|
* <pre>
|
||||||
* findNames(binding, IIndex.FIND_DEFINITIONS);
|
* findNames(binding, IIndex.FIND_DEFINITIONS);
|
||||||
* </pre>
|
* </pre>
|
||||||
* @param binding a binding for which declarations are searched for
|
* @param binding a binding for which declarations are searched for
|
||||||
* @return an array of names
|
* @return an array of names
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -389,7 +389,7 @@ public interface IIndex {
|
||||||
* @return an IIndexBinding for this IIndex that is equivalent to the specified binding
|
* @return an IIndexBinding for this IIndex that is equivalent to the specified binding
|
||||||
*/
|
*/
|
||||||
public IIndexBinding adaptBinding(IBinding binding);
|
public IIndexBinding adaptBinding(IBinding binding);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a file-set that can be used with this index as long as you hold a read-lock.
|
* Creates a file-set that can be used with this index as long as you hold a read-lock.
|
||||||
*/
|
*/
|
||||||
|
@ -403,7 +403,7 @@ public interface IIndex {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the global inline c++ namespaces.
|
* Returns the global inline c++ namespaces.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
public IScope[] getInlineNamespaces() throws CoreException;
|
public IScope[] getInlineNamespaces() throws CoreException;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.index;
|
package org.eclipse.cdt.internal.core.index;
|
||||||
|
|
||||||
|
@ -44,27 +44,27 @@ public class IndexFactory {
|
||||||
private static final int SKIP_PROVIDED = IIndexManager.SKIP_PROVIDED;
|
private static final int SKIP_PROVIDED = IIndexManager.SKIP_PROVIDED;
|
||||||
|
|
||||||
private PDOMManager fPDOMManager;
|
private PDOMManager fPDOMManager;
|
||||||
|
|
||||||
public IndexFactory(PDOMManager manager) {
|
public IndexFactory(PDOMManager manager) {
|
||||||
fPDOMManager= manager;
|
fPDOMManager= manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIndex getIndex(ICProject[] projects, int options) throws CoreException {
|
public IIndex getIndex(ICProject[] projects, int options) throws CoreException {
|
||||||
projects = (ICProject[]) ArrayUtil.removeNulls(ICProject.class, projects);
|
projects = (ICProject[]) ArrayUtil.removeNulls(ICProject.class, projects);
|
||||||
|
|
||||||
boolean addDependencies= (options & ADD_DEPENDENCIES) != 0;
|
boolean addDependencies= (options & ADD_DEPENDENCIES) != 0;
|
||||||
boolean addDependent= (options & ADD_DEPENDENT) != 0;
|
boolean addDependent= (options & ADD_DEPENDENT) != 0;
|
||||||
boolean skipProvided= (options & SKIP_PROVIDED) != 0;
|
boolean skipProvided= (options & SKIP_PROVIDED) != 0;
|
||||||
|
|
||||||
HashMap<IProject, Integer> map= new HashMap<IProject, Integer>();
|
HashMap<IProject, Integer> map= new HashMap<IProject, Integer>();
|
||||||
Collection<ICProject> selectedProjects= getProjects(projects, addDependencies, addDependent, map, new Integer(1));
|
Collection<ICProject> selectedProjects= getProjects(projects, addDependencies, addDependent, map, new Integer(1));
|
||||||
|
|
||||||
HashMap<String, IIndexFragment> fragments= new LinkedHashMap<String, IIndexFragment>();
|
HashMap<String, IIndexFragment> fragments= new LinkedHashMap<String, IIndexFragment>();
|
||||||
for (ICProject cproject : selectedProjects) {
|
for (ICProject cproject : selectedProjects) {
|
||||||
IIndexFragment pdom= fPDOMManager.getPDOM(cproject);
|
IIndexFragment pdom= fPDOMManager.getPDOM(cproject);
|
||||||
if (pdom != null) {
|
if (pdom != null) {
|
||||||
safeAddFragment(fragments, pdom);
|
safeAddFragment(fragments, pdom);
|
||||||
|
|
||||||
if (!skipProvided) {
|
if (!skipProvided) {
|
||||||
safeAddProvidedFragments(cproject, fragments);
|
safeAddProvidedFragments(cproject, fragments);
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,9 @@ public class IndexFactory {
|
||||||
if (fragments.isEmpty()) {
|
if (fragments.isEmpty()) {
|
||||||
return EmptyCIndex.INSTANCE;
|
return EmptyCIndex.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int primaryFragmentCount= fragments.size();
|
int primaryFragmentCount= fragments.size();
|
||||||
|
|
||||||
if (!addDependencies) {
|
if (!addDependencies) {
|
||||||
projects= selectedProjects.toArray(new ICProject[selectedProjects.size()]);
|
projects= selectedProjects.toArray(new ICProject[selectedProjects.size()]);
|
||||||
selectedProjects.clear();
|
selectedProjects.clear();
|
||||||
|
@ -84,18 +84,18 @@ public class IndexFactory {
|
||||||
for (ICProject cproject : selectedProjects) {
|
for (ICProject cproject : selectedProjects) {
|
||||||
IIndexFragment pdom= fPDOMManager.getPDOM(cproject);
|
IIndexFragment pdom= fPDOMManager.getPDOM(cproject);
|
||||||
safeAddFragment(fragments, pdom);
|
safeAddFragment(fragments, pdom);
|
||||||
|
|
||||||
if (!skipProvided) {
|
if (!skipProvided) {
|
||||||
safeAddProvidedFragments(cproject, fragments);
|
safeAddProvidedFragments(cproject, fragments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<IIndexFragment> pdoms= fragments.values();
|
Collection<IIndexFragment> pdoms= fragments.values();
|
||||||
return new CIndex(pdoms.toArray(new IIndexFragment[pdoms.size()]), primaryFragmentCount);
|
return new CIndex(pdoms.toArray(new IIndexFragment[pdoms.size()]), primaryFragmentCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IWritableIndex getWritableIndex(ICProject project) throws CoreException {
|
public IWritableIndex getWritableIndex(ICProject project) throws CoreException {
|
||||||
Map<String, IIndexFragment> readOnlyFrag= new LinkedHashMap<String, IIndexFragment>();
|
Map<String, IIndexFragment> readOnlyFrag= new LinkedHashMap<String, IIndexFragment>();
|
||||||
IWritableIndexFragment pdom= (IWritableIndexFragment) fPDOMManager.getPDOM(project);
|
IWritableIndexFragment pdom= (IWritableIndexFragment) fPDOMManager.getPDOM(project);
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
|
@ -104,26 +104,26 @@ public class IndexFactory {
|
||||||
}
|
}
|
||||||
safeAddProvidedFragments(project, readOnlyFrag);
|
safeAddProvidedFragments(project, readOnlyFrag);
|
||||||
|
|
||||||
Collection<ICProject> selectedProjects= getProjects(new ICProject[] {project}, true, false, new HashMap<IProject, Integer>(), new Integer(1));
|
Collection<ICProject> selectedProjects= getProjects(new ICProject[] {project}, true, false, new HashMap<IProject, Integer>(), new Integer(1));
|
||||||
selectedProjects.remove(project);
|
selectedProjects.remove(project);
|
||||||
|
|
||||||
for (ICProject cproject : selectedProjects) {
|
for (ICProject cproject : selectedProjects) {
|
||||||
safeAddFragment(readOnlyFrag, fPDOMManager.getPDOM(cproject));
|
safeAddFragment(readOnlyFrag, fPDOMManager.getPDOM(cproject));
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<IIndexFragment> roPdoms= readOnlyFrag.values();
|
Collection<IIndexFragment> roPdoms= readOnlyFrag.values();
|
||||||
return new WritableCIndex(pdom, roPdoms.toArray(new IIndexFragment[roPdoms.size()]) );
|
return new WritableCIndex(pdom, roPdoms.toArray(new IIndexFragment[roPdoms.size()]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<ICProject> getProjects(ICProject[] projects, boolean addDependencies, boolean addDependent, HashMap<IProject, Integer> map, Integer markWith) {
|
private Collection<ICProject> getProjects(ICProject[] projects, boolean addDependencies, boolean addDependent, HashMap<IProject, Integer> map, Integer markWith) {
|
||||||
List<IProject> projectsToSearch= new ArrayList<IProject>();
|
List<IProject> projectsToSearch= new ArrayList<IProject>();
|
||||||
|
|
||||||
for (ICProject cproject : projects) {
|
for (ICProject cproject : projects) {
|
||||||
IProject project= cproject.getProject();
|
IProject project= cproject.getProject();
|
||||||
checkAddProject(project, map, projectsToSearch, markWith);
|
checkAddProject(project, map, projectsToSearch, markWith);
|
||||||
projectsToSearch.add(project);
|
projectsToSearch.add(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addDependencies || addDependent) {
|
if (addDependencies || addDependent) {
|
||||||
for (int i=0; i<projectsToSearch.size(); i++) {
|
for (int i=0; i<projectsToSearch.size(); i++) {
|
||||||
IProject project= projectsToSearch.get(i);
|
IProject project= projectsToSearch.get(i);
|
||||||
|
@ -147,7 +147,7 @@ public class IndexFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreModel cm= CoreModel.getDefault();
|
CoreModel cm= CoreModel.getDefault();
|
||||||
Collection<ICProject> result= new ArrayList<ICProject>();
|
Collection<ICProject> result= new ArrayList<ICProject>();
|
||||||
for (Map.Entry<IProject, Integer> entry : map.entrySet()) {
|
for (Map.Entry<IProject, Integer> entry : map.entrySet()) {
|
||||||
|
@ -172,7 +172,7 @@ public class IndexFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an entry for the specified fragment. This copes with problems occurring when reading
|
* Add an entry for the specified fragment. This copes with problems occurring when reading
|
||||||
* the fragment ID.
|
* the fragment ID.
|
||||||
|
@ -197,7 +197,7 @@ public class IndexFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds ID -> IIndexFragment entries to the specified Map, for fragments provided under the
|
* Adds ID -> IIndexFragment entries to the specified Map, for fragments provided under the
|
||||||
* CIndex extension point for the specified ICProject
|
* CIndex extension point for the specified ICProject
|
||||||
|
|
Loading…
Add table
Reference in a new issue