org.eclipse.swt.widgets.Text Java Examples
The following examples show how to use
org.eclipse.swt.widgets.Text.
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: ModelPropertiesDialog.java From erflute with Apache License 2.0 | 7 votes |
private void edit(final TableItem item, final TableEditor tableEditor) { final Text text = new Text(table, SWT.NONE); text.setText(item.getText(targetColumn)); text.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { item.setText(targetColumn, text.getText()); text.dispose(); } }); tableEditor.setEditor(text, item, targetColumn); text.setFocus(); text.selectAll(); }
Example #2
Source File: CodewindPrefsParentPage.java From codewind-eclipse with Eclipse Public License 2.0 | 6 votes |
private Text createCWTimeoutEntry(Composite comp, String label, String prefKey) { Label timeoutLabel = new Label(comp, SWT.NONE); timeoutLabel.setText(label); timeoutLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, false, false)); Text text = new Text(comp, SWT.BORDER); text.setText(Integer.toString(prefs.getInt(prefKey))); GridData data = new GridData(GridData.BEGINNING, GridData.FILL, false, false); data.widthHint = 50; text.setLayoutData(data); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { validate(); } }); return text; }
Example #3
Source File: LoginDialog.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Build the password part of the box */ private void buildPassword() { final Label label = new Label(shell, SWT.NONE); final GridData gridData = new GridData(GridData.END, GridData.CENTER, false, false, 1, 1); gridData.horizontalIndent = 35; label.setLayoutData(gridData); label.setText(ResourceManager.getLabel(ResourceManager.PASSWORD)); final Text text = new Text(shell, SWT.PASSWORD | SWT.BORDER); text.setText(password == null ? "" : password); text.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1)); text.addListener(SWT.Modify, e -> { password = text.getText(); changeButtonOkState(); }); }
Example #4
Source File: CancelBuyOrderWizard.java From offspring with MIT License | 6 votes |
@Override public Control createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(1).applyTo(comp); textDescr = new Text(comp, SWT.BORDER | SWT.MULTI); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .hint(SWT.DEFAULT, 100).applyTo(textDescr); textDescr.setText(""); textDescr.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { requestVerification(); } }); return comp; }
Example #5
Source File: JobHasDescriptionImportRuleComposite.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public Composite getComposite( Composite parent, ImportRuleInterface importRule ) { PropsUI props = PropsUI.getInstance(); composite = new Composite( parent, SWT.NONE ); props.setLook( composite ); composite.setLayout( new FillLayout() ); Label label = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT ); props.setLook( label ); label.setText( "Minimum length: " ); text = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT ); props.setLook( text ); return composite; }
Example #6
Source File: N4JSNewProjectWizardCreationPage.java From n4js with Eclipse Public License 1.0 | 6 votes |
private void createVendorIdControls(DataBindingContext dbc, Composite parent) { final Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create()); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Label vendorIdLabel = new Label(composite, SWT.NONE); vendorIdLabel.setText("Vendor id:"); Text vendorIdText = new Text(composite, SWT.BORDER); vendorIdText.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create()); projectInfo.addPropertyChangeListener(event -> { if (event.getPropertyName().equals(N4JSProjectInfo.VENDOR_ID_PROP_NAME)) { setPageComplete(validatePage()); } }); dbc.bindValue(WidgetProperties.text(Modify).observe(vendorIdText), BeanProperties.value(N4JSProjectInfo.class, N4JSProjectInfo.VENDOR_ID_PROP_NAME).observe(projectInfo)); }
Example #7
Source File: DashboardComposite.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** {@code key} defines which data source will be used for display. */ public DashboardComposite(String key, Composite parent, int style) { super(parent, style); this.key = key; this.setLayout(new FillLayout()); final SashForm sf = new SashForm(this, SWT.HORIZONTAL); sf.setLayout(new FillLayout()); this.canvas = new VisualisationCanvas(sf, SWT.NONE); this.text = new Text(sf, SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); text.setText(""); createVisualisationControls(sf); sf.setWeights(new int[] { 45, 45, 10 }); }
Example #8
Source File: ApiDocumentationResultView.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * Create the composite. * * @param parent * @param style */ public ApiDocumentationResultView() { super(SWT.BORDER); setBackgroundMode(SWT.INHERIT_FORCE); setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); GridLayout gridLayout = new GridLayout(2, false); gridLayout.verticalSpacing = 0; setLayout(gridLayout); lblLabel = new CLabel(this, SWT.NONE); lblLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); lblLabel.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL)); lblLabel.setText("<Title of the API documentation>"); new Label(this, SWT.NONE); textUrl = new Text(this, SWT.READ_ONLY | SWT.WRAP); textUrl.setEditable(false); textUrl.setForeground(SWTResourceManager.getColor(SWT.COLOR_GRAY)); textUrl.setText("<url>"); textUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); }
Example #9
Source File: ContractInputExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createReturnTypeComposite(final Composite parent) { final Composite typeComposite = new Composite(parent, SWT.NONE); typeComposite.setLayoutData(GridDataFactory.fillDefaults() .grab(true, false).create()); final GridLayout gl = new GridLayout(2, false); gl.marginWidth = 0; gl.marginHeight = 0; typeComposite.setLayout(gl); final Label typeLabel = new Label(typeComposite, SWT.NONE); typeLabel.setText(Messages.returnType); typeLabel.setLayoutData(GridDataFactory.fillDefaults() .align(SWT.FILL, SWT.CENTER).create()); typeText = new Text(typeComposite, SWT.BORDER | SWT.READ_ONLY); typeText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .align(SWT.FILL, SWT.CENTER).indent(10, 0).create()); }
Example #10
Source File: GrammarInfoWidget.java From tm4e with Eclipse Public License 1.0 | 6 votes |
private void createUI(Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.marginLeft = 0; layout.marginRight = 0; parent.setLayout(layout); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); Label grammarNameLabel = new Label(parent, SWT.NONE); grammarNameLabel.setText(TMUIMessages.GrammarInfoWidget_name_text); nameText = new Text(parent, SWT.BORDER | SWT.READ_ONLY); nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label grammarScopeNameLabel = new Label(parent, SWT.NONE); grammarScopeNameLabel.setText(TMUIMessages.GrammarInfoWidget_scopeName_text); scopeNameText = new Text(parent, SWT.BORDER | SWT.READ_ONLY); scopeNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label grammarFileTypesLabel = new Label(parent, SWT.NONE); grammarFileTypesLabel.setText(TMUIMessages.GrammarInfoWidget_fileTypes_text); fileTypesText = new Text(parent, SWT.BORDER | SWT.READ_ONLY); fileTypesText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); }
Example #11
Source File: ConvertAnonymousToNestedWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Text addFieldNameField(Composite result) { Label nameLabel= new Label(result, SWT.NONE); nameLabel.setText(RefactoringMessages.ConvertAnonymousToNestedInputPage_class_name); nameLabel.setLayoutData(new GridData()); final Text classNameField= new Text(result, SWT.BORDER | SWT.SINGLE); classNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); classNameField.addModifyListener(new ModifyListener(){ public void modifyText(ModifyEvent e) { ConvertAnonymousToNestedInputPage.this.getConvertRefactoring().setClassName(classNameField.getText()); ConvertAnonymousToNestedInputPage.this.updateStatus(); } }); TextFieldNavigationHandler.install(classNameField); return classNameField; }
Example #12
Source File: ExceptionDetailsDialog.java From gama with GNU General Public License v3.0 | 6 votes |
/** * Create the details field based upon the details object. Do nothing if the details object is not specified. * * @param parent * the details area in which the fields are created * * @return the details field */ private Control createDetailsViewer(final Composite parent) { if (details == null) { return null; } final Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); text.setLayoutData(new GridData(GridData.FILL_BOTH)); // Create the content. final StringWriter writer = new StringWriter(1000); if (details instanceof Throwable) { appendException(new PrintWriter(writer), (Throwable) details); } else if (details instanceof IStatus) { appendCommandStatus(new PrintWriter(writer), (IStatus) details, 0); } text.setText(writer.toString()); return text; }
Example #13
Source File: TypeFilterInputDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Composite composite= (Composite) super.createDialogArea(parent); Composite inner= new Composite(composite, SWT.NONE); LayoutUtil.doDefaultLayout(inner, new DialogField[] { fNameDialogField }, true, 0, 0); int fieldWidthHint= convertWidthInCharsToPixels(60); Text text= fNameDialogField.getTextControl(null); LayoutUtil.setWidthHint(text, fieldWidthHint); LayoutUtil.setHorizontalGrabbing(text); BidiUtils.applyBidiProcessing(text, StructuredTextTypeHandlerFactory.JAVA); TextFieldNavigationHandler.install(text); fNameDialogField.postSetFocusOnDialogField(parent.getDisplay()); applyDialogFont(composite); return composite; }
Example #14
Source File: EquivalentPage.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 验证用户输入的加权系数的正确性 * @param equiTxt */ private void validEquiTxt(final Text equiTxt){ final String defaultStr = "0.50"; equiTxt.setText(defaultStr); equiTxt.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { String textStr = equiTxt.getText().trim(); if (textStr == null || textStr.trim().length() == 0) { equiTxt.setText(defaultStr); }else { String regular = "1\\.(0){0,2}|0\\.\\d{0,2}"; if (!textStr.matches(regular)) { MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), Messages.getString("preference.EquivalentPage.msg5")); equiTxt.setText(defaultStr); } } } }); }
Example #15
Source File: TexlipseProjectCreationWizardPage.java From texlipse with Eclipse Public License 1.0 | 6 votes |
/** * Creates a list element containing available templates (system and user) * and a text area next to it for showing description about the selected template * * @param composite the parent container */ private void createTemplateControl(Composite composite) { // add list for templates templateList = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); templateList.setItems(ProjectTemplateManager.loadTemplateNames()); templateList.setLayoutData(new GridData(GridData.FILL_VERTICAL)); templateList.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateTooltip")); templateList.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { attributes.setTemplate(templateList.getSelection()[0]); updateEntries(); }}); templateList.setSelection(0); // this has to be done, because setSelection() doesn't generate an event attributes.setTemplate(templateList.getItem(0)); // add TextField for the selected template's description descriptionField = new Text(composite, SWT.MULTI | SWT.BORDER); descriptionField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateDescriptionTooltip")); descriptionField.setLayoutData(new GridData(GridData.FILL_BOTH)); descriptionField.setEditable(false); }
Example #16
Source File: FileText.java From ermaster-b with Apache License 2.0 | 6 votes |
public FileText(Composite parent, int style, String[] filterExtensions) { this.text = new Text(parent, style); this.filterExtensions = filterExtensions; this.openBrowseButton = new Button(parent, SWT.NONE); this.openBrowseButton.setText(JFaceResources.getString("openBrowse")); this.openBrowseButton.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(SelectionEvent e) { // String saveFilePath = Activator.showSaveDialog(text.getText(), // FileText.this.filterExtensions); String saveFilePath = Activator.showSaveDialogInternal(text.getText(), FileText.this.filterExtensions); text.setText(saveFilePath); } }); }
Example #17
Source File: RunOptionsDefaultsComponentTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Before public void setUp() throws IOException { Account account1 = mock(Account.class, "[email protected]"); Credential credential1 = mock(Credential.class, "[email protected]"); when(account1.getEmail()).thenReturn("[email protected]"); when(account1.getOAuth2Credential()).thenReturn(credential1); mockStorageApiBucketList(credential1, "project", "alice-bucket-1", "alice-bucket-2"); mockProjectList(credential1, new GcpProject("project", "project")); mockServiceApi(credential1, "project", "dataflow.googleapis.com"); Account account2 = mock(Account.class, "[email protected]"); Credential credential2 = mock(Credential.class, "[email protected]"); when(account2.getEmail()).thenReturn("[email protected]"); when(account2.getOAuth2Credential()).thenReturn(credential2); mockStorageApiBucketList(credential2, "project", "bob-bucket"); mockProjectList(credential2, new GcpProject("project", "project")); mockServiceApi(credential2, "project", "dataflow.googleapis.com"); doCallRealMethod().when(page).setPageComplete(anyBoolean()); doCallRealMethod().when(page).isPageComplete(); when(loginService.getAccounts()).thenReturn(Sets.newHashSet(account1, account2)); shell = shellResource.getShell(); bot = new SWTBot(shell); component = new RunOptionsDefaultsComponent( shell, 3, messageTarget, preferences, page, false /* allowIncomplete */, loginService, apiFactory); selector = CompositeUtil.findControl(shell, AccountSelector.class); projectID = CompositeUtil.findControlAfterLabel(shell, Combo.class, "Cloud Platform &project ID:"); stagingLocations = CompositeUtil.findControlAfterLabel(shell, Combo.class, "Cloud Storage staging &location:"); createButton = CompositeUtil.findButton(shell, "&Create Bucket"); serviceAccountKey = CompositeUtil.findControl(shell, Text.class); browse = CompositeUtil.findButton(shell, "Browse..."); }
Example #18
Source File: CrosstabPageBreakDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
public void handleEvent( Event e ) { // TODO Auto-generated method stub Pattern pattern = Pattern.compile( "[0-9]\\d*" ); //$NON-NLS-1$ Matcher matcher = pattern.matcher( e.text ); if ( matcher.matches( ) ) // number { e.doit = true; } else if ( e.text.length( ) > 0 ) // characters including tab, space, // Chinese character, etc. { e.doit = false; } else // control keys { e.doit = true; } try { if ( e.doit = true && Integer.parseInt( ( (Text) e.widget ).getText( ) + e.text ) >= 0 ) { e.doit = true; } } catch ( NumberFormatException e1 ) { e.doit = false; } }
Example #19
Source File: OptionsConfigurationBlock.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Text getTextControl( Key key ) { for ( int i = fTextBoxes.size( ) - 1; i >= 0; i-- ) { Text curr = (Text) fTextBoxes.get( i ); ControlData data = (ControlData) curr.getData( ); if ( key.equals( data.getKey( ) ) ) { return curr; } } return null; }
Example #20
Source File: SlantingMatrixProjectorDesign.java From ldparteditor with MIT License | 5 votes |
private void insertMatrixCell(Composite cmp_container, BigDecimal val, Text[] textCmp) { Text txt_Cell = new Text(cmp_container, SWT.NONE); textCmp[0] = txt_Cell; txt_Cell.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); txt_Cell.setText(numberFormat.format(val)); txt_Cell.setFont(Font.MONOSPACE); txt_Cell.setEditable(false); }
Example #21
Source File: AbstractPathText.java From ermasterr with Apache License 2.0 | 5 votes |
public AbstractPathText(final Composite parent, final File argProjectDir, final boolean indent) { text = new Text(parent, SWT.BORDER); projectDir = argProjectDir; final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gridData.grabExcessHorizontalSpace = true; if (indent) { gridData.horizontalIndent = Resources.INDENT; } text.setLayoutData(gridData); openBrowseButton = new Button(parent, SWT.LEFT); openBrowseButton.setText(" " + JFaceResources.getString("openBrowse") + " "); openBrowseButton.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent e) { String saveFilePath = selectPathByDilaog(); if (saveFilePath != null) { saveFilePath = FileUtils.getRelativeFilePath(projectDir, saveFilePath); setText(saveFilePath); } } }); }
Example #22
Source File: LoginDialog.java From nebula with Eclipse Public License 2.0 | 5 votes |
private void buildLoginText() { final Text text = new Text(shell, SWT.BORDER); text.setText(login == null ? "" : login); text.setLayoutData(new GridData(GridData.FILL, GridData.END, true, false, 3, 1)); text.setFocus(); text.addListener(SWT.Modify, e -> { login = text.getText(); changeButtonOkState(); }); }
Example #23
Source File: WorkspaceDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridLayout layout = new GridLayout(); layout.numColumns = 1; composite.setLayout(layout); final GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); composite.setLayoutData(data); getShell().setText(Messages.getString("dialog.WorkspaceDialog.shell")); wsTreeViewer = new TreeViewer(composite, SWT.BORDER); final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint = 550; gd.heightHint = 250; wsTreeViewer.getTree().setLayoutData(gd); wsTreeViewer.setContentProvider(new LocationPageContentProvider()); wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider()); wsTreeViewer.setInput(ResourcesPlugin.getWorkspace()); final Composite group = new Composite(composite, SWT.NONE); layout = new GridLayout(2, false); layout.marginWidth = 0; group.setLayout(layout); group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); final Label label = new Label(group, SWT.NONE); label.setLayoutData(new GridData()); label.setText(Messages.getString("dialog.WorkspaceDialog.label")); wsFilenameText = new Text(group, SWT.BORDER); wsFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); setupListeners(); return parent; }
Example #24
Source File: ImporterPage.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public ODBCBasedImporter(final Composite parent, final ImporterPage home){ super(parent, SWT.NONE); setLayout(new GridLayout()); final Label lSource = new Label(this, SWT.NONE); tSource = new Text(this, SWT.BORDER); lSource.setText(Messages.ImporterPage_source); //$NON-NLS-1$ tSource.setEditable(false); lSource.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tSource.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tSource.setText(CoreHub.localCfg.get( "ImporterPage/" + home.getTitle() + "/ODBC-Source", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ home.results = new String[1]; home.results[0] = tSource.getText(); Button bSource = new Button(this, SWT.PUSH); bSource.setText(Messages.ImporterPage_enter); //$NON-NLS-1$ bSource.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e){ InputDialog in = new InputDialog(parent.getShell(), Messages.ImporterPage_odbcSource, //$NON-NLS-1$ Messages.ImporterPage_pleaseEnterODBC, null, null); //$NON-NLS-1$ if (in.open() == Dialog.OK) { tSource.setText(in.getValue()); home.results[0] = in.getValue(); CoreHub.localCfg.set( "ImporterPage/" + home.getTitle() + "/ODBC-Source", home.results[0]); //$NON-NLS-1$ //$NON-NLS-2$ } } }); }
Example #25
Source File: SWTFactory.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public static void addCharsFilterValidator(Text t, final String charsToExclude) { t.addListener(SWT.Verify, new Listener() { public void handleEvent(Event e) { String s = e.text; for (int i=0; i<charsToExclude.length(); ++i) { if (s.indexOf(charsToExclude.charAt(i))>= 0) { e.doit = false; return; } } } }); }
Example #26
Source File: ExtractTempWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void createControl(Composite parent) { loadSettings(); Composite result= new Composite(parent, SWT.NONE); setControl(result); GridLayout layout= new GridLayout(); layout.numColumns= 2; layout.verticalSpacing= 8; result.setLayout(layout); RowLayouter layouter= new RowLayouter(2); Label label= new Label(result, SWT.NONE); label.setText(RefactoringMessages.ExtractTempInputPage_variable_name); Text text= createTextInputField(result); text.selectAll(); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); ControlContentAssistHelper.createTextContentAssistant(text, new VariableNamesProcessor(fTempNameProposals)); layouter.perform(label, text, 1); addReplaceAllCheckbox(result, layouter); addDeclareFinalCheckbox(result, layouter); validateTextField(text.getText()); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.EXTRACT_TEMP_WIZARD_PAGE); }
Example #27
Source File: AddAnalysisDialog.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { // create composite final Composite composite = (Composite) super.createDialogArea(parent); // create label for name text createSubtitleLabel(composite, Messages.AddAnalysisDialog_Name); // create name text fNameText = new Text(composite, getInputTextStyle()); fNameText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); fNameText.addModifyListener(e -> validateInputs()); // create name error text fNameErrorLabel = createErrorLabel(composite); // spacer new Label(composite, SWT.WRAP); // create label for command text createSubtitleLabel(composite, Messages.AddAnalysisDialog_Command); // create command text fCommandText = new Text(composite, getInputTextStyle()); fCommandText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); final Font mono = new Font(parent.getDisplay(), "Monospace", 9, SWT.NONE); //$NON-NLS-1$ fCommandText.setFont(mono); fCommandText.addModifyListener(e -> validateInputs()); fCommandText.addDisposeListener(e -> mono.dispose()); // create command error text fCommandErrorLabel = createErrorLabel(composite); applyDialogFont(composite); return composite; }
Example #28
Source File: FilteredTypesSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void create() { super.create(); Control patternControl= getPatternControl(); if (patternControl instanceof Text) { TextFieldNavigationHandler.install((Text) patternControl); } }
Example #29
Source File: H5ResourcePage.java From dawnsci with Eclipse Public License 1.0 | 5 votes |
private void createFolderChoiceGroup(Composite folderChoiceGroup) { Label groupLabel = new Label(folderChoiceGroup, SWT.NONE); groupLabel.setText("External Folder"); groupLabel.setFont(folderChoiceGroup.getFont()); // source name entry field this.folderNameField = new Text(folderChoiceGroup, SWT.BORDER); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; folderNameField.setLayoutData(data); folderNameField.setFont(folderChoiceGroup.getFont()); folderNameField.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { dialogChanged(); } }); // source browse button Button folderBrowseButton = new Button(folderChoiceGroup, SWT.PUSH); folderBrowseButton.setText("Browse..."); folderBrowseButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { final DirectoryDialog dialog = new DirectoryDialog(getControl().getShell()); if (folderNameField.getText()!=null) dialog.setFilterPath(folderNameField.getText()); folderNameField.setText(dialog.open()); dialogChanged(); } }); folderBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); folderBrowseButton.setFont(folderChoiceGroup.getFont()); setButtonLayoutData(folderBrowseButton); }
Example #30
Source File: OptionsConfigurationBlock.java From typescript.java with MIT License | 5 votes |
protected void updateControls() { // update the UI for (int i = fCheckBoxes.size() - 1; i >= 0; i--) { updateCheckBox((Button) fCheckBoxes.get(i)); } for (int i = fComboBoxes.size() - 1; i >= 0; i--) { updateCombo((Combo) fComboBoxes.get(i)); } for (int i = fTextBoxes.size() - 1; i >= 0; i--) { updateText((Text) fTextBoxes.get(i)); } }