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;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
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.IProgressMonitor;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Interface for accessing the index for one or more projects.
|
||||
*
|
||||
|
@ -60,7 +60,7 @@ public interface IIndex {
|
|||
final int FIND_REFERENCES = 0x4;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
final int SEARCH_ACROSS_LANGUAGE_BOUNDARIES= 0x8;
|
||||
|
@ -246,7 +246,8 @@ public interface IIndex {
|
|||
* @throws CoreException
|
||||
* @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.
|
||||
|
@ -258,11 +259,13 @@ public interface IIndex {
|
|||
* @throws CoreException
|
||||
* @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
|
||||
* an AST or by a search in an index. May return {@code null}.
|
||||
*
|
||||
* @param name a name to find the binding for
|
||||
* @return the binding or {@code null}
|
||||
* @throws CoreException
|
||||
|
@ -274,50 +277,55 @@ public interface IIndex {
|
|||
* exists in multiple projects, no duplicate bindings are returned.
|
||||
* This is fully equivalent to
|
||||
* <pre>
|
||||
* findBindings(new Pattern[]{pattern}, isFullyQualified, filter, monitor);
|
||||
* findBindings(new Pattern[] {pattern}, isFullyQualified, filter, monitor);
|
||||
* </pre>
|
||||
* @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 monitor a monitor to report progress, may be {@code null}.
|
||||
* @return an array of bindings matching the pattern
|
||||
* @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
|
||||
* 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
|
||||
* 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.
|
||||
* @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
|
||||
* @param filter a filter that allows for skipping parts of the index
|
||||
* @param monitor a monitor to report progress, may be {@code null}.
|
||||
* @return an array of bindings matching the pattern
|
||||
* @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
|
||||
* match the given pattern. In case a binding exists in multiple projects, no duplicate
|
||||
* bindings are returned.
|
||||
*
|
||||
* @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 monitor a monitor to report progress, may be {@code null}
|
||||
* @return an array of bindings matching the pattern
|
||||
* @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
|
||||
* multiple projects, no duplicate bindings are returned. This method makes use of the BTree
|
||||
* 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
|
||||
* the bindings.
|
||||
* @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
|
||||
* @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.
|
||||
|
@ -342,7 +351,8 @@ public interface IIndex {
|
|||
* @return an array of bindings matching the pattern
|
||||
* @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.
|
||||
|
@ -356,10 +366,12 @@ public interface IIndex {
|
|||
* @return an array of bindings matching the pattern
|
||||
* @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.
|
||||
*
|
||||
* @param prefix the prefix with which all returned bindings must start
|
||||
* @param fileScopeOnly if true, only bindings at file scope are returned
|
||||
* @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
|
||||
* @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.
|
||||
*/
|
||||
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
|
||||
* or definitions, or a combination of those.
|
||||
* Searches for all names that resolve to the given binding. The search can be limited to
|
||||
* references, declarations or definitions, or a combination of those.
|
||||
*
|
||||
* @param binding a binding for which names are searched for
|
||||
* @param flags a combination of {@link #FIND_DECLARATIONS}, {@link #FIND_DEFINITIONS},
|
||||
* {@link #FIND_REFERENCES} and {@link #SEARCH_ACROSS_LANGUAGE_BOUNDARIES}.
|
||||
|
@ -422,23 +437,24 @@ public interface IIndex {
|
|||
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
|
||||
* bindings obtained from IIndex objects that might have been created for a different scope
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.index;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
|
@ -17,7 +16,7 @@ import org.eclipse.cdt.core.index.IIndexBinding;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public interface IIndexFragmentBinding extends IIndexBinding {
|
||||
IIndexFragmentBinding[] EMPTY_INDEX_BINDING_ARRAY= new IIndexFragmentBinding[0];
|
||||
IIndexFragmentBinding[] EMPTY_INDEX_BINDING_ARRAY= {};
|
||||
|
||||
/**
|
||||
* Returns the owner of the binding.
|
||||
|
@ -48,7 +47,7 @@ public interface IIndexFragmentBinding extends IIndexBinding {
|
|||
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
|
||||
IIndexScope getScope();
|
||||
|
@ -61,7 +60,8 @@ public interface IIndexFragmentBinding extends IIndexBinding {
|
|||
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
|
||||
*/
|
||||
long getBindingID();
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
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.parser.ISignificantMacros;
|
||||
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
|
||||
|
@ -21,11 +22,11 @@ import org.eclipse.cdt.internal.core.pdom.YieldableIndexLock;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class WritableCIndex extends CIndex implements IWritableIndex {
|
||||
private boolean fIsWriteLocked= false;
|
||||
private boolean fIsWriteLocked;
|
||||
private Object fThread;
|
||||
|
||||
public WritableCIndex(IWritableIndexFragment writable) {
|
||||
super(new IWritableIndexFragment[] {writable});
|
||||
super(new IWritableIndexFragment[] { writable }, IIndexExtension.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,7 +132,6 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
|
|||
checkThread();
|
||||
assert fIsWriteLocked: "No write lock to be released"; //$NON-NLS-1$
|
||||
|
||||
|
||||
// Bug 297641: Result cache of read only providers needs to be cleared.
|
||||
int establishReadlockCount = getReadLockCount();
|
||||
if (establishReadlockCount == 0) {
|
||||
|
|
|
@ -12,13 +12,6 @@
|
|||
*******************************************************************************/
|
||||
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.index.IIndexManager;
|
||||
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.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
|
||||
* fragments contributed via the CIndex extension point.
|
||||
|
@ -124,7 +124,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
|||
providers.add(new ReadOnlyPDOMProviderBridge((IReadOnlyPDOMProvider) provider));
|
||||
usageSpecifications.add(element.getChildren(ELEMENT_PROVIDER_USAGE));
|
||||
} else {
|
||||
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_0,
|
||||
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_InvalidIndexProvider,
|
||||
extension.getContributor().getName()));
|
||||
}
|
||||
} else if (ELEMENT_RO_INDEX_FRAGMENT_PROVIDER.equals(element.getName())) {
|
||||
|
@ -134,7 +134,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
|||
providers.add((IIndexFragmentProvider) provider);
|
||||
usageSpecifications.add(element.getChildren(ELEMENT_PROVIDER_USAGE));
|
||||
} else {
|
||||
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_0,
|
||||
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_InvalidIndexProvider,
|
||||
extension.getContributor().getName()));
|
||||
}
|
||||
}
|
||||
|
@ -386,12 +386,12 @@ public final class IndexProviderManager implements IElementChangedListener {
|
|||
final int length = fragmentProviders.length;
|
||||
IIndexFragmentProvider[] newProviders = new IIndexFragmentProvider[length - 1];
|
||||
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;
|
||||
|
||||
int[] newFilters = new int[length - 1];
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ import org.eclipse.osgi.util.NLS;
|
|||
public class Messages extends NLS {
|
||||
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;
|
||||
|
||||
static {
|
||||
// initialize resource bundle
|
||||
// Initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
# Contributors:
|
||||
# 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}.
|
||||
|
|
|
@ -112,14 +112,14 @@ PDOMProviderName=PDOM Provider
|
|||
|
||||
fastIndexer.name=Fast Indexer
|
||||
|
||||
# built-in languages
|
||||
# Built-in languages
|
||||
language.name.gcc= GNU C
|
||||
language.name.gpp= GNU C++
|
||||
language.name.asm= Assembly
|
||||
|
||||
CConfigurationDataProvider.name = CConfigurationData provider
|
||||
projectConverter.name = project converter
|
||||
CIndex.name = CIndex
|
||||
projectConverter.name = Project converter
|
||||
CIndex.name = C/C++ Index
|
||||
externalSettingsProvider.name = External Settings provider
|
||||
tagger.name = Parser Node Tagger Extension Point
|
||||
GeneratePDOMApplication.name = GeneratePDOM
|
||||
|
@ -128,10 +128,10 @@ templatesExtensionPoint.name = Templates Extension point
|
|||
templateProcessTypes.name = Process Types Extension point
|
||||
templateAssociations.name = Template Associations
|
||||
CProjectDescriptionStorage.name = Project Description Storage Extension point
|
||||
CProjectStorageType.singlefile.name = Xml Storage (single file)
|
||||
CProjectStorageType.separatefile.name = Xml Storage (Separate Files)
|
||||
CProjectStorageType.singlefile.name = XML Storage (single file)
|
||||
CProjectStorageType.separatefile.name = XML Storage (Separate Files)
|
||||
scannerInfoProvider2.name = Scanner Info Provider
|
||||
efsExtensionProvider.name = EFSExtensionProvider
|
||||
efsExtensionProvider.name = EFS Extension Provider
|
||||
refreshExclusionFactory.name = Refresh Exclusion Factory
|
||||
uncPathConverter.name = UNC Path Converter
|
||||
ScannerInfoExtensionLanguageSettingsProvider.name=Contributed ScannerInfo Entries
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.ui.indexview;
|
||||
|
||||
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.
|
||||
*/
|
||||
public class IndexViewSearchQuery extends CSearchQuery {
|
||||
|
||||
private IIndexBinding fBinding;
|
||||
private long fLastWrite;
|
||||
private String fName;
|
||||
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);
|
||||
fProject= project;
|
||||
fBinding = binding;
|
||||
|
@ -57,7 +56,7 @@ public class IndexViewSearchQuery extends CSearchQuery {
|
|||
}
|
||||
return Status.OK_STATUS;
|
||||
} 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