Handy isXWindow property

This commit is contained in:
Roman Shevchenko
2012-11-02 14:17:17 +01:00
parent d40b7a6c04
commit 5e5208fbfa
6 changed files with 14 additions and 21 deletions
@@ -290,7 +290,7 @@ public class InitialConfigurationDialog extends DialogWrapper {
return SystemInfo.isMac;
}
else if (KeymapManager.X_WINDOW_KEYMAP.equals(name) || "Default for GNOME".equals(name) || "Default for KDE".equals(name)) {
return SystemInfo.isUnix && !SystemInfo.isMac;
return SystemInfo.isXWindow;
}
return true;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,7 @@ import java.util.Map;
public class ScreenUtil {
@Nullable private static final Map<GraphicsConfiguration, Pair<Insets, Long>> ourInsetsCache;
static {
final boolean useCache = (SystemInfo.isLinux || SystemInfo.isSolaris)
&& !GraphicsEnvironment.isHeadless();
final boolean useCache = SystemInfo.isXWindow && !GraphicsEnvironment.isHeadless();
ourInsetsCache = useCache ? new WeakHashMap<GraphicsConfiguration, Pair<Insets, Long>>() : null;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
/**
* Author: msk
* @author msk
*/
public class PasteFromX11Action extends EditorAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.actions.PasteFromX11Action");
@@ -52,7 +52,7 @@ public class PasteFromX11Action extends EditorAction {
Presentation presentation = e.getPresentation();
DataContext dataContext = e.getDataContext();
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
if (editor == null || !SystemInfo.X11PasteEnabledSystem) {
if (editor == null || !SystemInfo.isXWindow) {
presentation.setEnabled(false);
}
else {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,11 +26,8 @@ import org.jdom.Element;
import java.awt.event.MouseEvent;
/**
* Created by IntelliJ IDEA.
* User: max
* Date: Nov 21, 2003
* Time: 9:00:35 PM
* To change this template use Options | File Templates.
* @author max
* @since Nov 21, 2003
*/
class DefaultKeymapImpl extends KeymapImpl {
public boolean canModify() {
@@ -44,7 +41,7 @@ class DefaultKeymapImpl extends KeymapImpl {
public void readExternal(Element keymapElement, Keymap[] existingKeymaps) throws InvalidDataException {
super.readExternal(keymapElement, existingKeymaps);
if (KeymapManager.DEFAULT_IDEA_KEYMAP.equals(getName()) && !SystemInfo.X11PasteEnabledSystem) {
if (KeymapManager.DEFAULT_IDEA_KEYMAP.equals(getName()) && !SystemInfo.isXWindow) {
addShortcut(IdeActions.ACTION_GOTO_DECLARATION, new MouseShortcut(MouseEvent.BUTTON2, 0, 1));
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ public class Patches {
* See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6322854.
* java.lang.NullPointerException: Failed to retrieve atom name.
*/
public static final boolean SUN_BUG_ID_6322854 = SystemInfo.isUnix && !SystemInfo.isMac;
public static final boolean SUN_BUG_ID_6322854 = SystemInfo.isXWindow;
/**
* See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4218084.
@@ -46,6 +46,7 @@ public class SystemInfo extends SystemInfoRt {
public static final boolean isFreeBSD = _OS_NAME.startsWith("freebsd");
public static final boolean isSolaris = _OS_NAME.startsWith("sunos");
public static final boolean isUnix = SystemInfoRt.isUnix;
public static final boolean isXWindow = isUnix && !isMac;
/** @deprecated inaccurate (to remove in IDEA 13) */
public static final boolean isKDE = SUN_DESKTOP.toLowerCase().contains("kde");
@@ -146,12 +147,8 @@ public class SystemInfo extends SystemInfoRt {
*/
public static final boolean isMacOSMountainLion = isMountainLion();
/**
* Operating system is supposed to have middle mouse button click occupied by paste action.
*
* @since 6.0
*/
public static boolean X11PasteEnabledSystem = isUnix && !isMac;
/** @deprecated use {@linkplain #isXWindow} (to remove in IDEA 13) */
public static boolean X11PasteEnabledSystem = isXWindow;
private static boolean isIntelMac() {
return isMac && "i386".equals(OS_ARCH);