Java Code Examples for org.eclipse.swt.widgets.Text#setData()
The following examples show how to use
org.eclipse.swt.widgets.Text#setData() .
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: HadoopLocationWizard.java From hadoop-gpu with Apache License 2.0 | 6 votes |
/** * Create an editor entry for the given configuration name * * @param listener the listener to trigger on property change * @param parent the SWT parent container * @param propName the name of the property to create an editor for * @param labelText a label (null will defaults to the property name) * * @return a SWT Text field */ private Text createConfNameEditor(ModifyListener listener, Composite parent, String propName, String labelText) { { ConfProp prop = ConfProp.getByName(propName); if (prop != null) return createConfLabelText(listener, parent, prop, labelText); } Label label = new Label(parent, SWT.NONE); if (labelText == null) labelText = propName; label.setText(labelText); Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(data); text.setData("hPropName", propName); text.setText(location.getConfProp(propName)); text.addModifyListener(listener); return text; }
Example 2
Source File: OptionsConfigurationBlock.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected Text addTextField(Composite parent, String label, String key, int indent, int widthHint) { Label labelControl = new Label(parent, SWT.WRAP); labelControl.setText(label); labelControl.setFont(JFaceResources.getDialogFont()); GridData labelLayoutData = new GridData(); labelLayoutData.horizontalIndent = indent; labelControl.setLayoutData(labelLayoutData); Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE); textBox.setData(key); makeScrollableCompositeAware(textBox); labels.put(textBox, labelControl); updateText(textBox); textBox.addModifyListener(getTextModifyListener()); GridData textLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); if (widthHint != 0) { textLayoutData.widthHint = widthHint; } textBox.setLayoutData(textLayoutData); textBoxes.add(textBox); return textBox; }
Example 3
Source File: HadoopLocationWizard.java From RDFS with Apache License 2.0 | 6 votes |
/** * Create an editor entry for the given configuration name * * @param listener the listener to trigger on property change * @param parent the SWT parent container * @param propName the name of the property to create an editor for * @param labelText a label (null will defaults to the property name) * * @return a SWT Text field */ private Text createConfNameEditor(ModifyListener listener, Composite parent, String propName, String labelText) { { ConfProp prop = ConfProp.getByName(propName); if (prop != null) return createConfLabelText(listener, parent, prop, labelText); } Label label = new Label(parent, SWT.NONE); if (labelText == null) labelText = propName; label.setText(labelText); Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(data); text.setData("hPropName", propName); text.setText(location.getConfProp(propName)); text.addModifyListener(listener); return text; }
Example 4
Source File: PropertyBindingPage.java From birt with Eclipse Public License 1.0 | 6 votes |
private void createExpressionButton( Composite composite, final Text property, String propName, boolean isEncryptable ) { ExpressionButton exprButton = ExpressionButtonUtil.createExpressionButton( composite, property, new ExpressionProvider( handle ), handle, SWT.PUSH ); if ( isEncryptable ) { exprButton.setExpressionButtonProvider( new ExprButtonProvider( true, property ) ); } Expression expr = handle.getPropertyBindingExpression( propName ); property.setData( ExpressionButtonUtil.EXPR_TYPE, expr == null || expr.getType( ) == null ? UIUtil.getDefaultScriptType( ) : (String) expr.getType( ) ); property.setText( ( expr == null || expr.getStringExpression( ) == null ) ? "" : expr.getStringExpression( ) ); exprButton.refresh( ); }
Example 5
Source File: EigenLeistungDialog.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createDialogArea(final Composite parent){ Composite ret = new Composite(parent, SWT.NONE); ret.setData("TEST_COMP_NAME", "EigenLeistungDialog_ret"); //$NON-NLS-1$ ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); ret.setLayout(new GridLayout(2, false)); new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_shortname); //$NON-NLS-1$ tKurz = new Text(ret, SWT.BORDER); tKurz.setData("TEST_COMP_NAME", "EigenLeistungDialog_tKurz"); //$NON-NLS-1$ tKurz.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_name); //$NON-NLS-1$ tName = new Text(ret, SWT.BORDER); tName.setData("TEST_COMP_NAME", "EigenLeistungDialog_tName"); //$NON-NLS-1$ tName.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_costInCents); //$NON-NLS-1$ tEK = new Text(ret, SWT.BORDER); tEK.setData("TEST_COMP_NAME", "EigenLeistungDialog_tEK"); //$NON-NLS-1$ tEK.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_priceInCents); //$NON-NLS-1$ tVK = new Text(ret, SWT.BORDER); tVK.setData("TEST_COMP_NAME", "EigenLeistungDialog_tVK"); //$NON-NLS-1$ tVK.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_timeInMinutes); //$NON-NLS-1$ tTime = new Text(ret, SWT.BORDER); tTime.setData("TEST_COMP_NAME", "EigenLeistungDialog_tTime"); //$NON-NLS-1$ tTime.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); if (result instanceof Eigenleistung) { Eigenleistung el = (Eigenleistung) result; tName.setText(el.get(Messages.BlockDetailDisplay_title)); //$NON-NLS-1$ tKurz.setText(el.get(Messages.BlockDetailDisplay_code)); //$NON-NLS-1$ tEK.setText(el.getKosten(new TimeTool()).getCentsAsString()); tVK.setText(el.getPreis(new TimeTool(), null).getCentsAsString()); tTime.setText(el.get(Eigenleistung.TIME)); } return ret; }
Example 6
Source File: ScriptView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent){ Composite ret = (Composite) super.createDialogArea(parent); Composite cVars = new Composite(ret, SWT.NONE); cVars.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); cVars.setLayout(new GridLayout(2, false)); for (String v : myVars) { new Label(cVars, SWT.NONE).setText(v); Text text = new Text(cVars, SWT.BORDER); text.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); text.setData("varname", v); inputs.add(text); } return ret; }
Example 7
Source File: AutoCompleteTextUtil.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public static <T> void setValue(Text text, T defaultObject){ if (defaultObject instanceof ICoding) { text.setText(((ICoding) defaultObject).getDisplay()); } else if (defaultObject instanceof Identifiable) { text.setText(((Identifiable) defaultObject).getLabel()); } else if (defaultObject != null) { text.setText(String.valueOf(defaultObject)); } text.setData(PROPOSAL_RET_OBJ, defaultObject); }
Example 8
Source File: OpenNameAndVersionDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createNameAndVersion(final Composite res, final DataBindingContext dbc) { final Label nameLabel = new Label(res, SWT.NONE); nameLabel.setText(Messages.name); nameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create()); final Text nameText = new Text(res, SWT.BORDER); nameText.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, "org.bonitasoft.studio.common.diagram.dialog.name.text"); nameText.setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).indent(10, 0).create()); final ISWTObservableValue observeNameText = SWTObservables.observeText(nameText, SWT.Modify); ControlDecorationSupport.create( dbc.bindValue(observeNameText, PojoProperties.value("name").observe(identifier), nameUpdateStrategy(), null), SWT.LEFT); final Label versionLabel = new Label(res, SWT.NONE); versionLabel.setText(Messages.version); final Text versionText = new Text(res, SWT.BORDER); versionText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(10, 0).create()); final ISWTObservableValue observeVersionText = SWTObservables.observeText(versionText, SWT.Modify); ControlDecorationSupport.create(dbc.bindValue(observeVersionText, PojoProperties.value("version").observe(identifier), versionUpdateStrategy(), null), SWT.LEFT); if (isForceNameUpdate()) { final MustUpdateValidator mustUpdateValidator = new MustUpdateValidator(abstractProcess, observeNameText, observeVersionText); dbc.addValidationStatusProvider(mustUpdateValidator); ControlDecorationSupport.create(mustUpdateValidator, SWT.LEFT); } final MultiValidator multiValidator = unicityValidator(observeNameText, observeVersionText); dbc.addValidationStatusProvider(multiValidator); ControlDecorationSupport.create(multiValidator, SWT.LEFT); }
Example 9
Source File: MultipleInputDialog.java From goclipse with Eclipse Public License 1.0 | 5 votes |
protected void createTextField(String labelText, String initialValue, boolean allowEmpty) { Label label = new Label(panel, SWT.NONE); label.setText(labelText); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); final Text text = new Text(panel, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); text.setData(FIELD_NAME, labelText); // make sure rows are the same height on both panels. label.setSize(label.getSize().x, text.getSize().y); if (initialValue != null) { text.setText(initialValue); } if (!allowEmpty) { validators.add(new Validator() { @Override public boolean validate() { return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING); } }); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validateFields(); } }); } controlList.add(text); }
Example 10
Source File: HadoopLocationWizard.java From RDFS with Apache License 2.0 | 5 votes |
/** * Create a SWT Text component for the given {@link ConfProp} text * configuration property. * * @param listener * @param parent * @param prop * @return */ private Text createConfText(ModifyListener listener, Composite parent, ConfProp prop) { Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(data); text.setData("hProp", prop); text.setText(location.getConfProp(prop)); text.addModifyListener(listener); return text; }
Example 11
Source File: BindingDialogHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
protected void initTextField( Text txtParam, IParameterDefn param ) { if ( paramsValueMap.containsKey( param.getName( ) ) ) { txtParam.setText( paramsValueMap.get( param.getName( ) )[0] ); txtParam.setData( ExpressionButtonUtil.EXPR_TYPE, paramsValueMap.get( param.getName( ) )[1] ); ExpressionButton button = (ExpressionButton) txtParam.getData( ExpressionButtonUtil.EXPR_BUTTON ); if ( button != null ) button.refresh( ); return; } if ( binding != null ) { for ( Iterator iterator = binding.argumentsIterator( ); iterator.hasNext( ); ) { AggregationArgumentHandle arg = (AggregationArgumentHandle) iterator.next( ); if ( arg.getName( ).equals( param.getName( ) ) ) { ExpressionButtonUtil.initExpressionButtonControl( txtParam, arg, AggregationArgument.VALUE_MEMBER ); return; } } } }
Example 12
Source File: OptionsConfigurationBlock.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Text addLabelledTextField( Composite parent, String label, Key key, int textlimit, int indent, boolean dummy ) { PixelConverter pixelConverter = new PixelConverter( parent ); Label labelControl = new Label( parent, SWT.WRAP ); labelControl.setText( label ); labelControl.setLayoutData( new GridData( ) ); Text textBox = new Text( parent, SWT.BORDER | SWT.SINGLE ); textBox.setData( key ); textBox.setLayoutData( new GridData( ) ); fLabels.put( textBox, labelControl ); String currValue = getValue( key ); if ( currValue != null ) { textBox.setText( currValue ); } textBox.addModifyListener( getTextModifyListener( ) ); GridData data = new GridData( GridData.HORIZONTAL_ALIGN_FILL ); if ( textlimit != 0 ) { textBox.setTextLimit( textlimit ); data.widthHint = pixelConverter.convertWidthInCharsToPixels( textlimit + 1 ); } data.horizontalIndent = indent; data.horizontalSpan = 2; textBox.setLayoutData( data ); fTextBoxes.add( textBox ); return textBox; }
Example 13
Source File: OptionsConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected Text addTextField(Composite parent, String label, Key key, int indent, int widthHint) { Label labelControl= new Label(parent, SWT.WRAP); labelControl.setText(label); labelControl.setFont(JFaceResources.getDialogFont()); GridData gd= new GridData(); gd.horizontalIndent= indent; labelControl.setLayoutData(gd); Text textBox= new Text(parent, SWT.BORDER | SWT.SINGLE); textBox.setData(key); makeScrollableCompositeAware(textBox); fLabels.put(textBox, labelControl); updateText(textBox); textBox.addModifyListener(getTextModifyListener()); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL); if (widthHint != 0) { data.widthHint= widthHint; } data.horizontalSpan= 2; textBox.setLayoutData(data); fTextBoxes.add(textBox); return textBox; }
Example 14
Source File: PrinterPreferencePage.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void widgetSelected(SelectionEvent e){ PrintDialog pd = new PrintDialog(getShell()); PrinterData pdata = pd.open(); if (pdata != null) { Text tx = (Text) ((Button) e.getSource()).getData(); tx.setText(pdata.name); tx.setData(pdata); } }
Example 15
Source File: HadoopLocationWizard.java From hadoop-gpu with Apache License 2.0 | 5 votes |
/** * Create a SWT Text component for the given {@link ConfProp} text * configuration property. * * @param listener * @param parent * @param prop * @return */ private Text createConfText(ModifyListener listener, Composite parent, ConfProp prop) { Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(data); text.setData("hProp", prop); text.setText(location.getConfProp(prop)); text.addModifyListener(listener); return text; }
Example 16
Source File: ApplicationOverviewEditorPart.java From codewind-eclipse with Eclipse Public License 2.0 | 5 votes |
public StringEntry(Composite composite, String name) { label = new Label(composite, SWT.NONE); label.setFont(boldFont); label.setText(name); label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); text = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY); text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); text.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false)); IDEUtil.paintBackgroundToMatch(text, composite); }
Example 17
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 18
Source File: OpenNameAndVersionForDiagramDialog.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
void createPNVComposite(final Composite parent, final ProcessesNameVersion pnv, final DataBindingContext dbc) { final Composite pnvCompo = new Composite(parent, SWT.NONE); pnvCompo.setLayout(GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(4).create()); pnvCompo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); final Label poolNameLabel = new Label(pnvCompo, SWT.NONE); poolNameLabel.setText(Messages.name); final Text poolNameText = new Text(pnvCompo, SWT.BORDER); poolNameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).create()); poolNameText.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, "org.bonitasoft.studio.common.diagram.dialog.poolName.text"); final ISWTObservableValue observePoolNameText = SWTObservables.observeText(poolNameText, SWT.Modify); ControlDecorationSupport.create(dbc.bindValue(observePoolNameText, PojoProperties.value("newName").observe(pnv), poolUpdateStrategy(Messages.name), null), SWT.LEFT); final Label poolVersion = new Label(pnvCompo, SWT.NONE); poolVersion.setText(Messages.version); final Text poolVersionText = new Text(pnvCompo, SWT.BORDER); poolVersionText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).create()); final ISWTObservableValue observePoolVersionText = SWTObservables.observeText(poolVersionText, SWT.Modify); ControlDecorationSupport.create(dbc.bindValue(observePoolVersionText, PojoProperties.value("newVersion").observe(pnv), poolUpdateStrategy(Messages.version), null), SWT.LEFT); if (isForceNameUpdate()) { final MustUpdateValidator mustUpdateValidator = new MustUpdateValidator(pnv.getAbstractProcess(), observePoolNameText, observePoolVersionText); dbc.addValidationStatusProvider(mustUpdateValidator); ControlDecorationSupport.create(mustUpdateValidator, SWT.LEFT); } final MultiValidator processesNameVersionUnicityValidator = new ProcessesNameVersionUnicityValidator( pnv.getAbstractProcess(), observePoolNameText, observePoolVersionText, existingProcessIdentifiers(), pools); dbc.addValidationStatusProvider(processesNameVersionUnicityValidator); ControlDecorationSupport.create(processesNameVersionUnicityValidator, SWT.LEFT); }
Example 19
Source File: EigenleistungDetailDisplay.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
/** * @wbp.parser.entryPoint */ @Override public Composite createDisplay(Composite parent, IViewSite site){ Composite ret = new Composite(parent, SWT.None); ret.setLayout(new GridLayout(2, false)); Label lblCode = new Label(ret, SWT.NONE); lblCode.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblCode.setText("Kürzel (Code)"); textCode = new Text(ret, SWT.BORDER); textCode.setData("TEST_COMP_NAME", "EigenleistungDetailCode_txt"); //$NON-NLS-1$ textCode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textCode.setTextLimit(20); textCode.setEditable(false); Label lblBezeichnung = new Label(ret, SWT.NONE); lblBezeichnung.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblBezeichnung.setText("Bezeichnung"); textBezeichnung = new Text(ret, SWT.BORDER | SWT.MULTI); textBezeichnung.setData("TEST_COMP_NAME", "EigenleistungDetailName_txt"); //$NON-NLS-1$ textBezeichnung.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textBezeichnung.setTextLimit(80); textBezeichnung.setEditable(false); Label lblEKP = new Label(ret, SWT.NONE); lblEKP.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblEKP.setText("Einkaufspreis (Rp.)"); textEKP = new Text(ret, SWT.BORDER); textEKP.setData("TEST_COMP_NAME", "EigenleistungDetailEKP_txt"); //$NON-NLS-1$ textEKP.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textEKP.setTextLimit(6); textEKP.setEditable(false); Label lblVKP = new Label(ret, SWT.NONE); lblVKP.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblVKP.setText("Verkaufspreis (Rp.)"); textVKP = new Text(ret, SWT.BORDER); textVKP.setData("TEST_COMP_NAME", "EigenleistungDetailVKP_txt"); //$NON-NLS-1$ textVKP.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textVKP.setTextLimit(6); textVKP.setEditable(false); Label lblZeit = new Label(ret, SWT.NONE); lblZeit.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblZeit.setText("Zeitbedarf"); textZeit = new Text(ret, SWT.BORDER); textZeit.setData("TEST_COMP_NAME", "EigenleistungDetailZeit_txt"); //$NON-NLS-1$ textZeit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textZeit.setTextLimit(4); textZeit.setEditable(false); return null; }
Example 20
Source File: ApplicationOverviewEditorPart.java From codewind-eclipse with Eclipse Public License 2.0 | 4 votes |
public ProjectStatusSection(Composite parent, FormToolkit toolkit, int hSpan, int vSpan) { Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR); section.setText(Messages.AppOverviewEditorProjectStatusSection); section.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true, false, hSpan, vSpan)); section.setExpanded(true); Composite composite = toolkit.createComposite(section); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 5; layout.marginWidth = 10; layout.verticalSpacing = 5; layout.horizontalSpacing = 10; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); toolkit.paintBordersFor(composite); section.setClient(composite); autoBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorAutoBuildEntry); injectMetricsEntry = new StringEntry(composite, Messages.AppOverviewEditorInjectMetricsEntry); appStatusEntry = new StringEntry(composite, Messages.AppOverviewEditorAppStatusEntry); buildStatusEntry = new StringEntry(composite, Messages.AppOverviewEditorBuildStatusEntry); lastImageBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorLastImageBuildEntry); lastBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorLastBuildEntry); Label label = new Label(composite, SWT.NONE); label.setFont(boldFont); label.setText(Messages.AppOverviewEditorProjectLogs); label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); projectLogs = new Link(composite, SWT.NONE); projectLogs.setText(""); projectLogs.setVisible(false); GridData data = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false); data.horizontalIndent = 2; data.exclude = true; projectLogs.setLayoutData(data); IDEUtil.paintBackgroundToMatch(projectLogs, composite); projectLogs.addListener(SWT.Selection, event -> { CodewindEclipseApplication app = (CodewindEclipseApplication) getApp(getConn()); if (app == null) { Logger.logError("A log link was selected but could not find the application for the " + connectionId //$NON-NLS-1$ + " connection with name: " + projectId); //$NON-NLS-1$ return; } Optional<ProjectLogInfo> logInfo = app.getLogInfos().stream().filter(info -> info.logName.equals(event.text)).findFirst(); if (logInfo.isPresent()) { try { SocketConsole console = app.getConsole(logInfo.get()); if (console == null) { console = CodewindConsoleFactory.createLogFileConsole(app, logInfo.get()); app.addConsole(console); } ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console); } catch (Exception e) { Logger.logError("An error occurred trying to open the " + logInfo.get().logName //$NON-NLS-1$ + "log file for application: " + projectId, e); //$NON-NLS-1$ MessageDialog.openError(parent.getShell(), Messages.AppOverviewEditorOpenLogErrorTitle, NLS.bind(Messages.AppOverviewEditorOpenLogErrorMsg, new String[] {logInfo.get().logName, app.name, e.getMessage()})); } } else { Logger.logError("The " + event.text + " was selected but the associated log info could not be found for the " + projectId + " project."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } }); noProjectLogs = new Text(composite, SWT.READ_ONLY); noProjectLogs.setText(Messages.AppOverviewEditorNoProjectLogs); noProjectLogs.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); noProjectLogs.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false)); IDEUtil.paintBackgroundToMatch(noProjectLogs, composite); }