1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Consolidate IPDOMManager vs. IIndexManager

This commit is contained in:
Markus Schorn 2007-03-19 16:52:09 +00:00
parent 35f9b7f4a5
commit fde5e2b801
5 changed files with 52 additions and 29 deletions

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 * 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
@ -14,7 +14,6 @@ package org.eclipse.cdt.core.dom;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
/** /**
* @author Doug Schaefer * @author Doug Schaefer
@ -25,23 +24,6 @@ public interface IPDOMManager {
public static final String ID_FAST_INDEXER= "org.eclipse.cdt.core.fastIndexer"; //$NON-NLS-1$ public static final String ID_FAST_INDEXER= "org.eclipse.cdt.core.fastIndexer"; //$NON-NLS-1$
public static final String ID_FULL_INDEXER= "org.eclipse.cdt.core.domsourceindexer"; //$NON-NLS-1$ public static final String ID_FULL_INDEXER= "org.eclipse.cdt.core.domsourceindexer"; //$NON-NLS-1$
/**
* Clears the entire index of the project and schedules the indexer.
* @throws CoreException
* @since 4.0
*/
public void reindex(ICProject project) throws CoreException;
/**
* Export index for usage within a team.
* @param project a project for which the pdom is to be exported.
* @param location the target location for the database.
* @param options currently none are supported.
* @throws CoreException
* @since 4.0
*/
public void export(ICProject project, String location, int options, IProgressMonitor monitor) throws CoreException;
// Getting and setting indexer Ids // Getting and setting indexer Ids
public String getDefaultIndexerId(); public String getDefaultIndexerId();
public void setDefaultIndexerId(String indexerId); public void setDefaultIndexerId(String indexerId);

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 * 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
@ -12,6 +12,7 @@
package org.eclipse.cdt.core.index; package org.eclipse.cdt.core.index;
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.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -31,14 +32,14 @@ import org.eclipse.core.runtime.IProgressMonitor;
* *
* @since 4.0 * @since 4.0
*/ */
public interface IIndexManager { public interface IIndexManager extends IPDOMManager {
/** /**
* Constant for passing to getIndex methods. This constant, when set, indicates * Constant for passing to getIndex methods. This constant, when set, indicates
* projects referenced by the set of input projects should also be added * projects referenced by the set of input projects should also be added
* to the resulting index. * to the resulting index.
*/ */
public final static int ADD_DEPENDENCIES = 0x1; public final static int ADD_DEPENDENCIES = 0x1;
/** /**
* Constant for passing to getIndex methods. This constant, when set, indicates * Constant for passing to getIndex methods. This constant, when set, indicates
* projects which reference any of the set of input projects should also be * projects which reference any of the set of input projects should also be
@ -58,7 +59,6 @@ public interface IIndexManager {
* @see IIndexManager#joinIndexer(int, IProgressMonitor) * @see IIndexManager#joinIndexer(int, IProgressMonitor)
*/ */
public final static int FOREVER= -1; public final static int FOREVER= -1;
/** /**
* Returns the index for the given project. * Returns the index for the given project.
* @param project the project to get the index for * @param project the project to get the index for
@ -130,4 +130,39 @@ public interface IIndexManager {
* Checks whether the indexer is currently idle * Checks whether the indexer is currently idle
*/ */
boolean isIndexerIdle(); boolean isIndexerIdle();
/**
* Returns whether an indexer is selected for the project.
* @since 4.0
*/
boolean isProjectIndexed(ICProject proj);
/**
* Returns the id of the indexer working on the project.
* @since 4.0
*/
public String getIndexerId(ICProject project);
/**
* Changes the indexer working on the project.
* @since 4.0
*/
public void setIndexerId(ICProject project, String indexerId);
/**
* Clears the entire index of the project and schedules the indexer.
* @throws CoreException
* @since 4.0
*/
public void reindex(ICProject project) throws CoreException;
/**
* Export index for usage within a team.
* @param project a project for which the pdom is to be exported.
* @param location the target location for the database.
* @param options currently none are supported.
* @throws CoreException
* @since 4.0
*/
public void export(ICProject project, String location, int options, IProgressMonitor monitor) throws CoreException;
} }

View file

@ -47,7 +47,6 @@ import org.eclipse.cdt.internal.core.index.IWritableIndexManager;
import org.eclipse.cdt.internal.core.index.IndexChangeEvent; import org.eclipse.cdt.internal.core.index.IndexChangeEvent;
import org.eclipse.cdt.internal.core.index.IndexFactory; import org.eclipse.cdt.internal.core.index.IndexFactory;
import org.eclipse.cdt.internal.core.index.IndexerStateEvent; import org.eclipse.cdt.internal.core.index.IndexerStateEvent;
import org.eclipse.cdt.internal.core.index.provider.IndexProviderManager;
import org.eclipse.cdt.internal.core.pdom.PDOM.IListener; import org.eclipse.cdt.internal.core.pdom.PDOM.IListener;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile; import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter; import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter;
@ -86,7 +85,7 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChange
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListener { public class PDOMManager implements IWritableIndexManager, IListener {
private static final class PerInstanceSchedulingRule implements ISchedulingRule { private static final class PerInstanceSchedulingRule implements ISchedulingRule {
public boolean contains(ISchedulingRule rule) { public boolean contains(ISchedulingRule rule) {
@ -250,7 +249,7 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
public String getIndexerId(ICProject project) { public String getIndexerId(ICProject project) {
IProject prj= project != null ? project.getProject() : null; IProject prj= project != null ? project.getProject() : null;
return IndexerPreferences.get(prj, IndexerPreferences.KEY_INDEXER_ID, ID_NO_INDEXER); return IndexerPreferences.get(prj, IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER);
} }
public void setIndexerId(final ICProject project, String indexerId) { public void setIndexerId(final ICProject project, String indexerId) {
@ -276,7 +275,7 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
IPDOMIndexer oldIndexer= null; IPDOMIndexer oldIndexer= null;
IProject prj= cproject.getProject(); IProject prj= cproject.getProject();
String newid= IndexerPreferences.get(prj, IndexerPreferences.KEY_INDEXER_ID, ID_NO_INDEXER); String newid= IndexerPreferences.get(prj, IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER);
Properties props= IndexerPreferences.getProperties(prj); Properties props= IndexerPreferences.getProperties(prj);
synchronized (fIndexerMutex) { synchronized (fIndexerMutex) {
@ -948,4 +947,8 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
String id= CCorePlugin.PLUGIN_ID + ".pdom.project." + DELIM + project.getName() + DELIM; //$NON-NLS-1$ String id= CCorePlugin.PLUGIN_ID + ".pdom.project." + DELIM + project.getName() + DELIM; //$NON-NLS-1$
pdom.setProperty(IIndexFragment.PROPERTY_FRAGMENT_ID, id); pdom.setProperty(IIndexFragment.PROPERTY_FRAGMENT_ID, id);
} }
public boolean isProjectIndexed(ICProject proj) {
return !IPDOMManager.ID_NO_INDEXER.equals(getIndexerId(proj));
}
} }

View file

@ -678,6 +678,9 @@ public class CCorePlugin extends Plugin {
return fCoreModel; return fCoreModel;
} }
/**
* @deprecated use getIndexManager().
*/
public static IPDOMManager getPDOMManager() { public static IPDOMManager getPDOMManager() {
return getDefault().pdomManager; return getDefault().pdomManager;
} }
@ -1211,7 +1214,7 @@ public class CCorePlugin extends Plugin {
public ICProjectDescription getProjectDescription(IProject project, boolean write){ public ICProjectDescription getProjectDescription(IProject project, boolean write){
return fNewCProjectDescriptionManager.getProjectDescription(project, write); return fNewCProjectDescriptionManager.getProjectDescription(project, write);
} }
/** /**
* forces the cached data of the specified projects to be re-calculated. * forces the cached data of the specified projects to be re-calculated.
* if the <code>projects</code> argument is <code>null</code> al projects * if the <code>projects</code> argument is <code>null</code> al projects

View file

@ -25,7 +25,7 @@ import org.osgi.service.prefs.BackingStoreException;
public class CCoreInternals { public class CCoreInternals {
public static PDOMManager getPDOMManager() { public static PDOMManager getPDOMManager() {
return (PDOMManager) CCorePlugin.getPDOMManager(); return (PDOMManager) CCorePlugin.getIndexManager();
} }
/** /**