1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 05:15:43 +02:00

Preference page added to control Property Pages behaviour

This commit is contained in:
Oleg Krasilnikov 2007-03-22 13:57:19 +00:00
parent 941ffc1b63
commit b0bdfa4229
17 changed files with 173 additions and 53 deletions

View file

@ -87,4 +87,5 @@ Binary.parsers=Binary parsers
Error.parsers=Error parsers
Data.hierarchy=Data hierarchy
Preferred.toolchains=Preferred toolchains
Wizard.defaults=Wizard defaults
Wizard.defaults=Wizard defaults
PropertyPage.defaults=Property page settings

View file

@ -90,13 +90,13 @@
<page
name="%MakeBuildPref.name"
category="org.eclipse.cdt.managedbuilder.ui.preferences.WizardPreferences"
class="org.eclipse.cdt.managedbuilder.ui.properties.PrefPage_NewCDTProject"
class="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTProject"
id="org.eclipse.cdt.managedbuilder.ui.preferences.BuildPreferences">
</page>
<page
name="%NewCDTWizardPref.name"
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
class="org.eclipse.cdt.managedbuilder.ui.properties.PrefPage_NewCDTWizard"
class="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTWizard"
id="org.eclipse.cdt.managedbuilder.ui.preferences.WizardPreferences">
</page>
</extension>
@ -324,12 +324,12 @@
name="%Output.location"
weight="009"
parent="org.eclipse.cdt.ui.newui.Page_PathAndSymb"/>
<!--tab
<tab
class="org.eclipse.cdt.ui.newui.StructureTreeTab"
icon="icons/obj16/hierarchy.gif"
name="%Data.hierarchy"
parent="org.eclipse.cdt.ui.newui.Page_PathAndSymb"
weight="012"/-->
weight="012"/>
<tab
class="org.eclipse.cdt.ui.newui.EnvironmentTab"
icon="icons/obj16/environment.gif"
@ -392,34 +392,40 @@
class="org.eclipse.cdt.ui.newui.BinaryParsTab"
name="%Binary.parsers"
icon="icons/obj16/bin_obj.gif"
parent="org.eclipse.cdt.managedbuilder.ui.properties.PrefPage_NewCDTProject"
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTProject"
/>
<tab
class="org.eclipse.cdt.ui.newui.ErrorParsTab"
name="%Error.parsers"
icon="icons/obj16/error_obj.gif"
parent="org.eclipse.cdt.managedbuilder.ui.properties.PrefPage_NewCDTProject"
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTProject"
/>
<tab
class="org.eclipse.cdt.managedbuilder.ui.properties.DiscoveryTab"
icon="icons/elcl16/discovery.gif"
name="%Discovery.options"
parent="org.eclipse.cdt.managedbuilder.ui.properties.PrefPage_NewCDTProject"
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTProject"
/>
<tab
class="org.eclipse.cdt.managedbuilder.ui.properties.BuilderSettingsTab"
icon="icons/obj16/build_settings.gif"
name="%Builder.settings"
parent="org.eclipse.cdt.managedbuilder.ui.properties.PrefPage_NewCDTProject"/>
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTProject"/>
<tab
class="org.eclipse.cdt.managedbuilder.ui.properties.PreferredToolchainsTab"
class="org.eclipse.cdt.managedbuilder.ui.preferences.PreferredToolchainsTab"
name="%Preferred.toolchains"
parent="org.eclipse.cdt.managedbuilder.ui.properties.PrefPage_NewCDTWizard"/>
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTWizard"/>
<tab
class="org.eclipse.cdt.managedbuilder.ui.properties.WizardDefaultsTab"
class="org.eclipse.cdt.managedbuilder.ui.preferences.WizardDefaultsTab"
name="%Wizard.defaults"
parent="org.eclipse.cdt.managedbuilder.ui.properties.PrefPage_NewCDTWizard"/>
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTWizard"/>
<tab
class="org.eclipse.cdt.ui.newui.PropertyPageDefsTab"
name="%PropertyPage.defaults"
parent="org.eclipse.cdt.ui.newui.PrefPage_PropertyPage"/>
</extension>

View file

@ -9,7 +9,7 @@
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.properties;
package org.eclipse.cdt.managedbuilder.ui.preferences;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;

View file

@ -9,9 +9,10 @@
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.properties;
package org.eclipse.cdt.managedbuilder.ui.preferences;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
import org.eclipse.cdt.ui.newui.AbstractPrefPage;
import org.eclipse.cdt.ui.newui.ICPropertyTab;

View file

@ -8,10 +8,13 @@
* Contributors:
* Intel Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.properties;
package org.eclipse.cdt.managedbuilder.ui.preferences;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
import org.eclipse.cdt.managedbuilder.ui.properties.PageLayout;
import org.eclipse.cdt.managedbuilder.ui.wizards.CMainWizardPage;
import org.eclipse.cdt.managedbuilder.ui.wizards.ICWizardHandler;
import org.eclipse.cdt.ui.newui.CDTPrefUtil;

View file

@ -8,9 +8,10 @@
* Contributors:
* Intel Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.properties;
package org.eclipse.cdt.managedbuilder.ui.preferences;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
import org.eclipse.swt.SWT;
@ -18,13 +19,11 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
public class WizardDefaultsTab extends AbstractCPropertyTab {
private Button show_sup;
private Button show_oth;
private Button show_mng;
public void createControls(Composite parent) {
super.createControls(parent);
@ -38,35 +37,20 @@ public class WizardDefaultsTab extends AbstractCPropertyTab {
show_oth.setText(Messages.getString("WizardDefaultsTab.1")); //$NON-NLS-1$
show_oth.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label l = new Label(usercomp, SWT.WRAP);
l.setText("\n This checkbox will be moved to another page soon"); //$NON-NLS-1$
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
show_mng = new Button(usercomp, SWT.CHECK);
show_mng.setText(Messages.getString("WizardDefaultsTab.2")); //$NON-NLS-1$
show_mng.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_UNSUPP));
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP));
show_oth.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS));
show_mng.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MANAGE));
}
protected void performOK() {
CDTPrefUtil.setBool(CDTPrefUtil.KEY_UNSUPP, !show_sup.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSUPP, !show_sup.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_OTHERS, show_oth.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MANAGE, show_mng.getSelection());
}
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }
protected void performDefaults() {
show_sup.setSelection(true);
show_oth.setSelection(false);
show_mng.setSelection(false);
}
protected void updateData(ICResourceDescription cfg) {
// Do nothing. Data is read once after creation
}
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }
protected void updateData(ICResourceDescription cfg) {} // Do nothing. Data is read once after creation
}

View file

@ -69,7 +69,6 @@ PrefPage_NewCDTWizard.0=Settings will be applied to CDT new project wizard
PrefPage_NewCDTWizard.1=\nduring project creation process
WizardDefaultsTab.0=Show only supported toolchains, by default
WizardDefaultsTab.1=Group old-style toolchains to <Others> folder
WizardDefaultsTab.2=Show <Manage> button on property pages
PreferredToolchainsTab.0=Preferred toolchain will be selected by default in Wizard
PreferredToolchainsTab.1=Make toolhain(s) preferred
PreferredToolchainsTab.2=Make toolhain(s) unpreferred

View file

@ -281,13 +281,13 @@ public class CConfigWizardPage extends MBSCustomPage {
NewModelProjectWizard nmWizard = (NewModelProjectWizard)wizard;
IProject newProject = nmWizard.getProject(true);
if (newProject != null) {
boolean oldManage = CDTPrefUtil.getBool(CDTPrefUtil.KEY_MANAGE);
boolean oldManage = CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG);
// disable manage configurations button
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MANAGE, false);
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, true);
try {
PreferencesUtil.createPropertyDialogOn(wizard.getContainer().getShell(), newProject, propertyId, null, null).open();
} finally {
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MANAGE, oldManage);
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, oldManage);
}
}
}

View file

@ -171,7 +171,7 @@ import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea.IErrorMes
}} );
// restore settings from preferences
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_UNSUPP));
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP));
}
/**

View file

@ -361,6 +361,7 @@ indexerPrefName=Indexer
varsPrefName=CDT build variables
envPrefName=Environment
propSettingsPrefName=Property Pages settings
# indexer names
CDTIndexer.domsourceindexer=Full C/C++ Indexer (complete parse)

View file

@ -695,6 +695,11 @@
class="org.eclipse.cdt.ui.newui.PrefPage_Vars"
id="org.eclipse.cdt.ui.preferences.VariablesPrefPage"
name="%varsPrefName"/>
<page
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
class="org.eclipse.cdt.ui.newui.PrefPage_PropertyPage"
id="org.eclipse.cdt.ui.preferences.PropertyPageSettings"
name="%propSettingsPrefName"/>
<!--page
name="%WorkInProgress.name"
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"

View file

@ -101,9 +101,6 @@ implements
IPreferencePageContainer, // dynamic pages
ICPropertyProvider // utility methods for tabs
{
// All(Multiple) configuration support is now disabled
private static final boolean ENABLE_MULTI_CFG = false;
private static ArrayList pages = new ArrayList(5);
private static ICResourceDescription resd = null;
private static ICConfigurationDescription[] cfgDescs = null;
@ -111,7 +108,6 @@ implements
private static ICProjectDescription prjd = null;
private static int cfgIndex = 0;
protected static boolean saveDone = false;
// private static boolean doneOK = false;
// tabs
private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.cPropertyTab"; //$NON-NLS-1$
public static final String ELEMENT_NAME = "tab"; //$NON-NLS-1$
@ -252,7 +248,7 @@ implements
configSelector.setLayoutData(gd);
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_MANAGE)) {
if (!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG)) {
manageButton = new Button(configGroup, SWT.PUSH);
manageButton.setText(UIMessages.getString("AbstractPage.12")); //$NON-NLS-1$
gd = new GridData(GridData.END);
@ -471,7 +467,7 @@ implements
if (cfgDescs[i].isActive()) cfgIndex = i;
}
// Handling of All/Multiple configurations can be disabled
if (ENABLE_MULTI_CFG) {
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI)) {
if (cfgDescs.length > 1) // "All cfgs" - shown if at least 2 cfgs available
configSelector.add(UIMessages.getString("AbstractPage.4")); //$NON-NLS-1$
if (cfgDescs.length > 2)// "Multi cfgs" - shown if at least 3 cfgs available
@ -508,6 +504,8 @@ implements
protected void handleResize(boolean visible) {
if (pages.size() > 1) return; // do not duplicate
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSAVE)) return;
IProject prj = getProject();
if (prj == null) return; // preferences. Do not process.
QualifiedName WIDTH = new QualifiedName(prj.getName(),".property.page.width"); //$NON-NLS-1$

View file

@ -19,11 +19,16 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.jface.preference.IPreferenceStore;
public class CDTPrefUtil {
public static final String KEY_UNSUPP = "wizard.default.show.unsupported"; //$NON-NLS-1$
public static final String KEY_OTHERS = "wizard.default.group.others"; //$NON-NLS-1$
// boolean keys (KEY_NO-s are to be inverted !)
public static final String KEY_NOSUPP = "wizard.show.unsupported.disable"; //$NON-NLS-1$
public static final String KEY_OTHERS = "wizard.group.others.enable"; //$NON-NLS-1$
public static final String KEY_NOMNG = "properties.manage.config.disable"; //$NON-NLS-1$
public static final String KEY_MULTI = "properties.multi.config.enable"; //$NON-NLS-1$
public static final String KEY_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$
public static final String KEY_NOSAVE = "properties.save.position.disable"; //$NON-NLS-1$
// string keys
public static final String KEY_PREFTC = "wizard.preferred.toolchains"; //$NON-NLS-1$
public static final String KEY_MANAGE = "properties.manage.config.button"; //$NON-NLS-1$
public static final String NULL = "NULL"; //$NON-NLS-1$
private static final IPreferenceStore pref = CUIPlugin.getDefault().getPreferenceStore();
private static final String DELIMITER = " "; //$NON-NLS-1$

View file

@ -336,6 +336,10 @@ ProjectConvert.noConverterErrordialog.title=Project Conversion Error
ProjectConvert.noConverterErrordialog.message=There are no converters available to convert the project {0} .
ProjectConvert.title=Project Converters for {0}
PropertyPageDefsTab.0=Show <Manage configurations> button
PropertyPageDefsTab.1=Display <Data hierarchy> tab
PropertyPageDefsTab.2=Enable multiple configurations setting
PropertyPageDefsTab.3=Save property dialog size and position
ProjectConvert.convertersList=Converters List
ScannerConfigOptionsDialog.title=Discovery Options
@ -484,3 +488,4 @@ StructureTreeTab.8=Property
StructureTreeTab.9=Value
StructureTreeTab.10=Class
StructureTreeTab.11=Wait...
PrefPage_PropertyPage.0=These settings will affect behaviour of CDT property pages

View file

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2007 Intel 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:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.ui.newui.AbstractPrefPage;
import org.eclipse.cdt.ui.newui.ICPropertyTab;
public class PrefPage_PropertyPage extends AbstractPrefPage {
protected String getHeader() {
return UIMessages.getString("PrefPage_PropertyPage.0"); //$NON-NLS-1$
}
/*
* All affected settings are stored in preferences.
* Tabs are responsible for saving, after OK signal.
* No need to affect Project Description somehow.
*/
public boolean performOk() {
forEach(ICPropertyTab.OK, null);
return true;
}
public ICResourceDescription getResDesc() { return null; }
protected boolean isSingle() { return true; }
}

View file

@ -0,0 +1,71 @@
/*******************************************************************************
* Copyright (c) 2007 Intel 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:
* Intel Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
public class PropertyPageDefsTab extends AbstractCPropertyTab {
private Button show_tree;
private Button show_mul;
private Button show_mng;
private Button show_sav;
public void createControls(Composite parent) {
super.createControls(parent);
usercomp.setLayout(new GridLayout(1, false));
show_mng = new Button(usercomp, SWT.CHECK);
show_mng.setText(UIMessages.getString("PropertyPageDefsTab.0")); //$NON-NLS-1$
show_mng.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
show_tree = new Button(usercomp, SWT.CHECK);
show_tree.setText(UIMessages.getString("PropertyPageDefsTab.1")); //$NON-NLS-1$
show_tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
show_mul = new Button(usercomp, SWT.CHECK);
show_mul.setText(UIMessages.getString("PropertyPageDefsTab.2")); //$NON-NLS-1$
show_mul.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
show_sav = new Button(usercomp, SWT.CHECK);
show_sav.setText(UIMessages.getString("PropertyPageDefsTab.3")); //$NON-NLS-1$
show_sav.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
show_tree.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_DTREE));
show_mul.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI));
show_mng.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG));
show_sav.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSAVE));
show_mul.setEnabled(false);
}
protected void performOK() {
CDTPrefUtil.setBool(CDTPrefUtil.KEY_DTREE, show_tree.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MULTI, show_mul.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, !show_mng.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSAVE, !show_sav.getSelection());
}
protected void performDefaults() {
show_tree.setSelection(false);
show_mul.setSelection(false);
show_mng.setSelection(true);
show_mng.setSelection(true);
}
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }
protected void updateData(ICResourceDescription cfg) {} // Do nothing. Data is read once after creation
}

View file

@ -776,4 +776,9 @@ public class StructureTreeTab extends AbstractCPropertyTab {
}
});
}
// This page can be displayed if it's permitted in prefs
public boolean canBeVisible() {
return CDTPrefUtil.getBool(CDTPrefUtil.KEY_DTREE);
}
}