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.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
|
@ -57,8 +56,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
protected void setUp() throws CoreException {
|
||||
fCProject= CProjectHelper.createCCProject("__bugsTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||
IPDOMIndexer indexer = CCoreInternals.getPDOMManager().getIndexer(fCProject);
|
||||
indexer.reindex();
|
||||
CCoreInternals.getPDOMManager().reindex(fCProject);
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
String content = "// comment \n#include \"header20061107.h\"\n";
|
||||
IFile file= TestSourceReader.createFile(fProject.getProject(), "intermed20061107.h", content);
|
||||
TestSourceReader.createFile(fProject.getProject(), "source20061107.cpp", "#include \"intermed20061107.h\"\n");
|
||||
CCoreInternals.getPDOMManager().getIndexer(fProject).reindex();
|
||||
CCoreInternals.getPDOMManager().reindex(fProject);
|
||||
waitForIndexer();
|
||||
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ import java.util.regex.Pattern;
|
|||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
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.core.runtime.NullProgressMonitor;
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class CCompositeTypeTests extends PDOMTestBase {
|
|||
CCompositeTypeTests foo = null;
|
||||
|
||||
project = createProject("compositeTypeTests");
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
|
||||
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.IFunction;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ public class CFunctionTests extends PDOMTestBase {
|
|||
|
||||
protected void setUp() throws Exception {
|
||||
project = createProject("functionTests");
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ public class CPPCompositeTypeTests extends PDOMTestBase {
|
|||
CPPCompositeTypeTests foo = null;
|
||||
|
||||
project = createProject("compositeTypeTests");
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
|
||||
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.IBasicType;
|
||||
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.ICPPMember;
|
||||
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.core.runtime.CoreException;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class CPPFieldTests extends PDOMTestBase {
|
|||
|
||||
protected void setUp() throws Exception {
|
||||
project = createProject("fieldTests");
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
|
||||
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.IBasicType;
|
||||
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.ICPPFunction;
|
||||
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.core.runtime.CoreException;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class CPPFunctionTests extends PDOMTestBase {
|
|||
|
||||
protected void setUp() throws Exception {
|
||||
project = createProject("functionTests");
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
|
||||
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.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ public class CPPVariableTests extends PDOMTestBase {
|
|||
|
||||
protected void setUp() throws Exception {
|
||||
project = createProject("variableTests");
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
|
||||
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.IVariable;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ public class CVariableTests extends PDOMTestBase {
|
|||
|
||||
protected void setUp() throws Exception {
|
||||
project = createProject("variableTests");
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.regex.Pattern;
|
|||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
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.IndexFilter;
|
||||
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.dom.PDOMName;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
@ -47,7 +47,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
protected void setUp() throws Exception {
|
||||
if (pdom == null) {
|
||||
ICProject project = createProject("classTests");
|
||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
}
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.regex.Pattern;
|
|||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
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.model.ICProject;
|
||||
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.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
@ -53,7 +53,7 @@ public class DefDeclTests extends PDOMTestBase {
|
|||
String requiredName = "defDeclTests";
|
||||
ICProject cproject = createProject(requiredName);
|
||||
this.projectName = cproject.getElementName();
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(cproject);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Pattern;
|
|||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
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.IndexFilter;
|
||||
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.core.runtime.NullProgressMonitor;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class EnumerationTests extends PDOMTestBase {
|
|||
protected void setUp() throws Exception {
|
||||
if (pdom == null) {
|
||||
ICProject project = createProject("enumerationTests");
|
||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
}
|
||||
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.IndexFilter;
|
||||
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.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -53,7 +54,7 @@ public class FilesOnReindexTests extends PDOMTestBase {
|
|||
IFile file = project.getProject().getFile("simple.cpp");
|
||||
performAssertions(file);
|
||||
pdom.releaseReadLock();
|
||||
CCorePlugin.getPDOMManager().getIndexer(project).reindex();
|
||||
CCoreInternals.getPDOMManager().reindex(project);
|
||||
|
||||
// wait until the indexer is done
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
|
||||
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.IBinding;
|
||||
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.ICPPMethod;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@ public class MethodTests extends PDOMTestBase {
|
|||
|
||||
protected void setUp() throws Exception {
|
||||
project = createProject("methodTests");
|
||||
pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Pattern;
|
|||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
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.IndexFilter;
|
||||
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.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
@ -49,7 +49,7 @@ public class NamespaceTests extends PDOMTestBase {
|
|||
protected void setUp() throws Exception {
|
||||
if (pdom == null) {
|
||||
ICProject project = createProject("namespaceTests", true);
|
||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
}
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ import java.util.regex.Pattern;
|
|||
|
||||
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.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
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.pdom.PDOM;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -41,7 +41,7 @@ public class OverloadsWithinCommonHeaderTests extends PDOMTestBase {
|
|||
protected void setUp() throws Exception {
|
||||
if (pdom == null) {
|
||||
ICProject project = createProject("overloadsWithinCommonHeader", true);
|
||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
}
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
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.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
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.dom.PDOMBinding;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -35,7 +35,7 @@ public class OverloadsWithinSingleTUTests extends PDOMTestBase {
|
|||
protected void setUp() throws Exception {
|
||||
if (pdom == null) {
|
||||
ICProject project = createProject("overloadsWithinSingleTU");
|
||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
}
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Pattern;
|
|||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
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.IndexFilter;
|
||||
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.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
|
@ -54,7 +54,7 @@ public class PDOMSearchTest extends PDOMTestBase {
|
|||
protected void setUp() throws Exception {
|
||||
if (pdom == null) {
|
||||
ICProject project = createProject("searchTests", true);
|
||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
}
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
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.core.runtime.NullProgressMonitor;
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class RaceCondition157992Test extends PDOMTestBase {
|
|||
|
||||
for(int i=0; i<noTrials; i++) {
|
||||
ICProject project = createProject("classTests");
|
||||
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
pdom.acquireReadLock();
|
||||
|
||||
IBinding[] Bs = pdom.findBindings(Pattern.compile("B"), new NullProgressMonitor());
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Pattern;
|
|||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
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.IndexFilter;
|
||||
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.core.runtime.NullProgressMonitor;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class TypesTests extends PDOMTestBase {
|
|||
protected void setUp() throws Exception {
|
||||
if (pdom == null) {
|
||||
ICProject project = createProject("types");
|
||||
pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
}
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
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.IPDOMVisitor;
|
||||
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.ICElement;
|
||||
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.PDOMManager;
|
||||
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.c.PDOMCStructure;
|
||||
|
@ -144,7 +145,7 @@ public class AllTypesCache {
|
|||
|
||||
private static ITypeInfo[] getTypes(ICProject[] projects, int[] kinds) throws CoreException {
|
||||
List types = new ArrayList();
|
||||
IPDOMManager pdomManager = CCorePlugin.getPDOMManager();
|
||||
PDOMManager pdomManager = CCoreInternals.getPDOMManager();
|
||||
|
||||
for (int i = 0; i < projects.length; ++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.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
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.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||
|
@ -121,7 +121,7 @@ public class PDOMTypeInfo implements ITypeInfo {
|
|||
|
||||
public ITypeReference getResolvedReference() {
|
||||
try {
|
||||
PDOM pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
PDOM pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||
IName[] names= pdom.findNames(binding, IIndex.FIND_DEFINITIONS);
|
||||
return names != null && names.length > 0 ? new PDOMTypeReference(names[0], project) : null;
|
||||
} catch (CoreException e) {
|
||||
|
|
|
@ -37,13 +37,19 @@ public interface IPDOMIndexerTask {
|
|||
* Used by the framework to report progress.
|
||||
* @since 4.0
|
||||
*/
|
||||
public int getRemainingSubtaskCount();
|
||||
public int estimateRemainingSources();
|
||||
|
||||
/**
|
||||
* Used by the framework to report progress.
|
||||
* @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.
|
||||
|
|
|
@ -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_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;
|
||||
|
||||
// Get the indexer for a given project
|
||||
public IPDOMIndexer getIndexer(ICProject project);
|
||||
public void reindex(ICProject project) throws CoreException;
|
||||
|
||||
// Getting and setting indexer Ids
|
||||
public String getDefaultIndexerId();
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ASTCompletionNode {
|
|||
* @return the prefix text up to the point of completion
|
||||
*/
|
||||
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() {
|
||||
return scanner.toString(); //$NON-NLS-1$
|
||||
return scanner.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -415,7 +415,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
resolveAmbiguities();
|
||||
log.traceLog("Ambiguity resolution : " //$NON-NLS-1$
|
||||
+ (System.currentTimeMillis() - startTime) + "ms" //$NON-NLS-1$
|
||||
); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
);
|
||||
IASTTranslationUnit result = getTranslationUnit();
|
||||
nullifyTranslationUnit();
|
||||
return result;
|
||||
|
|
|
@ -50,13 +50,21 @@ public class IndexBasedCodeReaderFactory implements ICodeReaderFactory {
|
|||
|
||||
private static final char[] EMPTY_CHARS = new char[0];
|
||||
|
||||
private static class NeedToParseException extends Exception {}
|
||||
public static class FileInfo {
|
||||
private FileInfo() {}
|
||||
public IIndexFile fFile= null;
|
||||
public IMacro[] fMacros= null;
|
||||
public boolean fNeedToIndex= false;
|
||||
private boolean fRequested= false;
|
||||
|
||||
public boolean isRequested() {
|
||||
return fRequested;
|
||||
}
|
||||
public void setRequested(boolean val) {
|
||||
fRequested= val;
|
||||
}
|
||||
}
|
||||
private static class NeedToParseException extends Exception {}
|
||||
|
||||
|
||||
public IndexBasedCodeReaderFactory(IIndex index) {
|
||||
this.index = index;
|
||||
|
@ -138,7 +146,7 @@ public class IndexBasedCodeReaderFactory implements ICodeReaderFactory {
|
|||
if (!target.add(fileInfo)) {
|
||||
return;
|
||||
}
|
||||
if (fileInfo.fFile == null || fileInfo.fNeedToIndex) {
|
||||
if (fileInfo.fFile == null || fileInfo.isRequested()) {
|
||||
throw new NeedToParseException();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.osgi.util.NLS;
|
|||
|
||||
public class Messages extends NLS {
|
||||
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_notifyJob_label;
|
||||
public static String PDOMManager_notifyTask_message;
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||
import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
|
||||
|
@ -29,7 +27,6 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
public class PDOMIndexerJob extends Job {
|
||||
|
||||
private final PDOMManager pdomManager;
|
||||
private int fCompletedSubtaskCount= 0;
|
||||
private IPDOMIndexerTask currentTask;
|
||||
private boolean cancelledByManager= false;
|
||||
private Object taskMutex = new Object();
|
||||
|
@ -48,15 +45,10 @@ public class PDOMIndexerJob extends Job {
|
|||
this.monitor = monitor;
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
String taskName = CCorePlugin.getResourceString("pdom.indexer.task"); //$NON-NLS-1$
|
||||
monitor.beginTask(taskName, IProgressMonitor.UNKNOWN);
|
||||
startMonitorJob(monitor);
|
||||
try {
|
||||
do {
|
||||
synchronized(taskMutex) {
|
||||
if (currentTask != null) {
|
||||
fCompletedSubtaskCount+= currentTask.getCompletedSubtaskCount();
|
||||
}
|
||||
currentTask= null;
|
||||
taskMutex.notify();
|
||||
|
||||
|
@ -118,10 +110,13 @@ public class PDOMIndexerJob extends Job {
|
|||
}
|
||||
|
||||
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) {
|
||||
String taskName = CCorePlugin.getResourceString("pdom.indexer.task"); //$NON-NLS-1$
|
||||
monitor.beginTask(taskName, 1000);
|
||||
int currentTick= 0;
|
||||
while(!m.isCanceled()) {
|
||||
updateMonitor(monitor);
|
||||
currentTick= pdomManager.getMonitorMessage(monitor, currentTick, 1000);
|
||||
try {
|
||||
Thread.sleep(350);
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -135,21 +130,6 @@ public class PDOMIndexerJob extends Job {
|
|||
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) {
|
||||
synchronized (taskMutex) {
|
||||
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 IPDOMIndexerTask fCurrentTask;
|
||||
private LinkedList fTaskQueue = new LinkedList();
|
||||
private int fCompletedSources;
|
||||
private int fCompletedHeaders;
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
fTaskQueue.addLast(subjob);
|
||||
if (fIndexerJob == null) {
|
||||
fCompletedSources= 0;
|
||||
fCompletedHeaders= 0;
|
||||
fIndexerJob = new PDOMIndexerJob(this);
|
||||
fIndexerJob.schedule();
|
||||
notifyBusy= true;
|
||||
|
@ -443,6 +447,10 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
|||
idle= true;
|
||||
}
|
||||
else {
|
||||
if (fCurrentTask != null) {
|
||||
fCompletedSources+= fCurrentTask.getCompletedSourcesCount();
|
||||
fCompletedHeaders+= fCurrentTask.getCompletedHeadersCount();
|
||||
}
|
||||
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;
|
||||
synchronized (fTaskQueueMutex) {
|
||||
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) {
|
||||
fChangeListeners.add(listener);
|
||||
}
|
||||
|
@ -644,14 +673,15 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
|||
}
|
||||
|
||||
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;
|
||||
try {
|
||||
while (true) {
|
||||
int currentTicks= 0;
|
||||
if (monitor.isCanceled()) {
|
||||
return false;
|
||||
}
|
||||
monitor.subTask(getMonitorMessage());
|
||||
currentTicks= getMonitorMessage(monitor, currentTicks, 1000);
|
||||
synchronized(fTaskQueueMutex) {
|
||||
if (isIndexerIdle()) {
|
||||
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);
|
||||
int remainingCount= 0;
|
||||
int completedCount= 0;
|
||||
IPDOMIndexerTask currentTask= null;
|
||||
PDOMIndexerJob currentJob= null;
|
||||
int remainingSources= 0;
|
||||
int completedSources= 0;
|
||||
int completedHeaders= 0;
|
||||
String detail= null;
|
||||
synchronized (fTaskQueueMutex) {
|
||||
completedHeaders= fCompletedHeaders;
|
||||
completedSources= fCompletedSources;
|
||||
for (Iterator iter = fTaskQueue.iterator(); iter.hasNext();) {
|
||||
IPDOMIndexerTask task = (IPDOMIndexerTask) iter.next();
|
||||
remainingCount+= task.getRemainingSubtaskCount();
|
||||
remainingSources+= task.estimateRemainingSources();
|
||||
}
|
||||
if (fCurrentTask != null) {
|
||||
remainingSources+= fCurrentTask.estimateRemainingSources();
|
||||
completedHeaders+= fCurrentTask.getCompletedHeadersCount();
|
||||
completedSources+= fCurrentTask.getCompletedSourcesCount();
|
||||
detail= fCurrentTask.getMonitorMessageDetail();
|
||||
}
|
||||
currentTask= fCurrentTask;
|
||||
currentJob= fIndexerJob;
|
||||
}
|
||||
if (currentTask != null) {
|
||||
remainingCount += currentTask.getRemainingSubtaskCount();
|
||||
|
||||
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$
|
||||
}
|
||||
if (currentJob != null) {
|
||||
completedCount= currentJob.getCompletedSubtaskCount();
|
||||
monitor.subTask(msg);
|
||||
|
||||
if (completedSources > 0 && totalSources >= completedSources) {
|
||||
int newTick= completedSources*base/totalSources;
|
||||
if (newTick > currentTicks) {
|
||||
monitor.worked(newTick-currentTicks);
|
||||
return newTick;
|
||||
}
|
||||
}
|
||||
return MessageFormat.format("{0}/{1}", new Object[] { //$NON-NLS-1$
|
||||
new Integer(completedCount), new Integer(remainingCount+completedCount)
|
||||
});
|
||||
return currentTicks;
|
||||
}
|
||||
|
||||
|
||||
|
@ -725,4 +770,5 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
|||
public IIndex getIndex(ICProject[] projects, int options) throws CoreException {
|
||||
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.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||
private static final Object NO_CONTEXT = new Object();
|
||||
protected static final int MAX_ERRORS = 10;
|
||||
|
||||
protected volatile int fTotalTasks= 0;
|
||||
protected volatile int fCompletedTasks= 0;
|
||||
protected volatile int fTotalSourcesEstimate= 0;
|
||||
protected volatile int fCompletedSources= 0;
|
||||
protected volatile int fCompletedHeaders= 0;
|
||||
protected int fErrorCount;
|
||||
protected Map fContextMap= new HashMap();
|
||||
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 {
|
||||
int flags = delta.getFlags();
|
||||
|
@ -199,11 +209,16 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
|||
return fMessage;
|
||||
}
|
||||
|
||||
final public int getRemainingSubtaskCount() {
|
||||
return fTotalTasks-fCompletedTasks;
|
||||
|
||||
final public int estimateRemainingSources() {
|
||||
return fTotalSourcesEstimate-fCompletedSources;
|
||||
}
|
||||
|
||||
final public int getCompletedSubtaskCount() {
|
||||
return fCompletedTasks;
|
||||
public int getCompletedHeadersCount() {
|
||||
return fCompletedHeaders;
|
||||
}
|
||||
|
||||
public int getCompletedSourcesCount() {
|
||||
return fCompletedSources;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class PDOMFastHandleDelta extends PDOMFastIndexerJob {
|
|||
public PDOMFastHandleDelta(PDOMFastIndexer indexer, ICElementDelta delta) throws CoreException {
|
||||
super(indexer);
|
||||
processDelta(delta, changed, changed, removed);
|
||||
fTotalTasks= changed.size() + removed.size();
|
||||
fTotalSourcesEstimate= changed.size() + removed.size();
|
||||
}
|
||||
|
||||
public void run(IProgressMonitor monitor) {
|
||||
|
@ -47,10 +47,27 @@ class PDOMFastHandleDelta extends PDOMFastIndexerJob {
|
|||
return;
|
||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||
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()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class PDOMFastIndexer implements IPDOMIndexer {
|
|||
|
||||
public void handleDelta(ICElementDelta delta) throws CoreException {
|
||||
PDOMFastHandleDelta fhd= new PDOMFastHandleDelta(this, delta);
|
||||
if (fhd.getRemainingSubtaskCount() > 0) {
|
||||
if (fhd.estimateRemainingSources() > 0) {
|
||||
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.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
|
@ -54,14 +53,9 @@ abstract class PDOMFastIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
|||
protected final PDOMFastIndexer indexer;
|
||||
protected IWritableIndex index;
|
||||
protected IndexBasedCodeReaderFactory codeReaderFactory;
|
||||
private boolean fTrace= false;
|
||||
|
||||
public PDOMFastIndexerJob(PDOMFastIndexer indexer) throws CoreException {
|
||||
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 {
|
||||
|
@ -69,11 +63,11 @@ abstract class PDOMFastIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
|||
this.codeReaderFactory = new IndexBasedCodeReaderFactory(index);
|
||||
}
|
||||
|
||||
protected void registerTUsInReaderFactory(Collection tus) throws CoreException {
|
||||
for (Iterator iter = tus.iterator(); iter.hasNext();) {
|
||||
protected void registerTUsInReaderFactory(Collection files) throws CoreException {
|
||||
for (Iterator iter = files.iterator(); iter.hasNext();) {
|
||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||
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();
|
||||
FileInfo info= codeReaderFactory.createFileInfo(path);
|
||||
if (!info.fNeedToIndex && info.fFile != null) {
|
||||
if (fTrace) {
|
||||
System.out.println("Indexer: skipping " + path); //$NON-NLS-1$
|
||||
}
|
||||
iter.remove();
|
||||
}
|
||||
else {
|
||||
|
||||
// file is requested or is not yet indexed.
|
||||
if (info.isRequested() || info.fFile == null) {
|
||||
// resolve the names
|
||||
ArrayList names= ((ArrayList[]) entry.getValue())[2];
|
||||
for (int i=0; i<names.size(); i++) {
|
||||
((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);
|
||||
try {
|
||||
for (Iterator iter = paths.iterator(); iter.hasNext();) {
|
||||
if (pm.isCanceled())
|
||||
return;
|
||||
|
||||
String path = (String) iter.next();
|
||||
FileInfo info= codeReaderFactory.createFileInfo(path);
|
||||
if (!info.fNeedToIndex) {
|
||||
fTotalTasks++;
|
||||
if (info.isRequested()) {
|
||||
info.setRequested(false);
|
||||
|
||||
if (isFirstRequest)
|
||||
isFirstRequest= false;
|
||||
else
|
||||
fTotalSourcesEstimate--;
|
||||
}
|
||||
info.fNeedToIndex= false;
|
||||
if (fTrace) {
|
||||
System.out.println("Indexer: adding " + path); //$NON-NLS-1$
|
||||
}
|
||||
addToIndex(path, info, (ArrayList[]) symbolMap.get(path));
|
||||
fCompletedTasks++;
|
||||
if (pm.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFirstAddition)
|
||||
isFirstAddition= false;
|
||||
else
|
||||
fCompletedHeaders++;
|
||||
}
|
||||
} finally {
|
||||
index.releaseWriteLock(1);
|
||||
}
|
||||
fCompletedSources++;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
protected void parseTUs(List translationUnits, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
||||
protected void parseTUs(List sources, List headers, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
||||
// sources first
|
||||
Iterator i = translationUnits.iterator();
|
||||
while (i.hasNext()) {
|
||||
Iterator iter;
|
||||
for (iter= sources.iterator(); iter.hasNext();) {
|
||||
if (monitor.isCanceled())
|
||||
return;
|
||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||
if (tu.isSourceUnit()) {
|
||||
parseTU(tu, monitor);
|
||||
i.remove();
|
||||
fCompletedTasks++;
|
||||
}
|
||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||
parseTU(tu, monitor);
|
||||
}
|
||||
|
||||
// headers with context
|
||||
i = translationUnits.iterator();
|
||||
while (i.hasNext()) {
|
||||
for (iter= headers.iterator(); iter.hasNext();) {
|
||||
if (monitor.isCanceled())
|
||||
return;
|
||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||
FileInfo info= codeReaderFactory.createFileInfo(tu);
|
||||
if (!info.fNeedToIndex) {
|
||||
i.remove();
|
||||
// check if header was handled while parsing a source
|
||||
if (!info.isRequested()) {
|
||||
iter.remove();
|
||||
}
|
||||
else if (info.fFile != null) {
|
||||
ITranslationUnit context= findContext(index, info.fFile.getLocation());
|
||||
|
@ -298,14 +301,14 @@ abstract class PDOMFastIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
|||
|
||||
// headers without context
|
||||
if (getIndexAllFiles()) {
|
||||
i = translationUnits.iterator();
|
||||
while (i.hasNext()) {
|
||||
for (iter= headers.iterator(); iter.hasNext();) {
|
||||
if (monitor.isCanceled())
|
||||
return;
|
||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||
FileInfo info= codeReaderFactory.createFileInfo(tu);
|
||||
if (!info.fNeedToIndex) {
|
||||
i.remove();
|
||||
// check if header was handled while parsing a source
|
||||
if (!info.isRequested()) {
|
||||
iter.remove();
|
||||
}
|
||||
else {
|
||||
parseTU(tu, monitor);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
package org.eclipse.cdt.internal.core.pdom.indexer.fast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -25,33 +25,29 @@ import org.eclipse.core.runtime.Platform;
|
|||
*
|
||||
*/
|
||||
class PDOMFastReindex extends PDOMFastIndexerJob {
|
||||
private ArrayList fTUs= new ArrayList();
|
||||
|
||||
public PDOMFastReindex(PDOMFastIndexer indexer) throws CoreException {
|
||||
super(indexer);
|
||||
fTotalTasks= 1;
|
||||
}
|
||||
|
||||
public void run(final IProgressMonitor monitor) {
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
boolean allFiles= getIndexAllFiles();
|
||||
Collection headers= allFiles ? fTUs : null;
|
||||
collectSources(indexer.getProject(), fTUs, headers, allFiles);
|
||||
fTotalTasks+= fTUs.size()+1;
|
||||
fCompletedTasks+= 1;
|
||||
List sources= new ArrayList();
|
||||
List headers= new ArrayList();
|
||||
collectSources(indexer.getProject(), sources, allFiles ? headers : null, allFiles);
|
||||
|
||||
fTotalSourcesEstimate= sources.size() + headers.size();
|
||||
setupIndexAndReaderFactory();
|
||||
clearIndex(index);
|
||||
|
||||
if (getRemainingSubtaskCount() == 1 || monitor.isCanceled()) {
|
||||
if (fTotalSourcesEstimate==0 || monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
registerTUsInReaderFactory(fTUs);
|
||||
fCompletedTasks++;
|
||||
|
||||
parseTUs(fTUs, monitor);
|
||||
registerTUsInReaderFactory(sources);
|
||||
registerTUsInReaderFactory(headers);
|
||||
parseTUs(sources, headers, monitor);
|
||||
|
||||
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
||||
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.internal.core.pdom.indexer.full;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -36,14 +35,26 @@ class PDOMFullHandleDelta extends PDOMFullIndexerJob {
|
|||
public PDOMFullHandleDelta(PDOMFullIndexer indexer, ICElementDelta delta) throws CoreException {
|
||||
super(indexer);
|
||||
processDelta(delta, changed, changed, removed);
|
||||
fTotalTasks= changed.size() + removed.size();
|
||||
fTotalSourcesEstimate= changed.size() + removed.size();
|
||||
}
|
||||
|
||||
public void run(IProgressMonitor monitor) {
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
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();
|
||||
while (i.hasNext()) {
|
||||
|
@ -51,13 +62,16 @@ class PDOMFullHandleDelta extends PDOMFullIndexerJob {
|
|||
return;
|
||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||
removeTU(index, tu);
|
||||
fCompletedTasks++;
|
||||
if (tu.isSourceUnit()) {
|
||||
fCompletedSources++;
|
||||
}
|
||||
else {
|
||||
fTotalSourcesEstimate--;
|
||||
fCompletedHeaders++;
|
||||
}
|
||||
}
|
||||
|
||||
parseTUs(changed, monitor);
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
parseTUs(sources, headers, monitor);
|
||||
|
||||
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
||||
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
||||
|
|
|
@ -42,7 +42,7 @@ public class PDOMFullIndexer implements IPDOMIndexer {
|
|||
|
||||
public void handleDelta(ICElementDelta delta) throws CoreException {
|
||||
PDOMFullHandleDelta task = new PDOMFullHandleDelta(this, delta);
|
||||
if (task.getRemainingSubtaskCount() > 0) {
|
||||
if (task.estimateRemainingSources() > 0) {
|
||||
CCoreInternals.getPDOMManager().enqueue(task);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,45 +61,42 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
|||
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();
|
||||
|
||||
for (Iterator iter = required.iterator(); iter.hasNext();) {
|
||||
for (Iterator iter = sources.iterator(); iter.hasNext();) {
|
||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||
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();
|
||||
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
|
||||
Iterator i = translationUnits.iterator();
|
||||
while (i.hasNext()) {
|
||||
Iterator iter;
|
||||
for (iter = sources.iterator(); iter.hasNext();) {
|
||||
if (monitor.isCanceled())
|
||||
return;
|
||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||
String path = tu.getLocation().toOSString();
|
||||
if (filePathsToParse.get(path) == null) {
|
||||
i.remove();
|
||||
}
|
||||
else if (tu.isSourceUnit()) {
|
||||
if (filePathsToParse.get(path) != null) {
|
||||
parseTU(tu, monitor);
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// headers with context
|
||||
i = translationUnits.iterator();
|
||||
while (i.hasNext()) {
|
||||
for (iter = headers.iterator(); iter.hasNext();) {
|
||||
if (monitor.isCanceled())
|
||||
return;
|
||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||
String path = tu.getLocation().toOSString();
|
||||
if (filePathsToParse.get(path)==null) {
|
||||
i.remove();
|
||||
iter.remove();
|
||||
}
|
||||
else {
|
||||
ITranslationUnit context= findContext(index, path);
|
||||
|
@ -111,12 +108,13 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
|||
|
||||
// headers without context
|
||||
if (getIndexAllFiles()) {
|
||||
i = translationUnits.iterator();
|
||||
while (i.hasNext()) {
|
||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||
for (iter = headers.iterator(); iter.hasNext();) {
|
||||
if (monitor.isCanceled())
|
||||
return;
|
||||
ITranslationUnit tu = (ITranslationUnit) iter.next();
|
||||
String path = tu.getLocation().toOSString();
|
||||
if (filePathsToParse.get(path)==null) {
|
||||
i.remove();
|
||||
iter.remove();
|
||||
}
|
||||
else {
|
||||
parseTU(tu, monitor);
|
||||
|
@ -194,19 +192,40 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
|
|||
}
|
||||
}
|
||||
|
||||
boolean isFirstRequest= true;
|
||||
boolean isFirstAddition= true;
|
||||
index.acquireWriteLock(0);
|
||||
try {
|
||||
for (Iterator iter = symbolMap.entrySet().iterator(); iter.hasNext();) {
|
||||
if (pm.isCanceled()) {
|
||||
if (pm.isCanceled())
|
||||
return;
|
||||
}
|
||||
|
||||
Map.Entry entry = (Map.Entry) iter.next();
|
||||
String path= (String) entry.getKey();
|
||||
addToIndex(path, (ArrayList[]) entry.getValue());
|
||||
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());
|
||||
|
||||
if (isFirstAddition)
|
||||
isFirstAddition= false;
|
||||
else
|
||||
fCompletedHeaders++;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
index.releaseWriteLock(0);
|
||||
}
|
||||
fCompletedSources++;
|
||||
}
|
||||
|
||||
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 {
|
||||
Boolean required= (Boolean) filePathsToParse.remove(location);
|
||||
if (required == null) {
|
||||
return;
|
||||
}
|
||||
if (!required.booleanValue()) {
|
||||
fTotalTasks++;
|
||||
}
|
||||
|
||||
// Remove the old symbols in the tu
|
||||
Path path= 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++) {
|
||||
index.addName(file, (IASTName) list.get(i));
|
||||
}
|
||||
fCompletedTasks++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,39 +27,35 @@ import org.eclipse.core.runtime.Status;
|
|||
*/
|
||||
class PDOMFullReindex extends PDOMFullIndexerJob {
|
||||
|
||||
private ArrayList fTUs= new ArrayList();
|
||||
|
||||
public PDOMFullReindex(PDOMFullIndexer indexer) throws CoreException {
|
||||
super(indexer);
|
||||
fTotalTasks= 1;
|
||||
}
|
||||
|
||||
public void run(final IProgressMonitor monitor) {
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
boolean allfiles= getIndexAllFiles();
|
||||
List optional= new ArrayList();
|
||||
List headers= new ArrayList();
|
||||
List sources= new ArrayList();
|
||||
|
||||
collectSources(indexer.getProject(), fTUs, optional, allfiles);
|
||||
if (allfiles) {
|
||||
fTUs.addAll(optional);
|
||||
optional.clear();
|
||||
}
|
||||
collectSources(indexer.getProject(), sources, headers, allfiles);
|
||||
|
||||
fTotalTasks+= fTUs.size()+1;
|
||||
fCompletedTasks++;
|
||||
fTotalSourcesEstimate= sources.size();
|
||||
if (allfiles)
|
||||
fTotalSourcesEstimate+= headers.size();
|
||||
|
||||
setupIndexAndReaderFactory();
|
||||
clearIndex(index);
|
||||
|
||||
if (getRemainingSubtaskCount() == 1 || monitor.isCanceled()) {
|
||||
if (fTotalSourcesEstimate == 0 || monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
registerTUsInReaderFactory(fTUs, optional);
|
||||
fCompletedTasks++;
|
||||
registerTUsInReaderFactory(sources, headers, allfiles);
|
||||
if (!allfiles)
|
||||
headers.clear();
|
||||
|
||||
parseTUs(fTUs, monitor);
|
||||
parseTUs(sources, headers, monitor);
|
||||
|
||||
String showTimings = Platform.getDebugOption(CCorePlugin.PLUGIN_ID
|
||||
+ "/debug/pdomtimings"); //$NON-NLS-1$
|
||||
|
|
|
@ -73,11 +73,15 @@ public class PDOMNullIndexer implements IPDOMIndexer {
|
|||
return null;
|
||||
}
|
||||
|
||||
public int getCompletedSubtaskCount() {
|
||||
public int estimateRemainingSources() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getRemainingSubtaskCount() {
|
||||
public int getCompletedHeadersCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCompletedSourcesCount() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,3 +3,4 @@ PDOMManager_notifyJob_label=Notify Index Change Listeners
|
|||
PDOMManager_JoinIndexerTask=Join Indexer
|
||||
PDOMManager_savePrefsJob=Save Project Preferences
|
||||
PDOMManager_notifyTask_message=Notify Listeners
|
||||
PDOMManager_indexMonitorDetail={0}/{1} sources, {2} headers
|
||||
|
|
|
@ -651,9 +651,6 @@ public class CCorePlugin extends Plugin {
|
|||
return fCoreModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* deprecated, use getIndexManager()
|
||||
*/
|
||||
public static IPDOMManager getPDOMManager() {
|
||||
return getDefault().pdomManager;
|
||||
}
|
||||
|
|
|
@ -77,3 +77,4 @@ pdom.indexer.name=C/C++ Indexer
|
|||
pdom.indexer.task=Indexing
|
||||
pdom.indexer.filling=Counting files
|
||||
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.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
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.tests.BaseUITestCase;
|
||||
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.callhierarchy.CHViewPart;
|
||||
import org.eclipse.cdt.internal.ui.callhierarchy.CallHierarchyUI;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
|
@ -42,12 +43,7 @@ public class CallHierarchyBaseTest extends BaseUITestCase {
|
|||
|
||||
protected void setUp() throws CoreException {
|
||||
fCProject= CProjectHelper.createCCProject("__chTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||
IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(fCProject);
|
||||
try {
|
||||
indexer.reindex();
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
}
|
||||
CCoreInternals.getPDOMManager().reindex(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.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
||||
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.ast.IASTName;
|
||||
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.model.ICProject;
|
||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.tests.BaseUITestCase;
|
||||
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
|
||||
public class ResolveBindingTests extends BaseUITestCase {
|
||||
|
||||
private static final int WAIT_FOR_INDEXER = 5000;
|
||||
|
@ -50,12 +49,7 @@ public class ResolveBindingTests extends BaseUITestCase {
|
|||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
fCProject= CProjectHelper.createCProject("ResolveBindingTests", "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(fCProject);
|
||||
try {
|
||||
indexer.reindex();
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
}
|
||||
CCoreInternals.getPDOMManager().reindex(fCProject);
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
*******************************************************************************/
|
||||
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.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
|
@ -22,6 +18,11 @@ import org.eclipse.ui.IActionDelegate;
|
|||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
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 {
|
||||
|
||||
private ISelection selection;
|
||||
|
@ -45,9 +46,8 @@ public class PDOMUpdateProjectAction implements IObjectActionDelegate {
|
|||
continue;
|
||||
|
||||
ICProject project = (ICProject)objs[i];
|
||||
IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(project);
|
||||
try {
|
||||
indexer.reindex();
|
||||
CCoreInternals.getPDOMManager().reindex(project);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
}
|
||||
|
|
|
@ -10,22 +10,24 @@
|
|||
*******************************************************************************/
|
||||
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.IPDOMVisitor;
|
||||
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.db.IBTreeVisitor;
|
||||
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.PDOMMacro;
|
||||
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
|
||||
|
@ -69,7 +71,7 @@ public class CountNodeAction extends IndexAction {
|
|||
continue;
|
||||
|
||||
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.getFileIndex().accept(new IBTreeVisitor() {
|
||||
|
|
|
@ -14,24 +14,6 @@ package org.eclipse.cdt.internal.ui.indexview;
|
|||
import java.util.Arrays;
|
||||
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.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -57,6 +39,27 @@ import org.eclipse.ui.IActionBars;
|
|||
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||
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
|
||||
*
|
||||
|
@ -182,7 +185,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
public Object[] getChildren(Object parentElement) {
|
||||
try {
|
||||
if (parentElement instanceof ICProject) {
|
||||
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM((ICProject)parentElement);
|
||||
PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM((ICProject)parentElement);
|
||||
PDOMLinkage[] linkages= pdom.getLinkages();
|
||||
if (linkages.length == 1) {
|
||||
// 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) {
|
||||
try {
|
||||
if (element instanceof ICProject) {
|
||||
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM((ICProject)element);
|
||||
PDOM pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM((ICProject)element);
|
||||
PDOMLinkage[] linkages = pdom.getLinkages();
|
||||
if (linkages.length == 0)
|
||||
return false;
|
||||
|
@ -278,7 +281,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
try {
|
||||
ICProject[] projects = model.getCProjects();
|
||||
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);
|
||||
}
|
||||
viewer.setChildCount(model, projects.length);
|
||||
|
@ -322,7 +325,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
try {
|
||||
ICProject[] projects = model.getCProjects();
|
||||
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);
|
||||
}
|
||||
viewer.setChildCount(model, projects.length);
|
||||
|
@ -424,7 +427,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
switch (delta.getKind()) {
|
||||
case ICElementDelta.ADDED:
|
||||
try {
|
||||
PDOM pdom = ((PDOM)CCorePlugin.getPDOMManager().getPDOM((ICProject)delta.getElement()));
|
||||
PDOM pdom = ((PDOM)CCoreInternals.getPDOMManager().getPDOM((ICProject)delta.getElement()));
|
||||
pdom.addListener(this);
|
||||
handleChange(pdom);
|
||||
} catch (CoreException e) {
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
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.jface.action.IAction;
|
||||
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.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.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
|
@ -44,9 +45,8 @@ public class RebuildIndexActionDelegate implements IObjectActionDelegate {
|
|||
continue;
|
||||
|
||||
ICProject project = (ICProject)objs[i];
|
||||
IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(project);
|
||||
try {
|
||||
indexer.reindex();
|
||||
CCoreInternals.getPDOMManager().reindex(project);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.List;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
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.IPDOMVisitor;
|
||||
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.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.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||
|
@ -61,7 +61,7 @@ public class PDOMCompletionContributor extends DOMCompletionContributor implemen
|
|||
return;
|
||||
|
||||
try {
|
||||
PDOM pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(workingCopy.getCProject());
|
||||
PDOM pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(workingCopy.getCProject());
|
||||
IASTName[] names = completionNode.getNames();
|
||||
for (int i = 0; i < names.length; ++i) {
|
||||
IASTName name = names[i];
|
||||
|
|
Loading…
Add table
Reference in a new issue