下面列出了org.eclipse.jface.viewers.CheckboxCellEditor#org.eclipse.jface.layout.GridDataFactory 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected void createContent(Composite parent) {
Composite mainComposite = getWidgetFactory().createComposite(parent);
mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).create());
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), mainComposite);
descriptionStyler = new AdditionalResourceStyler(resourceManager.createColor(ColorConstants.SIMPLE_TYPE_RGB));
createButtons(mainComposite);
createViewer(mainComposite);
DataBindingContext ctx = new DataBindingContext();
ComputedValue<Boolean> selectionNotNullObservable = new ComputedValueBuilder<Boolean>()
.withSupplier(() -> selectionObservable.getValue() != null)
.build();
ctx.bindValue(WidgetProperties.enabled().observe(editButton), selectionNotNullObservable);
ctx.bindValue(WidgetProperties.enabled().observe(removeButton), selectionNotNullObservable);
}
protected void createList(final Composite mainComposite) {
final List list = getWidgetFactory().createList(mainComposite, SWT.BORDER | SWT.V_SCROLL);
list.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 90).create());
listViewer = new ListViewer(list);
listViewer.setContentProvider(new ObservableListContentProvider<Element>());
listViewer.setLabelProvider(new LabelProvider(){
@Override
public String getText(final Object element) {
if(element != null && element instanceof Connection){
final String transitionName = ((Connection) element).getName();
return transitionName +" -- "+((Connection) element).getTarget().getName();
}
return super.getText(element);
}
});
listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
updateButtonsEnablement();
}
});
}
protected void setDefaultUserInformationGroup(final Group defaultGroup) {
defaultGroup.setText(Messages.defaultInformationGroupTitle);
defaultGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
defaultGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
final Composite globalComposite = new Composite(defaultGroup, SWT.FILL);
globalComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).create());
globalComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
final Composite tablesComposite = new Composite(globalComposite, SWT.FILL);
tablesComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(true).create());
tablesComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
createGeneralDataTable(tablesComposite);
createBusinessCardTable(tablesComposite);
createPersonalDataTable(tablesComposite);
final Composite membershipsComposite = new Composite(globalComposite, SWT.NONE);
membershipsComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
membershipsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
createMembershipsTable(membershipsComposite);
}
@Override
protected Composite createContentAssistOptions(Composite parent)
{
Composite caOptions = super.createContentAssistOptions(parent);
final Composite fieldEditorGroup = new Composite(parent, SWT.NONE);
fieldEditorGroup.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create());
// Auto-insert closing tags
BooleanFieldEditor closingTag = new BooleanFieldEditor(IPreferenceConstants.HTML_AUTO_CLOSE_TAG_PAIRS,
Messages.HTMLPreferencePage_AutoInsertCloseTagLabel, fieldEditorGroup);
addField(closingTag);
// Hit remote URLs for src/href path children proposals
BooleanFieldEditor remoteHREFProposals = new BooleanFieldEditor(
IPreferenceConstants.HTML_REMOTE_HREF_PROPOSALS,
Messages.HTMLPreferencePage_TraverseRemoteURIsForPathAssistLabel, fieldEditorGroup);
addField(remoteHREFProposals);
return caOptions;
}
@Override
public void createControl(final Composite parent) {
super.createControl(parent);
final Composite composite = (Composite) getControl() ;
removeButton = new Button(composite, SWT.PUSH) ;
removeButton.setText(Messages.remove) ;
removeButton.setLayoutData(GridDataFactory.swtDefaults().hint(85, SWT.DEFAULT).create()) ;
removeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
deleteConnectorRessources();
}
}) ;
removeButton.setEnabled(false) ;
}
@Override
protected Control createContents(Composite parent) {
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout());
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
Group groupCommon = new Group(tparent, SWT.NONE);
groupCommon.setLayout(new GridLayout());
groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupCommon.setText(Messages.getString("preference.FrameMakerPreferencePage.groupCommon"));
HsImageLabel imageLabel = new HsImageLabel(
Messages.getString("preference.FrameMakerPreferencePage.imageLabel"),
Activator.getImageDescriptor(Constants.PREFERENCE_FRAMEMAKER_32));
Composite cmpCommon = imageLabel.createControl(groupCommon);
cmpCommon.setLayout(new GridLayout());
cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnMaster = new Button(cmpCommon, SWT.CHECK);
btnMaster.setText(Messages.getString("preference.FrameMakerPreferencePage.btnMaster"));
GridDataFactory.fillDefaults().applyTo(btnMaster);
imageLabel.computeSize();
btnMaster.setSelection(preferenceStore.getBoolean(Constants.FRAMEMAKER_FILTER));
return parent;
}
private void createNavigationBar(Composite parent)
{
toolBarManager = new ToolBarManager(SWT.FLAT);
toolBarManager.add(consoleAction);
toolBarManager.add(backAction);
toolBarManager.add(forwardAction);
toolBarManager.add(stopAction);
toolBarManager.add(refreshAction);
ToolBar toolbar = toolBarManager.createControl(parent);
toolbar.setLayoutData(GridDataFactory.fillDefaults().create());
urlCombo = new Combo(parent, SWT.DROP_DOWN);
urlCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
urlCombo.addListener(SWT.DefaultSelection, new Listener() {
@Override
public void handleEvent(Event e) {
setURL(urlCombo.getText());
}
});
ToolBarManager toolBarManager2 = new ToolBarManager(SWT.FLAT);
toolBarManager2.add(goAction);
toolbar = toolBarManager2.createControl(parent);
toolbar.setLayoutData(GridDataFactory.fillDefaults().create());
}
/**
* Creates the default tree and sets it as the control. The default styles
* will show scrollbars as needed, and allows for multiple selection.
*
* @param parent
* The parent for the Tree
* @return the control
*/
@Override
public Control createControl(final Composite parent) {
parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
final Composite mainComposite = new Composite(parent, SWT.BORDER);
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 10).create());
mainComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
final TreeViewer treeViewer = createFilteredTree(mainComposite);
treeViewer.setLabelProvider(adapterFactoryLabelProvider);
treeViewer.setContentProvider(adapterFactoryContentProvider);
addFilters(treeViewer);
treeViewer.addSelectionChangedListener(
new TabbedPropertySynchronizerListener(editPartResolver, new TabbedPropertySelectionProviderRegistry(),
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()));
setControl(mainComposite);
return mainComposite;
}
@Override
protected Control createContents(final Composite parent) {
final Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());
createFunctionCategories(mainComposite);
final SashForm sashForm = new SashForm(mainComposite, SWT.VERTICAL);
sashForm.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(250, 250).minSize(100, SWT.DEFAULT).create());
final GridLayout gridLaout = GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 2).create();
sashForm.setLayout(gridLaout);
createFunctionsList(sashForm);
createFunctionDocumentaion(sashForm);
sashForm.setWeights(new int[] { 1, 1 });
return mainComposite;
}
@Override
protected Control createDialogArea(Composite parent)
{
Composite main = new Composite(parent, SWT.NONE);
main.setLayout(GridLayoutFactory.swtDefaults().create());
main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
if (clickListener != null)
{
main.addMouseListener(clickListener);
}
Label infoLabel = new Label(main, SWT.WRAP);
infoLabel.setText(message);
infoLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
if (clickListener != null)
{
infoLabel.addMouseListener(clickListener);
}
return main;
}
@Override
protected Control createDialogArea( Composite parent )
{
Composite content = new Composite( parent, SWT.NONE );
content.setLayoutData( GridDataFactory.swtDefaults( ).hint( 300,
SWT.DEFAULT ).create( ) );
content.setLayout( GridLayoutFactory.swtDefaults( )
.numColumns( 2 )
.margins( 15, 15 )
.create( ) );
new Label( content, SWT.NONE ).setText( Messages.getString("SelectVariableDialog.AvailableVariables") ); //$NON-NLS-1$
variablesCombo = new Combo( content, SWT.READ_ONLY );
variablesCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
variablesCombo.setVisibleItemCount( 30 );
variablesCombo.addSelectionListener( new SelectionAdapter( ) {
public void widgetSelected( SelectionEvent e )
{
validate( );
}
} );
UIUtil.bindHelp( parent, IHelpContextIds.SELECT_VARIABLE_DIALOG_ID );
return content;
}
private void createExecutionEventControl(final EMFDataBindingContext dbc, final Composite parent) {
final Label eventLabel = new Label(parent, SWT.NONE);
eventLabel.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create());
eventLabel.setText(Messages.connectorEventLabel);
final Composite eventRadioGroup = new Composite(parent, SWT.NONE);
eventRadioGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
eventRadioGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).extendedMargins(20, 0, 0, 15).create());
final Button inRadio = createRadioButton(eventRadioGroup, Messages.bind(Messages.connectorInChoice, ConnectorEvent.ON_ENTER.name()));
final Button outRadio = createRadioButton(eventRadioGroup, Messages.bind(Messages.connectorOutChoice, ConnectorEvent.ON_FINISH.name()));
final SelectObservableValue eventObservable = new SelectObservableValue(String.class);
eventObservable.addOption(ConnectorEvent.ON_ENTER.name(), SWTObservables.observeSelection(inRadio));
eventObservable.addOption(ConnectorEvent.ON_FINISH.name(), SWTObservables.observeSelection(outRadio));
dbc.bindValue(eventObservable, connectorEventObservable);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
content = createDeployPreferencesPanel(container, project, loginService,
this::handleLayoutChange, new ProjectRepository(googleApiFactory));
GridDataFactory.fillDefaults().grab(true, false).applyTo(content);
// we pull in Dialog's content margins which are zeroed out by TitleAreaDialog
GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
GridLayoutFactory.fillDefaults()
.margins(LayoutConstants.getMargins().x, LayoutConstants.getMargins().y)
.generateLayout(container);
TitleAreaDialogSupport.create(this, content.getDataBindingContext())
.setValidationMessageProvider(new ValidationMessageProvider() {
@Override
public int getMessageType(ValidationStatusProvider statusProvider) {
int type = super.getMessageType(statusProvider);
setValid(type != IMessageProvider.ERROR);
return type;
}
});
return area;
}
/**
* Create contents of the dialog.
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite cmp_container = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = (GridLayout) cmp_container.getLayout();
gridLayout.verticalSpacing = 10;
gridLayout.horizontalSpacing = 10;
Label lbl_specify = new Label(cmp_container, SWT.NONE);
lbl_specify.setText(I18n.E3D_LogUploadData);
Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL);
lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
final StyledText styledText = new StyledText(cmp_container, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
styledText.setText(source);
styledText.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
cmp_container.pack();
return cmp_container;
}
@Override
public void createControl(Composite parent) {
Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
mainComposite.setLayout(GridLayoutFactory.fillDefaults().create());
Label loginHint = new Label(mainComposite, SWT.WRAP);
loginHint.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
loginHint.setText(Messages.runLoginMessage);
textWidget = new TextWidget.Builder()
.labelAbove()
.withLabel(Messages.authenticatedUser)
.fill()
.grabHorizontalSpace()
.withProposalProvider(userProposalProvider)
.createIn(mainComposite);
setControl(mainComposite);
}
public void createDocumentTableViewerComposite(final Composite parent, final DataBindingContext dbc) {
documentTableViewerComposite = new Composite(parent, SWT.NONE);
documentTableViewerComposite.setLayout(GridLayoutFactory.swtDefaults().create());
documentTableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
final TableViewer documentTableViewer = new TableViewer(documentTableViewerComposite,
SWT.BORDER | SWT.SINGLE | SWT.NO_FOCUS | SWT.H_SCROLL
| SWT.V_SCROLL);
documentTableViewer.getTable()
.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(200, 100).create());
final ObservableListContentProvider contentProvider = new ObservableListContentProvider();
documentTableViewer.setContentProvider(contentProvider);
documentTableViewer.setLabelProvider(new DocumentStyledLabelProvider());
documentTableViewer.setInput(new WritableList(availableDocuments, ProcessPackage.Literals.DOCUMENT));
final IViewerObservableValue observeSingleSelection = ViewersObservables
.observeSingleSelection(documentTableViewer);
dbc.bindValue(observeSingleSelection, selectedDataObservable,
updateValueStrategy().withValidator(createDefaultValueAlreadyDefinedValidator()).create(), null);
documentButton.addSelectionListener(createDocumentSelectionAdapter());
}
public Section createGroupControl(final Composite composite, final Group object) {
final String desc = getDescription(object.getId());
int style = Section.NO_TITLE_FOCUS_BOX | Section.TWISTIE | Section.CLIENT_INDENT;
if (desc != null && !desc.isEmpty()) {
style = style | Section.DESCRIPTION;
}
final Section groupSection = new Section(composite, style);
groupSection.setText(getLabel(object.getId()));
groupSection.setFont(BonitaStudioFontRegistry.getBoldFont());
if (desc != null && !desc.isEmpty()) {
groupSection.setDescription(desc);
}
groupSection.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
groupSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
return groupSection;
}
private void createInputForCardinalityGroup(final TabbedPropertySheetWidgetFactory widgetFactory,
final Composite dataContent) {
final Group inputGroup = widgetFactory.createGroup(dataContent, Messages.input);
inputGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
inputGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).spacing(5, 3).create());
final Label label = widgetFactory.createLabel(inputGroup, Messages.numberOfInstancesToCreate, SWT.NONE);
label.setLayoutData(GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).create());
final ExpressionViewer cardinalityExpression = new ExpressionViewer(inputGroup, SWT.BORDER, widgetFactory);
cardinalityExpression.getControl()
.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
cardinalityExpression.addFilter(new AvailableExpressionTypeFilter(
new String[] { ExpressionConstants.CONSTANT_TYPE, ExpressionConstants.VARIABLE_TYPE,
ExpressionConstants.PARAMETER_TYPE, ExpressionConstants.SCRIPT_TYPE }));
cardinalityExpression.setExpressionNameResolver(new DefaultExpressionNameResolver("numberOfInstancesToCreate"));
final IObservableValue selectionObservable = ViewersObservables.observeSingleSelection(selectionProvider);
context.bindValue(ViewersObservables.observeInput(cardinalityExpression), selectionObservable);
context.bindValue(ViewersObservables.observeSingleSelection(cardinalityExpression),
CustomEMFEditObservables.observeDetailValue(Realm.getDefault(), selectionObservable,
ProcessPackage.Literals.MULTI_INSTANTIABLE__CARDINALITY_EXPRESSION));
}
protected Control createContactInfoControl(final Composite parent, final EReference ref) {
final Composite detailsInfoComposite = new Composite(parent, SWT.NONE);
detailsInfoComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).minSize(0, 0).create());
detailsInfoComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).create());
createEmailField(detailsInfoComposite, ref);
createPhoneField(detailsInfoComposite, ref);
createMobileField(detailsInfoComposite, ref);
createFaxField(detailsInfoComposite, ref);
createWebSiteField(detailsInfoComposite, ref);
createBuildingInfoFields(detailsInfoComposite, ref);
createAddressField(detailsInfoComposite, ref);
createAddressInfoFields(detailsInfoComposite, ref);
createCountryField(detailsInfoComposite, ref);
return detailsInfoComposite;
}
protected OperationViewer createOperationViewer() {
final OperationViewer viewer = new OperationViewer(operationComposite, widgetFactory, getEditingDomain(), actionExpressionFilter,
storageExpressionFilter, isPageFlowContext);
viewer.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create());
if (eObjectContext != null) {
viewer.setContext(eObjectContext);
}
if (storageExpressionNatureProvider != null) {
viewer.setStorageExpressionNatureProvider(storageExpressionNatureProvider);
}
if (actionExpressionNatureProvider != null) {
viewer.setActionExpressionNatureProvider(actionExpressionNatureProvider);
}
for (final IExpressionValidator validator : validators) {
viewer.addActionExpressionValidator(validator);
}
return viewer;
}
protected void createTableViewerComposite(final Composite parent,
final TabbedPropertySheetWidgetFactory widgetFactory) {
viewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
viewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 70).create());
viewer.getTable().setLinesVisible(true);
viewer.getTable().setHeaderVisible(captions != null && !captions.isEmpty());
provider = new ExpressionCollectionContentProvider();
viewer.setContentProvider(provider);
for (int i = 0; i < Math.max(minNbCol, getNbCols()); i++) {
addColumnToViewer(i);
}
viewer.getTable().addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(final MouseEvent e) {
if (minNbRow == 0 || getNbRows() < minNbRow) {
final Point point = new Point(e.x, e.y);
final TableItem item = viewer.getTable().getItem(point);
int currentWidth = 0;
int colIndex = 0;
for (int i = 0; i < viewer.getTable().getColumns().length; i++) {
final TableColumn c = viewer.getTable().getColumns()[i];
if (point.x >= currentWidth && point.x < currentWidth + c.getWidth()) {
colIndex = i;
break;
}
currentWidth = currentWidth + c.getWidth();
}
if (item == null && fixedRow) { //When fixedRow is true, no add button is present so we need to keep this behavior
addRow(colIndex);
}
}
}
});
}
private Composite createOptionsPanel(final Composite composite) {
final Composite row = new Composite(composite, SWT.NONE);
row.setLayout(new GridLayout(2,true));
final Group directionGroup = new Group(row, SWT.SHADOW_ETCHED_IN);
GridDataFactory.fillDefaults().grab(true, true).applyTo(directionGroup);
directionGroup.setText("Direction");
final RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
rowLayout.marginHeight = rowLayout.marginWidth = 3;
directionGroup.setLayout(rowLayout);
forwardButton = new Button(directionGroup, SWT.RADIO);
forwardButton.setText("F&orward");
forwardButton.setSelection(true);
final Button backwardButton = new Button(directionGroup, SWT.RADIO);
backwardButton.setText("&Backward");
final Group optionsGroup = new Group(row, SWT.SHADOW_ETCHED_IN);
GridDataFactory.fillDefaults().grab(true, true).applyTo(optionsGroup);
optionsGroup.setText("Options");
optionsGroup.setLayout(rowLayout);
caseSensitiveButton = new Button(optionsGroup, SWT.CHECK);
caseSensitiveButton.setText("&Case Sensitive");
wrapSearchButton = new Button(optionsGroup, SWT.CHECK);
wrapSearchButton.setText("&Wrap Search");
wrapSearchButton.setSelection(true);
return row;
}
private void createDisplayNameField(final Group group) {
final Label displayNameLabel = new Label(group, SWT.NONE);
displayNameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create());
displayNameLabel.setText(Messages.displayName);
final Text displayNamedText = new Text(group, SWT.BORDER);
displayNamedText.setMessage(Messages.groupNameExample);
displayNamedText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
final IObservableValue displayNameValue = EMFObservables.observeDetailValue(Realm.getDefault(), groupSingleSelectionObservable,
OrganizationPackage.Literals.GROUP__DISPLAY_NAME);
final Binding binding = context.bindValue(SWTObservables.observeText(displayNamedText, SWT.Modify), displayNameValue,
UpdateStrategyFactory.updateValueStrategy()
.withValidator(maxLengthValidator(Messages.displayName, LONG_FIELD_MAX_LENGTH)).create(),
null);
ControlDecorationSupport.create(binding, SWT.LEFT);
displayNameValue.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(final ValueChangeEvent event) {
handleGroupDisplayName(event);
}
});
}
private void createCaseSensitiveArea(Composite parent)
{
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(GridLayoutFactory.fillDefaults().create());
composite.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create());
fCaseSensitiveButton = new Button(composite, SWT.CHECK);
fCaseSensitiveButton.setFont(parent.getFont());
fCaseSensitiveButton.setText(Messages.TasksPreferencePage_CaseSensitiveLabel);
fCaseSensitiveButton.setSelection(getPreferenceStore().getBoolean(
ICorePreferenceConstants.TASK_TAGS_CASE_SENSITIVE));
setButtonLayoutData(fCaseSensitiveButton);
}
@Override
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10)
.spacing(20, 5).applyTo(composite);
/* generate the wizard fields */
for (IGenericTransactionField field : transaction.getFields()) {
Label label = new Label(composite, SWT.NONE);
label.setText(field.getLabel());
Control control = field.createControl(composite);
if (control instanceof Text && (control.getStyle() & SWT.V_SCROLL) != 0) {
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL)
.grab(true, true).applyTo(control);
}
else {
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
.grab(true, false).applyTo(control);
}
ControlDecoration deco = new ControlDecoration(control, SWT.TOP
| SWT.RIGHT);
deco.setImage(errorImage);
deco.hide();
decorators.put(field.getLabel(), deco);
}
setControl(composite);
}
private Composite createButtonSection(Composite composite) {
Composite panel = new Composite(composite, SWT.NONE);
GridLayout layout= new GridLayout(1,false);
panel.setLayout(layout);
statusLabel = new Label(panel, SWT.LEFT);
statusLabel.setForeground(statusLabel.getDisplay().getSystemColor(SWT.COLOR_RED));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(statusLabel);
findButton = createButton(panel, IDialogConstants.CLIENT_ID, "&Find", false);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT).applyTo(findButton);
findButton.setEnabled(false);
getShell().setDefaultButton(findButton);
findButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doFind();
}
});
Button closeButton = createButton(panel, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT).applyTo(closeButton);
return panel;
}
private void createStringFieldDetailsComposite(DataBindingContext ctx) {
stringFieldDetailsComposite = formPage.getToolkit().createComposite(this);
stringFieldDetailsComposite.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
stringFieldDetailsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
IObservableValue<Integer> fieldLengthObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
selectedFieldObservable, BusinessDataModelPackage.Literals.SIMPLE_FIELD__LENGTH);
createDescriptionTextArea(stringFieldDetailsComposite);
new ComboWidget.Builder()
.withLabel(Messages.length)
.withCompositeMessageDecorator()
.withItems(new String[] { "64", "128", "255", "512" })
.labelAbove()
.widthHint(500)
.bindTo(fieldLengthObservable)
.withTargetToModelStrategy(UpdateStrategyFactory.updateValueStrategy()
.withConverter(StringToNumberConverter.toInteger(false))
.withValidator(new StringLengthValidator(selectedFieldObservable))
.create())
.withModelToTargetStrategy(UpdateStrategyFactory.updateValueStrategy()
.withConverter(NumberToStringConverter.fromInteger(false))
.create())
.inContext(ctx)
.adapt(formPage.getToolkit())
.createIn(stringFieldDetailsComposite);
Label stringHelp = formPage.getToolkit().createLabel(stringFieldDetailsComposite, Messages.stringLengthTooltip,
SWT.WRAP);
stringHelp.setLayoutData(GridDataFactory.fillDefaults().hint(800, SWT.DEFAULT).create());
}
private void createOperationClassGroup(Composite parent) {
Group propertyGroup = new Group(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
propertyGroup.setText("Operation class:");
propertyGroup.setLayout(new GridLayout(1, false));
operationClass = new Text(propertyGroup, SWT.BORDER);
operationClass.addListener(SWT.Modify, new UpdateListener());
GridDataFactory.fillDefaults().grab(true, false).applyTo(operationClass);
}
private void createTableCombo(TableComboViewer tCmbViewer){
TableCombo tableCombo = tCmbViewer.getTableCombo();
tableCombo.setShowTableLines(false);
tableCombo.setShowTableHeader(false);
tableCombo.setDisplayColumnIndex(-1);
tableCombo.setShowImageWithinSelection(true);
tableCombo.setShowColorWithinSelection(false);
tableCombo.setShowFontWithinSelection(false);
tableCombo.setVisibleItemCount(2);
GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).applyTo(tableCombo);
tCmbViewer.setLabelProvider(new QATipsLabelProvider());
tCmbViewer.setContentProvider(new ArrayContentProvider());
tCmbViewer.setInput(CONSTANT_COMBOVALUE);
}
/**
* Set the layout data of the button to a GridData with appropriate heights
* and widths.
*
* @param button
*/
protected void setButtonCGridLayoutData( Button button )
{
int widthHint = convertHorizontalDLUsToPixels( IDialogConstants.BUTTON_WIDTH );
Point minSize = button.computeSize( SWT.DEFAULT, SWT.DEFAULT, true );
button.setLayoutData( GridDataFactory.swtDefaults( )
.hint( Math.max( widthHint, minSize.x ), SWT.DEFAULT )
.create( ) );
}