static final int quitAppProc(int theAppleEvent, int reply, int handlerRefcon) { UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.dispose(false, false); } else { UIExitUtilsSWT.setSkipCloseCheck(true); Display.getDefault().dispose(); } return noErr; }
static final int commandProc(int nextHandler, int theEvent, int userData) { try { int kind = ((Number) invoke(claOS, null, "GetEventKind", new Object[] {theEvent})).intValue(); if (kind == kEventProcessCommand) { Object command = claHICommand.newInstance(); // int GetEventParameter(int inEvent, int inName, int inDesiredType, // int[] outActualType, int inBufferSize, int[] outActualSize, HICommand outData); invoke( claOS, null, "GetEventParameter", new Class[] { int.class, int.class, int.class, int[].class, int.class, int[].class, claHICommand }, new Object[] { theEvent, kEventParamDirectObject, typeHICommand, null, claHICommand.getField("sizeof").getInt(command), null, command }); int commandID = claHICommand.getField("commandID").getInt(command); switch (commandID) { case kHICommandPreferences: { UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.openView(UIFunctions.VIEW_CONFIG, null); } return noErr; } case kHICommandAbout: AboutWindow.show(); return noErr; case kHICommandRestart: { UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.dispose(true, false); } return noErr; } case kHICommandWizard: new ConfigureWizard(false, ConfigureWizard.WIZARD_MODE_FULL); return noErr; case kHICommandNatTest: new NatTestWindow(); return noErr; case kHICommandSpeedTest: new SpeedTestWizard(); return noErr; case kAEQuitApplication: UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.dispose(false, false); return noErr; } else { UIExitUtilsSWT.setSkipCloseCheck(true); } default: break; } } } catch (Throwable t) { Debug.out(t); } return eventNotHandledErr; }