use of org.eclipse.swt.widgets.ColorDialog in project org.csstudio.display.builder by kasemir.
the class RGBCellEditor method activate.
/**
* Opens the color dialog.
*/
@Override
public void activate() {
final ColorDialog dialog = new ColorDialog(shell);
if (value != null)
dialog.setRGB(value);
value = dialog.open();
if (value != null)
fireApplyEditorValue();
}
use of org.eclipse.swt.widgets.ColorDialog in project dbeaver by dbeaver.
the class SetPartColorAction method createColorCommand.
private Command createColorCommand(final Object[] objects) {
return new Command() {
private final Map<ICustomizablePart, Color> oldColors = new HashMap<>();
private Color newColor;
@Override
public void execute() {
final Shell shell = UIUtils.createCenteredShell(getWorkbenchPart().getSite().getShell());
try {
ColorDialog colorDialog = new ColorDialog(shell);
RGB color = colorDialog.open();
if (color == null) {
return;
}
newColor = new Color(Display.getCurrent(), color);
for (Object item : objects) {
if (item instanceof ICustomizablePart) {
ICustomizablePart colorizedPart = (ICustomizablePart) item;
oldColors.put(colorizedPart, colorizedPart.getCustomBackgroundColor());
colorizedPart.setCustomBackgroundColor(newColor);
}
}
} finally {
UIUtils.disposeCenteredShell(shell);
}
}
@Override
public void undo() {
for (Object item : objects) {
if (item instanceof ICustomizablePart) {
ICustomizablePart colorizedPart = (ICustomizablePart) item;
colorizedPart.setCustomBackgroundColor(oldColors.get(colorizedPart));
}
}
}
@Override
public void redo() {
for (Object item : objects) {
if (item instanceof ICustomizablePart) {
ICustomizablePart colorizedPart = (ICustomizablePart) item;
colorizedPart.setCustomBackgroundColor(newColor);
}
}
}
};
}
use of org.eclipse.swt.widgets.ColorDialog in project pentaho-kettle by pentaho.
the class EnterOptionsDialog method addLookTab.
private void addLookTab() {
int h = 40;
// ////////////////////////
// START OF LOOK TAB///
// /
wLookTab = new CTabItem(wTabFolder, SWT.NONE);
wLookTab.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.LookAndFeel.Label"));
sLookComp = new ScrolledComposite(wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
sLookComp.setLayout(new FillLayout());
wLookComp = new Composite(sLookComp, SWT.NONE);
props.setLook(wLookComp);
FormLayout lookLayout = new FormLayout();
lookLayout.marginWidth = 3;
lookLayout.marginHeight = 3;
wLookComp.setLayout(lookLayout);
// Fixed font
int nr = 0;
Label wlFFont = new Label(wLookComp, SWT.RIGHT);
wlFFont.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.FixedWidthFont.Label"));
props.setLook(wlFFont);
FormData fdlFFont = new FormData();
fdlFFont.left = new FormAttachment(0, 0);
fdlFFont.right = new FormAttachment(middle, -margin);
fdlFFont.top = new FormAttachment(0, nr * h + margin + 10);
wlFFont.setLayoutData(fdlFFont);
wdFFont = new Button(wLookComp, SWT.PUSH | SWT.CENTER);
props.setLook(wdFFont);
FormData fddFFont = layoutResetOptionButton(wdFFont);
fddFFont.right = new FormAttachment(100, 0);
fddFFont.top = new FormAttachment(0, nr * h + margin);
fddFFont.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wdFFont.setLayoutData(fddFFont);
wdFFont.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
fixedFontData = new FontData(PropsUI.getInstance().getFixedFont().getName(), PropsUI.getInstance().getFixedFont().getHeight(), PropsUI.getInstance().getFixedFont().getStyle());
fixedFont.dispose();
fixedFont = new Font(display, fixedFontData);
wFFont.redraw();
}
});
wbFFont = new Button(wLookComp, SWT.PUSH);
props.setLook(wbFFont);
FormData fdbFFont = layoutEditOptionButton(wbFFont);
fdbFFont.right = new FormAttachment(wdFFont, -margin);
fdbFFont.top = new FormAttachment(0, nr * h + margin);
fdbFFont.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wbFFont.setLayoutData(fdbFFont);
wbFFont.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
FontDialog fd = new FontDialog(shell);
fd.setFontList(new FontData[] { fixedFontData });
FontData newfd = fd.open();
if (newfd != null) {
fixedFontData = newfd;
fixedFont.dispose();
fixedFont = new Font(display, fixedFontData);
wFFont.redraw();
}
}
});
wFFont = new Canvas(wLookComp, SWT.BORDER);
props.setLook(wFFont);
FormData fdFFont = new FormData();
fdFFont.left = new FormAttachment(middle, 0);
fdFFont.right = new FormAttachment(wbFFont, -margin);
fdFFont.top = new FormAttachment(0, margin);
fdFFont.bottom = new FormAttachment(0, h);
wFFont.setLayoutData(fdFFont);
wFFont.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent pe) {
pe.gc.setFont(fixedFont);
Rectangle max = wFFont.getBounds();
String name = fixedFontData.getName() + " - " + fixedFontData.getHeight();
Point size = pe.gc.textExtent(name);
pe.gc.drawText(name, (max.width - size.x) / 2, (max.height - size.y) / 2, true);
}
});
// Graph font
nr++;
Label wlGFont = new Label(wLookComp, SWT.RIGHT);
wlGFont.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.GraphFont.Label"));
props.setLook(wlGFont);
FormData fdlGFont = new FormData();
fdlGFont.left = new FormAttachment(0, 0);
fdlGFont.right = new FormAttachment(middle, -margin);
fdlGFont.top = new FormAttachment(0, nr * h + margin + 10);
wlGFont.setLayoutData(fdlGFont);
wdGFont = new Button(wLookComp, SWT.PUSH);
props.setLook(wdGFont);
FormData fddGFont = layoutResetOptionButton(wdGFont);
fddGFont.right = new FormAttachment(100, 0);
fddGFont.top = new FormAttachment(0, nr * h + margin);
fddGFont.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wdGFont.setLayoutData(fddGFont);
wdGFont.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
graphFont.dispose();
graphFontData = props.getDefaultFontData();
graphFont = new Font(display, graphFontData);
wGFont.redraw();
}
});
wbGFont = new Button(wLookComp, SWT.PUSH);
props.setLook(wbGFont);
FormData fdbGFont = layoutEditOptionButton(wbGFont);
fdbGFont.right = new FormAttachment(wdGFont, -margin);
fdbGFont.top = new FormAttachment(0, nr * h + margin);
fdbGFont.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wbGFont.setLayoutData(fdbGFont);
wbGFont.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
FontDialog fd = new FontDialog(shell);
fd.setFontList(new FontData[] { graphFontData });
FontData newfd = fd.open();
if (newfd != null) {
graphFontData = newfd;
graphFont.dispose();
graphFont = new Font(display, graphFontData);
wGFont.redraw();
}
}
});
wGFont = new Canvas(wLookComp, SWT.BORDER);
props.setLook(wGFont);
FormData fdGFont = new FormData();
fdGFont.left = new FormAttachment(middle, 0);
fdGFont.right = new FormAttachment(wbGFont, -margin);
fdGFont.top = new FormAttachment(0, nr * h + margin);
fdGFont.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wGFont.setLayoutData(fdGFont);
wGFont.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent pe) {
pe.gc.setFont(graphFont);
Rectangle max = wGFont.getBounds();
String name = graphFontData.getName() + " - " + graphFontData.getHeight();
Point size = pe.gc.textExtent(name);
pe.gc.drawText(name, (max.width - size.x) / 2, (max.height - size.y) / 2, true);
}
});
// Note font
nr++;
Label wlNFont = new Label(wLookComp, SWT.RIGHT);
wlNFont.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.NoteFont.Label"));
props.setLook(wlNFont);
FormData fdlNFont = new FormData();
fdlNFont.left = new FormAttachment(0, 0);
fdlNFont.right = new FormAttachment(middle, -margin);
fdlNFont.top = new FormAttachment(0, nr * h + margin + 10);
wlNFont.setLayoutData(fdlNFont);
wdNFont = new Button(wLookComp, SWT.PUSH);
props.setLook(wdNFont);
FormData fddNFont = layoutResetOptionButton(wdNFont);
fddNFont.right = new FormAttachment(100, 0);
fddNFont.top = new FormAttachment(0, nr * h + margin);
fddNFont.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wdNFont.setLayoutData(fddNFont);
wdNFont.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
noteFontData = props.getDefaultFontData();
noteFont.dispose();
noteFont = new Font(display, noteFontData);
wNFont.redraw();
}
});
wbNFont = new Button(wLookComp, SWT.PUSH);
props.setLook(wbNFont);
FormData fdbNFont = layoutEditOptionButton(wbNFont);
fdbNFont.right = new FormAttachment(wdNFont, -margin);
fdbNFont.top = new FormAttachment(0, nr * h + margin);
fdbNFont.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wbNFont.setLayoutData(fdbNFont);
wbNFont.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
FontDialog fd = new FontDialog(shell);
fd.setFontList(new FontData[] { noteFontData });
FontData newfd = fd.open();
if (newfd != null) {
noteFontData = newfd;
noteFont.dispose();
noteFont = new Font(display, noteFontData);
wNFont.redraw();
}
}
});
wNFont = new Canvas(wLookComp, SWT.BORDER);
props.setLook(wNFont);
FormData fdNFont = new FormData();
fdNFont.left = new FormAttachment(middle, 0);
fdNFont.right = new FormAttachment(wbNFont, -margin);
fdNFont.top = new FormAttachment(0, nr * h + margin);
fdNFont.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wNFont.setLayoutData(fdNFont);
wNFont.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent pe) {
pe.gc.setFont(noteFont);
Rectangle max = wNFont.getBounds();
String name = noteFontData.getName() + " - " + noteFontData.getHeight();
Point size = pe.gc.textExtent(name);
pe.gc.drawText(name, (max.width - size.x) / 2, (max.height - size.y) / 2, true);
}
});
// Background color
nr++;
Label wlBGColor = new Label(wLookComp, SWT.RIGHT);
wlBGColor.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.BackgroundColor.Label"));
props.setLook(wlBGColor);
FormData fdlBGColor = new FormData();
fdlBGColor.left = new FormAttachment(0, 0);
fdlBGColor.right = new FormAttachment(middle, -margin);
fdlBGColor.top = new FormAttachment(0, nr * h + margin + 10);
wlBGColor.setLayoutData(fdlBGColor);
wdBGcolor = new Button(wLookComp, SWT.PUSH);
props.setLook(wdBGcolor);
FormData fddBGColor = layoutResetOptionButton(wdBGcolor);
// to the right of the
fddBGColor.right = new FormAttachment(100, 0);
// dialog
fddBGColor.top = new FormAttachment(0, nr * h + margin);
fddBGColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wdBGcolor.setLayoutData(fddBGColor);
wdBGcolor.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
background.dispose();
backgroundRGB = new RGB(ConstUI.COLOR_BACKGROUND_RED, ConstUI.COLOR_BACKGROUND_GREEN, ConstUI.COLOR_BACKGROUND_BLUE);
background = new Color(display, backgroundRGB);
wBGColor.setBackground(background);
wBGColor.redraw();
}
});
wbBGColor = new Button(wLookComp, SWT.PUSH);
props.setLook(wbBGColor);
FormData fdbBGColor = layoutEditOptionButton(wbBGColor);
// to the
fdbBGColor.right = new FormAttachment(wdBGcolor, -margin);
// left of
// the
// "default"
// button
fdbBGColor.top = new FormAttachment(0, nr * h + margin);
fdbBGColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wbBGColor.setLayoutData(fdbBGColor);
wbBGColor.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ColorDialog cd = new ColorDialog(shell);
cd.setRGB(props.getBackgroundRGB());
RGB newbg = cd.open();
if (newbg != null) {
backgroundRGB = newbg;
background.dispose();
background = new Color(display, backgroundRGB);
wBGColor.setBackground(background);
wBGColor.redraw();
}
}
});
wBGColor = new Canvas(wLookComp, SWT.BORDER);
props.setLook(wBGColor);
wBGColor.setBackground(background);
FormData fdBGColor = new FormData();
fdBGColor.left = new FormAttachment(middle, 0);
fdBGColor.right = new FormAttachment(wbBGColor, -margin);
fdBGColor.top = new FormAttachment(0, nr * h + margin);
fdBGColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wBGColor.setLayoutData(fdBGColor);
// Graph background color
nr++;
Label wlGrColor = new Label(wLookComp, SWT.RIGHT);
wlGrColor.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.BackgroundColorGraph.Label"));
props.setLook(wlGrColor);
FormData fdlGrColor = new FormData();
fdlGrColor.left = new FormAttachment(0, 0);
fdlGrColor.right = new FormAttachment(middle, -margin);
fdlGrColor.top = new FormAttachment(0, nr * h + margin + 10);
wlGrColor.setLayoutData(fdlGrColor);
wdGrColor = new Button(wLookComp, SWT.PUSH);
props.setLook(wdGrColor);
FormData fddGrColor = layoutResetOptionButton(wdGrColor);
fddGrColor.right = new FormAttachment(100, 0);
fddGrColor.top = new FormAttachment(0, nr * h + margin);
fddGrColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wdGrColor.setLayoutData(fddGrColor);
wdGrColor.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
graphColor.dispose();
graphColorRGB = new RGB(ConstUI.COLOR_GRAPH_RED, ConstUI.COLOR_GRAPH_GREEN, ConstUI.COLOR_GRAPH_BLUE);
graphColor = new Color(display, graphColorRGB);
wGrColor.setBackground(graphColor);
wGrColor.redraw();
}
});
wbGrColor = new Button(wLookComp, SWT.PUSH);
props.setLook(wbGrColor);
FormData fdbGrColor = layoutEditOptionButton(wbGrColor);
fdbGrColor.right = new FormAttachment(wdGrColor, -margin);
fdbGrColor.top = new FormAttachment(0, nr * h + margin);
fdbGrColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wbGrColor.setLayoutData(fdbGrColor);
wbGrColor.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ColorDialog cd = new ColorDialog(shell);
cd.setRGB(props.getGraphColorRGB());
RGB newbg = cd.open();
if (newbg != null) {
graphColorRGB = newbg;
graphColor.dispose();
graphColor = new Color(display, graphColorRGB);
wGrColor.setBackground(graphColor);
wGrColor.redraw();
}
}
});
wGrColor = new Canvas(wLookComp, SWT.BORDER);
props.setLook(wGrColor);
wGrColor.setBackground(graphColor);
FormData fdGrColor = new FormData();
fdGrColor.left = new FormAttachment(middle, 0);
fdGrColor.right = new FormAttachment(wbGrColor, -margin);
fdGrColor.top = new FormAttachment(0, nr * h + margin);
fdGrColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wGrColor.setLayoutData(fdGrColor);
// Tab selected color
nr++;
Label wlTabColor = new Label(wLookComp, SWT.RIGHT);
wlTabColor.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.TabColor.Label"));
props.setLook(wlTabColor);
FormData fdlTabColor = new FormData();
fdlTabColor.left = new FormAttachment(0, 0);
fdlTabColor.right = new FormAttachment(middle, -margin);
fdlTabColor.top = new FormAttachment(0, nr * h + margin + 10);
wlTabColor.setLayoutData(fdlTabColor);
wdTabColor = new Button(wLookComp, SWT.PUSH | SWT.CENTER);
props.setLook(wdTabColor);
FormData fddTabColor = layoutResetOptionButton(wdTabColor);
fddTabColor.right = new FormAttachment(100, 0);
fddTabColor.top = new FormAttachment(0, nr * h + margin);
fddTabColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wdTabColor.setLayoutData(fddTabColor);
wdTabColor.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
tabColor.dispose();
tabColorRGB = new RGB(ConstUI.COLOR_TAB_RED, ConstUI.COLOR_TAB_GREEN, ConstUI.COLOR_TAB_BLUE);
tabColor = new Color(display, tabColorRGB);
wTabColor.setBackground(tabColor);
wTabColor.redraw();
}
});
wbTabColor = new Button(wLookComp, SWT.PUSH);
props.setLook(wbTabColor);
FormData fdbTabColor = layoutEditOptionButton(wbTabColor);
fdbTabColor.right = new FormAttachment(wdTabColor, -margin);
fdbTabColor.top = new FormAttachment(0, nr * h + margin);
fdbTabColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wbTabColor.setLayoutData(fdbTabColor);
wbTabColor.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ColorDialog cd = new ColorDialog(shell);
cd.setRGB(props.getTabColorRGB());
RGB newbg = cd.open();
if (newbg != null) {
tabColorRGB = newbg;
tabColor.dispose();
tabColor = new Color(display, tabColorRGB);
wTabColor.setBackground(tabColor);
wTabColor.redraw();
}
}
});
wTabColor = new Canvas(wLookComp, SWT.BORDER);
props.setLook(wTabColor);
wTabColor.setBackground(tabColor);
FormData fdTabColor = new FormData();
fdTabColor.left = new FormAttachment(middle, 0);
fdTabColor.right = new FormAttachment(wbTabColor, -margin);
fdTabColor.top = new FormAttachment(0, nr * h + margin);
fdTabColor.bottom = new FormAttachment(0, (nr + 1) * h + margin);
wTabColor.setLayoutData(fdTabColor);
// Iconsize line
Label wlIconsize = new Label(wLookComp, SWT.RIGHT);
wlIconsize.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.IconSize.Label"));
props.setLook(wlIconsize);
FormData fdlIconsize = new FormData();
fdlIconsize.left = new FormAttachment(0, 0);
fdlIconsize.right = new FormAttachment(middle, -margin);
fdlIconsize.top = new FormAttachment(wTabColor, margin);
wlIconsize.setLayoutData(fdlIconsize);
wIconsize = new Text(wLookComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wIconsize.setText(Integer.toString(props.getIconSize()));
props.setLook(wIconsize);
FormData fdIconsize = new FormData();
fdIconsize.left = new FormAttachment(middle, 0);
fdIconsize.right = new FormAttachment(100, -margin);
fdIconsize.top = new FormAttachment(wTabColor, margin);
wIconsize.setLayoutData(fdIconsize);
// LineWidth line
Label wlLineWidth = new Label(wLookComp, SWT.RIGHT);
wlLineWidth.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.LineWidth.Label"));
props.setLook(wlLineWidth);
FormData fdlLineWidth = new FormData();
fdlLineWidth.left = new FormAttachment(0, 0);
fdlLineWidth.right = new FormAttachment(middle, -margin);
fdlLineWidth.top = new FormAttachment(wIconsize, margin);
wlLineWidth.setLayoutData(fdlLineWidth);
wLineWidth = new Text(wLookComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wLineWidth.setText(Integer.toString(props.getLineWidth()));
props.setLook(wLineWidth);
FormData fdLineWidth = new FormData();
fdLineWidth.left = new FormAttachment(middle, 0);
fdLineWidth.right = new FormAttachment(100, -margin);
fdLineWidth.top = new FormAttachment(wIconsize, margin);
wLineWidth.setLayoutData(fdLineWidth);
// ShadowSize line
Label wlShadowSize = new Label(wLookComp, SWT.RIGHT);
wlShadowSize.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.ShadowSize.Label"));
props.setLook(wlShadowSize);
FormData fdlShadowSize = new FormData();
fdlShadowSize.left = new FormAttachment(0, 0);
fdlShadowSize.right = new FormAttachment(middle, -margin);
fdlShadowSize.top = new FormAttachment(wLineWidth, margin);
wlShadowSize.setLayoutData(fdlShadowSize);
wShadowSize = new Text(wLookComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wShadowSize.setText(Integer.toString(props.getShadowSize()));
props.setLook(wShadowSize);
FormData fdShadowSize = new FormData();
fdShadowSize.left = new FormAttachment(middle, 0);
fdShadowSize.right = new FormAttachment(100, -margin);
fdShadowSize.top = new FormAttachment(wLineWidth, margin);
wShadowSize.setLayoutData(fdShadowSize);
// MiddlePct line
Label wlMiddlePct = new Label(wLookComp, SWT.RIGHT);
wlMiddlePct.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.DialogMiddlePercentage.Label"));
props.setLook(wlMiddlePct);
FormData fdlMiddlePct = new FormData();
fdlMiddlePct.left = new FormAttachment(0, 0);
fdlMiddlePct.right = new FormAttachment(middle, -margin);
fdlMiddlePct.top = new FormAttachment(wShadowSize, margin);
wlMiddlePct.setLayoutData(fdlMiddlePct);
wMiddlePct = new Text(wLookComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wMiddlePct.setText(Integer.toString(props.getMiddlePct()));
props.setLook(wMiddlePct);
FormData fdMiddlePct = new FormData();
fdMiddlePct.left = new FormAttachment(middle, 0);
fdMiddlePct.right = new FormAttachment(100, -margin);
fdMiddlePct.top = new FormAttachment(wShadowSize, margin);
wMiddlePct.setLayoutData(fdMiddlePct);
// GridSize line
Label wlGridSize = new Label(wLookComp, SWT.RIGHT);
wlGridSize.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.GridSize.Label"));
wlGridSize.setToolTipText(BaseMessages.getString(PKG, "EnterOptionsDialog.GridSize.ToolTip"));
props.setLook(wlGridSize);
FormData fdlGridSize = new FormData();
fdlGridSize.left = new FormAttachment(0, 0);
fdlGridSize.right = new FormAttachment(middle, -margin);
fdlGridSize.top = new FormAttachment(wMiddlePct, margin);
wlGridSize.setLayoutData(fdlGridSize);
wGridSize = new Text(wLookComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wGridSize.setText(Integer.toString(props.getCanvasGridSize()));
wGridSize.setToolTipText(BaseMessages.getString(PKG, "EnterOptionsDialog.GridSize.ToolTip"));
props.setLook(wGridSize);
FormData fdGridSize = new FormData();
fdGridSize.left = new FormAttachment(middle, 0);
fdGridSize.right = new FormAttachment(100, -margin);
fdGridSize.top = new FormAttachment(wMiddlePct, margin);
wGridSize.setLayoutData(fdGridSize);
// Show Canvas Grid
Label wlShowCanvasGrid = new Label(wLookComp, SWT.RIGHT);
wlShowCanvasGrid.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.ShowCanvasGrid.Label"));
wlShowCanvasGrid.setToolTipText(BaseMessages.getString(PKG, "EnterOptionsDialog.ShowCanvasGrid.ToolTip"));
props.setLook(wlShowCanvasGrid);
FormData fdlShowCanvasGrid = new FormData();
fdlShowCanvasGrid.left = new FormAttachment(0, 0);
fdlShowCanvasGrid.right = new FormAttachment(middle, -margin);
fdlShowCanvasGrid.top = new FormAttachment(wGridSize, margin);
wlShowCanvasGrid.setLayoutData(fdlShowCanvasGrid);
wShowCanvasGrid = new Button(wLookComp, SWT.CHECK);
props.setLook(wShowCanvasGrid);
wShowCanvasGrid.setSelection(props.isShowCanvasGridEnabled());
FormData fdShowCanvasGrid = new FormData();
fdShowCanvasGrid.left = new FormAttachment(middle, 0);
fdShowCanvasGrid.right = new FormAttachment(100, -margin);
fdShowCanvasGrid.top = new FormAttachment(wGridSize, margin);
wShowCanvasGrid.setLayoutData(fdShowCanvasGrid);
// Enable anti-aliasing
Label wlAntiAlias = new Label(wLookComp, SWT.RIGHT);
wlAntiAlias.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.CanvasAntiAliasing.Label"));
props.setLook(wlAntiAlias);
FormData fdlAntiAlias = new FormData();
fdlAntiAlias.left = new FormAttachment(0, 0);
fdlAntiAlias.top = new FormAttachment(wShowCanvasGrid, margin);
fdlAntiAlias.right = new FormAttachment(middle, -margin);
wlAntiAlias.setLayoutData(fdlAntiAlias);
wAntiAlias = new Button(wLookComp, SWT.CHECK);
props.setLook(wAntiAlias);
wAntiAlias.setSelection(props.isAntiAliasingEnabled());
FormData fdAntiAlias = new FormData();
fdAntiAlias.left = new FormAttachment(middle, 0);
fdAntiAlias.top = new FormAttachment(wShowCanvasGrid, margin);
fdAntiAlias.right = new FormAttachment(100, 0);
wAntiAlias.setLayoutData(fdAntiAlias);
// Enable anti-aliasing
Label wlIndicateSlowSteps = new Label(wLookComp, SWT.RIGHT);
wlIndicateSlowSteps.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.CanvasIndicateSlowSteps.Label"));
props.setLook(wlIndicateSlowSteps);
FormData fdlIndicateSlowSteps = new FormData();
fdlIndicateSlowSteps.left = new FormAttachment(0, 0);
fdlIndicateSlowSteps.top = new FormAttachment(wAntiAlias, margin);
fdlIndicateSlowSteps.right = new FormAttachment(middle, -margin);
wlIndicateSlowSteps.setLayoutData(fdlIndicateSlowSteps);
wIndicateSlowSteps = new Button(wLookComp, SWT.CHECK);
props.setLook(wIndicateSlowSteps);
wIndicateSlowSteps.setSelection(props.isIndicateSlowTransStepsEnabled());
wIndicateSlowSteps.setToolTipText(BaseMessages.getString(PKG, "EnterOptionsDialog.CanvasIndicateSlowSteps.Tooltip"));
FormData fdIndicateSlowSteps = new FormData();
fdIndicateSlowSteps.left = new FormAttachment(middle, 0);
fdIndicateSlowSteps.top = new FormAttachment(wAntiAlias, margin);
fdIndicateSlowSteps.right = new FormAttachment(100, 0);
wIndicateSlowSteps.setLayoutData(fdIndicateSlowSteps);
// Show original look
Label wlOriginalLook = new Label(wLookComp, SWT.RIGHT);
wlOriginalLook.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.UseOSLook.Label"));
props.setLook(wlOriginalLook);
FormData fdlOriginalLook = new FormData();
fdlOriginalLook.left = new FormAttachment(0, 0);
fdlOriginalLook.top = new FormAttachment(wIndicateSlowSteps, margin);
fdlOriginalLook.right = new FormAttachment(middle, -margin);
wlOriginalLook.setLayoutData(fdlOriginalLook);
wOriginalLook = new Button(wLookComp, SWT.CHECK);
props.setLook(wOriginalLook);
wOriginalLook.setSelection(props.isOSLookShown());
FormData fdOriginalLook = new FormData();
fdOriginalLook.left = new FormAttachment(middle, 0);
fdOriginalLook.top = new FormAttachment(wIndicateSlowSteps, margin);
fdOriginalLook.right = new FormAttachment(100, 0);
wOriginalLook.setLayoutData(fdOriginalLook);
// Show branding graphics
Label wlBranding = new Label(wLookComp, SWT.RIGHT);
wlBranding.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.Branding.Label"));
props.setLook(wlBranding);
FormData fdlBranding = new FormData();
fdlBranding.left = new FormAttachment(0, 0);
fdlBranding.top = new FormAttachment(wOriginalLook, margin);
fdlBranding.right = new FormAttachment(middle, -margin);
wlBranding.setLayoutData(fdlBranding);
wBranding = new Button(wLookComp, SWT.CHECK);
props.setLook(wBranding);
wBranding.setSelection(props.isBrandingActive());
FormData fdBranding = new FormData();
fdBranding.left = new FormAttachment(middle, 0);
fdBranding.top = new FormAttachment(wOriginalLook, margin);
fdBranding.right = new FormAttachment(100, 0);
wBranding.setLayoutData(fdBranding);
// DefaultLocale line
Label wlDefaultLocale = new Label(wLookComp, SWT.RIGHT);
wlDefaultLocale.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.DefaultLocale.Label"));
props.setLook(wlDefaultLocale);
FormData fdlDefaultLocale = new FormData();
fdlDefaultLocale.left = new FormAttachment(0, 0);
fdlDefaultLocale.right = new FormAttachment(middle, -margin);
fdlDefaultLocale.top = new FormAttachment(wBranding, margin);
wlDefaultLocale.setLayoutData(fdlDefaultLocale);
wDefaultLocale = new Combo(wLookComp, SWT.SINGLE | SWT.READ_ONLY | SWT.LEFT | SWT.BORDER);
wDefaultLocale.setItems(GlobalMessages.localeDescr);
wDefaultLocale.setEnabled(!Const.isRunningOnWebspoonMode());
props.setLook(wDefaultLocale);
FormData fdDefaultLocale = new FormData();
fdDefaultLocale.left = new FormAttachment(middle, 0);
fdDefaultLocale.right = new FormAttachment(100, -margin);
fdDefaultLocale.top = new FormAttachment(wBranding, margin);
wDefaultLocale.setLayoutData(fdDefaultLocale);
// language selections...
int idxDefault = Const.indexOfString(LanguageChoice.getInstance().getDefaultLocale().toString(), GlobalMessages.localeCodes);
if (idxDefault >= 0) {
wDefaultLocale.select(idxDefault);
}
fdLookComp = new FormData();
fdLookComp.left = new FormAttachment(0, 0);
fdLookComp.right = new FormAttachment(100, 0);
fdLookComp.top = new FormAttachment(0, 0);
fdLookComp.bottom = new FormAttachment(100, 100);
wLookComp.setLayoutData(fdLookComp);
wLookComp.pack();
Rectangle bounds = wLookComp.getBounds();
sLookComp.setContent(wLookComp);
sLookComp.setExpandHorizontal(true);
sLookComp.setExpandVertical(true);
sLookComp.setMinWidth(bounds.width);
sLookComp.setMinHeight(bounds.height);
wLookTab.setControl(sLookComp);
// ///////////////////////////////////////////////////////////
// / END OF LOOK TAB
// ///////////////////////////////////////////////////////////
}
use of org.eclipse.swt.widgets.ColorDialog in project pentaho-kettle by pentaho.
the class NotePadDialog method open.
public NotePadMeta open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.NONE);
props.setLook(shell);
shell.setImage(guiresource.getImageNoteSmall());
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(title);
int margin = Const.MARGIN;
int middle = 30;
wNoteFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wNoteFolder, PropsUI.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF NOTE CONTENT TAB///
// /
wNoteContentTab = new CTabItem(wNoteFolder, SWT.NONE);
wNoteContentTab.setText(BaseMessages.getString(PKG, "NotePadDialog.ContentTab.Note"));
Composite wNoteContentComp = new Composite(wNoteFolder, SWT.NONE);
props.setLook(wNoteContentComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wNoteContentComp.setLayout(fileLayout);
// From step line
wlDesc = new Label(wNoteContentComp, SWT.NONE);
wlDesc.setText(BaseMessages.getString(PKG, "NotePadDialog.ContentTab.Note.Label"));
props.setLook(wlDesc);
fdlDesc = new FormData();
fdlDesc.left = new FormAttachment(0, 0);
fdlDesc.top = new FormAttachment(0, margin);
wlDesc.setLayoutData(fdlDesc);
wDesc = new StyledTextComp(variables, wNoteContentComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
wDesc.setText("");
// props.setLook(wDesc, PropsUI.WIDGET_STYLE_FIXED);
// props.setLook(wDesc);
fdDesc = new FormData();
fdDesc.left = new FormAttachment(0, 0);
fdDesc.top = new FormAttachment(wlDesc, margin);
fdDesc.right = new FormAttachment(100, -10);
fdDesc.bottom = new FormAttachment(100, -margin);
wDesc.setLayoutData(fdDesc);
fdNoteContentComp = new FormData();
fdNoteContentComp.left = new FormAttachment(0, 0);
fdNoteContentComp.top = new FormAttachment(0, 0);
fdNoteContentComp.right = new FormAttachment(100, 0);
fdNoteContentComp.bottom = new FormAttachment(100, 0);
wNoteContentComp.setLayoutData(fdNoteContentComp);
wNoteContentComp.layout();
wNoteContentTab.setControl(wNoteContentComp);
// ///////////////////////////////////////////////////////////
// / END OF NOTE CONTENT TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF NOTE FONT TAB///
// /
wNoteFontTab = new CTabItem(wNoteFolder, SWT.NONE);
wNoteFontTab.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Label"));
Composite wNoteFontComp = new Composite(wNoteFolder, SWT.NONE);
props.setLook(wNoteFontComp);
FormLayout notefontLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wNoteFontComp.setLayout(notefontLayout);
// Font name
wlFontName = new Label(wNoteFontComp, SWT.RIGHT);
wlFontName.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Name.Label"));
props.setLook(wlFontName);
fdlFontName = new FormData();
fdlFontName.left = new FormAttachment(margin, margin);
fdlFontName.top = new FormAttachment(0, 3 * margin);
fdlFontName.right = new FormAttachment(middle, -margin);
wlFontName.setLayoutData(fdlFontName);
wFontName = new CCombo(wNoteFontComp, SWT.BORDER | SWT.READ_ONLY);
wFontName.setItems(Const.GetAvailableFontNames());
props.setLook(wFontName);
fdFontName = new FormData();
fdFontName.left = new FormAttachment(middle, 0);
fdFontName.top = new FormAttachment(0, 3 * margin);
fdFontName.right = new FormAttachment(100, -margin);
wFontName.setLayoutData(fdFontName);
wFontName.select(0);
wFontName.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
refreshTextNote();
}
});
// FontSize line
wlFontSize = new Label(wNoteFontComp, SWT.RIGHT);
wlFontSize.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Size.Label"));
props.setLook(wlFontSize);
fdlFontSize = new FormData();
fdlFontSize.left = new FormAttachment(margin, margin);
fdlFontSize.top = new FormAttachment(wFontName, margin);
fdlFontSize.right = new FormAttachment(middle, -margin);
wlFontSize.setLayoutData(fdlFontSize);
wFontSize = new Spinner(wNoteFontComp, SWT.BORDER);
wFontSize.setMinimum(0);
wFontSize.setMaximum(70);
wFontSize.setIncrement(1);
fdFontSize = new FormData();
fdFontSize.left = new FormAttachment(middle, 0);
fdFontSize.top = new FormAttachment(wFontName, margin);
fdFontSize.right = new FormAttachment(100, -margin);
wFontSize.setLayoutData(fdFontSize);
wFontSize.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
refreshTextNote();
}
});
// Font bold?
wlFontBold = new Label(wNoteFontComp, SWT.RIGHT);
wlFontBold.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Bold.Label"));
props.setLook(wlFontBold);
fdlFontBold = new FormData();
fdlFontBold.left = new FormAttachment(margin, margin);
fdlFontBold.top = new FormAttachment(wFontSize, margin);
fdlFontBold.right = new FormAttachment(middle, -margin);
wlFontBold.setLayoutData(fdlFontBold);
wFontBold = new Button(wNoteFontComp, SWT.CHECK);
props.setLook(wFontBold);
fdFontBold = new FormData();
fdFontBold.left = new FormAttachment(middle, 0);
fdFontBold.top = new FormAttachment(wFontSize, margin);
fdFontBold.right = new FormAttachment(100, -margin);
wFontBold.setLayoutData(fdFontBold);
wFontBold.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
refreshTextNote();
}
});
// Font Italic?
wlFontItalic = new Label(wNoteFontComp, SWT.RIGHT);
wlFontItalic.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Italic.Label"));
props.setLook(wlFontItalic);
fdlFontItalic = new FormData();
fdlFontItalic.left = new FormAttachment(margin, margin);
fdlFontItalic.top = new FormAttachment(wFontBold, margin);
fdlFontItalic.right = new FormAttachment(middle, -margin);
wlFontItalic.setLayoutData(fdlFontItalic);
wFontItalic = new Button(wNoteFontComp, SWT.CHECK);
props.setLook(wFontItalic);
fdFontItalic = new FormData();
fdFontItalic.left = new FormAttachment(middle, 0);
fdFontItalic.top = new FormAttachment(wFontBold, margin);
fdFontItalic.right = new FormAttachment(100, -margin);
wFontItalic.setLayoutData(fdFontItalic);
wFontItalic.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
refreshTextNote();
}
});
// Font color line
wlFontColor = new Label(wNoteFontComp, SWT.RIGHT);
wlFontColor.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Color.Label"));
props.setLook(wlFontColor);
fdlFontColor = new FormData();
fdlFontColor.left = new FormAttachment(margin, margin);
fdlFontColor.top = new FormAttachment(wFontItalic, 2 * margin);
fdlFontColor.right = new FormAttachment(middle, -margin);
wlFontColor.setLayoutData(fdlFontColor);
// Change font color
wbFontColorChange = new Button(wNoteFontComp, SWT.PUSH);
wbFontColorChange.setImage(guiresource.getImageColor());
wbFontColorChange.setToolTipText(BaseMessages.getString(PKG, "NotePadDialog.Font.Color.Change.Tooltip"));
props.setLook(wbFontColorChange);
fdFontColorChange = new FormData();
fdFontColorChange.top = new FormAttachment(wFontItalic, 2 * margin);
fdFontColorChange.right = new FormAttachment(100, -margin);
wbFontColorChange.setLayoutData(fdFontColorChange);
wbFontColorChange.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ColorDialog cd = new ColorDialog(shell);
cd.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Color.Dialog.Label"));
cd.setRGB(wFontColor.getBackground().getRGB());
RGB newColor = cd.open();
if (newColor == null) {
return;
}
fontColor.dispose();
fontColor = new Color(shell.getDisplay(), newColor);
wFontColor.setBackground(fontColor);
refreshTextNote();
}
});
// Font color
wFontColor = new Label(wNoteFontComp, SWT.NONE);
wFontColor.setToolTipText(BaseMessages.getString(PKG, "NotePadDialog.Font.Color.Tooltip"));
props.setLook(wFontColor);
wFontColor.setEnabled(false);
fdFontColor = new FormData();
fdFontColor.left = new FormAttachment(wlFontColor, margin);
fdFontColor.top = new FormAttachment(wFontItalic, 2 * margin);
fdFontColor.right = new FormAttachment(wbFontColorChange, -margin);
wFontColor.setLayoutData(fdFontColor);
// Background color line
wlBackGroundColor = new Label(wNoteFontComp, SWT.RIGHT);
wlBackGroundColor.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.BackGroundColor.Label"));
props.setLook(wlBackGroundColor);
fdlBackGroundColor = new FormData();
fdlBackGroundColor.left = new FormAttachment(margin, margin);
fdlBackGroundColor.top = new FormAttachment(wFontColor, 2 * margin);
fdlBackGroundColor.right = new FormAttachment(middle, -margin);
wlBackGroundColor.setLayoutData(fdlBackGroundColor);
// Change Background color
wbBackGroundColorChange = new Button(wNoteFontComp, SWT.PUSH);
wbBackGroundColorChange.setImage(guiresource.getImageColor());
wbBackGroundColorChange.setToolTipText(BaseMessages.getString(PKG, "NotePadDialog.Font.BackGroundColor.Change.Tooltip"));
props.setLook(wbBackGroundColorChange);
fdBackGroundColorChange = new FormData();
fdBackGroundColorChange.top = new FormAttachment(wFontColor, 2 * margin);
fdBackGroundColorChange.right = new FormAttachment(100, -margin);
fdBackGroundColorChange.right = new FormAttachment(100, -margin);
wbBackGroundColorChange.setLayoutData(fdBackGroundColorChange);
wbBackGroundColorChange.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ColorDialog cd = new ColorDialog(shell);
cd.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Color.Dialog.Label"));
cd.setRGB(wBackGroundColor.getBackground().getRGB());
RGB newColor = cd.open();
if (newColor == null) {
return;
}
bgColor.dispose();
bgColor = new Color(shell.getDisplay(), newColor);
wBackGroundColor.setBackground(bgColor);
refreshTextNote();
}
});
// Background color
wBackGroundColor = new Label(wNoteFontComp, SWT.BORDER);
wBackGroundColor.setToolTipText(BaseMessages.getString(PKG, "NotePadDialog.Font.BackGroundColor.Tooltip"));
props.setLook(wBackGroundColor);
wBackGroundColor.setEnabled(false);
fdBackGroundColor = new FormData();
fdBackGroundColor.left = new FormAttachment(wlBackGroundColor, margin);
fdBackGroundColor.top = new FormAttachment(wFontColor, 2 * margin);
fdBackGroundColor.right = new FormAttachment(wbBackGroundColorChange, -margin);
wBackGroundColor.setLayoutData(fdBackGroundColor);
// Border color line
wlBorderColor = new Label(wNoteFontComp, SWT.RIGHT);
wlBorderColor.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.BorderColor.Label"));
props.setLook(wlBorderColor);
fdlBorderColor = new FormData();
fdlBorderColor.left = new FormAttachment(margin, margin);
fdlBorderColor.top = new FormAttachment(wBackGroundColor, 2 * margin);
fdlBorderColor.right = new FormAttachment(middle, -margin);
wlBorderColor.setLayoutData(fdlBorderColor);
// Change border color
wbBorderColorChange = new Button(wNoteFontComp, SWT.PUSH);
wbBorderColorChange.setImage(guiresource.getImageColor());
wbBorderColorChange.setToolTipText(BaseMessages.getString(PKG, "NotePadDialog.Font.BorderColor.Change.Tooltip"));
props.setLook(wbBorderColorChange);
fdBorderColorChange = new FormData();
fdBorderColorChange.top = new FormAttachment(wBackGroundColor, 2 * margin);
fdBorderColorChange.right = new FormAttachment(100, -margin);
wbBorderColorChange.setLayoutData(fdBorderColorChange);
wbBorderColorChange.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ColorDialog cd = new ColorDialog(shell);
cd.setText(BaseMessages.getString(PKG, "NotePadDialog.Font.Color.Dialog.Label"));
cd.setRGB(wBorderColor.getBackground().getRGB());
RGB newColor = cd.open();
if (newColor == null) {
return;
}
borderColor.dispose();
borderColor = new Color(shell.getDisplay(), newColor);
wBorderColor.setBackground(borderColor);
}
});
// border color
wBorderColor = new Label(wNoteFontComp, SWT.BORDER);
wBorderColor.setToolTipText(BaseMessages.getString(PKG, "NotePadDialog.Font.BorderColor.Tooltip"));
props.setLook(wBorderColor);
wBorderColor.setEnabled(false);
fdBorderColor = new FormData();
fdBorderColor.left = new FormAttachment(wlBorderColor, margin);
fdBorderColor.top = new FormAttachment(wBackGroundColor, 2 * margin);
fdBorderColor.right = new FormAttachment(wbBorderColorChange, -margin);
wBorderColor.setLayoutData(fdBorderColor);
// Draw note?
wlDrawShadow = new Label(wNoteFontComp, SWT.RIGHT);
wlDrawShadow.setText(BaseMessages.getString(PKG, "NotePadDialog.DrawShadow.Label"));
props.setLook(wlDrawShadow);
fdlDrawShadow = new FormData();
fdlDrawShadow.left = new FormAttachment(margin, margin);
fdlDrawShadow.top = new FormAttachment(wBorderColor, margin);
fdlDrawShadow.right = new FormAttachment(middle, -margin);
wlDrawShadow.setLayoutData(fdlDrawShadow);
wDrawShadow = new Button(wNoteFontComp, SWT.CHECK);
wDrawShadow.setToolTipText(BaseMessages.getString(PKG, "NotePadDialog.DrawShadow.Tooltip"));
props.setLook(wDrawShadow);
fdDrawShadow = new FormData();
fdDrawShadow.left = new FormAttachment(middle, 0);
fdDrawShadow.top = new FormAttachment(wBorderColor, margin);
fdDrawShadow.right = new FormAttachment(100, -margin);
wDrawShadow.setLayoutData(fdDrawShadow);
fdNoteFontComp = new FormData();
fdNoteFontComp.left = new FormAttachment(0, 0);
fdNoteFontComp.top = new FormAttachment(0, 0);
fdNoteFontComp.right = new FormAttachment(100, 0);
fdNoteFontComp.bottom = new FormAttachment(100, 0);
wNoteFontComp.setLayoutData(fdNoteFontComp);
wNoteFontComp.layout();
wNoteFontTab.setControl(wNoteFontComp);
// ///////////////////////////////////////////////////////////
// / END OF NOTE FONT TAB
// ///////////////////////////////////////////////////////////
fdNoteFolder = new FormData();
fdNoteFolder.left = new FormAttachment(0, 0);
fdNoteFolder.top = new FormAttachment(0, margin);
fdNoteFolder.right = new FormAttachment(100, 0);
fdNoteFolder.bottom = new FormAttachment(100, -50);
wNoteFolder.setLayoutData(fdNoteFolder);
// Some buttons
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wNoteFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
// Detect [X] or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return notePadMeta;
}
use of org.eclipse.swt.widgets.ColorDialog in project dbeaver by serge-rider.
the class SetRowColorAction method run.
@Override
public void run() {
RGB color;
final Shell shell = UIUtils.createCenteredShell(resultSetViewer.getControl().getShell());
try {
ColorDialog cd = new ColorDialog(shell);
color = cd.open();
if (color == null) {
return;
}
} finally {
UIUtils.disposeCenteredShell(shell);
}
try {
final DBVEntity vEntity = getColorsVirtualEntity();
vEntity.setColorOverride(attribute, value, null, StringConverter.asString(color));
updateColors(vEntity);
} catch (IllegalStateException e) {
DBWorkbench.getPlatformUI().showError("Row color", "Can't set row color", e);
}
}
Aggregations