mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
Cosmetics.
This commit is contained in:
parent
8aa01dbdfc
commit
cc3695ca21
8 changed files with 96 additions and 81 deletions
|
@ -14,8 +14,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.index;
|
package org.eclipse.cdt.core.index;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -23,6 +21,8 @@ import org.eclipse.cdt.core.parser.ISignificantMacros;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for accessing the index for one or more projects.
|
* Interface for accessing the index for one or more projects.
|
||||||
*
|
*
|
||||||
|
@ -60,7 +60,7 @@ public interface IIndex {
|
||||||
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
|
* Can be used 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;
|
||||||
|
@ -149,7 +149,7 @@ public interface IIndex {
|
||||||
/**
|
/**
|
||||||
* Returns the file for the given location, linkage, and significant macros
|
* Returns the file for the given location, linkage, and significant macros
|
||||||
* May return {@code null}, if no such file exists.
|
* May return {@code null}, if no such file exists.
|
||||||
*
|
*
|
||||||
* @param linkageID the id of the linkage in which the file has been parsed.
|
* @param linkageID the id of the linkage in which the file has been parsed.
|
||||||
* @param location the IIndexFileLocation representing the location of the file
|
* @param location the IIndexFileLocation representing the location of the file
|
||||||
* @param macroDictionary The names and definitions of the macros used to disambiguate between
|
* @param macroDictionary The names and definitions of the macros used to disambiguate between
|
||||||
|
@ -168,7 +168,7 @@ public interface IIndex {
|
||||||
* for different sets of macro definitions.
|
* for different sets of macro definitions.
|
||||||
* This method may only return files that are actually managed by this fragment.
|
* This method may only return files that are actually managed by this fragment.
|
||||||
* This method returns files without content, also.
|
* This method returns files without content, also.
|
||||||
*
|
*
|
||||||
* @param linkageID the id of the linkage in which the file has been parsed.
|
* @param linkageID the id of the linkage in which the file has been parsed.
|
||||||
* @param location the IIndexFileLocation representing the location of the file
|
* @param location the IIndexFileLocation representing the location of the file
|
||||||
* @return the files for the location and the linkage.
|
* @return the files for the location and the linkage.
|
||||||
|
@ -246,7 +246,8 @@ public interface IIndex {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
* @since 4.0.2
|
* @since 4.0.2
|
||||||
*/
|
*/
|
||||||
public IIndexMacro[] findMacros(char[] name, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexMacro[] findMacros(char[] name, IndexFilter filter, IProgressMonitor monitor)
|
||||||
|
throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all macros with names that start with the given prefix.
|
* Searches for all macros with names that start with the given prefix.
|
||||||
|
@ -258,11 +259,13 @@ public interface IIndex {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
* @since 4.0.2
|
* @since 4.0.2
|
||||||
*/
|
*/
|
||||||
public IIndexMacro[] findMacrosForPrefix(char[] prefix, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexMacro[] findMacrosForPrefix(char[] prefix, IndexFilter filter,
|
||||||
|
IProgressMonitor monitor) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for the binding of a name. The name may be originated by
|
* Searches for the binding of a name. The name may be originated by
|
||||||
* an AST or by a search in an index. May return {@code null}.
|
* an AST or by a search in an index. May return {@code null}.
|
||||||
|
*
|
||||||
* @param name a name to find the binding for
|
* @param name a name to find the binding for
|
||||||
* @return the binding or {@code null}
|
* @return the binding or {@code null}
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -274,50 +277,55 @@ public interface IIndex {
|
||||||
* exists in multiple projects, no duplicate bindings are returned.
|
* exists 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}, 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}.
|
* @param monitor a monitor to report progress, may be {@code null}.
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
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
|
* 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
|
* the given array 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
|
* bindings are returned. You can search with an array of patterns that specifies a partial
|
||||||
* qualification only.
|
* qualification only.
|
||||||
* @param patterns an array of patterns the names of the qualified name of the bindings
|
*
|
||||||
|
* @param patterns an array of patterns the components of the qualified name of the bindings
|
||||||
* have to match.
|
* have to match.
|
||||||
* @param isFullyQualified if <code>true</code>, the array of pattern specifies the fully
|
* @param isFullyQualified if {@code true}, the array of pattern specifies the fully
|
||||||
* qualified name
|
* 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}.
|
* @param monitor a monitor to report progress, may be {@code null}.
|
||||||
* @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
|
* match the given pattern. In case a binding exists in multiple projects, no duplicate
|
||||||
* bindings are returned.
|
* bindings 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}
|
* @param monitor a monitor to report progress, may be {@code null}
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
IIndexBinding[] findMacroContainers(Pattern pattern, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
IIndexBinding[] findMacroContainers(Pattern pattern, IndexFilter filter, IProgressMonitor monitor)
|
||||||
|
throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all bindings in global scope with a given name. In case a binding exists in
|
* Searches for all bindings in global scope with a given name. In case a binding exists in
|
||||||
* multiple projects, no duplicate bindings are returned. This method makes use of the BTree
|
* multiple projects, no duplicate bindings are returned. This method makes use of the BTree
|
||||||
* and is faster than the methods using patterns.
|
* and is faster than the methods using patterns.
|
||||||
* <p>
|
*
|
||||||
* @param names an array of names, which has to be matched by the qualified name of
|
* @param names an array of names, which has to be matched by the qualified name of
|
||||||
* the bindings.
|
* 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
|
||||||
|
@ -325,7 +333,8 @@ public interface IIndex {
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public IIndexBinding[] findBindings(char[][] names, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexBinding[] findBindings(char[][] names, IndexFilter filter, IProgressMonitor monitor)
|
||||||
|
throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches the global scope for all bindings with a given name.
|
* Searches the global scope for all bindings with a given name.
|
||||||
|
@ -342,7 +351,8 @@ public interface IIndex {
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public IIndexBinding[] findBindings(char[] name, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexBinding[] findBindings(char[] name, IndexFilter filter, IProgressMonitor monitor)
|
||||||
|
throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches the global scope and optionally all other scopes for bindings with a given name.
|
* Searches the global scope and optionally all other scopes for bindings with a given name.
|
||||||
|
@ -356,10 +366,12 @@ public interface IIndex {
|
||||||
* @return an array of bindings matching the pattern
|
* @return an array of bindings matching the pattern
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public IIndexBinding[] findBindings(char[] name, boolean fileScopeOnly, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexBinding[] findBindings(char[] name, boolean fileScopeOnly, IndexFilter filter,
|
||||||
|
IProgressMonitor monitor) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all bindings with names that start with the given prefix.
|
* Searches for all bindings with names that start with the given prefix.
|
||||||
|
*
|
||||||
* @param prefix the prefix with which all returned bindings must start
|
* @param prefix the prefix with which all returned bindings must start
|
||||||
* @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
|
||||||
|
@ -367,16 +379,19 @@ public interface IIndex {
|
||||||
* @return an array of bindings with the prefix
|
* @return an array of bindings with the prefix
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public IIndexBinding[] findBindingsForPrefix(char[] prefix, boolean fileScopeOnly, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexBinding[] findBindingsForPrefix(char[] prefix, boolean fileScopeOnly,
|
||||||
|
IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @noreference This method is not intended to be referenced by clients.
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
public IIndexBinding[] findBindingsForContentAssist(char[] prefix, boolean fileScopeOnly, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
public IIndexBinding[] findBindingsForContentAssist(char[] prefix, boolean fileScopeOnly,
|
||||||
|
IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for all names that resolve to the given binding. You can limit the result to references, declarations
|
* Searches for all names that resolve to the given binding. The search can be limited to
|
||||||
* or definitions, or a combination of those.
|
* references, declarations or definitions, or a combination of those.
|
||||||
|
*
|
||||||
* @param binding a binding for which names are searched for
|
* @param binding a binding for which names are searched for
|
||||||
* @param flags a combination of {@link #FIND_DECLARATIONS}, {@link #FIND_DEFINITIONS},
|
* @param flags a combination of {@link #FIND_DECLARATIONS}, {@link #FIND_DEFINITIONS},
|
||||||
* {@link #FIND_REFERENCES} and {@link #SEARCH_ACROSS_LANGUAGE_BOUNDARIES}.
|
* {@link #FIND_REFERENCES} and {@link #SEARCH_ACROSS_LANGUAGE_BOUNDARIES}.
|
||||||
|
@ -422,23 +437,24 @@ public interface IIndex {
|
||||||
public IIndexName[] findDefinitions(IBinding binding) throws CoreException;
|
public IIndexName[] findDefinitions(IBinding binding) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an IIndexBinding for this IIndex that is equivalent to the specified binding,
|
* Returns an {@link IIndexBinding} for this index that is equivalent to the specified binding,
|
||||||
* or null if such a binding does not exist in this index. This is useful for adapting
|
* or null if such a binding does not exist in this index. This is useful for adapting
|
||||||
* bindings obtained from IIndex objects that might have been created for a different scope
|
* bindings obtained from IIndex objects that might have been created for a different scope
|
||||||
* or for IBinding objects obtained directly from the AST.
|
* or for IBinding objects obtained directly from the AST.
|
||||||
* @param binding
|
*
|
||||||
* @return an IIndexBinding for this IIndex that is equivalent to the specified binding
|
* @param binding an AST or an index binding
|
||||||
|
* @return an IIndexBinding for this index 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 the caller holds a read-lock.
|
||||||
*/
|
*/
|
||||||
public IIndexFileSet createFileSet();
|
public IIndexFileSet createFileSet();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of all files that are part of this index. If a file is parsed in two
|
* Returns an array of all files that are part of this index. If a file is parsed in two
|
||||||
* linkages, or in multiple fragments only one of the files will be returned.
|
* linkages or in multiple fragments, only one of the files will be returned.
|
||||||
*/
|
*/
|
||||||
public IIndexFile[] getAllFiles() throws CoreException;
|
public IIndexFile[] getAllFiles() throws CoreException;
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,9 @@
|
||||||
* 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)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.index;
|
package org.eclipse.cdt.internal.core.index;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
|
@ -17,8 +16,8 @@ import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public interface IIndexFragmentBinding extends IIndexBinding {
|
public interface IIndexFragmentBinding extends IIndexBinding {
|
||||||
IIndexFragmentBinding[] EMPTY_INDEX_BINDING_ARRAY= new IIndexFragmentBinding[0];
|
IIndexFragmentBinding[] EMPTY_INDEX_BINDING_ARRAY= {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the owner of the binding.
|
* Returns the owner of the binding.
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +28,7 @@ public interface IIndexFragmentBinding extends IIndexBinding {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
ILinkage getLinkage();
|
ILinkage getLinkage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this binding has any definitions associated with it
|
* Returns whether this binding has any definitions associated with it
|
||||||
* in its associated fragment.
|
* in its associated fragment.
|
||||||
|
@ -37,22 +36,22 @@ public interface IIndexFragmentBinding extends IIndexBinding {
|
||||||
boolean hasDefinition() throws CoreException;
|
boolean hasDefinition() throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this binding has a declaration or definition associated with
|
* Returns whether this binding has a declaration or definition associated with
|
||||||
* it in its associated fragment.
|
* it in its associated fragment.
|
||||||
*/
|
*/
|
||||||
boolean hasDeclaration() throws CoreException;
|
boolean hasDeclaration() throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the constant identifying the type of binding stored in the index
|
* Returns the constant identifying the type of binding stored in the index
|
||||||
*/
|
*/
|
||||||
int getBindingConstant();
|
int getBindingConstant();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the scope that contains this binding, or <code>null</code> for bindings in global scope.
|
* Returns the scope that contains this binding, or {@code null} for bindings in global scope.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
IIndexScope getScope();
|
IIndexScope getScope();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
|
@ -61,7 +60,8 @@ public interface IIndexFragmentBinding extends IIndexBinding {
|
||||||
IIndexFragmentBinding getOwner();
|
IIndexFragmentBinding getOwner();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a unique id for the binding within the fragment, or <code>null</code> for unknown bindings.
|
* Returns a unique id for the binding within the fragment, or {@code null} for unknown
|
||||||
|
* bindings.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
long getBindingID();
|
long getBindingID();
|
||||||
|
|
|
@ -6,14 +6,15 @@
|
||||||
* 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)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index;
|
package org.eclipse.cdt.internal.core.index;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexExtension;
|
||||||
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
import org.eclipse.cdt.core.parser.ISignificantMacros;
|
import org.eclipse.cdt.core.parser.ISignificantMacros;
|
||||||
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
|
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
|
||||||
|
@ -21,18 +22,18 @@ import org.eclipse.cdt.internal.core.pdom.YieldableIndexLock;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public class WritableCIndex extends CIndex implements IWritableIndex {
|
public class WritableCIndex extends CIndex implements IWritableIndex {
|
||||||
private boolean fIsWriteLocked= false;
|
private boolean fIsWriteLocked;
|
||||||
private Object fThread;
|
private Object fThread;
|
||||||
|
|
||||||
public WritableCIndex(IWritableIndexFragment writable) {
|
public WritableCIndex(IWritableIndexFragment writable) {
|
||||||
super(new IWritableIndexFragment[] {writable});
|
super(new IWritableIndexFragment[] { writable }, IIndexExtension.EMPTY_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWritableIndexFragment getWritableFragment() {
|
public IWritableIndexFragment getWritableFragment() {
|
||||||
return (IWritableIndexFragment) getFragments()[0];
|
return (IWritableIndexFragment) getFragments()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexFragmentFile getWritableFile(int linkageID, IIndexFileLocation location,
|
public IIndexFragmentFile getWritableFile(int linkageID, IIndexFileLocation location,
|
||||||
ISignificantMacros macroDictionary) throws CoreException {
|
ISignificantMacros macroDictionary) throws CoreException {
|
||||||
|
@ -116,7 +117,7 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
|
||||||
public void acquireWriteLock() throws InterruptedException {
|
public void acquireWriteLock() throws InterruptedException {
|
||||||
checkThread();
|
checkThread();
|
||||||
assert !fIsWriteLocked: "Multiple write locks is not allowed"; //$NON-NLS-1$
|
assert !fIsWriteLocked: "Multiple write locks is not allowed"; //$NON-NLS-1$
|
||||||
|
|
||||||
getWritableFragment().acquireWriteLock(getReadLockCount());
|
getWritableFragment().acquireWriteLock(getReadLockCount());
|
||||||
fIsWriteLocked= true;
|
fIsWriteLocked= true;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +131,6 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
|
||||||
public void releaseWriteLock(boolean flush) {
|
public void releaseWriteLock(boolean flush) {
|
||||||
checkThread();
|
checkThread();
|
||||||
assert fIsWriteLocked: "No write lock to be released"; //$NON-NLS-1$
|
assert fIsWriteLocked: "No write lock to be released"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
// Bug 297641: Result cache of read only providers needs to be cleared.
|
// Bug 297641: Result cache of read only providers needs to be cleared.
|
||||||
int establishReadlockCount = getReadLockCount();
|
int establishReadlockCount = getReadLockCount();
|
||||||
|
@ -140,7 +140,7 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
|
||||||
|
|
||||||
fIsWriteLocked= false;
|
fIsWriteLocked= false;
|
||||||
getWritableFragment().releaseWriteLock(establishReadlockCount, flush);
|
getWritableFragment().releaseWriteLock(establishReadlockCount, flush);
|
||||||
|
|
||||||
if (establishReadlockCount == 0) {
|
if (establishReadlockCount == 0) {
|
||||||
fThread= null;
|
fThread= null;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
|
||||||
throw new IllegalArgumentException("A writable index must not be used from multiple threads."); //$NON-NLS-1$
|
throw new IllegalArgumentException("A writable index must not be used from multiple threads."); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearResultCache() {
|
public void clearResultCache() {
|
||||||
assert fIsWriteLocked: "Need to hold a write lock to clear result caches"; //$NON-NLS-1$
|
assert fIsWriteLocked: "Need to hold a write lock to clear result caches"; //$NON-NLS-1$
|
||||||
|
@ -179,7 +179,7 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
|
||||||
return;
|
return;
|
||||||
target.transferIncluders(source);
|
target.transferIncluders(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transferContext(IIndexFragmentFile source, IIndexFragmentFile target) throws CoreException {
|
public void transferContext(IIndexFragmentFile source, IIndexFragmentFile target) throws CoreException {
|
||||||
if (source == null || target == null)
|
if (source == null || target == null)
|
||||||
|
|
|
@ -12,13 +12,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.provider;
|
package org.eclipse.cdt.internal.core.index.provider;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.index.IIndexManager;
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.index.provider.IIndexProvider;
|
import org.eclipse.cdt.core.index.provider.IIndexProvider;
|
||||||
|
@ -45,6 +38,13 @@ import org.eclipse.osgi.service.resolver.VersionRange;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
import org.osgi.framework.Version;
|
import org.osgi.framework.Version;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The IndexProviderManager is responsible for maintaining the set of index
|
* The IndexProviderManager is responsible for maintaining the set of index
|
||||||
* fragments contributed via the CIndex extension point.
|
* fragments contributed via the CIndex extension point.
|
||||||
|
@ -68,7 +68,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
private static final String ELEMENT_RO_INDEX_FRAGMENT_PROVIDER= "ReadOnlyIndexFragmentProvider"; //$NON-NLS-1$
|
private static final String ELEMENT_RO_INDEX_FRAGMENT_PROVIDER= "ReadOnlyIndexFragmentProvider"; //$NON-NLS-1$
|
||||||
private static final String ELEMENT_PROVIDER_USAGE= "FragmentProviderUsage"; //$NON-NLS-1$
|
private static final String ELEMENT_PROVIDER_USAGE= "FragmentProviderUsage"; //$NON-NLS-1$
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
private static final String
|
private static final String
|
||||||
ATTRIBUTE_CLASS = "class",
|
ATTRIBUTE_CLASS = "class",
|
||||||
ATTRIBUTE_NAVIGATION = "navigation",
|
ATTRIBUTE_NAVIGATION = "navigation",
|
||||||
ATTRIBUTE_CONTENT_ASSIST = "content_assist",
|
ATTRIBUTE_CONTENT_ASSIST = "content_assist",
|
||||||
|
@ -124,7 +124,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
providers.add(new ReadOnlyPDOMProviderBridge((IReadOnlyPDOMProvider) provider));
|
providers.add(new ReadOnlyPDOMProviderBridge((IReadOnlyPDOMProvider) provider));
|
||||||
usageSpecifications.add(element.getChildren(ELEMENT_PROVIDER_USAGE));
|
usageSpecifications.add(element.getChildren(ELEMENT_PROVIDER_USAGE));
|
||||||
} else {
|
} else {
|
||||||
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_0,
|
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_InvalidIndexProvider,
|
||||||
extension.getContributor().getName()));
|
extension.getContributor().getName()));
|
||||||
}
|
}
|
||||||
} else if (ELEMENT_RO_INDEX_FRAGMENT_PROVIDER.equals(element.getName())) {
|
} else if (ELEMENT_RO_INDEX_FRAGMENT_PROVIDER.equals(element.getName())) {
|
||||||
|
@ -134,10 +134,10 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
providers.add((IIndexFragmentProvider) provider);
|
providers.add((IIndexFragmentProvider) provider);
|
||||||
usageSpecifications.add(element.getChildren(ELEMENT_PROVIDER_USAGE));
|
usageSpecifications.add(element.getChildren(ELEMENT_PROVIDER_USAGE));
|
||||||
} else {
|
} else {
|
||||||
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_0,
|
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_InvalidIndexProvider,
|
||||||
extension.getContributor().getName()));
|
extension.getContributor().getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
|
@ -173,7 +173,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
result |= getOption(elem, ATTRIBUTE_SEARCH, IIndexManager.ADD_EXTENSION_FRAGMENTS_SEARCH);
|
result |= getOption(elem, ATTRIBUTE_SEARCH, IIndexManager.ADD_EXTENSION_FRAGMENTS_SEARCH);
|
||||||
result |= getOption(elem, ATTRIBUTE_TYPE_HIERARCHY, IIndexManager.ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY);
|
result |= getOption(elem, ATTRIBUTE_TYPE_HIERARCHY, IIndexManager.ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY);
|
||||||
result |= getOption(elem, ATTRIBUTE_EDITOR, IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
|
result |= getOption(elem, ATTRIBUTE_EDITOR, IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// No logging, we are generating a msg for the log.
|
// No logging, we are generating a msg for the log.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
@ -361,7 +361,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
final int length = fragmentProviders.length;
|
final int length = fragmentProviders.length;
|
||||||
|
|
||||||
IIndexFragmentProvider[] newProviders = new IIndexFragmentProvider[length + 1];
|
IIndexFragmentProvider[] newProviders = new IIndexFragmentProvider[length + 1];
|
||||||
System.arraycopy(fragmentProviders, 0, newProviders, 0, length);
|
System.arraycopy(fragmentProviders, 0, newProviders, 0, length);
|
||||||
newProviders[length] = (IIndexFragmentProvider) provider;
|
newProviders[length] = (IIndexFragmentProvider) provider;
|
||||||
|
@ -386,12 +386,12 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
final int length = fragmentProviders.length;
|
final int length = fragmentProviders.length;
|
||||||
IIndexFragmentProvider[] newProviders = new IIndexFragmentProvider[length - 1];
|
IIndexFragmentProvider[] newProviders = new IIndexFragmentProvider[length - 1];
|
||||||
System.arraycopy(fragmentProviders, 0, newProviders, 0, i);
|
System.arraycopy(fragmentProviders, 0, newProviders, 0, i);
|
||||||
System.arraycopy(fragmentProviders, i+1, newProviders, i, length-i-1);
|
System.arraycopy(fragmentProviders, i + 1, newProviders, i, length - i - 1);
|
||||||
fragmentProviders = newProviders;
|
fragmentProviders = newProviders;
|
||||||
|
|
||||||
int[] newFilters = new int[length - 1];
|
int[] newFilters = new int[length - 1];
|
||||||
System.arraycopy(fragmentProviderUsage, 0, newFilters, 0, i);
|
System.arraycopy(fragmentProviderUsage, 0, newFilters, 0, i);
|
||||||
System.arraycopy(fragmentProviderUsage, i+1, newFilters, i, length-i-1);
|
System.arraycopy(fragmentProviderUsage, i + 1, newFilters, i, length - i - 1);
|
||||||
fragmentProviderUsage = newFilters;
|
fragmentProviderUsage = newFilters;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@ import org.eclipse.osgi.util.NLS;
|
||||||
public class Messages extends NLS {
|
public class Messages extends NLS {
|
||||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.index.provider.messages"; //$NON-NLS-1$
|
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.index.provider.messages"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static String IndexProviderManager_0;
|
public static String IndexProviderManager_InvalidIndexProvider;
|
||||||
public static String IndexProviderManager_NoCompatibleFragmentsAvailable;
|
public static String IndexProviderManager_NoCompatibleFragmentsAvailable;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// initialize resource bundle
|
// Initialize resource bundle
|
||||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# Symbian Software Limited - initial API and implementation
|
# Symbian Software Limited - initial API and implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
IndexProviderManager_0=Ignoring unrecognized implementation of IIndexProvider contributed by {0}
|
IndexProviderManager_InvalidIndexProvider=Ignoring unrecognized implementation of IIndexProvider contributed by {0}
|
||||||
IndexProviderManager_NoCompatibleFragmentsAvailable=No compatible index fragment found for fragment id: {0}, found versions {1}.
|
IndexProviderManager_NoCompatibleFragmentsAvailable=No compatible index fragment found for fragment id: {0}, found versions {1}.
|
||||||
|
|
|
@ -112,14 +112,14 @@ PDOMProviderName=PDOM Provider
|
||||||
|
|
||||||
fastIndexer.name=Fast Indexer
|
fastIndexer.name=Fast Indexer
|
||||||
|
|
||||||
# built-in languages
|
# Built-in languages
|
||||||
language.name.gcc= GNU C
|
language.name.gcc= GNU C
|
||||||
language.name.gpp= GNU C++
|
language.name.gpp= GNU C++
|
||||||
language.name.asm= Assembly
|
language.name.asm= Assembly
|
||||||
|
|
||||||
CConfigurationDataProvider.name = CConfigurationData provider
|
CConfigurationDataProvider.name = CConfigurationData provider
|
||||||
projectConverter.name = project converter
|
projectConverter.name = Project converter
|
||||||
CIndex.name = CIndex
|
CIndex.name = C/C++ Index
|
||||||
externalSettingsProvider.name = External Settings provider
|
externalSettingsProvider.name = External Settings provider
|
||||||
tagger.name = Parser Node Tagger Extension Point
|
tagger.name = Parser Node Tagger Extension Point
|
||||||
GeneratePDOMApplication.name = GeneratePDOM
|
GeneratePDOMApplication.name = GeneratePDOM
|
||||||
|
@ -128,10 +128,10 @@ templatesExtensionPoint.name = Templates Extension point
|
||||||
templateProcessTypes.name = Process Types Extension point
|
templateProcessTypes.name = Process Types Extension point
|
||||||
templateAssociations.name = Template Associations
|
templateAssociations.name = Template Associations
|
||||||
CProjectDescriptionStorage.name = Project Description Storage Extension point
|
CProjectDescriptionStorage.name = Project Description Storage Extension point
|
||||||
CProjectStorageType.singlefile.name = Xml Storage (single file)
|
CProjectStorageType.singlefile.name = XML Storage (single file)
|
||||||
CProjectStorageType.separatefile.name = Xml Storage (Separate Files)
|
CProjectStorageType.separatefile.name = XML Storage (Separate Files)
|
||||||
scannerInfoProvider2.name = Scanner Info Provider
|
scannerInfoProvider2.name = Scanner Info Provider
|
||||||
efsExtensionProvider.name = EFSExtensionProvider
|
efsExtensionProvider.name = EFS Extension Provider
|
||||||
refreshExclusionFactory.name = Refresh Exclusion Factory
|
refreshExclusionFactory.name = Refresh Exclusion Factory
|
||||||
uncPathConverter.name = UNC Path Converter
|
uncPathConverter.name = UNC Path Converter
|
||||||
ScannerInfoExtensionLanguageSettingsProvider.name=Contributed ScannerInfo Entries
|
ScannerInfoExtensionLanguageSettingsProvider.name=Contributed ScannerInfo Entries
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.indexview;
|
package org.eclipse.cdt.internal.ui.indexview;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -35,13 +34,13 @@ import org.eclipse.cdt.internal.ui.search.CSearchQuery;
|
||||||
* This is the search query to be used for searching the PDOM.
|
* This is the search query to be used for searching the PDOM.
|
||||||
*/
|
*/
|
||||||
public class IndexViewSearchQuery extends CSearchQuery {
|
public class IndexViewSearchQuery extends CSearchQuery {
|
||||||
|
|
||||||
private IIndexBinding fBinding;
|
private IIndexBinding fBinding;
|
||||||
private long fLastWrite;
|
private long fLastWrite;
|
||||||
private String fName;
|
private String fName;
|
||||||
private ICProject fProject;
|
private ICProject fProject;
|
||||||
|
|
||||||
public IndexViewSearchQuery(ICElement[] scope, ICProject project, long pdomLastWrite, IIndexBinding binding, String name, int flags) {
|
public IndexViewSearchQuery(ICElement[] scope, ICProject project, long pdomLastWrite,
|
||||||
|
IIndexBinding binding, String name, int flags) {
|
||||||
super(scope, flags);
|
super(scope, flags);
|
||||||
fProject= project;
|
fProject= project;
|
||||||
fBinding = binding;
|
fBinding = binding;
|
||||||
|
@ -57,7 +56,7 @@ public class IndexViewSearchQuery extends CSearchQuery {
|
||||||
}
|
}
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0, e.getLocalizedMessage(), e);
|
return new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue