/* * (non-Javadoc) * * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */ protected Control createContents(Composite parent) { Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP); text.setForeground(JFaceColors.getErrorText(text.getDisplay())); text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); text.setText(WorkbenchMessages.ErrorPreferencePage_errorMessage); return text; }
/** * Runs a runnable, which executes some code. The top visible line number of the text field is * remembered, and after the runnable has finished, the top visible line is restored is set to the * remembered number. * * @param runnable */ protected void doTxfieldActionPreservingVisibleLines(final Runnable runnable, Text textfield) { final Display display = textfield.getDisplay(); final int topIndex = textfield.getTopIndex(); runnable.run(); new Thread() { @Override public void run() { try { Thread.sleep(20); } catch (InterruptedException e) { LogUtil.logError(e); } Runnable r = new Runnable() { @Override public void run() { txtInputText.setTopIndex(topIndex); } }; display.syncExec(r); }; }.start(); }
@Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); if (this.message != null) { Label label = new Label(container, SWT.WRAP); label.setText(this.message); GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(data); label.setFont(parent.getFont()); } createCustomDialogArea(container); errorMessageText = new Text(container, SWT.READ_ONLY | SWT.WRAP); errorMessageText.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); errorMessageText.setBackground( errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); setErrorMessage(errorMessage); applyDialogFont(container); return container; }
private void updateDetailsText() { if (details != null) { details.dispose(); details = null; } if (showingDetails) { detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); Text detailsText = new Text( detailsArea, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT); detailsText.setText(getStackTrace(e)); detailsText.setBackground(detailsText.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); details = detailsText; detailsArea.layout(true); } else { detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); } }
/** * Set the font to display with * * @param fontData */ public void setFont(FontData[] fontData) { if (font != null) { font.dispose(); } font = new Font(text.getDisplay(), fontData); text.setFont(font); }
/* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Label label = new Label(composite, SWT.WRAP); label.setText(MessagesForDetailPane.PaneMaxLengthDialog_MaxCharactersToDisplay); GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(data); label.setFont(parent.getFont()); fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER); fTextWidget.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); fTextWidget.setText(fValue); fTextWidget.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); fValue = fTextWidget.getText(); } }); fErrorTextWidget = new Text(composite, SWT.READ_ONLY); fErrorTextWidget.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); fErrorTextWidget.setBackground( fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); setErrorMessage(fErrorMessage); applyDialogFont(composite); return composite; }
private void activateCellEditorAsynch(final Point selection, final boolean testFocus) { new AsynchronousThreading( 50, false, text.getDisplay(), new Runnable() { public void run() { // System.out.println("active async"); if (!text.isDisposed()) { Point newSelection = selection; if (!text.isFocusControl() && testFocus || !testFocus) { // System.out.println("activateCellEditorAsynch"); activateCellEditor(); } if (selection == null) { newSelection = selectionBeforeFocusLost; } // if (!cellEditorLocationHasChanged) { text.setSelection(new Point(newSelection.x, newSelection.y)); // } } } }) .start(); }
/** * Set the name chosen for the invoked element * * @param text the text string or null for auto-initialization */ private void setInvokedName(String text) { String name = text; if (text == null) { name = LabelHelper.INSTANCE.findName(parameterOwner, UMLPackage.eINSTANCE.getParameter()); // the name assignment will be performed by listener's call creationNameText.setText(name); } else if (name != null && !"".equals(name.trim())) { selectedName = name.trim(); Color black = creationNameText.getDisplay().getSystemColor(SWT.COLOR_BLACK); creationNameText.setForeground(black); refreshOkButton(); } else { selectedName = null; Color red = creationNameText.getDisplay().getSystemColor(SWT.COLOR_RED); creationNameText.setForeground(red); refreshOkButton(); } }
public void run() { // TODO Auto-generated method stub motorstatustext .getDisplay() .asyncExec( new Runnable() { public void run() { motorstatustext.setText(motorstatus); } }); }
private void periodicRepaint(final int delayMillis) { // Every n milliseconds redraw the icon bar m_Text .getDisplay() .timerExec( delayMillis, new Runnable() { public void run() { if (!m_IconBar.isDisposed()) { m_IconBar.redraw(); periodicRepaint(delayMillis); } } }); }
/** * {@inheritDoc} * * @see org.obeonetwork.dsl.entityrelation.parts.EntityPropertiesEditionPart#setComments(String * newValue) */ public void setComments(String newValue) { if (newValue != null) { comments.setText(newValue); } else { comments.setText(""); // $NON-NLS-1$ } boolean eefElementEditorReadOnlyState = isReadOnly(EntityrelationViewsRepository.Entity.Properties.comments); if (eefElementEditorReadOnlyState && comments.isEnabled()) { comments.setEnabled(false); comments.setBackground(comments.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); comments.setToolTipText(EntityrelationMessages.Entity_ReadOnly); } else if (!eefElementEditorReadOnlyState && !comments.isEnabled()) { comments.setEnabled(true); } }
/** * {@inheritDoc} * * @see org.obeonetwork.dsl.entity.parts.BlockPropertiesEditionPart#setDescription(String * newValue) */ public void setDescription(String newValue) { if (newValue != null) { description.setText(newValue); } else { description.setText(""); // $NON-NLS-1$ } boolean eefElementEditorReadOnlyState = isReadOnly(EntityViewsRepository.Block.Properties.description); if (eefElementEditorReadOnlyState && description.isEnabled()) { description.setEnabled(false); description.setBackground( description.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); description.setToolTipText(EntityMessages.Block_ReadOnly); } else if (!eefElementEditorReadOnlyState && !description.isEnabled()) { description.setEnabled(true); } }
private Composite createStateGroup(Composite parent, IFileStore fileStore, IFileInfo fileInfo) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).create()); Label timeStampLabel = new Label(container, SWT.NONE); timeStampLabel.setText(IDEWorkbenchMessages.ResourceInfo_lastModified); Text timeStampText = new Text(container, SWT.READ_ONLY); DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM); timeStampText.setText(format.format(new Date(fileInfo.getLastModified()))); timeStampText.setBackground( timeStampText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); timeStampText.setLayoutData( GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create()); return container; }
private static void createText(final Group group) { group.setLayout(new GridLayout(2, false)); group.setText("Text widget"); final Label lbl0 = new Label(group, SWT.NONE); lbl0.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl0.setText("No prompt :"); final Text txt0 = new Text(group, SWT.BORDER); txt0.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); final Label lbl1 = new Label(group, SWT.NONE); lbl1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl1.setText("Simple text prompt :"); final Text txt1 = new Text(group, SWT.BORDER); txt1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt1); final Label lbl2 = new Label(group, SWT.NONE); lbl2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl2.setText("Other style (bold) :"); final Text txt2 = new Text(group, SWT.BORDER); txt2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want in bold", txt2); PromptSupport.setFontStyle(SWT.BOLD, txt2); final Label lbl3 = new Label(group, SWT.NONE); lbl3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl3.setText("Behaviour highlight :"); final Text txt3 = new Text(group, SWT.BORDER); txt3.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt3); PromptSupport.setFocusBehavior(FocusBehavior.HIGHLIGHT_PROMPT, txt3); final Label lbl4 = new Label(group, SWT.NONE); lbl4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl4.setText("Change colors :"); final Text txt4 = new Text(group, SWT.BORDER); txt4.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt4); PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW), txt4); PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK), txt4); final Label lbl5 = new Label(group, SWT.NONE); lbl5.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl5.setText("Change when widget is initialized :"); final Text txt5 = new Text(group, SWT.BORDER); txt5.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); txt5.setText("Remove what is typed..."); txt5.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK)); txt5.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW)); PromptSupport.setPrompt("Type anything you want", txt5); PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE), txt5); PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_WHITE), txt5); }
/* * (non-Javadoc) Method declared on Dialog. */ protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite) super.createDialogArea(parent); Composite comp = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); // create message if (message != null) { Label label = new Label(comp, SWT.WRAP); label.setText(message); GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.horizontalSpan = 2; data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(data); label.setFont(parent.getFont()); } text = new Text(comp, getInputTextStyle()); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); text.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); Button browseButton = SWTFactory.createPushButton(comp, ActionMessages.Browse, null, SWT.RIGHT); GridData data = new GridData(SWT.LEFT, SWT.CENTER, false, false); browseButton.setLayoutData(data); browseButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(getShell()); dialog.setText(ActionMessages.SelectFileName); String loctext = ExportDialog.this.getValue().trim(); if (loctext.length() > 0) { File file = new File(loctext).getParentFile(); if (file != null && file.exists()) { dialog.setFilterPath(file.getAbsolutePath()); } } String newPath = dialog.open(); ExportDialog.this.getText().setText(newPath); } }); errorMessageText = new Text(comp, SWT.READ_ONLY | SWT.WRAP); GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); layoutData.horizontalSpan = 2; errorMessageText.setLayoutData(layoutData); errorMessageText.setBackground( errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); // Set the error message text // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292 setErrorMessage(errorMessage); applyDialogFont(comp); initialize(); PlatformUI.getWorkbench() .getHelpSystem() .setHelp(comp, IApiToolsHelpContextIds.API_COMPARE_EXPORT_DIALOG); return parent; }
private void bindControls(final DataBindingContext context) { final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject()); final Realm realm = SWTObservables.getRealm(_nameText.getDisplay()); _bindingValue = new WritableValue(realm, null, CamelMailBindingType.class); org.eclipse.core.databinding.Binding binding = context.bindValue( SWTObservables.observeText(_nameText, new int[] {SWT.Modify}), ObservablesUtil.observeDetailValue( domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT) .setAfterConvertValidator( new StringEmptyValidator( "Mail binding name should not be empty", Status.WARNING)), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); /* * we also want to bind the name field to the binding name. note that * the model to target updater is configured to NEVER update. we want * the camel binding name to be the definitive source for this field. */ binding = context.bindValue( SWTObservables.observeText(_nameText, new int[] {SWT.Modify}), ObservablesUtil.observeDetailValue( domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT) .setAfterConvertValidator( new StringEmptyValidator( "Mail binding name should not be empty", Status.WARNING)), new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); binding = context.bindValue( SWTObservables.observeText(_hostText, new int[] {SWT.Modify}), ObservablesUtil.observeDetailValue( domain, _bindingValue, MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__HOST), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT) .setAfterConvertValidator(new StringEmptyValidator(Messages.error_emptyHost)), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); binding = context.bindValue( SWTObservables.observeText(_portText, new int[] {SWT.Modify}), ObservablesUtil.observeDetailValue( domain, _bindingValue, MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__PORT), new EMFUpdateValueStrategyNullForEmptyString( "Port must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').", UpdateValueStrategy.POLICY_CONVERT) .setAfterConvertValidator( new EscapedPropertyIntegerValidator( "Port must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').")), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); FeaturePath path = FeaturePath.fromList( MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME, MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__FETCH_SIZE); binding = context.bindValue( SWTObservables.observeText(_fetchSizeText, new int[] {SWT.Modify}), ObservablesUtil.observeDetailValue(domain, _bindingValue, path), new EMFUpdateValueStrategyNullForEmptyString( "Fetch Size must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').", UpdateValueStrategy.POLICY_CONVERT) .setAfterConvertValidator( new EscapedPropertyIntegerValidator( "Fetch Size must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').")), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); path = FeaturePath.fromList( MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME, MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__ACCOUNT_TYPE); binding = context.bindValue( ViewersObservables.observeSingleSelection(_accountTypeCombo), ObservablesUtil.observeDetailValue(domain, _bindingValue, path), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); binding = context.bindValue( SWTObservables.observeText(_usernameText, new int[] {SWT.Modify}), ObservablesUtil.observeDetailValue( domain, _bindingValue, MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__USERNAME), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); binding = context.bindValue( SWTObservables.observeText(_passwordText, new int[] {SWT.Modify}), ObservablesUtil.observeDetailValue( domain, _bindingValue, MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__PASSWORD), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); path = FeaturePath.fromList( MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME, MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__FOLDER_NAME); binding = context.bindValue( SWTObservables.observeText(_folderNameText, new int[] {SWT.Modify}), ObservablesUtil.observeDetailValue(domain, _bindingValue, path), new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); path = FeaturePath.fromList( MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME, MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__UNSEEN); binding = context.bindValue( SWTObservables.observeSelection(_unseenCheckbox), ObservablesUtil.observeDetailValue(domain, _bindingValue, path), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); binding = context.bindValue( SWTObservables.observeSelection(_securedCheckbox), ObservablesUtil.observeDetailValue( domain, _bindingValue, MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__SECURE), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); path = FeaturePath.fromList( MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME, MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__DELETE); binding = context.bindValue( SWTObservables.observeSelection(_deleteCheckbox), ObservablesUtil.observeDetailValue(domain, _bindingValue, path), new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null); ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT); _opSelectorComposite.bindControls(domain, context); }
@Override protected Control createDialogArea(final Composite parent) { setShellStyle(SWT.WRAP); // create composite composite = (Composite) super.createDialogArea(parent); GridLayout layout = (GridLayout) composite.getLayout(); layout.makeColumnsEqualWidth = false; layout.numColumns = 2; label = new Label(composite, SWT.NONE | SWT.WRAP); // create message if (message != null) { // label = new Label(composite, SWT.NONE); label.setText(message); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); label.setFont(parent.getFont()); } text = new Text(composite, getInputTextStyle() | SWT.WRAP); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); text.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); // xpathwidget = new XpathWidget(site,"...",treeParent,null, composite, null,false,true); // XpathSelectDialog(Shell parentShell,TreeParent parent,String title,IWorkbenchPartSite // site,boolean // isMulti,String dataModelName) openDLG = new Button(composite, SWT.NONE); openDLG.setImage(ImageCache.getCreatedImage(EImage.DOTS_BUTTON.getPath())); openDLG.addSelectionListener(this); openDLG.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); openDLG.setVisible(isBtnShow); openDLG.setToolTipText(Messages.ProcessViewXX_SelectOneEntity); errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); errorMessageText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1)); errorMessageText.setBackground( errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); // Set the error message text setErrorMessage(errorMessage); if (isTransfor) { Group radioGroup = new Group(parent, SWT.SHADOW_NONE); radioGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); radioGroup.setLayout(new GridLayout(1, false)); radioGroup.setText(Messages.ProcessViewXX_SelectOneType); transformeButton = new Button(radioGroup, SWT.RADIO); transformeButton.setText(Messages.ProcessViewXX_CreateNormalProcess); transformeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); text.setText(""); // $NON-NLS-1$ transformeButton.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { text.setText(""); // $NON-NLS-1$ label.setText(message); openDLG.setVisible(false); parent.layout(true); value = ""; // $NON-NLS-1$ } }); transformeButton.setSelection(true); smartViewButton = new Button(radioGroup, SWT.RADIO); smartViewButton.setText(Messages.ProcessViewXX_CreateSmartProcess); smartViewButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); // smartViewButton.setSelection(true); smartViewButton.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { text.setText(Smart_view); label.setText(Messages.ProcessViewXX_LabelText); openDLG.setVisible(true); value = Smart_view; } }); beforeSavingButton = new Button(radioGroup, SWT.RADIO); beforeSavingButton.setText(Messages.ProcessViewXX_CreateBeforeProcess); beforeSavingButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); beforeSavingButton.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { text.setText(beforeSaving); label.setText(Messages.ProcessViewXX_LabelEnterName); openDLG.setVisible(true); value = beforeSaving; } }); beforeDeletingButton = new Button(radioGroup, SWT.RADIO); beforeDeletingButton.setText(Messages.ProcessViewXX_CreateBeforeDelProcess); beforeDeletingButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); beforeDeletingButton.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { text.setText(beforeDeleting); label.setText(Messages.ProcessViewXX_LabelEnterNameDel); openDLG.setVisible(true); value = beforeDeleting; } }); runnableProcessButton = new Button(radioGroup, SWT.RADIO); runnableProcessButton.setText(Messages.ProcessViewXX_CreateRunnableProcess); runnableProcessButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); runnableProcessButton.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { text.setText(runnableProcess); label.setText(Messages.ProcessViewXX_LabelEnterNameRunnable); openDLG.setVisible(true); value = runnableProcess; } }); standaloneProcessButton = new Button(radioGroup, SWT.RADIO); standaloneProcessButton.setText(Messages.ProcessViewXX_CreateStandloneProcess); standaloneProcessButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); standaloneProcessButton.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { text.setText(standaloneProcess); label.setText(Messages.ProcessViewXX_LabelEnterNameFlowRunnable); openDLG.setVisible(true); value = standaloneProcess; } }); } else { if (value != null) { text.setText(value); } } applyDialogFont(composite); return composite; }
void log(String text) { console.getDisplay().asyncExec(() -> appendLog(text)); }
private Composite createBasicInfoGroup( Composite parent, IFileStore fileStore, IFileInfo fileInfo) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).create()); Label label = new Label(container, SWT.NONE); label.setText(IDEWorkbenchMessages.ResourceInfo_path); label.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.TOP).create()); Text pathText = new Text(container, SWT.WRAP | SWT.READ_ONLY); pathText.setText(fileStore.toURI().getPath()); pathText.setBackground(pathText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); pathText.setLayoutData( GridDataFactory.swtDefaults() .grab(true, false) .align(SWT.FILL, SWT.CENTER) .hint(convertWidthInCharsToPixels(MAX_VALUE_WIDTH), SWT.DEFAULT) .create()); label = new Label(container, SWT.LEFT); label.setText(IDEWorkbenchMessages.ResourceInfo_type); label.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.TOP).create()); Text typeText = new Text(container, SWT.LEFT | SWT.READ_ONLY); typeText.setText( fileInfo.isDirectory() ? Messages.FileInfoPropertyPage_Folder : Messages.FileInfoPropertyPage_File); typeText.setBackground(typeText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); typeText.setLayoutData(GridDataFactory.swtDefaults().create()); label = new Label(container, SWT.LEFT); label.setText(IDEWorkbenchMessages.ResourceInfo_location); label.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.TOP).create()); Text locationText = new Text(container, SWT.WRAP | SWT.READ_ONLY); locationText.setText(fileStore.toString()); locationText.setBackground( locationText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); locationText.setLayoutData( GridDataFactory.swtDefaults() .grab(true, false) .align(SWT.FILL, SWT.CENTER) .hint(convertWidthInCharsToPixels(MAX_VALUE_WIDTH), SWT.DEFAULT) .create()); if (!fileInfo.isDirectory()) { label = new Label(container, SWT.LEFT); label.setText(IDEWorkbenchMessages.ResourceInfo_size); label.setLayoutData(GridDataFactory.swtDefaults().create()); Text sizeText = new Text(container, SWT.LEFT | SWT.READ_ONLY); sizeText.setText( MessageFormat.format( Messages.FileInfoPropertyPage_Bytes, Long.toString(fileInfo.getLength()))); sizeText.setBackground(sizeText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); sizeText.setLayoutData( GridDataFactory.swtDefaults() .grab(true, false) .align(SWT.FILL, SWT.CENTER) .hint(convertWidthInCharsToPixels(MAX_VALUE_WIDTH), SWT.DEFAULT) .create()); } return container; }