1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Consolidate IPDOMManager vs. IIndexManager

This commit is contained in:
Markus Schorn 2007-03-19 16:46:11 +00:00
parent 6d88aaec37
commit 35f9b7f4a5
10 changed files with 20 additions and 29 deletions

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* 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.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.model.CoreModel;
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.IBuildDescription;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
@ -997,11 +997,7 @@ public class BuildDescriptionModelTests extends TestCase {
ManagedBuildTestHelper.createFile(project, "f.h", "\n");
ICProject cProject = CoreModel.getDefault().create(project);
try {
CCorePlugin.getPDOMManager().setIndexerId(cProject, PDOMFastIndexer.ID);
} catch (CoreException e2) {
doFail("testDes_gnu30_exe_deps: failed to associate the fast indexer with the project");
}
CCorePlugin.getIndexManager().setIndexerId(cProject, IPDOMManager.ID_FAST_INDEXER);
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
IManagedProject mProj = info.getManagedProject();
IConfiguration cfg = mProj.getConfigurations()[0];

View file

@ -72,7 +72,7 @@ public class IndexLocationTest extends BaseTestCase {
String content = testData[2].toString().replaceAll("ABS_EXTERNAL", externalHeader.getAbsolutePath().replaceAll("\\\\","\\\\\\\\"));
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()));
super.setUp();

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* 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);
}
}, 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
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, new NullProgressMonitor()));
return result[0];

View file

@ -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.IVariable;
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.model.CoreModel;
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.testplugin.CProjectHelper;
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.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
@ -51,7 +52,7 @@ public class TeamSharedIndexTest extends IndexTestBase {
}
private Collection fProjects= new LinkedList();
private static final PDOMManager fPDOMManager = (PDOMManager) CCorePlugin.getPDOMManager();
private static final IIndexManager fPDOMManager = CCoreInternals.getPDOMManager();
public TeamSharedIndexTest(String name) {
super(name);

View file

@ -58,7 +58,7 @@ public class TrilogyPerformanceTest extends IndexTestBase {
try {
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
long start = System.currentTimeMillis();
CCorePlugin.getPDOMManager().reindex(cproject);
CCorePlugin.getIndexManager().reindex(cproject);
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
System.out.println("Took: "+(System.currentTimeMillis() - start));
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject);

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -97,7 +97,7 @@ public class PDOMTestBase extends BaseTestCase {
}, null);
// 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
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));

View file

@ -56,7 +56,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// ScannerConfigNature.addScannerConfigNature(project);
// PerProjectSICollector.calculateCompilerBuiltins(project);
CCorePlugin.getPDOMManager().setIndexerId(fCProject, sourceIndexerID);
CCorePlugin.getIndexManager().setIndexerId(fCProject, sourceIndexerID);
index= CCorePlugin.getIndexManager().getIndex(fCProject);
}

View file

@ -52,7 +52,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
fCProject = createProject("CSelectionTestsDOMIndexerProject"); //$NON-NLS-1$
assertNotNull("Unable to create project", fCProject);
CCorePlugin.getPDOMManager().setIndexerId(fCProject, sourceIndexerID);
CCorePlugin.getIndexManager().setIndexerId(fCProject, sourceIndexerID);
index= CCorePlugin.getIndexManager().getIndex(fCProject);
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* 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.dom.IPDOMManager;
import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.ui.CUIPlugin;
@ -33,14 +34,10 @@ public class SetFastIndexerAction extends IndexAction {
public void run() {
try {
IPDOMManager manager = CCorePlugin.getPDOMManager();
IIndexManager manager = CCorePlugin.getIndexManager();
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
for (int i = 0; i < projects.length; ++i) {
try {
manager.setIndexerId(projects[i], IPDOMManager.ID_FAST_INDEXER);
} catch (CoreException e) {
CUIPlugin.getDefault().log(e);
}
manager.setIndexerId(projects[i], IPDOMManager.ID_FAST_INDEXER);
}
} catch (CoreException e) {
CCorePlugin.log(e);

View file

@ -18,7 +18,6 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.ui.IEditorPart;
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.index.IIndex;
import org.eclipse.cdt.core.index.IIndexManager;
@ -117,10 +116,8 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
if (proj == null) return null;
try{
IPDOMManager manager = CCorePlugin.getPDOMManager();
String indexerId = manager.getIndexerId(proj);
if (!IPDOMManager.ID_NO_INDEXER.equals(indexerId)) {
IIndexManager manager= CCorePlugin.getIndexManager();
if (manager.isProjectIndexed(proj)) {
fIndex = CCorePlugin.getIndexManager().getIndex(proj,
IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);