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
|
* 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
group= ControlFactory.createGroup(composite, DialogsMessages.IndexerStrategyBlock_buildConfigGroup, 1);
|
if (IndexerPreferencePage.showBuildConfiguration()) {
|
||||||
gd= (GridData) group.getLayoutData();
|
group= ControlFactory.createGroup(composite, DialogsMessages.IndexerStrategyBlock_buildConfigGroup, 1);
|
||||||
gd.grabExcessHorizontalSpace= true;
|
gd= (GridData) group.getLayoutData();
|
||||||
gd.horizontalAlignment= GridData.FILL;
|
gd.grabExcessHorizontalSpace= true;
|
||||||
fUseActiveBuildButton= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_activeBuildConfig, null, null);
|
gd.horizontalAlignment= GridData.FILL;
|
||||||
fUseFixedBuildConfig= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_specificBuildConfig, null, null);
|
fUseActiveBuildButton= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_activeBuildConfig, 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);
|
||||||
|
|
||||||
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
if (fUseActiveBuildButton != null) {
|
||||||
ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(false);
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
boolean useActive= prefs.getConfigurationRelations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE;
|
ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(false);
|
||||||
fUseActiveBuildButton.setSelection(useActive);
|
boolean useActive= prefs.getConfigurationRelations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE;
|
||||||
fUseFixedBuildConfig.setSelection(!useActive);
|
fUseActiveBuildButton.setSelection(useActive);
|
||||||
|
fUseFixedBuildConfig.setSelection(!useActive);
|
||||||
|
}
|
||||||
updateEnablement();
|
updateEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,21 +126,25 @@ public class IndexerStrategyBlock extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
IndexerPreferences.setUpdatePolicy(null, updatePolicy);
|
IndexerPreferences.setUpdatePolicy(null, updatePolicy);
|
||||||
|
|
||||||
boolean useActive= fUseActiveBuildButton.getSelection();
|
if (fUseActiveBuildButton != null) {
|
||||||
int relation= useActive
|
boolean useActive= fUseActiveBuildButton.getSelection();
|
||||||
? ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE
|
int relation= useActive
|
||||||
: ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT;
|
? ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE
|
||||||
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
: ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT;
|
||||||
ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(true);
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
prefs.setConfigurationRelations(relation);
|
ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(true);
|
||||||
prjDescMgr.setProjectDescriptionWorkspacePreferences(prefs, false, new NullProgressMonitor());
|
prefs.setConfigurationRelations(relation);
|
||||||
|
prjDescMgr.setProjectDescriptionWorkspacePreferences(prefs, false, new NullProgressMonitor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performDefaults() {
|
public void performDefaults() {
|
||||||
initUpdatePolicy(IndexerPreferences.getDefaultUpdatePolicy());
|
initUpdatePolicy(IndexerPreferences.getDefaultUpdatePolicy());
|
||||||
fUseActiveBuildButton.setSelection(false);
|
if (fUseActiveBuildButton != null) {
|
||||||
fUseFixedBuildConfig.setSelection(true);
|
fUseActiveBuildButton.setSelection(false);
|
||||||
|
fUseFixedBuildConfig.setSelection(true);
|
||||||
|
}
|
||||||
updateEnablement();
|
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
|
* 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
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.dialogs;
|
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.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,9 +209,10 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
IProject prj= getProject();
|
IProject prj= getProject();
|
||||||
if (prj != null) {
|
if (prj != null) {
|
||||||
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
if (IndexerPreferencePage.showBuildConfiguration()) {
|
||||||
if (prjDescMgr.isNewStyleProject(prj)) {
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
return true;
|
if (prjDescMgr.isNewStyleProject(prj))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue