Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--features/org.eclipse.papyrus.backbone-feature/feature.xml14
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/META-INF/MANIFEST.MF36
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/build.properties8
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/plugin.xml6
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/schema/operationApprover.exsd78
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/Activator.java12
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/CheckedDiagramCommandStack.java39
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java302
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java63
-rw-r--r--plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/wrappers/OperationToGEFCommandWrapper.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusControlAction.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusUncontrolAction.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java39
-rw-r--r--plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java31
-rw-r--r--plugins/core/org.eclipse.papyrus.core/plugin.xml1
-rw-r--r--plugins/core/org.eclipse.papyrus.core/schema/transactionalEditingDomainProvider.exsd109
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/commands/ModelCreationCommandBase.java9
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ITransactionalEditingDomainProvider.java8
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java7
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/TransactionalEditingDomainManager.java85
-rw-r--r--plugins/core/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java17
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java12
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/.classpath7
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/.project28
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/META-INF/MANIFEST.MF14
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/build.properties11
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/icons/enable_write.pngbin0 -> 3321 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/plugin.properties8
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/plugin.xml126
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/schema/readOnlyHandler.exsd109
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/Activator.java45
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/FSReadOnlyHandler.java68
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/FSReadOnlyOneFileApprover.java116
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/IReadOnlyHandler.java23
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyManager.java113
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyTester.java45
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyTransactionalEditingDomainProvider.java46
-rw-r--r--plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/handlers/EnableWriteHandler.java71
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/.classpath7
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/.project28
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/META-INF/MANIFEST.MF17
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/build.properties6
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/plugin.properties8
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/plugin.xml12
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/src/org/eclipse/papyrus/svn/Activator.java45
-rw-r--r--plugins/core/org.eclipse.papyrus.svn/src/org/eclipse/papyrus/svn/SVNLockHandler.java48
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java6
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java11
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java12
-rw-r--r--plugins/uml/org.eclipse.papyrus.collaborationuse.editor.xtext.ui/src/org/eclipse/papyrus/collaborationuse/editor/xtext/ui/contributions/CollaborationUsePopupEditor.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.connectionpointreference.editor.xtext.ui/src/org/eclipse/papyrus/connectionpointreference/editor/xtext/ui/contributions/ConnectionPointReferencePopupEditorConfiguration.java12
-rw-r--r--plugins/uml/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java14
-rw-r--r--plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/helpers/SafeDialogOpenerDuringValidation.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.activity/custom-src/org/eclipse/papyrus/diagram/activity/helper/SafeDialogOpenerDuringValidation.java3
-rw-r--r--plugins/uml/org.eclipse.papyrus.message.editor.xtext.ui/src/org/eclipse/papyrus/message/editor/xtext/ui/contributions/MessagePopupEditor.java14
-rw-r--r--plugins/uml/org.eclipse.papyrus.parameter.editor.xtext.ui/src/org/eclipse/papyrus/parameter/editor/xtext/ui/contributions/ParameterPopupEditor.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.properties.tabbed.profile/src/org/eclipse/papyrus/properties/tabbed/profile/imagesection/ImageContentSection.java25
-rw-r--r--plugins/uml/org.eclipse.papyrus.properties.uml/src/org/eclipse/papyrus/properties/uml/widgets/StereotypeImageEditor.java23
-rw-r--r--plugins/uml/org.eclipse.papyrus.property.editor.xtext.ui/src/org/eclipse/papyrus/property/editor/xtext/ui/contributions/PropertyPopupEditorConfigurationContribution.java14
-rwxr-xr-xplugins/uml/org.eclipse.papyrus.state.editor.xtext.ui/src/org/eclipse/papyrus/state/editor/xtext/ui/contributions/StatePopupEditorConfigurationContribution.java11
-rw-r--r--plugins/uml/org.eclipse.papyrus.tabbedproperties.comments/src/org/eclipse/papyrus/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java8
-rw-r--r--plugins/uml/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.transition.editor.xtext.ui/src/org/eclipse/papyrus/transition/editor/xtext/ui/contributions/TransitionPopupEditorConfigurationContribution.java11
72 files changed, 1971 insertions, 231 deletions
diff --git a/features/org.eclipse.papyrus.backbone-feature/feature.xml b/features/org.eclipse.papyrus.backbone-feature/feature.xml
index 0f54bb6b9ba..c802b5898a2 100644
--- a/features/org.eclipse.papyrus.backbone-feature/feature.xml
+++ b/features/org.eclipse.papyrus.backbone-feature/feature.xml
@@ -368,4 +368,18 @@ http://www.eclipse.org/legal/epl-v10.html
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.papyrus.svn"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.readonly"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/plugins/core/org.eclipse.papyrus.commands/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.commands/META-INF/MANIFEST.MF
index e4b29b92eda..6064104fca8 100644
--- a/plugins/core/org.eclipse.papyrus.commands/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.commands/META-INF/MANIFEST.MF
@@ -1,18 +1,18 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.commands;singleton:=true
-Bundle-Version: 0.9.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.commands.Activator
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ui.workbench,
- org.eclipse.papyrus.log,
- org.eclipse.gmf.runtime.common.core,
- org.eclipse.emf.common,
- org.eclipse.gef,
- org.eclipse.gmf.runtime.diagram.ui
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.commands,
- org.eclipse.papyrus.commands.wrappers
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.commands,
+ org.eclipse.papyrus.commands.wrappers
+Require-Bundle: org.eclipse.ui.workbench,
+ org.eclipse.papyrus.log,
+ org.eclipse.gmf.runtime.common.core,
+ org.eclipse.emf.common,
+ org.eclipse.gef,
+ org.eclipse.gmf.runtime.diagram.ui
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.9.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.commands.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.commands;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/plugins/core/org.eclipse.papyrus.commands/build.properties b/plugins/core/org.eclipse.papyrus.commands/build.properties
index 050ac6e1f70..6539c962332 100644
--- a/plugins/core/org.eclipse.papyrus.commands/build.properties
+++ b/plugins/core/org.eclipse.papyrus.commands/build.properties
@@ -1,7 +1,11 @@
#
#Fry Sep 16 11:19:32 CEST 2011
-bin.includes=META-INF/,.,plugin.properties,about.html
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html,\
+ plugin.xml
output..=bin/
-src.includes=META-INF/,.,plugin.properties,about.html
+src.includes = about.html
source..=src/
bin..=bin/
diff --git a/plugins/core/org.eclipse.papyrus.commands/plugin.xml b/plugins/core/org.eclipse.papyrus.commands/plugin.xml
new file mode 100644
index 00000000000..9fef2c770d4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.commands/plugin.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="operationApprover" name="operationApprover" schema="schema/operationApprover.exsd"/>
+
+</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.commands/schema/operationApprover.exsd b/plugins/core/org.eclipse.papyrus.commands/schema/operationApprover.exsd
new file mode 100644
index 00000000000..1b3e020a89a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.commands/schema/operationApprover.exsd
@@ -0,0 +1,78 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.commands" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.commands" id="operationApprover" name="operationApprover"/>
+ </appinfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="operationApprover" minOccurs="0" maxOccurs="unbounded"/>
+ </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="operationApprover">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.core.commands.operations.IOperationApprover2"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string">
+ <annotation>
+ <documentation>
+ An integer value representing the priority of the operationApprover.
+High value means the operationApprover will be checked before those with lower value.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+
+
+
+
+
+</schema>
diff --git a/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/Activator.java b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/Activator.java
index 3eea5e94a84..89aac5d8c7a 100644
--- a/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/Activator.java
+++ b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/Activator.java
@@ -27,10 +27,10 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
-
+
/** The log helper */
- public static LogHelper log = new LogHelper();
-
+ public static LogHelper log = new LogHelper();
+
/**
* The constructor
*/
@@ -39,17 +39,19 @@ public class Activator extends AbstractUIPlugin {
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
// register the log helper
- log.setPlugin(plugin);
+ log.setPlugin(plugin);
}
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
@@ -60,7 +62,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
diff --git a/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/CheckedDiagramCommandStack.java b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/CheckedDiagramCommandStack.java
new file mode 100644
index 00000000000..8f1192ac01b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/CheckedDiagramCommandStack.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos.
+ *
+ *
+ * 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:
+ * Vincent Hemery (Atos) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.commands;
+
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditDomain;
+
+/**
+ * This DiagramCommandStack uses CheckedOperationHistory instead of the default one.
+ *
+ * @author vhemery
+ */
+public class CheckedDiagramCommandStack extends DiagramCommandStack {
+
+ protected IOperationHistory operationHistory;
+
+ public CheckedDiagramCommandStack(IDiagramEditDomain editDomain) {
+ super(editDomain);
+ operationHistory = CheckedOperationHistory.getInstance();
+ }
+
+ @Override
+ protected IOperationHistory getOperationHistory() {
+ return operationHistory;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java
new file mode 100644
index 00000000000..ddbfbce032a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java
@@ -0,0 +1,302 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.commands;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.ICompositeOperation;
+import org.eclipse.core.commands.operations.IOperationApprover;
+import org.eclipse.core.commands.operations.IOperationApprover2;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IOperationHistoryListener;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.workspace.EMFCommandOperation;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+
+public class CheckedOperationHistory implements IOperationHistory {
+
+ private static class CheckedOperationHistoryHolder {
+
+ public static final CheckedOperationHistory instance = new CheckedOperationHistory();
+ }
+
+ public static CheckedOperationHistory getInstance() {
+ return CheckedOperationHistoryHolder.instance;
+ }
+
+ protected static final IOperationApprover2[] approversArray;
+
+ protected IOperationHistory history;
+
+ private static class ApproverPriorityPair implements Comparable<ApproverPriorityPair> {
+
+ public IOperationApprover2 approver;
+
+ public int priority;
+
+ public int compareTo(ApproverPriorityPair o) {
+ if(o.priority > priority) {
+ return 1;
+ } else if(o.priority < priority) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+
+ }
+
+ static {
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.papyrus.commands", "operationApprover");
+
+ List<ApproverPriorityPair> approverPriorityPairs = new LinkedList<ApproverPriorityPair>();
+ for(IConfigurationElement elem : configElements) {
+ if("operationApprover".equals(elem.getName())) {
+ try {
+ ApproverPriorityPair approverPriorityPair = new ApproverPriorityPair();
+ approverPriorityPair.approver = (IOperationApprover2)elem.createExecutableExtension("class");
+ approverPriorityPair.priority = Integer.parseInt(elem.getAttribute("priority"));
+
+ approverPriorityPairs.add(approverPriorityPair);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Collections.sort(approverPriorityPairs);
+
+ approversArray = new IOperationApprover2[approverPriorityPairs.size()];
+
+ for(int i = 0; i < approversArray.length; i++) {
+ approversArray[i] = approverPriorityPairs.get(i).approver;
+ }
+ }
+
+ private CheckedOperationHistory() {
+ history = OperationHistoryFactory.getOperationHistory();
+ }
+
+ /*
+ * Consult the IOperationApprovers to see if the proposed redo should be
+ * allowed.
+ */
+ protected IStatus getRedoApproval(IUndoableOperation operation, IAdaptable info) {
+ operation = unwrap(operation);
+ for(int i = 0; i < approversArray.length; i++) {
+ IStatus approval = approversArray[i].proceedRedoing(operation, this, info);
+ if(!approval.isOK()) {
+ return approval;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /*
+ * Consult the IOperationApprovers to see if the proposed undo should be
+ * allowed.
+ */
+ protected IStatus getUndoApproval(IUndoableOperation operation, IAdaptable info) {
+ operation = unwrap(operation);
+ for(int i = 0; i < approversArray.length; i++) {
+ IStatus approval = approversArray[i].proceedUndoing(operation, this, info);
+ if(!approval.isOK()) {
+ return approval;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /*
+ * Consult the IOperationApprovers to see if the proposed execution should
+ * be allowed.
+ *
+ * @since 3.2
+ */
+ protected IStatus getExecuteApproval(IUndoableOperation operation, IAdaptable info) {
+ operation = unwrap(operation);
+ for(int i = 0; i < approversArray.length; i++) {
+ IStatus approval = approversArray[i].proceedExecuting(operation, this, info);
+ if(!approval.isOK()) {
+ return approval;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * the unified command stack wraps ICommand GMFtoEMFCommandWrapper
+ * which are wrapped in EMFCommandOperation,
+ * unwrap it before validation
+ *
+ * @param operation
+ * @return
+ */
+ protected IUndoableOperation unwrap(IUndoableOperation operation) {
+ if(operation instanceof EMFCommandOperation) {
+ Command emfCommand = ((EMFCommandOperation)operation).getCommand();
+ if(emfCommand instanceof GMFtoEMFCommandWrapper) {
+ ICommand gmfCommand = ((GMFtoEMFCommandWrapper)emfCommand).getGMFCommand();
+ if(gmfCommand != null) {
+ return gmfCommand;
+ }
+ }
+ }
+
+ return operation;
+ }
+
+ public IStatus execute(IUndoableOperation operation, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // check with the operation approvers
+ IStatus status = getExecuteApproval(operation, info);
+ if(!status.isOK()) {
+ // not approved. No notifications are sent, just return the status.
+ return status;
+ }
+ return history.execute(operation, monitor, info);
+ }
+
+ public IStatus undo(IUndoContext context, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Assert.isNotNull(context);
+ IUndoableOperation operation = getUndoOperation(context);
+
+ // info if there is no operation
+ if(operation == null) {
+ return IOperationHistory.NOTHING_TO_UNDO_STATUS;
+ }
+
+ // check with the operation approvers
+ IStatus status = getUndoApproval(operation, info);
+ if(!status.isOK()) {
+ // not approved. No notifications are sent, just return the status.
+ return status;
+ }
+ return history.undo(context, monitor, info);
+ }
+
+ public IStatus redo(IUndoContext context, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Assert.isNotNull(context);
+ IUndoableOperation operation = getRedoOperation(context);
+
+ // info if there is no operation
+ if(operation == null) {
+ return IOperationHistory.NOTHING_TO_REDO_STATUS;
+ }
+
+ // check with the operation approvers
+ IStatus status = getRedoApproval(operation, info);
+ if(!status.isOK()) {
+ // not approved. No notifications are sent, just return the status.
+ return status;
+ }
+ return history.redo(context, monitor, info);
+ }
+
+ // all the following methods are pure delegation
+
+ public IStatus undoOperation(IUndoableOperation operation, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ return history.undoOperation(operation, monitor, info);
+ }
+
+ public void setLimit(IUndoContext context, int limit) {
+ history.setLimit(context, limit);
+ }
+
+ public void replaceOperation(IUndoableOperation operation, IUndoableOperation[] replacements) {
+ history.replaceOperation(operation, replacements);
+ }
+
+ public void removeOperationHistoryListener(IOperationHistoryListener listener) {
+ history.removeOperationHistoryListener(listener);
+ }
+
+ public void removeOperationApprover(IOperationApprover approver) {
+ history.removeOperationApprover(approver);
+ }
+
+ public IStatus redoOperation(IUndoableOperation operation, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ return redoOperation(operation, monitor, info);
+ }
+
+ public void operationChanged(IUndoableOperation operation) {
+ history.operationChanged(operation);
+ }
+
+ public void openOperation(ICompositeOperation operation, int mode) {
+ history.openOperation(operation, mode);
+ }
+
+ public IUndoableOperation getUndoOperation(IUndoContext context) {
+ return history.getUndoOperation(context);
+ }
+
+ public IUndoableOperation[] getUndoHistory(IUndoContext context) {
+ return history.getUndoHistory(context);
+ }
+
+ public IUndoableOperation getRedoOperation(IUndoContext context) {
+ return history.getRedoOperation(context);
+ }
+
+ public IUndoableOperation[] getRedoHistory(IUndoContext context) {
+ return history.getRedoHistory(context);
+ }
+
+ public int getLimit(IUndoContext context) {
+ return history.getLimit(context);
+ }
+
+ public void dispose(IUndoContext context, boolean flushUndo, boolean flushRedo, boolean flushContext) {
+ history.dispose(context, flushUndo, flushRedo, flushContext);
+ }
+
+ public void closeOperation(boolean operationOK, boolean addToHistory, int mode) {
+ history.closeOperation(operationOK, addToHistory, mode);
+ }
+
+ public boolean canUndo(IUndoContext context) {
+ return history.canUndo(context);
+ }
+
+ public boolean canRedo(IUndoContext context) {
+ return history.canRedo(context);
+ }
+
+ public void addOperationHistoryListener(IOperationHistoryListener listener) {
+ history.addOperationHistoryListener(listener);
+ }
+
+ public void addOperationApprover(IOperationApprover approver) {
+ history.addOperationApprover(approver);
+ }
+
+ public void add(IUndoableOperation operation) {
+ history.add(operation);
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java
new file mode 100644
index 00000000000..a9877fe100d
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.commands;
+
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IOperationHistoryListener;
+import org.eclipse.core.commands.operations.OperationHistoryEvent;
+import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl;
+
+public class NotifyingWorkspaceCommandStack extends WorkspaceCommandStackImpl {
+
+ /**
+ * map with registered listeners and the corresponding proxy registered to
+ * actual map
+ */
+ private Map<CommandStackListener, IOperationHistoryListener> proxyOperationListeners = new HashMap<CommandStackListener, IOperationHistoryListener>();
+
+ public NotifyingWorkspaceCommandStack(IOperationHistory history) {
+ super(history);
+ }
+
+ @Override
+ public void addCommandStackListener(final CommandStackListener listener) {
+ removeCommandStackListener(listener);
+ IOperationHistoryListener proxy = new IOperationHistoryListener() {
+
+ public void historyNotification(OperationHistoryEvent event) {
+ int type = event.getEventType();
+
+ // emf stack only needs to be notified when an operation is finished
+ if(OperationHistoryEvent.DONE == type || OperationHistoryEvent.REDONE == type || OperationHistoryEvent.UNDONE == type) {
+ listener.commandStackChanged(new EventObject(this));
+ }
+ }
+ };
+ getOperationHistory().addOperationHistoryListener(proxy);
+ proxyOperationListeners.put(listener, proxy);
+ }
+
+ @Override
+ public void removeCommandStackListener(CommandStackListener listener) {
+ IOperationHistoryListener proxy = proxyOperationListeners.remove(listener);
+ if(proxy != null) {
+ getOperationHistory().removeOperationHistoryListener(proxy);
+ }
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/wrappers/OperationToGEFCommandWrapper.java b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/wrappers/OperationToGEFCommandWrapper.java
index bcf1209c50a..72e65878209 100644
--- a/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/wrappers/OperationToGEFCommandWrapper.java
+++ b/plugins/core/org.eclipse.papyrus.commands/src/org/eclipse/papyrus/commands/wrappers/OperationToGEFCommandWrapper.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos.
+ *
+ *
+ * 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:
+ * Vincent Hemery (Atos) - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.commands.wrappers;
import org.eclipse.core.commands.ExecutionException;
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusControlAction.java b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusControlAction.java
index ccffeeede15..5834821aff7 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusControlAction.java
+++ b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusControlAction.java
@@ -17,7 +17,6 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -39,6 +38,7 @@ import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.controlmode.commands.ControlCommand;
import org.eclipse.papyrus.controlmode.commands.IControlCondition;
import org.eclipse.papyrus.core.utils.EditorUtils;
@@ -176,7 +176,7 @@ public class PapyrusControlAction extends ControlAction {
}
try {
ControlCommand transactionalCommand = new ControlCommand(EditorUtils.getTransactionalEditingDomain(), controlledModel, eObject, "Control", null);
- IStatus status = OperationHistoryFactory.getOperationHistory().execute(transactionalCommand, new NullProgressMonitor(), null);
+ IStatus status = CheckedOperationHistory.getInstance().execute(transactionalCommand, new NullProgressMonitor(), null);
if (status.isOK()) {
notifySave();
} else {
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusUncontrolAction.java b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusUncontrolAction.java
index 3dd49d9e6a1..19cfa39d410 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusUncontrolAction.java
+++ b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/PapyrusUncontrolAction.java
@@ -14,7 +14,6 @@
package org.eclipse.papyrus.controlmode.action;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -26,6 +25,7 @@ import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.emf.edit.ui.action.CommandActionHandler;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.controlmode.commands.UncontrolCommand;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.resource.AbstractBaseModel;
@@ -119,7 +119,7 @@ public class PapyrusUncontrolAction extends CommandActionHandler {
try {
boolean confirmDelete = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Delete controlled resources?", "Delete the original controlled files ?");
UncontrolCommand transactionalCommand = new UncontrolCommand(EditorUtils.getTransactionalEditingDomain(), eObject, "Uncontrol", null, confirmDelete);
- IStatus status = OperationHistoryFactory.getOperationHistory().execute(transactionalCommand, new NullProgressMonitor(), null);
+ IStatus status = CheckedOperationHistory.getInstance().execute(transactionalCommand, new NullProgressMonitor(), null);
if (!status.isOK()) {
NotificationBuilder.createErrorPopup(status.getMessage()).setTitle("Unable to uncontrol").run();
}
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java
index 270eade5d67..ac809849bea 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java
+++ b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java
@@ -22,7 +22,6 @@ import java.util.List;
import java.util.Set;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -46,6 +45,7 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.EditingDomainUndoContext;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.controlmode.commands.IControlCommand.STATE_CONTROL;
import org.eclipse.papyrus.controlmode.history.HistoryModel;
import org.eclipse.papyrus.controlmode.history.utils.HistoryUtils;
@@ -143,14 +143,9 @@ public class ControlCommand extends AbstractTransactionalCommand {
@Override
protected IStatus doUndo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
// execute uncontrol command
- try {
- UncontrolCommand transactionalCommand = new UncontrolCommand(getEditingDomain(), eObject, "Uncontrol", null, true);
- OperationHistoryFactory.getOperationHistory().execute(transactionalCommand, new NullProgressMonitor(), null);
- return Status.OK_STATUS;
- } catch (ExecutionException e) {
- EMFEditUIPlugin.INSTANCE.log(e);
- return Status.CANCEL_STATUS;
- }
+ UncontrolCommand transactionalCommand = new UncontrolCommand(getEditingDomain(), eObject, "Uncontrol", null, true);
+ getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(transactionalCommand));
+ return Status.OK_STATUS;
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java
index 79b39ba64df..145e0e6439a 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java
+++ b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java
@@ -22,7 +22,6 @@ import java.util.List;
import java.util.Set;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -53,6 +52,7 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo
import org.eclipse.gmf.runtime.emf.commands.core.command.EditingDomainUndoContext;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.controlmode.commands.IUncontrolCommand.STATE_CONTROL;
import org.eclipse.papyrus.controlmode.history.utils.HistoryUtils;
import org.eclipse.papyrus.controlmode.mm.history.ControledResource;
@@ -161,14 +161,9 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
@Override
protected IStatus doUndo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
// execute control command
- try {
- ControlCommand transactionalCommand = new ControlCommand(modelSet.getTransactionalEditingDomain(), controlledModel, eObject, "Control", null);
- OperationHistoryFactory.getOperationHistory().execute(transactionalCommand, new NullProgressMonitor(), null);
- return Status.OK_STATUS;
- } catch (ExecutionException e) {
- EMFEditUIPlugin.INSTANCE.log(e);
- return Status.CANCEL_STATUS;
- }
+ ControlCommand transactionalCommand = new ControlCommand(modelSet.getTransactionalEditingDomain(), controlledModel, eObject, "Control", null);
+ modelSet.getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(transactionalCommand));
+ return Status.OK_STATUS;
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java
index c43435a8da9..9761aba8bfd 100644
--- a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java
+++ b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java
@@ -13,16 +13,17 @@
*****************************************************************************/
package org.eclipse.papyrus.core.adaptor.gmf;
-import java.util.Collections;
+import java.util.ArrayList;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.RecordingCommand;
@@ -38,6 +39,7 @@ import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.core.extension.commands.ICreationCommand;
import org.eclipse.papyrus.core.services.ServiceException;
@@ -110,17 +112,13 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
* The eObject to which the diagram should be attached, if possible.
*/
protected void runAsTransaction(final DiResourceSet diResourceSet, final EObject container, String name) {
- try {
- CompositeCommand cmd = new CompositeCommand("Create diagram");
- ICommand createCmd = getCreateDiagramCommand(diResourceSet, container, name);
- cmd.add(createCmd);
- cmd.add(new OpenDiagramCommand(diResourceSet.getTransactionalEditingDomain(), createCmd));
-
- OperationHistoryFactory.getOperationHistory().execute(cmd, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- e.printStackTrace();
- Activator.getInstance().logError(Messages.AbstractPapyrusGmfCreateDiagramCommandHandler_UnableCreateModelAndDiagram, e);
- }
+ TransactionalEditingDomain dom = diResourceSet.getTransactionalEditingDomain();
+ CompositeCommand cmd = new CompositeCommand("Create diagram");
+ ICommand createCmd = getCreateDiagramCommand(diResourceSet, container, name);
+ cmd.add(createCmd);
+ cmd.add(new OpenDiagramCommand(dom, createCmd));
+
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd));
}
/**
@@ -284,14 +282,19 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
* {@inheritDoc}
*/
public ICommand getCreateDiagramCommand(final DiResourceSet diResourceSet, final EObject container, final String diagramName) {
+ final Resource modelResource = diResourceSet.getAssociatedModelResource(container);
+ final Resource notationResource = diResourceSet.getAssociatedNotationResource(container);
+ final Resource diResource = diResourceSet.getAssociatedDiResource(container);
+
+ ArrayList<IFile> modifiedFiles = new ArrayList<IFile>();
+ modifiedFiles.add(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(modelResource.getURI().toPlatformString(true))));
+ modifiedFiles.add(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(notationResource.getURI().toPlatformString(true))));
+ modifiedFiles.add(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(diResource.getURI().toPlatformString(true))));
- return new AbstractTransactionalCommand(diResourceSet.getTransactionalEditingDomain(), Messages.AbstractPapyrusGmfCreateDiagramCommandHandler_CreateDiagramCommandLabel, Collections.EMPTY_LIST) {
+ return new AbstractTransactionalCommand(diResourceSet.getTransactionalEditingDomain(), Messages.AbstractPapyrusGmfCreateDiagramCommandHandler_CreateDiagramCommandLabel, modifiedFiles) {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Resource modelResource = diResourceSet.getAssociatedModelResource(container);
- Resource notationResource = diResourceSet.getAssociatedNotationResource(container);
- Resource diResource = diResourceSet.getAssociatedDiResource(container);
String name = diagramName;
if(name == null) {
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java
index 04f97d22a4c..920cd1efa16 100644
--- a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java
+++ b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java
@@ -16,11 +16,15 @@ package org.eclipse.papyrus.core.adaptor.gmf;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl;
+import org.eclipse.gef.DefaultEditDomain;
import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.commands.CommandStack;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.papyrus.commands.CheckedDiagramCommandStack;
import org.eclipse.papyrus.core.ui.IRevealSemanticElement;
/**
@@ -69,4 +73,29 @@ public class SynchronizableGmfDiagramEditor extends DiagramDocumentEditor implem
}
}
+ /**
+ * Configures my diagram edit domain with its command stack.
+ * This method has been completely overridden in order to use a proxy stack.
+ */
+ @Override
+ protected void configureDiagramEditDomain() {
+
+ DefaultEditDomain editDomain = getEditDomain();
+
+ if(editDomain != null) {
+ CommandStack stack = editDomain.getCommandStack();
+ if(stack != null) {
+ // dispose the old stack
+ stack.dispose();
+ }
+
+ // create and assign the new stack
+ CheckedDiagramCommandStack diagramStack = new CheckedDiagramCommandStack(getDiagramEditDomain());
+
+ editDomain.setCommandStack(diagramStack);
+ }
+
+ DiagramEditDomain diagEditDomain = (DiagramEditDomain)getDiagramEditDomain();
+ diagEditDomain.setActionManager(createActionManager());
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.core/plugin.xml b/plugins/core/org.eclipse.papyrus.core/plugin.xml
index 9b693f71071..756b31fe0c5 100644
--- a/plugins/core/org.eclipse.papyrus.core/plugin.xml
+++ b/plugins/core/org.eclipse.papyrus.core/plugin.xml
@@ -6,6 +6,7 @@
<extension-point id="papyrusContentOutline" name="PapyrusContentOutline" schema="schema/contentOutline.exsd"/>
<extension-point id="service" name="Service" schema="schema/service.exsd"/>
<extension-point id="model" name="plugin.xml.ModelName" schema="schema/model.exsd"/>
+ <extension-point id="transactionalEditingDomainProvider" name="transactionalEditingDomainProvider" schema="schema/transactionalEditingDomainProvider.exsd"/>
<extension
point="org.eclipse.ui.menus">
<menuContribution
diff --git a/plugins/core/org.eclipse.papyrus.core/schema/transactionalEditingDomainProvider.exsd b/plugins/core/org.eclipse.papyrus.core/schema/transactionalEditingDomainProvider.exsd
new file mode 100644
index 00000000000..9d5935ae8fa
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core/schema/transactionalEditingDomainProvider.exsd
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.papyrus.core" id="transactionalEditingDomainProvider" name="transactionalEditingDomainProvider"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="transactionalEditingDomainProvider" minOccurs="0" maxOccurs="unbounded"/>
+ </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="transactionalEditingDomainProvider">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.resource.ITransactionalEditingDomainProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/commands/ModelCreationCommandBase.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/commands/ModelCreationCommandBase.java
index 0a7f09dd3a8..4f3774846a2 100644
--- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/commands/ModelCreationCommandBase.java
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/commands/ModelCreationCommandBase.java
@@ -16,16 +16,15 @@ package org.eclipse.papyrus.core.extension.commands;
import java.util.Collections;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.DiResourceSet;
/**
@@ -77,11 +76,7 @@ public abstract class ModelCreationCommandBase implements IModelCreationCommand
}
};
- try {
- OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- e.printStackTrace();
- }
+ editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ITransactionalEditingDomainProvider.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ITransactionalEditingDomainProvider.java
new file mode 100644
index 00000000000..a5a0df6f45e
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ITransactionalEditingDomainProvider.java
@@ -0,0 +1,8 @@
+package org.eclipse.papyrus.resource;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+public interface ITransactionalEditingDomainProvider {
+ TransactionalEditingDomain createTransactionalEditingDomain(ResourceSet resourceSet);
+}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java
index d0b74cb3c81..0c9cfc4befc 100644
--- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java
@@ -134,6 +134,7 @@ public class ModelSet extends ResourceSetImpl {
Resource r = super.getResource(uri, loadOnDemand);
if(r instanceof ResourceImpl) {
ResourceImpl impl = (ResourceImpl)r;
+ impl.setTrackingModification(true);
if(impl.getIntrinsicIDToEObjectMap() == null) {
impl.setIntrinsicIDToEObjectMap(new HashMap<String, EObject>());
}
@@ -147,14 +148,10 @@ public class ModelSet extends ResourceSetImpl {
* @return the transactional editing domain
*/
public TransactionalEditingDomain getTransactionalEditingDomain() {
- // transactionalEditingDomain =
- // TransactionalEditingDomain.Factory.INSTANCE.getEditingDomain(this);
transactionalEditingDomain = WorkspaceEditingDomainFactory.INSTANCE.getEditingDomain(this);
if(transactionalEditingDomain == null) {
- // transactionalEditingDomain =
- // TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(this);
- transactionalEditingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain(this);
+ transactionalEditingDomain = TransactionalEditingDomainManager.createTransactionalEditingDomain(this);
// What for?
transactionalEditingDomain.setID("SharedEditingDomain"); //$NON-NLS-1$
}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/TransactionalEditingDomainManager.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/TransactionalEditingDomainManager.java
new file mode 100644
index 00000000000..0fc48fd0899
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/TransactionalEditingDomainManager.java
@@ -0,0 +1,85 @@
+package org.eclipse.papyrus.resource;
+
+import java.util.Collections;
+import java.util.LinkedList;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.eclipse.emf.workspace.IResourceUndoContextPolicy;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
+import org.eclipse.papyrus.commands.NotifyingWorkspaceCommandStack;
+
+public class TransactionalEditingDomainManager {
+
+ protected static final ITransactionalEditingDomainProvider[] orderedProvidersArray;
+
+ protected static class ProviderPriorityPair implements Comparable<ProviderPriorityPair> {
+
+ public ITransactionalEditingDomainProvider provider;
+ public int priority;
+
+ public int compareTo(ProviderPriorityPair o) {
+ if (o.priority > priority) {
+ return 1;
+ } else if (o.priority < priority) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+ }
+
+ static {
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.papyrus.core", "transactionalEditingDomainProvider");
+
+ LinkedList<ProviderPriorityPair> providerPriorityPairs = new LinkedList<ProviderPriorityPair>();
+
+ for(IConfigurationElement elem : configElements) {
+ if ("transactionalEditingDomainProvider".equals(elem.getName())) {
+ try {
+ ProviderPriorityPair providerPriorityPair = new ProviderPriorityPair();
+ providerPriorityPair.provider = (ITransactionalEditingDomainProvider) elem.createExecutableExtension("class");
+ providerPriorityPair.priority = Integer.parseInt(elem.getAttribute("priority"));
+
+ providerPriorityPairs.add(providerPriorityPair);
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ Collections.sort(providerPriorityPairs);
+
+ orderedProvidersArray = new ITransactionalEditingDomainProvider[providerPriorityPairs.size()];
+
+ for (int i = 0; i < orderedProvidersArray.length; i++) {
+ orderedProvidersArray[i] = providerPriorityPairs.get(i).provider;
+ }
+ }
+
+ public static TransactionalEditingDomain createTransactionalEditingDomain(ResourceSet resourceSet) {
+ for (ITransactionalEditingDomainProvider provider : orderedProvidersArray) {
+ TransactionalEditingDomain ed = provider.createTransactionalEditingDomain(resourceSet);
+ if (ed != null) {
+ return ed;
+ }
+ }
+ return createDefaultTransactionalEditingDomain(resourceSet);
+ }
+
+ public static TransactionalEditingDomain createDefaultTransactionalEditingDomain(ResourceSet resourceSet) {
+ NotifyingWorkspaceCommandStack stack = new NotifyingWorkspaceCommandStack(CheckedOperationHistory.getInstance());
+ stack.setResourceUndoContextPolicy(IResourceUndoContextPolicy.DEFAULT);
+
+ TransactionalEditingDomain result = new TransactionalEditingDomainImpl(
+ new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, resourceSet);
+
+ WorkspaceEditingDomainFactory.INSTANCE.mapResourceSet(result);
+
+ return result;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java b/plugins/core/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
index 3c82448b0b7..ceb1f03dd50 100644
--- a/plugins/core/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
+++ b/plugins/core/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
@@ -15,8 +15,6 @@ package org.eclipse.papyrus.documentation.view.papyrus;
import java.util.List;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -54,13 +52,10 @@ public class PapyrusDocumentationPartHandler implements IDocumentationPartHandle
}
public void executeCommand(IWorkbenchPart part, Command cmd) {
- try {
- CoreMultiDiagramEditor editor = getPapyrusEditor(part);
- if(editor != null && cmd != null) {
- OperationHistoryFactory.getOperationHistory().execute(new TransactionalUncheckedCommandProxy((TransactionalEditingDomain)editor.getEditingDomain(), cmd), null, null);
- }
- } catch (ExecutionException e) {
- e.printStackTrace();
+ CoreMultiDiagramEditor editor = getPapyrusEditor(part);
+ if(editor != null && cmd != null) {
+ TransactionalEditingDomain domain = (TransactionalEditingDomain)editor.getEditingDomain();
+ domain.getCommandStack().execute(cmd);
}
}
@@ -140,6 +135,11 @@ public class PapyrusDocumentationPartHandler implements IDocumentationPartHandle
}
public boolean isReadOnly(IWorkbenchPart part, EObject eObject) {
+ CoreMultiDiagramEditor editor = getPapyrusEditor(part);
+ if(editor != null && eObject != null) {
+ TransactionalEditingDomain domain = (TransactionalEditingDomain)editor.getEditingDomain();
+ return domain.isReadOnly(eObject.eResource());
+ }
return false;
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java
index af859ac57e3..3e880507d90 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java
@@ -12,13 +12,9 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.controller;
-import static org.eclipse.papyrus.properties.runtime.Activator.log;
-
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
@@ -26,6 +22,7 @@ import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.properties.runtime.modelhandler.emf.IEMFModelHandler;
import org.eclipse.papyrus.properties.runtime.modelhandler.emf.TransactionUtil;
@@ -80,11 +77,7 @@ public abstract class EMFTPropertyEditorController extends EMFPropertyEditorCont
}
if(cc.canExecute() && !(TransactionUtil.isReadTransactionInProgress(getEditingDomain(), true, true))) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(cc, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- log.error(e);
- }
+ getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(cc));
return;
}
}
@@ -95,11 +88,7 @@ public abstract class EMFTPropertyEditorController extends EMFPropertyEditorCont
*/
AbstractTransactionalCommand command = new EMFTControllerCommand();
if(command.canExecute() && !(TransactionUtil.isReadTransactionInProgress(editingDomain, true, true))) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- log.error(e);
- }
+ editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java
index 0565622d780..b0c763ccb26 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java
@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
@@ -31,6 +30,7 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.controller.ILabelProviderController;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
@@ -283,7 +283,7 @@ public abstract class AbstractTablePropertyEditor extends AbstractPropertyEditor
}
if(operations.size() == 1) {
try {
- OperationHistoryFactory.getOperationHistory().execute(operations.get(0), new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(operations.get(0), new NullProgressMonitor(), null);
} catch (ExecutionException e1) {
Activator.log.error(e1);
}
@@ -296,7 +296,7 @@ public abstract class AbstractTablePropertyEditor extends AbstractPropertyEditor
public void widgetSelected(SelectionEvent e) {
try {
- OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(operation, new NullProgressMonitor(), null);
} catch (ExecutionException e1) {
Activator.log.error(e1);
}
@@ -337,7 +337,7 @@ public abstract class AbstractTablePropertyEditor extends AbstractPropertyEditor
IUndoableOperation operation = getController().getDeleteValueOperation(indexes);
if(operation != null && operation.canExecute()) {
try {
- OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(operation, new NullProgressMonitor(), null);
} catch (ExecutionException e1) {
Activator.log.error(e1);
}
@@ -358,7 +358,7 @@ public abstract class AbstractTablePropertyEditor extends AbstractPropertyEditor
IUndoableOperation moveOperation = getController().getMoveCurrentValuesOperation(selectionList, -1);
if(moveOperation != null && moveOperation.canExecute()) {
try {
- OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(moveOperation, new NullProgressMonitor(), null);
// try to restore selection in the view
int[] newSelection = new int[newSelectionList.size()];
for(int i = 0; i < newSelectionList.size(); i++) {
@@ -387,7 +387,7 @@ public abstract class AbstractTablePropertyEditor extends AbstractPropertyEditor
IUndoableOperation moveOperation = getController().getMoveCurrentValuesOperation(selectionList, +1);
if(moveOperation != null && moveOperation.canExecute()) {
try {
- OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(moveOperation, new NullProgressMonitor(), null);
// try to restore selection in the view
int[] newSelection = new int[newSelectionList.size()];
for(int i = 0; i < newSelectionList.size(); i++) {
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java
index d33186de1e5..728c51bdb16 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java
@@ -13,12 +13,12 @@ package org.eclipse.papyrus.properties.runtime.propertyeditor;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.properties.runtime.Activator;
@@ -88,7 +88,7 @@ public class MultiplePrimitiveTypedPropertyEditor extends AbstractTablePropertyE
IUndoableOperation operation = getController().getEditValueOperation(index, table, value);
if(operation != null && operation.canExecute()) {
try {
- OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(operation, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
Activator.log.error(e);
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java
index 8952f5c628a..836a9ac2b9a 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java
@@ -137,7 +137,7 @@ public class MultipleReferencePropertyEditor extends AbstractTablePropertyEditor
// IUndoableOperation moveOperation = getController().getMoveCurrentValuesOperation(selectionList, -1);
// if(moveOperation != null && moveOperation.canExecute()) {
// try {
- // OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
+ // CheckedOperationHistory.getInstance().execute(moveOperation, new NullProgressMonitor(), null);
// // try to restore selection in the view
// int[] newSelection = new int[newSelectionList.size()];
// for(int i = 0; i < newSelectionList.size(); i++) {
@@ -185,7 +185,7 @@ public class MultipleReferencePropertyEditor extends AbstractTablePropertyEditor
// IUndoableOperation moveOperation = getController().getMoveCurrentValuesOperation(selectionList, +1);
// if(moveOperation != null && moveOperation.canExecute()) {
// try {
- // OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
+ // CheckedOperationHistory.getInstance().execute(moveOperation, new NullProgressMonitor(), null);
// // try to restore selection in the view
// int[] newSelection = new int[newSelectionList.size()];
// for(int i = 0; i < newSelectionList.size(); i++) {
diff --git a/plugins/core/org.eclipse.papyrus.readonly/.classpath b/plugins/core/org.eclipse.papyrus.readonly/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/core/org.eclipse.papyrus.readonly/.project b/plugins/core/org.eclipse.papyrus.readonly/.project
new file mode 100644
index 00000000000..75637808ba4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.readonly</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/core/org.eclipse.papyrus.readonly/.settings/org.eclipse.jdt.core.prefs b/plugins/core/org.eclipse.papyrus.readonly/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..726320266f9
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Sep 16 10:32:10 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/core/org.eclipse.papyrus.readonly/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.readonly/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..6bf734ba6b5
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.readonly;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.readonly.Activator
+Require-Bundle: org.eclipse.papyrus.core;bundle-version="0.8.2",
+ org.eclipse.papyrus.onefile;bundle-version="0.8.2",
+ org.eclipse.core.expressions;bundle-version="3.4.300"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.readonly,
+ org.eclipse.papyrus.readonly.handlers
+Bundle-Vendor: %providerName
diff --git a/plugins/core/org.eclipse.papyrus.readonly/about.html b/plugins/core/org.eclipse.papyrus.readonly/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.readonly/build.properties b/plugins/core/org.eclipse.papyrus.readonly/build.properties
new file mode 100644
index 00000000000..fc67ef03802
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/build.properties
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html,\
+ schema/,\
+ icons/
+src.includes = about.html,\
+ schema/
diff --git a/plugins/core/org.eclipse.papyrus.readonly/icons/enable_write.png b/plugins/core/org.eclipse.papyrus.readonly/icons/enable_write.png
new file mode 100644
index 00000000000..d4e55293f11
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/icons/enable_write.png
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.readonly/plugin.properties b/plugins/core/org.eclipse.papyrus.readonly/plugin.properties
new file mode 100644
index 00000000000..9ba43c0c39c
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/plugin.properties
@@ -0,0 +1,8 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = Papyrus Read Only Manager (Incubation)
+providerName = Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.readonly/plugin.xml b/plugins/core/org.eclipse.papyrus.readonly/plugin.xml
new file mode 100644
index 00000000000..93e88f9159b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/plugin.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="readOnlyHandler" name="readOnlyHandler" schema="schema/readOnlyHandler.exsd"/>
+ <extension
+ point="org.eclipse.papyrus.readonly.readOnlyHandler">
+ <readOnlyHandler
+ class="org.eclipse.papyrus.readonly.FSReadOnlyHandler"
+ priority="10">
+ </readOnlyHandler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.readonly.handlers.EnableWriteHandler"
+ commandId="org.eclipse.papyrus.readonly.EnableWriteCommand">
+ <enabledWhen>
+ <and>
+ <with variable="activeEditorId">
+ <equals value="org.eclipse.papyrus.core.papyrusEditor"/>
+ </with>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.readonly.tester.isReadOnly"
+ value="true">
+ </test>
+ <count
+ value="1">
+ </count>
+ </with>
+ </and>
+ </enabledWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="Enable write"
+ categoryId="org.eclipse.papyrus.editor.category"
+ id="org.eclipse.papyrus.readonly.EnableWriteCommand"
+ name="Enable write">
+ </command>
+ </extension>
+
+<extension
+ point="org.eclipse.ui.menus">
+
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.modelexplorer.modelexplorer.popup?after=org.eclipse.papyrus.modelexplorer.resourceloading.UnloadResource">
+ <command commandId="org.eclipse.papyrus.readonly.EnableWriteCommand"
+ icon="icons/enable_write.png"
+ label="Enable write"
+ style="push"
+ tooltip="Enable write">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?endof=fileMenu"
+ allPopups="false">
+ <command commandId="org.eclipse.papyrus.readonly.EnableWriteCommand"
+ icon="icons/enable_write.png"
+ label="Enable write"
+ style="push"
+ tooltip="Enable write">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar id="org.eclipse.papyrus.readonly.toolbar">
+ <command commandId="org.eclipse.papyrus.readonly.EnableWriteCommand"
+ icon="icons/enable_write.png"
+ label="Enable write"
+ style="push"
+ tooltip="Enable write">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </toolbar>
+ </menuContribution>
+ </extension>
+<extension
+ point="org.eclipse.papyrus.core.transactionalEditingDomainProvider">
+ <transactionalEditingDomainProvider
+ class="org.eclipse.papyrus.readonly.ReadOnlyTransactionalEditingDomainProvider"
+ priority="10">
+ </transactionalEditingDomainProvider>
+</extension>
+<extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.papyrus.readonly.ReadOnlyTester"
+ id="org.eclipse.papyrus.readonly.tester"
+ namespace="org.eclipse.papyrus.readonly.tester"
+ properties="isReadOnly"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
+</extension>
+<extension
+ point="org.eclipse.papyrus.commands.operationApprover">
+ <operationApprover
+ class="org.eclipse.papyrus.readonly.FSReadOnlyOneFileApprover"
+ priority="10">
+ </operationApprover>
+</extension>
+ <extension
+ point="org.eclipse.papyrus.ui.perspectiveconfiguration">
+ <configuration
+ perspectiveID="org.eclipse.papyrus.core.perspective">
+ <toolbar
+ toolbarID="org.eclipse.papyrus.readonly.toolbar">
+ </toolbar>
+ <command
+ commandID="org.eclipse.papyrus.readonly.EnableWriteCommand">
+ </command>
+ </configuration>
+ </extension>
+</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.readonly/schema/readOnlyHandler.exsd b/plugins/core/org.eclipse.papyrus.readonly/schema/readOnlyHandler.exsd
new file mode 100644
index 00000000000..9159e918c8f
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/schema/readOnlyHandler.exsd
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.readonly" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.readonly" id="readOnly" name="readOnly"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="readOnlyHandler" minOccurs="0" maxOccurs="unbounded"/>
+ </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="readOnlyHandler">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.readonly.IReadOnlyHandler"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/Activator.java b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/Activator.java
new file mode 100644
index 00000000000..513245a6bd4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/Activator.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.readonly;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/FSReadOnlyHandler.java b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/FSReadOnlyHandler.java
new file mode 100644
index 00000000000..bea8d1a09fa
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/FSReadOnlyHandler.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.readonly;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourceAttributes;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+
+public class FSReadOnlyHandler implements IReadOnlyHandler {
+
+ public boolean isReadOnly(IFile[] files) {
+ for(IFile file : files) {
+ if(file != null && file.isReadOnly()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // TODO ask user
+ public boolean enableWrite(final IFile[] files) {
+ final AtomicBoolean doEnableWrite = new AtomicBoolean();
+ Display.getCurrent().syncExec(new Runnable() {
+
+ public void run() {
+ String message = "Do you want to remove read only flag on those files ?\n\n";
+ for(IFile file : files) {
+ message += file.getName() + "\n";
+ }
+ doEnableWrite.set(MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Enable write", message));
+ }
+ });
+
+ if(doEnableWrite.get()) {
+ boolean ok = true;
+ for(IFile file : files) {
+ if(file != null) {
+ try {
+ ResourceAttributes att = file.getResourceAttributes();
+ att.setReadOnly(false);
+ file.setResourceAttributes(att);
+ } catch (CoreException e) {
+ ok = false;
+ }
+ }
+ }
+ return ok;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/FSReadOnlyOneFileApprover.java b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/FSReadOnlyOneFileApprover.java
new file mode 100644
index 00000000000..8c83dca31be
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/FSReadOnlyOneFileApprover.java
@@ -0,0 +1,116 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.readonly;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.core.commands.operations.IOperationApprover2;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult;
+import org.eclipse.papyrus.onefile.model.IPapyrusFile;
+import org.eclipse.papyrus.onefile.model.PapyrusModelHelper;
+import org.eclipse.papyrus.onefile.utils.OneFileUtils;
+
+public class FSReadOnlyOneFileApprover implements IOperationApprover2 {
+
+ public IStatus proceedRedoing(IUndoableOperation operation, IOperationHistory history, IAdaptable info) {
+ return proceedExecuting(operation, history, info);
+ }
+
+ public IStatus proceedUndoing(IUndoableOperation operation, IOperationHistory history, IAdaptable info) {
+ return proceedExecuting(operation, history, info);
+ }
+
+ public IStatus proceedExecuting(IUndoableOperation operation, IOperationHistory history, IAdaptable info) {
+
+ if(operation instanceof ICommand) {
+ ICommand command = (ICommand)operation;
+ List<IFile> affectedFiles = command.getAffectedFiles();
+
+ HashSet<IFile> filesToCheckForLock = new HashSet<IFile>();
+
+ for(IFile affectedFile : affectedFiles) {
+ if(affectedFile == null)
+ continue;
+
+ if(affectedFile.exists()) {
+ // the file is in the workspace
+ IPapyrusFile papFile = PapyrusModelHelper.getPapyrusModelFactory().createIPapyrusFile(affectedFile);
+ filesToCheckForLock.addAll(Arrays.asList(OneFileUtils.getAssociatedFiles(papFile)));
+
+ } else {
+ // the file is not in the workspace
+ IPath path = affectedFile.getRawLocation();
+ if(path == null) {
+ // cancel if we can't find the file
+ setCommandResult(command, Status.CANCEL_STATUS);
+ return Status.CANCEL_STATUS;
+ }
+ File file = path.toFile();
+ if(file != null && file.exists() && !file.canWrite()) {
+ // cancel if we find a read-only file outside the
+ // workspace
+ setCommandResult(command, Status.CANCEL_STATUS);
+ return Status.CANCEL_STATUS;
+ }
+ }
+ }
+
+ for(IFile file : affectedFiles) {
+ URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+
+ }
+ if(filesToCheckForLock.size() > 0) {
+ IFile[] filesToCheckForLockArray = filesToCheckForLock.toArray(new IFile[filesToCheckForLock.size()]);
+ if(ReadOnlyManager.isReadOnly(filesToCheckForLock.toArray(filesToCheckForLockArray))) {
+ boolean ok = ReadOnlyManager.enableWrite(filesToCheckForLockArray);
+ if(!ok) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Sets the command result of the specified command to a CommandResult
+ * having the specified status.
+ *
+ * @param command
+ * ICommand to set the CommandResult for
+ * @param status
+ * IStatus of the CommandResult that will be set on the
+ * command
+ */
+ public static void setCommandResult(ICommand command, IStatus status) {
+ if(command instanceof ICommandWithSettableResult) {
+ ((ICommandWithSettableResult)command).internalSetResult(new CommandResult(status));
+ }
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/IReadOnlyHandler.java b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/IReadOnlyHandler.java
new file mode 100644
index 00000000000..19e8818d348
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/IReadOnlyHandler.java
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.readonly;
+
+import org.eclipse.core.resources.IFile;
+
+public interface IReadOnlyHandler {
+
+ boolean isReadOnly(IFile[] files);
+
+ boolean enableWrite(IFile[] files);
+}
diff --git a/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyManager.java b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyManager.java
new file mode 100644
index 00000000000..f7bd10f2b80
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyManager.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.readonly;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class ReadOnlyManager {
+
+ protected static final IReadOnlyHandler[] orderedHandlersArray;
+
+ protected static class HandlerPriorityPair implements Comparable<HandlerPriorityPair> {
+
+ public IReadOnlyHandler handler;
+
+ public int priority;
+
+ public int compareTo(HandlerPriorityPair o) {
+ if(o.priority > priority) {
+ return 1;
+ } else if(o.priority < priority) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+ }
+
+ static {
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.papyrus.readonly", "readOnlyHandler");
+
+ List<HandlerPriorityPair> handlerPriorityPairs = new LinkedList<HandlerPriorityPair>();
+ for(IConfigurationElement elem : configElements) {
+ if("readOnlyHandler".equals(elem.getName())) {
+ try {
+ HandlerPriorityPair handlerPriorityPair = new HandlerPriorityPair();
+ handlerPriorityPair.handler = (IReadOnlyHandler)elem.createExecutableExtension("class");
+ handlerPriorityPair.priority = Integer.parseInt(elem.getAttribute("priority"));
+
+ handlerPriorityPairs.add(handlerPriorityPair);
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ Collections.sort(handlerPriorityPairs);
+
+ orderedHandlersArray = new IReadOnlyHandler[handlerPriorityPairs.size()];
+
+ for(int i = 0; i < orderedHandlersArray.length; i++) {
+ orderedHandlersArray[i] = handlerPriorityPairs.get(i).handler;
+ }
+ }
+
+ public static boolean isReadOnly(Resource resource) {
+ if(resource != null && resource.getURI() != null) {
+ if (resource.getURI().isPlatform()) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(resource.getURI().toPlatformString(true)));
+ if(isReadOnly(file)) {
+ return true;
+ }
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isReadOnly(IFile file) {
+ return isReadOnly(new IFile[]{ file });
+ }
+
+ public static boolean isReadOnly(IFile[] files) {
+ for(int i = 0; i < orderedHandlersArray.length; i++) {
+ if(orderedHandlersArray[i].isReadOnly(files)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean enableWrite(IFile[] files) {
+ for(int i = 0; i < orderedHandlersArray.length; i++) {
+ if(orderedHandlersArray[i].isReadOnly(files)) {
+ boolean ok = orderedHandlersArray[i].enableWrite(files);
+ if(!ok) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyTester.java b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyTester.java
new file mode 100644
index 00000000000..ad9ff706422
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyTester.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.readonly;
+
+import java.util.Iterator;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.core.utils.BusinessModelResolver;
+
+public class ReadOnlyTester extends PropertyTester {
+
+ public static final String IS_READ_ONLY = "isReadOnly"; //$NON-NLS-1$
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if(IS_READ_ONLY.equals(property) && receiver instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection)receiver;
+
+ Iterator<?> it = selection.iterator();
+ while(it.hasNext()) {
+ Object obj = it.next();
+ Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(obj);
+ if(businessObject instanceof EObject) {
+ Resource resource = ((EObject)businessObject).eResource();
+ return ReadOnlyManager.isReadOnly(resource);
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyTransactionalEditingDomainProvider.java b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyTransactionalEditingDomainProvider.java
new file mode 100644
index 00000000000..bdfad53b674
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/ReadOnlyTransactionalEditingDomainProvider.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.readonly;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.eclipse.emf.workspace.IResourceUndoContextPolicy;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
+import org.eclipse.papyrus.commands.NotifyingWorkspaceCommandStack;
+import org.eclipse.papyrus.resource.ITransactionalEditingDomainProvider;
+
+public class ReadOnlyTransactionalEditingDomainProvider implements ITransactionalEditingDomainProvider {
+
+ public TransactionalEditingDomain createTransactionalEditingDomain(ResourceSet resourceSet) {
+ NotifyingWorkspaceCommandStack stack = new NotifyingWorkspaceCommandStack(CheckedOperationHistory.getInstance());
+ stack.setResourceUndoContextPolicy(IResourceUndoContextPolicy.DEFAULT);
+
+ TransactionalEditingDomain result = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, resourceSet) {
+
+ @Override
+ public boolean isReadOnly(Resource resource) {
+ return ReadOnlyManager.isReadOnly(resource);
+ }
+ };
+
+ WorkspaceEditingDomainFactory.INSTANCE.mapResourceSet(result);
+
+ return result;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/handlers/EnableWriteHandler.java b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/handlers/EnableWriteHandler.java
new file mode 100644
index 00000000000..40ff218dc9e
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.readonly/src/org/eclipse/papyrus/readonly/handlers/EnableWriteHandler.java
@@ -0,0 +1,71 @@
+package org.eclipse.papyrus.readonly.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.core.utils.BusinessModelResolver;
+import org.eclipse.papyrus.onefile.model.IPapyrusFile;
+import org.eclipse.papyrus.onefile.model.PapyrusModelHelper;
+import org.eclipse.papyrus.onefile.utils.OneFileUtils;
+import org.eclipse.papyrus.readonly.ReadOnlyManager;
+import org.eclipse.ui.PlatformUI;
+
+public class EnableWriteHandler extends AbstractHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ EObject elem = getSelectedElement();
+ if(elem != null && elem.eResource() != null && elem.eResource().getResourceSet() != null) {
+ Resource res = elem.eResource();
+ ResourceSet rs = res.getResourceSet();
+
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(res.getURI().toPlatformString(true)));
+ IPapyrusFile papFile = PapyrusModelHelper.getPapyrusModelFactory().createIPapyrusFile(file);
+ IFile[] associatedFiles = OneFileUtils.getAssociatedFiles(papFile);
+
+ ReadOnlyManager.enableWrite(associatedFiles);
+
+ for(IFile associatedFile : associatedFiles) {
+ URI associatedUri = URI.createPlatformResourceURI(associatedFile.getFullPath().toString(), true);
+ Resource associatedResource = rs.getResource(associatedUri, true);
+ if(associatedResource != null) {
+ associatedResource.setModified(true);
+ }
+ }
+ }
+ return null;
+ }
+
+ protected EObject getSelectedElement() {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if(selection instanceof IStructuredSelection) {
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ return resolveSemanticObject(obj);
+ }
+ return null;
+ }
+
+ /**
+ * Resolve semantic element
+ *
+ * @param object
+ * the object to resolve
+ * @return <code>null</code> or the semantic element associated to the
+ * specified object
+ */
+ protected EObject resolveSemanticObject(Object object) {
+ Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(object);
+ if(businessObject instanceof EObject) {
+ return (EObject)businessObject;
+ }
+ return null;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.svn/.classpath b/plugins/core/org.eclipse.papyrus.svn/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/core/org.eclipse.papyrus.svn/.project b/plugins/core/org.eclipse.papyrus.svn/.project
new file mode 100644
index 00000000000..a775c36cc65
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.svn</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/core/org.eclipse.papyrus.svn/.settings/org.eclipse.jdt.core.prefs b/plugins/core/org.eclipse.papyrus.svn/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..8b458650a01
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue Sep 27 15:02:14 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/core/org.eclipse.papyrus.svn/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.svn/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..28f5df7744b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.svn;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.svn.Activator
+Require-Bundle: org.eclipse.papyrus.onefile,
+ org.eclipse.team.svn.ui,
+ org.eclipse.gmf.runtime.common.core,
+ org.eclipse.emf.ecore,
+ org.eclipse.team.svn.core,
+ org.eclipse.papyrus.readonly;bundle-version="0.8.2",
+ org.eclipse.papyrus.commands
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.svn
+Bundle-Vendor: %providerName
diff --git a/plugins/core/org.eclipse.papyrus.svn/about.html b/plugins/core/org.eclipse.papyrus.svn/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.svn/build.properties b/plugins/core/org.eclipse.papyrus.svn/build.properties
new file mode 100644
index 00000000000..259d16dfc42
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ build.properties
diff --git a/plugins/core/org.eclipse.papyrus.svn/plugin.properties b/plugins/core/org.eclipse.papyrus.svn/plugin.properties
new file mode 100644
index 00000000000..6722e0ce099
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/plugin.properties
@@ -0,0 +1,8 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = Papyrus SVN Integration (Incubation)
+providerName = Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.svn/plugin.xml b/plugins/core/org.eclipse.papyrus.svn/plugin.xml
new file mode 100644
index 00000000000..5babc722a69
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/plugin.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.readonly.readOnlyHandler">
+ <readOnlyHandler
+ class="org.eclipse.papyrus.svn.SVNLockHandler"
+ priority="20">
+ </readOnlyHandler>
+ </extension>
+
+</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.svn/src/org/eclipse/papyrus/svn/Activator.java b/plugins/core/org.eclipse.papyrus.svn/src/org/eclipse/papyrus/svn/Activator.java
new file mode 100644
index 00000000000..74536d136fa
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/src/org/eclipse/papyrus/svn/Activator.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.svn;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.svn/src/org/eclipse/papyrus/svn/SVNLockHandler.java b/plugins/core/org.eclipse.papyrus.svn/src/org/eclipse/papyrus/svn/SVNLockHandler.java
new file mode 100644
index 00000000000..d909cae3f15
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.svn/src/org/eclipse/papyrus/svn/SVNLockHandler.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.svn;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.team.FileModificationValidationContext;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.papyrus.readonly.IReadOnlyHandler;
+import org.eclipse.team.svn.core.IStateFilter;
+import org.eclipse.team.svn.core.svnstorage.SVNRemoteStorage;
+import org.eclipse.team.svn.core.utility.FileUtility;
+import org.eclipse.team.svn.ui.SVNTeamModificationValidator;
+
+public class SVNLockHandler implements IReadOnlyHandler {
+
+ SVNTeamModificationValidator validator = new SVNTeamModificationValidator();
+
+ public boolean isReadOnly(IFile[] files) {
+
+ IResource[] needsLockResources = FileUtility.filterResources(files, IStateFilter.SF_NEEDS_LOCK, IResource.DEPTH_ZERO);
+ for(IResource needsLockResource : needsLockResources) {
+ if(!SVNRemoteStorage.instance().asLocalResource(needsLockResource).isLocked()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean enableWrite(IFile[] files) {
+
+ IStatus result = validator.validateEdit(files, FileModificationValidationContext.VALIDATE_PROMPT);
+
+ return result.isOK();
+ }
+}
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java
index d722334e51a..77d2783e9f0 100644
--- a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java
@@ -11,10 +11,8 @@ package org.eclipse.xtext.gmf.glue.edit.part;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.commands.operations.DefaultOperationHistory;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -27,13 +25,13 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditDomain;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.commands.ActionHandler;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.ITextOperationTarget;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.text.templates.TemplateException;
import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
@@ -376,7 +374,7 @@ public class PopupXtextEditorHelper implements IPopupEditorHelper {
protected void installUndoRedoSupport(SourceViewer viewer) {
IDocumentUndoManager undoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(viewer.getDocument());
final IUndoContext context = undoManager.getUndoContext();
- IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory() ;
+ IOperationHistory operationHistory = CheckedOperationHistory.getInstance();
operationHistoryListener = new OperationHistoryListener(context, new IUpdate() {
public void update() {
updateAction(ITextEditorActionConstants.REDO);
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java b/plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java
index 20181aa1ac1..a0f209c7fb7 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java
@@ -13,10 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.parametric;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
@@ -28,6 +25,7 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescrip
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.adaptor.gmf.AbstractPapyrusGmfCreateDiagramCommandHandler;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
@@ -133,11 +131,6 @@ public class CreateParametricDiagramCommand extends AbstractPapyrusGmfCreateDiag
CreateCommand nodeCreationCommand = new CreateCommand(editingdomain, descriptor, diagram);
- try {
- OperationHistoryFactory.getOperationHistory().execute(nodeCreationCommand, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- e.printStackTrace();
- SysmlDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
- }
+ editingdomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(nodeCreationCommand));
}
}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java b/plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java
index 52ba21bbd36..1018be6c1f0 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java
@@ -19,10 +19,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.ecore.EObject;
@@ -38,7 +35,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.core.adaptor.gmf.Activator;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.diagram.common.helper.NotificationHelper;
import org.eclipse.papyrus.diagram.common.providers.UIAdapterImpl;
@@ -197,12 +194,7 @@ public class SelfCompartmentNotificationHelper extends NotificationHelper {
*/
private static void execute() {
if(!command.isEmpty()) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- e.printStackTrace();
- Activator.getInstance().logError("Unable to create diagram elements", e); //$NON-NLS-1$
- }
+ command.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.collaborationuse.editor.xtext.ui/src/org/eclipse/papyrus/collaborationuse/editor/xtext/ui/contributions/CollaborationUsePopupEditor.java b/plugins/uml/org.eclipse.papyrus.collaborationuse.editor.xtext.ui/src/org/eclipse/papyrus/collaborationuse/editor/xtext/ui/contributions/CollaborationUsePopupEditor.java
index 716e3c40259..8b9eb969187 100644
--- a/plugins/uml/org.eclipse.papyrus.collaborationuse.editor.xtext.ui/src/org/eclipse/papyrus/collaborationuse/editor/xtext/ui/contributions/CollaborationUsePopupEditor.java
+++ b/plugins/uml/org.eclipse.papyrus.collaborationuse.editor.xtext.ui/src/org/eclipse/papyrus/collaborationuse/editor/xtext/ui/contributions/CollaborationUsePopupEditor.java
@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
@@ -29,6 +28,7 @@ import org.eclipse.papyrus.collaborationuse.editor.xtext.ui.internal.UmlCollabor
import org.eclipse.papyrus.collaborationuse.editor.xtext.umlCollaborationUse.CollaborationUseRule;
import org.eclipse.papyrus.collaborationuse.editor.xtext.umlCollaborationUse.TypeRule;
import org.eclipse.papyrus.collaborationuse.editor.xtext.validation.SemanticValidator;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.uml2.uml.Collaboration;
import org.eclipse.uml2.uml.CollaborationUse;
@@ -133,7 +133,7 @@ public class CollaborationUsePopupEditor extends org.eclipse.xtext.gmf.glue.Popu
IUndoableOperation updateCommand = getUpdateCommand();
try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(updateCommand, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
org.eclipse.papyrus.properties.runtime.Activator.log.error(e);
}
diff --git a/plugins/uml/org.eclipse.papyrus.connectionpointreference.editor.xtext.ui/src/org/eclipse/papyrus/connectionpointreference/editor/xtext/ui/contributions/ConnectionPointReferencePopupEditorConfiguration.java b/plugins/uml/org.eclipse.papyrus.connectionpointreference.editor.xtext.ui/src/org/eclipse/papyrus/connectionpointreference/editor/xtext/ui/contributions/ConnectionPointReferencePopupEditorConfiguration.java
index de2580451cd..ab7c1152271 100644
--- a/plugins/uml/org.eclipse.papyrus.connectionpointreference.editor.xtext.ui/src/org/eclipse/papyrus/connectionpointreference/editor/xtext/ui/contributions/ConnectionPointReferencePopupEditorConfiguration.java
+++ b/plugins/uml/org.eclipse.papyrus.connectionpointreference.editor.xtext.ui/src/org/eclipse/papyrus/connectionpointreference/editor/xtext/ui/contributions/ConnectionPointReferencePopupEditorConfiguration.java
@@ -4,14 +4,14 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.connectionpointreference.editor.xtext.uMLConnectionPointReference.ConnectionPointReferenceRule;
import org.eclipse.papyrus.connectionpointreference.editor.xtext.ui.internal.UMLConnectionPointReferenceActivator;
import org.eclipse.papyrus.connectionpointreference.editor.xtext.validation.UMLConnectionPointReferenceJavaValidator;
@@ -113,12 +113,8 @@ public class ConnectionPointReferencePopupEditorConfiguration extends PopupEdito
// Creates and executes the update command
UpdateConnectionPointReferenceCommand updateCommand = new UpdateConnectionPointReferenceCommand(connectionPoint);
- try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null) ;
- }
- catch (ExecutionException e) {
- org.eclipse.papyrus.properties.runtime.Activator.log.error(e);
- }
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(updateCommand));
}
};
return super.createPopupEditorHelper(graphicalEditPart, injector, reconciler, textToEdit, fileExtension, new DefaultXtextSemanticValidator());
diff --git a/plugins/uml/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java b/plugins/uml/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java
index 3b9f599bc63..d736a40673c 100644
--- a/plugins/uml/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java
+++ b/plugins/uml/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java
@@ -16,12 +16,11 @@
package org.eclipse.ocl.examples.xtext.papyrus;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
@@ -31,6 +30,7 @@ import org.eclipse.ocl.examples.pivot.uml.UML2Ecore2Pivot;
import org.eclipse.ocl.examples.pivot.utilities.TypeManager;
import org.eclipse.ocl.examples.pivot.utilities.TypeManagerResourceAdapter;
import org.eclipse.ocl.examples.xtext.essentialocl.utilities.EssentialOCLPlugin;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.uml2.uml.Constraint;
@@ -68,14 +68,8 @@ public class EssentialOCLPopupEditorConfiguration extends org.eclipse.xtext.gmf.
// Creates and executes the update command
//
UpdateConstraintCommand updateCommand = new UpdateConstraintCommand((org.eclipse.uml2.uml.Constraint)modelObject, newTextualRepresentation);
- try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- /* [AC] TODO AC => check why LogHelper is not visible
- * org.eclipse.papyrus.properties.runtime.Activator.log.error(e);
- */
- e.printStackTrace() ;
- }
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(updateCommand));
//
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/helpers/SafeDialogOpenerDuringValidation.java b/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/helpers/SafeDialogOpenerDuringValidation.java
index f239cb4e0e6..99ca810e4f2 100644
--- a/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/helpers/SafeDialogOpenerDuringValidation.java
+++ b/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/helpers/SafeDialogOpenerDuringValidation.java
@@ -16,10 +16,10 @@ package org.eclipse.papyrus.controlmode.umlprofiles.helpers;
import org.eclipse.core.commands.operations.IOperationApprover2;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
/**
* This class must be used to open a dialog during a validation. Its usage avoids side effects with the Properties view, which would throw an
@@ -63,7 +63,7 @@ public abstract class SafeDialogOpenerDuringValidation<ReturnType> {
* temporarily disable all operations on the history, just enough time for opening the
* popup.
*/
- IOperationHistory history = OperationHistoryFactory.getOperationHistory();
+ IOperationHistory history = CheckedOperationHistory.getInstance();
history.addOperationApprover(operationDisapprover);
ReturnType result = openDialog();
history.removeOperationApprover(operationDisapprover);
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.activity/custom-src/org/eclipse/papyrus/diagram/activity/helper/SafeDialogOpenerDuringValidation.java b/plugins/uml/org.eclipse.papyrus.diagram.activity/custom-src/org/eclipse/papyrus/diagram/activity/helper/SafeDialogOpenerDuringValidation.java
index 911addd08ec..7fa907fdd83 100644
--- a/plugins/uml/org.eclipse.papyrus.diagram.activity/custom-src/org/eclipse/papyrus/diagram/activity/helper/SafeDialogOpenerDuringValidation.java
+++ b/plugins/uml/org.eclipse.papyrus.diagram.activity/custom-src/org/eclipse/papyrus/diagram/activity/helper/SafeDialogOpenerDuringValidation.java
@@ -20,6 +20,7 @@ import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.validation.internal.service.ResourceStatus;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
/**
* This class must be used to open a dialog during a validation. Its usage avoids side effects with the Properties view, which would throw an
@@ -62,7 +63,7 @@ public abstract class SafeDialogOpenerDuringValidation<ReturnType> {
* temporarily disable all operations on the history, just enough time for opening the
* popup.
*/
- IOperationHistory history = OperationHistoryFactory.getOperationHistory();
+ IOperationHistory history = CheckedOperationHistory.getInstance();
history.addOperationApprover(operationDisapprover);
ReturnType result = openDialog();
history.removeOperationApprover(operationDisapprover);
diff --git a/plugins/uml/org.eclipse.papyrus.message.editor.xtext.ui/src/org/eclipse/papyrus/message/editor/xtext/ui/contributions/MessagePopupEditor.java b/plugins/uml/org.eclipse.papyrus.message.editor.xtext.ui/src/org/eclipse/papyrus/message/editor/xtext/ui/contributions/MessagePopupEditor.java
index de67b5ee0f3..4ce4be955af 100644
--- a/plugins/uml/org.eclipse.papyrus.message.editor.xtext.ui/src/org/eclipse/papyrus/message/editor/xtext/ui/contributions/MessagePopupEditor.java
+++ b/plugins/uml/org.eclipse.papyrus.message.editor.xtext.ui/src/org/eclipse/papyrus/message/editor/xtext/ui/contributions/MessagePopupEditor.java
@@ -17,17 +17,15 @@ package org.eclipse.papyrus.message.editor.xtext.ui.contributions;
import java.util.Iterator;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.validation.internal.util.Log;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.log.LogHelper;
import org.eclipse.papyrus.message.editor.xtext.ui.internal.UmlMessageActivator;
import org.eclipse.papyrus.message.editor.xtext.umlMessage.MessageRule;
import org.eclipse.uml2.uml.Interaction;
@@ -170,12 +168,8 @@ public class MessagePopupEditor extends PopupEditorConfiguration {
// Creates and executes the update command
UpdateUMLMessageCommand updateCommand = new UpdateUMLMessageCommand(message);
- try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- //org.eclipse.papyrus.properties.runtime.Activator.log.error(e) ;
- //((LogHelper)Activator.log).error(e);
- }
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(updateCommand));
}
diff --git a/plugins/uml/org.eclipse.papyrus.parameter.editor.xtext.ui/src/org/eclipse/papyrus/parameter/editor/xtext/ui/contributions/ParameterPopupEditor.java b/plugins/uml/org.eclipse.papyrus.parameter.editor.xtext.ui/src/org/eclipse/papyrus/parameter/editor/xtext/ui/contributions/ParameterPopupEditor.java
index 0f1f08db730..1b895c35332 100644
--- a/plugins/uml/org.eclipse.papyrus.parameter.editor.xtext.ui/src/org/eclipse/papyrus/parameter/editor/xtext/ui/contributions/ParameterPopupEditor.java
+++ b/plugins/uml/org.eclipse.papyrus.parameter.editor.xtext.ui/src/org/eclipse/papyrus/parameter/editor/xtext/ui/contributions/ParameterPopupEditor.java
@@ -18,13 +18,13 @@ import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.common.editor.xtext.umlCommon.TypeRule;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.parameter.editor.xtext.ui.internal.UmlParameterActivator;
@@ -235,7 +235,7 @@ public class ParameterPopupEditor extends org.eclipse.xtext.gmf.glue.PopupEditor
IUndoableOperation updateCommand = getUpdateCommand();
try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(updateCommand, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
org.eclipse.papyrus.properties.runtime.Activator.log.error(e);
}
diff --git a/plugins/uml/org.eclipse.papyrus.properties.tabbed.profile/src/org/eclipse/papyrus/properties/tabbed/profile/imagesection/ImageContentSection.java b/plugins/uml/org.eclipse.papyrus.properties.tabbed.profile/src/org/eclipse/papyrus/properties/tabbed/profile/imagesection/ImageContentSection.java
index 79d33e90b4f..6288f4212ed 100644
--- a/plugins/uml/org.eclipse.papyrus.properties.tabbed.profile/src/org/eclipse/papyrus/properties/tabbed/profile/imagesection/ImageContentSection.java
+++ b/plugins/uml/org.eclipse.papyrus.properties.tabbed.profile/src/org/eclipse/papyrus/properties/tabbed/profile/imagesection/ImageContentSection.java
@@ -16,12 +16,12 @@ package org.eclipse.papyrus.properties.tabbed.profile.imagesection;
import java.io.File;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.properties.tabbed.profile.AbstractViewSection;
import org.eclipse.papyrus.properties.tabbed.profile.Activator;
@@ -130,7 +130,8 @@ public class ImageContentSection extends AbstractViewSection {
final File imgFile = new File(iconSelected);
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(EditorUtils.getTransactionalEditingDomain(), "Set Image content", null) {
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ AbstractTransactionalCommand operation = new AbstractTransactionalCommand(dom, "Set Image content", null) {
/**
* {@inheritDoc}
@@ -146,12 +147,8 @@ public class ImageContentSection extends AbstractViewSection {
}
};
- try {
- OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- }
-
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
+
refresh();
}
}
@@ -169,7 +166,8 @@ public class ImageContentSection extends AbstractViewSection {
// Erase image content
if(getElement() instanceof Image) {
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(EditorUtils.getTransactionalEditingDomain(), "Remove Image content", null) {
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ AbstractTransactionalCommand operation = new AbstractTransactionalCommand(dom, "Remove Image content", null) {
/**
* {@inheritDoc}
@@ -184,12 +182,7 @@ public class ImageContentSection extends AbstractViewSection {
return CommandResult.newOKCommandResult();
}
};
-
- try {
- OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- }
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
refresh();
}
diff --git a/plugins/uml/org.eclipse.papyrus.properties.uml/src/org/eclipse/papyrus/properties/uml/widgets/StereotypeImageEditor.java b/plugins/uml/org.eclipse.papyrus.properties.uml/src/org/eclipse/papyrus/properties/uml/widgets/StereotypeImageEditor.java
index 14d61db524b..55b9d2c7590 100644
--- a/plugins/uml/org.eclipse.papyrus.properties.uml/src/org/eclipse/papyrus/properties/uml/widgets/StereotypeImageEditor.java
+++ b/plugins/uml/org.eclipse.papyrus.properties.uml/src/org/eclipse/papyrus/properties/uml/widgets/StereotypeImageEditor.java
@@ -14,12 +14,12 @@ package org.eclipse.papyrus.properties.uml.widgets;
import java.io.File;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.properties.modelelement.ModelElement;
import org.eclipse.papyrus.properties.uml.Activator;
@@ -133,7 +133,8 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
final File imgFile = new File(iconSelected);
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(EditorUtils.getTransactionalEditingDomain(), "Set Image content", null) {
+ TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Set Image content", null) {
/**
* {@inheritDoc}
@@ -149,12 +150,7 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
return CommandResult.newOKCommandResult();
}
};
-
- try {
- OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- }
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
refresh();
}
@@ -164,7 +160,8 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
// Erase image content
if(getElement() instanceof Image) {
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(EditorUtils.getTransactionalEditingDomain(), "Remove Image content", null) {
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ AbstractTransactionalCommand operation = new AbstractTransactionalCommand(dom, "Remove Image content", null) {
/**
* {@inheritDoc}
@@ -180,11 +177,7 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
}
};
- try {
- OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- }
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
refresh();
}
diff --git a/plugins/uml/org.eclipse.papyrus.property.editor.xtext.ui/src/org/eclipse/papyrus/property/editor/xtext/ui/contributions/PropertyPopupEditorConfigurationContribution.java b/plugins/uml/org.eclipse.papyrus.property.editor.xtext.ui/src/org/eclipse/papyrus/property/editor/xtext/ui/contributions/PropertyPopupEditorConfigurationContribution.java
index edce74fb2a3..43d2a0ef779 100644
--- a/plugins/uml/org.eclipse.papyrus.property.editor.xtext.ui/src/org/eclipse/papyrus/property/editor/xtext/ui/contributions/PropertyPopupEditorConfigurationContribution.java
+++ b/plugins/uml/org.eclipse.papyrus.property.editor.xtext.ui/src/org/eclipse/papyrus/property/editor/xtext/ui/contributions/PropertyPopupEditorConfigurationContribution.java
@@ -13,20 +13,17 @@
*****************************************************************************/
package org.eclipse.papyrus.property.editor.xtext.ui.contributions;
-import static org.eclipse.papyrus.properties.runtime.Activator.log;
-
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.properties.runtime.modelhandler.emf.EMFUtils;
import org.eclipse.papyrus.properties.runtime.modelhandler.emf.TransactionUtil;
@@ -234,11 +231,8 @@ public class PropertyPopupEditorConfigurationContribution extends PopupEditorCon
TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(editedObjects);
if(updateCommand.canExecute() && !(TransactionUtil.isReadTransactionInProgress(editingDomain, true, true))) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- log.error(e);
- }
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(updateCommand));
return;
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.state.editor.xtext.ui/src/org/eclipse/papyrus/state/editor/xtext/ui/contributions/StatePopupEditorConfigurationContribution.java b/plugins/uml/org.eclipse.papyrus.state.editor.xtext.ui/src/org/eclipse/papyrus/state/editor/xtext/ui/contributions/StatePopupEditorConfigurationContribution.java
index 1817873c45d..12229a0e750 100755
--- a/plugins/uml/org.eclipse.papyrus.state.editor.xtext.ui/src/org/eclipse/papyrus/state/editor/xtext/ui/contributions/StatePopupEditorConfigurationContribution.java
+++ b/plugins/uml/org.eclipse.papyrus.state.editor.xtext.ui/src/org/eclipse/papyrus/state/editor/xtext/ui/contributions/StatePopupEditorConfigurationContribution.java
@@ -14,14 +14,14 @@
package org.eclipse.papyrus.state.editor.xtext.ui.contributions;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.state.editor.xtext.ui.contentassist.UmlStateProposalProvider;
@@ -154,11 +154,8 @@ public class StatePopupEditorConfigurationContribution extends PopupEditorConfig
// Creates and executes the update command
UpdateUMLStateCommand updateCommand = new UpdateUMLStateCommand(state);
- try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- org.eclipse.papyrus.properties.runtime.Activator.log.error(e);
- }
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(updateCommand));
}
};
return super.createPopupEditorHelper(graphicalEditPart,
diff --git a/plugins/uml/org.eclipse.papyrus.tabbedproperties.comments/src/org/eclipse/papyrus/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java b/plugins/uml/org.eclipse.papyrus.tabbedproperties.comments/src/org/eclipse/papyrus/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
index da0eaac9362..43753157d1c 100644
--- a/plugins/uml/org.eclipse.papyrus.tabbedproperties.comments/src/org/eclipse/papyrus/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
+++ b/plugins/uml/org.eclipse.papyrus.tabbedproperties.comments/src/org/eclipse/papyrus/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
@@ -20,7 +20,6 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -41,8 +40,8 @@ import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
@@ -63,6 +62,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
@@ -576,9 +576,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
}
};
if(command != null && command.canExecute()) {
- OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
-
- // command.execute(new NullProgressMonitor(), null);
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
} else {
Activator.log.error("Impossible to modify the annotated element list for the comment", null);
}
diff --git a/plugins/uml/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java b/plugins/uml/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java
index 67873f05bd3..13f7bd8bdcc 100644
--- a/plugins/uml/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java
+++ b/plugins/uml/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java
@@ -23,7 +23,6 @@ import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -49,6 +48,7 @@ import org.eclipse.emf.workspace.AbstractEMFOperation;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.core.editor.BackboneException;
import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.core.services.ServiceException;
@@ -181,7 +181,7 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
// Execute the command
try {
- OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
+ CheckedOperationHistory.getInstance().execute(command, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
Activator.getDefault().helper.error("Can't create Table Editor", e); //$NON-NLS-1$
}
diff --git a/plugins/uml/org.eclipse.papyrus.transition.editor.xtext.ui/src/org/eclipse/papyrus/transition/editor/xtext/ui/contributions/TransitionPopupEditorConfigurationContribution.java b/plugins/uml/org.eclipse.papyrus.transition.editor.xtext.ui/src/org/eclipse/papyrus/transition/editor/xtext/ui/contributions/TransitionPopupEditorConfigurationContribution.java
index e449de3470c..d717a6b37d1 100644
--- a/plugins/uml/org.eclipse.papyrus.transition.editor.xtext.ui/src/org/eclipse/papyrus/transition/editor/xtext/ui/contributions/TransitionPopupEditorConfigurationContribution.java
+++ b/plugins/uml/org.eclipse.papyrus.transition.editor.xtext.ui/src/org/eclipse/papyrus/transition/editor/xtext/ui/contributions/TransitionPopupEditorConfigurationContribution.java
@@ -17,15 +17,15 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.transition.editor.xtext.ui.internal.UmlTransitionActivator;
@@ -128,11 +128,8 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
// Creates and executes the update command
UpdateUMLTransitionCommand updateCommand = new UpdateUMLTransitionCommand(transition);
- try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- org.eclipse.papyrus.properties.runtime.Activator.log.error(e);
- }
+ TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
+ dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(updateCommand));
}
};
return super.createPopupEditorHelper(graphicalEditPart,

Back to the top