diff options
author | Martin Fluegge | 2011-08-09 15:45:56 +0000 |
---|---|---|
committer | Martin Fluegge | 2011-08-09 15:45:56 +0000 |
commit | 6da925d59e1d48ac6200308c1951cc33132042a2 (patch) | |
tree | f873bc1ac786d85b8ce16845c97240f5ec66894a /plugins/org.eclipse.emf.cdo.dawn | |
parent | c897ef8db9fe36446d579a761896273208ac67f2 (diff) | |
download | cdo-6da925d59e1d48ac6200308c1951cc33132042a2.tar.gz cdo-6da925d59e1d48ac6200308c1951cc33132042a2.tar.xz cdo-6da925d59e1d48ac6200308c1951cc33132042a2.zip |
[332902] [Dawn] Decouple Dawn Runtime from integrated frameworks
https://bugs.eclipse.org/bugs/show_bug.cgi?id=332902
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn')
28 files changed, 189 insertions, 2358 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.dawn/.settings/.api_filters index 56f7b38bba..4e3a23a4e3 100644 --- a/plugins/org.eclipse.emf.cdo.dawn/.settings/.api_filters +++ b/plugins/org.eclipse.emf.cdo.dawn/.settings/.api_filters @@ -1,13 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.emf.cdo.dawn" version="2">
- <resource path="src/org/eclipse/emf/cdo/dawn/resources/DawnPathmapManager.java" type="org.eclipse.emf.cdo.dawn.resources.DawnPathmapManager">
- <filter comment="To be fixed later" id="576720909">
- <message_arguments>
- <message_argument value="PathmapManager"/>
- <message_argument value="DawnPathmapManager"/>
- </message_arguments>
- </filter>
- </resource>
<resource path="src/org/eclipse/emf/cdo/dawn/resources/DawnResourceFactory.java" type="org.eclipse.emf.cdo.dawn.resources.DawnResourceFactory">
<filter id="571473929">
<message_arguments>
diff --git a/plugins/org.eclipse.emf.cdo.dawn/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.dawn/META-INF/MANIFEST.MF index e8ff091d1a..d8280ea589 100644 --- a/plugins/org.eclipse.emf.cdo.dawn/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.dawn/META-INF/MANIFEST.MF @@ -2,45 +2,31 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.cdo.dawn;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Activator: org.eclipse.emf.cdo.dawn.DawnRuntimePlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", org.eclipse.ui;bundle-version="[3.4.0,4.0.0)", org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)", - org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)", + org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)";visibility:=reexport, org.eclipse.emf.cdo.dawn.util;bundle-version="[1.0.0,2.0.0)", - org.eclipse.gmf.runtime.common.core;bundle-version="[1.4.0,2.0.0)", - org.eclipse.gmf.runtime.common.ui;bundle-version="[1.4.0,2.0.0)", - org.eclipse.gmf.runtime.diagram.core;bundle-version="[1.3.0,2.0.0)", - org.eclipse.gmf.runtime.diagram.ui;bundle-version="[1.4.0,2.0.0)", - org.eclipse.gmf.runtime.diagram.ui.actions;bundle-version="[1.4.0,2.0.0)", - org.eclipse.gmf.runtime.emf.core;bundle-version="[1.4.0,2.0.0)", - org.eclipse.gmf.runtime.notation;bundle-version="[1.4.0,2.0.0)", - org.eclipse.gmf.runtime.notation.edit;bundle-version="[1.4.0,2.0.0)", - org.eclipse.gmf.runtime.notation.providers;bundle-version="[1.3.0,2.0.0)", - org.eclipse.gmf.runtime.diagram.ui.resources.editor;bundle-version="[1.3.0,2.0.0)", - org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.2.0,2.0.0)", - org.eclipse.emf.common.ui;bundle-version="[2.6.0,3.0.0)" + org.eclipse.emf.common.ui;bundle-version="[2.6.0,3.0.0)", + org.eclipse.emf.transaction;bundle-version="[1.4.0,2.0.0)" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.eclipse.emf.cdo.dawn;version="1.0.0", - org.eclipse.emf.cdo.dawn.actions;version="1.0.0";x-internal:=true, - org.eclipse.emf.cdo.dawn.appearance;version="1.0.0", - org.eclipse.emf.cdo.dawn.appearance.impl;version="1.0.0", - org.eclipse.emf.cdo.dawn.commands;version="1.0.0", - org.eclipse.emf.cdo.dawn.conflicts;version="1.0.0", - org.eclipse.emf.cdo.dawn.editors;version="1.0.0", - org.eclipse.emf.cdo.dawn.editors.impl;version="1.0.0", - org.eclipse.emf.cdo.dawn.elementtypes;version="1.0.0", - org.eclipse.emf.cdo.dawn.handlers;version="1.0.0";x-internal:=true, - org.eclipse.emf.cdo.dawn.helper;version="1.0.0", - org.eclipse.emf.cdo.dawn.notifications;version="1.0.0", - org.eclipse.emf.cdo.dawn.notifications.impl;version="1.0.0";x-internal:=true, - org.eclipse.emf.cdo.dawn.preferences;version="1.0.0", - org.eclipse.emf.cdo.dawn.resources;version="1.0.0", - org.eclipse.emf.cdo.dawn.resources.impl;version="1.0.0", - org.eclipse.emf.cdo.dawn.synchronize;version="1.0.0", - org.eclipse.emf.cdo.dawn.transaction;version="1.0.0", - org.eclipse.emf.cdo.internal.dawn.bundle;version="1.0.0" +Export-Package: org.eclipse.emf.cdo.dawn;version="2.0.0", + org.eclipse.emf.cdo.dawn.actions;version="2.0.0";x-internal:=true, + org.eclipse.emf.cdo.dawn.appearance;version="2.0.0", + org.eclipse.emf.cdo.dawn.commands;version="2.0.0", + org.eclipse.emf.cdo.dawn.conflicts;version="2.0.0", + org.eclipse.emf.cdo.dawn.editors;version="2.0.0", + org.eclipse.emf.cdo.dawn.editors.impl;version="2.0.0", + org.eclipse.emf.cdo.dawn.handlers;version="2.0.0";x-internal:=true, + org.eclipse.emf.cdo.dawn.helper;version="2.0.0", + org.eclipse.emf.cdo.dawn.notifications;version="2.0.0", + org.eclipse.emf.cdo.dawn.preferences;version="2.0.0", + org.eclipse.emf.cdo.dawn.resources;version="2.0.0", + org.eclipse.emf.cdo.dawn.resources.impl;version="2.0.0", + org.eclipse.emf.cdo.dawn.transaction;version="2.0.0", + org.eclipse.emf.cdo.internal.dawn.bundle;version="2.0.0" Bundle-Vendor: %providerName diff --git a/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.listeners.exsd b/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.listeners.exsd index ccc087df42..515266a297 100644 --- a/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.listeners.exsd +++ b/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.listeners.exsd @@ -1,125 +1,125 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.emf.cdo.dawn" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appinfo> - <meta.schema plugin="org.eclipse.emf.cdo.dawn" id="org.eclipse.emf.cdo.dawn.listeners" name="DawnListeners"/> - </appinfo> - <documentation> - This extension point allows to add a tranaction listener to the editor's related transaction. This Listener must extend org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener. This allows to change the editors behavior an transaction changes. - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appinfo> - <meta.element /> - </appinfo> - </annotation> - <complexType> - <sequence> - <element ref="DawnTransactionListener"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute translatable="true"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="DawnResourceListener"> - <complexType> - <attribute name="class" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn="org.eclipse.emf.cdo.dawn.notifications.AbstractDawnResoureChangeListener:"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="DawnTransactionListener"> - <complexType> - <attribute name="class" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn="org.eclipse.emf.cdo.dawn.notifications.AbstractDawnListener:"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appinfo> - <meta.section type="since"/> - </appinfo> - <documentation> - 0.2.0 - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="examples"/> - </appinfo> - <documentation> - This examples shows how to set an own implementation to the extension point. -<pre> - <extension point="org.eclipse.emf.cdo.dawn.listeners"> - <DawnTransactionListener - class="org.eclipse.emf.cdo.dawn.notifications.DawnGMFTransactionListener"> - </DawnTransactionListener> - </extension> -</pre> - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="apiinfo"/> - </appinfo> - <documentation> - Extend org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener and override the method notifyEvent(IEvent event) to change the behavior. Set your implementation to the <b>class</b> attribute of the extension point. - </documentation> - </annotation> - - - <annotation> - <appinfo> - <meta.section type="copyright"/> - </appinfo> - <documentation> - Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.<br> -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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> - </documentation> - </annotation> - -</schema> +<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.cdo.dawn" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.cdo.dawn" id="org.eclipse.emf.cdo.dawn.listeners" name="DawnListeners"/>
+ </appinfo>
+ <documentation>
+ This extension point allows to add a tranaction listener to the editor's related transaction. This Listener must extend org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener. This allows to change the editors behavior if a transaction changes.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="DawnTransactionListener"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="DawnResourceListener">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.emf.cdo.dawn.notifications.AbstractDawnResoureChangeListener:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="DawnTransactionListener">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.emf.cdo.dawn.notifications.AbstractDawnListener:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.2.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ This examples shows how to set an own implementation to the extension point.
+<pre>
+ <extension point="org.eclipse.emf.cdo.dawn.listeners">
+ <DawnTransactionListener
+ class="org.eclipse.emf.cdo.dawn.notifications.DawnGMFTransactionListener">
+ </DawnTransactionListener>
+ </extension>
+</pre>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ Extend org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener and override the method notifyEvent(IEvent event) to change the behavior. Set your implementation to the <b>class</b> attribute of the extension point.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.<br>
+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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
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 4220adbf3d..3eb4495b52 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 @@ -16,7 +16,6 @@ import org.eclipse.emf.cdo.internal.dawn.bundle.OM; import org.eclipse.net4j.util.om.trace.ContextTracer; -import org.eclipse.gef.EditPart; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; @@ -26,6 +25,9 @@ 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 @@ -76,7 +78,7 @@ public class HandleConflictsAction implements IObjectActionDelegate if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection)selection; - if (structuredSelection.getFirstElement() instanceof EditPart) + // if (structuredSelection.getFirstElement() instanceof EditPart) { selectedElement = structuredSelection.getFirstElement(); } diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnAppearancer.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnAppearancer.java deleted file mode 100644 index 444bb3cc9a..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnAppearancer.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * 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.appearance; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.util.EditPartUtilities; -import org.eclipse.swt.graphics.Color; - -/** - * @author Martin Fluegge - */ -public class DawnAppearancer -{ - public static final int DEFAULT_BORDER_THICKNESS = 2; - - public static final int DEFAULT_LINE_THICKNESS = 3; - - public static final Color COLOR_NO_BORDER = new Color(null, 255, 255, 255); - - public static final Color COLOR_LOCKED_REMOTELY = ColorConstants.yellow; - - public static final Color COLOR_LOCKED_LOCALLY = ColorConstants.green; - - public static final Color COLOR_DELETE_CONFLICT = new Color(null, 255, 0, 0); - - public static final Color COLOR_CHANGE_CONFLICT = new Color(null, 0, 0, 255); - - public static final Color COLOR_NO_CONFLICT = new Color(null, 255, 255, 255); - - public static final int TYPE_CONFLICT_NONE = -1; - - public static final int TYPE_CONFLICT_LOCALLY_DELETED = 0; - - public static final int TYPE_CONFLICT_REMOTELY_DELETED = 1; - - public static final int TYPE_CONFLICT_REMOTELY_AND_LOCALLY_CHANGED = 2; - - public static final int TYPE_LOCKED_LOCALLY = 3; - - public static final int TYPE_LOCKED_GLOBALLY = 4; - - public static void setEdiPartConflicted(EditPart editPart, int type) - { - DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart); - if (stylizer != null) - { - stylizer.setConflicted(editPart, type); - } - } - - public static void setEditPartDefaultAllChildren(EditPart editPart) - { - setEditPartDefault(editPart); - - for (Object child : EditPartUtilities.getAllChildren((GraphicalEditPart)editPart)) - { - setEditPartDefaultAllChildren((EditPart)child); - } - } - - public static void setEditPartDefault(EditPart editPart) - { - DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart); - if (stylizer != null) - { - stylizer.setDefault(editPart); - } - } - - protected static void setEditPartLocked(EditPart editPart, int type) - { - DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart); - if (stylizer != null) - { - stylizer.setDefault(editPart); - } - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnEditPartStylizer.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnEditPartStylizer.java deleted file mode 100644 index 141d8e30e4..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnEditPartStylizer.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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.appearance; - -import org.eclipse.gef.EditPart; - -/** - * An EditPartStylizer can influence the visual representation of the models state. Dawn knows three states - default, - * conflicted and locked. By implementing an own DawnStylizer you can influence the appearance of the three states for - * your EditPart and it's related models. New stylizer can be registered to Dawn using the - * <b>org.eclipse.emf.cdo.dawn.editpartstylizers</b> extension point. - * - * @author Martin Fluegge - */ -public interface DawnEditPartStylizer -{ - public void setDefault(EditPart editPart); - - public void setConflicted(EditPart editPart, int type); - - public void setLocked(EditPart editPart, int type); -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnEditPartStylizerRegistry.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnEditPartStylizerRegistry.java deleted file mode 100644 index 7e97469df9..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnEditPartStylizerRegistry.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * 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.appearance; - -import org.eclipse.emf.cdo.dawn.appearance.impl.DawnBasicConnectionEditPartStylizerImpl; -import org.eclipse.emf.cdo.dawn.appearance.impl.DawnBasicGraphicalEditPartStylizerImpl; -import org.eclipse.emf.cdo.dawn.appearance.impl.DawnBasicNodeEditPartStylizerImpl; -import org.eclipse.emf.cdo.dawn.appearance.impl.DawnBasicTextAwareEditPartStylizerImpl; -import org.eclipse.emf.cdo.internal.dawn.bundle.OM; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.gef.ConnectionEditPart; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.NodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; - -import java.util.HashMap; -import java.util.Map; - -public class DawnEditPartStylizerRegistry -{ - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnEditPartStylizerRegistry.class); - - private static final String DAWN_STYLIZER_EXTENSION_POINT_ID = "org.eclipse.emf.cdo.dawn.editpartstylizers"; - - public static DawnEditPartStylizerRegistry instance = new DawnEditPartStylizerRegistry(); - - private Map<String, DawnEditPartStylizer> registeredStylizers = new HashMap<String, DawnEditPartStylizer>(); - - public DawnEditPartStylizer getStylizer(EditPart editPart) - { - DawnEditPartStylizer stylizer = registeredStylizers.get(editPart.getClass().getCanonicalName()); - - if (stylizer == null) - { - stylizer = getStylizerFromExtensionPoint(editPart); - } - - if (stylizer == null) - { - stylizer = getDefaultStylizer(editPart); - } - - return stylizer; - } - - private DawnEditPartStylizer getDefaultStylizer(EditPart editPart) - { - DawnEditPartStylizer stylizer = null; - if (editPart instanceof ConnectionEditPart) - { - stylizer = new DawnBasicConnectionEditPartStylizerImpl(); - } - else if (editPart instanceof NodeEditPart) - { - stylizer = new DawnBasicNodeEditPartStylizerImpl(); - } - else if (editPart instanceof DiagramEditPart) - { - stylizer = new DawnBasicNodeEditPartStylizerImpl(); - } - else if (editPart instanceof ITextAwareEditPart) - { - stylizer = new DawnBasicTextAwareEditPartStylizerImpl(); - } - else - { - // In the case that there is no match we use a simple border styled stylizer. - stylizer = new DawnBasicGraphicalEditPartStylizerImpl(); - } - - return stylizer; - } - - private DawnEditPartStylizer getStylizerFromExtensionPoint(EditPart editPart) - { - try - { - IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor( - DAWN_STYLIZER_EXTENSION_POINT_ID); - for (IConfigurationElement e : config) - { - if (editPart.getClass().getCanonicalName().equals(e.getAttribute("editpart"))) - { - DawnEditPartStylizer stylizer = (DawnEditPartStylizer)e.createExecutableExtension("stylizer"); - registeredStylizers.put(editPart.getClass().getCanonicalName(), stylizer); - if (TRACER.isEnabled()) - { - TRACER.format("Registered DawnEditPartStylizer {0} ", stylizer); //$NON-NLS-1$ - } - - return stylizer; - } - } - } - catch (InvalidRegistryObjectException e1) - { - e1.printStackTrace(); - } - catch (CoreException e) - { - e.printStackTrace(); - } - - return null; - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnElementStylizer.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnElementStylizer.java new file mode 100644 index 0000000000..5a7be31d79 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnElementStylizer.java @@ -0,0 +1,27 @@ +/**
+ * 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.appearance;
+
+/**
+ * This interface is used do influence the appearance of an UI element by a certain state. Implementations allow to
+ * change the appearance for the adapted types of editors.
+ *
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public interface DawnElementStylizer<T>
+{
+ public void setDefault(T element);
+
+ public void setConflicted(T element, int type);
+
+ public void setLocked(T element, int type);
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java deleted file mode 100644 index 3bd1244265..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * 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.appearance.impl; - -import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer; -import org.eclipse.emf.cdo.dawn.appearance.DawnEditPartStylizer; - -import org.eclipse.emf.workspace.AbstractEMFOperation; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.common.core.util.StringStatics; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyValueRequest; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; -import org.eclipse.gmf.runtime.emf.core.util.PackageUtil; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.swt.graphics.Color; - -/** - * @author Martin Fluegge - */ -public class DawnBasicConnectionEditPartStylizerImpl implements DawnEditPartStylizer -{ - - public void setDefault(EditPart editPart) - { - setEdge(editPart, DawnAppearancer.COLOR_NO_CONFLICT); - } - - public void setConflicted(EditPart editPart, int type) - { - Color color = DawnAppearancer.COLOR_DELETE_CONFLICT; - setEdge(editPart, color); - } - - private void setEdge(EditPart editPart, Color color) - { - ChangePropertyValueRequest request = new ChangePropertyValueRequest(StringStatics.BLANK, - PackageUtil.getID(NotationPackage.eINSTANCE.getLineStyle_LineColor()), FigureUtilities.colorToInteger(color)); - final Command command = editPart.getCommand(request); - - AbstractEMFOperation operation = new AbstractEMFOperation(((IGraphicalEditPart)editPart).getEditingDomain(), - StringStatics.BLANK, null) - { - @Override - protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - command.execute(); - return Status.OK_STATUS; - } - }; - - try - { - operation.execute(new NullProgressMonitor(), null); - } - catch (ExecutionException e) - { - } - - editPart.refresh(); - editPart.getRoot().refresh(); - } - - public void setLocked(EditPart editPart, int type) - { - Color color = null; - switch (type) - { - case DawnAppearancer.TYPE_LOCKED_LOCALLY: - { - color = DawnAppearancer.COLOR_LOCKED_REMOTELY; - break; - } - case DawnAppearancer.TYPE_LOCKED_GLOBALLY: - { - color = DawnAppearancer.COLOR_LOCKED_LOCALLY; - break; - } - - default: - break; - } - if (color != null) - { - setEdge(editPart, color); - } - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicDiagramStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicDiagramStylizerImpl.java deleted file mode 100644 index 96c255807d..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicDiagramStylizerImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.appearance.impl; - -import org.eclipse.emf.cdo.dawn.appearance.DawnEditPartStylizer; - -import org.eclipse.gef.EditPart; - -/** - * @author Martin Fluegge - */ -public class DawnBasicDiagramStylizerImpl implements DawnEditPartStylizer -{ - public void setDefault(EditPart editpart) - { - } - - public void setConflicted(EditPart editpart, int type) - { - } - - public void setLocked(EditPart editpart, int type) - { - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java deleted file mode 100644 index d4bebac44f..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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.appearance.impl; - -import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer; -import org.eclipse.emf.cdo.dawn.appearance.DawnEditPartStylizer; - -import org.eclipse.draw2d.Border; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.swt.graphics.Color; - -/** - * @author Martin Fluegge - */ -public class DawnBasicGraphicalEditPartStylizerImpl implements DawnEditPartStylizer -{ - public void setDefault(EditPart editPart) - { - setBorder(editPart, null); - } - - public void setConflicted(EditPart editPart, int type) - { - setBorder(editPart, DawnAppearancer.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - } - - public void setLocked(EditPart editPart, int type) - { - setBorder(editPart, DawnAppearancer.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - } - - protected void setBorder(EditPart editPart, Color color, int thickness) - { - Border thickBorder = new LineBorder(color, thickness); - setBorder(editPart, thickBorder); - } - - protected void setBorder(EditPart editPart, Border border) - { - GraphicalEditPart e = (GraphicalEditPart)editPart; - - IFigure figure = e.getFigure(); - figure.setBorder(border); - editPart.refresh(); - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java deleted file mode 100644 index 3b371d7908..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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.appearance.impl; - -import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer; - -import org.eclipse.gef.EditPart; - -/** - * @author Martin Fluegge - */ -public class DawnBasicNodeEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl -{ - - @Override - public void setDefault(EditPart editPart) - { - setBorder(editPart, DawnAppearancer.COLOR_NO_CONFLICT, 0); - } - - @Override - public void setConflicted(EditPart editPart, int type) - { - setBorder(editPart, DawnAppearancer.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - } - - @Override - public void setLocked(EditPart editPart, int type) - { - setBorder(editPart, DawnAppearancer.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicTextAwareEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicTextAwareEditPartStylizerImpl.java deleted file mode 100644 index ee0883042a..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBasicTextAwareEditPartStylizerImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * 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.appearance.impl; - -import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer; - -import org.eclipse.draw2d.Border; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Martin Fluegge - */ -public class DawnBasicTextAwareEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl -{ - - Map<EditPart, Border> oldValues = new HashMap<EditPart, Border>(); - - @Override - public void setDefault(EditPart editPart) - { - setBorder(editPart, oldValues.get(editPart)); - } - - @Override - public void setConflicted(EditPart editPart, int type) - { - final IGraphicalEditPart e = (IGraphicalEditPart)editPart; - - // TODO Setting the foreground color just works until the EditPart is refreshed and the default color is used again. - // Find a better way to handle this. - // e.getFigure().setForegroundColor(DawnAppearancer.COLOR_DELETE_CONFLICT); - oldValues.put(e, e.getFigure().getBorder()); - - setBorder(editPart, DawnAppearancer.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - // View view = (View)e.getModel(); - // FontStyle style = (FontStyle)view.getStyle(NotationPackage.eINSTANCE.getFontStyle()); - // if (style == null) - // { - // style = NotationFactory.eINSTANCE.createFontStyle(); - // style.setFontColor(FigureUtilities.colorToInteger(DiagramColorConstants.red)); - // style.setBold(true); - // - // view.getStyles().add(style); - // } - } - - @Override - public void setLocked(EditPart editPart, int type) - { - setBorder(editPart, DawnAppearancer.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBlinkingNodeEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBlinkingNodeEditPartStylizerImpl.java deleted file mode 100644 index 7975f7d2e3..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/impl/DawnBlinkingNodeEditPartStylizerImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * 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.appearance.impl; - -import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer; - -import org.eclipse.gef.EditPart; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Martin Fluegge - */ -public class DawnBlinkingNodeEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl -{ - - BlinkingThread blinkingThread; - - public DawnBlinkingNodeEditPartStylizerImpl() - { - blinkingThread = new BlinkingThread(); - blinkingThread.start(); - } - - @Override - public void setDefault(EditPart editPart) - { - blinkingThread.stop(editPart); - setBorder(editPart, DawnAppearancer.COLOR_NO_CONFLICT, 0); - } - - @Override - public void setConflicted(EditPart editPart, int type) - { - blinkingThread.start(editPart); - } - - @Override - public void setLocked(EditPart editPart, int type) - { - setBorder(editPart, DawnAppearancer.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - } - - protected class BlinkingThread extends Thread - { - - Map<EditPart, Boolean> editParts = new HashMap<EditPart, Boolean>(); - - @Override - public void run() - { - while (true) - { - for (EditPart e : editParts.keySet()) - { - if (editParts.get(e)) - { - setBorder(e, DawnAppearancer.COLOR_NO_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - } - else - { - setBorder(e, DawnAppearancer.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS); - } - - editParts.put(e, !editParts.get(e)); - } - try - { - Thread.sleep(500); - } - catch (InterruptedException e1) - { - e1.printStackTrace(); - } - } - } - - public void start(EditPart editPart) - { - editParts.put(editPart, true); - } - - public void stop(EditPart editPart) - { - editParts.remove(editPart); - } - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/conflicts/ResourceSynchronizer.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/conflicts/ResourceSynchronizer.java index 00ab21c3b8..2b49aa9d4d 100644 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/conflicts/ResourceSynchronizer.java +++ b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/conflicts/ResourceSynchronizer.java @@ -13,15 +13,17 @@ package org.eclipse.emf.cdo.dawn.conflicts; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.gmf.runtime.notation.View; - import java.util.Map; import java.util.Observer; import java.util.Set; /** + * Since Dawn 2.0 this interface is deprecated and will be removed soon. Because it was never really used, there will be + * no surragote. + * * @author Martin Fluegge */ +@Deprecated public interface ResourceSynchronizer { public static final int NO_CONFLICT = -1; @@ -60,11 +62,11 @@ public interface ResourceSynchronizer void resolveDeletedRemotellyConflict(String xmiId); - void updateViewWithRemoteView(View obj); - - void lastResourceDeleteView(View newView); - - void lastResourceChangeView(View newView); + // void updateViewWithRemoteView(View obj); + // + // void lastResourceDeleteView(View newView); + // + // void lastResourceChangeView(View newView); boolean isConflicted(); diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/editors/impl/DawnEMFEditorSupport.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/editors/impl/DawnEMFEditorSupport.java deleted file mode 100644 index 8d5dbbbefc..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/editors/impl/DawnEMFEditorSupport.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * 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.editors.impl; - -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener; -import org.eclipse.emf.cdo.dawn.notifications.impl.DawnEMFHandler; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.view.CDOAdapterPolicy; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -/** - * @author Martin Fluegge - * @since 1.0 - */ -public class DawnEMFEditorSupport extends DawnAbstractEditorSupport -{ - public DawnEMFEditorSupport(IDawnEditor editor) - { - super(editor); - } - - public void close() - { - CDOView view = getView(); - if (view != null && !view.isClosed()) - { - view.close(); - } - } - - public void registerListeners() - { - BasicDawnListener listener = new DawnEMFHandler(getEditor()); - CDOView view = getView(); - view.addListener(listener); - - if (view instanceof CDOTransaction) - { - CDOTransaction transaction = (CDOTransaction)view; - transaction.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.CDO); - } - } - - @Override - public void rollback() - { - super.rollback(); - ((IViewerProvider)getEditor()).getViewer().refresh(); - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/editors/impl/DawnGMFEditorSupport.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/editors/impl/DawnGMFEditorSupport.java deleted file mode 100644 index e2b624010b..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/editors/impl/DawnGMFEditorSupport.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * 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.editors.impl; - -import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer; -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener; -import org.eclipse.emf.cdo.dawn.notifications.impl.DawnGMFHandler; -import org.eclipse.emf.cdo.dawn.util.DawnDiagramUpdater; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.view.CDOAdapterPolicy; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.TransactionalEditingDomain; - -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor; - -/** - * @author Martin Fluegge - */ -public class DawnGMFEditorSupport extends DawnAbstractEditorSupport -{ - public DawnGMFEditorSupport(IDawnEditor editor) - { - super(editor); - } - - public void close() - { - CDOView view = getView(); - if (view != null && !view.isClosed()) - { - view.close(); - } - } - - public void registerListeners() - { - BasicDawnListener listener = new DawnGMFHandler(getEditor()); - CDOView view = getView(); - view.addListener(listener); - - if (view instanceof CDOTransaction) - { - CDOTransaction transaction = (CDOTransaction)view; - transaction.addTransactionHandler(listener); - transaction.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.CDO); - } - } - - /** - * @since 1.0 - */ - @Override - public void rollback() - { - super.rollback(); - final DiagramDocumentEditor diagramDocumentEditor = (DiagramDocumentEditor)getEditor(); - TransactionalEditingDomain editingDomain = diagramDocumentEditor.getEditingDomain(); - editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain) - { - @Override - public void doExecute() - { - DawnAppearancer.setEditPartDefaultAllChildren(diagramDocumentEditor.getDiagramEditPart()); - DawnDiagramUpdater.refreshEditPart(diagramDocumentEditor.getDiagramEditPart()); - } - }); - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/elementtypes/DawnElementTypeHelper.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/elementtypes/DawnElementTypeHelper.java deleted file mode 100644 index efc7035ee6..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/elementtypes/DawnElementTypeHelper.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * 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.elementtypes; - -/** - * - * @author Martin Fluegge - */ -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.notation.View; - -public interface DawnElementTypeHelper -{ - IElementType getElementType(View view); -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/elementtypes/DawnElementTypeHelperFactory.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/elementtypes/DawnElementTypeHelperFactory.java deleted file mode 100644 index 2c35e7a478..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/elementtypes/DawnElementTypeHelperFactory.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * 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.elementtypes; - -/** - * @author Martin Fluegge - */ -public interface DawnElementTypeHelperFactory -{ - DawnElementTypeHelper create(); -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/notifications/impl/DawnEMFHandler.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/notifications/impl/DawnEMFHandler.java deleted file mode 100644 index 3943e8b45b..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/notifications/impl/DawnEMFHandler.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * 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.notifications.impl; - -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener; -import org.eclipse.emf.cdo.transaction.CDOTransactionConflictEvent; -import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent; - -import org.eclipse.emf.common.ui.viewer.IViewerProvider; - -/** - * @author Martin Fluegge - */ -public class DawnEMFHandler extends BasicDawnListener -{ - /** - * @since 1.0 - */ - public DawnEMFHandler(IDawnEditor editor) - { - super(editor); - } - - @Override - public void handleTransactionConflictEvent(CDOTransactionConflictEvent event) - { - super.handleTransactionConflictEvent(event); - refreshEditor(); - } - - @Override - public void handleViewInvalidationEvent(CDOViewInvalidationEvent event) - { - super.handleViewInvalidationEvent(event); - refreshEditor(); - } - - private void refreshEditor() - { - editor.getSite().getShell().getDisplay().asyncExec(new Runnable() - { - public void run() - { - ((IViewerProvider)editor).getViewer().refresh(); - } - }); - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/notifications/impl/DawnGMFHandler.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/notifications/impl/DawnGMFHandler.java deleted file mode 100644 index 8371f27bf5..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/notifications/impl/DawnGMFHandler.java +++ /dev/null @@ -1,288 +0,0 @@ -/******************************************************************************* - * 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.notifications.impl; - -import org.eclipse.emf.cdo.CDOObject; -import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta; -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener; -import org.eclipse.emf.cdo.dawn.synchronize.DawnConflictHelper; -import org.eclipse.emf.cdo.dawn.util.DawnDiagramUpdater; -import org.eclipse.emf.cdo.internal.dawn.bundle.OM; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.transaction.CDOTransactionConflictEvent; -import org.eclipse.emf.cdo.util.CDOUtil; -import org.eclipse.emf.cdo.util.InvalidObjectException; -import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.TransactionalEditingDomain; - -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.widgets.Display; - -/** - * @author Martin Fluegge - */ -public class DawnGMFHandler extends BasicDawnListener -{ - - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnGMFHandler.class); - - /** - * @since 1.0 - */ - public DawnGMFHandler(IDawnEditor editor) - { - super(editor); - } - - /** - * @since 1.0 - */ - @Override - public void handleViewInvalidationEvent(CDOViewInvalidationEvent event) - { - CDOViewInvalidationEvent e = event; - - if (TRACER.isEnabled()) - { - TRACER.format("Detached Objects {0} ", e.getDetachedObjects()); //$NON-NLS-1$ - TRACER.format("Dirty Objects {0} ", e.getDirtyObjects()); //$NON-NLS-1$ - } - adjustDeletedEdges(e); - - for (CDOObject dirtyObject : e.getDirtyObjects()) - { - handleObject(dirtyObject); - } - - for (CDOObject detachedObject : e.getDetachedObjects()) - { - handleObject(detachedObject); - } - } - - /** - * @since 1.0 - */ - @Override - public void handleTransactionConflictEvent(CDOTransactionConflictEvent event) - { - CDOTransactionConflictEvent cdoTransactionConflictEvent = event; - - CDOObject cdoObject = cdoTransactionConflictEvent.getConflictingObject(); - - EObject element = CDOUtil.getEObject(cdoObject); // either semantic object or notational - View view = DawnDiagramUpdater.findView(element); - - if (DawnConflictHelper.isConflicted(cdoObject)) - { - DawnConflictHelper.handleConflictedView(cdoObject, view, (DiagramDocumentEditor)editor); - return; - } - } - - @Override - public void modifyingObject(CDOTransaction transaction, final CDOObject object, CDOFeatureDelta featureDelta) - { - if (TRACER.isEnabled()) - { - TRACER.format("modifyingObject {0}", object); //$NON-NLS-1$ - } - - refresh(object); - editor.setDirty(); - object.eAdapters().add(new Adapter() - { - public void setTarget(Notifier newTarget) - { - } - - public void notifyChanged(Notification notification) - { - DawnDiagramUpdater.refreshEditPart(((DiagramDocumentEditor)editor).getDiagramEditPart(), - (DiagramDocumentEditor)editor); - object.eAdapters().remove(this); - } - - public boolean isAdapterForType(Object type) - { - return false; - } - - public Notifier getTarget() - { - return null; - } - }); - } - - /** - * @since 1.0 - */ - @Override - public void attachingObject(CDOTransaction transaction, CDOObject object) - { - super.attachingObject(transaction, object); - refresh(object); - } - - /** - * Edges must be adjusted because of the transience of the Node source/targetEdges CDO cannot see this because - * removing an edges just removes the edge from the diagram. CDO just notices the change in the diagram but not in the - * (detached) edge. The other site (node) is transient and will not be part of the notification. So I must adjust this - * later. CDOLEgacy Wrapper breakes because it only adjusts the changes in the diagram and not the removed edge. So I - * cannot adjust this in the Wrapper. Maybe there is another more generic way. - */ - public void adjustDeletedEdges(final CDOViewInvalidationEvent e) - { - Display.getDefault().asyncExec(new Runnable() - { - public void run() - { - for (CDOObject obj : e.getDetachedObjects()) - { - final EObject view = CDOUtil.getEObject(obj); - if (view instanceof Edge) - { - EditingDomain editingDomain = ((IEditingDomainProvider)view.eResource().getResourceSet()) - .getEditingDomain(); - editingDomain.getCommandStack().execute(new RecordingCommand((TransactionalEditingDomain)editingDomain) - { - @Override - protected void doExecute() - { - try - { - ((Edge)view).setTarget(null); - } - catch (InvalidObjectException ignore) - { - } - - try - { - ((Edge)view).setSource(null); - } - catch (InvalidObjectException ignore) - { - } - } - }); - } - } - } - }); - } - - protected void handleConflicts(CDOViewInvalidationEvent e) - { - for (CDOObject obj : e.getDetachedObjects()) - { - EObject element = CDOUtil.getEObject(obj); - View view = DawnDiagramUpdater.findViewByContainer(element); - DawnConflictHelper.handleConflictedView(CDOUtil.getCDOObject(element), view, (DiagramDocumentEditor)editor); - } - } - - private void handleObject(CDOObject dirtyObject) - { - - if (dirtyObject.cdoInvalid()) - { - return; - } - EObject element = CDOUtil.getEObject(dirtyObject); // either sementic object or notational - - View view = DawnDiagramUpdater.findView(element); - - if (DawnConflictHelper.isConflicted(dirtyObject)) - { - // DawnConflictHelper.handleConflictedView(dirtyObject, view, editor); - return; - } - - EditPart relatedEditPart = DawnDiagramUpdater.findEditPart(view, ((DiagramEditor)editor).getDiagramEditPart() - .getViewer()); - if (relatedEditPart != null) - { - if (TRACER.isEnabled()) - { - TRACER.format("Updating EditPart {0} ", relatedEditPart); //$NON-NLS-1$ - } - DawnDiagramUpdater.refreshEditPart(relatedEditPart.getParent(), (DiagramDocumentEditor)editor); - } - else - { - if (TRACER.isEnabled()) - { - TRACER.format("Updating DiagramEditPart {0} ", ((DiagramEditor)editor).getDiagramEditPart()); //$NON-NLS-1$ - } - DawnDiagramUpdater.refreshEditPart(((DiagramEditor)editor).getDiagramEditPart(), (DiagramDocumentEditor)editor); - } - } - - protected void refresh(CDOObject object) - { - View view = DawnDiagramUpdater.findViewByContainer(object); - if (view == null) - { - view = DawnDiagramUpdater.findViewForModel(object, (DiagramDocumentEditor)editor); - } - if (view == null) - { - DawnDiagramUpdater.findViewFromCrossReferences(object); - } - - EditPart relatedEditPart = DawnDiagramUpdater.findEditPart(view, ((DiagramDocumentEditor)editor) - .getDiagramEditPart().getViewer()); - - if (relatedEditPart != null) - { - if (TRACER.isEnabled()) - { - TRACER.format("Updating EditPart {0} ", relatedEditPart); //$NON-NLS-1$ - } - EditPart parent = relatedEditPart.getParent(); - if (parent instanceof IGraphicalEditPart) - { - DawnDiagramUpdater.refresh((IGraphicalEditPart)parent); - } - else - { - DawnDiagramUpdater.refreshEditPart(parent, (DiagramDocumentEditor)editor); - } - } - else - { - if (TRACER.isEnabled()) - { - TRACER.format("Updating DiagramEditPart {0} ", ((DiagramDocumentEditor)editor).getDiagramEditPart()); //$NON-NLS-1$ - } - - DawnDiagramUpdater.refresh(((DiagramDocumentEditor)editor).getDiagramEditPart()); - } - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/resources/DawnPathmapManager.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/resources/DawnPathmapManager.java deleted file mode 100644 index 1b16c5474f..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/resources/DawnPathmapManager.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * 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.resources; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.gmf.runtime.emf.core.internal.resources.PathmapManager; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Martin Fluegge - */ -@SuppressWarnings("restriction") -public class DawnPathmapManager extends PathmapManager -{ - // TODO remove this as soon as the PathmapManager problem is solved! - @Override - public void notifyChanged(Notification msg) - { - if (msg.getFeatureID(ResourceSet.class) == ResourceSet.RESOURCE_SET__RESOURCES) - { - switch (msg.getEventType()) - { - case Notification.REMOVE_MANY: - { - if (msg.getNewValue() instanceof int[]) - { - return; - } - break; - } - } - } - - super.notifyChanged(msg); - } - - public static void removePathMapMananger(EList<Adapter> eAdapters) - { - List<Adapter> toBeRemoved = new ArrayList<Adapter>(); - for (Adapter a : eAdapters) - { - if (a instanceof PathmapManager) - { - toBeRemoved.add(a); - } - } - eAdapters.removeAll(toBeRemoved); - } - -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/resources/impl/DawnWrapperResourceImpl.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/resources/impl/DawnWrapperResourceImpl.java index 49fab2d62b..cff31f5547 100644 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/resources/impl/DawnWrapperResourceImpl.java +++ b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/resources/impl/DawnWrapperResourceImpl.java @@ -28,8 +28,8 @@ import java.io.Writer; import java.util.Map; /** - * This class wrapper CDOResource and combines it with a XMLResource to avoid problems with GMF which casts internally - * to XML resource + * This class wrapper CDOResource and combines it with a XMLResource to avoid problems with all frameworks which are + * internally using an XMLResource * * @author Martin Fluegge */ diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/synchronize/DawnChangeHelper.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/synchronize/DawnChangeHelper.java deleted file mode 100644 index 30581a79eb..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/synchronize/DawnChangeHelper.java +++ /dev/null @@ -1,629 +0,0 @@ -/******************************************************************************* - * 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.synchronize; - -import org.eclipse.emf.cdo.dawn.util.DawnDiagramUpdater; -import org.eclipse.emf.cdo.dawn.util.DawnResourceHelper; -import org.eclipse.emf.cdo.dawn.util.exceptions.EClassIncompatibleException; -import org.eclipse.emf.cdo.internal.dawn.bundle.OM; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.Transaction; -import org.eclipse.emf.transaction.TransactionalEditingDomain; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.Border; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.commands.SetPropertyCommand; -import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredCreateConnectionViewAndElementCommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest.ConnectionViewAndElementDescriptor; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.core.util.PackageUtil; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; -import org.eclipse.gmf.runtime.notation.Anchor; -import org.eclipse.gmf.runtime.notation.Bendpoints; -import org.eclipse.gmf.runtime.notation.Bounds; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Display; - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; - -/** - * @author Martin Fluegge - */ -public class DawnChangeHelper -{ - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnChangeHelper.class); - - protected static final java.util.Map<String, Boolean> options = new HashMap<String, Boolean>(); - - protected static final java.util.Map<Object, Object> setElementOptions = new HashMap<Object, Object>(); - static - { - options.put(Transaction.OPTION_UNPROTECTED, Boolean.FALSE); - options.put(Transaction.OPTION_NO_NOTIFICATIONS, Boolean.TRUE); - options.put(Transaction.OPTION_NO_TRIGGERS, Boolean.TRUE); - } - - /** - * genereic Method to create an EditPart by the given view - * - * @param node - * @param elementType - * @param diagramEP - * @return the EditPart for the newly created Node - */ - public static EditPart createNode(final Node node, IElementType elementType, DiagramEditPart diagramEP) - { - CreateViewRequest createViewRequest = CreateViewRequestFactory.getCreateShapeRequest(elementType, - diagramEP.getDiagramPreferencesHint()); - - Bounds bounds = (Bounds)node.getLayoutConstraint(); - - Point p = new Point(bounds.getX(), bounds.getY()); - Dimension dimension = new Dimension(bounds.getWidth(), bounds.getHeight()); - createViewRequest.setLocation(p); - createViewRequest.setSize(dimension); - - diagramEP.performRequest(createViewRequest); - - final IAdaptable viewAdapter = (IAdaptable)((List<?>)createViewRequest.getNewObject()).get(0); - final EditPartViewer viewer = diagramEP.getViewer(); - final EditPart kep = (EditPart)viewer.getEditPartRegistry().get(viewAdapter.getAdapter(View.class)); - return kep; - } - - public static EditPart createAttribute(final Node node, IElementType elementType, IGraphicalEditPart parentEditpart) - { - - if (TRACER.isEnabled()) - { - TRACER.format("ElementType: {0} semanticHint {1}", elementType, ((IHintedType)elementType).getSemanticHint()); //$NON-NLS-1$ - } - - CreateElementRequest request = new CreateElementRequest(elementType); - CreateElementRequestAdapter createElementRequestAdapter = new CreateElementRequestAdapter(request); - - ViewAndElementDescriptor viewAndElementDescriptor = new ViewAndElementDescriptor(createElementRequestAdapter, - Node.class, ((IHintedType)elementType).getSemanticHint(), - - parentEditpart.getDiagramPreferencesHint()); - - CreateViewAndElementRequest createViewRequest = new CreateViewAndElementRequest(viewAndElementDescriptor); - - // Command command = parentEditpart.getCommand(createViewRequest); - - parentEditpart.performRequest(createViewRequest); - - final IAdaptable viewAdapter = (IAdaptable)((List<?>)createViewRequest.getNewObject()).get(0); - final EditPartViewer viewer = parentEditpart.getViewer(); - final EditPart kep = (EditPart)viewer.getEditPartRegistry().get(viewAdapter.getAdapter(View.class)); - return kep; - } - - /********************************************************************************************************************* - * This method creates an EditPart given by the specified ElemetType and PLaces it to the give coordinates - * Element-Types could be: DawnElementTypes.Klasse_1001 - * - * @param p - * the point where the view shoudl be created - * @param elementType - * @param diagramEditor - * @return the created EditPart - ********************************************************************************************************************/ - public static EditPart createEditPart(Point p, IElementType elementType, DiagramDocumentEditor diagramEditor) - { - DiagramEditPart diagramEP = diagramEditor.getDiagramEditPart(); - - CreateViewRequest createViewRequest = CreateViewRequestFactory.getCreateShapeRequest(elementType, - diagramEP.getDiagramPreferencesHint()); - - createViewRequest.setLocation(p); - diagramEP.performRequest(createViewRequest); - - final IAdaptable viewAdapter = (IAdaptable)((List<?>)createViewRequest.getNewObject()).get(0); - final EditPartViewer viewer = diagramEP.getViewer(); - return (EditPart)viewer.getEditPartRegistry().get(viewAdapter.getAdapter(View.class)); - } - - /********************************************************************************************************************* - * sets a property for an editpart - * - * @param editPart - * @param name - * @param object - * @param dawnDiagramEditor - ********************************************************************************************************************/ - public static void setProperty(EditPart editPart, String name, String packageUtilPropertyID, Object object, - DiagramDocumentEditor dawnDiagramEditor) - { - SetPropertyCommand setPropertyCommand = new SetPropertyCommand(dawnDiagramEditor.getEditingDomain(), editPart, - packageUtilPropertyID, name, object); - - DiagramEditPart diagramEP = dawnDiagramEditor.getDiagramEditPart(); - - diagramEP.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(setPropertyCommand)); - - } - - /********************************************************************************************************************* - * resizes an Editpart to the given dimension - * - * @param editpart - * @param d - * dimension - ********************************************************************************************************************/ - public static void resizeEditPart(EditPart editpart, Dimension d) - { - boolean editModeEnabled = ((org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart)editpart) - .isEditModeEnabled(); - if (!editModeEnabled) - { - ((org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart)editpart).enableEditMode(); - } - - ChangeBoundsRequest move_req = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE); - move_req.setResizeDirection(PositionConstants.SOUTH_EAST); - - Bounds b = (Bounds)((Node)editpart.getModel()).getLayoutConstraint(); - Dimension dimensionDelta = new Dimension(d.width - b.getWidth(), d.height - b.getHeight()); - - move_req.setSizeDelta(dimensionDelta); - - Command cmd = editpart.getCommand(move_req); - if (cmd == null || !cmd.canExecute()) - { - throw new IllegalArgumentException("Command is not executable."); - } - ((DiagramEditPart)editpart.getParent()).getDiagramEditDomain().getDiagramCommandStack().execute(cmd); - - if (editModeEnabled) - { - ((org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart)editpart).enableEditMode(); - } - else - { - ((org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart)editpart).disableEditMode(); - } - } - - /********************************************************************************************************************* - * moves an EdidPart to the given postione - * - * @param editpart - * @param p - ********************************************************************************************************************/ - public static void moveEditPart(EditPart editpart, Point p) - { - ChangeBoundsRequest move_req = new ChangeBoundsRequest(RequestConstants.REQ_MOVE); - - Bounds b = (Bounds)((Node)editpart.getModel()).getLayoutConstraint(); - Point newPoint = new Point(p.x - b.getX(), p.y - b.getY()); - move_req.setMoveDelta(newPoint); - - Command cmd = editpart.getCommand(move_req); - if (cmd == null || !cmd.canExecute()) - { - throw new IllegalArgumentException("Command is not executable."); - } - ((DiagramEditPart)editpart.getParent()).getDiagramEditDomain().getDiagramCommandStack().execute(cmd); - } - - /** - * Moves the Editpart from the current position to the new Vector - */ - public static void moveEditPartTo(EditPart editpart, Point p) - { - ChangeBoundsRequest move_req = new ChangeBoundsRequest(RequestConstants.REQ_MOVE); - move_req.setMoveDelta(p); - Command cmd = editpart.getCommand(move_req); - if (cmd == null || !cmd.canExecute()) - { - throw new IllegalArgumentException("Command is not executable."); - } - ((DiagramEditPart)editpart.getParent()).getDiagramEditDomain().getDiagramCommandStack().execute(cmd); - } - - /** - * deletes the EditPart an the concerning model element - * - * @param editPart - * @param editor - */ - public static void deleteEditPart(final EditPart editPart, DiagramDocumentEditor editor) - { - final View view = (View)editPart.getModel(); - - EObject eObject = view.getElement(); - if (eObject != null) - { - DestroyElementRequest destroy = new DestroyElementRequest(editor.getEditingDomain(), eObject, false); - - Request req = new EditCommandRequestWrapper(destroy); - - Command command = editPart.getCommand(req); - editor.getDiagramEditDomain().getDiagramCommandStack().execute(command); - } - TransactionalEditingDomain domain = editor.getEditingDomain(); - if (view instanceof Edge) // also update the lists of the other client - { - domain.getCommandStack().execute(new RecordingCommand(domain) - { - @Override - public void doExecute() - { - Edge e = (Edge)view; - View source = e.getSource(); - View target = e.getTarget(); - if (source != null && target != null) - { - EObject targetElement = target.getElement(); - EObject sourceElement = source.getElement(); - - EStructuralFeature containingFeature = sourceElement.eContainingFeature(); - Collection<?> sourceCrossreferenceCollection = (Collection<?>)sourceElement.eGet(containingFeature); - sourceCrossreferenceCollection.remove(targetElement); - } - } - }); - } - ViewUtil.destroy(view); - } - - /********************************************************************************************************************* - * Deletes a view and it's contained element - * - * @param view - * @param editor - ********************************************************************************************************************/ - public static void deleteView(final View view, DiagramDocumentEditor editor) - { - - if (TRACER.isEnabled()) - { - TRACER.format("Deleting view {0} ", view); //$NON-NLS-1$ - } - - EObject eObject = view.getElement(); - if (eObject != null) - { - DestroyElementRequest destroy = new DestroyElementRequest(editor.getEditingDomain(), eObject, false); - - Request req = new EditCommandRequestWrapper(destroy); - - EditPart findEditPart = DawnDiagramUpdater.findEditPart(view, editor.getDiagramEditPart().getViewer()); - Command command = findEditPart.getCommand(req); - editor.getDiagramEditDomain().getDiagramCommandStack().execute(command); - } - if (view instanceof Edge) // also update the lists of the other client - { - destroyEdge((Edge)view, editor); - } - ViewUtil.destroy(view); - } - - public static void destroyEdge(Edge edge, DiagramDocumentEditor editor) - { - EObject referenceObject = ViewUtil.resolveSemanticElement(edge.getTarget()); - EObject container = ViewUtil.resolveSemanticElement(edge.getSource()); - EditPart parentEditpart = DawnDiagramUpdater.findEditPart(edge, editor.getDiagramEditPart().getViewer()); - DestroyReferenceRequest destroyReferenceRequest = new DestroyReferenceRequest(editor.getEditingDomain(), container, - null, referenceObject, false); - Request req = new EditCommandRequestWrapper(destroyReferenceRequest); - - Command command = parentEditpart.getCommand(req); - editor.getDiagramEditDomain().getDiagramCommandStack().execute(command); - } - - /********************************************************************************************************************* - * creates an edge for a given elementType - * - * @param oldEdge - * @param sourceEditPart - * @param targetEditPart - * @param elementType - * @param root - * @return the newly created EditPart - ********************************************************************************************************************/ - public static EditPart createEdge(Edge oldEdge, EditPart sourceEditPart, EditPart targetEditPart, - IElementType elementType, final DiagramEditPart root) - { - if (TRACER.isEnabled()) - { - TRACER.format("Creaeting Edge from old edge {0} ", oldEdge); //$NON-NLS-1$ - } - - CreateConnectionViewAndElementRequest req = new CreateConnectionViewAndElementRequest(elementType, - ((IHintedType)elementType).getSemanticHint(), root.getDiagramPreferencesHint()); - - ICommand createConnectionCmd = new DeferredCreateConnectionViewAndElementCommand(req, new EObjectAdapter( - (EObject)sourceEditPart.getModel()), new EObjectAdapter((EObject)targetEditPart.getModel()), root.getViewer()); - - root.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(createConnectionCmd)); - - final EditPartViewer viewer = root.getViewer(); - - final EditPart ret = (EditPart)viewer.getEditPartRegistry().get( - ((ConnectionViewAndElementDescriptor)req.getNewObject()).getAdapter(View.class)); - - if (ret != null) - { - setAnchorsAndBendPoints(ret, oldEdge, root); - } - return ret; - } - - /********************************************************************************************************************* - * This Method sets the Anchors and Bendpoint from an old Edge to the edge of the given EditPart - * - * @param edgeEditpart - * @param oldEdge - * @param root - ********************************************************************************************************************/ - public static void setAnchorsAndBendPoints(final EditPart edgeEditpart, final Edge oldEdge, final DiagramEditPart root) - { - TransactionalEditingDomain domain = root.getEditingDomain();// getEditingDomain(); - domain.getCommandStack().execute(new RecordingCommand(domain) - { - @Override - public void doExecute() - { - Edge edge = (Edge)edgeEditpart.getModel(); - - edge.setBendpoints((Bendpoints)DawnResourceHelper.createCopy(oldEdge.getBendpoints())); - if (oldEdge.getSourceAnchor() != null) - { - edge.setSourceAnchor((Anchor)DawnResourceHelper.createCopy(oldEdge.getSourceAnchor())); - } - if (oldEdge.getTargetAnchor() != null) - { - edge.setTargetAnchor((Anchor)DawnResourceHelper.createCopy(oldEdge.getTargetAnchor())); - } - - edgeEditpart.refresh(); - root.refresh(); - } - }); - } - - /** - * returns the border color from a given EditPart - * - * @param editPart - * @return the border color of the EditPart - */ - public static Color getBorderColor(EditPart editPart) - { - GraphicalEditPart e = (GraphicalEditPart)editPart; - - Border border = e.getFigure().getBorder(); - - if (border instanceof org.eclipse.draw2d.MarginBorder) - { - // MarginBorder b = ((MarginBorder) e.getFigure().getBorder()); - // if (border != null) - // { - // return b.getColor(); - // } - return null; - } - else if (border instanceof LineBorder) - { - LineBorder b = (LineBorder)e.getFigure().getBorder(); - - return b.getColor(); - } - - return null; - } - - /** - * activates a given EditPart - * - * @param e - */ - public static void activateEditPart(final EditPart e) - { - Display.getDefault().asyncExec(new Runnable() - { - public void run() - { - e.activate(); - org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart g = (org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart)e; - g.getFigure().setEnabled(true); - } - }); - - } - - /** - * activates the diagram EditPart - * - * @param diagramEditPart - */ - public static void activateDiagramEditPart(DiagramEditPart diagramEditPart) - { - DawnChangeHelper.activateEditPart(diagramEditPart); - - for (Object e : diagramEditPart.getChildren()) - { - DawnChangeHelper.activateEditPart((EditPart)e); - } - } - - /** - * deactivates the given EditPart - * - * @param e - */ - public static void deactivateEditPart(final EditPart e) - { - Display.getDefault().asyncExec(new Runnable() - { - public void run() - { - e.deactivate(); - e.getViewer().deselect(e); - - org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart g = (org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart)e; - g.getFigure().setEnabled(false); - } - }); - } - - /** - * deactivates the DiagramEditPart - * - * @param diagramEditPart - */ - public static void deactivateDiagramEditPart(DiagramEditPart diagramEditPart) - { - DawnChangeHelper.deactivateEditPart(diagramEditPart); - - for (Object e : diagramEditPart.getChildren()) - { - DawnChangeHelper.deactivateEditPart((EditPart)e); - } - - } - - /** - * Deselects the given EditPart EditPart - */ - public static void deselect(final EditPart e) - { - Display.getDefault().asyncExec(new Runnable() - { - - public void run() - { - e.getViewer().deselect(e); - } - }); - } - - /** - * selects the given EditPart - * - * @param e - */ - public static void select(final EditPart e) - { - Display.getDefault().asyncExec(new Runnable() - { - - public void run() - { - e.getViewer().select(e); - } - }); - } - - /********************************************************************************************************************* - * sets a property for an editpart - * - * @param editPart - * @param name - * @param object - * @param dawnDiagramEditor - ********************************************************************************************************************/ - public static void setProperty(EditPart editPart, String name, EAttribute attribute, Object object, - DiagramDocumentEditor dawnDiagramEditor) - { - SetPropertyCommand setPropertyCommand = new SetPropertyCommand(dawnDiagramEditor.getEditingDomain(), editPart, - PackageUtil.getID(attribute), name, object); - DiagramEditPart diagramEP = dawnDiagramEditor.getDiagramEditPart(); - - diagramEP.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(setPropertyCommand)); - } - - /********************************************************************************************************************* - * updates the model - * - * @param editPart - * @param model - * @param editor - ********************************************************************************************************************/ - public static void updateModel(final EditPart editPart, final EObject model, DiagramDocumentEditor editor) - { - editPart.getViewer().getEditDomain(); - View view = (View)editPart.getModel(); - final EObject element = view.getElement(); - - if (element.eClass().getName().equals("AnOperation")) // ugliest of all workarounds. Just for the prototype - { - editor.getEditingDomain().getCommandStack().execute(new RecordingCommand(editor.getEditingDomain()) - { - @Override - public void doExecute() - { - try - { - DawnResourceHelper.updateEObject(element, model); - } - catch (EClassIncompatibleException e) - { - e.printStackTrace(); - } - } - }); - } - else - { - for (EAttribute attribute : element.eClass().getEAllAttributes()) - { - setProperty(editPart, attribute.getName(), attribute, model.eGet(attribute), editor); - } - } - } - - public static void deleteAttribute(View view, DiagramDocumentEditor editor) - { - deleteView(view, editor); - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/synchronize/DawnConflictHelper.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/synchronize/DawnConflictHelper.java deleted file mode 100644 index 9c272f7237..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/synchronize/DawnConflictHelper.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * 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.synchronize; - -import org.eclipse.emf.cdo.CDOObject; -import org.eclipse.emf.cdo.CDOState; -import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer; -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.util.DawnDiagramUpdater; -import org.eclipse.emf.cdo.internal.dawn.bundle.OM; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; - -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @author Martin Fluegge - */ -public class DawnConflictHelper -{ - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnConflictHelper.class); - - public static boolean handleConflictedView(CDOObject cdoObject, View view, DiagramDocumentEditor editor) - { - boolean cdoConflict = cdoObject.cdoConflict(); - if (cdoConflict && view != null) - { - if (TRACER.isEnabled()) - { - TRACER.format("Object ({0}) is in state conflict!", cdoObject); //$NON-NLS-1$ - } - EditPart editPart = DawnDiagramUpdater.createOrFindEditPartIfViewExists(view, editor); - int typeConflictLocallyDeleted = evaluateConflictType(cdoObject); - DawnAppearancer.setEdiPartConflicted(editPart, typeConflictLocallyDeleted); - } - return cdoConflict; - } - - private static int evaluateConflictType(CDOObject cdoObject) - { - if (cdoObject.cdoState() == CDOState.DIRTY) - { - return DawnAppearancer.TYPE_CONFLICT_REMOTELY_AND_LOCALLY_CHANGED; - } - return DawnAppearancer.TYPE_CONFLICT_REMOTELY_DELETED; - } - - public static void rollback(final DiagramDocumentEditor editor) - { - CDOView view = ((IDawnEditor)editor).getView(); - - if (view != null && view instanceof CDOTransaction) - { - ((CDOTransaction)view).rollback(); - } - - editor.getEditingDomain().getCommandStack().execute(new RecordingCommand(editor.getEditingDomain()) - { - @Override - public void doExecute() - { - DawnAppearancer.setEditPartDefaultAllChildren(editor.getDiagramEditPart()); - DawnDiagramUpdater.refreshEditPart(editor.getDiagramEditPart()); - } - }); - } - - /** - * TODO this method should decide whether the object is conflicted or not using special Policies - * - * @param object - * @return whether the object is conflicted - */ - public static boolean isConflicted(EObject object) - { - CDOObject cdoObject = CDOUtil.getCDOObject(object); - if (cdoObject.cdoConflict()) - { - return true; - } - if (object instanceof View) - { - CDOObject element = CDOUtil.getCDOObject(((View)object).getElement()); - if (element.cdoConflict()) - { - return true; - } - } - return false; - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnDiagramEditingDomainFactory.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnDiagramEditingDomainFactory.java deleted file mode 100644 index 799b4e079d..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnDiagramEditingDomainFactory.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * 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: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.transaction; - -import org.eclipse.emf.cdo.dawn.resources.DawnPathmapManager; -import org.eclipse.emf.cdo.internal.dawn.bundle.OM; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.transaction.TransactionalCommandStack; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.impl.TransactionChangeRecorder; -import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory; -import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl; - -import org.eclipse.core.commands.operations.IOperationHistory; -import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory; - -public class DawnDiagramEditingDomainFactory extends DiagramEditingDomainFactory -{ - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnDiagramEditingDomainFactory.class); - - private static DawnDiagramEditingDomainFactory instance = new DawnDiagramEditingDomainFactory(); - - protected static class DawnDiagramEditingDomain extends DiagramEditingDomain - { - public DawnDiagramEditingDomain(AdapterFactory adapterFactory, ResourceSet resourceSet) - { - super(adapterFactory, resourceSet); - } - - public DawnDiagramEditingDomain(AdapterFactory adapterFactory, TransactionalCommandStack stack, - ResourceSet resourceSet) - { - super(adapterFactory, stack, resourceSet); - } - - public DawnDiagramEditingDomain(AdapterFactory adapterFactory, TransactionalCommandStack stack) - { - super(adapterFactory, stack); - } - - public DawnDiagramEditingDomain(AdapterFactory adapterFactory) - { - super(adapterFactory); - } - - /** - * override the TransactionChangeRecorder to suppress the write asserts which are not need with CDO - */ - @Override - protected TransactionChangeRecorder createChangeRecorder(ResourceSet rset) - { - return new DawnTransactionChangeRecorder(this, rset); - } - } - - @Override - public TransactionalEditingDomain createEditingDomain(IOperationHistory history) - { - if (TRACER.isEnabled()) - { - TRACER.trace("Creating DawnTransactionalEditingDomain using DawnDiagramEditingDomainFactory"); //$NON-NLS-1$ - } - WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history); - - TransactionalEditingDomain result = new DawnDiagramEditingDomain(new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack); - - mapResourceSet(result); - - configure(result); - return result; - } - - @Override - public TransactionalEditingDomain createEditingDomain(ResourceSet rset, IOperationHistory history) - { - WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history); - - TransactionalEditingDomain result = new DawnDiagramEditingDomain(new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, rset); - - mapResourceSet(result); - configure(result); - return result; - } - - @Override - protected void configure(final TransactionalEditingDomain domain) - { - super.configure(domain); - - final ResourceSet rset = domain.getResourceSet(); - DawnPathmapManager.removePathMapMananger(rset.eAdapters()); - rset.eAdapters().add(new DawnPathmapManager()); - } - - public static WorkspaceEditingDomainFactory getInstance() - { - return instance; - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnGMFEditingDomainFactory.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnGMFEditingDomainFactory.java deleted file mode 100644 index 187bb648c9..0000000000 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnGMFEditingDomainFactory.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * 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: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.transaction; - -import org.eclipse.emf.cdo.dawn.resources.DawnPathmapManager; -import org.eclipse.emf.cdo.internal.dawn.bundle.OM; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory; -import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl; - -import org.eclipse.core.commands.operations.IOperationHistory; -import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; - -public class DawnGMFEditingDomainFactory extends GMFEditingDomainFactory -{ - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnGMFEditingDomainFactory.class); - - private static DawnGMFEditingDomainFactory instance = new DawnGMFEditingDomainFactory(); - - @Override - public TransactionalEditingDomain createEditingDomain() - { - TransactionalEditingDomain result = super.createEditingDomain(); - configure(result); - return result; - } - - @Override - public TransactionalEditingDomain createEditingDomain(ResourceSet rset) - { - TransactionalEditingDomain result = super.createEditingDomain(rset); - configure(result); - return result; - } - - /** - * overrides WorkspaceEditingDomainFactory method - */ - @Override - public synchronized TransactionalEditingDomain createEditingDomain(IOperationHistory history) - { - WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history); - stack.setResourceUndoContextPolicy(getResourceUndoContextPolicy()); - - TransactionalEditingDomain result = new DawnTransactionalEditingDomainImpl(new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack); - - mapResourceSet(result); - // configures as the GMFEditingDomainFactory would do - configure(result); - - return result; - } - - /** - * overrides WorkspaceEditingDomainFactory method - */ - @Override - public synchronized TransactionalEditingDomain createEditingDomain(ResourceSet rset, IOperationHistory history) - { - if (TRACER.isEnabled()) - { - TRACER.trace("Creating DawnTransactionalEditingDomain using DawnDiagramEditingDomainFactory"); //$NON-NLS-1$ - } - WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history); - stack.setResourceUndoContextPolicy(getResourceUndoContextPolicy()); - - TransactionalEditingDomain result = new DawnTransactionalEditingDomainImpl(new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, rset); - - mapResourceSet(result); - - // configures as the GMFEditingDomainFactory would do - configure(result); - - return result; - } - - public static WorkspaceEditingDomainFactory getInstance() - { - return instance; - } - - @Override - protected void configure(final TransactionalEditingDomain domain) - { - super.configure(domain); - - final ResourceSet rset = domain.getResourceSet(); - DawnPathmapManager.removePathMapMananger(rset.eAdapters()); - rset.eAdapters().add(new DawnPathmapManager()); - } -} diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnTransactionChangeRecorder.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnTransactionChangeRecorder.java index 63a2acd5c8..bfb63b6a16 100644 --- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnTransactionChangeRecorder.java +++ b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/transaction/DawnTransactionChangeRecorder.java @@ -22,6 +22,9 @@ import org.eclipse.emf.transaction.impl.TransactionChangeRecorder; */ public class DawnTransactionChangeRecorder extends TransactionChangeRecorder { + /** + * @since 2.0 + */ public DawnTransactionChangeRecorder(InternalTransactionalEditingDomain domain, ResourceSet rset) { super(domain, rset); |