org.eclipse.jface.util.Util.isWin32()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(159)

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

Util.isWin32介绍

[英]Common WS query helper method.
[中]通用WS-query助手方法。

代码示例

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

/**
 * Background color intended for widgets that display text.
 * This color is compatible with with Gtk system themes, for example
 * on the white theme this color is white and on the dark theme it is dark.
 * <p>
 * Note, there is no need to free this color because it's a color managed by
 * the system not the application.
 * </p>
 *
 * @param display
 *            the display the color is from
 * @return Color most suitable for presenting text background depending on
 *         the platform, to match the rest of the environment.
 *
 * @since 3.13
 */
public static Color getInformationViewerBackgroundColor(Display display) {
  if (Util.isWin32() || Util.isCocoa()) {
    // Technically COLOR_INFO_* should only be used for tooltips. But on
    // Windows/Cocoa COLOR_INFO_* gives info viewers/hovers a
    // yellow background which is very suitable for information
    // presentation.
    return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
  }
  // Technically, COLOR_LIST_* is not the best system color for this
  // because it is only supposed to be used for Tree/List controls. But at
  // the moment COLOR_TEXT_* is not implemented, so this should work for
  // now. See Bug 508612.
  return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
}

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

if (Util.isWin32() || Util.isCocoa()) {

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

private void updateQuickAccessText() {
  if (txtQuickAccess == null || txtQuickAccess.isDisposed()) {
    return;
  }
  updateQuickAccessTriggerSequence();
  if (triggerSequence != null) {
    txtQuickAccess.setToolTipText(
        NLS.bind(QuickAccessMessages.QuickAccess_TooltipDescription, triggerSequence.format()));
  } else {
    txtQuickAccess.setToolTipText(QuickAccessMessages.QuickAccess_TooltipDescription_Empty);
  }
  GC gc = new GC(txtQuickAccess);
  // workaround for Bug 491317
  if (Util.isWin32() || Util.isGtk()) {
    FontMetrics fm = gc.getFontMetrics();
    int wHint = QuickAccessMessages.QuickAccess_EnterSearch.length() * fm.getAverageCharWidth();
    int hHint = fm.getHeight();
    gc.dispose();
    txtQuickAccess.setSize(txtQuickAccess.computeSize(wHint, hHint));
  } else {
    Point p = gc.textExtent(QuickAccessMessages.QuickAccess_EnterSearch);
    Rectangle r = txtQuickAccess.computeTrim(0, 0, p.x, p.y);
    gc.dispose();
    // computeTrim() may result in r.x < 0
    GridDataFactory.fillDefaults().hint(r.width - r.x, SWT.DEFAULT).applyTo(txtQuickAccess);
  }
  txtQuickAccess.requestLayout();
}

相关文章