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

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

本文整理了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

  1. /**
  2. * Background color intended for widgets that display text.
  3. * This color is compatible with with Gtk system themes, for example
  4. * on the white theme this color is white and on the dark theme it is dark.
  5. * <p>
  6. * Note, there is no need to free this color because it's a color managed by
  7. * the system not the application.
  8. * </p>
  9. *
  10. * @param display
  11. * the display the color is from
  12. * @return Color most suitable for presenting text background depending on
  13. * the platform, to match the rest of the environment.
  14. *
  15. * @since 3.13
  16. */
  17. public static Color getInformationViewerBackgroundColor(Display display) {
  18. if (Util.isWin32() || Util.isCocoa()) {
  19. // Technically COLOR_INFO_* should only be used for tooltips. But on
  20. // Windows/Cocoa COLOR_INFO_* gives info viewers/hovers a
  21. // yellow background which is very suitable for information
  22. // presentation.
  23. return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
  24. }
  25. // Technically, COLOR_LIST_* is not the best system color for this
  26. // because it is only supposed to be used for Tree/List controls. But at
  27. // the moment COLOR_TEXT_* is not implemented, so this should work for
  28. // now. See Bug 508612.
  29. return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
  30. }

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

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

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

  1. private void updateQuickAccessText() {
  2. if (txtQuickAccess == null || txtQuickAccess.isDisposed()) {
  3. return;
  4. }
  5. updateQuickAccessTriggerSequence();
  6. if (triggerSequence != null) {
  7. txtQuickAccess.setToolTipText(
  8. NLS.bind(QuickAccessMessages.QuickAccess_TooltipDescription, triggerSequence.format()));
  9. } else {
  10. txtQuickAccess.setToolTipText(QuickAccessMessages.QuickAccess_TooltipDescription_Empty);
  11. }
  12. GC gc = new GC(txtQuickAccess);
  13. // workaround for Bug 491317
  14. if (Util.isWin32() || Util.isGtk()) {
  15. FontMetrics fm = gc.getFontMetrics();
  16. int wHint = QuickAccessMessages.QuickAccess_EnterSearch.length() * fm.getAverageCharWidth();
  17. int hHint = fm.getHeight();
  18. gc.dispose();
  19. txtQuickAccess.setSize(txtQuickAccess.computeSize(wHint, hHint));
  20. } else {
  21. Point p = gc.textExtent(QuickAccessMessages.QuickAccess_EnterSearch);
  22. Rectangle r = txtQuickAccess.computeTrim(0, 0, p.x, p.y);
  23. gc.dispose();
  24. // computeTrim() may result in r.x < 0
  25. GridDataFactory.fillDefaults().hint(r.width - r.x, SWT.DEFAULT).applyTo(txtQuickAccess);
  26. }
  27. txtQuickAccess.requestLayout();
  28. }

相关文章