Java Code Examples for org.eclipse.swt.widgets.Text#selectAll()
The following examples show how to use
org.eclipse.swt.widgets.Text#selectAll() .
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: RenameElementWizard.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); composite.setFont(parent.getFont()); Label label = new Label(composite, SWT.NONE); label.setText("New name:");//$NON-NLS-1$ label.setLayoutData(new GridData()); nameField = new Text(composite, SWT.BORDER); nameField.setText(currentName); nameField.setFont(composite.getFont()); nameField.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false)); nameField.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validatePage(); } }); nameField.selectAll(); validatePage(); setControl(composite); }
Example 3
Source File: ModelPropertiesDialog.java From ermasterr with Apache License 2.0 | 6 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(final FocusEvent e) { item.setText(targetColumn, text.getText()); text.dispose(); } }); tableEditor.setEditor(text, item, targetColumn); text.setFocus(); text.selectAll(); }
Example 4
Source File: ExternalizeWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void createKeyPrefixField(Composite parent) { Composite composite= new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout gl= new GridLayout(); gl.numColumns= 2; gl.marginWidth= 0; composite.setLayout(gl); Label l= new Label(composite, SWT.NONE); l.setText(NLSUIMessages.ExternalizeWizardPage_common_prefix); l.setLayoutData(new GridData()); fPrefixField= new Text(composite, SWT.SINGLE | SWT.BORDER); fPrefixField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fPrefixField.setText(fNLSRefactoring.getPrefix()); fPrefixField.selectAll(); fPrefixField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { fNLSRefactoring.setPrefix(fPrefixField.getText()); validateKeys(true); } }); }
Example 5
Source File: IntroduceParameterObjectWizard.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.IntroduceParameterObjectWizard_classnamefield_label); final Text text= new Text(result, SWT.SINGLE | SWT.BORDER); text.setText(fProcessor.getClassName()); text.selectAll(); text.setFocus(); text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { fProcessor.setClassName(text.getText()); updateSignaturePreview(); validateRefactoring(); } }); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); }
Example 6
Source File: ModelPropertiesDialog.java From ermaster-b with Apache License 2.0 | 6 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 7
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 8
Source File: PromoteTempWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void addFieldNameField(Composite result) { Label nameLabel= new Label(result, SWT.NONE); nameLabel.setText(RefactoringMessages.PromoteTempInputPage_Field_name); nameLabel.setLayoutData(new GridData()); String[] guessedFieldNames= getPromoteTempRefactoring().guessFieldNames(); String firstGuessedFieldName= guessedFieldNames[0]; fNameField = new Text(result, SWT.BORDER | SWT.SINGLE); fNameField.setText(firstGuessedFieldName); getPromoteTempRefactoring().setFieldName(firstGuessedFieldName); fNameField.selectAll(); fNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fNameField.addModifyListener(new ModifyListener(){ public void modifyText(ModifyEvent e) { PromoteTempInputPage.this.getPromoteTempRefactoring().setFieldName(fNameField.getText()); PromoteTempInputPage.this.updateStatus(); } }); IContentAssistProcessor processor= new FieldNameProcessor(guessedFieldNames, getPromoteTempRefactoring()); ControlContentAssistHelper.createTextContentAssistant(fNameField, processor); TextFieldNavigationHandler.install(fNameField); }
Example 9
Source File: LabeledEdit.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private void createEdit(String text) { edit = new Text(this, SWT.BORDER | SWT.SINGLE); edit.setText(text); edit.selectAll(); GridData textData = new GridData(GridData.FILL_HORIZONTAL); textData.grabExcessHorizontalSpace = true; edit.setLayoutData(textData); }
Example 10
Source File: NoteEditManager.java From ermaster-b with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void initCellEditor() { TextCellEditor editor = (TextCellEditor) this.getCellEditor(); if (note.getText() != null) { editor.setValue(note.getText()); } Text text = (Text) editor.getControl(); text.selectAll(); }
Example 11
Source File: ExtractConstantWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void createControl(Composite parent) { 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.ExtractConstantInputPage_constant_name); Text text= createTextInputField(result); text.selectAll(); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (fConstNameProposals.length > 0) { fContentAssistProcessor= new VariableNamesProcessor(fConstNameProposals); ControlContentAssistHelper.createTextContentAssistant(text, fContentAssistProcessor); } layouter.perform(label, text, 1); addAccessModifierGroup(result, layouter); addReplaceAllCheckbox(result, layouter); addQualifyReferencesCheckbox(result, layouter); addSeparator(result, layouter); addLabel(result, layouter); validateTextField(text.getText()); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.EXTRACT_CONSTANT_WIZARD_PAGE); }
Example 12
Source File: WalkerNoteEditManager.java From erflute with Apache License 2.0 | 5 votes |
@Override protected void initCellEditor() { final TextCellEditor editor = (TextCellEditor) getCellEditor(); if (note.getNoteText() != null) { editor.setValue(note.getNoteText()); } final Text text = (Text) editor.getControl(); text.selectAll(); }
Example 13
Source File: RenameInputWizardPage.java From typescript.java with MIT License | 5 votes |
@Override public void createControl(Composite parent) { Composite superComposite = new Composite(parent, SWT.NONE); setControl(superComposite); initializeDialogUnits(superComposite); superComposite.setLayout(new GridLayout()); Composite composite = new Composite(superComposite, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); RowLayouter layouter = new RowLayouter(2); Label label = new Label(composite, SWT.NONE); label.setText(RefactoringMessages.RenameInputWizardPage_new_name); Text text = createTextInputField(composite); text.selectAll(); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(25); text.setLayoutData(gd); layouter.perform(label, text, 1); Label separator = new Label(composite, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false); gridData.heightHint = 2; separator.setLayoutData(gridData); addFindInCommentsCheckbox(composite, layouter); addFindInStringsCheckbox(composite, layouter); Dialog.applyDialogFont(superComposite); }
Example 14
Source File: NoteEditManager.java From ermasterr with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void initCellEditor() { final TextCellEditor editor = (TextCellEditor) getCellEditor(); if (note.getText() != null) { editor.setValue(note.getText()); } final Text text = (Text) editor.getControl(); text.selectAll(); }
Example 15
Source File: RenameRefactoringPage.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private void createTxtNewName(Composite composite) { txtNewName = new Text(composite, SWT.BORDER); txtNewName.setText(refactoringInfo.getSelectedIdentifier()); txtNewName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); txtNewName.selectAll(); txtNewName.addKeyListener( new KeyAdapter() { public void keyReleased( final KeyEvent e ) { refactoringInfo.setNewName( txtNewName.getText() ); validate(); } } ); }
Example 16
Source File: RenameInputWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void createControl(Composite parent) { Composite superComposite= new Composite(parent, SWT.NONE); setControl(superComposite); initializeDialogUnits(superComposite); superComposite.setLayout(new GridLayout()); Composite composite= new Composite(superComposite, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout= new GridLayout(); layout.numColumns= 2; layout.marginHeight= 0; layout.marginWidth= 0; composite.setLayout(layout); RowLayouter layouter= new RowLayouter(2); Label label= new Label(composite, SWT.NONE); label.setText(getLabelText()); Text text= createTextInputField(composite); text.selectAll(); GridData gd= new GridData(GridData.FILL_HORIZONTAL); gd.widthHint= convertWidthInCharsToPixels(25); text.setLayoutData(gd); layouter.perform(label, text, 1); Label separator= new Label(composite, SWT.NONE); GridData gridData= new GridData(SWT.FILL, SWT.FILL, false, false); gridData.heightHint= 2; separator.setLayoutData(gridData); int indent= LayoutUtil.getIndent(); addOptionalUpdateReferencesCheckbox(composite, layouter); addAdditionalOptions(composite, layouter); addOptionalUpdateTextualMatches(composite, layouter); addOptionalUpdateQualifiedNameComponent(composite, layouter, indent); addOptionalLeaveDelegateCheckbox(composite, layouter); addOptionalDeprecateDelegateCheckbox(composite, layouter, indent); updateForcePreview(); Dialog.applyDialogFont(superComposite); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), fHelpContextID); }
Example 17
Source File: IntroduceFactoryInputPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Text createTextInputField(Composite result) { final Text textField = new Text(result, SWT.SINGLE | SWT.LEFT | SWT.BORDER); textField.selectAll(); TextFieldNavigationHandler.install(textField); return textField; }
Example 18
Source File: RadlNewWizardPage.java From RADL with Apache License 2.0 | 4 votes |
private void focus(Text control) { setControl(control); control.selectAll(); }
Example 19
Source File: ExtendedPropertyEditorComposite.java From birt with Eclipse Public License 1.0 | 4 votes |
public void widgetSelected( SelectionEvent e ) { if ( e.getSource( ).equals( btnAdd ) ) { String sKey = txtNewKey.getText( ); if ( sKey.length( ) > 0 && !propMap.containsKey( sKey ) ) { String[] sProperty = new String[2]; sProperty[0] = sKey; sProperty[1] = ""; //$NON-NLS-1$ TableItem tiProp = new TableItem( table, SWT.NONE ); tiProp.setText( sProperty ); table.select( table.getItemCount( ) - 1 ); updateModel( sProperty[0], sProperty[1] ); txtNewKey.setText( "" ); //$NON-NLS-1$ } } else if ( e.getSource( ).equals( btnRemove ) ) { if ( table.getSelection( ).length != 0 ) { int index = table.getSelectionIndex( ); String key = table.getSelection( )[0].getText( 0 ); ExtendedProperty property = propMap.get( key ); if ( property != null ) { extendedProperties.remove( property ); propMap.remove( key ); table.remove( table.getSelectionIndex( ) ); table.select( index<table.getItemCount( ) ?index:table.getItemCount( )- 1 ); } Control editor = editorValue.getEditor( ); if ( editor != null ) { editor.dispose( ); } } } else if ( e.getSource( ).equals( table ) ) { Control oldEditor = editorValue.getEditor( ); if ( oldEditor != null ) oldEditor.dispose( ); // Identify the selected row final TableItem item = (TableItem) e.item; if ( item == null ) { return; } // The control that will be the editor must be a child of the Table Text newEditor = new Text( table, SWT.NONE ); newEditor.setText( item.getText( 1 ) ); newEditor.addListener( SWT.FocusOut, new Listener( ) { public void handleEvent( Event event ) { Text text = (Text) event.widget; editorValue.getItem( ).setText( 1, text.getText( ) ); updateModel( item.getText( 0 ), text.getText( ) ); } } ); newEditor.selectAll( ); newEditor.setFocus( ); editorValue.setEditor( newEditor, item, 1 ); } btnRemove.setEnabled( !propDisabledMap.containsKey( table.getSelection( )[0].getText( 0 ) ) ); }
Example 20
Source File: TableCellEditorListener.java From Pydev with Eclipse Public License 1.0 | 4 votes |
/** * http://www.eclipse.org/swt/snippets/ */ @Override public void handleEvent(Event event) { final TableEditor editor = new TableEditor(table); editor.horizontalAlignment = SWT.LEFT; editor.grabHorizontal = true; Rectangle clientArea = table.getClientArea(); if (table.getSelection().length != 1) { return; } Rectangle bounds = table.getSelection()[0].getBounds(); Point pt = new Point(bounds.x, bounds.y); int index = table.getTopIndex(); while (index < table.getItemCount()) { boolean visible = false; final SimpleTableItem item = (SimpleTableItem) table.getItem(index); for (int i = 0; i < table.getColumnCount(); i++) { Rectangle rect = item.getBounds(i); if (rect.contains(pt)) { final Text text = new Text(table, SWT.NONE); Listener textListener = new TextListener(item, text); text.addListener(SWT.FocusOut, textListener); text.addListener(SWT.Traverse, textListener); text.addListener(SWT.FocusOut, wizard); editor.setEditor(text, item, i); text.setText(item.getText(i)); text.selectAll(); text.setFocus(); return; } if (!visible && rect.intersects(clientArea)) { visible = true; } } if (!visible) { return; } index++; } }