1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug # 229771: Usability: Bad Environment preference dialog layout

This commit is contained in:
Oleg Krasilnikov 2008-05-03 09:21:11 +00:00
parent 0010c4d7b8
commit be0117f55a
5 changed files with 47 additions and 66 deletions

View file

@ -15,10 +15,7 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab; import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
import org.eclipse.cdt.ui.newui.CDTPrefUtil; import org.eclipse.cdt.ui.newui.CDTPrefUtil;
import org.eclipse.cdt.ui.newui.UIMessages; import org.eclipse.cdt.ui.newui.UIMessages;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
@ -31,10 +28,8 @@ import org.eclipse.swt.widgets.Label;
public class PropertyMultiCfgTab extends AbstractCPropertyTab { public class PropertyMultiCfgTab extends AbstractCPropertyTab {
private static final int SPACING = 5; // for radio buttons layout private static final int SPACING = 5; // for radio buttons layout
private static final Color RED = CUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_RED);
private static final Color BLUE = CUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_BLUE); private static final Color BLUE = CUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_BLUE);
private Button enable_multi;
private Group dGrp; private Group dGrp;
private Group wGrp; private Group wGrp;
private Button d_1; private Button d_1;
@ -50,20 +45,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
g.verticalSpacing = SPACING; g.verticalSpacing = SPACING;
usercomp.setLayout(g); usercomp.setLayout(g);
Label l = new Label(usercomp, SWT.CENTER | SWT.BORDER);
l.setText(UIMessages.getString("PropertyMultiCfgTab.0")); //$NON-NLS-1$
l.setForeground(RED);
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
enable_multi = new Button(usercomp, SWT.CHECK);
enable_multi.setText(UIMessages.getString("PropertyMultiCfgTab.1")); //$NON-NLS-1$
enable_multi.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
enable_multi.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
setStates();
}});
dGrp = new Group(usercomp, SWT.NONE); dGrp = new Group(usercomp, SWT.NONE);
dGrp.setText(UIMessages.getString("PropertyMultiCfgTab.3")); //$NON-NLS-1$ dGrp.setText(UIMessages.getString("PropertyMultiCfgTab.3")); //$NON-NLS-1$
dGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); dGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -72,7 +53,7 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
fl.marginWidth = SPACING; fl.marginWidth = SPACING;
dGrp.setLayout(fl); dGrp.setLayout(fl);
l = new Label(dGrp, SWT.WRAP | SWT.CENTER); Label l = new Label(dGrp, SWT.WRAP | SWT.CENTER);
l.setText( l.setText(
UIMessages.getString("PropertyMultiCfgTab.4") //$NON-NLS-1$ UIMessages.getString("PropertyMultiCfgTab.4") //$NON-NLS-1$
); );
@ -100,8 +81,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
w_1 = new Button(wGrp, SWT.RADIO); w_1 = new Button(wGrp, SWT.RADIO);
w_1.setText(UIMessages.getString("PropertyMultiCfgTab.11")); //$NON-NLS-1$ w_1.setText(UIMessages.getString("PropertyMultiCfgTab.11")); //$NON-NLS-1$
enable_multi.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI));
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DMODE)) { switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DMODE)) {
case CDTPrefUtil.DMODE_CONJUNCTION: d_1.setSelection(true); break; case CDTPrefUtil.DMODE_CONJUNCTION: d_1.setSelection(true); break;
case CDTPrefUtil.DMODE_DISJUNCTION: d_2.setSelection(true); break; case CDTPrefUtil.DMODE_DISJUNCTION: d_2.setSelection(true); break;
@ -113,12 +92,9 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
case CDTPrefUtil.WMODE_REPLACE: w_1.setSelection(true); break; case CDTPrefUtil.WMODE_REPLACE: w_1.setSelection(true); break;
default: w_0.setSelection(true); break; default: w_0.setSelection(true); break;
} }
setStates();
} }
protected void performOK() { protected void performOK() {
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MULTI, enable_multi.getSelection());
int x = 0; int x = 0;
if (d_1.getSelection()) if (d_1.getSelection())
x = CDTPrefUtil.DMODE_CONJUNCTION; x = CDTPrefUtil.DMODE_CONJUNCTION;
@ -134,23 +110,12 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
} }
protected void performDefaults() { protected void performDefaults() {
enable_multi.setSelection(false);
d_1.setSelection(true); d_1.setSelection(true);
d_2.setSelection(false); d_2.setSelection(false);
w_0.setSelection(true); w_0.setSelection(true);
w_1.setSelection(false); w_1.setSelection(false);
} }
private void setStates() {
boolean b = enable_multi.getSelection();
d_1.setEnabled(b);
d_2.setEnabled(b);
w_0.setEnabled(b);
w_1.setEnabled(b);
dGrp.setEnabled(b);
wGrp.setEnabled(b);
}
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); } protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }
protected void updateData(ICResourceDescription cfg) {} // Do nothing. Data is read once after creation protected void updateData(ICResourceDescription cfg) {} // Do nothing. Data is read once after creation
protected void updateButtons() {} // Do nothing. No buttons to update protected void updateButtons() {} // Do nothing. No buttons to update

View file

@ -32,6 +32,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.help.HelpSystem;
import org.eclipse.help.IContext;
import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferencePageContainer; import org.eclipse.jface.preference.IPreferencePageContainer;
@ -61,6 +63,7 @@ import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference; import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
import org.eclipse.ui.dialogs.PropertyPage; import org.eclipse.ui.dialogs.PropertyPage;
@ -587,13 +590,10 @@ implements
if (cfgIndex == -1 && cfgDescs[i].isActive()) if (cfgIndex == -1 && cfgDescs[i].isActive())
cfgIndex = i; cfgIndex = i;
} }
// Handling of All/Multiple configurations can be disabled
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI)) {
if (cfgDescs.length > 1) // "All cfgs" - shown if at least 2 cfgs available if (cfgDescs.length > 1) // "All cfgs" - shown if at least 2 cfgs available
configSelector.add(UIMessages.getString("AbstractPage.4")); //$NON-NLS-1$ configSelector.add(UIMessages.getString("AbstractPage.4")); //$NON-NLS-1$
if (cfgDescs.length > 2)// "Multi cfgs" - shown if at least 3 cfgs available if (cfgDescs.length > 2)// "Multi cfgs" - shown if at least 3 cfgs available
configSelector.add(UIMessages.getString("AbstractPage.5")); //$NON-NLS-1$ configSelector.add(UIMessages.getString("AbstractPage.5")); //$NON-NLS-1$
}
configSelector.select(cfgIndex); configSelector.select(cfgIndex);
handleConfigSelection(); handleConfigSelection();
} }
@ -1096,4 +1096,15 @@ implements
return getDefaultsButton(); return getDefaultsButton();
} }
@Override
public void performHelp() {
if (currentTab != null && currentTab instanceof AbstractCPropertyTab) {
String s = ((AbstractCPropertyTab)currentTab).getHelpContextId();
if (s != null) {
IContext context= HelpSystem.getContext(s);
PlatformUI.getWorkbench().getHelpSystem().displayHelp(context);
// PlatformUI.getWorkbench().getHelpSystem().displayHelp(s);
}
}
}
} }

View file

@ -27,7 +27,6 @@ public class CDTPrefUtil {
public static final String KEY_NOSUPP = "wizard.show.unsupported.disable"; //$NON-NLS-1$ 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_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_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_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$
public static final String KEY_NOTOOLM = "properties.toolchain.modification.disable"; //$NON-NLS-1$ public static final String KEY_NOTOOLM = "properties.toolchain.modification.disable"; //$NON-NLS-1$
public static final String KEY_EXPORT = "properties.export.page.enable"; //$NON-NLS-1$ public static final String KEY_EXPORT = "properties.export.page.enable"; //$NON-NLS-1$
@ -121,7 +120,7 @@ public class CDTPrefUtil {
String s = null; String s = null;
switch(CDTPrefUtil.getInt(CDTPrefUtil.KEY_WMODE)) { switch(CDTPrefUtil.getInt(CDTPrefUtil.KEY_WMODE)) {
case CDTPrefUtil.WMODE_MODIFY: case CDTPrefUtil.WMODE_MODIFY:
s = UIMessages.getString("EnvironmentTab.20"); //$NON-NLS-1$ s = UIMessages.getString("EnvironmentTab.24"); //$NON-NLS-1$
break; break;
case CDTPrefUtil.WMODE_REPLACE: case CDTPrefUtil.WMODE_REPLACE:
s = UIMessages.getString("EnvironmentTab.21"); //$NON-NLS-1$ s = UIMessages.getString("EnvironmentTab.21"); //$NON-NLS-1$

View file

@ -153,10 +153,12 @@ public class EnvironmentTab extends AbstractCPropertyTab {
@Override @Override
public void createControls(Composite parent) { public void createControls(Composite parent) {
super.createControls(parent); super.createControls(parent);
usercomp.setLayout(new GridLayout(2, true)); usercomp.setLayout(new GridLayout(3, true));
Label l1 = new Label(usercomp, SWT.LEFT); Label l1 = new Label(usercomp, SWT.LEFT);
l1.setText(UIMessages.getString("EnvironmentTab.0")); //$NON-NLS-1$ l1.setText(UIMessages.getString("EnvironmentTab.0")); //$NON-NLS-1$
l1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
l1.setLayoutData(gd);
table = new Table(usercomp, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.FULL_SELECTION); table = new Table(usercomp, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.FULL_SELECTION);
table.setHeaderVisible(true); table.setHeaderVisible(true);
table.setLinesVisible(true); table.setLinesVisible(true);
@ -197,14 +199,16 @@ public class EnvironmentTab extends AbstractCPropertyTab {
tc.setWidth(100); tc.setWidth(100);
} }
GridData gd = new GridData(GridData.FILL_BOTH); gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2; gd.horizontalSpan = 3;
table.setLayoutData(gd); table.setLayoutData(gd);
b1 = new Button(usercomp, SWT.RADIO); b1 = new Button(usercomp, SWT.RADIO);
b1.setText(UIMessages.getString("EnvironmentTab.3")); //$NON-NLS-1$ b1.setText(UIMessages.getString("EnvironmentTab.3")); //$NON-NLS-1$
b1.setToolTipText(UIMessages.getString("EnvironmentTab.3")); //$NON-NLS-1$ b1.setToolTipText(UIMessages.getString("EnvironmentTab.3")); //$NON-NLS-1$
b1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
b1.setLayoutData(gd);
b1.addSelectionListener(new SelectionAdapter() { b1.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
@ -228,7 +232,9 @@ public class EnvironmentTab extends AbstractCPropertyTab {
b2 = new Button(usercomp, SWT.RADIO); b2 = new Button(usercomp, SWT.RADIO);
b2.setText(UIMessages.getString("EnvironmentTab.4")); //$NON-NLS-1$ b2.setText(UIMessages.getString("EnvironmentTab.4")); //$NON-NLS-1$
b2.setToolTipText(UIMessages.getString("EnvironmentTab.4")); //$NON-NLS-1$ b2.setToolTipText(UIMessages.getString("EnvironmentTab.4")); //$NON-NLS-1$
b2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
b2.setLayoutData(gd);
b2.addSelectionListener(new SelectionAdapter() { b2.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {

View file

@ -376,18 +376,6 @@ EnvDialog.2=Variables
EnvDialog.3=Add to all configurations EnvDialog.3=Add to all configurations
EnvironmentTab.0=Environment variables to set EnvironmentTab.0=Environment variables to set
EnvironmentTab.1=Variable EnvironmentTab.1=Variable
EnvironmentTab.2=Value
EnvironmentTab.20=MODIFY
EnvironmentTab.21=REPLACE
EnvironmentTab.22=WRITE mode:
EnvironmentTab.23=Current String List WRITE mode. Double-click to change
EnvironmentTab.3=Append variables to native environment
EnvironmentTab.4=Replace native environment with specified one
EnvironmentTab.5=Add...
EnvironmentTab.6=Select...
EnvironmentTab.7=Edit...
EnvironmentTab.8=Delete
EnvironmentTab.9=Undefine
EnvironmentTab.10=New variable EnvironmentTab.10=New variable
EnvironmentTab.11=Edit variable EnvironmentTab.11=Edit variable
EnvironmentTab.12=Variables list EnvironmentTab.12=Variables list
@ -395,10 +383,22 @@ EnvironmentTab.13=Add to all configurations
EnvironmentTab.14=Select variables EnvironmentTab.14=Select variables
EnvironmentTab.15=Current String List DISPLAY mode. Double-click to change EnvironmentTab.15=Current String List DISPLAY mode. Double-click to change
EnvironmentTab.16=Origin EnvironmentTab.16=Origin
EnvironmentTab.17=CONJUNCTION EnvironmentTab.17=CONJ.
EnvironmentTab.18=DISJUNCTION EnvironmentTab.18=DISJ.
EnvironmentTab.19=DISPLAY mode: EnvironmentTab.19=DISPL mode:
EnvironmentTab.2=Value
EnvironmentTab.20=<UNDEFINED> EnvironmentTab.20=<UNDEFINED>
EnvironmentTab.21=REPLACE
EnvironmentTab.22=WRITE mode:
EnvironmentTab.23=Current String List WRITE mode. Double-click to change
EnvironmentTab.24=MODIFY
EnvironmentTab.3=Append variables to native environment
EnvironmentTab.4=Replace native environment with specified one
EnvironmentTab.5=Add...
EnvironmentTab.6=Select...
EnvironmentTab.7=Edit...
EnvironmentTab.8=Delete
EnvironmentTab.9=Undefine
IncludeTab.0=Include directories IncludeTab.0=Include directories
IncludeTab.1=Add directory path IncludeTab.1=Add directory path
IncludeTab.2=Change directory path IncludeTab.2=Change directory path