Merge pull request #845 from ultraklon/modification4

Proposed fix for #814
This commit is contained in:
Tom Morris 2014-04-20 23:27:18 -04:00
commit dd18f09390
2 changed files with 1 additions and 33 deletions

Binary file not shown.

View File

@ -461,44 +461,12 @@ class RefineClient extends JFrame implements ActionListener {
final static Logger logger = LoggerFactory.getLogger("refine-client");
public static boolean MACOSX = (System.getProperty("os.name").toLowerCase().startsWith("mac os x"));
private URI uri;
public void init(String host, int port) throws Exception {
uri = new URI("http://" + host + ":" + port + "/");
if (MACOSX) {
// for more info on the code found here that is macosx-specific see:
// http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html
// http://developer.apple.com/mac/library/releasenotes/CrossPlatform/JavaSnowLeopardUpdate1LeopardUpdate6RN/NewandNoteworthy/NewandNoteworthy.html
JMenuBar mb = new JMenuBar();
JMenu m = new JMenu("Open");
JMenuItem mi = new JMenuItem("Open New Refine Window...");
mi.addActionListener(this);
m.add(mi);
mb.add(m);
Class<?> applicationClass = Class.forName("com.apple.eawt.Application");
Object macOSXApplication = applicationClass.getConstructor((Class[]) null).newInstance((Object[]) null);
Method setDefaultMenuBar = applicationClass.getDeclaredMethod("setDefaultMenuBar", new Class[] { JMenuBar.class });
setDefaultMenuBar.invoke(macOSXApplication, new Object[] { mb });
// FIXME(SM): this part below doesn't seem to work, I get a NPE but I have *no* idea why, suggestions?
// PopupMenu dockMenu = new PopupMenu("dock");
// MenuItem mmi = new MenuItem("Open new Refine Window...");
// mmi.addActionListener(this);
// dockMenu.add(mmi);
// this.add(dockMenu);
//
// Method setDockMenu = applicationClass.getDeclaredMethod("setDockMenu", new Class[] { PopupMenu.class });
// setDockMenu.invoke(macOSXApplication, new Object[] { dockMenu });
}
openBrowser();
}
@ -550,4 +518,4 @@ class ShutdownSignalHandler implements Runnable {
}
}