本文整理汇总了Java中org.eclipse.jface.preference.ColorSelector.getButton方法的典型用法代码示例。如果您正苦于以下问题:Java ColorSelector.getButton方法的具体用法?Java ColorSelector.getButton怎么用?Java ColorSelector.getButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.preference.ColorSelector
的用法示例。
在下文中一共展示了ColorSelector.getButton方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBinding
import org.eclipse.jface.preference.ColorSelector; //导入方法依赖的package包/类
@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()));
}
示例2: createStylesComposite
import org.eclipse.jface.preference.ColorSelector; //导入方法依赖的package包/类
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);
}
示例3: makeColorControl
import org.eclipse.jface.preference.ColorSelector; //导入方法依赖的package包/类
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;
}
示例4: ColourControl
import org.eclipse.jface.preference.ColorSelector; //导入方法依赖的package包/类
/**
* Creates the control in the specified composite. Adds the preferences to
* the list of styles to edit.
* @param parent The parent composite to put this control in
* @param preferences The preferences this control will edit.
*/
public ColourControl( Composite parent, Preference ... preferences )
{
composite = SWTUtil.createGridLayoutComposite( parent, 2 );
SWTUtil.removeLayoutMargins( (GridLayout) composite.getLayout() );
SWTUtil.gridDataFillHorizontal( composite );
// List of colour preferences
SWTUtil.addLabel( composite, ZLang.ZL_ElementLabel );
SWTUtil.createBlankGrid( composite );
elementList = SWTUtil.addList( composite, SWT.V_SCROLL );
SWTUtil.gridDataPreferredHeight( elementList, 180 );
elementList.addSelectionListener( colourListener );
for( Preference pref : preferences ) {
elementList.add( pref.getText() );
ColourSetting setting = new ColourSetting( pref );
colourSettings.add( setting );
prefMap.put( pref, setting );
}
elementList.setSelection( 0 );
SWTUtil.gridDataFillHorizontal( elementList );
// Colour options
Composite colourOptions = SWTUtil.createGridLayoutComposite( composite, 2 );
checkDefault = SWTUtil.addCheckButton( colourOptions, ZLang.ZL_UseDefault, true );
SWTUtil.gridDataColSpan( checkDefault, 2 );
checkDefault.addSelectionListener( colourListener );
SWTUtil.createBlankGrid( colourOptions, 10, 1 );
Composite colourComposite = SWTUtil.createGridLayoutComposite( colourOptions, 2 );
SWTUtil.removeLayoutMargins( (GridLayout) colourComposite.getLayout() );
Label colourButtonLabel = SWTUtil.addLabel( colourComposite, ZLang.ZL_ColourLabel );
buttonColour = new ColorSelector( colourComposite );
buttonColour.addListener( colourListener );
SWTUtil.createBlankGrid( colourOptions, 10, 1 );
checkBold = SWTUtil.addCheckButton( colourOptions, ZLang.ZL_Bold, false );
checkBold.addSelectionListener( colourListener );
SWTUtil.createBlankGrid( colourOptions, 10, 1 );
checkItalic = SWTUtil.addCheckButton( colourOptions, ZLang.ZL_Italic, false );
checkItalic.addSelectionListener( colourListener );
SWTUtil.createBlankGrid( colourOptions, 10, 1 );
checkStrikethrough = SWTUtil.addCheckButton( colourOptions, ZLang.ZL_Strikethrough, false );
checkStrikethrough.addSelectionListener( colourListener );
SWTUtil.createBlankGrid( colourOptions, 10, 1 );
checkUnderline = SWTUtil.addCheckButton( colourOptions, ZLang.ZL_Underline, false );
checkUnderline.addSelectionListener( colourListener );
settingSet = new SWTSet(
buttonColour.getButton(), checkBold, checkItalic, checkStrikethrough,
checkUnderline, colourButtonLabel
);
// Preview
Label previewLabel = SWTUtil.addLabel( composite, ZLang.ZL_PreviewLabel );
SWTUtil.gridDataColSpan( previewLabel, 2 );
preview = new TrafficScriptPreview( composite );
colourListener.showSelectedProperty();
composite.pack();
composite.layout();
}