use of com.apple.eawt.Application in project zaproxy by zaproxy.
the class OsXGui method setup.
/**
* Setups the GUI of ZAP for OSX.
* <p>
* Sets OS X related GUI properties and functionalities.
*/
public static void setup() {
// Set the various and sundry OS X-specific system properties
System.setProperty("apple.laf.useScreenMenuBar", "true");
// Broken and unfixed; thanks, Apple
System.setProperty("dock:name", "ZAP");
// more thx
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ZAP");
// Override various handlers, so that About, Preferences, and Quit behave in an OS X typical fashion.
LOGGER.info("Initializing OS X specific settings, despite Apple's best efforts");
// Attempt to load the apple classes
Application app = Application.getApplication();
// Set the dock image icon
Image img = Toolkit.getDefaultToolkit().getImage(GuiBootstrap.class.getResource("/resource/zap1024x1024.png"));
app.setDockIconImage(img);
// Set handlers for About and Preferences
app.setAboutHandler(new OSXAboutHandler());
app.setPreferencesHandler(new OSXPreferencesHandler());
// Let's not forget to clean up our database mess when we Quit
OSXQuitHandler quitHandler = new OSXQuitHandler();
// quitHandler.removeZAPViewItem(view); // TODO
app.setQuitHandler(quitHandler);
}
use of com.apple.eawt.Application in project VocabHunter by VocabHunter.
the class OsxEventSource method setListener.
@Override
public void setListener(final ExternalEventListener listener) {
Application application = Application.getApplication();
application.setOpenFileHandler(new OsxOpenFilesHandler(listener));
}
use of com.apple.eawt.Application in project cayenne by apache.
the class OSXApplicationWrapper method setHandler.
private void setHandler(Method setMethod, Class<?> handlerClass, Runnable action) {
InvocationHandler handler = (proxy, method, args) -> {
action.run();
return null;
};
Object proxy = createProxy(handlerClass, handler);
try {
setMethod.invoke(application, proxy);
} catch (IllegalAccessException | InvocationTargetException ex) {
logger.warn("Unable to call " + setMethod.getName(), ex);
}
}
use of com.apple.eawt.Application in project cayenne by apache.
the class OSXApplicationWrapper method setQuitHandler.
public void setQuitHandler(Consumer<OSXQuitResponseWrapper> action) {
InvocationHandler handler = (proxy, method, args) -> {
// args: 0 - event, 1 - quitResponse
action.accept(new OSXQuitResponseWrapper(args[1]));
return null;
};
Object proxy = createProxy(quitHandlerClass, handler);
try {
setQuitHandler.invoke(application, proxy);
} catch (IllegalAccessException | InvocationTargetException ex) {
logger.warn("Unable to call " + setQuitHandler.getName(), ex);
}
}
use of com.apple.eawt.Application in project gocd by gocd.
the class AgentMacWindow method initializeApplicationAdapter.
private MacBootstrapperApplicationAdapter initializeApplicationAdapter() {
Application application = Application.getApplication();
application.setEnabledPreferencesMenu(true);
application.setEnabledAboutMenu(true);
setVisible(false);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setResizable(false);
setSize(getPreferredSize());
MacBootstrapperApplicationAdapter applicationAdapter = new MacBootstrapperApplicationAdapter(this);
application.addApplicationListener(applicationAdapter);
return applicationAdapter;
}
Aggregations