mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Added offset and length parameters for index entries.
Refactoring of AbstractIndexer. Moved old parser specific stuff to the appropriate subclass.
This commit is contained in:
parent
81150f40fe
commit
6edbe49fa3
3 changed files with 2 additions and 10 deletions
|
@ -10,9 +10,6 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
@ -42,7 +39,6 @@ import org.eclipse.core.runtime.Path;
|
||||||
public class CGenerateIndexVisitor extends CASTVisitor {
|
public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
private DOMSourceIndexerRunner indexer;
|
private DOMSourceIndexerRunner indexer;
|
||||||
private IFile resourceFile;
|
private IFile resourceFile;
|
||||||
private List problems;
|
|
||||||
{
|
{
|
||||||
shouldVisitNames = true;
|
shouldVisitNames = true;
|
||||||
// shouldVisitDeclarations = false;
|
// shouldVisitDeclarations = false;
|
||||||
|
@ -64,7 +60,6 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
super();
|
super();
|
||||||
this.indexer = indexer;
|
this.indexer = indexer;
|
||||||
this.resourceFile = resourceFile;
|
this.resourceFile = resourceFile;
|
||||||
problems = new ArrayList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.eclipse.cdt.core.parser.ParseError;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
|
||||||
import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
|
import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
|
||||||
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
|
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
|
||||||
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer;
|
||||||
|
@ -79,7 +78,7 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
|
|
||||||
protected void indexFile(IFile file) throws IOException {
|
protected void indexFile(IFile file) throws IOException {
|
||||||
// Add the name of the file to the index
|
// Add the name of the file to the index
|
||||||
IndexedFileEntry indFile = output.addIndexedFile(file.getFullPath().toString());
|
output.addIndexedFile(file.getFullPath().toString());
|
||||||
|
|
||||||
int problems = indexer.indexProblemsEnabled(resourceFile.getProject());
|
int problems = indexer.indexProblemsEnabled(resourceFile.getProject());
|
||||||
setProblemMarkersEnabled(problems);
|
setProblemMarkersEnabled(problems);
|
||||||
|
@ -242,8 +241,6 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
* @see org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer#addMarkers(org.eclipse.core.resources.IFile, org.eclipse.core.resources.IFile, java.lang.Object, java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer#addMarkers(org.eclipse.core.resources.IFile, org.eclipse.core.resources.IFile, java.lang.Object, java.lang.Object)
|
||||||
*/
|
*/
|
||||||
protected void addMarkers(IFile tempFile, IFile originator, Object problem, Object location) {
|
protected void addMarkers(IFile tempFile, IFile originator, Object problem, Object location) {
|
||||||
String fileName;
|
|
||||||
int sourceLineNumber = -1;
|
|
||||||
String errorMessage = ""; //$NON-NLS-1$
|
String errorMessage = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
if (problem instanceof IASTProblem) {
|
if (problem instanceof IASTProblem) {
|
||||||
|
@ -259,7 +256,6 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
}
|
}
|
||||||
if (location != null && location instanceof IASTFileLocation) {
|
if (location != null && location instanceof IASTFileLocation) {
|
||||||
IASTFileLocation fileLoc = (IASTFileLocation) location;
|
IASTFileLocation fileLoc = (IASTFileLocation) location;
|
||||||
fileName = fileLoc.getFileName();
|
|
||||||
try {
|
try {
|
||||||
//we only ever add index markers on the file, so DEPTH_ZERO is far enough
|
//we only ever add index markers on the file, so DEPTH_ZERO is far enough
|
||||||
IMarker[] markers = tempFile.findMarkers(ICModelMarker.INDEXER_MARKER, true,IResource.DEPTH_ZERO);
|
IMarker[] markers = tempFile.findMarkers(ICModelMarker.INDEXER_MARKER, true,IResource.DEPTH_ZERO);
|
||||||
|
|
|
@ -426,6 +426,7 @@ public abstract class AbstractIndexer implements IIndexer,IIndexConstants, ICSea
|
||||||
public AddMarkerProblem(IFile file, IFile orig, Object problem, Object location) {
|
public AddMarkerProblem(IFile file, IFile orig, Object problem, Object location) {
|
||||||
super( file, orig );
|
super( file, orig );
|
||||||
this.problem = problem;
|
this.problem = problem;
|
||||||
|
this.location = location;
|
||||||
}
|
}
|
||||||
public boolean isAddProblem(){
|
public boolean isAddProblem(){
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue