mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Improved filtering of indexer problem markers.
This commit is contained in:
parent
f0657ffcaf
commit
2a1fa02cde
4 changed files with 32 additions and 17 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2005-04-05 Vladimir Hirsl
|
||||||
|
Improved filtering of indexer problem markers
|
||||||
|
|
||||||
|
* index/org/eclipse/cdt/core/index/IIndexDelta.java
|
||||||
|
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSourceIndexerRunner.java
|
||||||
|
* index/org/eclipse/cdt/internal/core/index/impl/IndexDelta.java
|
||||||
|
|
||||||
2005-03-30 Alain Magloire
|
2005-03-30 Alain Magloire
|
||||||
Patch from Alex Chapiro, tentative fix for PR 89662
|
Patch from Alex Chapiro, tentative fix for PR 89662
|
||||||
* utils/org/eclipse/cdt/utils/spawner/EnvironmentReader.java
|
* utils/org/eclipse/cdt/utils/spawner/EnvironmentReader.java
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.core.index;
|
package org.eclipse.cdt.core.index;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public interface IIndexDelta {
|
||||||
/**
|
/**
|
||||||
* @return Returns the files.
|
* @return Returns the files.
|
||||||
*/
|
*/
|
||||||
public ArrayList getFiles();
|
public List getFiles();
|
||||||
/**
|
/**
|
||||||
* @return Returns the project.
|
* @return Returns the project.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.ICLogConstants;
|
import org.eclipse.cdt.core.ICLogConstants;
|
||||||
import org.eclipse.cdt.core.dom.CDOM;
|
import org.eclipse.cdt.core.dom.CDOM;
|
||||||
|
@ -25,11 +27,13 @@ import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexDelta;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||||
import org.eclipse.cdt.core.parser.ParseError;
|
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.impl.IndexDelta;
|
||||||
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
|
||||||
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;
|
||||||
|
@ -62,7 +66,6 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
|
|
||||||
public void setFileTypes(String[] fileTypes) {
|
public void setFileTypes(String[] fileTypes) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void indexFile(IFile file) throws IOException {
|
protected void indexFile(IFile file) throws IOException {
|
||||||
|
@ -76,15 +79,14 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
//C or CPP?
|
//C or CPP?
|
||||||
ParserLanguage language = CoreModel.hasCCNature(resourceFile.getProject()) ?
|
ParserLanguage language = CoreModel.hasCCNature(resourceFile.getProject()) ?
|
||||||
ParserLanguage.CPP : ParserLanguage.C;
|
ParserLanguage.CPP : ParserLanguage.C;
|
||||||
|
IASTTranslationUnit tu = null;
|
||||||
try {
|
try {
|
||||||
long startTime = 0, parseTime = 0, endTime = 0;
|
long startTime = 0, parseTime = 0, endTime = 0;
|
||||||
|
|
||||||
if (AbstractIndexer.TIMING)
|
if (AbstractIndexer.TIMING)
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
IASTTranslationUnit tu = CDOM.getInstance().getASTService().getTranslationUnit(
|
tu = CDOM.getInstance().getASTService().getTranslationUnit(resourceFile,
|
||||||
resourceFile,
|
|
||||||
CDOM.getInstance().getCodeReaderFactory(CDOM.PARSE_SAVED_RESOURCES));
|
CDOM.getInstance().getCodeReaderFactory(CDOM.PARSE_SAVED_RESOURCES));
|
||||||
|
|
||||||
if (AbstractIndexer.TIMING)
|
if (AbstractIndexer.TIMING)
|
||||||
|
@ -136,9 +138,11 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report events
|
// Report events
|
||||||
// ArrayList filesTrav = requestor.getFilesTraversed();
|
if (tu != null) {
|
||||||
// IndexDelta indexDelta = new IndexDelta(resourceFile.getProject(),filesTrav, IIndexDelta.INDEX_FINISHED_DELTA);
|
List filesTrav = Arrays.asList(tu.getIncludeDirectives());
|
||||||
// CCorePlugin.getDefault().getCoreModel().getIndexManager().notifyListeners(indexDelta);
|
IndexDelta indexDelta = new IndexDelta(resourceFile.getProject(),filesTrav, IIndexDelta.INDEX_FINISHED_DELTA);
|
||||||
|
indexer.notifyListeners(indexDelta);
|
||||||
|
}
|
||||||
// Release all resources
|
// Release all resources
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,14 +236,18 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
|
|
||||||
if (markers.length > 0) {
|
if (markers.length > 0) {
|
||||||
IMarker tempMarker = null;
|
IMarker tempMarker = null;
|
||||||
Integer tempInt = null;
|
int nameStart = -1;
|
||||||
|
int nameLen = -1;
|
||||||
String tempMsgString = null;
|
String tempMsgString = null;
|
||||||
|
|
||||||
for (int i=0; i<markers.length; i++) {
|
for (int i=0; i<markers.length; i++) {
|
||||||
tempMarker = markers[i];
|
tempMarker = markers[i];
|
||||||
tempInt = (Integer) tempMarker.getAttribute(IMarker.LINE_NUMBER);
|
nameStart = ((Integer) tempMarker.getAttribute(IMarker.CHAR_START)).intValue();
|
||||||
|
nameLen = ((Integer) tempMarker.getAttribute(IMarker.CHAR_END)).intValue() - nameStart;
|
||||||
tempMsgString = (String) tempMarker.getAttribute(IMarker.MESSAGE);
|
tempMsgString = (String) tempMarker.getAttribute(IMarker.MESSAGE);
|
||||||
if (tempInt != null && tempInt.intValue()== sourceLineNumber &&
|
if (nameStart != -1 &&
|
||||||
|
nameStart == fileLoc.getNodeOffset() &&
|
||||||
|
nameLen == fileLoc.getNodeLength() &&
|
||||||
tempMsgString.equalsIgnoreCase(INDEXER_MARKER_PREFIX + errorMessage)) {
|
tempMsgString.equalsIgnoreCase(INDEXER_MARKER_PREFIX + errorMessage)) {
|
||||||
newProblem = false;
|
newProblem = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.impl;
|
package org.eclipse.cdt.internal.core.index.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.index.IIndexDelta;
|
import org.eclipse.cdt.core.index.IIndexDelta;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
public class IndexDelta implements IIndexDelta {
|
public class IndexDelta implements IIndexDelta {
|
||||||
|
|
||||||
private ArrayList files = null;
|
private List files = null;
|
||||||
private IProject project = null;
|
private IProject project = null;
|
||||||
private IndexDeltaType deltaType = null;
|
private IndexDeltaType deltaType = null;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class IndexDelta implements IIndexDelta {
|
||||||
* @param project
|
* @param project
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public IndexDelta(IProject project, ArrayList filesTrav) {
|
public IndexDelta(IProject project, List filesTrav) {
|
||||||
this(project,filesTrav,null);
|
this(project,filesTrav,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class IndexDelta implements IIndexDelta {
|
||||||
* @param project
|
* @param project
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public IndexDelta(IProject project, ArrayList filesTrav, IndexDeltaType indexDeltaType) {
|
public IndexDelta(IProject project, List filesTrav, IndexDeltaType indexDeltaType) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
this.files = filesTrav;
|
this.files = filesTrav;
|
||||||
this.deltaType = indexDeltaType;
|
this.deltaType = indexDeltaType;
|
||||||
|
@ -44,7 +44,7 @@ public class IndexDelta implements IIndexDelta {
|
||||||
/**
|
/**
|
||||||
* @return Returns the files.
|
* @return Returns the files.
|
||||||
*/
|
*/
|
||||||
public ArrayList getFiles() {
|
public List getFiles() {
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue