use of org.eclipse.jface.fieldassist.ControlDecoration in project bndtools by bndtools.
the class BndPreferencePage method createContents.
@Override
protected Control createContents(Composite parent) {
// Layout
GridLayout layout;
GridData gd;
Composite composite = new Composite(parent, SWT.NONE);
final Button btnOfflineWorkspace = new Button(composite, SWT.CHECK);
btnOfflineWorkspace.setText(Messages.BndPreferencePage_btnOfflineWorkspace);
ControlDecoration decoration = new ControlDecoration(btnOfflineWorkspace, SWT.RIGHT | SWT.TOP, composite);
decoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
decoration.setDescriptionText(Messages.BndPreferencePage_decorOfflineWorkspace);
// Create controls
Group grpLaunching = new Group(composite, SWT.NONE);
grpLaunching.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
grpLaunching.setText(Messages.BndPreferencePage_grpLaunching_text);
grpLaunching.setLayout(new GridLayout(1, false));
final Button btnWarnExistingLaunch = new Button(grpLaunching, SWT.CHECK);
btnWarnExistingLaunch.setText(Messages.BndPreferencePage_btnWarnExistingLaunch);
final Button btnBuildBeforeLaunch = new Button(grpLaunching, SWT.CHECK);
btnBuildBeforeLaunch.setText(Messages.BndPreferencePage_btnBuildBeforeLaunch);
Group editorGroup = new Group(composite, SWT.NONE);
editorGroup.setText(Messages.BndPreferencePage_editorGroup);
final Button btnEditorOpenSourceTab = new Button(editorGroup, SWT.CHECK);
btnEditorOpenSourceTab.setText(Messages.BndPreferencePage_btnEditorOpenSourceTab);
// Load Data
btnWarnExistingLaunch.setSelection(warnExistingLaunch);
btnBuildBeforeLaunch.setSelection(buildBeforeLaunch);
btnEditorOpenSourceTab.setSelection(editorOpenSourceTab);
btnOfflineWorkspace.setSelection(workspaceIsOffline);
// headless already done
// versionControlIgnores already done
// Listeners
btnOfflineWorkspace.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
workspaceIsOffline = btnOfflineWorkspace.getSelection();
}
});
btnBuildBeforeLaunch.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
buildBeforeLaunch = btnBuildBeforeLaunch.getSelection();
}
});
btnWarnExistingLaunch.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
warnExistingLaunch = btnWarnExistingLaunch.getSelection();
}
});
btnEditorOpenSourceTab.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
editorOpenSourceTab = btnEditorOpenSourceTab.getSelection();
}
});
// headless already done
// versionControlIgnores already done
layout = new GridLayout(1, false);
composite.setLayout(layout);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
editorGroup.setLayoutData(gd);
layout = new GridLayout(1, false);
layout.verticalSpacing = 10;
editorGroup.setLayout(layout);
return composite;
}
use of org.eclipse.jface.fieldassist.ControlDecoration in project linuxtools by eclipse.
the class ContainerDataVolumeDialog method createDialogArea.
@Override
protected Control createDialogArea(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
final int COLUMNS = 3;
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1).grab(true, true).applyTo(container);
GridLayoutFactory.fillDefaults().margins(10, 10).numColumns(COLUMNS).applyTo(container);
// Container path
final Label containerPathLabel = new Label(container, SWT.NONE);
containerPathLabel.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.containerPathLabel"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(containerPathLabel);
final Text containerPathText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(containerPathText);
final IObservableValue containerPathObservable = BeanProperties.value(DataVolumeModel.class, DataVolumeModel.CONTAINER_PATH).observe(model);
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(containerPathText), containerPathObservable);
// mount type
final Label explanationLabel = new Label(container, SWT.NONE);
explanationLabel.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.explanationLabel"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS, 1).grab(true, false).applyTo(explanationLabel);
final int INDENT = 20;
// No mount
final Button noMountButton = new Button(container, SWT.RADIO);
noMountButton.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.noMountButton"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).span(COLUMNS, 1).grab(true, false).applyTo(noMountButton);
bindButton(noMountButton, MountType.NONE);
// File System mount
final Button fileSystemMountButton = new Button(container, SWT.RADIO);
fileSystemMountButton.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.fileSystemMountButton"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).span(COLUMNS, 1).grab(true, false).applyTo(fileSystemMountButton);
final Label hostPathLabel = new Label(container, SWT.NONE);
hostPathLabel.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.hostPathLabel"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(2 * INDENT, SWT.DEFAULT).grab(false, false).applyTo(hostPathLabel);
final Text hostPathText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(hostPathText);
final IObservableValue hostPathObservable = BeanProperties.value(DataVolumeModel.class, DataVolumeModel.HOST_PATH_MOUNT).observe(model);
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(hostPathText), hostPathObservable);
// browse for directory
final Button hostPathDirectoryButton = new Button(container, SWT.NONE);
hostPathDirectoryButton.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.directoryButton"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(hostPathDirectoryButton);
hostPathDirectoryButton.addSelectionListener(onHostDirectoryPath());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(new Label(container, SWT.NONE));
// optional read-only access
final Button readOnlyButton = new Button(container, SWT.CHECK);
readOnlyButton.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.readOnlyButton"));
readOnlyButton.setToolTipText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.readOnlyButtonTooltip"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS - 2, 1).grab(true, false).applyTo(readOnlyButton);
final ISWTObservableValue readOnlyButtonObservable = WidgetProperties.selection().observe(readOnlyButton);
dbc.bindValue(readOnlyButtonObservable, BeanProperties.value(DataVolumeModel.class, DataVolumeModel.READ_ONLY_VOLUME).observe(model));
// browse for file
final Button hostPathFileButton = new Button(container, SWT.NONE);
hostPathFileButton.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.fileButton"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(hostPathFileButton);
hostPathFileButton.addSelectionListener(onHostFilePath());
bindButton(fileSystemMountButton, MountType.HOST_FILE_SYSTEM, hostPathText, hostPathDirectoryButton, hostPathFileButton, readOnlyButton);
// Container mount
final Button containerMountButton = new Button(container, SWT.RADIO);
containerMountButton.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.containerMountButton"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).span(COLUMNS, 1).grab(true, false).applyTo(containerMountButton);
final Label containerSelectionLabel = new Label(container, SWT.NONE);
containerSelectionLabel.setText(WizardMessages.getString(// $NON-NLS-1$
"ContainerDataVolumeDialog.containerSelectionLabel"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(2 * INDENT, SWT.DEFAULT).applyTo(containerSelectionLabel);
final Combo containerSelectionCombo = new Combo(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(containerSelectionCombo);
new ControlDecoration(containerSelectionCombo, SWT.TOP | SWT.LEFT);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(new Label(container, SWT.NONE));
bindButton(containerMountButton, MountType.CONTAINER, containerSelectionCombo);
final ComboViewer containerSelectionComboViewer = new ComboViewer(containerSelectionCombo);
containerSelectionComboViewer.setContentProvider(new ArrayContentProvider());
containerSelectionComboViewer.setInput(this.containerNames);
final IObservableValue selectedContainerObservable = BeanProperties.value(DataVolumeModel.class, DataVolumeModel.CONTAINER_MOUNT).observe(model);
dbc.bindValue(WidgetProperties.selection().observe(containerSelectionCombo), selectedContainerObservable);
new ContentProposalAdapter(containerSelectionCombo, new ComboContentAdapter() {
@Override
public void insertControlContents(Control control, String text, int cursorPosition) {
final Combo combo = (Combo) control;
final Point selection = combo.getSelection();
combo.setText(text);
selection.x = text.length();
selection.y = selection.x;
combo.setSelection(selection);
}
}, getContainerNameContentProposalProvider(containerSelectionCombo), null, null);
// error message
final Composite errorContainer = new Composite(container, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(COLUMNS, 1).grab(true, true).applyTo(errorContainer);
GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(errorContainer);
final Label errorMessageIcon = new Label(errorContainer, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).hint(20, SWT.DEFAULT).applyTo(errorMessageIcon);
final Label errorMessageLabel = new Label(errorContainer, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(errorMessageLabel);
setupValidationSupport(errorMessageIcon, errorMessageLabel);
return container;
}
use of org.eclipse.jface.fieldassist.ControlDecoration in project linuxtools by eclipse.
the class ImageRunSelectionPage method createImageSettingsSection.
/**
* Creates the {@link Composite} container that will display widgets to
* select an {@link IDockerImage}, name it and specify the command to run.
*
* @param container
* the parent {@link Composite}
*/
private void createImageSettingsSection(final Composite container) {
// Image selection name
final Label imageSelectionLabel = new Label(container, SWT.NONE);
imageSelectionLabel.setText(// $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.imageName"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(imageSelectionLabel);
final Combo imageSelectionCombo = new Combo(container, SWT.BORDER);
final ComboViewer imageSelectionComboViewer = new ComboViewer(imageSelectionCombo);
imageSelectionCombo.setToolTipText(WizardMessages.getString(// $NON-NLS-1$
"ImageRunSelectionPage.selectTooltip"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(imageSelectionCombo);
new ControlDecoration(imageSelectionCombo, SWT.TOP | SWT.LEFT);
new ContentProposalAdapter(imageSelectionCombo, new ComboContentAdapter() {
@Override
public void insertControlContents(Control control, String text, int cursorPosition) {
final Combo combo = (Combo) control;
final Point selection = combo.getSelection();
combo.setText(text);
selection.x = text.length();
selection.y = selection.x;
combo.setSelection(selection);
}
}, getImageNameContentProposalProvider(imageSelectionCombo), null, null);
// image search
final Button searchImageButton = new Button(container, SWT.NONE);
searchImageButton.setText(// $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.search"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).span(1, 1).applyTo(searchImageButton);
searchImageButton.addSelectionListener(onSearchImage());
// link to pull image
final Label fillerLabel = new Label(container, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).span(1, 1).applyTo(fillerLabel);
pullImageLink = new Link(container, SWT.NONE);
pullImageLink.setText(// $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.pullImage"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(COLUMNS - 1, 1).applyTo(pullImageLink);
pullImageLink.addSelectionListener(onPullImage());
dbc.bindValue(WidgetProperties.enabled().observe(pullImageLink), BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.SELECTED_IMAGE_NEEDS_PULLING).observe(model));
// bind combo with model (for values and selection)
imageSelectionComboViewer.setContentProvider(new ObservableListContentProvider());
dbc.bindList(WidgetProperties.items().observe(imageSelectionCombo), BeanProperties.list(ImageRunSelectionModel.class, ImageRunSelectionModel.IMAGE_NAMES).observe(model));
dbc.bindValue(WidgetProperties.selection().observe(imageSelectionCombo), BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.SELECTED_IMAGE_NAME).observe(model));
// Container name (optional)
final Label containerNameLabel = new Label(container, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(imageSelectionLabel);
containerNameLabel.setText(WizardMessages.getString(// $NON-NLS-1$
"ImageRunSelectionPage.containerName"));
final Text containerNameText = new Text(container, SWT.BORDER);
containerNameText.setToolTipText(WizardMessages.getString(// $NON-NLS-1$
"ImageRunSelectionPage.containerTooltip"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(containerNameText);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).span(1, 1).applyTo(new Label(container, SWT.NONE));
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(containerNameText), BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.CONTAINER_NAME).observe(model));
// EntryPoint (optional)
final Label entrypointLabel = new Label(container, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(imageSelectionLabel);
entrypointLabel.setText(// $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.entrypoint"));
// TODO: include SWT.SEARCH | SWT.ICON_SEARCH to support value reset
final Text entrypointText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(entrypointText);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).span(1, 1).applyTo(new Label(container, SWT.NONE));
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(entrypointText), BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.ENTRYPOINT).observe(model));
// Command (optional)
final Label commandLabel = new Label(container, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(imageSelectionLabel);
commandLabel.setText(// $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.command"));
final Text commandText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(commandText);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).span(1, 1).applyTo(new Label(container, SWT.NONE));
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(commandText), BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.COMMAND).observe(model));
}
use of org.eclipse.jface.fieldassist.ControlDecoration in project bndtools by bndtools.
the class JpmDependencyWizardPage method createHelpLabel.
private Control createHelpLabel(Composite container, String text) {
Label label = new Label(container, SWT.WRAP);
label.setText(text);
ControlDecoration decoration = new ControlDecoration(label, SWT.LEFT, container);
Image imgInfo = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
decoration.setImage(imgInfo);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
gd.horizontalIndent = imgInfo.getBounds().width;
gd.widthHint = 100;
label.setLayoutData(gd);
return label;
}
use of org.eclipse.jface.fieldassist.ControlDecoration in project mechanoid by robotoworks.
the class NewMechanoidElementPage method createFieldInfoLabel.
private void createFieldInfoLabel(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout(1, true));
comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
mFieldInfoLabel = new Label(comp, SWT.WRAP);
GridData labelLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
labelLayoutData.horizontalIndent = 24;
mFieldInfoLabel.setLayoutData(labelLayoutData);
final ControlDecoration deco = new ControlDecoration(mFieldInfoLabel, SWT.LEFT | SWT.TOP);
Image decoImage = MechanoidUiPlugin.getPlugin().getImageRegistry().get(MechanoidPluginImages.IMG_INFO_LABEL);
//Image decoImage = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR_QUICKFIX).getImage();
deco.setMarginWidth(8);
deco.setImage(decoImage);
}
Aggregations