1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Allow to hide build-specific indexer configuration, bug 217860.

This commit is contained in:
Markus Schorn 2008-05-28 10:55:50 +00:00
parent c544d8f156
commit 75f29e6d15
3 changed files with 55 additions and 33 deletions

View file

@ -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 * 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
@ -23,13 +23,19 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage; 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.CacheSizeBlock;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer; import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.cdt.ui.dialogs.IndexerBlock; import org.eclipse.cdt.ui.dialogs.IndexerBlock;
public class IndexerPreferencePage extends PreferencePage implements public class IndexerPreferencePage extends PreferencePage implements
IWorkbenchPreferencePage, ICOptionContainer { 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 IndexerBlock fOptionBlock;
private CacheSizeBlock fCacheBlock; private CacheSizeBlock fCacheBlock;
@ -103,4 +109,15 @@ public class IndexerPreferencePage extends PreferencePage implements
fCacheBlock.performDefaults(); fCacheBlock.performDefaults();
updateContainer(); 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();
}
} }

View file

@ -78,13 +78,14 @@ public class IndexerStrategyBlock extends AbstractCOptionPage {
fImmediateUpdateButton= ControlFactory.createCheckBox(group, DialogsMessages.IndexerStrategyBlock_immediateUpdate); fImmediateUpdateButton= ControlFactory.createCheckBox(group, DialogsMessages.IndexerStrategyBlock_immediateUpdate);
fAutoUpdateButton.addSelectionListener(updateEnablement); fAutoUpdateButton.addSelectionListener(updateEnablement);
if (IndexerPreferencePage.showBuildConfiguration()) {
group= ControlFactory.createGroup(composite, DialogsMessages.IndexerStrategyBlock_buildConfigGroup, 1); group= ControlFactory.createGroup(composite, DialogsMessages.IndexerStrategyBlock_buildConfigGroup, 1);
gd= (GridData) group.getLayoutData(); gd= (GridData) group.getLayoutData();
gd.grabExcessHorizontalSpace= true; gd.grabExcessHorizontalSpace= true;
gd.horizontalAlignment= GridData.FILL; gd.horizontalAlignment= GridData.FILL;
fUseActiveBuildButton= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_activeBuildConfig, null, null); fUseActiveBuildButton= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_activeBuildConfig, null, null);
fUseFixedBuildConfig= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_specificBuildConfig, null, null); fUseFixedBuildConfig= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_specificBuildConfig, null, null);
}
initializeValues(); initializeValues();
} }
@ -96,12 +97,13 @@ public class IndexerStrategyBlock extends AbstractCOptionPage {
int updatePolicy= IndexerPreferences.getUpdatePolicy(null); int updatePolicy= IndexerPreferences.getUpdatePolicy(null);
initUpdatePolicy(updatePolicy); initUpdatePolicy(updatePolicy);
if (fUseActiveBuildButton != null) {
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager(); ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(false); ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(false);
boolean useActive= prefs.getConfigurationRelations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE; boolean useActive= prefs.getConfigurationRelations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE;
fUseActiveBuildButton.setSelection(useActive); fUseActiveBuildButton.setSelection(useActive);
fUseFixedBuildConfig.setSelection(!useActive); fUseFixedBuildConfig.setSelection(!useActive);
}
updateEnablement(); updateEnablement();
} }
@ -124,6 +126,7 @@ public class IndexerStrategyBlock extends AbstractCOptionPage {
} }
IndexerPreferences.setUpdatePolicy(null, updatePolicy); IndexerPreferences.setUpdatePolicy(null, updatePolicy);
if (fUseActiveBuildButton != null) {
boolean useActive= fUseActiveBuildButton.getSelection(); boolean useActive= fUseActiveBuildButton.getSelection();
int relation= useActive int relation= useActive
? ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE ? ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE
@ -133,12 +136,15 @@ public class IndexerStrategyBlock extends AbstractCOptionPage {
prefs.setConfigurationRelations(relation); prefs.setConfigurationRelations(relation);
prjDescMgr.setProjectDescriptionWorkspacePreferences(prefs, false, new NullProgressMonitor()); prjDescMgr.setProjectDescriptionWorkspacePreferences(prefs, false, new NullProgressMonitor());
} }
}
@Override @Override
public void performDefaults() { public void performDefaults() {
initUpdatePolicy(IndexerPreferences.getDefaultUpdatePolicy()); initUpdatePolicy(IndexerPreferences.getDefaultUpdatePolicy());
if (fUseActiveBuildButton != null) {
fUseActiveBuildButton.setSelection(false); fUseActiveBuildButton.setSelection(false);
fUseFixedBuildConfig.setSelection(true); fUseFixedBuildConfig.setSelection(true);
}
updateEnablement(); updateEnablement();
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* 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 * 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
@ -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.CCoreInternals;
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences; import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
/** import org.eclipse.cdt.internal.ui.preferences.IndexerPreferencePage;
* @author Bogdan Gheorghe
*/
/** /**
* This <code>IndexerBlock</code> is used in the <code>MakeProjectWizardOptionPage</code> and * This <code>IndexerBlock</code> is used in the <code>MakeProjectWizardOptionPage</code> and
@ -211,8 +209,9 @@ public class IndexerBlock extends AbstractCOptionPage {
} }
IProject prj= getProject(); IProject prj= getProject();
if (prj != null) { if (prj != null) {
if (IndexerPreferencePage.showBuildConfiguration()) {
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager(); ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
if (prjDescMgr.isNewStyleProject(prj)) { if (prjDescMgr.isNewStyleProject(prj))
return true; return true;
} }
} }