diff options
author | Martin Fluegge | 2011-10-30 11:28:09 +0000 |
---|---|---|
committer | Martin Fluegge | 2011-10-30 11:28:09 +0000 |
commit | 31a6535193b0496546baaf1856516a534a9f7bbc (patch) | |
tree | 4cae84a86db55e262d7cb6aca2a2f0930f504192 /plugins/org.eclipse.emf.cdo.dawn | |
parent | 44bf2d4233e0ce1a90b2a48a7eb3c8be892e70f7 (diff) | |
download | cdo-31a6535193b0496546baaf1856516a534a9f7bbc.tar.gz cdo-31a6535193b0496546baaf1856516a534a9f7bbc.tar.xz cdo-31a6535193b0496546baaf1856516a534a9f7bbc.zip |
clean up
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/actions/HandleConflictsAction.java | 178 |
1 files changed, 87 insertions, 91 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/actions/HandleConflictsAction.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/actions/HandleConflictsAction.java index ff94033a4f..2eb56259f4 100644 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/actions/HandleConflictsAction.java +++ b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/actions/HandleConflictsAction.java @@ -1,91 +1,87 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.actions; - -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper; -import org.eclipse.emf.cdo.internal.dawn.bundle.OM; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; - -/** - * Since Dawn 0.2 this class is deprecated and replaced with "org.eclipse.emf.cdo.dawn.handlers.SolveConflictHandler". - * It will be removed soon. - * - * @author Martin Fluegge - */ -@Deprecated -public class HandleConflictsAction implements IObjectActionDelegate -{ - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HandleConflictsAction.class); - - private Object selectedElement; - - public final static String ID = "org.eclipse.emf.cdo.dawn.actions.HandleConflictAction"; - - public HandleConflictsAction() - { - } - - public void run(IAction action) - { - - if (TRACER.isEnabled()) - { - TRACER.format("Start solving conflicts for {0}", selectedElement); //$NON-NLS-1$ - } - - IEditorPart activeEditor = DawnEditorHelper.getActiveEditor(); - if (activeEditor instanceof IDawnEditor) - { - MessageDialog dialog = new MessageDialog(DawnEditorHelper.getActiveShell(), "Conflict", null, - "There are conflicts in your diagram. Would you like to rollback your current transaction?", - MessageDialog.QUESTION, new String[] { "yes", "no", "Cancel" }, 1); - - switch (dialog.open()) - { - case 0: // yes - // DawnConflictHelper.rollback((DiagramDocumentEditor)activeEditor); - ((IDawnEditor)activeEditor).getDawnEditorSupport().rollback(); - break; - case 1: // no - break; - default: // cancel - break; - } - } - } - - public void selectionChanged(IAction action, ISelection selection) - { - selectedElement = null; - if (selection instanceof IStructuredSelection) - { - IStructuredSelection structuredSelection = (IStructuredSelection)selection; - // if (structuredSelection.getFirstElement() instanceof EditPart) - { - selectedElement = structuredSelection.getFirstElement(); - } - } - } - - public void setActivePart(IAction action, IWorkbenchPart targetPart) - { - } -} +/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.actions;
+
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
+import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper;
+import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Since Dawn 0.2 this class is deprecated and replaced with "org.eclipse.emf.cdo.dawn.handlers.SolveConflictHandler".
+ * It will be removed soon.
+ *
+ * @author Martin Fluegge
+ */
+@Deprecated
+public class HandleConflictsAction implements IObjectActionDelegate
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HandleConflictsAction.class);
+
+ private Object selectedElement;
+
+ public final static String ID = "org.eclipse.emf.cdo.dawn.actions.HandleConflictAction";
+
+ public void run(IAction action)
+ {
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Start solving conflicts for {0}", selectedElement); //$NON-NLS-1$
+ }
+
+ IEditorPart activeEditor = DawnEditorHelper.getActiveEditor();
+ if (activeEditor instanceof IDawnEditor)
+ {
+ MessageDialog dialog = new MessageDialog(DawnEditorHelper.getActiveShell(), "Conflict", null,
+ "There are conflicts in your diagram. Would you like to rollback your current transaction?",
+ MessageDialog.QUESTION, new String[] { "yes", "no", "Cancel" }, 1);
+
+ switch (dialog.open())
+ {
+ case 0: // yes
+ // DawnConflictHelper.rollback((DiagramDocumentEditor)activeEditor);
+ ((IDawnEditor)activeEditor).getDawnEditorSupport().rollback();
+ break;
+ case 1: // no
+ break;
+ default: // cancel
+ break;
+ }
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection)
+ {
+ selectedElement = null;
+ if (selection instanceof IStructuredSelection)
+ {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ // if (structuredSelection.getFirstElement() instanceof EditPart)
+ {
+ selectedElement = structuredSelection.getFirstElement();
+ }
+ }
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart)
+ {
+ }
+}
|