Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit

Permalink
8238719: [macOS] Delete the property which use deprecated prefix "com…
Browse files Browse the repository at this point in the history
….apple.macos."

Reviewed-by: psadhukhan, jdv, prr
  • Loading branch information
mrserb committed Mar 25, 2020
1 parent 3399842 commit cf22b4e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 24 deletions.
39 changes: 30 additions & 9 deletions src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
25 changes: 10 additions & 15 deletions src/java.desktop/macosx/classes/com/apple/laf/AquaMenuBarUI.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -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.