Java Code Examples for com.intellij.openapi.util.SystemInfo#isMacOSSnowLeopard()

The following examples show how to use com.intellij.openapi.util.SystemInfo#isMacOSSnowLeopard() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MouseGestureManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void add(final IdeFrame frame) {
  if (!Registry.is("actionSystem.mouseGesturesEnabled")) return;

  if (SystemInfo.isMacOSSnowLeopard) {
    try {
      if (myListeners.containsKey(frame)) {
        remove(frame);
      }

      Object listener = new MacGestureAdapter(this, frame);

      myListeners.put(frame, listener);
    }
    catch (Throwable e) {
      LOG.debug(e);
    }
  }
}
 
Example 2
Source File: MouseGestureManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void remove(IdeFrame frame) {
  if (!Registry.is("actionSystem.mouseGesturesEnabled")) return;

  if (SystemInfo.isMacOSSnowLeopard) {
    try {
      Object listener = myListeners.get(frame);
      JComponent cmp = frame.getComponent();
      myListeners.remove(frame);
      if (listener != null && cmp != null && cmp.isShowing()) {
        ((MacGestureAdapter)listener).remove(cmp);
      }
    }
    catch (Throwable e) {
      LOG.debug(e);
    }
  }

}
 
Example 3
Source File: MacUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void adjustFocusTraversal(@Nonnull Disposable disposable) {
  if (!SystemInfo.isMacOSSnowLeopard) return;
  final AWTEventListener listener = new AWTEventListener() {
    @Override
    public void eventDispatched(AWTEvent event) {
      if (event instanceof KeyEvent && ((KeyEvent)event).getKeyCode() == KeyEvent.VK_TAB && (!(event.getSource() instanceof JTextComponent)) && (!(event.getSource() instanceof JList)) && !isFullKeyboardAccessEnabled())
        ((KeyEvent)event).consume();
    }
  };
  Disposer.register(disposable, new Disposable() {
    @Override
    public void dispose() {
      Toolkit.getDefaultToolkit().removeAWTEventListener(listener);
    }
  });
  Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
}
 
Example 4
Source File: FontPreferences.java    From consulo with Apache License 2.0 5 votes vote down vote up
static String getDefaultFontName() {
  if (SystemInfo.isWindows) return WINDOWS_DEFAULT_FONT_FAMILY;
  if (SystemInfo.isMacOSSnowLeopard) return MAC_OS_DEFAULT_FONT_FAMILY;
  if (SystemInfo.isXWindow && !GraphicsEnvironment.isHeadless() && !ApplicationManager.getApplication().isCommandLine()) {
    for (Font font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()) {
      if (LINUX_DEFAULT_FONT_FAMILY.equals(font.getName())) {
        return font.getFontName();
      }
    }
  }
  return FALLBACK_FONT_FAMILY;
}
 
Example 5
Source File: BrowserUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static boolean isOpenCommandSupportArgs() {
  return SystemInfo.isMacOSSnowLeopard;
}
 
Example 6
Source File: MacUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static boolean isFullKeyboardAccessEnabled() {
  if (!SystemInfo.isMacOSSnowLeopard) return false;
  final AtomicBoolean result = new AtomicBoolean();
  executeOnMainThread(true, true, () -> result.set(invoke(invoke("NSApplication", "sharedApplication"), "isFullKeyboardAccessEnabled").intValue() == 1));
  return result.get();
}