use of org.eclipse.jface.preference.ColorSelector in project knime-core by knime.
the class BorderStyleDialog method createColorSelector.
private void createColorSelector(final Composite parent) {
Composite panel = new Composite(parent, SWT.FILL);
GridData gData = new GridData(GridData.FILL_HORIZONTAL);
panel.setLayoutData(gData);
panel.setLayout(new GridLayout(2, false));
Label msg = new Label(panel, SWT.LEFT);
msg.setText("Border color (click to change):");
msg.setLayoutData(gData);
final ColorSelector sel = new ColorSelector(panel);
sel.setColorValue(m_defColor.getRGB());
sel.addListener(new IPropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent event) {
m_color = sel.getColorValue();
}
});
m_color = m_defColor.getRGB();
}
use of org.eclipse.jface.preference.ColorSelector in project dbeaver by dbeaver.
the class ColorSettingsDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText("Customize row coloring");
Composite composite = (Composite) super.createDialogArea(parent);
Composite mainGroup = new Composite(composite, SWT.NONE);
mainGroup.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH));
mainGroup.setLayout(new GridLayout(2, false));
{
Group colorsGroup = new Group(mainGroup, SWT.NONE);
colorsGroup.setText("Colors");
colorsGroup.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH));
colorsGroup.setLayout(new GridLayout(1, false));
colorsViewer = CheckboxTableViewer.newCheckList(colorsGroup, SWT.SINGLE | SWT.BORDER);
colorsViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
ToolBar toolbar = new ToolBar(colorsGroup, SWT.FLAT | SWT.HORIZONTAL);
final ToolItem newButton = new ToolItem(toolbar, SWT.NONE);
newButton.setText("Add");
newButton.setImage(DBeaverIcons.getImage(UIIcon.ROW_ADD));
final ToolItem deleteButton = new ToolItem(toolbar, SWT.NONE);
deleteButton.setText("Delete");
deleteButton.setImage(DBeaverIcons.getImage(UIIcon.ROW_DELETE));
}
{
Group settingsGroup = new Group(mainGroup, SWT.NONE);
settingsGroup.setText("Settings");
settingsGroup.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH));
settingsGroup.setLayout(new GridLayout(2, false));
UIUtils.createLabelText(settingsGroup, "Title", "");
UIUtils.createLabelCombo(settingsGroup, "Attribute", SWT.READ_ONLY | SWT.DROP_DOWN);
UIUtils.createLabelCombo(settingsGroup, "Criteria", SWT.READ_ONLY | SWT.DROP_DOWN);
UIUtils.createLabelText(settingsGroup, "Value", "");
UIUtils.createControlLabel(settingsGroup, "Foreground");
new ColorSelector(settingsGroup);
UIUtils.createControlLabel(settingsGroup, "Background");
new ColorSelector(settingsGroup);
}
return parent;
}
use of org.eclipse.jface.preference.ColorSelector in project erlide_eclipse by erlang.
the class ColoringPreferencePage method createSyntaxPage.
private Control createSyntaxPage(final Composite parent) {
final Composite colorComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
colorComposite.setLayout(layout);
final Link link = new Link(colorComposite, SWT.NONE);
link.setText(PreferencesMessages.ErlEditorColoringConfigurationBlock_link);
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null);
}
});
final GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
gridData.widthHint = 150;
gridData.horizontalSpan = 2;
link.setLayoutData(gridData);
addFiller(colorComposite, 1);
Label label;
label = new Label(colorComposite, SWT.LEFT);
label.setText(PreferencesMessages.ErlEditorPreferencePage_coloring_element);
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Composite editorComposite = new Composite(colorComposite, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
editorComposite.setLayout(layout);
GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
editorComposite.setLayoutData(gd);
fListViewer = new TreeViewer(editorComposite, SWT.SINGLE | SWT.BORDER);
final Tree tree = fListViewer.getTree();
final GridData gdTree = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
gdTree.widthHint = 100;
tree.setLayoutData(gdTree);
fListViewer.setLabelProvider(new ColorListLabelProvider());
fListViewer.setContentProvider(new ColorListContentProvider());
fListViewer.setInput(fColors);
fListViewer.setSelection(new StructuredSelection(fErlangCategory));
fListViewer.setComparator(new ViewerComparator() {
@Override
public int category(final Object element) {
// don't sort the top level categories
if (fErlangCategory.equals(element)) {
return 0;
}
// return 1;
return 0;
}
});
gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, true);
gd.heightHint = convertHeightInCharsToPixels(9);
int maxWidth = 0;
for (final TokenHighlight item : fColors.keySet()) {
maxWidth = Math.max(maxWidth, convertWidthInCharsToPixels(item.getName().length()));
}
final ScrollBar vBar = ((Scrollable) fListViewer.getControl()).getVerticalBar();
if (vBar != null) {
// scrollbars and tree
maxWidth += vBar.getSize().x * 3;
}
// indentation guess
gd.widthHint = maxWidth;
fListViewer.getControl().setLayoutData(gd);
fListViewer.expandAll();
final Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
stylesComposite.setLayout(layout);
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
fEnableCheckbox = new Button(stylesComposite, SWT.CHECK);
fEnableCheckbox.setText(PreferencesMessages.ErlEditorPreferencePage_enable);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
fEnableCheckbox.setLayoutData(gd);
// TODO hide this until reworking the dialog
fEnableCheckbox.setVisible(false);
fColorEditorLabel = new Label(stylesComposite, SWT.LEFT);
fColorEditorLabel.setText(PreferencesMessages.ErlEditorPreferencePage_color);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = 20;
fColorEditorLabel.setLayoutData(gd);
fSyntaxForegroundColorEditor = new ColorSelector(stylesComposite);
final Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
foregroundColorButton.setLayoutData(gd);
new Label(stylesComposite, SWT.NONE);
fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
fBoldCheckBox.setText(PreferencesMessages.ErlEditorPreferencePage_bold);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = 20;
gd.horizontalSpan = 2;
fBoldCheckBox.setLayoutData(gd);
fItalicCheckBox = new Button(stylesComposite, SWT.CHECK);
fItalicCheckBox.setText(PreferencesMessages.ErlEditorPreferencePage_italic);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = 20;
gd.horizontalSpan = 2;
fItalicCheckBox.setLayoutData(gd);
fStrikethroughCheckBox = new Button(stylesComposite, SWT.CHECK);
fStrikethroughCheckBox.setText(PreferencesMessages.ErlEditorPreferencePage_strikeout);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = 20;
gd.horizontalSpan = 2;
fStrikethroughCheckBox.setLayoutData(gd);
fUnderlineCheckBox = new Button(stylesComposite, SWT.CHECK);
fUnderlineCheckBox.setText(PreferencesMessages.ErlEditorPreferencePage_underline);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = 20;
gd.horizontalSpan = 2;
fUnderlineCheckBox.setLayoutData(gd);
final String content = ColoringPreferencePage.loadPreviewContentFromFile(getClass(), // $NON-NLS-1$
"ColorSettingPreviewCode.txt");
fPreviewViewer = ErlangSourceViewer.createErlangPreviewer(colorComposite, fColorManager, fOverlayStore, fColors, content);
final Control previewer = fPreviewViewer.getControl();
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = convertWidthInCharsToPixels(20);
gd.heightHint = convertHeightInCharsToPixels(5);
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
previewer.setLayoutData(gd);
fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
handleSyntaxColorListSelection();
}
});
foregroundColorButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
// do nothing
}
@Override
public void widgetSelected(final SelectionEvent e) {
final TokenHighlight item = getHighlight();
final HighlightStyle data = item.getStyle(fOverlayStore);
if (data == null) {
return;
}
data.setColor(fSyntaxForegroundColorEditor.getColorValue());
storeHighlight(fOverlayStore, item, data);
fPreviewViewer.invalidateTextPresentation();
}
});
fBoldCheckBox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
// do nothing
}
@Override
public void widgetSelected(final SelectionEvent e) {
final TokenHighlight item = getHighlight();
final HighlightStyle data = item.getStyle(fOverlayStore);
if (data == null) {
return;
}
data.setStyle(SWT.BOLD, fBoldCheckBox.getSelection());
storeHighlight(fOverlayStore, item, data);
fPreviewViewer.invalidateTextPresentation();
}
});
fItalicCheckBox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
// do nothing
}
@Override
public void widgetSelected(final SelectionEvent e) {
final TokenHighlight item = getHighlight();
final HighlightStyle data = item.getStyle(fOverlayStore);
if (data == null) {
return;
}
data.setStyle(SWT.ITALIC, fItalicCheckBox.getSelection());
storeHighlight(fOverlayStore, item, data);
fPreviewViewer.invalidateTextPresentation();
}
});
fStrikethroughCheckBox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
// do nothing
}
@Override
public void widgetSelected(final SelectionEvent e) {
final TokenHighlight item = getHighlight();
final HighlightStyle data = item.getStyle(fOverlayStore);
if (data == null) {
return;
}
data.setStyle(TextAttribute.STRIKETHROUGH, fStrikethroughCheckBox.getSelection());
storeHighlight(fOverlayStore, item, data);
fPreviewViewer.invalidateTextPresentation();
}
});
fUnderlineCheckBox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
// do nothing
}
@Override
public void widgetSelected(final SelectionEvent e) {
final TokenHighlight item = getHighlight();
final HighlightStyle data = item.getStyle(fOverlayStore);
if (data == null) {
return;
}
data.setStyle(TextAttribute.UNDERLINE, fUnderlineCheckBox.getSelection());
storeHighlight(fOverlayStore, item, data);
fPreviewViewer.invalidateTextPresentation();
}
});
fEnableCheckbox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
// do nothing
}
@Override
public void widgetSelected(final SelectionEvent e) {
fEnableCheckbox.setSelection(true);
// final TokenHighlight item = getHighlight();
// if (item instanceof SemanticHighlightingColorListItem) {
// final boolean enable = fEnableCheckbox.getSelection();
// getPreferenceStore().setValue(
// ((SemanticHighlightingColorListItem) item)
// .getEnableKey(), enable);
// fEnableCheckbox.setSelection(enable);
// fSyntaxForegroundColorEditor.getButton().setEnabled(enable);
// fColorEditorLabel.setEnabled(enable);
// fBoldCheckBox.setEnabled(enable);
// fItalicCheckBox.setEnabled(enable);
// fStrikethroughCheckBox.setEnabled(enable);
// fUnderlineCheckBox.setEnabled(enable);
// }
}
});
colorComposite.layout(false);
handleSyntaxColorListSelection();
fPreviewViewer.invalidateTextPresentation();
return colorComposite;
}
use of org.eclipse.jface.preference.ColorSelector in project whole by wholeplatform.
the class EditorPreferencePage method createContents.
protected Control createContents(Composite parent) {
Label label;
GridData gd;
Composite topComposite = new Composite(parent, SWT.NONE);
topComposite.setLayout(new GridLayout(1, false));
topComposite.setFont(parent.getFont());
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 1;
topComposite.setLayoutData(gd);
Label fontsLabel = new Label(topComposite, SWT.LEFT);
fontsLabel.setText("Font category:");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
fontsLabel.setLayoutData(gd);
Composite fontComposite = new Composite(topComposite, SWT.BORDER);
GridLayout fontLayout = new GridLayout(3, false);
fontComposite.setLayout(fontLayout);
fontComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
monospaceFont = new FontFieldEditor(PreferenceConstants.MONOSPACE_FONT, "Monospace", fontComposite);
sanserifFont = new FontFieldEditor(PreferenceConstants.SANSERIF_FONT, "Sans Serif", fontComposite);
serifFont = new FontFieldEditor(PreferenceConstants.SERIF_FONT, "Serif", fontComposite);
GridLayout bgLayout = new GridLayout(2, false);
bgLayout.marginHeight = 5;
bgLayout.marginWidth = 10;
topComposite.setLayout(bgLayout);
Label bgLabel = new Label(topComposite, SWT.LEFT);
bgLabel.setText("Hilight category:");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
bgLabel.setLayoutData(gd);
bgCategoryTable = new TableViewer(topComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
bgCategoryTable.setContentProvider(new ArrayContentProvider());
bgCategoryTable.setLabelProvider(new PresentationLabelProvider(bgCategoryTable));
bgCategoryTable.setComparator(new ViewerComparator());
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH);
gd.widthHint = convertWidthInCharsToPixels(25);
// convertHeightInCharsToPixels(5);
gd.heightHint = 90;
bgCategoryTable.getControl().setLayoutData(gd);
bgColumn = new TableColumn(bgCategoryTable.getTable(), SWT.LEFT);
Composite bgStylesComposite = new Composite(topComposite, SWT.NONE);
GridLayout bgStylesLayout = new GridLayout(2, false);
bgStylesLayout.marginHeight = 0;
bgStylesLayout.marginWidth = 0;
bgStylesComposite.setLayout(bgStylesLayout);
bgStylesComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
label = new Label(bgStylesComposite, SWT.LEFT);
label.setText("Color:");
label.setLayoutData(new GridData());
bgColorSelector = new ColorSelector(bgStylesComposite);
Label fgLabel = new Label(topComposite, SWT.NONE);
fgLabel.setText("Syntax category:");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
fgLabel.setLayoutData(gd);
fgCategoryTable = new TableViewer(topComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
fgCategoryTable.setContentProvider(new ArrayContentProvider());
fgCategoryTable.setLabelProvider(new PresentationLabelProvider(fgCategoryTable));
fgCategoryTable.setComparator(new ViewerComparator());
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH);
gd.widthHint = convertWidthInCharsToPixels(25);
// convertHeightInCharsToPixels(4);
gd.heightHint = 52;
fgCategoryTable.getControl().setLayoutData(gd);
fgColumn = new TableColumn(fgCategoryTable.getTable(), SWT.LEFT);
Composite fgStylesComposite = new Composite(topComposite, SWT.NONE);
GridLayout fgStylesLayout = new GridLayout(2, false);
fgStylesLayout.marginHeight = 0;
fgStylesLayout.marginWidth = 0;
fgStylesComposite.setLayout(fgStylesLayout);
fgStylesComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
label = new Label(fgStylesComposite, SWT.LEFT);
label.setText("Color:");
label.setLayoutData(new GridData());
fgColorSelector = new ColorSelector(fgStylesComposite);
label = new Label(fgStylesComposite, SWT.LEFT);
label.setText("Font:");
label.setLayoutData(new GridData());
classCombo = new Combo(fgStylesComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
classCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
label = new Label(fgStylesComposite, SWT.LEFT);
label.setText("Style:");
label.setLayoutData(new GridData());
styleCombo = new Combo(fgStylesComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
styleCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
label = new Label(fgStylesComposite, SWT.LEFT);
label.setText("Size:");
label.setLayoutData(new GridData());
sizeCombo = new Combo(fgStylesComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
sizeCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
bgCategoryTable.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
if (!event.getSelection().isEmpty()) {
handleBgCategoryListSelection();
}
}
});
bgCategoryTable.getControl().addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
bgColumn.setWidth(bgCategoryTable.getControl().getSize().x - 4);
}
});
bgColorSelector.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
RGB newRGB = (RGB) event.getNewValue();
String key = getSelectedKey(bgCategoryTable);
if (key != null && newRGB != null && !newRGB.equals(event.getOldValue())) {
store.putValue(key, StringConverter.asString(newRGB));
}
}
});
fgCategoryTable.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
if (!event.getSelection().isEmpty()) {
handleFgCategoryListSelection();
}
}
});
fgCategoryTable.getControl().addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
fgColumn.setWidth(fgCategoryTable.getControl().getSize().x - 24);
}
});
fgColorSelector.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
RGB newRGB = (RGB) event.getNewValue();
String key = getSelectedKey(fgCategoryTable);
if (key != null && newRGB != null && !newRGB.equals(event.getOldValue())) {
store.putValue(key, StringConverter.asString(newRGB));
}
}
});
classCombo.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
String key = getSelectedKey(fgCategoryTable);
store.putValue(key + PreferenceConstants.CLASS, FontClass.nameOf(classCombo.getSelectionIndex()));
}
});
styleCombo.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
String key = getSelectedKey(fgCategoryTable);
store.putValue(key + PreferenceConstants.STYLE, FontStyle.nameOf(styleCombo.getSelectionIndex()));
}
});
sizeCombo.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
String key = getSelectedKey(fgCategoryTable);
store.putValue(key + PreferenceConstants.SIZE, FontSize.nameOf(sizeCombo.getSelectionIndex()));
}
});
initialize();
return topComposite;
}
use of org.eclipse.jface.preference.ColorSelector in project netxms by netxms.
the class SeparatorProperties method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
config = (SeparatorConfig) getElement().getAdapter(SeparatorConfig.class);
Composite dialogArea = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
dialogArea.setLayout(layout);
Composite fgArea = new Composite(dialogArea, SWT.NONE);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
fgArea.setLayoutData(gd);
RowLayout areaLayout = new RowLayout();
areaLayout.type = SWT.HORIZONTAL;
areaLayout.marginBottom = 0;
areaLayout.marginTop = 0;
areaLayout.marginLeft = 0;
areaLayout.marginRight = 0;
fgArea.setLayout(areaLayout);
new Label(fgArea, SWT.NONE).setText(Messages.get().LabelProperties_TextColor);
foreground = new ColorSelector(fgArea);
foreground.setColorValue(ColorConverter.rgbFromInt(config.getForegroundColorAsInt()));
Composite bgArea = new Composite(dialogArea, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
bgArea.setLayoutData(gd);
areaLayout = new RowLayout();
areaLayout.type = SWT.HORIZONTAL;
areaLayout.marginBottom = 0;
areaLayout.marginTop = 0;
areaLayout.marginLeft = 0;
areaLayout.marginRight = 0;
bgArea.setLayout(areaLayout);
new Label(bgArea, SWT.NONE).setText(Messages.get().LabelProperties_BgColor);
background = new ColorSelector(bgArea);
background.setColorValue(ColorConverter.rgbFromInt(config.getBackgroundColorAsInt()));
Composite lineWidthGroup = new Composite(dialogArea, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginTop = WidgetHelper.OUTER_SPACING;
lineWidthGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 2;
lineWidthGroup.setLayoutData(gd);
Label label = new Label(lineWidthGroup, SWT.NONE);
label.setText(Messages.get().SeparatorProperties_LineWidth);
gd = new GridData();
gd.horizontalAlignment = SWT.LEFT;
gd.horizontalSpan = 2;
label.setLayoutData(gd);
lineWidthScale = new Scale(lineWidthGroup, SWT.HORIZONTAL);
lineWidthScale.setMinimum(0);
lineWidthScale.setMaximum(15);
lineWidthScale.setSelection(config.getLineWidth());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
lineWidthScale.setLayoutData(gd);
lineWidthScale.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
lineWidthSpinner.setSelection(lineWidthScale.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
lineWidthSpinner = new Spinner(lineWidthGroup, SWT.BORDER);
lineWidthSpinner.setMinimum(1);
lineWidthSpinner.setMaximum(600);
lineWidthSpinner.setSelection(config.getLineWidth());
lineWidthSpinner.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
lineWidthScale.setSelection(lineWidthSpinner.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
marginLeft = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().SeparatorProperties_LeftMargin, 0, 255, WidgetHelper.DEFAULT_LAYOUT_DATA);
marginLeft.setSelection(config.getLeftMargin());
marginRight = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().SeparatorProperties_RightMargin, 0, 255, WidgetHelper.DEFAULT_LAYOUT_DATA);
marginRight.setSelection(config.getRightMargin());
marginTop = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().SeparatorProperties_TopMargin, 0, 255, WidgetHelper.DEFAULT_LAYOUT_DATA);
marginTop.setSelection(config.getTopMargin());
marginBottom = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().SeparatorProperties_BottomMargin, 0, 255, WidgetHelper.DEFAULT_LAYOUT_DATA);
marginBottom.setSelection(config.getBottomMargin());
return dialogArea;
}
Aggregations