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

Bug 461378

Adding margins to configure settings pages.

Change-Id: Ic9e8df3d73f66a47a53726c8fc115f3397436c37
Signed-off-by: mazab <mohamed_azab@mentor.com>
This commit is contained in:
mazab 2015-03-04 13:04:06 +02:00 committed by Jeff Johnston
parent cf6b8c725f
commit ed26026034
2 changed files with 33 additions and 14 deletions

View file

@ -21,12 +21,14 @@ import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
public class AutotoolsCategoryPropertyOptionPage extends
AbstractConfigurePropertyOptionsPage {
private static final int MARGIN = 3;
private String catName = "";
private IAConfiguration cfg;
// Label class for a preference page.
@ -81,6 +83,17 @@ public class AutotoolsCategoryPropertyOptionPage extends
protected void createFieldEditors() {
super.createFieldEditors();
Composite parent = getFieldEditorParent();
// Add margin
parent.setLayout(new GridLayout(1, false));
Composite area = new Composite(parent, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
gl.marginTop = MARGIN;
gl.marginLeft = MARGIN;
gl.marginRight = MARGIN;
area.setLayout(gl);
area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
// FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
AutotoolsConfiguration.Option[] options = AutotoolsConfiguration.getChildOptions(catName);
for (int i = 0; i < options.length; ++i) {
@ -89,23 +102,20 @@ public class AutotoolsCategoryPropertyOptionPage extends
case IConfigureOption.STRING:
case IConfigureOption.INTERNAL:
case IConfigureOption.MULTIARG:
parent = getFieldEditorParent();
StringFieldEditor f = new StringFieldEditor(option.getName(), option.getDescription(), 20, parent);
f.getLabelControl(parent).setToolTipText(option.getToolTip());
StringFieldEditor f = new StringFieldEditor(option.getName(), option.getDescription(), area);
f.getLabelControl(area).setToolTipText(option.getToolTip());
addField(f);
fieldEditors.add(f);
break;
case IConfigureOption.BIN:
case IConfigureOption.FLAGVALUE:
parent = getFieldEditorParent();
BooleanFieldEditor b = new BooleanFieldEditor(option.getName(), option.getDescription(), parent);
b.getDescriptionControl(parent).setToolTipText(option.getToolTip());
BooleanFieldEditor b = new BooleanFieldEditor(option.getName(), option.getDescription(), area);
b.getDescriptionControl(area).setToolTipText(option.getToolTip());
addField(b);
fieldEditors.add(b);
break;
case IConfigureOption.FLAG:
parent = getFieldEditorParent();
FieldEditor l = createLabelEditor(parent, option.getDescription());
FieldEditor l = createLabelEditor(area, option.getDescription());
addField(l);
fieldEditors.add(l);
break;

View file

@ -20,12 +20,14 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
public class AutotoolsToolPropertyOptionPage extends
AbstractConfigurePropertyOptionsPage {
private static final int MARGIN = 3;
private ToolListElement element;
private String toolName = "";
private IAConfiguration cfg;
@ -84,20 +86,27 @@ public class AutotoolsToolPropertyOptionPage extends
super.createFieldEditors();
// Add a string editor to edit the tool command
Composite parent = getFieldEditorParent();
FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
parent.setLayout(new GridLayout(1, false));
Composite area = new Composite(parent, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
gl.marginTop = MARGIN;
gl.marginLeft = MARGIN;
gl.marginRight = MARGIN;
area.setLayout(gl);
area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
FontMetrics fm = AbstractCPropertyTab.getFontMetrics(area);
commandStringField = new StringFieldEditor(toolName,
ConfigureMessages.getString(COMMAND),
parent);
area);
commandStringField.setEmptyStringAllowed(false);
GridData gd = ((GridData)commandStringField.getTextControl(parent).getLayoutData());
GridData gd = ((GridData)commandStringField.getTextControl(area).getLayoutData());
gd.grabExcessHorizontalSpace = true;
gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3);
addField(commandStringField);
// Add a field editor that displays overall build options
Composite par = getFieldEditorParent();
allOptionFieldEditor = new MultiLineTextFieldEditor(AutotoolsConfigurePrefStore.ALL_OPTIONS_ID,
ConfigureMessages.getString(ALL_OPTIONS), par);
allOptionFieldEditor.getTextControl(par).setEditable(false);
ConfigureMessages.getString(ALL_OPTIONS), area);
allOptionFieldEditor.getTextControl(area).setEditable(false);
// gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData());
gd.grabExcessHorizontalSpace = true;
gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);