Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Roldan Betancort2008-12-19 12:41:19 +0000
committerVictor Roldan Betancort2008-12-19 12:41:19 +0000
commitb342286c537eb742352e7da8d48a41d2182c8795 (patch)
treea1a14cc03c8677ecc6acbf58b7c39ec1ad74cd58 /plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
parent55e502264d0c0ea02fed296bebbc8a2354bf69bb (diff)
downloadcdo-b342286c537eb742352e7da8d48a41d2182c8795.tar.gz
cdo-b342286c537eb742352e7da8d48a41d2182c8795.tar.xz
cdo-b342286c537eb742352e7da8d48a41d2182c8795.zip
[244129] [UI] Show warning when closing a session/transaction with uncommitted changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244129
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
index e4439662ea..ee817758d6 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
@@ -4,15 +4,19 @@
* 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:
* Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.actions;
import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IWorkbenchPage;
/**
@@ -30,8 +34,23 @@ public final class CloseSessionAction extends SessionAction
}
@Override
+ protected void preRun() throws Exception
+ {
+ if (CDOUtil.isSessionDirty(getSession()))
+ {
+ MessageDialog dialog = new MessageDialog(getShell(), TITLE, null,
+ "You have uncommitted changes. Do you want to discard them?", MessageDialog.QUESTION, new String[] {
+ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
+ if (dialog.open() != MessageDialog.OK)
+ {
+ cancel();
+ }
+ }
+ }
+
+ @Override
protected void doRun(IProgressMonitor progressMonitor) throws Exception
{
getSession().close();
- }
+ }
}

Back to the top