--- old/src/java.desktop/macosx/classes/com/apple/eawt/Application.java 2015-03-04 18:15:39.000000000 +0300
+++ new/src/java.desktop/macosx/classes/com/apple/eawt/Application.java 2015-03-04 18:15:39.000000000 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,18 @@
package com.apple.eawt;
-import java.awt.*;
-import java.awt.peer.*;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.PopupMenu;
+import java.awt.Toolkit;
+import java.awt.Window;
import java.beans.Beans;
import javax.swing.JMenuBar;
-import sun.lwawt.*;
-import sun.lwawt.macosx.*;
+import sun.awt.AWTAccessor;
+import sun.lwawt.LWWindowPeer;
+import sun.lwawt.macosx.CPlatformWindow;
/**
* The Application
class allows you to integrate your Java application with the native Mac OS X environment.
@@ -385,10 +389,8 @@
*
* @since Java for Mac OS X 10.7 Update 1
*/
- @SuppressWarnings("deprecation")
public void requestToggleFullScreen(final Window window) {
- final ComponentPeer peer = window.getPeer();
-
+ final Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
if (!(peer instanceof LWWindowPeer)) return;
Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow();
if (!(platformWindow instanceof CPlatformWindow)) return;
--- old/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java 2015-03-04 18:15:39.000000000 +0300
+++ new/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java 2015-03-04 18:15:39.000000000 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
import java.awt.*;
import java.lang.reflect.*;
+import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*;
import sun.lwawt.macosx.CImage.Creator;
@@ -41,7 +42,6 @@
_AppDockIconHandler() { }
- @SuppressWarnings("deprecation")
public void setDockMenu(final PopupMenu menu) {
fDockMenu = menu;
@@ -61,8 +61,8 @@
// instantiate the menu peer and set the native fDockMenu ivar
menu.addNotify();
- final long nsMenuPtr = ((CMenu)fDockMenu.getPeer()).getNativeMenu();
- nativeSetDockMenu(nsMenuPtr);
+ CMenu peer = AWTAccessor.getMenuComponentAccessor().getPeer(fDockMenu);
+ nativeSetDockMenu(peer.getNativeMenu());
}
public PopupMenu getDockMenu() {
--- old/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java 2015-03-04 18:15:40.000000000 +0300
+++ new/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java 2015-03-04 18:15:40.000000000 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
import javax.swing.plaf.MenuBarUI;
import com.apple.laf.ScreenMenuBar;
+import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import com.apple.laf.AquaMenuBarUI;
@@ -49,7 +50,10 @@
}
// callback from the native delegate -init function
- private static void initMenuStates(final boolean aboutMenuItemVisible, final boolean aboutMenuItemEnabled, final boolean prefsMenuItemVisible, final boolean prefsMenuItemEnabled) {
+ private static void initMenuStates(final boolean aboutMenuItemVisible,
+ final boolean aboutMenuItemEnabled,
+ final boolean prefsMenuItemVisible,
+ final boolean prefsMenuItemEnabled) {
synchronized (instance) {
instance.aboutMenuItemVisible = aboutMenuItemVisible;
instance.aboutMenuItemEnabled = aboutMenuItemEnabled;
@@ -92,7 +96,6 @@
return (frame.getExtendedState() & Frame.ICONIFIED) != 0;
}
- @SuppressWarnings("deprecation")
static void installDefaultMenuBar(final JMenuBar menuBar) {
if (menuBar == null) {
// intentionally clearing the default menu
@@ -114,7 +117,7 @@
}
screenMenuBar.addNotify();
- final MenuComponentPeer peer = screenMenuBar.getPeer();
+ final Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(screenMenuBar);
if (!(peer instanceof CMenuBar)) {
// such a thing should not be possible
throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar");
--- old/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenu.java 2015-03-04 18:15:41.000000000 +0300
+++ new/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenu.java 2015-03-04 18:15:41.000000000 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,11 +27,11 @@
import java.awt.*;
import java.awt.event.*;
-import java.awt.peer.MenuComponentPeer;
import java.util.Hashtable;
import javax.swing.*;
+import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.lwawt.LWToolkit;
import sun.lwawt.macosx.*;
@@ -212,24 +212,36 @@
// Send a mouseExited to the previously hilited item, if it wasn't 0.
if (target != fLastMouseEventTarget) {
if (fLastMouseEventTarget != null) {
- LWToolkit.postEvent(new MouseEvent(fLastMouseEventTarget, MouseEvent.MOUSE_EXITED, when, modifiers, x - fLastTargetRect.x, y - fLastTargetRect.y, 0, false));
+ LWToolkit.postEvent(
+ new MouseEvent(fLastMouseEventTarget,
+ MouseEvent.MOUSE_EXITED, when,
+ modifiers, x - fLastTargetRect.x,
+ y - fLastTargetRect.y, 0,
+ false));
}
- // Send a mouseEntered to the current hilited item, if it wasn't 0.
+ // Send a mouseEntered to the current hilited item, if it
+ // wasn't 0.
if (target != null) {
- LWToolkit.postEvent(new MouseEvent(target, MouseEvent.MOUSE_ENTERED, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false));
+ LWToolkit.postEvent(
+ new MouseEvent(target, MouseEvent.MOUSE_ENTERED,
+ when, modifiers,
+ x - targetRect.x,
+ y - targetRect.y, 0, false));
}
fLastMouseEventTarget = target;
fLastTargetRect = targetRect;
}
// Post a mouse event to the current item.
if (target == null) return;
- LWToolkit.postEvent(new MouseEvent(target, kind, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false));
+ LWToolkit.postEvent(
+ new MouseEvent(target, kind, when, modifiers,
+ x - targetRect.x, y - targetRect.y, 0,
+ false));
}
});
}
@Override
- @SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
super.addNotify();
@@ -248,7 +260,8 @@
if (tooltipText != null) {
setToolTipText(tooltipText);
}
- final MenuComponentPeer peer = getPeer();
+ final Object peer = AWTAccessor.getMenuComponentAccessor()
+ .getPeer(this);
if (peer instanceof CMenu) {
final CMenu menu = (CMenu) peer;
final long nativeMenu = menu.getNativeMenu();
@@ -355,9 +368,8 @@
public void setIndeterminate(boolean indeterminate) { }
@Override
- @SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
- final MenuComponentPeer peer = getPeer();
+ Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
@@ -365,9 +377,8 @@
}
@Override
- @SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
- final MenuComponentPeer peer = getPeer();
+ Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
--- old/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuBar.java 2015-03-04 18:15:42.000000000 +0300
+++ new/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuBar.java 2015-03-04 18:15:41.000000000 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,19 +25,21 @@
package com.apple.laf;
-import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import java.awt.*;
import java.awt.event.*;
-import java.lang.reflect.*;
-import java.security.*;
import java.util.*;
import javax.swing.*;
+import static sun.awt.AWTAccessor.*;
+
@SuppressWarnings("serial") // JDK implementation class
-public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenMenuPropertyHandler, ComponentListener {
+public class ScreenMenuBar extends MenuBar
+ implements ContainerListener, ScreenMenuPropertyHandler,
+ ComponentListener {
+
static boolean sJMenuBarHasHelpMenus = false; //$ could check by calling getHelpMenu in a try block
JMenuBar fSwingBar;
@@ -246,22 +248,23 @@
fSubmenus.remove(menu);
}
- @SuppressWarnings("deprecation")
public Menu add(final Menu m, final int index) {
synchronized (getTreeLock()) {
if (m.getParent() != null) {
m.getParent().remove(m);
}
- final Vector