org.eclipse.swt.widgets.Text.setSelection()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(225)

本文整理了Java中org.eclipse.swt.widgets.Text.setSelection()方法的一些代码示例,展示了Text.setSelection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Text.setSelection()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Text
类名称:Text
方法名:setSelection

Text.setSelection介绍

[英]Sets the selection.

Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.

Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N. This differs from other functions that address character position such as getText () that use the regular array indexing rules.
[中]设置选择。
索引是基于零的。选择的范围为0。。N其中N是小部件中的字符数。
根据插入符号位置指定文本选择。在包含N个字符的文本小部件中,有N+1个插入符号位置,范围为0。。N.这不同于其他处理字符位置的函数,例如使用常规数组索引规则的getText()。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public void setSelection( int i ) {
 wText.setSelection( i );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void setSelection( int i ) {
 wText.setSelection( i );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void addLog( String line ) {
 StringBuilder rest = new StringBuilder( XMLHandler.date2string( new Date() ) );
 rest.append( " : " );
 rest.append( line ).append( Const.CR );
 wLogging.append( rest.toString() );
 wLogging.setSelection( wLogging.getText().length() ); // make it scroll
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
protected Control createMessageArea( Composite composite ) {
 GridLayout gridLayout = (GridLayout) composite.getLayout();
 gridLayout.numColumns = 1;
 composite.setLayout( gridLayout );
 if ( this.message != null ) {
  this.messageLabel = new Label( composite, this.getMessageLabelStyle() );
  this.messageLabel.setText( this.message );
 }
 if ( this.details != null ) {
  this.detailsText = new Text( composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
  this.detailsText.pack();
  this.detailsText.setText( this.details );
  GridData gridData = new GridData( );
  gridData.widthHint = 1024;
  gridData.heightHint = 300;
  this.detailsText.setLayoutData( gridData );
  this.detailsText.setSelection( this.details.length() );
 }
 return composite;
}

代码示例来源:origin: pentaho/pentaho-kettle

wText.setSelection( wText.getText().length() );
 wText.showSelection();
} else if ( treeEntry.isJob() ) {
 wText.setSelection( wText.getText().length() );
 wText.showSelection();
} else {

代码示例来源:origin: pentaho/pentaho-kettle

protected void showKeySelection( String key ) {
 if ( !key.equals( selectedKey ) ) {
  applyChangedValue();
 }
 if ( selectedLocale != null && key != null && selectedMessagesPackage != null ) {
  String mainValue = store.lookupKeyValue( referenceLocale, selectedMessagesPackage, key );
  String value = store.lookupKeyValue( selectedLocale, selectedMessagesPackage, key );
  KeyOccurrence keyOccurrence = crawler.getKeyOccurrence( key, selectedMessagesPackage );
  wKey.setText( key );
  wMain.setText( Const.NVL( mainValue, "" ) );
  wValue.setText( Const.NVL( value, "" ) );
  wSource.setText( Const.NVL( keyOccurrence.getSourceLine(), "" ) );
  // Focus on the entry field
  // Put the cursor all the way at the back
  //
  wValue.setFocus();
  wValue.setSelection( wValue.getText().length() );
  wValue.showSelection();
  wValue.clearSelection();
  selectedKey = key;
  lastValueChanged = false;
  wApply.setEnabled( false );
  wRevert.setEnabled( false );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

text.setSelection( text.getText().length() );
 text.showSelection();
} else {

代码示例来源:origin: pentaho/pentaho-kettle

text.setSelection( text.getText().length() );
 text.showSelection();
} else {

代码示例来源:origin: pentaho/pentaho-kettle

wName.setSelection( 0, wName.getText().length() );

代码示例来源:origin: pentaho/pentaho-kettle

widget.selectAll();
widget.showSelection();
widget.setSelection( 0 );
widget.showSelection();
widget.setSelection( idx );

代码示例来源:origin: pentaho/pentaho-kettle

textWidget.setSelection( content.length() );

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

@Override
public void setControlContents(Control control, String text,
    int cursorPosition) {
  ((Text) control).setText(text);
  ((Text) control).setSelection(cursorPosition, cursorPosition);
}

代码示例来源:origin: org.eclipse.scout.sdk.s2e/org.eclipse.scout.sdk.s2e.nls

public void setValue(Object value) {
 String txt = m_smartFieldModel.getText(value);
 m_text.setText(txt);
 m_text.setSelection(0, txt.length());
 m_lastVerifiedInput = m_text.getText();
 fireInputChanged(value);
}

代码示例来源:origin: oyse/yedit

@Override
public boolean setFocus() {
  if (isOkToUse(fTextControl)) {
    fTextControl.setFocus();
    fTextControl.setSelection(0, fTextControl.getText().length());
  }
  return true;
}

代码示例来源:origin: org.eclipse.xtext/ui

@Override
public boolean setFocus() {
  if (isOkToUse(fTextControl)) {
    fTextControl.setFocus();
    fTextControl.setSelection(0, fTextControl.getText().length());
  }
  return true;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

@Override
public void insertControlContents(Control control, String text,
    int cursorPosition) {
  Point selection = ((Text) control).getSelection();
  ((Text) control).insert(text);
  // Insert will leave the cursor at the end of the inserted text. If this
  // is not what we wanted, reset the selection.
  if (cursorPosition < text.length()) {
    ((Text) control).setSelection(selection.x + cursorPosition,
        selection.x + cursorPosition);
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

public void insertControlContents(Control control, String text,
    int cursorPosition) {
  Point selection = ((Text) control).getSelection();
  ((Text) control).insert(text);
  // Insert will leave the cursor at the end of the inserted text. If this
  // is not what we wanted, reset the selection.
  if (cursorPosition < text.length()) {
    ((Text) control).setSelection(selection.x + cursorPosition,
        selection.x + cursorPosition);
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public void widgetSelected(SelectionEvent e) {
  fNameText.setEnabled(true);
  fNameText.setFocus();
  fNameText.setSelection(0, fNameText.getText().length());
  doValidation();
}
@Override

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
  protected void doSetFocus() {
    if (text != null) {
      text.setFocus();
      text.setSelection(text.getText().length());
      checkSelection();
      checkDeleteable();
      checkSelectable();
    }
  }
};

代码示例来源:origin: org.eclipse.mylyn.commons/workbench

public void open(OpenEvent event) {
  String text = getTextFromSelection(event.getSelection());
  if (text != null) {
    textSearchControl.getTextControl().setText(text);
    textControl.setSelection(text.length());
    textSearchControl.addToSearchHistory(text);
  }
  close();
}

相关文章

Text类方法