mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
Consolidate IPDOMManager vs. IIndexManager
This commit is contained in:
parent
6d88aaec37
commit
35f9b7f4a5
10 changed files with 20 additions and 29 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 Intel Corporation and others.
|
* Copyright (c) 2006, 2007 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -24,9 +24,9 @@ import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.fast.PDOMFastIndexer;
|
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
||||||
|
@ -997,11 +997,7 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
ManagedBuildTestHelper.createFile(project, "f.h", "\n");
|
ManagedBuildTestHelper.createFile(project, "f.h", "\n");
|
||||||
|
|
||||||
ICProject cProject = CoreModel.getDefault().create(project);
|
ICProject cProject = CoreModel.getDefault().create(project);
|
||||||
try {
|
CCorePlugin.getIndexManager().setIndexerId(cProject, IPDOMManager.ID_FAST_INDEXER);
|
||||||
CCorePlugin.getPDOMManager().setIndexerId(cProject, PDOMFastIndexer.ID);
|
|
||||||
} catch (CoreException e2) {
|
|
||||||
doFail("testDes_gnu30_exe_deps: failed to associate the fast indexer with the project");
|
|
||||||
}
|
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||||
IManagedProject mProj = info.getManagedProject();
|
IManagedProject mProj = info.getManagedProject();
|
||||||
IConfiguration cfg = mProj.getConfigurations()[0];
|
IConfiguration cfg = mProj.getConfigurations()[0];
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class IndexLocationTest extends BaseTestCase {
|
||||||
String content = testData[2].toString().replaceAll("ABS_EXTERNAL", externalHeader.getAbsolutePath().replaceAll("\\\\","\\\\\\\\"));
|
String content = testData[2].toString().replaceAll("ABS_EXTERNAL", externalHeader.getAbsolutePath().replaceAll("\\\\","\\\\\\\\"));
|
||||||
IFile file3 = TestSourceReader.createFile(cproject.getProject(), "source.cpp", content);
|
IFile file3 = TestSourceReader.createFile(cproject.getProject(), "source.cpp", content);
|
||||||
|
|
||||||
CCorePlugin.getPDOMManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, new NullProgressMonitor()));
|
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, new NullProgressMonitor()));
|
||||||
|
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -47,7 +47,7 @@ public class IndexTestBase extends BaseTestCase {
|
||||||
CProjectHelper.importSourcesFromPlugin(result[0], CTestPlugin.getDefault().getBundle(), importSource);
|
CProjectHelper.importSourcesFromPlugin(result[0], CTestPlugin.getDefault().getBundle(), importSource);
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
CCorePlugin.getPDOMManager().setIndexerId(result[0], IPDOMManager.ID_FAST_INDEXER);
|
CCorePlugin.getIndexManager().setIndexerId(result[0], IPDOMManager.ID_FAST_INDEXER);
|
||||||
// wait until the indexer is done
|
// wait until the indexer is done
|
||||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, new NullProgressMonitor()));
|
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, new NullProgressMonitor()));
|
||||||
return result[0];
|
return result[0];
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
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.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||||
|
@ -30,7 +31,7 @@ import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMManager;
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
|
@ -51,7 +52,7 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection fProjects= new LinkedList();
|
private Collection fProjects= new LinkedList();
|
||||||
private static final PDOMManager fPDOMManager = (PDOMManager) CCorePlugin.getPDOMManager();
|
private static final IIndexManager fPDOMManager = CCoreInternals.getPDOMManager();
|
||||||
|
|
||||||
public TeamSharedIndexTest(String name) {
|
public TeamSharedIndexTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class TrilogyPerformanceTest extends IndexTestBase {
|
||||||
try {
|
try {
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
CCorePlugin.getPDOMManager().reindex(cproject);
|
CCorePlugin.getIndexManager().reindex(cproject);
|
||||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||||
System.out.println("Took: "+(System.currentTimeMillis() - start));
|
System.out.println("Took: "+(System.currentTimeMillis() - start));
|
||||||
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject);
|
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 QNX Software Systems and others.
|
* Copyright (c) 2006, 2007 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -97,7 +97,7 @@ public class PDOMTestBase extends BaseTestCase {
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
// Index the project
|
// Index the project
|
||||||
CCorePlugin.getPDOMManager().setIndexerId(cprojects[0], IPDOMManager.ID_FAST_INDEXER);
|
CCorePlugin.getIndexManager().setIndexerId(cprojects[0], IPDOMManager.ID_FAST_INDEXER);
|
||||||
// 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()));
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
||||||
// ScannerConfigNature.addScannerConfigNature(project);
|
// ScannerConfigNature.addScannerConfigNature(project);
|
||||||
// PerProjectSICollector.calculateCompilerBuiltins(project);
|
// PerProjectSICollector.calculateCompilerBuiltins(project);
|
||||||
|
|
||||||
CCorePlugin.getPDOMManager().setIndexerId(fCProject, sourceIndexerID);
|
CCorePlugin.getIndexManager().setIndexerId(fCProject, sourceIndexerID);
|
||||||
index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
||||||
fCProject = createProject("CSelectionTestsDOMIndexerProject"); //$NON-NLS-1$
|
fCProject = createProject("CSelectionTestsDOMIndexerProject"); //$NON-NLS-1$
|
||||||
assertNotNull("Unable to create project", fCProject);
|
assertNotNull("Unable to create project", fCProject);
|
||||||
|
|
||||||
CCorePlugin.getPDOMManager().setIndexerId(fCProject, sourceIndexerID);
|
CCorePlugin.getIndexManager().setIndexerId(fCProject, sourceIndexerID);
|
||||||
index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2006 QNX Software Systems
|
* Copyright (c) 2005, 2007 QNX Software Systems
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -16,6 +16,7 @@ import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -33,14 +34,10 @@ public class SetFastIndexerAction extends IndexAction {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
IPDOMManager manager = CCorePlugin.getPDOMManager();
|
IIndexManager manager = CCorePlugin.getIndexManager();
|
||||||
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
|
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
|
||||||
for (int i = 0; i < projects.length; ++i) {
|
for (int i = 0; i < projects.length; ++i) {
|
||||||
try {
|
manager.setIndexerId(projects[i], IPDOMManager.ID_FAST_INDEXER);
|
||||||
manager.setIndexerId(projects[i], IPDOMManager.ID_FAST_INDEXER);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
CUIPlugin.getDefault().log(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.jface.text.ITextViewer;
|
||||||
import org.eclipse.ui.IEditorPart;
|
import org.eclipse.ui.IEditorPart;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IIndexManager;
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
|
@ -117,10 +116,8 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
|
||||||
if (proj == null) return null;
|
if (proj == null) return null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
IPDOMManager manager = CCorePlugin.getPDOMManager();
|
IIndexManager manager= CCorePlugin.getIndexManager();
|
||||||
String indexerId = manager.getIndexerId(proj);
|
if (manager.isProjectIndexed(proj)) {
|
||||||
|
|
||||||
if (!IPDOMManager.ID_NO_INDEXER.equals(indexerId)) {
|
|
||||||
fIndex = CCorePlugin.getIndexManager().getIndex(proj,
|
fIndex = CCorePlugin.getIndexManager().getIndex(proj,
|
||||||
IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue