Merge
authorlana
Wed, 31 Jul 2013 12:56:26 -0700
changeset 19028 deaa4303f6fc
parent 19017 0528383260ef (current diff)
parent 19027 aedec0ba69c7 (diff)
child 19076 6829bfa15dda
Merge
--- a/jdk/src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java	Wed Jul 31 12:56:26 2013 -0700
@@ -31,6 +31,7 @@
 import javax.swing.*;
 import javax.swing.plaf.MenuBarUI;
 
+import com.apple.laf.ScreenMenuBar;
 import sun.lwawt.macosx.CMenuBar;
 
 import com.apple.laf.AquaMenuBarUI;
@@ -72,12 +73,15 @@
         // scan the current frames, and see if any are foreground
         final Frame[] frames = Frame.getFrames();
         for (final Frame frame : frames) {
-            if (frame.isVisible() && !isFrameMinimized(frame)) return;
+            if (frame.isVisible() && !isFrameMinimized(frame)) {
+                return;
+            }
         }
 
         // if we have no foreground frames, then we have to "kick" the menubar
         final JFrame pingFrame = new JFrame();
         pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f));
+        pingFrame.setUndecorated(true);
         pingFrame.setVisible(true);
         pingFrame.toFront();
         pingFrame.setVisible(false);
@@ -101,7 +105,6 @@
             // Aqua was not installed
             throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel");
         }
-/* TODO: disabled until ScreenMenuBar is working
 
         final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui;
         final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar();
@@ -118,8 +121,7 @@
         }
 
         // grab the pointer to the CMenuBar, and retain it in native
-        nativeSetDefaultMenuBar(((CMenuBar)peer).getNativeMenuBarPeer());
-*/
+        nativeSetDefaultMenuBar(((CMenuBar)peer).getModel());
     }
 
     void setAboutMenuItemVisible(final boolean present) {
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Wed Jul 31 12:56:26 2013 -0700
@@ -182,7 +182,11 @@
         Long format = predefinedClipboardNameMap.get(str);
 
         if (format == null) {
-            format = new Long(registerFormatWithPasteboard(str));
+            if (java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
+                // Do not try to access native system for the unknown format
+                return -1L;
+            }
+            format = registerFormatWithPasteboard(str);
             predefinedClipboardNameMap.put(str, format);
             predefinedClipboardFormatMap.put(format, str);
         }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java	Wed Jul 31 12:56:26 2013 -0700
@@ -43,7 +43,7 @@
         return target;
     }
 
-    long getModel() {
+    public long getModel() {
         return modelPtr;
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jul 31 12:56:26 2013 -0700
@@ -47,7 +47,7 @@
 import com.sun.awt.AWTUtilities;
 
 public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
-    private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h);
+    private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
     private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
     private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
     private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
@@ -230,7 +230,8 @@
         contentView = createContentView();
         contentView.initialize(peer, responder);
 
-        final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0);
+        final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L;
+        final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), ownerPtr, styleBits, 0, 0, 0, 0);
         setPtr(nativeWindowPtr);
 
         if (target instanceof javax.swing.RootPaneContainer) {
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.h	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h	Wed Jul 31 12:56:26 2013 -0700
@@ -44,6 +44,7 @@
     jint styleBits;
     BOOL isEnabled;
     NSWindow *nsWindow;
+    AWTWindow *ownerWindow;
 }
 
 // An instance of either AWTWindow_Normal or AWTWindow_Panel
@@ -51,12 +52,15 @@
 
 @property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow;
 @property (nonatomic, retain) CMenuBar *javaMenuBar;
+@property (nonatomic, retain) AWTWindow *ownerWindow;
 @property (nonatomic) NSSize javaMinSize;
 @property (nonatomic) NSSize javaMaxSize;
 @property (nonatomic) jint styleBits;
 @property (nonatomic) BOOL isEnabled;
 
+
 - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow
+                  ownerWindow:owner
                     styleBits:(jint)styleBits
                     frameRect:(NSRect)frameRect
                   contentView:(NSView *)contentView;
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m	Wed Jul 31 12:56:26 2013 -0700
@@ -30,6 +30,7 @@
 #import "sun_lwawt_macosx_CPlatformWindow.h"
 #import "com_apple_eawt_event_GestureHandler.h"
 #import "com_apple_eawt_FullScreenHandler.h"
+#import "ApplicationDelegate.h"
 
 #import "AWTWindow.h"
 #import "AWTView.h"
@@ -55,7 +56,7 @@
 // doesn't provide information about "opposite" window, so we
 // have to do a bit of tracking. This variable points to a window
 // which had been the key window just before a new key window
-// was set. It would be nil if the new key window isn't an AWT 
+// was set. It would be nil if the new key window isn't an AWT
 // window or the app currently has no key window.
 static AWTWindow* lastKeyWindow = nil;
 
@@ -120,6 +121,7 @@
 @synthesize javaMaxSize;
 @synthesize styleBits;
 @synthesize isEnabled;
+@synthesize ownerWindow;
 
 - (void) updateMinMaxSize:(BOOL)resizable {
     if (resizable) {
@@ -201,6 +203,7 @@
 }
 
 - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)platformWindow
+                  ownerWindow:owner
                     styleBits:(jint)bits
                     frameRect:(NSRect)rect
                   contentView:(NSView *)view
@@ -245,6 +248,7 @@
     self.isEnabled = YES;
     self.javaPlatformWindow = platformWindow;
     self.styleBits = bits;
+    self.ownerWindow = owner;
     [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)];
 
     return self;
@@ -350,7 +354,7 @@
     [self.javaPlatformWindow setJObject:nil withEnv:env];
 
     self.nsWindow = nil;
-
+    self.ownerWindow = nil;
     [super dealloc];
 }
 
@@ -539,11 +543,27 @@
 AWT_ASSERT_APPKIT_THREAD;
     [AWTToolkit eventCountPlusPlus];
     AWTWindow *opposite = [AWTWindow lastKeyWindow];
-    if (!IS(self.styleBits, IS_DIALOG)) {
-        [CMenuBar activate:self.javaMenuBar modallyDisabled:NO];
-    } else if ((opposite != NULL) && IS(self.styleBits, IS_MODAL)) {
-        [CMenuBar activate:opposite->javaMenuBar modallyDisabled:YES];        
+
+    // Finds appropriate menubar in our hierarchy,
+    AWTWindow *awtWindow = self;
+    while (awtWindow.ownerWindow != nil) {
+        awtWindow = awtWindow.ownerWindow;
     }
+
+    CMenuBar *menuBar = nil;
+    BOOL isDisabled = NO;
+    if ([awtWindow.nsWindow isVisible]){
+        menuBar = awtWindow.javaMenuBar;
+        isDisabled = !awtWindow.isEnabled;
+    }
+
+    if (menuBar == nil) {
+        menuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
+        isDisabled = NO;
+    }
+
+    [CMenuBar activate:menuBar modallyDisabled:isDisabled];
+
     [AWTWindow setLastKeyWindow:nil];
 
     [self _deliverWindowFocusEvent:YES oppositeWindow: opposite];
@@ -555,6 +575,14 @@
     [AWTToolkit eventCountPlusPlus];
     [self.javaMenuBar deactivate];
 
+    // In theory, this might cause flickering if the window gaining focus
+    // has its own menu. However, I couldn't reproduce it on practice, so
+    // perhaps this is a non issue.
+    CMenuBar* defaultMenu = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
+    if (defaultMenu != nil) {
+        [CMenuBar activate:defaultMenu modallyDisabled:NO];
+    }
+
     // the new key window
     NSWindow *keyWindow = [NSApp keyWindow];
     AWTWindow *opposite = nil;
@@ -741,7 +769,7 @@
  * Signature: (JJIIII)J
  */
 JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCreateNSWindow
-(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h)
+(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong ownerPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h)
 {
     __block AWTWindow *window = nil;
 
@@ -750,13 +778,14 @@
     JNFWeakJObjectWrapper *platformWindow = [JNFWeakJObjectWrapper wrapperWithJObject:obj withEnv:env];
     NSView *contentView = OBJC(contentViewPtr);
     NSRect frameRect = NSMakeRect(x, y, w, h);
-
+    AWTWindow *owner = [OBJC(ownerPtr) delegate];
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
 
         window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow
-                                                  styleBits:styleBits
-                                                  frameRect:frameRect
-                                                contentView:contentView];
+                                               ownerWindow:owner
+                                                 styleBits:styleBits
+                                                 frameRect:frameRect
+                                               contentView:contentView];
         // the window is released is CPlatformWindow.nativeDispose()
 
         if (window) CFRetain(window.nsWindow);
@@ -818,11 +847,19 @@
 
         AWTWindow *window = (AWTWindow*)[nsWindow delegate];
 
-        if ([nsWindow isKeyWindow]) [window.javaMenuBar deactivate];
+        if ([nsWindow isKeyWindow]) {
+            [window.javaMenuBar deactivate];
+        }
+
         window.javaMenuBar = menuBar;
 
+        CMenuBar* actualMenuBar = menuBar;
+        if (actualMenuBar == nil) {
+            actualMenuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
+        }
+
         if ([nsWindow isKeyWindow]) {
-            [CMenuBar activate:window.javaMenuBar modallyDisabled:NO];
+            [CMenuBar activate:actualMenuBar modallyDisabled:NO];
         }
     }];
 
--- a/jdk/src/macosx/native/sun/awt/CMenuBar.m	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/CMenuBar.m	Wed Jul 31 12:56:26 2013 -0700
@@ -63,7 +63,7 @@
         if (excludingAppleMenu && ![currMenu isJavaMenu]) {
             continue;
         }
-
+        [currItem setSubmenu:nil];
         [theMainMenu removeItemAtIndex:index];
     }
 
@@ -154,7 +154,10 @@
     // Clean up extra items
     NSUInteger removedIndex, removedCount = [removedMenuArray count];
     for (removedIndex=removedCount; removedIndex > 0; removedIndex--) {
-        [theMainMenu removeItemAtIndex:[[removedMenuArray objectAtIndex:(removedIndex-1)] integerValue]];
+        NSUInteger index = [[removedMenuArray objectAtIndex:(removedIndex-1)] integerValue];
+        NSMenuItem *currItem = [theMainMenu itemAtIndex:index];
+        [currItem setSubmenu:nil];
+        [theMainMenu removeItemAtIndex:index];
     }
 
     i = cmenuIndex;
--- a/jdk/src/macosx/native/sun/awt/CMenuItem.m	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/CMenuItem.m	Wed Jul 31 12:56:26 2013 -0700
@@ -70,9 +70,15 @@
     JNIEnv *env = [ThreadUtilities getJNIEnv];
 JNF_COCOA_ENTER(env);
 
-    // If we are called as a result of user pressing a shorcut, do nothing,
+    // If we are called as a result of user pressing a shortcut, do nothing,
     // because AVTView has already sent corresponding key event to the Java
-    // layer from performKeyEquivalent
+    // layer from performKeyEquivalent.
+    // There is an exception from the rule above, though: if a window with
+    // a menu gets minimized by user and there are no other windows to take
+    // focus, the window's menu won't be removed from the global menu bar.
+    // However, the Java layer won't handle invocation by a shortcut coming
+    // from this "frameless" menu, because there are no active windows. This
+    // means we have to handle it here.
     NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent];
     if ([currEvent type] == NSKeyDown) {
         NSString *menuKey = [sender keyEquivalent];
@@ -91,7 +97,8 @@
             eventKey = [NSString stringWithCharacters: &newChar length: 1];
         }
 
-        if ([menuKey isEqualToString:eventKey]) {
+        NSWindow *keyWindow = [NSApp keyWindow];
+        if ([menuKey isEqualToString:eventKey] && keyWindow != nil) {
             return;
         }
     }
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties	Wed Jul 31 12:56:26 2013 -0700
@@ -1,54 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=&GTK Color Chooser
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Hue:
-
-GTKColorChooserPanel.red.textAndMnemonic=R&ed:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation:
-
-GTKColorChooserPanel.green.textAndMnemonic=&Green:
-
-GTKColorChooserPanel.value.textAndMnemonic=&Value:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Blue:
-
-GTKColorChooserPanel.color.textAndMnemonic=Color &Name:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=All Files
-FileChooser.newFolderButton.textAndMnemonic=&New Folder
-FileChooser.newFolderDialog.textAndMnemonic=Folder name:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error creating directory "{0}": No such file or directory
-FileChooser.deleteFileButton.textAndMnemonic=De&lete File
-FileChooser.renameFileButton.textAndMnemonic=&Rename File
-FileChooser.cancelButton.textAndMnemonic=&Cancel
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Save
-FileChooser.openDialogTitle.textAndMnemonic=Open
-FileChooser.pathLabel.textAndMnemonic=&Selection:
-FileChooser.filterLabel.textAndMnemonic=Filter:
-FileChooser.foldersLabel.textAndMnemonic=Fol&ders
-FileChooser.filesLabel.textAndMnemonic=&Files
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Abort file chooser dialog.
-FileChooser.saveButtonToolTip.textAndMnemonic=Save selected file.
-FileChooser.openButtonToolTip.textAndMnemonic=Open selected file.
-
-FileChooser.renameFileDialog.textAndMnemonic=Rename file "{0}" to
-FileChooser.renameFileError.titleAndMnemonic=Error
-FileChooser.renameFileError.textAndMnemonic=Error renaming file "{0}" to "{1}"
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=&GTK Color Chooser
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Hue:
+
+GTKColorChooserPanel.red.textAndMnemonic=R&ed:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Green:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Value:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Blue:
+
+GTKColorChooserPanel.color.textAndMnemonic=Color &Name:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=All Files
+FileChooser.newFolderButton.textAndMnemonic=&New Folder
+FileChooser.newFolderDialog.textAndMnemonic=Folder name:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error creating directory "{0}": No such file or directory
+FileChooser.deleteFileButton.textAndMnemonic=De&lete File
+FileChooser.renameFileButton.textAndMnemonic=&Rename File
+FileChooser.cancelButton.textAndMnemonic=&Cancel
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Save
+FileChooser.openDialogTitle.textAndMnemonic=Open
+FileChooser.pathLabel.textAndMnemonic=&Selection:
+FileChooser.filterLabel.textAndMnemonic=Filter:
+FileChooser.foldersLabel.textAndMnemonic=Fol&ders
+FileChooser.filesLabel.textAndMnemonic=&Files
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Abort file chooser dialog.
+FileChooser.saveButtonToolTip.textAndMnemonic=Save selected file.
+FileChooser.openButtonToolTip.textAndMnemonic=Open selected file.
+
+FileChooser.renameFileDialog.textAndMnemonic=Rename file "{0}" to
+FileChooser.renameFileError.titleAndMnemonic=Error
+FileChooser.renameFileError.textAndMnemonic=Error renaming file "{0}" to "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java	Wed Jul 31 12:56:26 2013 -0700
@@ -499,7 +499,8 @@
 
         public void setItem(Object item) {
             super.setItem(item);
-            if (editor.hasFocus()) {
+            Object focus = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+            if ((focus == editor) || (focus == editor.getParent())) {
                 editor.selectAll();
             }
         }
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties	Wed Jul 31 12:56:26 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Look &In:
-FileChooser.saveInLabel.textAndMnemonic=Save In:
-FileChooser.fileNameLabel.textAndMnemonic=File &Name:
-FileChooser.folderNameLabel.textAndMnemonic=Folder &Name:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &Type:
-FileChooser.upFolderToolTip.textAndMnemonic=Up One Level
-FileChooser.upFolderAccessibleName=Up
-FileChooser.homeFolderToolTip.textAndMnemonic=Home
-FileChooser.homeFolderAccessibleName=Home
-FileChooser.newFolderToolTip.textAndMnemonic=Create New Folder
-FileChooser.newFolderAccessibleName=New Folder
-FileChooser.newFolderActionLabel.textAndMnemonic=New Folder
-FileChooser.listViewButtonToolTip.textAndMnemonic=List
-FileChooser.listViewButtonAccessibleName=List
-FileChooser.listViewActionLabel.textAndMnemonic=List
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details
-FileChooser.detailsViewButtonAccessibleName=Details
-FileChooser.detailsViewActionLabel.textAndMnemonic=Details
-FileChooser.refreshActionLabel.textAndMnemonic=Refresh
-FileChooser.viewMenuLabel.textAndMnemonic=View
-FileChooser.fileNameHeader.textAndMnemonic=Name
-FileChooser.fileSizeHeader.textAndMnemonic=Size
-FileChooser.fileTypeHeader.textAndMnemonic=Type
-FileChooser.fileDateHeader.textAndMnemonic=Modified
-FileChooser.fileAttrHeader.textAndMnemonic=Attributes
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Look &In:
+FileChooser.saveInLabel.textAndMnemonic=Save In:
+FileChooser.fileNameLabel.textAndMnemonic=File &Name:
+FileChooser.folderNameLabel.textAndMnemonic=Folder &Name:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &Type:
+FileChooser.upFolderToolTip.textAndMnemonic=Up One Level
+FileChooser.upFolderAccessibleName=Up
+FileChooser.homeFolderToolTip.textAndMnemonic=Home
+FileChooser.homeFolderAccessibleName=Home
+FileChooser.newFolderToolTip.textAndMnemonic=Create New Folder
+FileChooser.newFolderAccessibleName=New Folder
+FileChooser.newFolderActionLabel.textAndMnemonic=New Folder
+FileChooser.listViewButtonToolTip.textAndMnemonic=List
+FileChooser.listViewButtonAccessibleName=List
+FileChooser.listViewActionLabel.textAndMnemonic=List
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details
+FileChooser.detailsViewButtonAccessibleName=Details
+FileChooser.detailsViewActionLabel.textAndMnemonic=Details
+FileChooser.refreshActionLabel.textAndMnemonic=Refresh
+FileChooser.viewMenuLabel.textAndMnemonic=View
+FileChooser.fileNameHeader.textAndMnemonic=Name
+FileChooser.fileSizeHeader.textAndMnemonic=Size
+FileChooser.fileTypeHeader.textAndMnemonic=Type
+FileChooser.fileDateHeader.textAndMnemonic=Modified
+FileChooser.fileAttrHeader.textAndMnemonic=Attributes
--- a/jdk/src/share/classes/java/awt/AWTException.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/share/classes/java/awt/AWTException.java	Wed Jul 31 12:56:26 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, 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
@@ -26,7 +26,7 @@
 
 
 /**
- * Signals that an Absract Window Toolkit exception has occurred.
+ * Signals that an Abstract Window Toolkit exception has occurred.
  *
  * @author      Arthur van Hoff
  */
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Wed Jul 31 12:56:26 2013 -0700
@@ -1149,9 +1149,10 @@
         int index = filters.indexOf(f);
         if (index >= 0) {
             if(getFileFilter() == f) {
-                if (isAcceptAllFileFilterUsed()) {
+                FileFilter aaff = getAcceptAllFileFilter();
+                if (isAcceptAllFileFilterUsed() && (aaff != f)) {
                     // choose default filter if it is used
-                    setFileFilter(getAcceptAllFileFilter());
+                    setFileFilter(aaff);
                 }
                 else if (index > 0) {
                     // choose the first filter, because it is not removed
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Wed Jul 31 12:56:26 2013 -0700
@@ -344,7 +344,8 @@
             configureRenderer(cellContext);
             while (!done && paintingEnumerator.hasMoreElements()) {
                 path = (TreePath)paintingEnumerator.nextElement();
-                if (path != null) {
+                bounds = getPathBounds(tree, path);
+                if ((path != null) && (bounds != null)) {
                     isLeaf = treeModel.isLeaf(path.getLastPathComponent());
                     if (isLeaf) {
                         isExpanded = hasBeenExpanded = false;
@@ -353,7 +354,6 @@
                         isExpanded = treeState.getExpandedState(path);
                         hasBeenExpanded = tree.hasBeenExpanded(path);
                     }
-                    bounds = getPathBounds(tree, path);
                     rowBounds.y = bounds.y;
                     rowBounds.height = bounds.height;
                     paintRow(renderer, dtcr, context, cellContext, g,
@@ -383,7 +383,8 @@
             paintingEnumerator = treeState.getVisiblePathsFrom(initialPath);
             while (!done && paintingEnumerator.hasMoreElements()) {
                 path = (TreePath)paintingEnumerator.nextElement();
-                if (path != null) {
+                bounds = getPathBounds(tree, path);
+                if ((path != null) && (bounds != null)) {
                     isLeaf = treeModel.isLeaf(path.getLastPathComponent());
                     if (isLeaf) {
                         isExpanded = hasBeenExpanded = false;
@@ -392,7 +393,6 @@
                         isExpanded = treeState.getExpandedState(path);
                         hasBeenExpanded = tree.hasBeenExpanded(path);
                     }
-                    bounds = getPathBounds(tree, path);
                     // See if the vertical line to the parent has been drawn.
                     parentPath = path.getParentPath();
                     if (parentPath != null) {
--- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Wed Jul 31 12:56:26 2013 -0700
@@ -29,12 +29,18 @@
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
+import java.awt.Dimension;
 import java.awt.EventQueue;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
+import java.awt.event.ComponentListener;
+import java.awt.event.ContainerEvent;
+import java.awt.event.ContainerListener;
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBufferInt;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import java.security.AccessController;
 
 import javax.swing.JLayeredPane;
@@ -80,6 +86,8 @@
     private boolean copyBufferEnabled;
     private int[] copyBuffer;
 
+    private PropertyChangeListener layoutSizeListener;
+
     /**
      * Constructs a new, initially invisible {@code JLightweightFrame}
      * instance.
@@ -94,6 +102,23 @@
         if (getGraphicsConfiguration().isTranslucencyCapable()) {
             setBackground(new Color(0, 0, 0, 0));
         }
+
+        layoutSizeListener = new PropertyChangeListener() {
+            @Override
+            public void propertyChange(PropertyChangeEvent e) {
+                Dimension d = (Dimension)e.getNewValue();
+
+                if ("preferredSize".equals(e.getPropertyName())) {
+                    content.preferredSizeChanged(d.width, d.height);
+
+                } else if ("maximumSize".equals(e.getPropertyName())) {
+                    content.maximumSizeChanged(d.width, d.height);
+
+                } else if ("minimumSize".equals(e.getPropertyName())) {
+                    content.minimumSizeChanged(d.width, d.height);
+                }
+            }
+        };
     }
 
     /**
@@ -104,10 +129,23 @@
      *
      * @param content the {@link LightweightContent} instance
      */
-    public void setContent(LightweightContent content) {
+    public void setContent(final LightweightContent content) {
+        if (content == null) {
+            System.err.println("JLightweightFrame.setContent: content may not be null!");
+            return;
+        }
         this.content = content;
         this.component = content.getComponent();
 
+        Dimension d = this.component.getPreferredSize();
+        content.preferredSizeChanged(d.width, d.height);
+
+        d = this.component.getMaximumSize();
+        content.maximumSizeChanged(d.width, d.height);
+
+        d = this.component.getMinimumSize();
+        content.minimumSizeChanged(d.width, d.height);
+
         initInterior();
     }
 
@@ -202,6 +240,25 @@
         contentPane.setLayout(new BorderLayout());
         contentPane.add(component);
         setContentPane(contentPane);
+
+        contentPane.addContainerListener(new ContainerListener() {
+            @Override
+            public void componentAdded(ContainerEvent e) {
+                Component c = JLightweightFrame.this.component;
+                if (e.getChild() == c) {
+                    c.addPropertyChangeListener("preferredSize", layoutSizeListener);
+                    c.addPropertyChangeListener("maximumSize", layoutSizeListener);
+                    c.addPropertyChangeListener("minimumSize", layoutSizeListener);
+                }
+            }
+            @Override
+            public void componentRemoved(ContainerEvent e) {
+                Component c = JLightweightFrame.this.component;
+                if (e.getChild() == c) {
+                    c.removePropertyChangeListener(layoutSizeListener);
+                }
+            }
+        });
     }
 
     @SuppressWarnings("deprecation")
--- a/jdk/src/share/classes/sun/swing/LightweightContent.java	Wed Jul 31 13:11:31 2013 +0400
+++ b/jdk/src/share/classes/sun/swing/LightweightContent.java	Wed Jul 31 12:56:26 2013 -0700
@@ -161,4 +161,22 @@
      * application that the frame has ungrabbed focus.
      */
     public void focusUngrabbed();
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the content preferred size has changed.
+     */
+    public void preferredSizeChanged(int width, int height);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the content maximum size has changed.
+     */
+    public void maximumSizeChanged(int width, int height);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the content minimum size has changed.
+     */
+    public void minimumSizeChanged(int width, int height);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java	Wed Jul 31 12:56:26 2013 -0700
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.java.swing.plaf.windows.WindowsComboBoxUI.WindowsComboBoxEditor;
+import java.awt.Toolkit;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import javax.swing.ComboBoxEditor;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JTextField;
+import javax.swing.UIManager;
+import sun.awt.SunToolkit;
+
+import static javax.swing.SwingUtilities.invokeAndWait;
+import static javax.swing.SwingUtilities.windowForComponent;
+import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
+
+/*
+ * @test
+ * @bug 8015300
+ * @summary Tests that editable combobox select all text
+ * @author Sergey Malenkov
+ */
+
+public class Test8015300 {
+    private static final SunToolkit STK = (SunToolkit) Toolkit.getDefaultToolkit();
+    private static final String[] ITEMS = {
+            "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
+            "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
+
+    private static JComboBox<String> combo;
+
+    public static void main(String[] args) throws Exception {
+        UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
+        for (UIManager.LookAndFeelInfo info : array) {
+            UIManager.setLookAndFeel(info.getClassName());
+            System.err.println("L&F: " + info.getName());
+            invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    combo = new JComboBox<>(ITEMS);
+                    combo.addItemListener(new ItemListener() {
+                        @Override
+                        public void itemStateChanged(ItemEvent event) {
+                            if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
+                                ComboBoxEditor editor = combo.getEditor();
+                                Object component = editor.getEditorComponent();
+                                if (component instanceof JTextField) {
+                                    JTextField text = (JTextField) component;
+                                    boolean selected = null != text.getSelectedText();
+
+                                    StringBuilder sb = new StringBuilder();
+                                    sb.append(" - ").append(combo.getSelectedIndex());
+                                    sb.append(": ").append(event.getItem());
+                                    if (selected) {
+                                        sb.append("; selected");
+                                    }
+                                    System.err.println(sb);
+                                    if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
+                                        throw new Error("unexpected state of text selection");
+                                    }
+                                }
+                            }
+                        }
+                    });
+                    JFrame frame = new JFrame(getClass().getSimpleName());
+                    frame.add(combo);
+                    frame.pack();
+                    frame.setLocationRelativeTo(null);
+                    frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+                    frame.setVisible(true);
+                }
+            });
+            for (int i = 0; i < ITEMS.length; ++i) {
+                select(i, true);
+                select(1, false);
+            }
+            invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    windowForComponent(combo).dispose();
+                }
+            });
+        }
+    }
+
+    private static void select(final int index, final boolean editable) throws Exception {
+        invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                combo.setEditable(editable);
+                combo.setSelectedIndex(index);
+            }
+        });
+        STK.realSync();
+        Thread.sleep(50L);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/Test8015926.java	Wed Jul 31 12:56:26 2013 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8015926
+ * @summary Tests that there are no NPE during painting
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+
+import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
+
+public class Test8015926 implements TreeModelListener, Runnable, Thread.UncaughtExceptionHandler {
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
+        SwingUtilities.invokeAndWait(new Test8015926());
+        Thread.sleep(1000L);
+    }
+
+    private JTree tree;
+
+    @Override
+    public void treeStructureChanged(TreeModelEvent event) {
+    }
+
+    @Override
+    public void treeNodesRemoved(TreeModelEvent event) {
+    }
+
+    @Override
+    public void treeNodesInserted(TreeModelEvent event) {
+        this.tree.expandPath(event.getTreePath());
+    }
+
+    @Override
+    public void treeNodesChanged(TreeModelEvent event) {
+    }
+
+    @Override
+    public void run() {
+        Thread.currentThread().setUncaughtExceptionHandler(this);
+
+        DefaultMutableTreeNode root = new DefaultMutableTreeNode();
+        DefaultMutableTreeNode child = new DefaultMutableTreeNode("Child");
+        DefaultTreeModel model = new DefaultTreeModel(root);
+
+        this.tree = new JTree();
+        this.tree.setModel(model);
+
+        JFrame frame = new JFrame(getClass().getSimpleName());
+        frame.add(this.tree);
+
+        model.addTreeModelListener(this); // frame is not visible yet
+        model.insertNodeInto(child, root, root.getChildCount());
+        model.removeNodeFromParent(child);
+
+        frame.setSize(640, 480);
+        frame.setLocationRelativeTo(null);
+        frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+        frame.setVisible(true);
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable exception) {
+        exception.printStackTrace();
+        System.exit(1);
+    }
+}