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

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

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

Text.getCharCount介绍

[英]Returns the number of characters.
[中]返回字符数。

代码示例

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

@Override
public boolean isSelectAllEnabled() {
  if (text == null || text.isDisposed())
    return false;
  return text.getCharCount() > 0;
}

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

@Override
public boolean isSelectAllEnabled() {
  if (text == null || text.isDisposed())
    return false;
  return text.getCharCount() > 0;
}

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

public boolean isSelectAllEnabled() {
  if (text == null || text.isDisposed())
    return false;
  return text.getCharCount() > 0;
}

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

@Override
  public void focusGained(FocusEvent e) {
    fControl.setSelection(0, fControl.getCharCount());
  }
});

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

protected void focusGained() {
  fOldSelected= fSelected;
  fNumberText.setSelection(0, fNumberText.getCharCount());
}

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

protected void focusGained() {
  fOldSelected= fSelected;
  fNumberText.setSelection(0, fNumberText.getCharCount());
}

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

protected void focusGained() {
  fOldSelected= fSelected;
  fText.setSelection(0, fText.getCharCount());
}

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

protected void focusGained() {
  fOldSelected= fSelected;
  fNumberText.setSelection(0, fNumberText.getCharCount());
}

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

protected void focusGained() {
  fOldSelected= fSelected;
  fText.setSelection(0, fText.getCharCount());
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

NSString getInsertString (String string, NSRange range) {
  NSString str;
  int charCount = getCharCount ();
  int length = string.length ();
  int selectionLength = range != null ? (int)/*64*/(range.length) : 0;
  if (charCount - selectionLength + length > textLimit) {
    length = textLimit - charCount + selectionLength;
    length = Math.max (0, length);
  }
  char [] buffer = new char [length];
  string.getChars (0, buffer.length, buffer, 0);
  str = NSString.stringWithCharacters (buffer, buffer.length);
  return str;
}

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

@Override
  public void verifyText(VerifyEvent e) {
    if (fCanModifyPackage && ! fEnclosingTypeSelection.isSelected() && e.start == 0 && e.end == ((Text) e.widget).getCharCount()) {
      String typeNameWithoutParameters= getTypeNameWithoutParameters(getTypeNameWithoutExtension(e.text));
      int lastDot= typeNameWithoutParameters.lastIndexOf('.');
      if (lastDot == -1 || lastDot == typeNameWithoutParameters.length() - 1)
        return;
      
      String pack= typeNameWithoutParameters.substring(0, lastDot);
      if (validatePackageName(pack, null).getSeverity() == IStatus.ERROR)
        return;
      
      fPackageDialogField.setText(pack);
      e.text= e.text.substring(lastDot + 1);
    }
  }
});

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

@Override
  public void verifyText(VerifyEvent e) {
    if (fCanModifyPackage && ! fEnclosingTypeSelection.isSelected() && e.start == 0 && e.end == ((Text) e.widget).getCharCount()) {
      String typeNameWithoutParameters= getTypeNameWithoutParameters(e.text);
      int lastDot= typeNameWithoutParameters.lastIndexOf('.');
      if (lastDot == -1 || lastDot == typeNameWithoutParameters.length() - 1)
        return;
      
      String pack= typeNameWithoutParameters.substring(0, lastDot);
      if (validatePackageName(pack, null).getSeverity() == IStatus.ERROR)
        return;
      
      fPackageDialogField.setText(pack);
      e.text= e.text.substring(lastDot + 1);
    }
  }
});

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

public boolean isDeleteEnabled() {
  if (text == null || text.isDisposed())
    return false;
  return text.getSelectionCount() > 0
      || text.getCaretPosition() < text.getCharCount();
}

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

@Override
public boolean isDeleteEnabled() {
  if (text == null || text.isDisposed())
    return false;
  return text.getSelectionCount() > 0
      || text.getCaretPosition() < text.getCharCount();
}

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

@Override
public boolean isDeleteEnabled() {
  if (text == null || text.isDisposed())
    return false;
  return text.getSelectionCount() > 0
      || text.getCaretPosition() < text.getCharCount();
}

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

/**
 * The <code>TextCellEditor</code>  implementation of this
 * <code>CellEditor</code> method returns <code>true</code>
 * if there is a selection or if the caret is not positioned
 * at the end of the text.
 */
@Override
public boolean isDeleteEnabled() {
  if (text == null || text.isDisposed()) {
    return false;
  }
  return text.getSelectionCount() > 0
      || text.getCaretPosition() < text.getCharCount();
}

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

/**
 * The <code>TextCellEditor</code>  implementation of this
 * <code>CellEditor</code> method returns <code>true</code>
 * if there is a selection or if the caret is not positioned
 * at the end of the text.
 */
@Override
public boolean isDeleteEnabled() {
  if (text == null || text.isDisposed()) {
    return false;
  }
  return text.getSelectionCount() > 0
      || text.getCaretPosition() < text.getCharCount();
}

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

/**
   * Update the state.
   */
  public void updateEnabledState() {
    if (activeTextControl != null && !activeTextControl.isDisposed()) {
      setEnabled(activeTextControl.getCharCount() > 0);
      return;
    }
    if (selectAllAction != null) {
      setEnabled(selectAllAction.isEnabled());
      return;
    }
    setEnabled(false);
  }
}

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

private void showGoToAddressComposite() {
  String selectedStr = getSelectedAsString();
  Text text = fGoToAddressComposite.getExpressionWidget();
  text.setText(selectedStr);
  text.setSelection(0, text.getCharCount());
  double height = fGoToAddressComposite.getHeight();
  double canvasHeight = fSashForm.getParent().getClientArea().height;
  double tableHeight = canvasHeight - height;
  double tableWeight = (tableHeight / canvasHeight) * 100;
  double textWeight = (height / canvasHeight) * 100;
  fSashForm.setWeights(new int[] { (int) tableWeight, (int) textWeight });
  fSashForm.setMaximizedControl(null);
  fGoToAddressComposite.getExpressionWidget().setFocus();
}

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

public void performDelete() {
  if (text.getSelectionCount() > 0)
    // remove the contents of the current selection
    text.insert(""); //$NON-NLS-1$
  else {
    // remove the next character
    int pos = text.getCaretPosition();
    if (pos < text.getCharCount()) {
      text.setSelection(pos, pos + 1);
      text.insert(""); //$NON-NLS-1$
    }
  }
  checkSelection();
  checkDeleteable();
  checkSelectable();
}

相关文章

微信公众号

最新文章

更多

Text类方法