1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixed compiler warnings.

This commit is contained in:
Sergey Prigogin 2011-10-17 18:37:53 -07:00
parent 9972595fc7
commit ef7a5f4f0b
19 changed files with 180 additions and 68 deletions

View file

@ -87,10 +87,12 @@ public interface IASTCastExpression extends IASTExpression {
/**
* @since 5.1
*/
@Override
public IASTCastExpression copy();
/**
* @since 5.3
*/
@Override
public IASTCastExpression copy(CopyStyle style);
}

View file

@ -44,8 +44,8 @@ public interface IIndexBinding extends IBinding {
IIndexFile getLocalToFile() throws CoreException;
/**
* {@inheritDoc}
* @since 5.1
*/
@Override
IIndexBinding getOwner();
}

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.core.index;
import org.eclipse.cdt.core.dom.ast.IFileNomination;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective;
import org.eclipse.cdt.core.parser.ISignificantMacros;
import org.eclipse.core.runtime.CoreException;
/**
@ -35,13 +34,6 @@ public interface IIndexFile extends IFileNomination {
*/
IIndexFileLocation getLocation() throws CoreException;
/**
* Returns the significant macros for this version of the file.
* @throws CoreException
* @since 5.4
*/
ISignificantMacros getSignificantMacros() throws CoreException;
/**
* Returns all includes found in this file.
* @return an array of all includes found in this file
@ -102,13 +94,6 @@ public interface IIndexFile extends IFileNomination {
*/
IIndexInclude getParsedInContext() throws CoreException;
/**
* Returns <code>true</code> if the file is a header with #pragma once statement or an include
* guard, or if it is a source file.
* @since 5.4
*/
public boolean hasPragmaOnceSemantics() throws CoreException;
/**
* Returns the id of the linkage this file was parsed in.
* @since 5.0

View file

@ -207,12 +207,14 @@ public interface IIndexManager extends IPDOMManager {
* Returns the id of the indexer working on the project.
* @since 4.0
*/
@Override
public String getIndexerId(ICProject project);
/**
* Changes the indexer working on the project.
* @since 4.0
*/
@Override
public void setIndexerId(ICProject project, String indexerId);
/**

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Ferguson (Symbian) - Initial implementation
* Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/
package org.eclipse.cdt.core.index;
import org.eclipse.cdt.internal.core.index.IndexFileLocation;
@ -16,15 +16,13 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
/**
* A location converter for converting project resource locations to be relative to a specified container.
* Resources outside of the associated project will not be converted (ignored).
* A location converter for converting project resource locations to be relative to a specified
* container. Resources outside of the associated project will not be converted (ignored).
* <br>
* This location converter is internal-representation-compatible with URIRelativeLocationConverter
*/
/*
* Internal representation is a relative path
*/
public class ResourceContainerRelativeLocationConverter implements IIndexLocationConverter {
protected IWorkspaceRoot root;
protected IPath fullPath;
@ -36,18 +34,13 @@ public class ResourceContainerRelativeLocationConverter implements IIndexLocatio
this.fullPath = container.getFullPath();
this.root = ResourcesPlugin.getWorkspace().getRoot();
}
/*
* (non-Javadoc)
* @see org.eclipse.cdt.core.index.IIndexLocationConverter#fromInternalFormat(java.lang.String)
*/
@Override
public IIndexFileLocation fromInternalFormat(String raw) {
IResource member= root.getFile(fullPath.append(raw));
return new IndexFileLocation(member.getLocationURI(), member.getFullPath().toString());
}
/*
* (non-Javadoc)
* @see org.eclipse.cdt.core.index.IIndexLocationConverter#toInternalFormat(org.eclipse.cdt.core.index.IIndexFileLocation)
*/
@Override
public String toInternalFormat(IIndexFileLocation location) {
String sFullPath= location.getFullPath();
if(sFullPath!=null) {

View file

@ -39,6 +39,7 @@ public class URIRelativeLocationConverter implements IIndexLocationConverter {
this.baseURI = baseURI;
}
@Override
public IIndexFileLocation fromInternalFormat(String raw) {
String rawPath = URIUtil.toURI(raw).getRawPath();
if (rawPath.length() > 0 && rawPath.charAt(0) == '/')
@ -47,6 +48,7 @@ public class URIRelativeLocationConverter implements IIndexLocationConverter {
return new IndexFileLocation(uri, null);
}
@Override
public String toInternalFormat(IIndexFileLocation location) {
URI relative = baseURI.relativize(location.getURI());
return relative.isAbsolute() ? null : relative.getPath();

View file

@ -50,6 +50,7 @@ public class CModelListener implements IElementChangedListener, IResourceChangeL
fManager= manager;
}
@Override
public void elementChanged(ElementChangedEvent event) {
// Only respond to post change events
if (event.getType() != ElementChangedEvent.POST_CHANGE)
@ -151,6 +152,7 @@ public class CModelListener implements IElementChangedListener, IResourceChangeL
}
}
@Override
public void resourceChanged(IResourceChangeEvent event) {
if (event.getType() == IResourceChangeEvent.POST_BUILD) {
fManager.handlePostBuildEvent();

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
import org.eclipse.cdt.core.index.IndexerSetupParticipant;
@ -22,7 +21,6 @@ import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
import org.eclipse.core.resources.IProject;
public class CProjectDescriptionListener implements ICProjectDescriptionListener {
private PDOMManager fIndexManager;
private IndexerSetupParticipant fIndexerSetupParticipant;
@ -41,6 +39,7 @@ public class CProjectDescriptionListener implements ICProjectDescriptionListener
};
}
@Override
public void handleEvent(CProjectDescriptionEvent event) {
ICProjectDescription old= event.getOldCProjectDescription();
ICProjectDescription act= event.getNewCProjectDescription();

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
@ -25,12 +25,15 @@ class JobChangeListener implements IJobChangeListener {
fPDomManager= pdomManager;
}
@Override
public void aboutToRun(IJobChangeEvent event) {
}
@Override
public void awake(IJobChangeEvent event) {
}
@Override
public void done(IJobChangeEvent event) {
if (event.getJob().belongsTo(fPDomManager)) {
if (Job.getJobManager().find(fPDomManager).length == 0) {
@ -39,15 +42,18 @@ class JobChangeListener implements IJobChangeListener {
}
}
@Override
public void running(IJobChangeEvent event) {
}
@Override
public void scheduled(IJobChangeEvent event) {
if (event.getJob().belongsTo(fPDomManager)) {
fPDomManager.fireStateChange(IndexerStateEvent.STATE_BUSY);
}
}
@Override
public void sleeping(IJobChangeEvent event) {
}
}

View file

@ -28,19 +28,14 @@ import org.eclipse.core.runtime.CoreException;
* This class handles changes in language mappings for the PDOM by reindexing the appropriate projects.
* This class is a a work in progress and will be changed soon to be smarter about the resources it reindexes.
*/
public class LanguageMappingChangeListener implements
ILanguageMappingChangeListener {
public class LanguageMappingChangeListener implements ILanguageMappingChangeListener {
private IIndexManager fManager;
public LanguageMappingChangeListener(IIndexManager manager) {
fManager = manager;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ILanguageMappingChangeListener#handleLanguageMappingChangeEvent(org.eclipse.cdt.core.model.ILanguageMappingsChangeEvent)
*/
@Override
public void handleLanguageMappingChangeEvent(ILanguageMappingChangeEvent event) {
CModelManager manager = CModelManager.getDefault();
if (event.getType() == ILanguageMappingChangeEvent.TYPE_WORKSPACE) {

View file

@ -31,14 +31,17 @@ public class NotifyCModelManagerTask implements IPDOMIndexerTask {
fProject= project;
}
@Override
public IPDOMIndexer getIndexer() {
return null;
}
@Override
public IndexerProgress getProgressInformation() {
return new IndexerProgress();
}
@Override
public void run(IProgressMonitor monitor) throws InterruptedException {
IContentType ct1= Platform.getContentTypeManager().getContentType(CCorePlugin.CONTENT_TYPE_CXXHEADER);
IContentType ct2= Platform.getContentTypeManager().getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
@ -51,6 +54,7 @@ public class NotifyCModelManagerTask implements IPDOMIndexerTask {
}
}
@Override
public boolean acceptUrgentTask(IPDOMIndexerTask task) {
return false;
}

View file

@ -390,12 +390,14 @@ public class PDOM extends PlatformObject implements IPDOM {
}
}
@Override
public void addListener(IListener listener) {
if (listeners == null)
listeners = new LinkedList<IListener>();
listeners.add(listener);
}
@Override
public void removeListener(IListener listener) {
if (listeners == null)
return;
@ -422,6 +424,7 @@ public class PDOM extends PlatformObject implements IPDOM {
}
@Deprecated
@Override
public PDOMFile getFile(int linkageID, IIndexFileLocation location) throws CoreException {
PDOMLinkage linkage= getLinkage(linkageID);
if (linkage == null)
@ -429,6 +432,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return PDOMFile.findFile(linkage, getFileIndex(), location, locationConverter);
}
@Override
public PDOMFile getFile(int linkageID, IIndexFileLocation location,
ISignificantMacros macroDictionary) throws CoreException {
PDOMLinkage linkage= getLinkage(linkageID);
@ -443,6 +447,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return PDOMFile.findFile(linkage, getFileIndex(), location, locationConverter, macroDictionary);
}
@Override
public IIndexFragmentFile[] getFiles(int linkageID, IIndexFileLocation location) throws CoreException {
PDOMLinkage linkage= getLinkage(linkageID);
if (linkage == null)
@ -450,16 +455,20 @@ public class PDOM extends PlatformObject implements IPDOM {
return PDOMFile.findFiles(linkage, getFileIndex(), location, locationConverter);
}
@Override
public IIndexFragmentFile[] getFiles(IIndexFileLocation location) throws CoreException {
return PDOMFile.findFiles(this, getFileIndex(), location, locationConverter);
}
@Override
public IIndexFragmentFile[] getAllFiles() throws CoreException {
final List<PDOMFile> locations = new ArrayList<PDOMFile>();
getFileIndex().accept(new IBTreeVisitor() {
@Override
public int compare(long record) throws CoreException {
return 0;
}
@Override
public boolean visit(long record) throws CoreException {
PDOMFile file = PDOMFile.recreateFile(PDOM.this, record);
locations.add(file);
@ -516,6 +525,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return getFirstLinkageRecord() == 0;
}
@Override
public IIndexFragmentBinding findBinding(IASTName name) throws CoreException {
IBinding binding= name.resolveBinding();
if (binding != null) {
@ -553,6 +563,7 @@ public class PDOM extends PlatformObject implements IPDOM {
matchStack.add(matchesUpToLevel);
}
@Override
public boolean visit(IPDOMNode node) throws CoreException {
if (monitor.isCanceled())
throw new CoreException(Status.OK_STATUS);
@ -600,6 +611,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return false;
}
@Override
public void leave(IPDOMNode node) throws CoreException {
final int idx= currentPath.size()-1;
if (idx >= 0 && currentPath.get(idx) == node) {
@ -617,7 +629,9 @@ public class PDOM extends PlatformObject implements IPDOM {
return findBindings(new Pattern[] { pattern }, isFullyQualified, filter, monitor);
}
public IIndexFragmentBinding[] findBindings(Pattern[] patterns, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
@Override
public IIndexFragmentBinding[] findBindings(Pattern[] patterns, boolean isFullyQualified,
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
if (monitor == null) {
monitor= new NullProgressMonitor();
}
@ -710,7 +724,9 @@ public class PDOM extends PlatformObject implements IPDOM {
return null;
}
public IIndexFragmentBinding[] findMacroContainers(Pattern pattern, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
@Override
public IIndexFragmentBinding[] findMacroContainers(Pattern pattern, IndexFilter filter,
IProgressMonitor monitor) throws CoreException {
if (monitor == null) {
monitor= new NullProgressMonitor();
}
@ -747,7 +763,9 @@ public class PDOM extends PlatformObject implements IPDOM {
return result.toArray(new IIndexFragmentBinding[result.size()]);
}
public IIndexFragmentBinding[] findBindings(char[][] names, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
@Override
public IIndexFragmentBinding[] findBindings(char[][] names, IndexFilter filter,
IProgressMonitor monitor) throws CoreException {
return findBindings(names, true, filter, monitor);
}
@ -797,11 +815,13 @@ public class PDOM extends PlatformObject implements IPDOM {
return db.getRecPtr(LINKAGES);
}
@Override
public IIndexLinkage[] getLinkages() {
Collection<PDOMLinkage> values = getLinkageList();
return values.toArray(new IIndexLinkage[values.size()]);
}
@Override
public PDOMLinkage[] getLinkageImpls() {
Collection<PDOMLinkage> values = getLinkageList();
return values.toArray(new PDOMLinkage[values.size()]);
@ -822,6 +842,7 @@ public class PDOM extends PlatformObject implements IPDOM {
private long lastReadAccess= 0;
private long timeWriteLockAcquired;
@Override
public void acquireReadLock() throws InterruptedException {
long t = sDEBUG_LOCKS ? System.nanoTime() : 0;
synchronized (mutex) {
@ -845,6 +866,7 @@ public class PDOM extends PlatformObject implements IPDOM {
}
}
@Override
public void releaseReadLock() {
boolean clearCache= false;
synchronized (mutex) {
@ -948,12 +970,14 @@ public class PDOM extends PlatformObject implements IPDOM {
fireChange(event);
}
@Override
public boolean hasWaitingReaders() {
synchronized (mutex) {
return waitingReaders > 0;
}
}
@Override
public long getLastWriteAccess() {
return lastWriteAccess;
}
@ -966,6 +990,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return fLinkageIDCache.get(linkage.getLinkageID());
}
@Override
public IIndexFragmentBinding adaptBinding(IBinding binding) throws CoreException {
if (binding == null) {
return null;
@ -997,6 +1022,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return null;
}
@Override
public IIndexFragmentName[] findNames(IBinding binding, int options) throws CoreException {
ArrayList<IIndexFragmentName> names= new ArrayList<IIndexFragmentName>();
IIndexFragmentBinding myBinding= adaptBinding(binding);
@ -1079,6 +1105,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return true;
}
@Override
public IIndexFragmentInclude[] findIncludedBy(IIndexFragmentFile file) throws CoreException {
PDOMFile pdomFile= adaptFile(file);
if (pdomFile != null) {
@ -1105,6 +1132,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return fPath;
}
@Override
public IIndexFragmentBinding[] findBindingsForPrefix(char[] prefix, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
return findBindingsForPrefix(prefix, filescope, false, filter, monitor);
}
@ -1113,6 +1141,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return findBindingsForPrefixOrContentAssist(prefix, filescope, false, caseSensitive, filter, monitor);
}
@Override
public IIndexFragmentBinding[] findBindingsForContentAssist(char[] prefix, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
return findBindingsForPrefixOrContentAssist(prefix, filescope, true, false, filter, monitor);
}
@ -1143,11 +1172,14 @@ public class PDOM extends PlatformObject implements IPDOM {
return result.toArray(new IIndexFragmentBinding[result.size()]);
}
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
@Override
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, IndexFilter filter,
IProgressMonitor monitor) throws CoreException {
return findBindings(name, filescope, true, filter, monitor);
}
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope,
boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
ArrayList<IIndexFragmentBinding> result= new ArrayList<IIndexFragmentBinding>();
try {
for (PDOMLinkage linkage : getLinkageList()) {
@ -1203,7 +1235,9 @@ public class PDOM extends PlatformObject implements IPDOM {
return result.toArray(new IIndexFragmentBinding[result.size()]);
}
public IIndexMacro[] findMacros(char[] prefix, boolean isPrefix, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
@Override
public IIndexMacro[] findMacros(char[] prefix, boolean isPrefix, boolean isCaseSensitive,
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
ArrayList<IIndexMacro> result= new ArrayList<IIndexMacro>();
try {
for (PDOMLinkage linkage : getLinkageList()) {
@ -1221,6 +1255,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return result.toArray(new IIndexMacro[result.size()]);
}
@Override
public String getProperty(String propertyName) throws CoreException {
if (IIndexFragment.PROPERTY_FRAGMENT_FORMAT_ID.equals(propertyName)) {
return FRAGMENT_PROPERTY_VALUE_FORMAT_ID;
@ -1250,20 +1285,24 @@ public class PDOM extends PlatformObject implements IPDOM {
clearResultCache();
}
@Override
public void clearResultCache() {
synchronized (fResultCache) {
fResultCache.clear();
}
}
@Override
public long getCacheHits() {
return db.getCacheHits();
}
@Override
public long getCacheMisses() {
return db.getCacheMisses();
}
@Override
public void resetCacheCounters() {
db.resetCacheCounters();
}
@ -1272,6 +1311,7 @@ public class PDOM extends PlatformObject implements IPDOM {
db.flush();
}
@Override
public Object getCachedResult(Object key) {
synchronized (fResultCache) {
return fResultCache.get(key);
@ -1282,6 +1322,7 @@ public class PDOM extends PlatformObject implements IPDOM {
putCachedResult(key, result, true);
}
@Override
public Object putCachedResult(Object key, Object result, boolean replace) {
synchronized (fResultCache) {
Object old= fResultCache.put(key, result);
@ -1445,6 +1486,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return PDOMBinding.EMPTY_PDOMBINDING_ARRAY;
}
@Override
public IIndexFragmentFileSet createFileSet() {
return new PDOMFileSet();
}
@ -1589,6 +1631,7 @@ public class PDOM extends PlatformObject implements IPDOM {
}
}
@Override
public IIndexScope[] getInlineNamespaces() throws CoreException {
PDOMLinkage linkage = getLinkage(ILinkage.CPP_LINKAGE_ID);
if (linkage == null) {

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
@ -20,24 +20,27 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile;
import org.eclipse.core.runtime.CoreException;
public class PDOMFileSet implements IIndexFragmentFileSet {
private HashSet<Long> fFileIDs= new HashSet<Long>();
@Override
public void add(IIndexFragmentFile fragFile) {
PDOMFile pdomFile= (PDOMFile) fragFile;
fFileIDs.add(pdomFile.getRecord());
}
@Override
public void remove(IIndexFragmentFile fragFile) {
PDOMFile pdomFile= (PDOMFile) fragFile;
fFileIDs.remove(pdomFile.getRecord());
}
@Override
public boolean containsFileOfLocalBinding(IIndexFragmentBinding fb) throws CoreException {
PDOMBinding pdomBinding= (PDOMBinding) fb;
return fFileIDs.contains(pdomBinding.getLocalToFileRec());
}
@Override
public boolean contains(IIndexFragmentFile file) throws CoreException {
if (file instanceof PDOMFile) {
return fFileIDs.contains(((PDOMFile) file).getRecord());

View file

@ -122,6 +122,8 @@ public class PDOMManager implements IWritableIndexManager, IListener {
public PCL(ICProject prj) {
fProject= prj;
}
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if (fProject.getProject().isOpen()) {
onPreferenceChange(fProject, event);
@ -191,6 +193,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
fProjectDescriptionListener= new CProjectDescriptionListener(this);
fJobChangeListener= new JobChangeListener(this);
fPreferenceChangeListener= new IPreferenceChangeListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
onPreferenceChange(event);
}
@ -422,20 +425,24 @@ public class PDOMManager implements IWritableIndexManager, IListener {
return project.getElementName() + "." + time + ".pdom"; //$NON-NLS-1$//$NON-NLS-2$
}
@Override
public String getDefaultIndexerId() {
return getIndexerId(null);
}
@Override
public void setDefaultIndexerId(String indexerId) {
IndexerPreferences.setDefaultIndexerId(indexerId);
}
public String getIndexerId(ICProject project) {
@Override
public String getIndexerId(ICProject project) {
IProject prj= project != null ? project.getProject() : null;
return IndexerPreferences.get(prj, IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER);
}
public void setIndexerId(final ICProject project, String indexerId) {
@Override
public void setIndexerId(final ICProject project, String indexerId) {
IProject prj= project.getProject();
IndexerPreferences.set(prj, IndexerPreferences.KEY_INDEXER_ID, indexerId);
CCoreInternals.savePreferences(prj, IndexerPreferences.getScope(prj) == IndexerPreferences.SCOPE_PROJECT_SHARED);
@ -733,7 +740,8 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
}
public boolean isIndexerIdle() {
@Override
public boolean isIndexerIdle() {
return Job.getJobManager().find(this).length == 0;
}
@ -944,6 +952,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
}
@Override
public void reindex(final ICProject project) {
Job job= new Job(Messages.PDOMManager_notifyJob_label) {
@Override
@ -977,18 +986,22 @@ public class PDOMManager implements IWritableIndexManager, IListener {
job.schedule();
}
@Override
public void addIndexChangeListener(IIndexChangeListener listener) {
fChangeListeners.add(listener);
}
@Override
public void removeIndexChangeListener(IIndexChangeListener listener) {
fChangeListeners.remove(listener);
}
@Override
public void addIndexerStateListener(IIndexerStateListener listener) {
fStateListeners.add(listener);
}
@Override
public void removeIndexerStateListener(IIndexerStateListener listener) {
fStateListeners.remove(listener);
}
@ -1034,16 +1047,19 @@ public class PDOMManager implements IWritableIndexManager, IListener {
return;
}
Runnable notify= new Runnable() {
public void run() {
@Override
public void run() {
fIndexerStateEvent.setState(state);
Object[] listeners= fStateListeners.getListeners();
for (Object listener2 : listeners) {
final IIndexerStateListener listener = (IIndexerStateListener) listener2;
SafeRunner.run(new ISafeRunnable(){
public void handleException(Throwable exception) {
@Override
public void handleException(Throwable exception) {
CCorePlugin.log(exception);
}
public void run() throws Exception {
@Override
public void run() throws Exception {
listener.indexChanged(fIndexerStateEvent);
}
});
@ -1054,6 +1070,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
}
@Override
public void handleChange(PDOM pdom, final PDOM.ChangeEvent e) {
if (fChangeListeners.isEmpty()) {
return;
@ -1067,15 +1084,18 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (project != null) {
final ICProject finalProject= project;
Runnable notify= new Runnable() {
@Override
public void run() {
fIndexChangeEvent.setAffectedProject(finalProject, e);
Object[] listeners= fChangeListeners.getListeners();
for (Object listener2 : listeners) {
final IIndexChangeListener listener = (IIndexChangeListener) listener2;
SafeRunner.run(new ISafeRunnable(){
@Override
public void handleException(Throwable exception) {
CCorePlugin.log(exception);
}
@Override
public void run() throws Exception {
listener.indexChanged(fIndexChangeEvent);
}
@ -1087,6 +1107,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
}
@Override
public boolean joinIndexer(final int waitMaxMillis, final IProgressMonitor monitor) {
assert monitor != null;
Thread th= null;
@ -1169,22 +1190,27 @@ public class PDOMManager implements IWritableIndexManager, IListener {
return currentTicks;
}
@Override
public IWritableIndex getWritableIndex(ICProject project) throws CoreException {
return fIndexFactory.getWritableIndex(project);
}
@Override
public IIndex getIndex(ICProject project) throws CoreException {
return fIndexFactory.getIndex(new ICProject[] {project}, 0);
}
@Override
public IIndex getIndex(ICProject[] projects) throws CoreException {
return fIndexFactory.getIndex(projects, 0);
}
@Override
public IIndex getIndex(ICProject project, int options) throws CoreException {
return fIndexFactory.getIndex(new ICProject[] {project}, options);
}
@Override
public IIndex getIndex(ICProject[] projects, int options) throws CoreException {
return fIndexFactory.getIndex(projects, options);
}
@ -1294,6 +1320,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
}
@Override
public void export(ICProject project, String location, int options, IProgressMonitor monitor) throws CoreException {
TeamPDOMExportOperation operation= new TeamPDOMExportOperation(project);
operation.setTargetLocation(location);
@ -1313,16 +1340,19 @@ public class PDOMManager implements IWritableIndexManager, IListener {
pdom.setProperty(IIndexFragment.PROPERTY_FRAGMENT_ID, id);
}
@Override
public boolean isProjectIndexed(ICProject proj) {
return !IPDOMManager.ID_NO_INDEXER.equals(getIndexerId(proj));
}
@Override
public boolean isIndexerSetupPostponed(ICProject proj) {
synchronized (fSetupParticipants) {
return fPostponedProjects.contains(proj);
}
}
@Override
public void update(ICElement[] tuSelection, int options) throws CoreException {
Map<ICProject, List<ICElement>> projectsToElements= splitSelection(tuSelection);
for (Map.Entry<ICProject, List<ICElement>> entry : projectsToElements.entrySet()) {
@ -1427,12 +1457,15 @@ public class PDOMManager implements IWritableIndexManager, IListener {
fPostponedProjects.remove(cproject);
final IndexerSetupParticipant[] participants= fSetupParticipants.toArray(new IndexerSetupParticipant[fSetupParticipants.size()]);
Runnable notify= new Runnable() {
@Override
public void run() {
for (final IndexerSetupParticipant p : participants) {
SafeRunner.run(new ISafeRunnable(){
@Override
public void handleException(Throwable exception) {
CCorePlugin.log(exception);
}
@Override
public void run() throws Exception {
p.onIndexerSetup(cproject);
}
@ -1459,12 +1492,14 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
}
@Override
public void addIndexerSetupParticipant(IndexerSetupParticipant participant) {
synchronized (fSetupParticipants) {
fSetupParticipants.add(participant);
}
}
@Override
public void removeIndexerSetupParticipant(IndexerSetupParticipant participant) {
synchronized (fSetupParticipants) {
fSetupParticipants.remove(participant);

View file

@ -55,6 +55,7 @@ public class PDOMProxy implements IPDOM {
}
}
@Override
public synchronized void acquireReadLock() throws InterruptedException {
if (fDelegate != null) {
fDelegate.acquireReadLock();
@ -66,6 +67,7 @@ public class PDOMProxy implements IPDOM {
}
}
@Override
public IIndexMacro[] findMacros(char[] name, boolean isPrefix, boolean caseSensitive,
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
if (fDelegate != null)
@ -73,18 +75,21 @@ public class PDOMProxy implements IPDOM {
return IIndexMacro.EMPTY_INDEX_MACRO_ARRAY;
}
@Override
public synchronized IIndexFragmentBinding adaptBinding(IBinding binding) throws CoreException {
if (fDelegate != null)
return fDelegate.adaptBinding(binding);
return null;
}
@Override
public synchronized IIndexFragmentBinding findBinding(IASTName astName) throws CoreException {
if (fDelegate != null)
return fDelegate.findBinding(astName);
return null;
}
@Override
public synchronized IIndexFragmentBinding[] findBindings(char[][] names, IndexFilter filter,
IProgressMonitor monitor) throws CoreException {
if (fDelegate != null)
@ -93,6 +98,7 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
}
@Override
public synchronized IIndexFragmentBinding[] findBindings(Pattern[] patterns, boolean isFullyQualified,
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
if (fDelegate != null)
@ -101,6 +107,7 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
}
@Override
public synchronized IIndexFragmentBinding[] findBindings(char[] name, boolean filescope,
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
if (fDelegate != null)
@ -109,6 +116,7 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
}
@Override
public synchronized IIndexFragmentBinding[] findBindingsForPrefix(char[] prefix, boolean filescope,
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
if (fDelegate != null)
@ -117,6 +125,7 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
}
@Override
public synchronized IIndexFragmentBinding[] findBindingsForContentAssist(char[] prefix, boolean filescope,
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
if (fDelegate != null)
@ -125,6 +134,7 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
}
@Override
public synchronized IIndexFragmentInclude[] findIncludedBy(IIndexFragmentFile file) throws CoreException {
if (fDelegate != null)
return fDelegate.findIncludedBy(file);
@ -132,6 +142,7 @@ public class PDOMProxy implements IPDOM {
return new IIndexFragmentInclude[0];
}
@Override
public synchronized IIndexFragmentName[] findNames(IBinding binding, int flags)
throws CoreException {
if (fDelegate != null)
@ -140,6 +151,7 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentName.EMPTY_NAME_ARRAY;
}
@Override
public synchronized long getCacheHits() {
if (fDelegate != null)
return fDelegate.getCacheHits();
@ -147,6 +159,7 @@ public class PDOMProxy implements IPDOM {
return 0;
}
@Override
public synchronized long getCacheMisses() {
if (fDelegate != null)
return fDelegate.getCacheMisses();
@ -155,6 +168,7 @@ public class PDOMProxy implements IPDOM {
}
@Deprecated
@Override
public synchronized IIndexFragmentFile getFile(int linkageID, IIndexFileLocation location) throws CoreException {
if (fDelegate != null)
return fDelegate.getFile(linkageID, location);
@ -162,6 +176,7 @@ public class PDOMProxy implements IPDOM {
return null;
}
@Override
public IIndexFragmentFile getFile(int linkageID, IIndexFileLocation location,
ISignificantMacros sigMacros) throws CoreException {
if (fDelegate != null)
@ -170,6 +185,7 @@ public class PDOMProxy implements IPDOM {
return null;
}
@Override
public IIndexFragmentFile[] getFiles(int linkageID, IIndexFileLocation location)
throws CoreException {
if (fDelegate != null)
@ -178,6 +194,7 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentFile.EMPTY_ARRAY;
}
@Override
public synchronized IIndexFragmentFile[] getFiles(IIndexFileLocation location) throws CoreException {
if (fDelegate != null)
return fDelegate.getFiles(location);
@ -185,6 +202,7 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentFile.EMPTY_ARRAY;
}
@Override
public synchronized long getLastWriteAccess() {
if (fDelegate != null)
return fDelegate.getLastWriteAccess();
@ -192,6 +210,7 @@ public class PDOMProxy implements IPDOM {
return 0;
}
@Override
public synchronized IIndexLinkage[] getLinkages() {
if (fDelegate != null)
return fDelegate.getLinkages();
@ -199,6 +218,7 @@ public class PDOMProxy implements IPDOM {
return new IIndexLinkage[0];
}
@Override
public synchronized String getProperty(String propertyName) throws CoreException {
if (fDelegate != null)
return fDelegate.getProperty(propertyName);
@ -206,6 +226,7 @@ public class PDOMProxy implements IPDOM {
return null;
}
@Override
public synchronized void releaseReadLock() {
// read-locks not forwarded to delegate need to be released here
if (fReadLockCount > 0) {
@ -217,10 +238,12 @@ public class PDOMProxy implements IPDOM {
}
}
@Override
public boolean hasWaitingReaders() {
return fDelegate != null && fDelegate.hasWaitingReaders();
}
@Override
public synchronized void resetCacheCounters() {
if (fDelegate != null)
fDelegate.resetCacheCounters();
@ -234,6 +257,7 @@ public class PDOMProxy implements IPDOM {
return null;
}
@Override
public synchronized void addListener(IListener listener) {
if (fDelegate != null) {
fDelegate.addListener(listener);
@ -242,6 +266,7 @@ public class PDOMProxy implements IPDOM {
}
}
@Override
public synchronized PDOMLinkage[] getLinkageImpls() {
if (fDelegate != null)
return fDelegate.getLinkageImpls();
@ -249,6 +274,7 @@ public class PDOMProxy implements IPDOM {
return new PDOMLinkage[0];
}
@Override
public synchronized void removeListener(IListener listener) {
if (fDelegate != null) {
fDelegate.removeListener(listener);
@ -280,19 +306,19 @@ public class PDOMProxy implements IPDOM {
}
}
@Override
public IIndexFragmentFileSet createFileSet() {
return new PDOMFileSet();
}
@Override
public synchronized IIndexFragmentFile[] getAllFiles() throws CoreException {
if (fDelegate != null)
return fDelegate.getAllFiles();
return IIndexFragmentFile.EMPTY_ARRAY;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.index.IIndexFragment#findMacroContainers(java.util.regex.Pattern, org.eclipse.cdt.core.index.IndexFilter, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public synchronized IIndexFragmentBinding[] findMacroContainers(Pattern pattern, IndexFilter filter,
IProgressMonitor monitor) throws CoreException {
if (fDelegate != null) {
@ -301,19 +327,23 @@ public class PDOMProxy implements IPDOM {
return IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
}
@Override
public Object getCachedResult(Object key) {
return null;
}
@Override
public Object putCachedResult(Object key, Object value, boolean replace) {
return value;
}
@Override
public void clearResultCache() {
if (fDelegate != null)
fDelegate.clearResultCache();
}
@Override
public IIndexScope[] getInlineNamespaces() throws CoreException {
if (fDelegate != null)
return fDelegate.getInlineNamespaces();

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
@ -50,7 +50,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
public class TeamPDOMExportOperation implements IWorkspaceRunnable {
/**
* Option constant (value:1) to indicate that a resource snapshot
* should be saved along with the exported PDOM.
@ -84,6 +83,7 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
fMessageDigest= md;
}
@Override
public void run(IProgressMonitor monitor) throws CoreException {
getMessageDigest();
getTargetLocation();

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
@ -82,6 +82,7 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
fShowActivity= PDOMIndexerTask.checkDebugOption(IPDOMIndexerTask.TRACE_ACTIVITY, "true"); //$NON-NLS-1$
}
@Override
public void run(IProgressMonitor pm) {
if (fShowActivity) {
System.out.println("Indexer: PDOMImporter start"); //$NON-NLS-1$

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
@ -30,13 +30,19 @@ public class WaitForRefreshJobs extends IndexerSetupParticipant {
private Set<Job> fRefreshJobs= Collections.synchronizedSet(new HashSet<Job>());
private IJobChangeListener fJobListener= new IJobChangeListener() {
@Override
public void sleeping(IJobChangeEvent event) {}
@Override
public void scheduled(IJobChangeEvent event) {}
@Override
public void running(IJobChangeEvent event) {}
@Override
public void done(IJobChangeEvent event) {
onJobDone(event.getJob());
}
@Override
public void awake(IJobChangeEvent event) {}
@Override
public void aboutToRun(IJobChangeEvent event) {}
};

View file

@ -73,6 +73,7 @@ public class WritablePDOM extends PDOM implements IWritableIndexFragment {
return super.addFile(linkageID, location, sigMacros);
}
@Override
public IIndexFragmentFile addUncommittedFile(int linkageID, IIndexFileLocation location,
ISignificantMacros significantMacros) throws CoreException {
uncommittedKey = new FileContentKey(linkageID, location, significantMacros);
@ -82,6 +83,7 @@ public class WritablePDOM extends PDOM implements IWritableIndexFragment {
return uncommittedFile;
}
@Override
public IIndexFragmentFile commitUncommittedFile() throws CoreException {
if (uncommittedFile == null)
return null;
@ -102,6 +104,7 @@ public class WritablePDOM extends PDOM implements IWritableIndexFragment {
return file;
}
@Override
public void clearUncommittedFile() throws CoreException {
if (uncommittedFile != null) {
try {
@ -115,6 +118,7 @@ public class WritablePDOM extends PDOM implements IWritableIndexFragment {
}
}
@Override
public void addFileContent(IIndexFragmentFile sourceFile, IncludeInformation[] includes,
IASTPreprocessorStatement[] macros, IASTName[][] names, ASTFilePathResolver pathResolver,
YieldableIndexLock lock) throws CoreException, InterruptedException {
@ -139,6 +143,7 @@ public class WritablePDOM extends PDOM implements IWritableIndexFragment {
}
}
@Override
public void clearFile(IIndexFragmentFile file) throws CoreException {
assert file.getIndexFragment() == this;
IIndexFileLocation location = file.getLocation();
@ -158,10 +163,7 @@ public class WritablePDOM extends PDOM implements IWritableIndexFragment {
super.flush();
}
/*
* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.index.IWritableIndexFragment#setProperty(java.lang.String, java.lang.String)
*/
@Override
public void setProperty(String propertyName, String value) throws CoreException {
if (IIndexFragment.PROPERTY_FRAGMENT_FORMAT_ID.equals(propertyName)
|| IIndexFragment.PROPERTY_FRAGMENT_FORMAT_VERSION.equals(propertyName)) {
@ -183,9 +185,11 @@ public class WritablePDOM extends PDOM implements IWritableIndexFragment {
public void rewriteLocations(final IIndexLocationConverter newConverter) throws CoreException {
final List<PDOMFile> pdomfiles = new ArrayList<PDOMFile>();
getFileIndex().accept(new IBTreeVisitor() {
@Override
public int compare(long record) throws CoreException {
return 0;
}
@Override
public boolean visit(long record) throws CoreException {
PDOMFile file = PDOMFile.recreateFile(WritablePDOM.this, record);
pdomfiles.add(file);