mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Follow up for 150075, progress indication for indexer;
Cancel indexing on manual reindex request.
This commit is contained in:
parent
2d8f966f3b
commit
68fce7ef7c
50 changed files with 380 additions and 301 deletions
|
@ -18,7 +18,6 @@ import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
@ -57,8 +56,7 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
|
|
||||||
protected void setUp() throws CoreException {
|
protected void setUp() throws CoreException {
|
||||||
fCProject= CProjectHelper.createCCProject("__bugsTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
fCProject= CProjectHelper.createCCProject("__bugsTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||||
IPDOMIndexer indexer = CCoreInternals.getPDOMManager().getIndexer(fCProject);
|
CCoreInternals.getPDOMManager().reindex(fCProject);
|
||||||
indexer.reindex();
|
|
||||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
String content = "// comment \n#include \"header20061107.h\"\n";
|
String content = "// comment \n#include \"header20061107.h\"\n";
|
||||||
IFile file= TestSourceReader.createFile(fProject.getProject(), "intermed20061107.h", content);
|
IFile file= TestSourceReader.createFile(fProject.getProject(), "intermed20061107.h", content);
|
||||||
TestSourceReader.createFile(fProject.getProject(), "source20061107.cpp", "#include \"intermed20061107.h\"\n");
|
TestSourceReader.createFile(fProject.getProject(), "source20061107.cpp", "#include \"intermed20061107.h\"\n");
|
||||||
CCoreInternals.getPDOMManager().getIndexer(fProject).reindex();
|
CCoreInternals.getPDOMManager().reindex(fProject);
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@ import java.util.regex.Pattern;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class CCompositeTypeTests extends PDOMTestBase {
|
||||||
CCompositeTypeTests foo = null;
|
CCompositeTypeTests foo = null;
|
||||||
|
|
||||||
project = createProject("compositeTypeTests");
|
project = createProject("compositeTypeTests");
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ public class CFunctionTests extends PDOMTestBase {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
project = createProject("functionTests");
|
project = createProject("functionTests");
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,7 @@ public class CPPCompositeTypeTests extends PDOMTestBase {
|
||||||
CPPCompositeTypeTests foo = null;
|
CPPCompositeTypeTests foo = null;
|
||||||
|
|
||||||
project = createProject("compositeTypeTests");
|
project = createProject("compositeTypeTests");
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -21,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class CPPFieldTests extends PDOMTestBase {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
project = createProject("fieldTests");
|
project = createProject("fieldTests");
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -23,6 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class CPPFunctionTests extends PDOMTestBase {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
project = createProject("functionTests");
|
project = createProject("functionTests");
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ public class CPPVariableTests extends PDOMTestBase {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
project = createProject("variableTests");
|
project = createProject("variableTests");
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ public class CVariableTests extends PDOMTestBase {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
project = createProject("variableTests");
|
project = createProject("variableTests");
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -28,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
@ -47,7 +47,7 @@ public class ClassTests extends PDOMTestBase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
ICProject project = createProject("classTests");
|
ICProject project = createProject("classTests");
|
||||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
}
|
}
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import java.util.regex.Pattern;
|
||||||
import junit.framework.AssertionFailedError;
|
import junit.framework.AssertionFailedError;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -27,6 +26,7 @@ import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
@ -53,7 +53,7 @@ public class DefDeclTests extends PDOMTestBase {
|
||||||
String requiredName = "defDeclTests";
|
String requiredName = "defDeclTests";
|
||||||
ICProject cproject = createProject(requiredName);
|
ICProject cproject = createProject(requiredName);
|
||||||
this.projectName = cproject.getElementName();
|
this.projectName = cproject.getElementName();
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(cproject);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -24,6 +23,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class EnumerationTests extends PDOMTestBase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
ICProject project = createProject("enumerationTests");
|
ICProject project = createProject("enumerationTests");
|
||||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
}
|
}
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IIndexFile;
|
import org.eclipse.cdt.core.index.IIndexFile;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -53,7 +54,7 @@ public class FilesOnReindexTests extends PDOMTestBase {
|
||||||
IFile file = project.getProject().getFile("simple.cpp");
|
IFile file = project.getProject().getFile("simple.cpp");
|
||||||
performAssertions(file);
|
performAssertions(file);
|
||||||
pdom.releaseReadLock();
|
pdom.releaseReadLock();
|
||||||
CCorePlugin.getPDOMManager().getIndexer(project).reindex();
|
CCoreInternals.getPDOMManager().reindex(project);
|
||||||
|
|
||||||
// wait until the indexer is done
|
// wait until the indexer is done
|
||||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
|
@ -23,6 +22,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,7 @@ public class MethodTests extends PDOMTestBase {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
project = createProject("methodTests");
|
project = createProject("methodTests");
|
||||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -26,6 +25,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
@ -49,7 +49,7 @@ public class NamespaceTests extends PDOMTestBase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
ICProject project = createProject("namespaceTests", true);
|
ICProject project = createProject("namespaceTests", true);
|
||||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
}
|
}
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,13 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -41,7 +41,7 @@ public class OverloadsWithinCommonHeaderTests extends PDOMTestBase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
ICProject project = createProject("overloadsWithinCommonHeader", true);
|
ICProject project = createProject("overloadsWithinCommonHeader", true);
|
||||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
}
|
}
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -35,7 +35,7 @@ public class OverloadsWithinSingleTUTests extends PDOMTestBase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
ICProject project = createProject("overloadsWithinSingleTU");
|
ICProject project = createProject("overloadsWithinSingleTU");
|
||||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
}
|
}
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -28,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -54,7 +54,7 @@ public class PDOMSearchTest extends PDOMTestBase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
ICProject project = createProject("searchTests", true);
|
ICProject project = createProject("searchTests", true);
|
||||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
}
|
}
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class RaceCondition157992Test extends PDOMTestBase {
|
||||||
|
|
||||||
for(int i=0; i<noTrials; i++) {
|
for(int i=0; i<noTrials; i++) {
|
||||||
ICProject project = createProject("classTests");
|
ICProject project = createProject("classTests");
|
||||||
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
|
|
||||||
IBinding[] Bs = pdom.findBindings(Pattern.compile("B"), new NullProgressMonitor());
|
IBinding[] Bs = pdom.findBindings(Pattern.compile("B"), new NullProgressMonitor());
|
||||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -27,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class TypesTests extends PDOMTestBase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
ICProject project = createProject("types");
|
ICProject project = createProject("types");
|
||||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
}
|
}
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
@ -28,7 +27,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMManager;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCStructure;
|
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCStructure;
|
||||||
|
@ -144,7 +145,7 @@ public class AllTypesCache {
|
||||||
|
|
||||||
private static ITypeInfo[] getTypes(ICProject[] projects, int[] kinds) throws CoreException {
|
private static ITypeInfo[] getTypes(ICProject[] projects, int[] kinds) throws CoreException {
|
||||||
List types = new ArrayList();
|
List types = new ArrayList();
|
||||||
IPDOMManager pdomManager = CCorePlugin.getPDOMManager();
|
PDOMManager pdomManager = CCoreInternals.getPDOMManager();
|
||||||
|
|
||||||
for (int i = 0; i < projects.length; ++i) {
|
for (int i = 0; i < projects.length; ++i) {
|
||||||
ICProject project = projects[i];
|
ICProject project = projects[i];
|
||||||
|
|
|
@ -14,13 +14,13 @@ package org.eclipse.cdt.core.browser;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -121,7 +121,7 @@ public class PDOMTypeInfo implements ITypeInfo {
|
||||||
|
|
||||||
public ITypeReference getResolvedReference() {
|
public ITypeReference getResolvedReference() {
|
||||||
try {
|
try {
|
||||||
PDOM pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
PDOM pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
IName[] names= pdom.findNames(binding, IIndex.FIND_DEFINITIONS);
|
IName[] names= pdom.findNames(binding, IIndex.FIND_DEFINITIONS);
|
||||||
return names != null && names.length > 0 ? new PDOMTypeReference(names[0], project) : null;
|
return names != null && names.length > 0 ? new PDOMTypeReference(names[0], project) : null;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
|
|
@ -37,13 +37,19 @@ public interface IPDOMIndexerTask {
|
||||||
* Used by the framework to report progress.
|
* Used by the framework to report progress.
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public int getRemainingSubtaskCount();
|
public int estimateRemainingSources();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by the framework to report progress.
|
* Used by the framework to report progress.
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public int getCompletedSubtaskCount();
|
public int getCompletedSourcesCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by the framework to report progress.
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
public int getCompletedHeadersCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information about the current subtask.
|
* Returns information about the current subtask.
|
||||||
|
|
|
@ -24,14 +24,12 @@ public interface IPDOMManager {
|
||||||
public static final String ID_FAST_INDEXER= "org.eclipse.cdt.core.fastIndexer"; //$NON-NLS-1$
|
public static final String ID_FAST_INDEXER= "org.eclipse.cdt.core.fastIndexer"; //$NON-NLS-1$
|
||||||
public static final String ID_FULL_INDEXER= "org.eclipse.cdt.core.domsourceindexer"; //$NON-NLS-1$
|
public static final String ID_FULL_INDEXER= "org.eclipse.cdt.core.domsourceindexer"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Getting the PDOM
|
|
||||||
/**
|
/**
|
||||||
* mstodo deprecate: use CCorePlugin.getIndexManager().getIndex(...).
|
* Clears the entire index of the project and schedules the indexer.
|
||||||
|
* @throws CoreException
|
||||||
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public IPDOM getPDOM(ICProject project) throws CoreException;
|
public void reindex(ICProject project) throws CoreException;
|
||||||
|
|
||||||
// Get the indexer for a given project
|
|
||||||
public IPDOMIndexer getIndexer(ICProject project);
|
|
||||||
|
|
||||||
// Getting and setting indexer Ids
|
// Getting and setting indexer Ids
|
||||||
public String getDefaultIndexerId();
|
public String getDefaultIndexerId();
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class ASTCompletionNode {
|
||||||
* @return the prefix text up to the point of completion
|
* @return the prefix text up to the point of completion
|
||||||
*/
|
*/
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
return completionToken.getType() != IToken.tEOC ? completionToken.getImage() : "";
|
return completionToken.getType() != IToken.tEOC ? completionToken.getImage() : ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -371,7 +371,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return scanner.toString(); //$NON-NLS-1$
|
return scanner.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,7 +415,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
resolveAmbiguities();
|
resolveAmbiguities();
|
||||||
log.traceLog("Ambiguity resolution : " //$NON-NLS-1$
|
log.traceLog("Ambiguity resolution : " //$NON-NLS-1$
|
||||||
+ (System.currentTimeMillis() - startTime) + "ms" //$NON-NLS-1$
|
+ (System.currentTimeMillis() - startTime) + "ms" //$NON-NLS-1$
|
||||||
); //$NON-NLS-1$ //$NON-NLS-2$
|
);
|
||||||
IASTTranslationUnit result = getTranslationUnit();
|
IASTTranslationUnit result = getTranslationUnit();
|
||||||
nullifyTranslationUnit();
|
nullifyTranslationUnit();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -50,13 +50,21 @@ public class IndexBasedCodeReaderFactory implements ICodeReaderFactory {
|
||||||
|
|
||||||
private static final char[] EMPTY_CHARS = new char[0];
|
private static final char[] EMPTY_CHARS = new char[0];
|
||||||
|
|
||||||
|
private static class NeedToParseException extends Exception {}
|
||||||
public static class FileInfo {
|
public static class FileInfo {
|
||||||
private FileInfo() {}
|
private FileInfo() {}
|
||||||
public IIndexFile fFile= null;
|
public IIndexFile fFile= null;
|
||||||
public IMacro[] fMacros= null;
|
public IMacro[] fMacros= null;
|
||||||
public boolean fNeedToIndex= false;
|
private boolean fRequested= false;
|
||||||
|
|
||||||
|
public boolean isRequested() {
|
||||||
|
return fRequested;
|
||||||
}
|
}
|
||||||
private static class NeedToParseException extends Exception {}
|
public void setRequested(boolean val) {
|
||||||
|
fRequested= val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public IndexBasedCodeReaderFactory(IIndex index) {
|
public IndexBasedCodeReaderFactory(IIndex index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
@ -138,7 +146,7 @@ public class IndexBasedCodeReaderFactory implements ICodeReaderFactory {
|
||||||
if (!target.add(fileInfo)) {
|
if (!target.add(fileInfo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fileInfo.fFile == null || fileInfo.fNeedToIndex) {
|
if (fileInfo.fFile == null || fileInfo.isRequested()) {
|
||||||
throw new NeedToParseException();
|
throw new NeedToParseException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public class Messages extends NLS {
|
public class Messages extends NLS {
|
||||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.pdom.messages"; //$NON-NLS-1$
|
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.pdom.messages"; //$NON-NLS-1$
|
||||||
|
public static String PDOMManager_indexMonitorDetail;
|
||||||
public static String PDOMManager_JoinIndexerTask;
|
public static String PDOMManager_JoinIndexerTask;
|
||||||
public static String PDOMManager_notifyJob_label;
|
public static String PDOMManager_notifyJob_label;
|
||||||
public static String PDOMManager_notifyTask_message;
|
public static String PDOMManager_notifyTask_message;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
package org.eclipse.cdt.internal.core.pdom;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
|
import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
|
||||||
|
@ -29,7 +27,6 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
public class PDOMIndexerJob extends Job {
|
public class PDOMIndexerJob extends Job {
|
||||||
|
|
||||||
private final PDOMManager pdomManager;
|
private final PDOMManager pdomManager;
|
||||||
private int fCompletedSubtaskCount= 0;
|
|
||||||
private IPDOMIndexerTask currentTask;
|
private IPDOMIndexerTask currentTask;
|
||||||
private boolean cancelledByManager= false;
|
private boolean cancelledByManager= false;
|
||||||
private Object taskMutex = new Object();
|
private Object taskMutex = new Object();
|
||||||
|
@ -48,15 +45,10 @@ public class PDOMIndexerJob extends Job {
|
||||||
this.monitor = monitor;
|
this.monitor = monitor;
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
String taskName = CCorePlugin.getResourceString("pdom.indexer.task"); //$NON-NLS-1$
|
|
||||||
monitor.beginTask(taskName, IProgressMonitor.UNKNOWN);
|
|
||||||
startMonitorJob(monitor);
|
startMonitorJob(monitor);
|
||||||
try {
|
try {
|
||||||
do {
|
do {
|
||||||
synchronized(taskMutex) {
|
synchronized(taskMutex) {
|
||||||
if (currentTask != null) {
|
|
||||||
fCompletedSubtaskCount+= currentTask.getCompletedSubtaskCount();
|
|
||||||
}
|
|
||||||
currentTask= null;
|
currentTask= null;
|
||||||
taskMutex.notify();
|
taskMutex.notify();
|
||||||
|
|
||||||
|
@ -118,10 +110,13 @@ public class PDOMIndexerJob extends Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startMonitorJob(final IProgressMonitor monitor) {
|
private void startMonitorJob(final IProgressMonitor monitor) {
|
||||||
fMonitorJob= new Job("cdt indexer monitor job") { //$NON-NLS-1$
|
fMonitorJob= new Job(CCorePlugin.getResourceString("PDOMIndexerJob.updateMonitorJob")) { //$NON-NLS-1$
|
||||||
protected IStatus run(IProgressMonitor m) {
|
protected IStatus run(IProgressMonitor m) {
|
||||||
|
String taskName = CCorePlugin.getResourceString("pdom.indexer.task"); //$NON-NLS-1$
|
||||||
|
monitor.beginTask(taskName, 1000);
|
||||||
|
int currentTick= 0;
|
||||||
while(!m.isCanceled()) {
|
while(!m.isCanceled()) {
|
||||||
updateMonitor(monitor);
|
currentTick= pdomManager.getMonitorMessage(monitor, currentTick, 1000);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(350);
|
Thread.sleep(350);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -135,21 +130,6 @@ public class PDOMIndexerJob extends Job {
|
||||||
fMonitorJob.schedule();
|
fMonitorJob.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateMonitor(IProgressMonitor monitor) {
|
|
||||||
String detail= null;
|
|
||||||
synchronized(taskMutex) {
|
|
||||||
if (currentTask != null) {
|
|
||||||
detail= currentTask.getMonitorMessageDetail();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String msg= pdomManager.getMonitorMessage();
|
|
||||||
if (detail != null) {
|
|
||||||
msg= MessageFormat.format("{0}: {1}", new Object[] {msg, detail}); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor.subTask(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cancelJobs(IPDOMIndexer indexer) {
|
public void cancelJobs(IPDOMIndexer indexer) {
|
||||||
synchronized (taskMutex) {
|
synchronized (taskMutex) {
|
||||||
if (currentTask != null && currentTask.getIndexer() == indexer) {
|
if (currentTask != null && currentTask.getIndexer() == indexer) {
|
||||||
|
@ -165,13 +145,4 @@ public class PDOMIndexerJob extends Job {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCompletedSubtaskCount() {
|
|
||||||
synchronized (taskMutex) {
|
|
||||||
if (currentTask != null) {
|
|
||||||
return currentTask.getCompletedSubtaskCount() + fCompletedSubtaskCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fCompletedSubtaskCount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,8 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
private PDOMIndexerJob fIndexerJob;
|
private PDOMIndexerJob fIndexerJob;
|
||||||
private IPDOMIndexerTask fCurrentTask;
|
private IPDOMIndexerTask fCurrentTask;
|
||||||
private LinkedList fTaskQueue = new LinkedList();
|
private LinkedList fTaskQueue = new LinkedList();
|
||||||
|
private int fCompletedSources;
|
||||||
|
private int fCompletedHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores mapping from pdom to project, used to serialize\ creation of new pdoms.
|
* Stores mapping from pdom to project, used to serialize\ creation of new pdoms.
|
||||||
|
@ -423,6 +425,8 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
synchronized (fTaskQueueMutex) {
|
synchronized (fTaskQueueMutex) {
|
||||||
fTaskQueue.addLast(subjob);
|
fTaskQueue.addLast(subjob);
|
||||||
if (fIndexerJob == null) {
|
if (fIndexerJob == null) {
|
||||||
|
fCompletedSources= 0;
|
||||||
|
fCompletedHeaders= 0;
|
||||||
fIndexerJob = new PDOMIndexerJob(this);
|
fIndexerJob = new PDOMIndexerJob(this);
|
||||||
fIndexerJob.schedule();
|
fIndexerJob.schedule();
|
||||||
notifyBusy= true;
|
notifyBusy= true;
|
||||||
|
@ -443,6 +447,10 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
idle= true;
|
idle= true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (fCurrentTask != null) {
|
||||||
|
fCompletedSources+= fCurrentTask.getCompletedSourcesCount();
|
||||||
|
fCompletedHeaders+= fCurrentTask.getCompletedHeadersCount();
|
||||||
|
}
|
||||||
result= fCurrentTask= (IPDOMIndexerTask)fTaskQueue.removeFirst();
|
result= fCurrentTask= (IPDOMIndexerTask)fTaskQueue.removeFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,6 +544,10 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cancelIndexerJobs(indexer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelIndexerJobs(IPDOMIndexer indexer) {
|
||||||
PDOMIndexerJob jobToCancel= null;
|
PDOMIndexerJob jobToCancel= null;
|
||||||
synchronized (fTaskQueueMutex) {
|
synchronized (fTaskQueueMutex) {
|
||||||
for (Iterator iter = fTaskQueue.iterator(); iter.hasNext();) {
|
for (Iterator iter = fTaskQueue.iterator(); iter.hasNext();) {
|
||||||
|
@ -553,6 +565,23 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reindex(ICProject project) throws CoreException {
|
||||||
|
assert !Thread.holdsLock(fPDOMs);
|
||||||
|
IPDOMIndexer indexer= null;
|
||||||
|
synchronized (fIndexerMutex) {
|
||||||
|
indexer= getIndexer(project, false);
|
||||||
|
}
|
||||||
|
// don't attempt to hold lock on indexerMutex while cancelling
|
||||||
|
if (indexer != null) {
|
||||||
|
cancelIndexerJobs(indexer);
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized(fIndexerMutex) {
|
||||||
|
indexer= getIndexer(project, true);
|
||||||
|
indexer.reindex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void addIndexChangeListener(IIndexChangeListener listener) {
|
public void addIndexChangeListener(IIndexChangeListener listener) {
|
||||||
fChangeListeners.add(listener);
|
fChangeListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
@ -644,14 +673,15 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean joinIndexer(int waitMaxMillis, IProgressMonitor monitor) {
|
public boolean joinIndexer(int waitMaxMillis, IProgressMonitor monitor) {
|
||||||
monitor.beginTask(Messages.PDOMManager_JoinIndexerTask, IProgressMonitor.UNKNOWN);
|
monitor.beginTask(Messages.PDOMManager_JoinIndexerTask, 1000);
|
||||||
long limit= System.currentTimeMillis()+waitMaxMillis;
|
long limit= System.currentTimeMillis()+waitMaxMillis;
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
int currentTicks= 0;
|
||||||
if (monitor.isCanceled()) {
|
if (monitor.isCanceled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
monitor.subTask(getMonitorMessage());
|
currentTicks= getMonitorMessage(monitor, currentTicks, 1000);
|
||||||
synchronized(fTaskQueueMutex) {
|
synchronized(fTaskQueueMutex) {
|
||||||
if (isIndexerIdle()) {
|
if (isIndexerIdle()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -680,29 +710,44 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getMonitorMessage() {
|
int getMonitorMessage(IProgressMonitor monitor, int currentTicks, int base) {
|
||||||
assert !Thread.holdsLock(fTaskQueueMutex);
|
assert !Thread.holdsLock(fTaskQueueMutex);
|
||||||
int remainingCount= 0;
|
int remainingSources= 0;
|
||||||
int completedCount= 0;
|
int completedSources= 0;
|
||||||
IPDOMIndexerTask currentTask= null;
|
int completedHeaders= 0;
|
||||||
PDOMIndexerJob currentJob= null;
|
String detail= null;
|
||||||
synchronized (fTaskQueueMutex) {
|
synchronized (fTaskQueueMutex) {
|
||||||
|
completedHeaders= fCompletedHeaders;
|
||||||
|
completedSources= fCompletedSources;
|
||||||
for (Iterator iter = fTaskQueue.iterator(); iter.hasNext();) {
|
for (Iterator iter = fTaskQueue.iterator(); iter.hasNext();) {
|
||||||
IPDOMIndexerTask task = (IPDOMIndexerTask) iter.next();
|
IPDOMIndexerTask task = (IPDOMIndexerTask) iter.next();
|
||||||
remainingCount+= task.getRemainingSubtaskCount();
|
remainingSources+= task.estimateRemainingSources();
|
||||||
}
|
}
|
||||||
currentTask= fCurrentTask;
|
if (fCurrentTask != null) {
|
||||||
currentJob= fIndexerJob;
|
remainingSources+= fCurrentTask.estimateRemainingSources();
|
||||||
|
completedHeaders+= fCurrentTask.getCompletedHeadersCount();
|
||||||
|
completedSources+= fCurrentTask.getCompletedSourcesCount();
|
||||||
|
detail= fCurrentTask.getMonitorMessageDetail();
|
||||||
}
|
}
|
||||||
if (currentTask != null) {
|
|
||||||
remainingCount += currentTask.getRemainingSubtaskCount();
|
|
||||||
}
|
}
|
||||||
if (currentJob != null) {
|
|
||||||
completedCount= currentJob.getCompletedSubtaskCount();
|
int totalSources = remainingSources+completedSources;
|
||||||
|
String msg= MessageFormat.format(Messages.PDOMManager_indexMonitorDetail, new Object[] {
|
||||||
|
new Integer(completedSources), new Integer(totalSources),
|
||||||
|
new Integer(completedHeaders)});
|
||||||
|
if (detail != null) {
|
||||||
|
msg= msg+ ": " + detail; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return MessageFormat.format("{0}/{1}", new Object[] { //$NON-NLS-1$
|
monitor.subTask(msg);
|
||||||
new Integer(completedCount), new Integer(remainingCount+completedCount)
|
|
||||||
});
|
if (completedSources > 0 && totalSources >= completedSources) {
|
||||||
|
int newTick= completedSources*base/totalSources;
|
||||||
|
if (newTick > currentTicks) {
|
||||||
|
monitor.worked(newTick-currentTicks);
|
||||||
|
return newTick;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -725,4 +770,5 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
public IIndex getIndex(ICProject[] projects, int options) throws CoreException {
|
public IIndex getIndex(ICProject[] projects, int options) throws CoreException {
|
||||||
return fIndexFactory.getIndex(projects, options);
|
return fIndexFactory.getIndex(projects, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,16 +37,26 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
|
||||||
public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
private static final Object NO_CONTEXT = new Object();
|
private static final Object NO_CONTEXT = new Object();
|
||||||
protected static final int MAX_ERRORS = 10;
|
protected static final int MAX_ERRORS = 10;
|
||||||
|
|
||||||
protected volatile int fTotalTasks= 0;
|
protected volatile int fTotalSourcesEstimate= 0;
|
||||||
protected volatile int fCompletedTasks= 0;
|
protected volatile int fCompletedSources= 0;
|
||||||
|
protected volatile int fCompletedHeaders= 0;
|
||||||
protected int fErrorCount;
|
protected int fErrorCount;
|
||||||
protected Map fContextMap= new HashMap();
|
protected Map fContextMap= new HashMap();
|
||||||
protected volatile String fMessage;
|
protected volatile String fMessage;
|
||||||
|
protected boolean fTrace;
|
||||||
|
|
||||||
|
protected PDOMIndexerTask() {
|
||||||
|
String trace = Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/indexer"); //$NON-NLS-1$
|
||||||
|
if (trace != null && trace.equalsIgnoreCase("true")) { //$NON-NLS-1$
|
||||||
|
fTrace= true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void processDelta(ICElementDelta delta, Collection added, Collection changed, Collection removed) throws CoreException {
|
protected void processDelta(ICElementDelta delta, Collection added, Collection changed, Collection removed) throws CoreException {
|
||||||
int flags = delta.getFlags();
|
int flags = delta.getFlags();
|
||||||
|
@ -199,11 +209,16 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
return fMessage;
|
return fMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public int getRemainingSubtaskCount() {
|
|
||||||
return fTotalTasks-fCompletedTasks;
|
final public int estimateRemainingSources() {
|
||||||
|
return fTotalSourcesEstimate-fCompletedSources;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public int getCompletedSubtaskCount() {
|
public int getCompletedHeadersCount() {
|
||||||
return fCompletedTasks;
|
return fCompletedHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCompletedSourcesCount() {
|
||||||
|
return fCompletedSources;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class PDOMFastHandleDelta extends PDOMFastIndexerJob {
|
||||||
public PDOMFastHandleDelta(PDOMFastIndexer indexer, ICElementDelta delta) throws CoreException {
|
public PDOMFastHandleDelta(PDOMFastIndexer indexer, ICElementDelta delta) throws CoreException {
|
||||||
super(indexer);
|
super(indexer);
|
||||||
processDelta(delta, changed, changed, removed);
|
processDelta(delta, changed, changed, removed);
|
||||||
fTotalTasks= changed.size() + removed.size();
|
fTotalSourcesEstimate= changed.size() + removed.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor) {
|
public void run(IProgressMonitor monitor) {
|
||||||
|
@ -47,10 +47,27 @@ class PDOMFastHandleDelta extends PDOMFastIndexerJob {
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||||
removeTU(index, tu);
|
removeTU(index, tu);
|
||||||
fCompletedTasks++;
|
if (tu.isSourceUnit()) {
|
||||||
|
fCompletedSources++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fTotalSourcesEstimate--;
|
||||||
|
fCompletedHeaders++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parseTUs(changed, monitor);
|
// separate headers
|
||||||
|
List headers= new ArrayList();
|
||||||
|
List sources= changed;
|
||||||
|
for (Iterator iter = changed.iterator(); iter.hasNext();) {
|
||||||
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
|
if (!tu.isSourceUnit()) {
|
||||||
|
headers.add(tu);
|
||||||
|
iter.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parseTUs(sources, headers, monitor);
|
||||||
if (monitor.isCanceled()) {
|
if (monitor.isCanceled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class PDOMFastIndexer implements IPDOMIndexer {
|
||||||
|
|
||||||
public void handleDelta(ICElementDelta delta) throws CoreException {
|
public void handleDelta(ICElementDelta delta) throws CoreException {
|
||||||
PDOMFastHandleDelta fhd= new PDOMFastHandleDelta(this, delta);
|
PDOMFastHandleDelta fhd= new PDOMFastHandleDelta(this, delta);
|
||||||
if (fhd.getRemainingSubtaskCount() > 0) {
|
if (fhd.estimateRemainingSources() > 0) {
|
||||||
CCoreInternals.getPDOMManager().enqueue(fhd);
|
CCoreInternals.getPDOMManager().enqueue(fhd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
|
@ -54,14 +53,9 @@ abstract class PDOMFastIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
protected final PDOMFastIndexer indexer;
|
protected final PDOMFastIndexer indexer;
|
||||||
protected IWritableIndex index;
|
protected IWritableIndex index;
|
||||||
protected IndexBasedCodeReaderFactory codeReaderFactory;
|
protected IndexBasedCodeReaderFactory codeReaderFactory;
|
||||||
private boolean fTrace= false;
|
|
||||||
|
|
||||||
public PDOMFastIndexerJob(PDOMFastIndexer indexer) throws CoreException {
|
public PDOMFastIndexerJob(PDOMFastIndexer indexer) throws CoreException {
|
||||||
this.indexer = indexer;
|
this.indexer = indexer;
|
||||||
String trace = Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/indexer"); //$NON-NLS-1$
|
|
||||||
if (trace != null && trace.equalsIgnoreCase("true")) { //$NON-NLS-1$
|
|
||||||
fTrace= true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupIndexAndReaderFactory() throws CoreException {
|
protected void setupIndexAndReaderFactory() throws CoreException {
|
||||||
|
@ -69,11 +63,11 @@ abstract class PDOMFastIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
this.codeReaderFactory = new IndexBasedCodeReaderFactory(index);
|
this.codeReaderFactory = new IndexBasedCodeReaderFactory(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerTUsInReaderFactory(Collection tus) throws CoreException {
|
protected void registerTUsInReaderFactory(Collection files) throws CoreException {
|
||||||
for (Iterator iter = tus.iterator(); iter.hasNext();) {
|
for (Iterator iter = files.iterator(); iter.hasNext();) {
|
||||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
FileInfo info= codeReaderFactory.createFileInfo(tu);
|
FileInfo info= codeReaderFactory.createFileInfo(tu);
|
||||||
info.fNeedToIndex= true;
|
info.setRequested(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,42 +167,55 @@ abstract class PDOMFastIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
}
|
}
|
||||||
String path= (String) entry.getKey();
|
String path= (String) entry.getKey();
|
||||||
FileInfo info= codeReaderFactory.createFileInfo(path);
|
FileInfo info= codeReaderFactory.createFileInfo(path);
|
||||||
if (!info.fNeedToIndex && info.fFile != null) {
|
|
||||||
if (fTrace) {
|
// file is requested or is not yet indexed.
|
||||||
System.out.println("Indexer: skipping " + path); //$NON-NLS-1$
|
if (info.isRequested() || info.fFile == null) {
|
||||||
}
|
|
||||||
iter.remove();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// resolve the names
|
// resolve the names
|
||||||
ArrayList names= ((ArrayList[]) entry.getValue())[2];
|
ArrayList names= ((ArrayList[]) entry.getValue())[2];
|
||||||
for (int i=0; i<names.size(); i++) {
|
for (int i=0; i<names.size(); i++) {
|
||||||
((IASTName) names.get(i)).resolveBinding();
|
((IASTName) names.get(i)).resolveBinding();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (fTrace) {
|
||||||
|
System.out.println("Indexer: skipping " + path); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
iter.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isFirstRequest= true;
|
||||||
|
boolean isFirstAddition= true;
|
||||||
index.acquireWriteLock(1);
|
index.acquireWriteLock(1);
|
||||||
try {
|
try {
|
||||||
for (Iterator iter = paths.iterator(); iter.hasNext();) {
|
for (Iterator iter = paths.iterator(); iter.hasNext();) {
|
||||||
|
if (pm.isCanceled())
|
||||||
|
return;
|
||||||
|
|
||||||
String path = (String) iter.next();
|
String path = (String) iter.next();
|
||||||
FileInfo info= codeReaderFactory.createFileInfo(path);
|
FileInfo info= codeReaderFactory.createFileInfo(path);
|
||||||
if (!info.fNeedToIndex) {
|
if (info.isRequested()) {
|
||||||
fTotalTasks++;
|
info.setRequested(false);
|
||||||
|
|
||||||
|
if (isFirstRequest)
|
||||||
|
isFirstRequest= false;
|
||||||
|
else
|
||||||
|
fTotalSourcesEstimate--;
|
||||||
}
|
}
|
||||||
info.fNeedToIndex= false;
|
|
||||||
if (fTrace) {
|
if (fTrace) {
|
||||||
System.out.println("Indexer: adding " + path); //$NON-NLS-1$
|
System.out.println("Indexer: adding " + path); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
addToIndex(path, info, (ArrayList[]) symbolMap.get(path));
|
addToIndex(path, info, (ArrayList[]) symbolMap.get(path));
|
||||||
fCompletedTasks++;
|
|
||||||
if (pm.isCanceled()) {
|
if (isFirstAddition)
|
||||||
return;
|
isFirstAddition= false;
|
||||||
}
|
else
|
||||||
|
fCompletedHeaders++;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
index.releaseWriteLock(1);
|
index.releaseWriteLock(1);
|
||||||
}
|
}
|
||||||
|
fCompletedSources++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToMap(HashMap map, int idx, String path, Object thing) {
|
private void addToMap(HashMap map, int idx, String path, Object thing) {
|
||||||
|
@ -264,29 +271,25 @@ abstract class PDOMFastIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
return (IIndexFragmentFile) info.fFile;
|
return (IIndexFragmentFile) info.fFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void parseTUs(List translationUnits, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
protected void parseTUs(List sources, List headers, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
||||||
// sources first
|
// sources first
|
||||||
Iterator i = translationUnits.iterator();
|
Iterator iter;
|
||||||
while (i.hasNext()) {
|
for (iter= sources.iterator(); iter.hasNext();) {
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
if (tu.isSourceUnit()) {
|
|
||||||
parseTU(tu, monitor);
|
parseTU(tu, monitor);
|
||||||
i.remove();
|
|
||||||
fCompletedTasks++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// headers with context
|
// headers with context
|
||||||
i = translationUnits.iterator();
|
for (iter= headers.iterator(); iter.hasNext();) {
|
||||||
while (i.hasNext()) {
|
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
FileInfo info= codeReaderFactory.createFileInfo(tu);
|
FileInfo info= codeReaderFactory.createFileInfo(tu);
|
||||||
if (!info.fNeedToIndex) {
|
// check if header was handled while parsing a source
|
||||||
i.remove();
|
if (!info.isRequested()) {
|
||||||
|
iter.remove();
|
||||||
}
|
}
|
||||||
else if (info.fFile != null) {
|
else if (info.fFile != null) {
|
||||||
ITranslationUnit context= findContext(index, info.fFile.getLocation());
|
ITranslationUnit context= findContext(index, info.fFile.getLocation());
|
||||||
|
@ -298,14 +301,14 @@ abstract class PDOMFastIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
|
|
||||||
// headers without context
|
// headers without context
|
||||||
if (getIndexAllFiles()) {
|
if (getIndexAllFiles()) {
|
||||||
i = translationUnits.iterator();
|
for (iter= headers.iterator(); iter.hasNext();) {
|
||||||
while (i.hasNext()) {
|
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
FileInfo info= codeReaderFactory.createFileInfo(tu);
|
FileInfo info= codeReaderFactory.createFileInfo(tu);
|
||||||
if (!info.fNeedToIndex) {
|
// check if header was handled while parsing a source
|
||||||
i.remove();
|
if (!info.isRequested()) {
|
||||||
|
iter.remove();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parseTU(tu, monitor);
|
parseTU(tu, monitor);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer.fast;
|
package org.eclipse.cdt.internal.core.pdom.indexer.fast;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -25,33 +25,29 @@ import org.eclipse.core.runtime.Platform;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class PDOMFastReindex extends PDOMFastIndexerJob {
|
class PDOMFastReindex extends PDOMFastIndexerJob {
|
||||||
private ArrayList fTUs= new ArrayList();
|
|
||||||
|
|
||||||
public PDOMFastReindex(PDOMFastIndexer indexer) throws CoreException {
|
public PDOMFastReindex(PDOMFastIndexer indexer) throws CoreException {
|
||||||
super(indexer);
|
super(indexer);
|
||||||
fTotalTasks= 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(final IProgressMonitor monitor) {
|
public void run(final IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
boolean allFiles= getIndexAllFiles();
|
boolean allFiles= getIndexAllFiles();
|
||||||
Collection headers= allFiles ? fTUs : null;
|
List sources= new ArrayList();
|
||||||
collectSources(indexer.getProject(), fTUs, headers, allFiles);
|
List headers= new ArrayList();
|
||||||
fTotalTasks+= fTUs.size()+1;
|
collectSources(indexer.getProject(), sources, allFiles ? headers : null, allFiles);
|
||||||
fCompletedTasks+= 1;
|
|
||||||
|
|
||||||
|
fTotalSourcesEstimate= sources.size() + headers.size();
|
||||||
setupIndexAndReaderFactory();
|
setupIndexAndReaderFactory();
|
||||||
clearIndex(index);
|
clearIndex(index);
|
||||||
|
|
||||||
if (getRemainingSubtaskCount() == 1 || monitor.isCanceled()) {
|
if (fTotalSourcesEstimate==0 || monitor.isCanceled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerTUsInReaderFactory(fTUs);
|
registerTUsInReaderFactory(sources);
|
||||||
fCompletedTasks++;
|
registerTUsInReaderFactory(headers);
|
||||||
|
parseTUs(sources, headers, monitor);
|
||||||
parseTUs(fTUs, monitor);
|
|
||||||
|
|
||||||
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
||||||
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer.full;
|
package org.eclipse.cdt.internal.core.pdom.indexer.full;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -36,14 +35,26 @@ class PDOMFullHandleDelta extends PDOMFullIndexerJob {
|
||||||
public PDOMFullHandleDelta(PDOMFullIndexer indexer, ICElementDelta delta) throws CoreException {
|
public PDOMFullHandleDelta(PDOMFullIndexer indexer, ICElementDelta delta) throws CoreException {
|
||||||
super(indexer);
|
super(indexer);
|
||||||
processDelta(delta, changed, changed, removed);
|
processDelta(delta, changed, changed, removed);
|
||||||
fTotalTasks= changed.size() + removed.size();
|
fTotalSourcesEstimate= changed.size() + removed.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor) {
|
public void run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
setupIndexAndReaderFactory();
|
setupIndexAndReaderFactory();
|
||||||
registerTUsInReaderFactory(changed, Collections.EMPTY_LIST);
|
|
||||||
|
// separate headers
|
||||||
|
List headers= new ArrayList();
|
||||||
|
List sources= changed;
|
||||||
|
for (Iterator iter = changed.iterator(); iter.hasNext();) {
|
||||||
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
|
if (!tu.isSourceUnit()) {
|
||||||
|
headers.add(tu);
|
||||||
|
iter.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
registerTUsInReaderFactory(sources, headers, true);
|
||||||
|
|
||||||
Iterator i= removed.iterator();
|
Iterator i= removed.iterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
|
@ -51,13 +62,16 @@ class PDOMFullHandleDelta extends PDOMFullIndexerJob {
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||||
removeTU(index, tu);
|
removeTU(index, tu);
|
||||||
fCompletedTasks++;
|
if (tu.isSourceUnit()) {
|
||||||
|
fCompletedSources++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fTotalSourcesEstimate--;
|
||||||
|
fCompletedHeaders++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parseTUs(changed, monitor);
|
parseTUs(sources, headers, monitor);
|
||||||
if (monitor.isCanceled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
||||||
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class PDOMFullIndexer implements IPDOMIndexer {
|
||||||
|
|
||||||
public void handleDelta(ICElementDelta delta) throws CoreException {
|
public void handleDelta(ICElementDelta delta) throws CoreException {
|
||||||
PDOMFullHandleDelta task = new PDOMFullHandleDelta(this, delta);
|
PDOMFullHandleDelta task = new PDOMFullHandleDelta(this, delta);
|
||||||
if (task.getRemainingSubtaskCount() > 0) {
|
if (task.estimateRemainingSources() > 0) {
|
||||||
CCoreInternals.getPDOMManager().enqueue(task);
|
CCoreInternals.getPDOMManager().enqueue(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,45 +61,42 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
this.index = ((IWritableIndexManager) CCorePlugin.getIndexManager()).getWritableIndex(indexer.getProject());
|
this.index = ((IWritableIndexManager) CCorePlugin.getIndexManager()).getWritableIndex(indexer.getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerTUsInReaderFactory(Collection required, Collection optional) throws CoreException {
|
protected void registerTUsInReaderFactory(Collection sources, Collection headers,
|
||||||
|
boolean requireHeaders) throws CoreException {
|
||||||
filePathsToParse= new HashMap();
|
filePathsToParse= new HashMap();
|
||||||
|
|
||||||
for (Iterator iter = required.iterator(); iter.hasNext();) {
|
for (Iterator iter = sources.iterator(); iter.hasNext();) {
|
||||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
filePathsToParse.put(tu.getLocation().toOSString(), Boolean.TRUE);
|
filePathsToParse.put(tu.getLocation().toOSString(), Boolean.TRUE);
|
||||||
}
|
}
|
||||||
for (Iterator iter = optional.iterator(); iter.hasNext();) {
|
Boolean required= Boolean.valueOf(requireHeaders);
|
||||||
|
for (Iterator iter = headers.iterator(); iter.hasNext();) {
|
||||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
filePathsToParse.put(tu.getLocation().toOSString(), Boolean.FALSE);
|
filePathsToParse.put(tu.getLocation().toOSString(), required);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void parseTUs(Collection translationUnits, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
protected void parseTUs(Collection sources, Collection headers, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
||||||
// sources first
|
// sources first
|
||||||
Iterator i = translationUnits.iterator();
|
Iterator iter;
|
||||||
while (i.hasNext()) {
|
for (iter = sources.iterator(); iter.hasNext();) {
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
String path = tu.getLocation().toOSString();
|
String path = tu.getLocation().toOSString();
|
||||||
if (filePathsToParse.get(path) == null) {
|
if (filePathsToParse.get(path) != null) {
|
||||||
i.remove();
|
|
||||||
}
|
|
||||||
else if (tu.isSourceUnit()) {
|
|
||||||
parseTU(tu, monitor);
|
parseTU(tu, monitor);
|
||||||
i.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// headers with context
|
// headers with context
|
||||||
i = translationUnits.iterator();
|
for (iter = headers.iterator(); iter.hasNext();) {
|
||||||
while (i.hasNext()) {
|
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
String path = tu.getLocation().toOSString();
|
String path = tu.getLocation().toOSString();
|
||||||
if (filePathsToParse.get(path)==null) {
|
if (filePathsToParse.get(path)==null) {
|
||||||
i.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ITranslationUnit context= findContext(index, path);
|
ITranslationUnit context= findContext(index, path);
|
||||||
|
@ -111,12 +108,13 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
|
|
||||||
// headers without context
|
// headers without context
|
||||||
if (getIndexAllFiles()) {
|
if (getIndexAllFiles()) {
|
||||||
i = translationUnits.iterator();
|
for (iter = headers.iterator(); iter.hasNext();) {
|
||||||
while (i.hasNext()) {
|
if (monitor.isCanceled())
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
return;
|
||||||
|
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||||
String path = tu.getLocation().toOSString();
|
String path = tu.getLocation().toOSString();
|
||||||
if (filePathsToParse.get(path)==null) {
|
if (filePathsToParse.get(path)==null) {
|
||||||
i.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parseTU(tu, monitor);
|
parseTU(tu, monitor);
|
||||||
|
@ -194,19 +192,40 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isFirstRequest= true;
|
||||||
|
boolean isFirstAddition= true;
|
||||||
index.acquireWriteLock(0);
|
index.acquireWriteLock(0);
|
||||||
try {
|
try {
|
||||||
for (Iterator iter = symbolMap.entrySet().iterator(); iter.hasNext();) {
|
for (Iterator iter = symbolMap.entrySet().iterator(); iter.hasNext();) {
|
||||||
if (pm.isCanceled()) {
|
if (pm.isCanceled())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
Map.Entry entry = (Map.Entry) iter.next();
|
Map.Entry entry = (Map.Entry) iter.next();
|
||||||
String path= (String) entry.getKey();
|
String path= (String) entry.getKey();
|
||||||
|
Boolean required= (Boolean) filePathsToParse.remove(path);
|
||||||
|
if (required != null) {
|
||||||
|
if (required.booleanValue()) {
|
||||||
|
if (isFirstRequest)
|
||||||
|
isFirstRequest= false;
|
||||||
|
else
|
||||||
|
fTotalSourcesEstimate--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fTrace)
|
||||||
|
System.out.println("Indexer: adding " + path); //$NON-NLS-1$
|
||||||
|
|
||||||
addToIndex(path, (ArrayList[]) entry.getValue());
|
addToIndex(path, (ArrayList[]) entry.getValue());
|
||||||
|
|
||||||
|
if (isFirstAddition)
|
||||||
|
isFirstAddition= false;
|
||||||
|
else
|
||||||
|
fCompletedHeaders++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
index.releaseWriteLock(0);
|
index.releaseWriteLock(0);
|
||||||
}
|
}
|
||||||
|
fCompletedSources++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToMap(HashMap map, int idx, String path, Object thing) {
|
private void addToMap(HashMap map, int idx, String path, Object thing) {
|
||||||
|
@ -221,14 +240,6 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToIndex(String location, ArrayList[] lists) throws CoreException {
|
private void addToIndex(String location, ArrayList[] lists) throws CoreException {
|
||||||
Boolean required= (Boolean) filePathsToParse.remove(location);
|
|
||||||
if (required == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!required.booleanValue()) {
|
|
||||||
fTotalTasks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the old symbols in the tu
|
// Remove the old symbols in the tu
|
||||||
Path path= new Path(location);
|
Path path= new Path(location);
|
||||||
IIndexFragmentFile file= (IIndexFragmentFile) index.getFile(new Path(location));
|
IIndexFragmentFile file= (IIndexFragmentFile) index.getFile(new Path(location));
|
||||||
|
@ -259,6 +270,5 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
index.addName(file, (IASTName) list.get(i));
|
index.addName(file, (IASTName) list.get(i));
|
||||||
}
|
}
|
||||||
fCompletedTasks++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,39 +27,35 @@ import org.eclipse.core.runtime.Status;
|
||||||
*/
|
*/
|
||||||
class PDOMFullReindex extends PDOMFullIndexerJob {
|
class PDOMFullReindex extends PDOMFullIndexerJob {
|
||||||
|
|
||||||
private ArrayList fTUs= new ArrayList();
|
|
||||||
|
|
||||||
public PDOMFullReindex(PDOMFullIndexer indexer) throws CoreException {
|
public PDOMFullReindex(PDOMFullIndexer indexer) throws CoreException {
|
||||||
super(indexer);
|
super(indexer);
|
||||||
fTotalTasks= 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(final IProgressMonitor monitor) {
|
public void run(final IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
boolean allfiles= getIndexAllFiles();
|
boolean allfiles= getIndexAllFiles();
|
||||||
List optional= new ArrayList();
|
List headers= new ArrayList();
|
||||||
|
List sources= new ArrayList();
|
||||||
|
|
||||||
collectSources(indexer.getProject(), fTUs, optional, allfiles);
|
collectSources(indexer.getProject(), sources, headers, allfiles);
|
||||||
if (allfiles) {
|
|
||||||
fTUs.addAll(optional);
|
|
||||||
optional.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
fTotalTasks+= fTUs.size()+1;
|
fTotalSourcesEstimate= sources.size();
|
||||||
fCompletedTasks++;
|
if (allfiles)
|
||||||
|
fTotalSourcesEstimate+= headers.size();
|
||||||
|
|
||||||
setupIndexAndReaderFactory();
|
setupIndexAndReaderFactory();
|
||||||
clearIndex(index);
|
clearIndex(index);
|
||||||
|
|
||||||
if (getRemainingSubtaskCount() == 1 || monitor.isCanceled()) {
|
if (fTotalSourcesEstimate == 0 || monitor.isCanceled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerTUsInReaderFactory(fTUs, optional);
|
registerTUsInReaderFactory(sources, headers, allfiles);
|
||||||
fCompletedTasks++;
|
if (!allfiles)
|
||||||
|
headers.clear();
|
||||||
|
|
||||||
parseTUs(fTUs, monitor);
|
parseTUs(sources, headers, monitor);
|
||||||
|
|
||||||
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
||||||
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
||||||
|
|
|
@ -73,11 +73,15 @@ public class PDOMNullIndexer implements IPDOMIndexer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCompletedSubtaskCount() {
|
public int estimateRemainingSources() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRemainingSubtaskCount() {
|
public int getCompletedHeadersCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCompletedSourcesCount() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,3 +3,4 @@ PDOMManager_notifyJob_label=Notify Index Change Listeners
|
||||||
PDOMManager_JoinIndexerTask=Join Indexer
|
PDOMManager_JoinIndexerTask=Join Indexer
|
||||||
PDOMManager_savePrefsJob=Save Project Preferences
|
PDOMManager_savePrefsJob=Save Project Preferences
|
||||||
PDOMManager_notifyTask_message=Notify Listeners
|
PDOMManager_notifyTask_message=Notify Listeners
|
||||||
|
PDOMManager_indexMonitorDetail={0}/{1} sources, {2} headers
|
||||||
|
|
|
@ -651,9 +651,6 @@ public class CCorePlugin extends Plugin {
|
||||||
return fCoreModel;
|
return fCoreModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* deprecated, use getIndexManager()
|
|
||||||
*/
|
|
||||||
public static IPDOMManager getPDOMManager() {
|
public static IPDOMManager getPDOMManager() {
|
||||||
return getDefault().pdomManager;
|
return getDefault().pdomManager;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,3 +77,4 @@ pdom.indexer.name=C/C++ Indexer
|
||||||
pdom.indexer.task=Indexing
|
pdom.indexer.task=Indexing
|
||||||
pdom.indexer.filling=Counting files
|
pdom.indexer.filling=Counting files
|
||||||
pdom.indexer.message=file {0} of {1}: {2}
|
pdom.indexer.message=file {0} of {1}: {2}
|
||||||
|
PDOMIndexerJob.updateMonitorJob=Update Monitor
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.eclipse.swt.widgets.TreeItem;
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
@ -27,6 +26,8 @@ import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.tests.BaseUITestCase;
|
import org.eclipse.cdt.ui.tests.BaseUITestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.callhierarchy.CHViewPart;
|
import org.eclipse.cdt.internal.ui.callhierarchy.CHViewPart;
|
||||||
import org.eclipse.cdt.internal.ui.callhierarchy.CallHierarchyUI;
|
import org.eclipse.cdt.internal.ui.callhierarchy.CallHierarchyUI;
|
||||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
|
@ -42,12 +43,7 @@ public class CallHierarchyBaseTest extends BaseUITestCase {
|
||||||
|
|
||||||
protected void setUp() throws CoreException {
|
protected void setUp() throws CoreException {
|
||||||
fCProject= CProjectHelper.createCCProject("__chTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
fCProject= CProjectHelper.createCCProject("__chTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||||
IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(fCProject);
|
CCoreInternals.getPDOMManager().reindex(fCProject);
|
||||||
try {
|
|
||||||
indexer.reindex();
|
|
||||||
} catch (CoreException e) {
|
|
||||||
CUIPlugin.getDefault().log(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,9 @@ import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
@ -30,9 +28,10 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.cdt.ui.tests.BaseUITestCase;
|
import org.eclipse.cdt.ui.tests.BaseUITestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
|
|
||||||
public class ResolveBindingTests extends BaseUITestCase {
|
public class ResolveBindingTests extends BaseUITestCase {
|
||||||
|
|
||||||
private static final int WAIT_FOR_INDEXER = 5000;
|
private static final int WAIT_FOR_INDEXER = 5000;
|
||||||
|
@ -50,12 +49,7 @@ public class ResolveBindingTests extends BaseUITestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
fCProject= CProjectHelper.createCProject("ResolveBindingTests", "bin", IPDOMManager.ID_NO_INDEXER);
|
fCProject= CProjectHelper.createCProject("ResolveBindingTests", "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(fCProject);
|
CCoreInternals.getPDOMManager().reindex(fCProject);
|
||||||
try {
|
|
||||||
indexer.reindex();
|
|
||||||
} catch (CoreException e) {
|
|
||||||
CUIPlugin.getDefault().log(e);
|
|
||||||
}
|
|
||||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.actions;
|
package org.eclipse.cdt.internal.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
@ -22,6 +18,11 @@ import org.eclipse.ui.IActionDelegate;
|
||||||
import org.eclipse.ui.IObjectActionDelegate;
|
import org.eclipse.ui.IObjectActionDelegate;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
|
|
||||||
public class PDOMUpdateProjectAction implements IObjectActionDelegate {
|
public class PDOMUpdateProjectAction implements IObjectActionDelegate {
|
||||||
|
|
||||||
private ISelection selection;
|
private ISelection selection;
|
||||||
|
@ -45,9 +46,8 @@ public class PDOMUpdateProjectAction implements IObjectActionDelegate {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ICProject project = (ICProject)objs[i];
|
ICProject project = (ICProject)objs[i];
|
||||||
IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(project);
|
|
||||||
try {
|
try {
|
||||||
indexer.reindex();
|
CCoreInternals.getPDOMManager().reindex(project);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().log(e);
|
CUIPlugin.getDefault().log(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,22 +10,24 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.indexview;
|
package org.eclipse.cdt.internal.ui.indexview;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMacro;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMacro;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dschaefer
|
* @author dschaefer
|
||||||
|
@ -69,7 +71,7 @@ public class CountNodeAction extends IndexAction {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ICProject project = (ICProject)objs[i];
|
ICProject project = (ICProject)objs[i];
|
||||||
final PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
final PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
//pdom.getDB().reportFreeBlocks();
|
//pdom.getDB().reportFreeBlocks();
|
||||||
|
|
||||||
pdom.getFileIndex().accept(new IBTreeVisitor() {
|
pdom.getFileIndex().accept(new IBTreeVisitor() {
|
||||||
|
|
|
@ -14,24 +14,6 @@ package org.eclipse.cdt.internal.ui.indexview;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
|
||||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
|
||||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
|
||||||
import org.eclipse.cdt.core.model.ICModel;
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
|
||||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
|
||||||
import org.eclipse.cdt.internal.ui.IndexLabelProvider;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -57,6 +39,27 @@ import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.part.ViewPart;
|
import org.eclipse.ui.part.ViewPart;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||||
|
import org.eclipse.cdt.core.model.ICModel;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.IndexLabelProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*
|
*
|
||||||
|
@ -182,7 +185,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
||||||
public Object[] getChildren(Object parentElement) {
|
public Object[] getChildren(Object parentElement) {
|
||||||
try {
|
try {
|
||||||
if (parentElement instanceof ICProject) {
|
if (parentElement instanceof ICProject) {
|
||||||
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM((ICProject)parentElement);
|
PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM((ICProject)parentElement);
|
||||||
PDOMLinkage[] linkages= pdom.getLinkages();
|
PDOMLinkage[] linkages= pdom.getLinkages();
|
||||||
if (linkages.length == 1) {
|
if (linkages.length == 1) {
|
||||||
// Skip linkages in hierarchy if there is only one
|
// Skip linkages in hierarchy if there is only one
|
||||||
|
@ -212,7 +215,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
try {
|
try {
|
||||||
if (element instanceof ICProject) {
|
if (element instanceof ICProject) {
|
||||||
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM((ICProject)element);
|
PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM((ICProject)element);
|
||||||
PDOMLinkage[] linkages = pdom.getLinkages();
|
PDOMLinkage[] linkages = pdom.getLinkages();
|
||||||
if (linkages.length == 0)
|
if (linkages.length == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -278,7 +281,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
||||||
try {
|
try {
|
||||||
ICProject[] projects = model.getCProjects();
|
ICProject[] projects = model.getCProjects();
|
||||||
for (int i = 0; i < projects.length; ++i) {
|
for (int i = 0; i < projects.length; ++i) {
|
||||||
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(projects[i]);
|
PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(projects[i]);
|
||||||
pdom.addListener(this);
|
pdom.addListener(this);
|
||||||
}
|
}
|
||||||
viewer.setChildCount(model, projects.length);
|
viewer.setChildCount(model, projects.length);
|
||||||
|
@ -322,7 +325,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
||||||
try {
|
try {
|
||||||
ICProject[] projects = model.getCProjects();
|
ICProject[] projects = model.getCProjects();
|
||||||
for (int i = 0; i < projects.length; ++i) {
|
for (int i = 0; i < projects.length; ++i) {
|
||||||
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(projects[i]);
|
PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(projects[i]);
|
||||||
pdom.removeListener(this);
|
pdom.removeListener(this);
|
||||||
}
|
}
|
||||||
viewer.setChildCount(model, projects.length);
|
viewer.setChildCount(model, projects.length);
|
||||||
|
@ -424,7 +427,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
||||||
switch (delta.getKind()) {
|
switch (delta.getKind()) {
|
||||||
case ICElementDelta.ADDED:
|
case ICElementDelta.ADDED:
|
||||||
try {
|
try {
|
||||||
PDOM pdom = ((PDOM)CCorePlugin.getPDOMManager().getPDOM((ICProject)delta.getElement()));
|
PDOM pdom = ((PDOM)CCoreInternals.getPDOMManager().getPDOM((ICProject)delta.getElement()));
|
||||||
pdom.addListener(this);
|
pdom.addListener(this);
|
||||||
handleChange(pdom);
|
handleChange(pdom);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
package org.eclipse.cdt.internal.ui.indexview;
|
package org.eclipse.cdt.internal.ui.indexview;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
@ -10,6 +6,11 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.ui.IObjectActionDelegate;
|
import org.eclipse.ui.IObjectActionDelegate;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 QNX Software Systems and others.
|
* Copyright (c) 2006 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
@ -44,9 +45,8 @@ public class RebuildIndexActionDelegate implements IObjectActionDelegate {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ICProject project = (ICProject)objs[i];
|
ICProject project = (ICProject)objs[i];
|
||||||
IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(project);
|
|
||||||
try {
|
try {
|
||||||
indexer.reindex();
|
CCoreInternals.getPDOMManager().reindex(project);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().log(e);
|
CUIPlugin.getDefault().log(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import java.util.List;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.text.ITextViewer;
|
import org.eclipse.jface.text.ITextViewer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
|
@ -34,6 +33,7 @@ import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
|
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
|
@ -61,7 +61,7 @@ public class PDOMCompletionContributor extends DOMCompletionContributor implemen
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PDOM pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(workingCopy.getCProject());
|
PDOM pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(workingCopy.getCProject());
|
||||||
IASTName[] names = completionNode.getNames();
|
IASTName[] names = completionNode.getNames();
|
||||||
for (int i = 0; i < names.length; ++i) {
|
for (int i = 0; i < names.length; ++i) {
|
||||||
IASTName name = names[i];
|
IASTName name = names[i];
|
||||||
|
|
Loading…
Add table
Reference in a new issue