Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8238719: [macOS] Delete the property which use deprecated prefix "com…
….apple.macos."

Reviewed-by: psadhukhan, jdv, prr
  • Loading branch information
mrserb committed Mar 25, 2020
1 parent 3399842 commit cf22b4e7c8dec96caca58e0b8c911217362e987b
Showing with 40 additions and 24 deletions.
  1. +30 −9 src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java
  2. +10 −15 src/java.desktop/macosx/classes/com/apple/laf/AquaMenuBarUI.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, 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,22 +25,43 @@

package com.apple.laf;

import java.awt.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.KeyboardFocusManager;
import java.security.PrivilegedAction;
import java.util.*;

import javax.swing.*;
import java.util.Enumeration;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JRootPane;
import javax.swing.PopupFactory;
import javax.swing.SwingConstants;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.plaf.*;
import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.DimensionUIResource;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.basic.BasicBorders;
import javax.swing.plaf.basic.BasicLookAndFeel;

import apple.laf.JRSUIControl;
import apple.laf.JRSUIUtils;
import sun.swing.SwingAccessor;
import sun.swing.SwingUtilities2;

import static javax.swing.UIDefaults.LazyValue;
import sun.swing.*;
import apple.laf.*;

@SuppressWarnings("serial") // Superclass is not serializable across versions
public class AquaLookAndFeel extends BasicLookAndFeel {
static final String sOldPropertyPrefix = "com.apple.macos."; // old prefix for things like 'useScreenMenuBar'
static final String sPropertyPrefix = "apple.laf."; // new prefix for things like 'useScreenMenuBar'

// for lazy initalizers. Following the pattern from metal.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, 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,10 +25,15 @@

package com.apple.laf;

import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.MenuBar;
import java.security.AccessController;

import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicMenuBarUI;

@@ -145,17 +150,7 @@ public static final boolean isScreenMenuBar(final JMenuBar c) {
public static boolean getScreenMenuBarProperty() {
// Do not allow AWT to set the screen menu bar if it's embedded in another UI toolkit
if (LWCToolkit.isEmbedded()) return false;
if (AccessController.doPrivileged(
new GetBooleanAction(AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar"))) {
return true;
}
if (AccessController.doPrivileged(
new GetBooleanAction(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar"))) {
System.err.println(AquaLookAndFeel.sOldPropertyPrefix +
"useScreenMenuBar has been deprecated. Please switch to " +
AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
return true;
}
return false;
return AccessController.doPrivileged(new GetBooleanAction(
AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar"));
}
}

0 comments on commit cf22b4e

Please sign in to comment.