use of com.apple.eawt.AppEvent.OpenFilesEvent in project energy3d by concord-consortium.
the class Mac method init.
public static void init() {
final Application application = Application.getApplication();
application.setDockIconImage(Toolkit.getDefaultToolkit().getImage(MainFrame.class.getResource("icons/icon.png")));
application.setOpenFileHandler(new OpenFilesHandler() {
@Override
public void openFiles(final OpenFilesEvent e) {
MainApplication.isMacOpeningFile = true;
SceneManager.getTaskManager().update(new Callable<Object>() {
@Override
public Object call() throws Exception {
// somehow newFile() must be called to set up the scene before we can correctly load the content when an NG3 file is double-clicked without an open instance
if (Scene.getURL() == null) {
Scene.newFile();
}
try {
Scene.open(new File(e.getFiles().get(0).toString()).toURI().toURL());
} catch (final Throwable err) {
BugReporter.report(err, e.getFiles().get(0).toString());
}
return null;
}
});
}
});
application.setAboutHandler(new AboutHandler() {
@Override
public void handleAbout(final AboutEvent e) {
MainFrame.getInstance().showAbout();
}
});
application.setPreferencesHandler(new PreferencesHandler() {
@Override
public void handlePreferences(final PreferencesEvent e) {
MainFrame.getInstance().showPreferences();
}
});
application.setQuitHandler(new QuitHandler() {
@Override
public void handleQuitRequestWith(final QuitEvent e, final QuitResponse r) {
MainFrame.getInstance().exit();
r.cancelQuit();
}
});
}
Aggregations