mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 04:15:35 +02:00
Changed indexer change notification to run as a job.
Some additiional ICDTIndexer changes.
This commit is contained in:
parent
7e8e3349ba
commit
50a283a448
6 changed files with 49 additions and 29 deletions
|
@ -1,3 +1,7 @@
|
|||
2005-03-29 Bogdan Gheorghe
|
||||
Changed indexer change notification to run as a job.
|
||||
Some additiional ICDTIndexer changes.
|
||||
|
||||
2005-03-29 Bogdan Gheorghe
|
||||
|
||||
Added cumulative timer to SouceIndexer/DOMIndexer.
|
||||
|
|
|
@ -10,10 +10,12 @@
|
|||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.index;
|
||||
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexer;
|
||||
import org.eclipse.cdt.internal.core.search.processing.IIndexJob;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
/**
|
||||
* @author Bogdan Gheorghe
|
||||
|
@ -105,10 +107,10 @@ public interface ICDTIndexer extends IIndexer {
|
|||
|
||||
/**
|
||||
* Returns if this indexer is enabled
|
||||
* @param p
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
public boolean isIndexEnabled(IProject p);
|
||||
public boolean isIndexEnabled(IProject project);
|
||||
|
||||
/**
|
||||
* Returns the storage used by this indexer.
|
||||
|
@ -116,4 +118,14 @@ public interface ICDTIndexer extends IIndexer {
|
|||
*/
|
||||
public IIndexStorage getIndexStorage();
|
||||
|
||||
/**
|
||||
* Returns the index for the given path.
|
||||
*
|
||||
* @param path
|
||||
* @param reuseExistingFile
|
||||
* @param createIfMissing
|
||||
* @return
|
||||
*/
|
||||
public IIndex getIndex(IPath path, boolean reuseExistingFile, boolean createIfMissing);
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.filetype.ICFileType;
|
||||
import org.eclipse.cdt.core.filetype.ICFileTypeConstants;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
||||
|
@ -81,14 +82,6 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
protected static final String INDEXER_MARKER_PREFIX = Util.bind("indexerMarker.prefix" ) + " "; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
protected static final String INDEXER_MARKER_ORIGINATOR = ICModelMarker.INDEXER_MARKER + ".originator"; //$NON-NLS-1$
|
||||
private static final String INDEXER_MARKER_PROCESSING = Util.bind( "indexerMarker.processing" ); //$NON-NLS-1$
|
||||
|
||||
|
||||
//IDs defined in plugin.xml for file types
|
||||
private final static String C_SOURCE_ID = "org.eclipse.cdt.core.fileType.c_source"; //$NON-NLS-1$
|
||||
private final static String C_HEADER_ID = "org.eclipse.cdt.core.fileType.c_header"; //$NON-NLS-1$
|
||||
private final static String CPP_SOURCE_ID = "org.eclipse.cdt.core.fileType.cxx_source"; //$NON-NLS-1$
|
||||
private final static String CPP_HEADER_ID = "org.eclipse.cdt.core.fileType.cxx_header"; //$NON-NLS-1$
|
||||
|
||||
|
||||
public AbstractIndexer() {
|
||||
super();
|
||||
|
@ -542,10 +535,10 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
|||
ICFileType type = CCorePlugin.getDefault().getFileType(fileToBeIndexed.getProject(),fileToBeIndexed.getName());
|
||||
if (type.isSource() || type.isHeader()){
|
||||
String id = type.getId();
|
||||
if (id.equals(AbstractIndexer.C_SOURCE_ID) ||
|
||||
id.equals(AbstractIndexer.CPP_SOURCE_ID) ||
|
||||
id.equals(AbstractIndexer.C_HEADER_ID) ||
|
||||
id.equals(AbstractIndexer.CPP_HEADER_ID))
|
||||
if (id.equals(ICFileTypeConstants.FT_C_SOURCE) ||
|
||||
id.equals(ICFileTypeConstants.FT_CXX_SOURCE) ||
|
||||
id.equals(ICFileTypeConstants.FT_C_HEADER) ||
|
||||
id.equals(ICFileTypeConstants.FT_CXX_HEADER))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,10 +34,13 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
|||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.ISafeRunnable;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
||||
/**
|
||||
* @author Bogdan Gheorghe
|
||||
|
@ -339,8 +342,26 @@ public class IndexManager extends JobManager{
|
|||
Object e = indexerMap.remove(project);
|
||||
} finally {
|
||||
monitor.exitWrite();
|
||||
ICDTIndexer indexer = this.getIndexerForProject(project);
|
||||
indexer.notifyIndexerChange(project);
|
||||
final ICDTIndexer indexer = this.getIndexerForProject(project);
|
||||
final IProject finalProject = project;
|
||||
|
||||
//Notify new indexer in a job of change
|
||||
Job job = new Job("Index Change Notification"){ //$NON-NLS-1$
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
Platform.run(new ISafeRunnable() {
|
||||
public void handleException(Throwable exception) {
|
||||
CCorePlugin.log(exception);
|
||||
}
|
||||
public void run() throws Exception {
|
||||
indexer.notifyIndexerChange(finalProject);
|
||||
}
|
||||
});
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
|
||||
job.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@ import org.eclipse.cdt.core.model.ICModel;
|
|||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsIndexer;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -97,16 +95,9 @@ public class IndexSelector {
|
|||
|
||||
IIndex index = null;
|
||||
|
||||
if (indexer != null){
|
||||
if (indexer instanceof SourceIndexer){
|
||||
SourceIndexer sourceIndexer = (SourceIndexer) indexer;
|
||||
index =sourceIndexer.getIndex(indexKeys[i], true /*reuse index file*/, false /*do not create if none*/);
|
||||
}
|
||||
else if (indexer instanceof CTagsIndexer){
|
||||
CTagsIndexer ctagsIndexer = (CTagsIndexer) indexer;
|
||||
index =ctagsIndexer.getIndex(indexKeys[i], true /*reuse index file*/, false /*do not create if none*/);
|
||||
}
|
||||
}
|
||||
if (indexer != null)
|
||||
index =indexer.getIndex(indexKeys[i], true /*reuse index file*/, false /*do not create if none*/);
|
||||
|
||||
if (index != null) indexes[count++] = index; // only consider indexes which are ready yet
|
||||
}
|
||||
if (count != length) {
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.cdt.core.search.ICSearchScope;
|
|||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.impl.Index;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.ReadWriteMonitor;
|
||||
import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
|
||||
|
|
Loading…
Add table
Reference in a new issue