org.eclipse.jface.fieldassist.FieldDecorationRegistry Java Examples
The following examples show how to use
org.eclipse.jface.fieldassist.FieldDecorationRegistry.
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: ContactTypeDecorator.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override public void decorate(Object element, IDecoration decoration){ IContact contact = (IContact) element; if (contact.isDeleted()) { ImageDescriptor deleted = Images.IMG_DELETE.getImageDescriptor(); decoration.addOverlay(deleted, IDecoration.TOP_LEFT); } if (contact.isMandator()) { ImageDescriptor vip = Images.IMG_VIP_OVERLAY.getImageDescriptor(); decoration.addOverlay(vip, IDecoration.BOTTOM_RIGHT); } if (contact.isUser()) { FieldDecoration info = FieldDecorationRegistry.getDefault().getFieldDecoration( FieldDecorationRegistry.DEC_INFORMATION); ImageDescriptor infoD = ImageDescriptor.createFromImage(info.getImage()); decoration.addOverlay(infoD, IDecoration.BOTTOM_LEFT); } }
Example #2
Source File: ServerPortExtension.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@Override public void createControl(UI_POSITION position, Composite parent) { // We add controls only to the BOTTOM position. if (position == UI_POSITION.BOTTOM) { portLabel = new Label(parent, SWT.NONE); portLabel.setVisible(false); portLabel.setText(Messages.getString("NEW_SERVER_DIALOG_PORT")); portText = new Text(parent, SWT.SINGLE | SWT.BORDER); portText.setVisible(false); portText.setText(String.valueOf(LocalAppEngineServerBehaviour.DEFAULT_SERVER_PORT)); portText.addVerifyListener(new PortChangeMonitor()); portText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); Image errorImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage(); portDecoration = new ControlDecoration(portText, SWT.LEFT | SWT.TOP); portDecoration.setDescriptionText(Messages.getString("NEW_SERVER_DIALOG_INVALID_PORT_VALUE")); portDecoration.setImage(errorImage); portDecoration.hide(); } }
Example #3
Source File: ExtractClassWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void createClassNameInput(Composite result) { Label label= new Label(result, SWT.LEAD); label.setText(RefactoringMessages.ExtractClassWizard_label_class_name); final Text text= new Text(result, SWT.SINGLE | SWT.BORDER); fClassNameDecoration= new ControlDecoration(text, SWT.TOP | SWT.LEAD); text.setText(fDescriptor.getClassName()); text.selectAll(); text.setFocus(); text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { fDescriptor.setClassName(text.getText()); validateRefactoring(); } }); GridData gridData= new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalIndent= FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); text.setLayoutData(gridData); }
Example #4
Source File: ExtractClassWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected void updateDecoration(ControlDecoration decoration, RefactoringStatus status) { RefactoringStatusEntry highestSeverity= status.getEntryWithHighestSeverity(); if (highestSeverity != null) { Image newImage= null; FieldDecorationRegistry registry= FieldDecorationRegistry.getDefault(); switch (highestSeverity.getSeverity()) { case RefactoringStatus.INFO: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage(); break; case RefactoringStatus.WARNING: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); break; case RefactoringStatus.FATAL: case RefactoringStatus.ERROR: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage(); } decoration.setDescriptionText(highestSeverity.getMessage()); decoration.setImage(newImage); decoration.show(); } else { decoration.setDescriptionText(null); decoration.hide(); } }
Example #5
Source File: ExtractClassWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void createParameterNameInput(Composite group) { Label l= new Label(group, SWT.NONE); l.setText(RefactoringMessages.ExtractClassWizard_field_name); final Text text= new Text(group, SWT.BORDER); fParameterNameDecoration= new ControlDecoration(text, SWT.TOP | SWT.LEAD); text.setText(fDescriptor.getFieldName()); text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { fDescriptor.setFieldName(text.getText()); validateRefactoring(); } }); GridData gridData= new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalIndent= FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); text.setLayoutData(gridData); }
Example #6
Source File: WrappingValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @param controlDecoration * @param validator */ public WrappingValidator(ControlDecoration controlDecoration, IValidator validator, boolean onlyChangeDecoration, boolean updateMessage) { this.controlDecoration = controlDecoration; this.validator = validator; this.onlyChangeDecoration = onlyChangeDecoration; this.updateMessage = updateMessage; FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR); error = fieldDecoration.getImage(); fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING); warn = fieldDecoration.getImage(); fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION); info = fieldDecoration.getImage(); }
Example #7
Source File: FieldAssistHelper.java From birt with Eclipse Public License 1.0 | 6 votes |
private FieldDecoration getCueDecoration( ) { // We use our own decoration which is based on the JFace version. FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault( ); FieldDecoration dec = registry.getFieldDecoration( DEC_CONTENTASSIST_ID ); if ( dec == null ) { // Get the standard one. We use its image and our own customized // text. FieldDecoration standardDecoration = registry.getFieldDecoration( FieldDecorationRegistry.DEC_CONTENT_PROPOSAL ); registry.registerFieldDecoration( DEC_CONTENTASSIST_ID, Messages.getFormattedString( "ssDecoratorContentAssist", //$NON-NLS-1$ getTriggerKeyText( ) ), standardDecoration.getImage( ) ); dec = registry.getFieldDecoration( DEC_CONTENTASSIST_ID ); } else { dec.setDescription( Messages.getFormattedString( "ssDecoratorContentAssist", //$NON-NLS-1$ getTriggerKeyText( ) ) ); } return dec; }
Example #8
Source File: MedicationComposite.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void initControlDecoration(){ ctrlDecor = new ControlDecoration(btnConfirm, SWT.TOP); ctrlDecor.setDescriptionText(Messages.MedicationComposite_decorConfirm); Image imgWarn = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); ctrlDecor.setImage(imgWarn); }
Example #9
Source File: Texterstellung.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void updateExternPathDeco(String path){ path = BriefExternUtil.getAsExternFilePath(path); if (BriefExternUtil.isValidExternPath(path, false)) { externPathDeco.hide(); allExtern.setEnabled(true); } else { externPathDeco.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage()); externPathDeco.setDescriptionText(getPathDiagnoseString(path)); externPathDeco.show(); allExtern.setEnabled(false); } }
Example #10
Source File: HierarchyWizardPageRedaction.java From arx with Apache License 2.0 | 5 votes |
/** * Decorates a text field for domain properties. * * @param text */ private void decorate(final Text text) { final ControlDecoration decoration = new ControlDecoration(text, SWT.RIGHT); text.addModifyListener(new ModifyListener(){ @Override public void modifyText(ModifyEvent arg0) { if (!isValidNumber(text.getText())) { decoration.setDescriptionText(Resources.getMessage("HierarchyWizardPageRedaction.23")); //$NON-NLS-1$ Image image = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR) .getImage(); decoration.setImage(image); decoration.show(); } else { decoration.hide(); if (text == textAlphabetSize) { model.setAlphabetSize(text.getText().length() == 0 ? null : Integer.valueOf(text.getText())); } else if (text == textDomainSize) { model.setDomainSize(text.getText().length() == 0 ? null : Integer.valueOf(text.getText())); } else if (text == textMaximalLength) { model.setMaxValueLength(text.getText().length() == 0 ? null : Integer.valueOf(text.getText())); } } setPageComplete(isPageComplete()); } }); }
Example #11
Source File: FieldDecoratorProviderTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void should_createControlDecorator_attach_a_ControlDecorator_to_a_Control() throws Exception { final ControlDecoration decorator = fieldDecoratorProvider.createControlDecorator(realmWithDisplay.createComposite(), "a description", FieldDecorationRegistry.DEC_CONTENT_PROPOSAL, SWT.RIGHT); assertThat(decorator.getDescriptionText()).isEqualTo("a description"); assertThat(decorator.getImage()).isNotNull(); }
Example #12
Source File: FieldDecoratorProvider.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected FieldDecoration getDecorator(final String fieldDecorationType) { final FieldDecoration decorator = FieldDecorationRegistry.getDefault().getFieldDecoration(fieldDecorationType); if(decorator == null){ throw new IllegalArgumentException("Unknown fieldDecorationType: " + fieldDecorationType); } return decorator; }
Example #13
Source File: TransitionOrderingPropertySection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createExplanationLabel(final Composite mainComposite) { final Label explanationLabel = getWidgetFactory().createLabel(mainComposite, Messages.transitionOrderingExplanation_Short,SWT.WRAP); explanationLabel.setLayoutData(GridDataFactory.swtDefaults().grab(false, false).span(2, 1).create()); final ControlDecoration cd = new ControlDecoration(explanationLabel, SWT.RIGHT); final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION); cd.setImage(fieldDecoration.getImage()); cd.setDescriptionText(Messages.transitionOrderingExplanation); }
Example #14
Source File: ErrorEventSectionContribution.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void createControl(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory, ExtensibleGridPropertySection extensibleGridPropertySection) { codeCombo = new Combo(composite, SWT.NONE); codeCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); controlDecoration = new ControlDecoration(codeCombo, SWT.RIGHT | SWT.TOP); FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR); controlDecoration.setImage(fieldDecoration.getImage()); controlDecoration.setDescriptionText(Messages.mustBeSet); controlDecoration.hide(); hint = new ControlDecoration(composite.getChildren()[0], SWT.RIGHT); hint.setImage(Pics.getImage(PicsConstants.hint)); }
Example #15
Source File: SignalEventEventSelectionContribution.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void createControl(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory, ExtensibleGridPropertySection extensibleGridPropertySection) { combo = new Combo(composite, SWT.NONE); combo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); controlDecoration = new ControlDecoration(combo, SWT.RIGHT | SWT.TOP); FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR); controlDecoration.setImage(fieldDecoration.getImage()); controlDecoration.setDescriptionText(Messages.mustBeSet); controlDecoration.hide(); hint = new ControlDecoration(combo, SWT.LEFT | SWT.TOP); hint.setImage(Pics.getImage(PicsConstants.hint)); }
Example #16
Source File: ExtractClassWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void createLocationInput(Composite parent) { Label l= new Label(parent, SWT.NONE); l.setText(RefactoringMessages.ExtractClassWizard_label_destination); Composite composite= new Composite(parent, SWT.None); GridLayout gridLayout= new GridLayout(2, false); gridLayout.marginHeight= 0; gridLayout.marginWidth= 0; composite.setLayout(gridLayout); GridData gridData= new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalIndent= FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); composite.setLayoutData(gridData); final Button topLvlRadio= new Button(composite, SWT.RADIO); topLvlRadio.setText(RefactoringMessages.ExtractClassWizard_radio_top_level); topLvlRadio.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean fAsTopLevel= topLvlRadio.getSelection(); fDescriptor.setCreateTopLevel(fAsTopLevel); validateRefactoring(); } }); Button nestedRadio= new Button(composite, SWT.RADIO); nestedRadio.setText(Messages.format(RefactoringMessages.ExtractClassWizard_radio_nested, JavaElementLabels.getElementLabel(fDescriptor.getType(), JavaElementLabels.ALL_DEFAULT))); boolean createAsTopLevel= getBooleanSetting(CREATE_TOP_LEVEL_SETTING, fDescriptor.isCreateTopLevel()); fDescriptor.setCreateTopLevel(createAsTopLevel); topLvlRadio.setSelection(createAsTopLevel); nestedRadio.setSelection(!createAsTopLevel); }
Example #17
Source File: ParameterComposite.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public ParameterComposite(Composite parent, int style, AbstractTemplate template, IParameterPage parameterPage) { super(parent, style); this.template = template; this.parameterPage = parameterPage; setLayout(new GridLayout(2, false)); for (TemplateVariable variable : template.getVariables()) { Composite varParent = variable.getContainer() == null ? this : variable.getContainer().getWidget(); if (variable.isLabeled()) { Label label = new Label(varParent, SWT.NONE); label.setText(variable.getLabel()); label.setToolTipText(variable.getDescription()); label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); variable.createWidget(this, varParent); variable.getWidget().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); } else { variable.createWidget(this, varParent); variable.getWidget().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); } if (variable.getDescription() != null) { ControlDecoration decorator = new ControlDecoration(variable.getWidget(), SWT.RIGHT | SWT.TOP, varParent); decorator.setDescriptionText(variable.getDescription()); decorator.setImage( FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage()); } } update(); }
Example #18
Source File: AdvancedNewProjectPage.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected ControlDecoration InfoDecoration(Control control, String text) { FieldDecoration infoField = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION); ControlDecoration controlDecoration = new ControlDecoration(control, (SWT.TOP + SWT.RIGHT)); controlDecoration.setImage(infoField.getImage()); controlDecoration.setDescriptionText(text); controlDecoration.setShowHover(true); return controlDecoration; }
Example #19
Source File: GcpLocalRunTab.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
private void showServiceKeyDecorationMessage(String message, boolean isError) { FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); FieldDecoration fieldDecoration = registry.getFieldDecoration( isError ? FieldDecorationRegistry.DEC_ERROR : FieldDecorationRegistry.DEC_INFORMATION); serviceKeyDecoration.show(); serviceKeyDecoration.setImage(fieldDecoration.getImage()); serviceKeyDecoration.setDescriptionText(message); serviceKeyDecoration.showHoverText(message); }
Example #20
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 #21
Source File: RouteResourceController.java From tesb-studio-se with Apache License 2.0 | 4 votes |
@Override public Control createControl(final Composite subComposite, final IElementParameter param, final int numInRow, final int nbInRow, final int top, final Control lastControl) { this.curParameter = param; this.paramFieldType = param.getFieldType(); FormData data; final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER | SWT.READ_ONLY, new SelectAllTextControlCreator()); if (param.isRequired()) { FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration( FieldDecorationRegistry.DEC_REQUIRED); dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.TOP, false); } Control cLayout = dField.getLayoutControl(); labelText = (Text) dField.getControl(); labelText.setData(PARAMETER_NAME, param.getName()); cLayout.setBackground(subComposite.getBackground()); labelText.setEditable(false); if (elem instanceof Node) { labelText.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName()); } addDragAndDropTarget(labelText); CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName()); data = new FormData(); if (lastControl != null) { data.left = new FormAttachment(lastControl, 0); } else { data.left = new FormAttachment(((numInRow - 1) * MAX_PERCENT) / (nbInRow + 1), 0); } data.top = new FormAttachment(0, top); labelLabel.setLayoutData(data); if (numInRow != 1) { labelLabel.setAlignment(SWT.RIGHT); } data = new FormData(); int currentLabelWidth = STANDARD_LABEL_WIDTH; GC gc = new GC(labelLabel); Point labelSize = gc.stringExtent(param.getDisplayName()); gc.dispose(); if ((labelSize.x + ITabbedPropertyConstants.HSPACE) > currentLabelWidth) { currentLabelWidth = labelSize.x + ITabbedPropertyConstants.HSPACE; } if (numInRow == 1) { if (lastControl != null) { data.left = new FormAttachment(lastControl, currentLabelWidth); } else { data.left = new FormAttachment(0, currentLabelWidth); } } else { data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT); } data.right = new FormAttachment((numInRow * MAX_PERCENT) / (nbInRow + 1), 0); data.top = new FormAttachment(0, top); cLayout.setLayoutData(data); Button btn; Point btnSize; btn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$ btnSize = btn.computeSize(SWT.DEFAULT, SWT.DEFAULT); btn.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON))); btn.addSelectionListener(listenerSelection); btn.setData(PARAMETER_NAME, param.getName()); btn.setEnabled(!param.isReadOnly()); data = new FormData(); data.left = new FormAttachment(cLayout, 0); data.right = new FormAttachment(cLayout, STANDARD_BUTTON_WIDTH, SWT.RIGHT); data.top = new FormAttachment(0, top); data.height = STANDARD_HEIGHT - 2; btn.setLayoutData(data); hashCurControls.put(param.getName(), labelText); Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT); Control lastControlUsed = btn; lastControlUsed = addVersionCombo(subComposite, param.getChildParameters().get(EParameterName.ROUTE_RESOURCE_TYPE_VERSION.getName()), lastControlUsed, numInRow + 1, nbInRow, top); dynamicProperty.setCurRowSize(Math.max(initialSize.y, btnSize.y) + ITabbedPropertyConstants.VSPACE); return btn; }
Example #22
Source File: GeneralSectionBuilder.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * @wbp.parser.entryPoint */ @Override public void buildUI() { Section generalSection = formToolkit.createSection(composite, Section.TWISTIE | Section.TITLE_BAR); GridData gd_generalSection = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gd_generalSection.heightHint = 240; generalSection.setLayoutData(gd_generalSection); formToolkit.paintBordersFor(generalSection); generalSection.setText(Messages.BASICATTRIBUTE); generalSection.setExpanded(true); Composite generalComposite = new Composite(generalSection, SWT.NONE); formToolkit.adapt(generalComposite); formToolkit.paintBordersFor(generalComposite); generalSection.setClient(generalComposite); generalComposite.setLayout(new GridLayout(4, false)); FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR); String decorationDescription = Messages.NULLERROR; Image decorationImage = fieldDecoration.getImage(); Label appNameLabel = formToolkit.createLabel(generalComposite, Messages.APPNAME, SWT.NONE); appNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); appNameText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE); appNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); appNameDecoration = createTextErrorDecoration(appNameText, decorationDescription, decorationImage); Label lblNewLabel_1 = formToolkit.createLabel(generalComposite, Messages.AUTHERNAME, SWT.NONE); lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); authorNameText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE); authorNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); authorNameDecoration = createTextErrorDecoration(authorNameText, decorationDescription, decorationImage); Label lblNewLabel_2 = formToolkit.createLabel(generalComposite,Messages.AUTHEREMAIL, SWT.NONE); lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); authorEmailText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE); authorEmailText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); authorEmailDecoration = createTextErrorDecoration(authorEmailText, decorationDescription, decorationImage); Label lblNewLabel_3 = formToolkit.createLabel(generalComposite,Messages.AUTHORIZEDCONNECTION, SWT.NONE); lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); authorHrefText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE); authorHrefText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); authorHrefDecoration = createTextErrorDecoration(authorHrefText, decorationDescription, decorationImage); Label lblNewLabel_4 = formToolkit.createLabel(generalComposite,Messages.STARTPAGE, SWT.NONE); lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1)); ContentSrcText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE); ContentSrcText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); ContentSrcDecoration = createTextErrorDecoration(ContentSrcText, decorationDescription, decorationImage); Label lblNewLabel_6 = new Label(generalComposite, SWT.NONE); lblNewLabel_6.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); formToolkit.adapt(lblNewLabel_6, true, true); lblNewLabel_6.setText("\u63CF\u8FF0"); descriptionText = new Text(generalComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI); GridData gd_descriptionText = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_descriptionText.heightHint = 49; descriptionText.setLayoutData(gd_descriptionText); formToolkit.adapt(descriptionText, true, true); }
Example #23
Source File: NodeAttachDebugTab.java From wildwebdeveloper with Eclipse Public License 2.0 | 4 votes |
@Override public void createControl(Composite parent) { super.createControl(parent); Composite composite = (Composite)getControl(); Composite rootMapComposite = new Composite(composite, SWT.NONE); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).span(((GridLayout)composite.getLayout()).numColumns, 1).grab(true, false).indent(0, 40).applyTo(rootMapComposite); rootMapComposite.setLayout(new GridLayout(3, false)); Label rootMapDescription = new Label(rootMapComposite, SWT.NONE); rootMapDescription.setText(Messages.NodeAttach_rootMapDescription); rootMapDescription.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 3, 1)); GridDataFactory indentFactory = GridDataFactory.swtDefaults().indent(20, 0); Label remoteRootLabel = new Label(rootMapComposite, SWT.NONE); remoteRootLabel.setText(Messages.NodeAttach_remoteRoot); indentFactory.applyTo(remoteRootLabel); remoteRootText = new Text(rootMapComposite, SWT.BORDER); remoteRootText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1)); remoteRootText.addModifyListener(e -> { setDirty(true); updateLaunchConfigurationDialog(); }); Label localRootLabel = new Label(rootMapComposite, SWT.NONE); localRootLabel.setText(Messages.NodeAttach_localRoot); indentFactory.applyTo(localRootLabel); localRootText = new Text(rootMapComposite, SWT.BORDER); localRootText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); Button browseLocalButton = new Button(rootMapComposite, SWT.PUSH); browseLocalButton.setText(Messages.AbstractRunHTMLDebugTab_browse); browseLocalButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { DirectoryDialog directoryDialog = new DirectoryDialog(browseLocalButton.getShell()); directoryDialog.setText(Messages.NodeAttach_localRoot); String selectedDirString = directoryDialog.open(); if (selectedDirString != null) { localRootText.setText(selectedDirString); } })); ControlDecoration invalidDirectoryDecoration = new ControlDecoration(localRootText, SWT.TOP | SWT.LEFT); invalidDirectoryDecoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage()); invalidDirectoryDecoration.setDescriptionText(Messages.NodeAttach_invalidLocalRootDirectory); invalidDirectoryDecoration.hide(); localRootText.addModifyListener(e -> { if (!localRootText.getText().isEmpty() && !new File(localRootText.getText()).isDirectory()) { invalidDirectoryDecoration.show(); setWarningMessage(Messages.NodeAttach_invalidLocalRootDirectory); } else { invalidDirectoryDecoration.hide(); setWarningMessage(null); } setDirty(true); updateLaunchConfigurationDialog(); }); }