--- old/make/mapfiles/libawt_xawt/mapfile-vers 2015-11-24 19:06:32.188601286 +0300 +++ new/make/mapfiles/libawt_xawt/mapfile-vers 2015-11-24 19:06:32.024601282 +0300 @@ -150,6 +150,12 @@ Java_sun_awt_X11_XlibWrapper_XdbeEndIdiom; Java_sun_awt_X11_XDesktopPeer_init; Java_sun_awt_X11_XDesktopPeer_gnome_1url_1show; + Java_sun_awt_X11_XTaskbarPeer_init; + Java_sun_awt_X11_XTaskbarPeer_runloop; + Java_sun_awt_X11_XTaskbarPeer_setBadge; + Java_sun_awt_X11_XTaskbarPeer_setUrgent; + Java_sun_awt_X11_XTaskbarPeer_updateProgress; + Java_sun_awt_X11_XTaskbarPeer_setNativeMenu; Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl; Java_sun_awt_X11_XRobotPeer_keyPressImpl; Java_sun_awt_X11_XRobotPeer_keyReleaseImpl; --- old/src/java.desktop/macosx/classes/com/apple/eawt/Application.java 2015-11-24 19:06:32.616601297 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/Application.java 2015-11-24 19:06:32.488601294 +0300 @@ -26,10 +26,10 @@ package com.apple.eawt; import java.awt.Image; -import java.awt.Point; import java.awt.PopupMenu; import java.awt.Toolkit; import java.awt.Window; +import java.awt.desktop.*; import java.beans.Beans; import javax.swing.JMenuBar; @@ -104,38 +104,38 @@ } /** - * Adds sub-types of {@link AppEventListener} to listen for notifications from the native Mac OS X system. + * Adds sub-types of {@link SystemEventListener} to listen for notifications from the native Mac OS X system. * * @see AppForegroundListener * @see AppHiddenListener * @see AppReOpenedListener - * @see ScreenSleepListener - * @see SystemSleepListener - * @see UserSessionListener + * @see AppScreenSleepListener + * @see AppSystemSleepListener + * @see AppUserSessionListener * * @param listener * @since Java for Mac OS X 10.6 Update 3 * @since Java for Mac OS X 10.5 Update 8 */ - public void addAppEventListener(final AppEventListener listener) { + public void addAppEventListener(final SystemEventListener listener) { eventHandler.addListener(listener); } /** - * Removes sub-types of {@link AppEventListener} from listening for notifications from the native Mac OS X system. + * Removes sub-types of {@link SystemEventListener} from listening for notifications from the native Mac OS X system. * * @see AppForegroundListener * @see AppHiddenListener * @see AppReOpenedListener - * @see ScreenSleepListener - * @see SystemSleepListener - * @see UserSessionListener + * @see AppScreenSleepListener + * @see AppSystemSleepListener + * @see AppUserSessionListener * * @param listener * @since Java for Mac OS X 10.6 Update 3 * @since Java for Mac OS X 10.5 Update 8 */ - public void removeAppEventListener(final AppEventListener listener) { + public void removeAppEventListener(final SystemEventListener listener) { eventHandler.removeListener(listener); } @@ -366,6 +366,17 @@ public void setDockIconBadge(final String badge) { iconHandler.setDockIconBadge(badge); } + + /** + * Displays a progress bar to this application's Dock icon. + * Acceptable values are from 0 to 100, any other disables progress indication. + * + * @param value progress value + * @since 1.9 + */ + public void setDockIconProgress(final int value) { + iconHandler.setDockIconProgress(value); + } /** * Sets the default menu bar to use when there are no active frames. @@ -397,168 +408,4 @@ ((CPlatformWindow)platformWindow).toggleFullScreen(); } - - // -- DEPRECATED API -- - - /** - * Adds the specified ApplicationListener as a receiver of callbacks from this class. - * This method throws a RuntimeException if the newer About, Preferences, Quit, etc handlers are installed. - * - * @param listener an implementation of ApplicationListener that handles ApplicationEvents - * - * @deprecated register individual handlers for each task (About, Preferences, Open, Print, Quit, etc) - * @since 1.4 - */ - @SuppressWarnings("deprecation") - @Deprecated - public void addApplicationListener(final ApplicationListener listener) { - eventHandler.legacyHandler.addLegacyAppListener(listener); - } - - /** - * Removes the specified ApplicationListener from being a receiver of callbacks from this class. - * This method throws a RuntimeException if the newer About, Preferences, Quit, etc handlers are installed. - * - * @param listener an implementation of ApplicationListener that had previously been registered to handle ApplicationEvents - * - * @deprecated unregister individual handlers for each task (About, Preferences, Open, Print, Quit, etc) - * @since 1.4 - */ - @SuppressWarnings("deprecation") - @Deprecated - public void removeApplicationListener(final ApplicationListener listener) { - eventHandler.legacyHandler.removeLegacyAppListener(listener); - } - - /** - * Enables the Preferences item in the application menu. The ApplicationListener receives a callback for - * selection of the Preferences item in the application menu only if this is set to true. - * - * If a Preferences item isn't present, this method adds and enables it. - * - * @param enable specifies whether the Preferences item in the application menu should be enabled (true) or not (false) - * - * @deprecated no replacement - * @since 1.4 - */ - @Deprecated - public void setEnabledPreferencesMenu(final boolean enable) { - menuBarHandler.setPreferencesMenuItemVisible(true); - menuBarHandler.setPreferencesMenuItemEnabled(enable); - } - - /** - * Enables the About item in the application menu. The ApplicationListener receives a callback for - * selection of the About item in the application menu only if this is set to true. Because AWT supplies - * a standard About window when an application may not, by default this is set to true. - * - * If the About item isn't present, this method adds and enables it. - * - * @param enable specifies whether the About item in the application menu should be enabled (true) or not (false) - * - * @deprecated no replacement - * @since 1.4 - */ - @Deprecated - public void setEnabledAboutMenu(final boolean enable) { - menuBarHandler.setAboutMenuItemEnabled(enable); - } - - /** - * Determines if the Preferences item of the application menu is enabled. - * - * @deprecated no replacement - * @since 1.4 - */ - @Deprecated - public boolean getEnabledPreferencesMenu() { - return menuBarHandler.isPreferencesMenuItemEnabled(); - } - - /** - * Determines if the About item of the application menu is enabled. - * - * @deprecated no replacement - * @since 1.4 - */ - @Deprecated - public boolean getEnabledAboutMenu() { - return menuBarHandler.isAboutMenuItemEnabled(); - } - - /** - * Determines if the About item of the application menu is present. - * - * @deprecated no replacement - * @since 1.4 - */ - @Deprecated - public boolean isAboutMenuItemPresent() { - return menuBarHandler.isAboutMenuItemVisible(); - } - - /** - * Adds the About item to the application menu if the item is not already present. - * - * @deprecated use {@link #setAboutHandler(AboutHandler)} with a non-null {@link AboutHandler} parameter - * @since 1.4 - */ - @Deprecated - public void addAboutMenuItem() { - menuBarHandler.setAboutMenuItemVisible(true); - } - - /** - * Removes the About item from the application menu if the item is present. - * - * @deprecated use {@link #setAboutHandler(AboutHandler)} with a null parameter - * @since 1.4 - */ - @Deprecated - public void removeAboutMenuItem() { - menuBarHandler.setAboutMenuItemVisible(false); - } - - /** - * Determines if the About Preferences of the application menu is present. By default there is no Preferences menu item. - * - * @deprecated no replacement - * @since 1.4 - */ - @Deprecated - public boolean isPreferencesMenuItemPresent() { - return menuBarHandler.isPreferencesMenuItemVisible(); - } - - /** - * Adds the Preferences item to the application menu if the item is not already present. - * - * @deprecated use {@link #setPreferencesHandler(PreferencesHandler)} with a non-null {@link PreferencesHandler} parameter - * @since 1.4 - */ - @Deprecated - public void addPreferencesMenuItem() { - menuBarHandler.setPreferencesMenuItemVisible(true); - } - - /** - * Removes the Preferences item from the application menu if that item is present. - * - * @deprecated use {@link #setPreferencesHandler(PreferencesHandler)} with a null parameter - * @since 1.4 - */ - @Deprecated - public void removePreferencesMenuItem() { - menuBarHandler.setPreferencesMenuItemVisible(false); - } - - /** - * @deprecated Use java.awt.MouseInfo.getPointerInfo().getLocation(). - * - * @since 1.4 - */ - @Deprecated - public static Point getMouseLocationOnScreen() { - return java.awt.MouseInfo.getPointerInfo().getLocation(); - } } --- old/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java 2015-11-24 19:06:33.060601309 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java 2015-11-24 19:06:32.928601305 +0300 @@ -46,7 +46,7 @@ * @see ScreenSleepListener * @see SystemSleepListener * - * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link QuitResponse}. + * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}. * @since 1.4 */ @SuppressWarnings("deprecation") --- old/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java 2015-11-24 19:06:33.520601320 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java 2015-11-24 19:06:33.372601317 +0300 @@ -30,7 +30,7 @@ /** * The class of events sent to the deprecated ApplicationListener callbacks. * - * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link QuitResponse} + * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse} * @since 1.4 */ @Deprecated --- old/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java 2015-11-24 19:06:33.936601331 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java 2015-11-24 19:06:33.796601327 +0300 @@ -47,7 +47,7 @@ * @see SystemSleepListener * * @since 1.4 - * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link QuitResponse} + * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse} */ @SuppressWarnings("deprecation") @Deprecated @@ -134,7 +134,7 @@ * event. To reject the quit, set isHandled(false). * * @param event a Quit Application event - * @deprecated use {@link QuitHandler} and {@link QuitResponse} + * @deprecated use {@link QuitHandler} and {@link MacQuitResponse} */ @Deprecated public void handleQuit(ApplicationEvent event); --- old/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenAdapter.java 2015-11-24 19:06:34.372601342 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenAdapter.java 2015-11-24 19:06:34.232601339 +0300 @@ -25,7 +25,7 @@ package com.apple.eawt; -import com.apple.eawt.AppEvent.FullScreenEvent; +import com.apple.eawt.event.FullScreenEvent; /** * Abstract adapter class for receiving fullscreen events. This class is provided --- old/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenHandler.java 2015-11-24 19:06:34.800601353 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenHandler.java 2015-11-24 19:06:34.672601350 +0300 @@ -25,13 +25,13 @@ package com.apple.eawt; +import com.apple.eawt.event.FullScreenEvent; import java.awt.*; import java.util.*; import java.util.List; import javax.swing.RootPaneContainer; -import com.apple.eawt.AppEvent.FullScreenEvent; import sun.awt.SunToolkit; import java.lang.annotation.Native; --- old/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenListener.java 2015-11-24 19:06:35.232601364 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenListener.java 2015-11-24 19:06:35.092601361 +0300 @@ -25,9 +25,9 @@ package com.apple.eawt; +import com.apple.eawt.event.FullScreenEvent; import java.util.EventListener; -import com.apple.eawt.AppEvent.FullScreenEvent; /** * --- old/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java 2015-11-24 19:06:35.676601376 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java 2015-11-24 19:06:35.540601372 +0300 @@ -35,6 +35,7 @@ class _AppDockIconHandler { private static native void nativeSetDockMenu(final long cmenu); private static native void nativeSetDockIconImage(final long image); + private static native void nativeSetDockIconProgress(final int value); private static native long nativeGetDockIconImage(); private static native void nativeSetDockIconBadge(final String badge); @@ -92,6 +93,10 @@ void setDockIconBadge(final String badge) { nativeSetDockIconBadge(badge); } + + void setDockIconProgress(int value) { + nativeSetDockIconProgress(value); + } static Creator getCImageCreator() { try { --- old/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java 2015-11-24 19:06:36.132601387 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java 2015-11-24 19:06:35.984601383 +0300 @@ -26,6 +26,7 @@ package com.apple.eawt; import java.awt.*; +import java.awt.desktop.*; import java.awt.event.WindowEvent; import java.io.File; import java.net.*; @@ -34,7 +35,7 @@ import sun.awt.AppContext; import sun.awt.SunToolkit; -import com.apple.eawt.AppEvent.*; +import java.awt.AppEvent.*; class _AppEventHandler { private static final int NOTIFY_ABOUT = 1; @@ -84,8 +85,6 @@ final _ScreenSleepDispatcher screenSleepDispatcher = new _ScreenSleepDispatcher(); final _SystemSleepDispatcher systemSleepDispatcher = new _SystemSleepDispatcher(); - final _AppEventLegacyHandler legacyHandler = new _AppEventLegacyHandler(this); - QuitStrategy defaultQuitAction = QuitStrategy.SYSTEM_EXIT_0; _AppEventHandler() { @@ -101,8 +100,8 @@ } } - void addListener(final AppEventListener listener) { - if (listener instanceof AppReOpenedListener) reOpenAppDispatcher.addListener((AppReOpenedListener)listener); + void addListener(final SystemEventListener listener) { + if (listener instanceof AppReopenedListener) reOpenAppDispatcher.addListener((AppReopenedListener)listener); if (listener instanceof AppForegroundListener) foregroundAppDispatcher.addListener((AppForegroundListener)listener); if (listener instanceof AppHiddenListener) hiddenAppDispatcher.addListener((AppHiddenListener)listener); if (listener instanceof UserSessionListener) userSessionDispatcher.addListener((UserSessionListener)listener); @@ -110,8 +109,8 @@ if (listener instanceof SystemSleepListener) systemSleepDispatcher.addListener((SystemSleepListener)listener); } - void removeListener(final AppEventListener listener) { - if (listener instanceof AppReOpenedListener) reOpenAppDispatcher.removeListener((AppReOpenedListener)listener); + void removeListener(final SystemEventListener listener) { + if (listener instanceof AppReopenedListener) reOpenAppDispatcher.removeListener((AppReopenedListener)listener); if (listener instanceof AppForegroundListener) foregroundAppDispatcher.removeListener((AppForegroundListener)listener); if (listener instanceof AppHiddenListener) hiddenAppDispatcher.removeListener((AppHiddenListener)listener); if (listener instanceof UserSessionListener) userSessionDispatcher.removeListener((UserSessionListener)listener); @@ -127,10 +126,10 @@ this.defaultQuitAction = defaultQuitAction; } - QuitResponse currentQuitResponse; - synchronized QuitResponse obtainQuitResponse() { + MacQuitResponse currentQuitResponse; + synchronized MacQuitResponse obtainQuitResponse() { if (currentQuitResponse != null) return currentQuitResponse; - return currentQuitResponse = new QuitResponse(this); + return currentQuitResponse = new MacQuitResponse(this); } synchronized void cancelQuit() { @@ -270,10 +269,10 @@ } } - class _AppReOpenedDispatcher extends _AppEventMultiplexor { - void performOnListener(AppReOpenedListener listener, final _NativeEvent event) { - final AppReOpenedEvent e = new AppReOpenedEvent(); - listener.appReOpened(e); + class _AppReOpenedDispatcher extends _AppEventMultiplexor { + void performOnListener(AppReopenedListener listener, final _NativeEvent event) { + final AppReopenedEvent e = new AppReopenedEvent(); + listener.appReopened(e); } } @@ -391,7 +390,7 @@ } void performUsing(final QuitHandler handler, final _NativeEvent event) { - final QuitResponse response = obtainQuitResponse(); // obtains the "current" quit response + final MacQuitResponse response = obtainQuitResponse(); // obtains the "current" quit response handler.handleQuitRequestWith(new QuitEvent(), response); } } @@ -524,9 +523,6 @@ setHandlerContext(AppContext.getAppContext()); - // if a new handler is installed, block addition of legacy ApplicationListeners - if (handler == legacyHandler) return; - legacyHandler.blockLegacyAPI(); } void performDefaultAction(final _NativeEvent event) { } // by default, do nothing @@ -574,10 +570,6 @@ } } } - - // if a new handler is installed, block addition of legacy ApplicationListeners - if (handler == legacyHandler) return; - legacyHandler.blockLegacyAPI(); } } } --- old/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java 2015-11-24 19:06:36.564601398 +0300 +++ new/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java 2015-11-24 19:06:36.428601395 +0300 @@ -26,7 +26,6 @@ package com.apple.eawt; import java.awt.Frame; -import java.awt.peer.MenuComponentPeer; import javax.swing.*; import javax.swing.plaf.MenuBarUI; --- old/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java 2015-11-24 19:06:36.984601409 +0300 +++ new/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java 2015-11-24 19:06:36.832601405 +0300 @@ -371,6 +371,11 @@ } @Override + public final boolean isTaskbarSupported() { + return true; + } + + @Override public final KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() { return LWKeyboardFocusManagerPeer.getInstance(); } --- old/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDesktopPeer.java 2015-11-24 19:06:37.392601419 +0300 +++ new/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDesktopPeer.java 2015-11-24 19:06:37.268601416 +0300 @@ -25,9 +25,14 @@ package sun.lwawt.macosx; +import com.apple.eawt.Application; + +import javax.swing.*; import java.awt.Desktop.Action; +import java.awt.desktop.*; import java.awt.peer.DesktopPeer; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; @@ -37,34 +42,126 @@ * * @see DesktopPeer */ -public class CDesktopPeer implements DesktopPeer { +final public class CDesktopPeer implements DesktopPeer { + @Override public boolean isSupported(Action action) { - // OPEN, EDIT, PRINT, MAIL, BROWSE all supported. - // Though we don't really differentiate between OPEN / EDIT return true; } + @Override public void open(File file) throws IOException { this.lsOpenFile(file, false); } + @Override public void edit(File file) throws IOException { this.lsOpenFile(file, false); } + @Override public void print(File file) throws IOException { this.lsOpenFile(file, true); } + @Override public void mail(URI uri) throws IOException { this.lsOpen(uri); } + @Override public void browse(URI uri) throws IOException { this.lsOpen(uri); } + @Override + public void addAppEventListener(SystemEventListener listener) { + Application.getApplication().addAppEventListener(listener); + } + + @Override + public void removeAppEventListener(SystemEventListener listener) { + Application.getApplication().removeAppEventListener(listener); + } + + @Override + public void setAboutHandler(AboutHandler aboutHandler) { + Application.getApplication().setAboutHandler(aboutHandler); + } + + @Override + public void setPreferencesHandler(PreferencesHandler preferencesHandler) { + Application.getApplication().setPreferencesHandler(preferencesHandler); + } + + @Override + public void setOpenFileHandler(OpenFilesHandler openFileHandler) { + Application.getApplication().setOpenFileHandler(openFileHandler); + } + + @Override + public void setPrintFileHandler(PrintFilesHandler printFileHandler) { + Application.getApplication().setPrintFileHandler(printFileHandler); + } + + @Override + public void setOpenURIHandler(OpenURIHandler openURIHandler) { + Application.getApplication().setOpenURIHandler(openURIHandler); + } + + @Override + public void setQuitHandler(QuitHandler quitHandler) { + Application.getApplication().setQuitHandler(quitHandler); + } + + @Override + public void setQuitStrategy(QuitStrategy strategy) { + Application.getApplication().setQuitStrategy(strategy); + } + + @Override + public void enableSuddenTermination() { + Application.getApplication().enableSuddenTermination(); + } + + @Override + public void disableSuddenTermination() { + Application.getApplication().disableSuddenTermination(); + } + + @Override + public void requestForeground(boolean allWindows) { + Application.getApplication().requestForeground(allWindows); + } + + @Override + public void openHelpViewer() { + Application.getApplication().openHelpViewer(); + } + + @Override + public void setDefaultMenuBar(JMenuBar menuBar) { + Application.getApplication().setDefaultMenuBar(menuBar); + } + + @Override + public boolean browseFileDirectory(File file) { + try { + return com.apple.eio.FileManager.revealInFinder(file); + } catch (FileNotFoundException ex) { + return false; //handled in java.awt.Desktop + } + } + + @Override + public boolean moveToTrash(File file) { + try { + return com.apple.eio.FileManager.moveToTrash(file); + } catch (FileNotFoundException ex) { + return false; //handled in java.awt.Desktop + } + } + private void lsOpen(URI uri) throws IOException { int status = _lsOpenURI(uri.toString()); --- old/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java 2015-11-24 19:06:37.892601432 +0300 +++ new/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java 2015-11-24 19:06:37.668601427 +0300 @@ -25,6 +25,7 @@ package sun.lwawt.macosx; +import java.awt.peer.TaskbarPeer; import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.dnd.*; @@ -296,6 +297,11 @@ public DesktopPeer createDesktopPeer(Desktop target) { return new CDesktopPeer(); } + + @Override + public TaskbarPeer createTaskbarPeer(Taskbar target) { + return new CTaskbarPeer(); + } @Override public LWCursorManager getCursorManager() { --- old/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.h 2015-11-24 19:06:38.360601444 +0300 +++ new/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.h 2015-11-24 19:06:38.208601440 +0300 @@ -39,6 +39,8 @@ NSMenu *fDockMenu; CMenuBar *fDefaultMenuBar; + + NSProgressIndicator *fProgressIndicator; BOOL fHandlesDocumentTypes; BOOL fHandlesURLTypes; @@ -47,6 +49,8 @@ @property (nonatomic, retain) NSMenuItem *fPreferencesMenu; @property (nonatomic, retain) NSMenuItem *fAboutMenu; +@property (nonatomic, retain) NSProgressIndicator *fProgressIndicator; + @property (nonatomic, retain) NSMenu *fDockMenu; @property (nonatomic, retain) CMenuBar *fDefaultMenuBar; --- old/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m 2015-11-24 19:06:38.800601455 +0300 +++ new/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m 2015-11-24 19:06:38.664601452 +0300 @@ -100,6 +100,7 @@ @synthesize fPreferencesMenu; @synthesize fAboutMenu; +@synthesize fProgressIndicator; @synthesize fDockMenu; @synthesize fDefaultMenuBar; @@ -200,6 +201,18 @@ self.fPreferencesMenu = (NSMenuItem*)[appMenu itemWithTag:PREFERENCES_TAG]; self.fAboutMenu = (NSMenuItem*)[appMenu itemAtIndex:0]; + + NSDockTile *dockTile = [NSApp dockTile]; + self.fProgressIndicator = [[NSProgressIndicator alloc] + initWithFrame:NSMakeRect(3.f, 0.f, dockTile.size.width - 6.f, 20.f)]; + + [fProgressIndicator setStyle:NSProgressIndicatorBarStyle]; + [fProgressIndicator setIndeterminate:NO]; + [[dockTile contentView] addSubview:fProgressIndicator]; + [fProgressIndicator setMinValue:0]; + [fProgressIndicator setMaxValue:100]; + [fProgressIndicator setHidden:YES]; + [fProgressIndicator release]; // If the java application has a bundle with an Info.plist file with // a CFBundleDocumentTypes entry, then it is set up to handle Open Doc @@ -252,6 +265,7 @@ self.fAboutMenu = nil; self.fDockMenu = nil; self.fDefaultMenuBar = nil; + self.fProgressIndicator = nil; [super dealloc]; } @@ -468,6 +482,9 @@ [dockImageView setImageScaling:NSImageScaleProportionallyUpOrDown]; [dockImageView setImage:image]; + [[ApplicationDelegate sharedDelegate].fProgressIndicator removeFromSuperview]; + [dockImageView addSubview:[ApplicationDelegate sharedDelegate].fProgressIndicator]; + // add it to the NSDockTile [dockTile setContentView: dockImageView]; [dockTile display]; @@ -475,6 +492,20 @@ [dockImageView release]; } ++ (void)_setDockIconProgress:(NSNumber *)value { +AWT_ASSERT_APPKIT_THREAD; + + ApplicationDelegate *delegate = [ApplicationDelegate sharedDelegate]; + if ([value doubleValue] >= 0 && [value doubleValue] <=100) { + [delegate.fProgressIndicator setDoubleValue:[value doubleValue]]; + [delegate.fProgressIndicator setHidden:NO]; + } else { + [delegate.fProgressIndicator setHidden:YES]; + } + + [[NSApp dockTile] display]; +} + // Obtains the image of the Dock icon, either manually set, a drawn copy, or the default NSApplicationIcon + (NSImage *)_dockIconImage { AWT_ASSERT_APPKIT_THREAD; @@ -609,6 +640,24 @@ } /* + * Class: com_apple_eawt__AppDockIconHandler + * Method: nativeSetDockIconProgress + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_apple_eawt__1AppDockIconHandler_nativeSetDockIconProgress + (JNIEnv *env, jclass clz, jint value) +{ + JNF_COCOA_ENTER(env); + + [ThreadUtilities performOnMainThread:@selector(_setDockIconProgress:) + on:[ApplicationDelegate class] + withObject:[NSNumber numberWithInt:value] + waitUntilDone:NO]; + + JNF_COCOA_EXIT(env); +} + +/* * Class: com_apple_eawt__AppDockIconHandler * Method: nativeGetDockIconImage * Signature: ()J --- old/src/java.desktop/share/classes/java/awt/Desktop.java 2015-11-24 19:06:39.260601467 +0300 +++ new/src/java.desktop/share/classes/java/awt/Desktop.java 2015-11-24 19:06:39.120601464 +0300 @@ -25,6 +25,7 @@ package java.awt; +import java.awt.desktop.*; import java.awt.peer.DesktopPeer; import java.io.File; import java.io.FilePermission; @@ -35,12 +36,11 @@ import java.net.URL; import sun.awt.SunToolkit; +import javax.swing.JMenuBar; import sun.security.util.SecurityConstants; /** - * The {@code Desktop} class allows a Java application to launch - * associated applications registered on the native desktop to handle - * a {@link java.net.URI} or a file. + * The {@code Desktop} class allows interact with various desktop capabilities. * *

Supported operations include: *