org.eclipse.swt.widgets.Text#selectAll ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Text#selectAll ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: erflute   文件: ModelPropertiesDialog.java
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();
}
 
源代码2 项目: xtext-eclipse   文件: RenameElementWizard.java
@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);
}
 
源代码3 项目: ermasterr   文件: ModelPropertiesDialog.java
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();
}
 
源代码4 项目: ermaster-b   文件: ModelPropertiesDialog.java
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();
}
 
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);
}
 
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);
}
 
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));
}
 
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);
		}
	});
}
 
源代码9 项目: Pydev   文件: LabeledEdit.java
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);
}
 
源代码10 项目: xds-ide   文件: RenameRefactoringPage.java
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();
		}
	} );
}
 
源代码11 项目: ermasterr   文件: NoteEditManager.java
/**
 * {@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();
}
 
源代码12 项目: typescript.java   文件: RenameInputWizardPage.java
@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);
}
 
源代码13 项目: erflute   文件: WalkerNoteEditManager.java
@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();
}
 
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);
}
 
源代码15 项目: ermaster-b   文件: NoteEditManager.java
/**
 * {@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();
}
 
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);
}
 
private Text createTextInputField(Composite result) {
	final Text textField = new Text(result, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
	textField.selectAll();
	TextFieldNavigationHandler.install(textField);
	return textField;
}
 
源代码18 项目: RADL   文件: RadlNewWizardPage.java
private void focus(Text control) {
  setControl(control);
  control.selectAll();
}
 
源代码19 项目: birt   文件: ExtendedPropertyEditorComposite.java
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 ) ) );
}
 
源代码20 项目: Pydev   文件: TableCellEditorListener.java
/**
 * 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++;
    }
}