diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IndexerPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IndexerPreferencePage.java index 391b896f728..a30c50e0ae7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IndexerPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IndexerPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 QNX Software Systems and others. + * Copyright (c) 2005, 2008 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 @@ -23,13 +23,19 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.activities.IIdentifier; +import org.eclipse.ui.activities.IWorkbenchActivitySupport; +import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.dialogs.CacheSizeBlock; import org.eclipse.cdt.ui.dialogs.ICOptionContainer; import org.eclipse.cdt.ui.dialogs.IndexerBlock; public class IndexerPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, ICOptionContainer { + // bug 217860, allow to hide build configuration + private static final String SHOW_BUILD_SPECIFIC_CONFIG = "show.build.specific.indexer.config"; //$NON-NLS-1$ private IndexerBlock fOptionBlock; private CacheSizeBlock fCacheBlock; @@ -103,4 +109,15 @@ public class IndexerPreferencePage extends PreferencePage implements fCacheBlock.performDefaults(); updateContainer(); } + + /** + * Returns whether the capability for showing build configurations is enabled. + * @since 5.0 + */ + public static boolean showBuildConfiguration() { + IWorkbenchActivitySupport activitySupport= PlatformUI.getWorkbench().getActivitySupport(); + IIdentifier identifier= activitySupport.getActivityManager().getIdentifier( + CUIPlugin.getPluginId() + '/' + SHOW_BUILD_SPECIFIC_CONFIG); + return identifier.isEnabled(); + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IndexerStrategyBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IndexerStrategyBlock.java index 59ceaa753a8..101913ec98b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IndexerStrategyBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IndexerStrategyBlock.java @@ -78,13 +78,14 @@ public class IndexerStrategyBlock extends AbstractCOptionPage { fImmediateUpdateButton= ControlFactory.createCheckBox(group, DialogsMessages.IndexerStrategyBlock_immediateUpdate); fAutoUpdateButton.addSelectionListener(updateEnablement); - group= ControlFactory.createGroup(composite, DialogsMessages.IndexerStrategyBlock_buildConfigGroup, 1); - gd= (GridData) group.getLayoutData(); - gd.grabExcessHorizontalSpace= true; - gd.horizontalAlignment= GridData.FILL; - fUseActiveBuildButton= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_activeBuildConfig, null, null); - fUseFixedBuildConfig= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_specificBuildConfig, null, null); - + if (IndexerPreferencePage.showBuildConfiguration()) { + group= ControlFactory.createGroup(composite, DialogsMessages.IndexerStrategyBlock_buildConfigGroup, 1); + gd= (GridData) group.getLayoutData(); + gd.grabExcessHorizontalSpace= true; + gd.horizontalAlignment= GridData.FILL; + fUseActiveBuildButton= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_activeBuildConfig, null, null); + fUseFixedBuildConfig= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_specificBuildConfig, null, null); + } initializeValues(); } @@ -96,12 +97,13 @@ public class IndexerStrategyBlock extends AbstractCOptionPage { int updatePolicy= IndexerPreferences.getUpdatePolicy(null); initUpdatePolicy(updatePolicy); - ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager(); - ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(false); - boolean useActive= prefs.getConfigurationRelations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE; - fUseActiveBuildButton.setSelection(useActive); - fUseFixedBuildConfig.setSelection(!useActive); - + if (fUseActiveBuildButton != null) { + ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager(); + ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(false); + boolean useActive= prefs.getConfigurationRelations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE; + fUseActiveBuildButton.setSelection(useActive); + fUseFixedBuildConfig.setSelection(!useActive); + } updateEnablement(); } @@ -124,21 +126,25 @@ public class IndexerStrategyBlock extends AbstractCOptionPage { } IndexerPreferences.setUpdatePolicy(null, updatePolicy); - boolean useActive= fUseActiveBuildButton.getSelection(); - int relation= useActive - ? ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE - : ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT; - ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager(); - ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(true); - prefs.setConfigurationRelations(relation); - prjDescMgr.setProjectDescriptionWorkspacePreferences(prefs, false, new NullProgressMonitor()); + if (fUseActiveBuildButton != null) { + boolean useActive= fUseActiveBuildButton.getSelection(); + int relation= useActive + ? ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE + : ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT; + ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager(); + ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(true); + prefs.setConfigurationRelations(relation); + prjDescMgr.setProjectDescriptionWorkspacePreferences(prefs, false, new NullProgressMonitor()); + } } @Override public void performDefaults() { initUpdatePolicy(IndexerPreferences.getDefaultUpdatePolicy()); - fUseActiveBuildButton.setSelection(false); - fUseFixedBuildConfig.setSelection(true); + if (fUseActiveBuildButton != null) { + fUseActiveBuildButton.setSelection(false); + fUseFixedBuildConfig.setSelection(true); + } updateEnablement(); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java index eaafa8a73aa..ceb34cdde8b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java @@ -1,13 +1,13 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2008 IBM 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 * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM - Initial API and implementation - * Markus Schorn (Wind River Systems) + * IBM - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.ui.dialogs; @@ -51,9 +51,7 @@ import org.eclipse.cdt.utils.ui.controls.TabFolderLayout; import org.eclipse.cdt.internal.core.CCoreInternals; import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences; -/** - * @author Bogdan Gheorghe - */ +import org.eclipse.cdt.internal.ui.preferences.IndexerPreferencePage; /** * This IndexerBlock is used in the MakeProjectWizardOptionPage and @@ -211,9 +209,10 @@ public class IndexerBlock extends AbstractCOptionPage { } IProject prj= getProject(); if (prj != null) { - ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager(); - if (prjDescMgr.isNewStyleProject(prj)) { - return true; + if (IndexerPreferencePage.showBuildConfiguration()) { + ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager(); + if (prjDescMgr.isNewStyleProject(prj)) + return true; } } return false;