mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 06:55:23 +02:00
Fix for 172919, ui for selecting build configuration for indexer.
This commit is contained in:
parent
55e7256b86
commit
2d963989a0
5 changed files with 165 additions and 25 deletions
|
@ -27,7 +27,6 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||||
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;
|
||||||
import org.eclipse.cdt.ui.dialogs.IndexerStrategyBlock;
|
|
||||||
|
|
||||||
public class IndexerPreferencePage extends PreferencePage implements
|
public class IndexerPreferencePage extends PreferencePage implements
|
||||||
IWorkbenchPreferencePage, ICOptionContainer {
|
IWorkbenchPreferencePage, ICOptionContainer {
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.dialogs;
|
package org.eclipse.cdt.internal.ui.preferences;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
@ -21,6 +22,13 @@ import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionPreferences;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionWorkspacePreferences;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.DialogsMessages;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
|
@ -33,8 +41,8 @@ public class IndexerStrategyBlock extends AbstractCOptionPage {
|
||||||
|
|
||||||
private Button fAutoUpdateButton;
|
private Button fAutoUpdateButton;
|
||||||
private Button fImmediateUpdateButton;
|
private Button fImmediateUpdateButton;
|
||||||
// private Button fUseActiveBuildButton;
|
private Button fUseActiveBuildButton;
|
||||||
// private Button fUseFixedBuildConfig;
|
private Button fUseFixedBuildConfig;
|
||||||
|
|
||||||
public IndexerStrategyBlock(ICOptionContainer container){
|
public IndexerStrategyBlock(ICOptionContainer container){
|
||||||
setContainer(container);
|
setContainer(container);
|
||||||
|
@ -68,12 +76,12 @@ 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);
|
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();
|
||||||
}
|
}
|
||||||
|
@ -86,8 +94,11 @@ public class IndexerStrategyBlock extends AbstractCOptionPage {
|
||||||
int updatePolicy= IndexerPreferences.getUpdatePolicy(null);
|
int updatePolicy= IndexerPreferences.getUpdatePolicy(null);
|
||||||
initUpdatePolicy(updatePolicy);
|
initUpdatePolicy(updatePolicy);
|
||||||
|
|
||||||
// fUseActiveBuildButton.setSelection(false);
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
// fUseFixedBuildConfig.setSelection(false);
|
ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(false);
|
||||||
|
boolean useActive= prefs.getConfigurationReltations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE;
|
||||||
|
fUseActiveBuildButton.setSelection(useActive);
|
||||||
|
fUseFixedBuildConfig.setSelection(!useActive);
|
||||||
|
|
||||||
updateEnablement();
|
updateEnablement();
|
||||||
}
|
}
|
||||||
|
@ -109,10 +120,21 @@ public class IndexerStrategyBlock extends AbstractCOptionPage {
|
||||||
updatePolicy= IndexerPreferences.UPDATE_POLICY_LAZY;
|
updatePolicy= IndexerPreferences.UPDATE_POLICY_LAZY;
|
||||||
}
|
}
|
||||||
IndexerPreferences.setUpdatePolicy(null, updatePolicy);
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performDefaults() {
|
public void performDefaults() {
|
||||||
initUpdatePolicy(IndexerPreferences.getDefaultUpdatePolicy());
|
initUpdatePolicy(IndexerPreferences.getDefaultUpdatePolicy());
|
||||||
|
fAutoUpdateButton.setSelection(false);
|
||||||
|
fImmediateUpdateButton.setSelection(true);
|
||||||
updateEnablement();
|
updateEnablement();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,6 +19,7 @@ public class DialogsMessages extends NLS {
|
||||||
public static String AbstractIndexerPage_indexUpFront;
|
public static String AbstractIndexerPage_indexUpFront;
|
||||||
public static String AbstractIndexerPage_skipAllReferences;
|
public static String AbstractIndexerPage_skipAllReferences;
|
||||||
public static String AbstractIndexerPage_skipTypeReferences;
|
public static String AbstractIndexerPage_skipTypeReferences;
|
||||||
|
public static String IndexerBlock_fixedBuildConfig;
|
||||||
public static String IndexerStrategyBlock_activeBuildConfig;
|
public static String IndexerStrategyBlock_activeBuildConfig;
|
||||||
public static String IndexerStrategyBlock_autoUpdate;
|
public static String IndexerStrategyBlock_autoUpdate;
|
||||||
public static String IndexerStrategyBlock_buildConfigGroup;
|
public static String IndexerStrategyBlock_buildConfigGroup;
|
||||||
|
|
|
@ -22,6 +22,7 @@ CacheSizeBlock_absoluteLimit=Absolute Limit:
|
||||||
CacheSizeBlock_headerFileCache=Header file cache (used by full indexer and refactoring):
|
CacheSizeBlock_headerFileCache=Header file cache (used by full indexer and refactoring):
|
||||||
IndexerStrategyBlock_strategyGroup=Indexing strategy
|
IndexerStrategyBlock_strategyGroup=Indexing strategy
|
||||||
IndexerStrategyBlock_autoUpdate=Automatically update the index
|
IndexerStrategyBlock_autoUpdate=Automatically update the index
|
||||||
|
IndexerBlock_fixedBuildConfig=Use a fixed build configuration
|
||||||
IndexerStrategyBlock_immediateUpdate=Update index immediately after every file-change
|
IndexerStrategyBlock_immediateUpdate=Update index immediately after every file-change
|
||||||
IndexerStrategyBlock_buildConfigGroup=Build configuration for the indexer
|
IndexerStrategyBlock_buildConfigGroup=Build configuration for the indexer
|
||||||
IndexerStrategyBlock_activeBuildConfig=Use active build configuration
|
IndexerStrategyBlock_activeBuildConfig=Use active build configuration
|
||||||
|
|
|
@ -28,12 +28,20 @@ import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.ui.dialogs.PropertyPage;
|
||||||
|
|
||||||
import com.ibm.icu.text.Collator;
|
import com.ibm.icu.text.Collator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionPreferences;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionWorkspacePreferences;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
||||||
|
@ -58,9 +66,9 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
|
|
||||||
private static final String PREF_PAGE_ID = "org.eclipse.cdt.ui.preferences.IndexerPreferencePage"; //$NON-NLS-1$
|
private static final String PREF_PAGE_ID = "org.eclipse.cdt.ui.preferences.IndexerPreferencePage"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String INDEXER_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.label" ); //$NON-NLS-1$
|
private static final String INDEXER_LABEL = "C/C++ Indexer"; //$NON-NLS-1$
|
||||||
private static final String INDEXER_DESCRIPTION = CUIPlugin.getResourceString("BaseIndexerBlock.desc"); //$NON-NLS-1$
|
private static final String INDEXER_DESCRIPTION = "C/C++ Indexer setting for this project."; //$NON-NLS-1$
|
||||||
private static final String INDEXER_COMBO_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.comboLabel"); //$NON-NLS-1$
|
private static final String INDEXER_COMBO_LABEL = "Select indexer"; //$NON-NLS-1$
|
||||||
|
|
||||||
private PreferenceScopeBlock fPrefScopeBlock;
|
private PreferenceScopeBlock fPrefScopeBlock;
|
||||||
private Combo fIndexersComboBox;
|
private Combo fIndexersComboBox;
|
||||||
|
@ -68,9 +76,12 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
private Composite fIndexerPageComposite;
|
private Composite fIndexerPageComposite;
|
||||||
private AbstractIndexerPage fCurrentPage;
|
private AbstractIndexerPage fCurrentPage;
|
||||||
private Properties fCurrentProperties;
|
private Properties fCurrentProperties;
|
||||||
private ControlEnableState fEnableState;
|
|
||||||
private Composite fPreferenceContent;
|
private Composite fPreferenceContent;
|
||||||
private Composite fParent;
|
private Composite fParent;
|
||||||
|
private Button fUseActiveBuildButton;
|
||||||
|
private Button fUseFixedBuildConfig;
|
||||||
|
private Combo fBuildConfigComboBox;
|
||||||
|
private ControlEnableState fEnableState;
|
||||||
|
|
||||||
public IndexerBlock(){
|
public IndexerBlock(){
|
||||||
super(INDEXER_LABEL);
|
super(INDEXER_LABEL);
|
||||||
|
@ -140,14 +151,8 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
gd= (GridData) fPreferenceContent.getLayoutData();
|
gd= (GridData) fPreferenceContent.getLayoutData();
|
||||||
gd.horizontalIndent= 0;
|
gd.horizontalIndent= 0;
|
||||||
|
|
||||||
Composite isc = ControlFactory.createComposite(fPreferenceContent, 1);
|
|
||||||
GridLayout gridLayout = ((GridLayout)isc.getLayout());
|
|
||||||
gridLayout.makeColumnsEqualWidth= false;
|
|
||||||
gridLayout.marginHeight = 0;
|
|
||||||
gridLayout.marginWidth= 0;
|
|
||||||
|
|
||||||
// add combo to select indexer
|
// add combo to select indexer
|
||||||
Group group= ControlFactory.createGroup(isc,INDEXER_COMBO_LABEL, 1);
|
Group group= ControlFactory.createGroup(fPreferenceContent,INDEXER_COMBO_LABEL, 1);
|
||||||
gd= (GridData) group.getLayoutData();
|
gd= (GridData) group.getLayoutData();
|
||||||
gd.grabExcessHorizontalSpace= true;
|
gd.grabExcessHorizontalSpace= true;
|
||||||
fIndexersComboBox = ControlFactory.createSelectCombo(group,"", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
fIndexersComboBox = ControlFactory.createSelectCombo(group,"", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -162,21 +167,87 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
fIndexerPageComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
|
fIndexerPageComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
|
||||||
fIndexerPageComposite.setLayout(new TabFolderLayout());
|
fIndexerPageComposite.setLayout(new TabFolderLayout());
|
||||||
|
|
||||||
|
if (needBuildConfigOptions()) {
|
||||||
|
group= ControlFactory.createGroup(composite, DialogsMessages.IndexerStrategyBlock_buildConfigGroup, 1);
|
||||||
|
gd= (GridData) group.getLayoutData();
|
||||||
|
gd.grabExcessHorizontalSpace= true;
|
||||||
|
fUseActiveBuildButton= ControlFactory.createRadioButton(group, DialogsMessages.IndexerStrategyBlock_activeBuildConfig, null, null);
|
||||||
|
fUseFixedBuildConfig= ControlFactory.createRadioButton(group, DialogsMessages.IndexerBlock_fixedBuildConfig, null, null);
|
||||||
|
fBuildConfigComboBox= ControlFactory.createSelectCombo(group, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
final SelectionAdapter listener = new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
setUseActiveBuildConfig(fUseActiveBuildButton.getSelection());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fUseActiveBuildButton.addSelectionListener(listener);
|
||||||
|
fUseFixedBuildConfig.addSelectionListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
initializeScope();
|
initializeScope();
|
||||||
initializeIndexerCombo();
|
initializeIndexerCombo();
|
||||||
|
initializeBuildConfigs();
|
||||||
onPreferenceScopeChange();
|
onPreferenceScopeChange();
|
||||||
fParent.layout(true);
|
fParent.layout(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean needBuildConfigOptions() {
|
||||||
|
if (fPrefScopeBlock == null || !(getContainer() instanceof PropertyPage)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
IProject prj= getProject();
|
||||||
|
if (prj != null) {
|
||||||
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
|
if (prjDescMgr.isNewStyleProject(prj)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateBuildConfigForScope(int scope) {
|
||||||
|
if (fBuildConfigComboBox != null) {
|
||||||
|
if (scope == IndexerPreferences.SCOPE_INSTANCE) {
|
||||||
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
|
ICProjectDescriptionWorkspacePreferences prefs= prjDescMgr.getProjectDescriptionWorkspacePreferences(false);
|
||||||
|
boolean useActive= prefs.getConfigurationReltations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE;
|
||||||
|
setUseActiveBuildConfig(useActive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setUseActiveBuildConfig(boolean useActive) {
|
||||||
|
if (fBuildConfigComboBox != null) {
|
||||||
|
if (useActive) {
|
||||||
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
|
ICProjectDescription prefs= prjDescMgr.getProjectDescription(getProject(), false);
|
||||||
|
selectBuildConfigInCombo(prefs.getActiveConfiguration().getName());
|
||||||
|
fBuildConfigComboBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fBuildConfigComboBox.setEnabled(true);
|
||||||
|
}
|
||||||
|
fUseActiveBuildButton.setSelection(useActive);
|
||||||
|
fUseFixedBuildConfig.setSelection(!useActive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void enablePreferenceContent(boolean enable) {
|
private void enablePreferenceContent(boolean enable) {
|
||||||
if (fEnableState != null) {
|
if (fEnableState != null) {
|
||||||
fEnableState.restore();
|
fEnableState.restore();
|
||||||
|
if (fUseActiveBuildButton != null) {
|
||||||
|
fUseActiveBuildButton.setEnabled(true);
|
||||||
|
fUseFixedBuildConfig.setEnabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (enable) {
|
if (enable) {
|
||||||
fEnableState= null;
|
fEnableState= null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fEnableState= ControlEnableState.disable(fPreferenceContent);
|
fEnableState= ControlEnableState.disable(fPreferenceContent);
|
||||||
|
if (fUseActiveBuildButton != null) {
|
||||||
|
fUseActiveBuildButton.setEnabled(false);
|
||||||
|
fUseFixedBuildConfig.setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,8 +282,36 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
fIndexersComboBox.setItems(names);
|
fIndexersComboBox.setItems(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeBuildConfigs() {
|
||||||
|
if (fBuildConfigComboBox != null) {
|
||||||
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
|
ICProjectDescription prefs= prjDescMgr.getProjectDescription(getProject(), false);
|
||||||
|
setUseActiveBuildConfig(prefs.getConfigurationReltations() == ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE);
|
||||||
|
ICConfigurationDescription[] configs= prefs.getConfigurations();
|
||||||
|
String[] names= new String[configs.length];
|
||||||
|
for (int i = 0; i < configs.length; i++) {
|
||||||
|
ICConfigurationDescription config = configs[i];
|
||||||
|
names[i]= config.getName();
|
||||||
|
}
|
||||||
|
Arrays.sort(names, Collator.getInstance());
|
||||||
|
fBuildConfigComboBox.setItems(names);
|
||||||
|
selectBuildConfigInCombo(prefs.getDefaultSettingConfiguration().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectBuildConfigInCombo(String useName) {
|
||||||
|
String[] names= fBuildConfigComboBox.getItems();
|
||||||
|
int selectedIndex = 0;
|
||||||
|
for (int i=0; i<names.length; i++){
|
||||||
|
if (names[i].equals(useName))
|
||||||
|
selectedIndex = i;
|
||||||
|
}
|
||||||
|
fBuildConfigComboBox.select(selectedIndex);
|
||||||
|
}
|
||||||
|
|
||||||
protected void onPreferenceScopeChange() {
|
protected void onPreferenceScopeChange() {
|
||||||
int scope= computeScope();
|
int scope= computeScope();
|
||||||
|
updateBuildConfigForScope(scope);
|
||||||
if (fCurrentProperties == null || scope != IndexerPreferences.SCOPE_PROJECT_PRIVATE) {
|
if (fCurrentProperties == null || scope != IndexerPreferences.SCOPE_PROJECT_PRIVATE) {
|
||||||
Properties props= IndexerPreferences.getProperties(getProject(), scope);
|
Properties props= IndexerPreferences.getProperties(getProject(), scope);
|
||||||
|
|
||||||
|
@ -368,6 +467,24 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
IndexerPreferences.setScope(project, scope);
|
IndexerPreferences.setScope(project, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fBuildConfigComboBox != null) {
|
||||||
|
boolean useActive= fUseActiveBuildButton.getSelection();
|
||||||
|
ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();
|
||||||
|
ICProjectDescription prefs= prjDescMgr.getProjectDescription(getProject(), true);
|
||||||
|
if (scope == IndexerPreferences.SCOPE_INSTANCE) {
|
||||||
|
prefs.useDefaultConfigurationRelations();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
prefs.setConfigurationRelations(useActive
|
||||||
|
? ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE
|
||||||
|
: ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT);
|
||||||
|
}
|
||||||
|
if (!useActive) {
|
||||||
|
prefs.setDefaultSettingConfiguration(prefs.getConfigurationByName(fBuildConfigComboBox.getText()));
|
||||||
|
}
|
||||||
|
prjDescMgr.setProjectDescription(getProject(), prefs);
|
||||||
|
}
|
||||||
CCoreInternals.savePreferences(project);
|
CCoreInternals.savePreferences(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue