From bda21f162b6366cb9e657958735371bc5305ae38 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Mon, 2 Mar 2009 14:10:52 +0000 Subject: [PATCH] Public API to update external headers, bug 255338. --- .../org/eclipse/cdt/core/index/IIndexManager.java | 15 +++++++++++---- .../internal/core/pdom/AbstractIndexerTask.java | 2 +- .../cdt/internal/core/pdom/PDOMManager.java | 4 +--- .../core/pdom/indexer/PDOMUpdateTask.java | 6 +++--- .../internal/ui/actions/FreshenIndexAction.java | 6 ++---- .../UpdateIndexWithModifiedFilesAction.java | 6 ++---- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java index cec8613948d..67fb6a4139d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.core.index; import org.eclipse.cdt.core.CCorePlugin; @@ -68,10 +67,18 @@ public interface IIndexManager extends IPDOMManager { /** * Constant for indicating to update translation units if their configuration - * has changed. + * has changed. The flag currently has no effect. */ public final static int UPDATE_CHECK_CONFIGURATION= 0x4; + /** + * Constant for requesting to update the external files for a project, also. This flag works only + * if it is used to update one or more projects. It shall be used together with {@link #UPDATE_ALL} + * or {@link #UPDATE_CHECK_TIMESTAMPS}. + * @since 5.1 + */ + public final static int UPDATE_EXTERNAL_FILES_FOR_PROJECT= 0x8; + /** * Returns the index for the given project. * @param project the project to get the index for @@ -183,9 +190,9 @@ public interface IIndexManager extends IPDOMManager { * the options supplied. The selection is defined by an array of translation * units, containers and projects. For containers and projects all recursively * nested translation units are considered. - * Valid options are {@link #UPDATE_ALL} and {@link #UPDATE_CHECK_TIMESTAMPS} * @param tuSelection the translation units to update. - * @param options one of {@link #UPDATE_ALL} or {@link #UPDATE_CHECK_TIMESTAMPS}. + * @param options one of {@link #UPDATE_ALL} or {@link #UPDATE_CHECK_TIMESTAMPS} optionally + * combined with {@link #UPDATE_EXTERNAL_FILES_FOR_PROJECT}. * @throws CoreException * @since 4.0 */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java index b9f53dc838d..a6ab17d4870 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2009 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 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java index 97634092182..644dbfec740 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 QNX Software Systems and others. + * Copyright (c) 2005, 2009 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 @@ -138,8 +138,6 @@ public class PDOMManager implements IWritableIndexManager, IListener { } } - public static final int UPDATE_EXTERNAL_FILES_FOR_PROJECT = 0x10000; // must not collide with IIndexManager.UPDATE... - private static final String SETTINGS_FOLDER_NAME = ".settings"; //$NON-NLS-1$ private static final QualifiedName dbNameProperty= new QualifiedName(CCorePlugin.PLUGIN_ID, "pdomName"); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java index 9f0ec8493b5..fcb459ecc6a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2009 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 @@ -21,13 +21,13 @@ import org.eclipse.cdt.core.dom.IPDOMManager; import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexFileLocation; +import org.eclipse.cdt.core.index.IIndexManager; import org.eclipse.cdt.core.index.IndexLocationFactory; 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.core.model.ITranslationUnit; import org.eclipse.cdt.internal.core.pdom.IndexerProgress; -import org.eclipse.cdt.internal.core.pdom.PDOMManager; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; @@ -97,7 +97,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask { elem.accept(collector); } } - if (haveProject && (fUpdateOptions & PDOMManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT) != 0) { + if (haveProject && (fUpdateOptions & IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT) != 0) { IIndex index= CCorePlugin.getIndexManager().getIndex(project); index.acquireReadLock(); try { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/FreshenIndexAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/FreshenIndexAction.java index 511484e59f5..ffed3d4d1c1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/FreshenIndexAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/FreshenIndexAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2009 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 @@ -12,12 +12,10 @@ package org.eclipse.cdt.internal.ui.actions; import org.eclipse.cdt.core.index.IIndexManager; -import org.eclipse.cdt.internal.core.pdom.PDOMManager; - public class FreshenIndexAction extends AbstractUpdateIndexAction { @Override protected int getUpdateOptions() { - return IIndexManager.UPDATE_ALL | PDOMManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT; + return IIndexManager.UPDATE_ALL | IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT; } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/UpdateIndexWithModifiedFilesAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/UpdateIndexWithModifiedFilesAction.java index 122c4c655f5..a48312b325c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/UpdateIndexWithModifiedFilesAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/UpdateIndexWithModifiedFilesAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2009 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 @@ -12,12 +12,10 @@ package org.eclipse.cdt.internal.ui.actions; import org.eclipse.cdt.core.index.IIndexManager; -import org.eclipse.cdt.internal.core.pdom.PDOMManager; - public class UpdateIndexWithModifiedFilesAction extends AbstractUpdateIndexAction { @Override protected int getUpdateOptions() { - return IIndexManager.UPDATE_CHECK_TIMESTAMPS | IIndexManager.UPDATE_CHECK_CONFIGURATION | PDOMManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT; + return IIndexManager.UPDATE_CHECK_TIMESTAMPS | IIndexManager.UPDATE_CHECK_CONFIGURATION | IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT; } }