mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (drops obsolete Apple runtime checks)
This commit is contained in:
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.ide.FileIconPatcher;
|
||||
@@ -411,13 +397,13 @@ public class IconUtil {
|
||||
|
||||
@NotNull
|
||||
public static Icon scale(@NotNull final Icon source, double _scale) {
|
||||
final int hiDPIscale;
|
||||
final int hiDPIScale;
|
||||
if (source instanceof ImageIcon) {
|
||||
Image image = ((ImageIcon)source).getImage();
|
||||
hiDPIscale = RetinaImage.isAppleHiDPIScaledImage(image) || image instanceof JBHiDPIScaledImage ? 2 : 1;
|
||||
hiDPIScale = image instanceof JBHiDPIScaledImage ? 2 : 1;
|
||||
}
|
||||
else {
|
||||
hiDPIscale = 1;
|
||||
hiDPIScale = 1;
|
||||
}
|
||||
final double scale = Math.min(32, Math.max(.1, _scale));
|
||||
return new Icon() {
|
||||
@@ -439,12 +425,12 @@ public class IconUtil {
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return (int)(source.getIconWidth() * scale) / hiDPIscale;
|
||||
return (int)(source.getIconWidth() * scale) / hiDPIScale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return (int)(source.getIconHeight() * scale) / hiDPIscale;
|
||||
return (int)(source.getIconHeight() * scale) / hiDPIScale;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -567,7 +553,7 @@ public class IconUtil {
|
||||
}
|
||||
return createImageIcon((Image)img);
|
||||
}
|
||||
|
||||
|
||||
private static abstract class Filter {
|
||||
@NotNull
|
||||
abstract int[] convert(@NotNull int[] rgba);
|
||||
@@ -591,7 +577,7 @@ public class IconUtil {
|
||||
return new int[]{rgb >> 16 & 0xff, rgb >> 8 & 0xff, rgb & 0xff, rgba[3]};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class DesaturationFilter extends Filter {
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.progress.util;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -206,7 +192,7 @@ class ProgressDialog implements Disposable {
|
||||
|
||||
void enableCancelButtonIfNeeded(boolean enable) {
|
||||
if (!myProgressWindow.myShouldShowCancel) return;
|
||||
|
||||
|
||||
if (enable && !myProgressWindow.isCanceled()) {
|
||||
setCancelButtonEnabledASAP(true);
|
||||
} else {
|
||||
@@ -295,11 +281,6 @@ class ProgressDialog implements Disposable {
|
||||
? new MyDialogWrapper(myParentWindow, myProgressWindow.myShouldShowCancel)
|
||||
: new MyDialogWrapper(myProgressWindow.myProject, myProgressWindow.myShouldShowCancel);
|
||||
myPopup.setUndecorated(true);
|
||||
if (SystemInfo.isAppleJvm) {
|
||||
// With Apple JDK we look for MacMessage parent by the window title.
|
||||
// Let's set just the title as the window title for simplicity.
|
||||
myPopup.setTitle(myProgressWindow.getTitle());
|
||||
}
|
||||
if (myPopup.getPeer() instanceof DialogWrapperPeerImpl) {
|
||||
((DialogWrapperPeerImpl)myPopup.getPeer()).setAutoRequestFocus(false);
|
||||
if (isWriteActionProgress()) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.vfs.newvfs.impl;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -27,7 +13,6 @@ import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.roots.OrderEnumerator;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
@@ -128,10 +113,6 @@ public class VfsRootAccess {
|
||||
|
||||
String javaHome = SystemProperties.getJavaHome();
|
||||
allowed.add(FileUtil.toSystemIndependentName(javaHome));
|
||||
if (SystemInfo.isMac && SystemInfo.isAppleJvm) {
|
||||
// Apple SDK has jars in the folder _next_ to the java.home
|
||||
allowed.add(FileUtil.toSystemIndependentName(new File(new File(javaHome).getParent(), "Classes").getPath()));
|
||||
}
|
||||
allowed.add(FileUtil.toSystemIndependentName(new File(FileUtil.getTempDirectory()).getParent()));
|
||||
allowed.add(FileUtil.toSystemIndependentName(System.getProperty("java.io.tmpdir")));
|
||||
allowed.add(FileUtil.toSystemIndependentName(SystemProperties.getUserHome()));
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.wm.impl
|
||||
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.ModificationTracker
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.wm.WindowManager
|
||||
import com.intellij.openapi.wm.impl.WindowManagerImpl.FrameBoundsConverter.convertToDeviceSpace
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
@@ -67,9 +64,7 @@ fun WindowManagerImpl.getFrameInfoInDeviceSpace(project: Project): FrameInfo? {
|
||||
val frameInfo = FrameInfo()
|
||||
// save bounds even if maximized because on unmaximize we must restore previous frame bounds
|
||||
frameInfo.bounds = convertToDeviceSpace(frame.graphicsConfiguration, myDefaultFrameInfo.bounds!!)
|
||||
if (!(frame.isInFullScreen && SystemInfo.isAppleJvm)) {
|
||||
frameInfo.extendedState = extendedState
|
||||
}
|
||||
frameInfo.extendedState = extendedState
|
||||
|
||||
if (isFullScreenSupportedInCurrentOS) {
|
||||
frameInfo.fullScreen = frame.isInFullScreen
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
/* -*-mode:java; c-basic-offset:2; -*- */
|
||||
|
||||
@@ -33,7 +19,6 @@ import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.util.JBHiDPIScaledImage;
|
||||
import com.intellij.util.RetinaImage;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.jediterm.terminal.TextStyle;
|
||||
import com.jediterm.terminal.model.StyleState;
|
||||
@@ -79,12 +64,12 @@ public class JBTerminalPanel extends TerminalPanel implements FocusListener, Ter
|
||||
"GotoBookmark7",
|
||||
"GotoBookmark8",
|
||||
"GotoBookmark9",
|
||||
|
||||
|
||||
"GotoAction",
|
||||
"GotoFile",
|
||||
"GotoClass",
|
||||
"GotoSymbol",
|
||||
|
||||
|
||||
"ShowSettings",
|
||||
"RecentFiles",
|
||||
"Switcher"
|
||||
@@ -215,9 +200,6 @@ public class JBTerminalPanel extends TerminalPanel implements FocusListener, Ter
|
||||
newG.scale(1, 1);
|
||||
newG.dispose();
|
||||
}
|
||||
else if (RetinaImage.isAppleHiDPIScaledImage(image)) {
|
||||
g.drawImage(image, dx1, dy1, dx2, dy2, sx1 * 2, sy1 * 2, sx2 * 2, sy2 * 2, observer);
|
||||
}
|
||||
else {
|
||||
g.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
|
||||
}
|
||||
|
||||
@@ -1,28 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ui.messages;
|
||||
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.impl.ModalityHelper;
|
||||
import com.intellij.ui.MessageException;
|
||||
import com.intellij.ui.mac.MacMessagesEmulation;
|
||||
import com.intellij.ui.mac.foundation.MacUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -144,11 +128,6 @@ public class JBMacMessages extends MacMessagesEmulation {
|
||||
}
|
||||
}
|
||||
|
||||
if (SystemInfo.isAppleJvm && MacUtil.getWindowTitle(_window) == null) {
|
||||
// With Apple JDK we cannot find a window if it does not have a title
|
||||
// Let's show a dialog instead of the message.
|
||||
throw new MessageException("MacMessage parent does not have a title.");
|
||||
}
|
||||
while (_window != null && MacUtil.getWindowTitle(_window) == null) {
|
||||
_window = _window.getOwner();
|
||||
//At least our frame should have a title
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory;
|
||||
@@ -53,7 +51,6 @@ import com.intellij.ui.tree.AsyncTreeModel;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
import com.intellij.util.concurrency.AppScheduledExecutorService;
|
||||
import java.util.HashMap;
|
||||
import com.intellij.util.io.ZipUtil;
|
||||
import com.intellij.util.ref.GCUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -604,8 +601,7 @@ public class PlatformTestUtil {
|
||||
|
||||
@NotNull
|
||||
public static String getRtJarPath() {
|
||||
String home = SystemProperties.getJavaHome();
|
||||
return SystemInfo.isAppleJvm ? FileUtil.toCanonicalPath(home + "/../Classes/classes.jar") : home + "/lib/rt.jar";
|
||||
return SystemProperties.getJavaHome() + "/lib/rt.jar";
|
||||
}
|
||||
|
||||
public static void saveProject(@NotNull Project project) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util;
|
||||
|
||||
import apple.awt.CImage;
|
||||
@@ -5,9 +6,7 @@ import apple.awt.CImage;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
/** @deprecated Apple JRE is no longer supported (to be removed in IDEA 2019) */
|
||||
public class AppleHiDPIScaledImage {
|
||||
public static BufferedImage create(int width, int height, int imageType) {
|
||||
return new CImage.HiDPIScaledImage(width, height, imageType) {
|
||||
|
||||
@@ -1,23 +1,6 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -64,16 +47,7 @@ public class RetinaImage { // [tav] todo: create HiDPIImage class
|
||||
public static Image createFrom(Image image, final double scale, ImageObserver observer) {
|
||||
int w = image.getWidth(observer);
|
||||
int h = image.getHeight(observer);
|
||||
|
||||
Image hidpi = new JBHiDPIScaledImage(image, w / scale, h / scale, BufferedImage.TYPE_INT_ARGB);
|
||||
if (SystemInfo.isAppleJvm) {
|
||||
Graphics2D g = (Graphics2D)hidpi.getGraphics();
|
||||
g.scale(1f / scale, 1f / scale);
|
||||
g.drawImage(image, 0, 0, null);
|
||||
g.dispose();
|
||||
}
|
||||
|
||||
return hidpi;
|
||||
return new JBHiDPIScaledImage(image, w / scale, h / scale, BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -91,7 +65,8 @@ public class RetinaImage { // [tav] todo: create HiDPIImage class
|
||||
return new JBHiDPIScaledImage(gc, width, height, type);
|
||||
}
|
||||
|
||||
public static boolean isAppleHiDPIScaledImage(Image image) {
|
||||
return UIUtil.isAppleRetina() && AppleHiDPIScaledImage.is(image);
|
||||
/** @deprecated Apple JRE is no longer supported (to be removed in IDEA 2019) */
|
||||
public static boolean isAppleHiDPIScaledImage(@SuppressWarnings("unused") Image image) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,8 +195,9 @@ public class UIUtil {
|
||||
return isUnderDarcula() ? DARCULA_GRAY_FILTER : DEFAULT_GRAY_FILTER;
|
||||
}
|
||||
|
||||
/** @deprecated Apple JRE is no longer supported (to be removed in IDEA 2019) */
|
||||
public static boolean isAppleRetina() {
|
||||
return isRetina() && SystemInfo.isAppleJvm;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Couple<Color> getCellColors(JTable table, boolean isSel, int row, int column) {
|
||||
@@ -412,7 +413,7 @@ public class UIUtil {
|
||||
}
|
||||
}
|
||||
if (SystemInfo.isMac) {
|
||||
jreHiDPI = !SystemInfo.isAppleJvm;
|
||||
jreHiDPI = true;
|
||||
}
|
||||
return jreHiDPI;
|
||||
}
|
||||
@@ -441,12 +442,9 @@ public class UIUtil {
|
||||
* value that has been got on AppKit previously.
|
||||
*/
|
||||
static boolean isOracleMacRetinaDevice (GraphicsDevice device) {
|
||||
|
||||
if (SystemInfo.isAppleJvm) return false;
|
||||
|
||||
Boolean isRetina = devicesToRetinaSupportCacheMap.get(device);
|
||||
|
||||
if (isRetina != null){
|
||||
if (isRetina != null) {
|
||||
return isRetina;
|
||||
}
|
||||
|
||||
@@ -481,28 +479,8 @@ public class UIUtil {
|
||||
return isRetina;
|
||||
}
|
||||
|
||||
/*
|
||||
Could be quite easily implemented with [NSScreen backingScaleFactor]
|
||||
and JNA
|
||||
*/
|
||||
//private static boolean isAppleRetina (Graphics2D g2d) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
/**
|
||||
* For JDK6 we have a dedicated property which does not allow to understand anything
|
||||
* per device but could be useful for image creation. We will get true in case
|
||||
* if at least one retina device is present.
|
||||
*/
|
||||
private static boolean hasAppleRetinaDevice() {
|
||||
return (Float)Toolkit.getDefaultToolkit()
|
||||
.getDesktopProperty(
|
||||
"apple.awt.contentScaleFactor") != 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method perfectly detects retina Graphics2D for jdk7+
|
||||
* For Apple JDK6 it returns false.
|
||||
* @param g graphics to be tested
|
||||
* @return false if the device of the Graphics2D is not a retina device,
|
||||
* jdk is an Apple JDK or Oracle API has been changed.
|
||||
@@ -520,10 +498,6 @@ public class UIUtil {
|
||||
* @return true if at least one device is a retina device
|
||||
*/
|
||||
private static boolean isRetina() {
|
||||
if (SystemInfo.isAppleJvm) {
|
||||
return hasAppleRetinaDevice();
|
||||
}
|
||||
|
||||
// Oracle JDK
|
||||
|
||||
if (SystemInfo.isMac) {
|
||||
|
||||
Reference in New Issue
Block a user