aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobesedin2012-05-03 13:26:56 (EDT)
committerobesedin2012-05-03 13:31:13 (EDT)
commit68b24c3d9b0010da4389117f4238927162aac2a3 (patch)
treec46ace50d00e6659172cf13d2241db70410e2a2b
parentaa3fabc57b242fcd960289450fa938b613eae295 (diff)
downloadeclipse.platform.ui-68b24c3d9b0010da4389117f4238927162aac2a3.zip
eclipse.platform.ui-68b24c3d9b0010da4389117f4238927162aac2a3.tar.gz
eclipse.platform.ui-68b24c3d9b0010da4389117f4238927162aac2a3.tar.bz2
Bug 375744 - Command-Q does not ask to confirm exitv20120503-1731I20120503-1500
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/src/org/eclipse/e4/ui/workbench/renderers/swt/cocoa/CocoaUIHandler.java1
-rw-r--r--bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.ui.ide.application/plugin.xml7
-rw-r--r--bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/QuitHandler.java45
4 files changed, 55 insertions, 1 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/src/org/eclipse/e4/ui/workbench/renderers/swt/cocoa/CocoaUIHandler.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/src/org/eclipse/e4/ui/workbench/renderers/swt/cocoa/CocoaUIHandler.java
index 1ce3943..c68c45f 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/src/org/eclipse/e4/ui/workbench/renderers/swt/cocoa/CocoaUIHandler.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/src/org/eclipse/e4/ui/workbench/renderers/swt/cocoa/CocoaUIHandler.java
@@ -598,6 +598,7 @@ public class CocoaUIHandler {
// cribbed from SWT Snippet347
private void hookApplicationMenu() {
+ hookAppMenuItem(SWT.ID_QUIT, COMMAND_ID_QUIT);
hookAppMenuItem(SWT.ID_PREFERENCES, COMMAND_ID_PREFERENCES);
hookAppMenuItem(SWT.ID_ABOUT, COMMAND_ID_ABOUT);
}
diff --git a/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF
index 1da7ddd..bd2a535 100644
--- a/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF
@@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.6.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
org.eclipse.core.net;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.core.filesystem;bundle-version="1.3.0"
+ org.eclipse.core.filesystem;bundle-version="1.3.0",
+ org.eclipse.core.expressions;bundle-version="[3.4.300,4.0.0)"
Export-Package: org.eclipse.ui.internal.ide.application;x-internal:=true,
org.eclipse.ui.internal.ide.application.dialogs;x-internal:=true
Import-Package: com.ibm.icu.text
diff --git a/bundles/org.eclipse.ui.ide.application/plugin.xml b/bundles/org.eclipse.ui.ide.application/plugin.xml
index ee32e3d..c98ea62 100644
--- a/bundles/org.eclipse.ui.ide.application/plugin.xml
+++ b/bundles/org.eclipse.ui.ide.application/plugin.xml
@@ -106,4 +106,11 @@
</menu>
</menuContribution>
</extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.ui.internal.ide.application.QuitHandler"
+ commandId="org.eclipse.ui.file.exit">
+ </handler>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/QuitHandler.java b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/QuitHandler.java
new file mode 100644
index 0000000..1b0cf65
--- /dev/null
+++ b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/QuitHandler.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Brian de Alwis - adapted to prompt user for confirmation
+ *******************************************************************************/
+package org.eclipse.ui.internal.ide.application;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Adaptation of {@link org.eclipse.ui.internal.handlers.QuitHandler} that
+ * prompts the user to confirm whether to quit.
+ */
+public class QuitHandler extends AbstractHandler {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
+ * ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEvaluationContext context = (IEvaluationContext) event.getApplicationContext();
+ IWorkbench workbench = (IWorkbench) context.getVariable(IWorkbench.class.getName());
+ Shell shell = HandlerUtil.getActiveShell(event);
+ if (IDEWorkbenchWindowAdvisor.promptOnExit(shell)) {
+ workbench.close();
+ }
+ return null;
+ }
+
+}