@Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); Label tagNameLabel = new Label(container, SWT.NONE); tagNameLabel.setText("Tag name"); tagInput = new Text(container, SWT.SINGLE | SWT.BORDER); tagInput.setText(suggestion); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); tagInput.setLayoutData(gridData); Label tagCategoryLabel = new Label(container, SWT.NONE); tagCategoryLabel.setText("Colour"); colourSelector = new ColorSelector(container); return container; }
/** * * * @param colorsAndFontsGroup * void */ private void createCommentFillColor(Group parent) { Label fontColorLabel = new Label(parent, SWT.NONE); fontColorLabel.setLayoutData(labelGridData); fontColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_COMMENT_FILL_COLOR) + UICoreConstant.PROJECT_CONSTANTS__COLON); commentFillColorSelector = new ColorSelector(parent); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.BEGINNING; commentFillColorSelector.getButton().setLayoutData(gridData); commentFillColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { changedColorNameList.add(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_COMMENT_FILL); changedColorMap.put(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_COMMENT_FILL, (RGB) event.getNewValue()); fireValueChanged(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_COMMENT_FILL, event.getOldValue(), event.getNewValue()); } }); }
/** * @param parent */ private void createFontColor(Group parent) { Label fontColorLabel = new Label(parent, SWT.NONE); fontColorLabel.setLayoutData(labelGridData); fontColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_FONT_COLOR) + UICoreConstant.PROJECT_CONSTANTS__COLON); fontColorSelector = new ColorSelector(parent); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.BEGINNING; fontColorSelector.getButton().setLayoutData(gridData); fontColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { changedColorNameList.add(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_FONT); changedColorMap.put(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_FONT, (RGB) event.getNewValue()); fireValueChanged(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_FONT, event.getOldValue(), event.getNewValue()); } }); }
/** * * * @param colorsAndFontsGroup * void */ private void createNoteFillColor(Group parent) { Label fontColorLabel = new Label(parent, SWT.NONE); fontColorLabel.setLayoutData(labelGridData); fontColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_NOTE_FILL_COLOR) + UICoreConstant.PROJECT_CONSTANTS__COLON); noteFillColorSelector = new ColorSelector(parent); gridData = new GridData(); gridData.horizontalSpan = 1; gridData.horizontalAlignment = GridData.BEGINNING; noteFillColorSelector.getButton().setLayoutData(gridData); noteFillColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { changedColorNameList.add(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_NOTE_FILL); changedColorMap.put(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_NOTE_FILL, (RGB) event.getNewValue()); fireValueChanged(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_NOTE_FILL, event.getOldValue(), event.getNewValue()); } }); }
/** * @param parent */ private void createNoteFontColor(Group parent) { Label fontColorLabel = new Label(parent, SWT.NONE); fontColorLabel.setLayoutData(labelGridData); fontColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_FONT_COLOR) + UICoreConstant.PROJECT_CONSTANTS__COLON); noteFontColorSelector = new ColorSelector(parent); gridData = new GridData(); gridData.horizontalSpan = 1; gridData.horizontalAlignment = GridData.BEGINNING; noteFontColorSelector.getButton().setLayoutData(gridData); noteFontColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { changedColorNameList.add(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_NOTE_FONT); changedColorMap.put(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_NOTE_FONT, (RGB) event.getNewValue()); fireValueChanged(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_NOTE_FONT, event.getOldValue(), event.getNewValue()); } }); }
/** * * * @param colorsAndFontsGroup * void */ private void createLineColor(Group parent) { Label fontColorLabel = new Label(parent, SWT.NONE); fontColorLabel.setLayoutData(labelGridData); fontColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_LINE_COLOR) + UICoreConstant.PROJECT_CONSTANTS__COLON); lineColorSelector = new ColorSelector(parent); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.BEGINNING; lineColorSelector.getButton().setLayoutData(gridData); lineColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { changedColorNameList.add(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_LINE); changedColorMap.put(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_LINE, (RGB) event.getNewValue()); fireValueChanged(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_LINE, event.getOldValue(), event.getNewValue()); } }); }
/** * * * @param colorsAndFontsGroup * void */ private void createFillColor(Group parent) { Label fontColorLabel = new Label(parent, SWT.NONE); fontColorLabel.setLayoutData(labelGridData); fontColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_FILL_COLOR) + UICoreConstant.PROJECT_CONSTANTS__COLON); fillColorSelector = new ColorSelector(parent); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.BEGINNING; fillColorSelector.getButton().setLayoutData(gridData); fillColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { changedColorNameList.add(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_FILL); changedColorMap.put(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_FILL, (RGB) event.getNewValue()); fireValueChanged(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_UMLNOTATION_FILL, event.getOldValue(), event.getNewValue()); } }); }
/** * @param parent */ private void createCommentFontColor(Group parent) { Label fontColorLabel = new Label(parent, SWT.NONE); fontColorLabel.setLayoutData(labelGridData); fontColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_FONT_COLOR) + UICoreConstant.PROJECT_CONSTANTS__COLON); commentFontColorSelector = new ColorSelector(parent); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.BEGINNING; commentFontColorSelector.getButton().setLayoutData(gridData); commentFontColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { changedColorNameList.add(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_COMMENT_FONT); changedColorMap.put(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_COMMENT_FONT, (RGB) event.getNewValue()); fireValueChanged(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COLORSANDFONTS_COMMENT_FONT, event.getOldValue(), event.getNewValue()); } }); }
public void createColorProperty(Composite cmp, final String prop, String name, final IPreferenceStore store) { new Label(cmp, SWT.NONE).setText(name); final ColorSelector colorSelector = new ColorSelector(cmp); colorSelector.addListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { properties.put(prop, StringConverter.asString(colorSelector.getColorValue())); save(store); } }); try { colorSelector.setColorValue(StringConverter.asRGB(properties.get(prop))); } catch (DataFormatException e) { e.printStackTrace(); } }
private void createUI_80_DimmingColor(final Composite parent) { final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(container); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(container); { // label final Label label = new Label(container, SWT.NONE); GridDataFactory.fillDefaults()// .align(SWT.FILL, SWT.CENTER) .applyTo(label); label.setText(Messages.pref_map_layout_dim_color); // dimming color _colorMapDimmColor = new ColorSelector(container); _colorMapDimmColor.addListener(_defaultChangePropertyListener); } }
private void onSelectColor(final ColorSelector colorSelector, final int valueColorIndex) { // update model final ColorValue colorValue = _mapColorWorkingCopy.getColorValues()[4 - valueColorIndex]; final RGB selectedRGB = colorSelector.getColorValue(); colorValue.red = selectedRGB.red; colorValue.green = selectedRGB.green; colorValue.blue = selectedRGB.blue; updateUI(); updateUI_LegendImage(); updateModelFromUI(); doLiveUpdate(); }
@Override public Binding createBinding(DetailProviderParameter p) { FormToolkit toolkit = p.getDetailFormToolkit(); Composite parent = p.getParent(); EObject target = p.getTarget(); IItemPropertyDescriptor pd = p.getPropertyDescriptor(); EStructuralFeature feature = (EStructuralFeature) pd.getFeature(target); if (feature == null) { return null; } boolean isEditable = pd.canSetProperty(target); EMFDetailUtils.createLabel(parent, toolkit, target, pd); Composite composite = createPaddingComposite(toolkit, parent); ColorSelector colorSelector = new ColorSelector(composite); Button button = colorSelector.getButton(); button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true)); button.setEnabled(isEditable); toolkit.adapt(button, true, true); EMFDetailUtils.bindControlViability(p, new Control[] {button}); return EMFDetailUtils.bindEMFUndoable(p, new RGBSelectorObservableValue(colorSelector, ERGB.class == feature.getEType().getInstanceClass())); }
private ColorSelector createColorSelector() { final ColorSelector chooser = new ColorSelector(parent); chooser.addListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { String oldValue = getObject(); // get the RGB values, and update RGB rgb = colorChooser.getColorValue(); String newValue = ColorUtils.formatRGB(rgb); setObject(newValue); firePropertyChange(oldValue, newValue); } }); return chooser; }
/** * createFillColor * * @param colorsAndFontsGroup * void */ private void createFillColor(Group parent) { Label fillColorLabel = new Label(parent, SWT.NONE); fillColorLabel.setLayoutData(labelGridData); fillColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_FILL_COLOR) + COLON_TEXT); fillColorLabel.setBackground(UiCorePlugin.getDefault().getColor("White")); fillColorSelector = new ColorSelector(parent); GridData gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.BEGINNING; fillColorSelector.getButton().setLayoutData(gridData); fillColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { nodeColor = (RGB) event.getNewValue(); DomainUtil.run(new TransactionalAction() { /** * @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute() */ @Override public void doExecute() { AbstractView viewModel = getViewModel(); if (viewModel != null) { viewModel.setFillColor(StringConverter.asString(nodeColor)); } } }); } }); }
/** * @param parent */ private void createFontColor(Group parent) { Label fontColorLabel = new Label(parent, SWT.NONE); fontColorLabel.setLayoutData(labelGridData); fontColorLabel.setText(UMLMessage.getMessage(UMLMessage.LABEL_PREFERENCE_APPEARANCE_FONT_COLOR) + COLON_TEXT); fontColorLabel.setBackground(UiCorePlugin.getDefault().getColor("White")); fontColorSelector = new ColorSelector(parent); GridData gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.BEGINNING; fontColorSelector.getButton().setLayoutData(gridData); fontColorSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector /** * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { fontColor = (RGB) event.getNewValue(); DomainUtil.run(new TransactionalAction() { /** * @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute() */ @Override public void doExecute() { AbstractView viewModel = getViewModel(); if (viewModel != null) { viewModel.setFontColor(StringConverter.asString(fontColor)); } } }); } }); }
private void createBackgroundColorSelector(Composite parent) { // Fix for issue 38: Cannot enter colors using Mac OS X createEmptyTable(parent,2); // draw label Label label = new Label(parent,SWT.LEFT); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); label.setText(LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.background.label")); //$NON-NLS-1$ // draw selector backgroundColorSelector = new ColorSelector(parent); backgroundColorSelector.setColorValue(new RGB(255,255,255)); backgroundColorSelector.getButton().setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); if(edit) { backgroundColorSelector.setColorValue(this.data.getBackgroundColor()); } }
private void createForegroundColorSelector(Composite parent) { // Fix for issue 38: Cannot enter colors using Mac OS X createEmptyTable(parent,2); // draw label Label label = new Label(parent,SWT.LEFT); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); label.setText(LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.foreground.label")); //$NON-NLS-1$ // draw selector foregroundColorSelector = new ColorSelector(parent); foregroundColorSelector.setColorValue(new RGB(0,0,0)); foregroundColorSelector.getButton().setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); if(edit) { foregroundColorSelector.setColorValue(this.data.getForegroundColor()); } }
@Override protected Control createContents(Composite parent) { // CONTAINER Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, true); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.grabExcessHorizontalSpace = true; container.setLayout(layout); container.setLayoutData(layoutData); /* * Fill the widget with the color chooser controls */ IConfigurationManager conf = getConfigurationManager(); m_colorSelectors = new ColorSelector[GuiColorKey.values().length]; for (GuiColorKey key : GuiColorKey.values()) { Label label = new Label(container, SWT.NONE); label.setText(key.description); label.setLayoutData(GridDataFactory.copyData(layoutData)); ColorSelector selector = new ColorSelector(container); selector.setColorValue(conf.getGuiColor(key).getRGB()); m_colorSelectors[key.ordinal()] = selector; } return container; }
@Override public void performApply() { IConfigurationManager conf = getConfigurationManager(); for (GuiColorKey key : GuiColorKey.values()) { ColorSelector selector = m_colorSelectors[key.ordinal()]; RGB rgb = selector.getColorValue(); conf.setGuiColor(key, rgb); } }
@Override protected Control createContents(Composite parent) { // CONTAINER Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, true); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.grabExcessHorizontalSpace = true; container.setLayout(layout); container.setLayoutData(layoutData); /* * Fill the widget with the color chooser controls */ IConfigurationManager conf = getConfigurationManager(); m_colorSelectors = new ColorSelector[StatusColorKey.values().length]; for (StatusColorKey key : StatusColorKey.values()) { Label label = new Label(container, SWT.NONE); label.setText(key.description); label.setLayoutData(GridDataFactory.copyData(layoutData)); ColorSelector selector = new ColorSelector(container); selector.setColorValue(conf.getColor(key.getPreferenceName()) .getRGB()); m_colorSelectors[key.ordinal()] = selector; } return container; }
@Override public void performApply() { IConfigurationManager conf = getConfigurationManager(); for (StatusColorKey key : StatusColorKey.values()) { ColorSelector selector = m_colorSelectors[key.ordinal()]; RGB rgb = selector.getColorValue(); conf.setColor(key.getPreferenceName(), rgb); } }
@Override protected Control createContents(Composite parent) { // CONTAINER Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, true); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.grabExcessHorizontalSpace = true; container.setLayout(layout); container.setLayoutData(layoutData); /* * Fill the widget with the color chooser controls */ IConfigurationManager conf = getConfigurationManager(); m_colorSelectors = new ColorSelector[ExecutorStatus.values().length]; for (ExecutorStatus key : ExecutorStatus.values()) { Label label = new Label(container, SWT.NONE); label.setText(key.description); label.setLayoutData(GridDataFactory.copyData(layoutData)); ColorSelector selector = new ColorSelector(container); selector.setColorValue(conf.getColor( ProcColorKey.getPreferenceName(key)).getRGB()); m_colorSelectors[key.ordinal()] = selector; } return container; }
@Override public void performApply() { IConfigurationManager conf = getConfigurationManager(); for (ExecutorStatus key : ExecutorStatus.values()) { ColorSelector selector = m_colorSelectors[key.ordinal()]; RGB rgb = selector.getColorValue(); conf.setColor(ProcColorKey.getPreferenceName(key), rgb); } }
private void createGlobalColorControls(Composite composite) { Composite colors = new Composite(composite, SWT.NONE); colors.setLayout(new GridLayout(4, false)); // TODO Make the ColorSelector buttons be SWT.FLAT, and let them handle alpha values as Textmate does Label label = new Label(colors, SWT.NONE); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); label.setText(Messages.ThemePreferencePage_ForegroundLabel); fgSelector = new ColorSelector(colors); fgSelector.addListener(this); label = new Label(colors, SWT.NONE); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); label.setText(Messages.ThemePreferencePage_SelectionLabel); selectionSelector = new ColorSelector(colors); selectionSelector.addListener(this); label = new Label(colors, SWT.NONE); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); label.setText(Messages.ThemePreferencePage_BackgroundLabel); bgSelector = new ColorSelector(colors); bgSelector.addListener(this); label = new Label(colors, SWT.NONE); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); label.setText(Messages.ThemePreferencePage_LineHighlightLabel); lineHighlightSelector = new ColorSelector(colors); lineHighlightSelector.addListener(this); label = new Label(colors, SWT.NONE); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); label.setText(Messages.ThemePreferencePage_CaretLabel); caretSelector = new ColorSelector(colors); caretSelector.addListener(this); }
private ColorSelector createUIColorSelector(final Composite parent, final IPropertyChangeListener colorListener, final GridDataFactory gd) { final ColorSelector colorSelector = new ColorSelector(parent); colorSelector.addListener(colorListener); gd.applyTo(colorSelector.getButton()); return colorSelector; }
private void setColorValue(final ColorSelector colorSelector, int colorValue) { if (colorValue == -1) { colorValue = 0; } final RGB rgb = getRGB(colorValue); colorSelector.setColorValue(rgb); colorSelector.getButton().setToolTipText(rgb.toString()); }
/** * Create the color selection control. * * @param parent */ private void createUI_20_ColorControl(final Composite parent) { final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(false, false).applyTo(container); GridLayoutFactory.fillDefaults().numColumns(1).applyTo(container); // container.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW)); { /* * button: color selector: */ _colorSelector = new ColorSelector(container); _colorSelector.getButton().setLayoutData(new GridData()); _colorSelector.setEnabled(false); setButtonLayoutData(_colorSelector.getButton()); _colorSelector.addListener(new IPropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { onSelectColorInColorSelector(event); } }); /* * button: mapping color */ _btnLegend = new Button(container, SWT.NONE); _btnLegend.setText(Messages.Pref_ChartColors_btn_legend); setButtonLayoutData(_btnLegend); _btnLegend.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { onSelectMappingColor(); } }); _btnLegend.setEnabled(false); } }
public RGBSelectorObservableValue(ColorSelector colorSelector, boolean isERGB) { this.colorSelector = colorSelector; this.isERGB = isERGB; colorSelector.addListener(widgetListener); colorSelector.getButton().addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { dispose(); } }); }
@Override protected void doFillIntoGrid(Composite parent, int numColumns) { label = new Label(parent, SWT.LEFT); label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 2, 1)); label.setText(labelText); list = new List(parent, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); list.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1)); list.addSelectionListener(getSelectionListener()); colorSelector = new ColorSelector(parent); // list.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); }
private void createStylesComposite(Composite editorComposite) { GridLayout layout; GridData gd; 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.END, GridData.FILL, false, true)); fEnableCheckbox = new Button(stylesComposite, SWT.CHECK); fEnableCheckbox.setText("Enable"); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalSpan = 2; fEnableCheckbox.setLayoutData(gd); fColorEditorLabel = new Label(stylesComposite, SWT.LEFT); fColorEditorLabel.setText("Color:"); gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent = 20; fColorEditorLabel.setLayoutData(gd); fSyntaxForegroundColorEditor = new ColorSelector(stylesComposite); fForegroundColorButton = fSyntaxForegroundColorEditor.getButton(); gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); fForegroundColorButton.setLayoutData(gd); fBoldCheckBox = new Button(stylesComposite, SWT.CHECK); fBoldCheckBox.setText("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("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("Strikethrough"); gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent = 20; gd.horizontalSpan = 2; fStrikethroughCheckBox.setLayoutData(gd); fUnderlineCheckBox = new Button(stylesComposite, SWT.CHECK); fUnderlineCheckBox.setText("Underlined"); gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent = 20; gd.horizontalSpan = 2; fUnderlineCheckBox.setLayoutData(gd); }
public static Button makeColorControl(Composite options, int span) { ColorSelector selector = new ColorSelector(options); Button button = selector.getButton(); GridDataFactory.fillDefaults().span(span, 1).applyTo(button); return button; }
protected void updateBackground(final ColorSelector ctrl, final Color c) { if (c == null) { genGradientBut.setEnabled(false); } else ctrl.setColorValue(c.getRGB()); }