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

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

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

Text.getStyle介绍

暂无

代码示例

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

private static String[] getAllowedStyles( Text text ) {
 return ( text.getStyle() & SWT.SEARCH ) != 0 ? ALLOWED_STYLES_WITH_SEARCH : ALLOWED_STYLES;
}

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

private static AbstractTextDelegateLCA getLCADelegate( final Widget widget ) {
  AbstractTextDelegateLCA result;
  int style = ( ( Text )widget ).getStyle();
  if( ( style & SWT.PASSWORD ) != 0 ) {
   result = PASSWORD;
  } else if( ( style & SWT.SINGLE ) != 0 ) {
   result = SINGLE;
  } else if( ( style & SWT.MULTI ) != 0 ) {
   result = MULTI;
  } else {
   result = SINGLE;
  }
  return result;
 }
}

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

private static boolean useNativeSearchField(Composite composite) {
  if (fgUseNativeSearchField == null) {
    fgUseNativeSearchField= Boolean.FALSE;
    Text testText= null;
    try {
      testText= new Text(composite, SWT.SEARCH | SWT.ICON_CANCEL);
      fgUseNativeSearchField= Boolean.valueOf((testText.getStyle() & SWT.ICON_CANCEL) != 0);
    } finally {
      if (testText != null) {
        testText.dispose();
      }
    }
  }
  return fgUseNativeSearchField.booleanValue();
}

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

private static boolean useNativeSearchField(Composite composite) {
  if (fgUseNativeSearchField == null) {
    fgUseNativeSearchField= Boolean.FALSE;
    Text testText= null;
    try {
      testText= new Text(composite, SWT.SEARCH | SWT.ICON_CANCEL);
      fgUseNativeSearchField= Boolean.valueOf((testText.getStyle() & SWT.ICON_CANCEL) != 0);
    } finally {
      if (testText != null) {
        testText.dispose();
      }
    }
  }
  return fgUseNativeSearchField.booleanValue();
}

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

private static boolean useNativeSearchField(Composite composite) {
  if (useNativeSearchField == null) {
    useNativeSearchField = Boolean.FALSE;
    Text testText = null;
    try {
      testText = new Text(composite, SWT.SEARCH | SWT.ICON_CANCEL);
      useNativeSearchField = Boolean.valueOf((testText.getStyle() & SWT.ICON_CANCEL) != 0);
    } finally {
      if (testText != null) {
        testText.dispose();
      }
    }
  }
  return useNativeSearchField.booleanValue();
}

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

private static boolean useNativeSearchField(boolean automaticFind, Composite parent) {
  if (parent != null) {
    if (useNativeSearchField == null) {
      useNativeSearchField = Boolean.FALSE;
      Text testText = null;
      try {
        int style = SWT.SEARCH | ICON_CANCEL;
        if (automaticFind) {
          style |= ICON_SEARCH;
        }
        testText = new Text(parent, style);
        useNativeSearchField = new Boolean((testText.getStyle() & ICON_CANCEL) != 0
            && (!automaticFind || (testText.getStyle() & ICON_SEARCH) != 0));
      } finally {
        if (testText != null) {
          testText.dispose();
        }
      }
    }
  } else {
    useNativeSearchField = Boolean.FALSE;
  }
  return useNativeSearchField.booleanValue();
}

代码示例来源:origin: org.eclipse.e4.ui.css/swt

protected String computeAttributeType() {
  Widget widget = getWidget();
  if (widget instanceof Button) {
    Button button = (Button) widget;
    int style = button.getStyle();
    if ((style | SWT.RADIO) == style)
      return "radio";
    if ((style | SWT.CHECK) == style)
      return "checkbox";
    return "button";
  }
  if (widget instanceof Text) {
    Text text = (Text) widget;
    if ((text.getStyle() & SWT.PASSWORD) != 0)
      return "password";
    else if ((text.getStyle() & SWT.MULTI) != 0)
      return "";
    else
      return "text";
  }
  return "";
}

代码示例来源:origin: io.sarl/io.sarl.eclipse

@Override
  public void keyTraversed(TraverseEvent event) {
    switch (event.detail) {
    case SWT.TRAVERSE_ESCAPE:
    case SWT.TRAVERSE_PAGE_NEXT:
    case SWT.TRAVERSE_PAGE_PREVIOUS:
      event.doit = true;
      break;
    case SWT.TRAVERSE_RETURN:
    case SWT.TRAVERSE_TAB_NEXT:
    case SWT.TRAVERSE_TAB_PREVIOUS:
      if ((SARLArgumentsTab.this.sreArgumentsText.getStyle() & SWT.SINGLE) != 0) {
        event.doit = true;
      } else {
        if (!SARLArgumentsTab.this.sreArgumentsText.isEnabled() || (event.stateMask & SWT.MODIFIER_MASK) != 0) {
          event.doit = true;
        }
      }
      break;
    default:
    }
  }
});

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

static void writeWrap( final Text text ) throws IOException {
 JSWriter writer = JSWriter.getWriterFor( text );
 Boolean value = Boolean.valueOf( ( text.getStyle() & SWT.WRAP ) != 0 );
 writer.set( "wrap", value );
}

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

public void handleNotifySelection( Text text, JsonObject properties ) {
 if( ( text.getStyle() & SWT.MULTI ) == 0 ) {
  Event event = createSelectionEvent( SWT.Selection, properties );
  text.notifyListeners( SWT.Selection, event );
 }
}

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

public void handleNotifyDefaultSelection( Text text, JsonObject properties ) {
 if( ( text.getStyle() & SWT.MULTI ) == 0 ) {
  Event event = createSelectionEvent( SWT.DefaultSelection, properties );
  text.notifyListeners( SWT.DefaultSelection, event );
 }
}

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

@Override
protected Text doCreateFilterText(Composite parent) {
  // Overridden so the text gets create using the toolkit if we have one
  Text parentText = super.doCreateFilterText(parent);
  if (fToolkit != null) {
    int style = parentText.getStyle();
    parentText.dispose();
    return fToolkit.createText(parent, null, style);
  }
  return parentText;
}

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

protected Text doCreateFilterText(Composite actParent) {
  // Overridden so the text gets create using the toolkit if we have one
  Text parentText = super.doCreateFilterText(actParent);
  if (fToolkit != null) {
    int style = parentText.getStyle();
    parentText.dispose();
    return fToolkit.createText(actParent, null, style);
  }
  return parentText;
}

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

protected void keyReleaseOccured(KeyEvent keyEvent) {
  if (keyEvent.character == '\r') { // Return key
    // Enter is handled in handleDefaultSelection.
    // Do not apply the editor value in response to an Enter key event
    // since this can be received from the IME when the intent is -not-
    // to apply the value.  
    // See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus event from Text Control
    //
    // An exception is made for Ctrl+Enter for multi-line texts, since
    // a default selection event is not sent in this case. 
    if (text != null && !text.isDisposed()
        && (text.getStyle() & SWT.MULTI) != 0) {
      if ((keyEvent.stateMask & SWT.CTRL) != 0) {
        super.keyReleaseOccured(keyEvent);
      }
    }
    return;
  }
  super.keyReleaseOccured(keyEvent);
}

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

static void writeAlignment( final Text text ) throws IOException {
 int style = text.getStyle();
 if( ( style & SWT.RIGHT ) != 0 ) {
  JSWriter writer = JSWriter.getWriterFor( text );
  writer.set( JS_PROP_TEXT_ALIGN, "right" );
 } else if( ( style & SWT.CENTER ) != 0 ) {
  JSWriter writer = JSWriter.getWriterFor( text );
  writer.set( JS_PROP_TEXT_ALIGN, "center" );
 }
}

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

@Override
protected void keyReleaseOccured(KeyEvent keyEvent) {
  if (keyEvent.character == '\r') { // Return key
    // Enter is handled in handleDefaultSelection.
    // Do not apply the editor value in response to an Enter key event
    // since this can be received from the IME when the intent is -not-
    // to apply the value.
    // See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus event from Text Control
    //
    // An exception is made for Ctrl+Enter for multi-line texts, since
    // a default selection event is not sent in this case.
    if (text != null && !text.isDisposed()
        && (text.getStyle() & SWT.MULTI) != 0) {
      if ((keyEvent.stateMask & SWT.CTRL) != 0) {
        super.keyReleaseOccured(keyEvent);
      }
    }
    return;
  }
  super.keyReleaseOccured(keyEvent);
}

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

@Override
protected void keyReleaseOccured(KeyEvent keyEvent) {
  if (keyEvent.character == '\r') { // Return key
    // Enter is handled in handleDefaultSelection.
    // Do not apply the editor value in response to an Enter key event
    // since this can be received from the IME when the intent is -not-
    // to apply the value.
    // See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus event from Text Control
    //
    // An exception is made for Ctrl+Enter for multi-line texts, since
    // a default selection event is not sent in this case.
    if (text != null && !text.isDisposed()
        && (text.getStyle() & SWT.MULTI) != 0) {
      if ((keyEvent.stateMask & SWT.CTRL) != 0) {
        super.keyReleaseOccured(keyEvent);
      }
    }
    return;
  }
  super.keyReleaseOccured(keyEvent);
}

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

@Override
  public void setEnabled(boolean enabled) {
    if ((filterText.getStyle() & SWT.ICON_CANCEL) == 0) { // filter uses FilteredTree new look, not native
      int filterColor = enabled ? SWT.COLOR_LIST_BACKGROUND : SWT.COLOR_WIDGET_BACKGROUND;
      filterComposite.setBackground(getDisplay().getSystemColor(filterColor));
    }
    filterText.setEnabled(enabled);
    treeViewer.getTree().setEnabled(enabled);

  }
}

代码示例来源:origin: org.codehaus.openxma/xmartclient

/**
 * Implementation of the focus events.
 * The focusControl on the dialog and the error message in the status bar are updated.
 * The focus lost event is propagated via {@link #widgetEvent()}.
 *
 * @param event the SWT-Event that happened.
 * @param type the type of the Event, as defined by the event type constants in class SWT.
 */
void focusEvent(FocusEvent event, int type) {
  if(type==SWT.FocusIn) {
    getDialog().setFocusControl((Control)event.widget);
    getDialog().updateErrorStatus(event.widget);
    if(event.widget instanceof Text) {       // select single line texts on focus in
      Text text = (Text) event.widget;     // caused by keystroke-navigation
      if((text.getStyle()&SWT.MULTI)==0) { // it does not select the text on mouse-click
        text.setSelection(0,text.getText().length()+1);
      }
    }
  } else if(type==SWT.FocusOut) {
    getDialog().setFocusControl(null);
    widgetEvent(event,SWT.FocusOut);
  }
}

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

@Override
protected Text doCreateFilterText(Composite parent) {
  int borderStyle = toolkit.getBorderStyle();
  toolkit.setBorderStyle(SWT.NONE); // we don't want Forms border around tree filter
  Text temp = super.doCreateFilterText(parent);
  int style = temp.getStyle();
  temp.dispose();
  fEntryFilter = new FormEntry(parent, toolkit, null, style);
  toolkit.setBorderStyle(borderStyle); // restore Forms border settings
  setBackground(toolkit.getColors().getBackground());
  return fEntryFilter.getText();
}

相关文章

微信公众号

最新文章

更多

Text类方法