Java Code Examples for org.eclipse.jface.fieldassist.ControlDecoration#setMarginWidth()
The following examples show how to use
org.eclipse.jface.fieldassist.ControlDecoration#setMarginWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StyledTextXtextAdapter.java From statecharts with Eclipse Public License 1.0 | 6 votes |
private ControlDecoration createContentAssistDecoration(StyledText styledText) { final ControlDecoration result = new ControlDecoration(styledText, SWT.TOP | SWT.LEFT); result.setShowHover(true); result.setShowOnlyOnFocus(true); final Image image = ImageDescriptor .createFromFile(XtextStyledTextCellEditor.class, "images/content_assist_cue.gif").createImage(); result.setImage(image); result.setDescriptionText("Content Assist Available (CTRL + Space)"); result.setMarginWidth(2); styledText.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { if (getDecoration() != null) { getDecoration().dispose(); } if (image != null) { image.dispose(); } } }); return result; }
Example 2
Source File: PageComponentSwitchBuilder.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createDescriptionDecorator(final Composite composite, final Label labelField, final String desc) { final ControlDecoration descriptionDecoration = new ControlDecoration(labelField, SWT.RIGHT, composite); descriptionDecoration.setMarginWidth(0); descriptionDecoration .setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK)); descriptionDecoration.setDescriptionText(desc); descriptionDecoration.setShowOnlyOnFocus(false); descriptionDecoration.setShowHover(true); descriptionDecoration.show(); }
Example 3
Source File: PatternExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createTextViewer() { viewer = createViewer(mc); viewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); configureTextViewer(); addLineStyleListener(); helpDecoration = new ControlDecoration(viewer.getControl(), SWT.TOP | SWT.RIGHT, this); helpDecoration.setImage(JFaceResources.getImage(Dialog.DLG_IMG_HELP)); helpDecoration.setDescriptionText(Messages.patternViewerHint); helpDecoration.setMarginWidth(2); helpDecoration.hide(); hintDecoration = new ControlDecoration(viewer.getControl(), SWT.TOP | SWT.LEFT, this); hintDecoration.setImage(Pics.getImage(PicsConstants.hint)); hintDecoration.setMarginWidth(2); hintDecoration.setShowHover(true); hintDecoration.setShowOnlyOnFocus(true); hintDecoration.hide(); viewer.addTextListener(new ITextListener() { @Override public void textChanged(final TextEvent event) { viewer.getTextWidget().notifyListeners(SWT.Modify, new Event()); } }); helpDecoration.show(); }
Example 4
Source File: SelectDataWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createActionModeSelectionRadioButtons(DataBindingContext dbc, Composite parent) { Label actionLabel = new Label(parent, SWT.NONE); actionLabel.setLayoutData(GridDataFactory.fillDefaults().create()); actionLabel.setText(Messages.action); actionLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); Composite buttonComposite = new Composite(parent, SWT.NONE); buttonComposite.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); buttonComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).spacing(20, 0).create()); Button createButton = new Button(buttonComposite, SWT.RADIO); createButton.setText(Messages.createDataFromContractChoice); ControlDecoration createModeCcontrolDecoration = new ControlDecoration(createButton, SWT.RIGHT); createModeCcontrolDecoration.setDescriptionText(Messages.createActionHint); createModeCcontrolDecoration.setImage(Pics.getImage(PicsConstants.hint)); createModeCcontrolDecoration.setShowOnlyOnFocus(false); createModeCcontrolDecoration.setMarginWidth(-5); Button editButton = new Button(buttonComposite, SWT.RADIO); editButton.setText(Messages.editDataFromContractChoice); ControlDecoration editModeCcontrolDecoration = new ControlDecoration(editButton, SWT.RIGHT); editModeCcontrolDecoration.setDescriptionText(Messages.editActionHint); editModeCcontrolDecoration.setImage(Pics.getImage(PicsConstants.hint)); editModeCcontrolDecoration.setShowOnlyOnFocus(false); editModeCcontrolDecoration.setMarginWidth(-5); SelectObservableValue creationTypeObservable = new SelectObservableValue<EditMode>(EditMode.class); creationTypeObservable.addOption(EditMode.CREATE, WidgetProperties.selection().observe(createButton)); creationTypeObservable.addOption(EditMode.EDIT, WidgetProperties.selection().observe(editButton)); editButton.setEnabled(contract.eContainer() instanceof Task); generateOptions.setEditMode(contract.eContainer() instanceof Task ? EditMode.EDIT : EditMode.CREATE); dbc.bindValue(creationTypeObservable, generateOptions.getEditModeObservable()); }
Example 5
Source File: PageComponentSwitchBuilder.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public Composite createRadioGroupControl(final Composite composite, final RadioGroup object) { final Input input = getConnectorInput(object.getInputName()); final ConnectorParameter parameter = connectorConfigurationSupport.getConnectorParameter(object.getInputName(), object, input); if (parameter != null) { Label label = null; if (object.getOrientation() == Orientation.HORIZONTAL) { label = createFieldLabel(composite, SWT.CENTER, object.getId(), input.isMandatory()); } else { label = createFieldLabel(composite, SWT.TOP, object.getId(), input.isMandatory()); } final String desc = messageProvider.getFieldDescription(definition, object.getId()); if (desc != null && !desc.isEmpty()) { final ControlDecoration controlDecoration = new ControlDecoration(label, SWT.RIGHT); controlDecoration.setDescriptionText(desc); controlDecoration.setImage(Pics.getImage(PicsConstants.hint)); controlDecoration.setMarginWidth(1); } final Composite radioCompoiste = new Composite(composite, SWT.NONE); radioCompoiste.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(16, 0).create()); if (object.getOrientation() == Orientation.HORIZONTAL) { radioCompoiste.setLayout(GridLayoutFactory.fillDefaults().numColumns(object.getChoices().size()).create()); } else { radioCompoiste.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create()); } String defaultSelection = input.getDefaultValue(); ((Expression) parameter.getExpression()).setType(ExpressionConstants.CONSTANT_TYPE); ((Expression) parameter.getExpression()).setReturnType(input.getType()); final String content = ((Expression) parameter.getExpression()).getContent(); if (defaultSelection == null) { defaultSelection = object.getChoices().get(0); } for (final String choice : object.getChoices()) { final Button radioButton = new Button(radioCompoiste, SWT.RADIO); radioButton.setText(choice); radioButton.setLayoutData(GridDataFactory.fillDefaults().create()); radioButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (radioButton.getSelection()) { ((Expression) parameter.getExpression()).setContent(choice); ((Expression) parameter.getExpression()).setName(choice); } } }); radioButton.setSelection(false); if (content == null && defaultSelection != null && defaultSelection.equals(choice)) { radioButton.setSelection(true); } else if (content != null && content.equals(choice)) { radioButton.setSelection(true); } } return radioCompoiste; } return null; }
Example 6
Source File: ExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected void createTextControl(final int style, final TabbedPropertySheetWidgetFactory widgetFactory) { if (expressionProposalLableProvider == null) { expressionProposalLableProvider = new ExpressionLabelProvider(); } contentAssistText = new ContentAssistText(control, expressionProposalLableProvider, style); textControl = contentAssistText.getTextControl(); if (widgetFactory != null) { widgetFactory.adapt(textControl, false, false); } textControl.addDisposeListener(disposeListener); textTooltip = new DefaultToolTip(textControl) { @Override protected boolean shouldCreateToolTip(final Event event) { return super.shouldCreateToolTip(event) && getText(event) != null; } }; textTooltip.setShift(new Point(5, 5)); textTooltip.setRespectMonitorBounds(true); textTooltip.setPopupDelay(100); typeDecoration = new ControlDecoration(contentAssistText.getToolbar(), SWT.LEFT, control); typeDecoration.setMarginWidth(0); messageDecoration = new ControlDecoration(contentAssistText, SWT.LEFT, control); messageDecoration.setShowHover(true); messageDecoration.setMarginWidth(1); messageDecoration.hide(); contentAssistText.addContentAssistListener(this); autoCompletion = contentAssistText.getAutocompletion(); autoCompletion.addExpressionProposalListener(this); int indent = 0; if ((style & SWT.PASSWORD) != 0) { isPassword = true; } if ((style & SWT.BORDER) != 0) { indent = 16; } contentAssistText.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).indent(indent, 0) .grab(true, false).create()); }
Example 7
Source File: QueryDetailsControl.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void createReturnTypeComposite(Composite parent) { Composite returnTypeComposite = formPage.getToolkit().createComposite(parent); returnTypeComposite.setLayout(GridLayoutFactory.fillDefaults().create()); returnTypeComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create()); Label queryResultTypeLabel = formPage.getToolkit().createLabel(returnTypeComposite, Messages.queryResultType); queryResultTypeLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).create()); returnTypeComboViewer = new ComboViewer(returnTypeComposite, SWT.BORDER | SWT.READ_ONLY); returnTypeComboViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().grab(false, false).hint(300, SWT.DEFAULT).create()); returnTypeComboViewer.setContentProvider(ArrayContentProvider.getInstance()); returnTypeComboViewer.setLabelProvider(new QueryResultTypeLabelProvider(boSelectedObservable)); updateReturnTypeViewerInput(); Label queryResultTypeInfoLabel = formPage.getToolkit().createLabel(returnTypeComposite, Messages.queryReturnTypeWarning); queryResultTypeInfoLabel .setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).indent(20, 0).create()); ControlDecoration typeinfo = new ControlDecoration(queryResultTypeInfoLabel, SWT.LEFT); typeinfo.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO)); typeinfo.setMarginWidth(5); querySelectedObservable.addValueChangeListener(e -> { if (isDefault()) { returnTypeComboViewer.getControl().setEnabled(false); } else { returnTypeComboViewer.getControl().setEnabled(true); } }); boSelectedObservable.addValueChangeListener(e -> updateReturnTypeViewerInput()); IObservableValue<String> returnTypeSelectionObservable = ViewerProperties.singleSelection(String.class) .observe(returnTypeComboViewer); IObservableValue<String> returnTypeObservable = EMFObservables.observeDetailValue(Realm.getDefault(), querySelectedObservable, BusinessDataModelPackage.Literals.QUERY__RETURN_TYPE); ctx.bindValue(returnTypeSelectionObservable, returnTypeObservable); returnTypeObservable.addValueChangeListener(e -> queryViewer.refresh()); // might impact the info tooltip for the count queries }
Example 8
Source File: IterationPropertySection.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void createInputForDataGroup(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 inputListlabel = widgetFactory.createLabel(inputGroup, Messages.inputList + " *"); inputListlabel.setLayoutData(GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).create()); final ControlDecoration inputListlabelDecoration = new ControlDecoration(inputListlabel, SWT.RIGHT); inputListlabelDecoration.setMarginWidth(-3); inputListlabelDecoration.setDescriptionText(Messages.inputListHint); inputListlabelDecoration.setImage(Pics.getImage(PicsConstants.hint)); final ComboViewer inputListComboViewer = createComboViewer(widgetFactory, inputGroup, new ObservableListContentProviderWithProposalListenersForPool()); inputListComboViewer.getControl().setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).indent(5, 0).create()); inputListComboViewer.addFilter(new ListDataFilter()); inputListComboViewer.setSorter(new DataViewerSorter()); final IViewerObservableValue observeSingleSelection = ViewersObservables .observeSingleSelection(inputListComboViewer); final IObservableValue selectionObservable = ViewersObservables.observeSingleSelection(selectionProvider); final IObservableValue observeInputCollectionValue = CustomEMFEditObservables.observeDetailValue( Realm.getDefault(), selectionObservable, ProcessPackage.Literals.MULTI_INSTANTIABLE__COLLECTION_DATA_TO_MULTI_INSTANTIATE); selectionObservable.addValueChangeListener(createInputValueChanged(inputListComboViewer, observeSingleSelection, observeInputCollectionValue, false)); inputListComboViewer.addSelectionChangedListener(createComboSelectionListener(inputListComboViewer, false)); inputListComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { updateReturnTypeFromSelectedInputCollection(inputListComboViewer); } }); context.bindValue(observeSingleSelection, observeInputCollectionValue); final Label label = widgetFactory.createLabel(inputGroup, ""); label.setImage(Pics.getImage("icon-arrow-down.png")); label.setLayoutData(GridDataFactory.fillDefaults().span(3, 1).align(SWT.CENTER, SWT.CENTER).create()); createIteratorControl(widgetFactory, inputGroup); }
Example 9
Source File: ServerPreferencePage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * Creates the field editors. Field editors are abstractions of the common * GUI blocks needed to manipulate various types of preferences. Each field * editor knows how to save and restore itself. */ @Override public void createFieldEditors() { createTitleBar(Messages.BonitaPreferenceDialog_UserXP_Settings, Pics.getImage(PicsConstants.preferenceLogin), false); BooleanFieldEditor lazyEditor = new BooleanFieldEditor(EnginePreferenceConstants.LAZYLOAD_ENGINE, Messages.engineLazyLoad, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent()); addField(lazyEditor); debugCustomPage = new BooleanFieldEditor(BonitaPreferenceConstants.CUSTOM_PAGE_DEBUG, Messages.debugCustomPageMode, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent()); addField(debugCustomPage); Control descriptionControl = debugCustomPage.getDescriptionControl(getFieldEditorParent()); ControlDecoration debugHintControlDecorator = new ControlDecoration(descriptionControl, SWT.RIGHT); debugHintControlDecorator.setDescriptionText(Messages.debugCustomPageModeHint); debugHintControlDecorator.setMarginWidth(3); debugHintControlDecorator.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage()); createPreferenceEditorContributions(ACM_CONTRIBUTOR_ID); getContributedEditors().put(lazyEditor, EnginePlugin.getDefault().getPreferenceStore()); port = new IntegerFieldEditor(BonitaPreferenceConstants.CONSOLE_PORT, Messages.consolePreferencePortLabel, getFieldEditorParent()); port.setValidRange(PortConfigurator.MIN_PORT_NUMBER, PortConfigurator.MAX_PORT_NUMBER); addField(port); xmxOption = new IntegerFieldEditor(EnginePreferenceConstants.TOMCAT_XMX_OPTION, Messages.tomcatXmxOption, getFieldEditorParent()); addField(xmxOption); getContributedEditors().put(xmxOption, EnginePlugin.getDefault().getPreferenceStore()); extraParamsField = new StringFieldEditor(EnginePreferenceConstants.TOMCAT_EXTRA_PARAMS, Messages.tomcatExtraParams, getFieldEditorParent()); addField(extraParamsField); getContributedEditors().put(extraParamsField, EnginePlugin.getDefault().getPreferenceStore()); uidExtraParamsField = new StringFieldEditor(BonitaPreferenceConstants.UID_JVM_OPTS, Messages.uidExtraParams, getFieldEditorParent()); addField(uidExtraParamsField); }
Example 10
Source File: FieldAssistHelper.java From birt with Eclipse Public License 1.0 | 3 votes |
/** * Create a ControlDecoration for decorating specified control. Render the * decoration only on the specified Composite or its children. * * @param control * the control to be decorated. * @param composite * The SWT composite within which the decoration should be * rendered. The decoration will be clipped to this composite, * but it may be rendered on a child of the composite. The * decoration will not be visible if the specified composite or * its child composites are not visible in the space relative to * the control, where the decoration is to be rendered. If this * value is null, then the decoration will be rendered on * whichever composite (or composites) are located in the * specified position. * @return instance of <code>ControlDecoration</code> */ public ControlDecoration createControlDecoration( Control control, Composite composite ) { ControlDecoration cd = new ControlDecoration( control, getDecorationLocationBits( ), composite ); cd.setMarginWidth( getMarginWidth( ) ); return cd; }