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:
parent
c544d8f156
commit
75f29e6d15
3 changed files with 55 additions and 33 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 <code>IndexerBlock</code> is used in the <code>MakeProjectWizardOptionPage</code> 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;
|
||||
|
|
Loading…
Add table
Reference in a new issue