diff options
Diffstat (limited to 'plugins/infra/gmfdiag')
85 files changed, 1719 insertions, 2177 deletions
diff --git a/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant/META-INF/MANIFEST.MF index a2cd4de1581..e557f4b85b5 100644 --- a/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.emf.ecore.xmi;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.filters;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", com.ibm.icu;bundle-version="52.1.0" Export-Package: org.eclipse.papyrus.infra.gmfdiag.assistant, org.eclipse.papyrus.infra.gmfdiag.assistant.core, diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF index b2147ca4cce..1d8470dcb9e 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF @@ -1,12 +1,12 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.configuration.handler -Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.css.properties;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, +Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.css.properties;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.e4.ui.css.core;bundle-version="[0.11.0,1.0.0)", - org.eclipse.papyrus.infra.gmfdiag.css3.xtext;bundle-version="[2.0.0,3.0.0)";visibility:=reexport + org.eclipse.papyrus.infra.gmfdiag.css3.xtext;bundle-version="[3.0.0,4.0.0)";visibility:=reexport Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Name: CSS Configuration Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.css.configuration.Activator Bundle-ManifestVersion: 2 diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/pom.xml b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/pom.xml index 04b9961c188..1b1c98a02e4 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/pom.xml +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.css.configuration</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.css.configuration</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF index 15c4a98e6d7..ac84a8ab6c1 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.properties.creation, org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding, org.eclipse.papyrus.infra.gmfdiag.css.properties.provider -Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[1.3.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.properties;bundle-version="[2.0.0,3.0.0)", +Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.gmfdiag.properties;bundle-version="[3.0.0,4.0.0)", org.eclipse.e4.ui.css.core;bundle-version="[0.11.0,1.0.0)", org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="[1.2.0,2.0.0)" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 2.1.0.qualifier Bundle-Name: CSS Properties Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.css.properties.Activator Bundle-ManifestVersion: 2 diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/pom.xml b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/pom.xml index c4eca1b9958..97355e90cee 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/pom.xml +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.css.properties</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.css.properties</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/InputComboFieldEditor.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/InputComboFieldEditor.java index 202f455441a..3d14a36b0d2 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/InputComboFieldEditor.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/InputComboFieldEditor.java @@ -228,7 +228,7 @@ public class InputComboFieldEditor extends FieldEditor implements IDynamicFieldE } } if (fEntryNamesAndValues.length > 0) { - value = fEntryNamesAndValues[0][1]; + this.value = fEntryNamesAndValues[0][1]; combo.setText(fEntryNamesAndValues[0][0]); } } diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/META-INF/MANIFEST.MF index b65744dbbe4..40f34fb513c 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/META-INF/MANIFEST.MF @@ -1,5 +1,5 @@ Manifest-Version: 1.0 -Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[1.2.0,2.0.0)" +Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.0.0,3.0.0)" Bundle-Vendor: Eclipse Modeling Project Bundle-Version: 1.2.0.qualifier Bundle-Name: Papyrus Theme diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF index 04cd9d144a8..2d026df0412 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF @@ -20,12 +20,12 @@ Require-Bundle: org.eclipse.e4.ui.css.core;bundle-version="[0.11.0,1.0.0)", org.w3c.css.sac;bundle-version="[1.3.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf.appearance;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.gmfdiag.css.model;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.gmf.runtime.notation.edit;bundle-version="[1.7.0,2.0.0)", org.eclipse.papyrus.infra.properties;bundle-version="[1.2.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.css.Activator diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/pom.xml b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/pom.xml index deef8f07927..53faaef5c36 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/pom.xml +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.css</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.css</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSImageBufferStyleDelegate.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSImageBufferStyleDelegate.java index 094d505090a..fa2dfeaf9d3 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSImageBufferStyleDelegate.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSImageBufferStyleDelegate.java @@ -1,54 +1,56 @@ -/***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * - * 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: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.ImageBufferStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSImageBufferStyle; -import org.w3c.dom.css.CSSValue; - -public class CSSImageBufferStyleDelegate implements CSSImageBufferStyle { - - private ImageBufferStyle imageBufferStyle; - - private ExtendedCSSEngine engine; - - public CSSImageBufferStyleDelegate(ImageBufferStyle imageBufferStyle, ExtendedCSSEngine engine) { - this.imageBufferStyle = imageBufferStyle; - this.engine = engine; - } - - // ////////////////////////////////////////////// - // Implements a getter for each CSS property // - // ////////////////////////////////////////////// - - @Override - public java.lang.Boolean getCSSAntiAlias() { - CSSValue cssValue = engine.retrievePropertyValue(imageBufferStyle, "antiAlias"); - if (cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getImageStyle_AntiAlias().getDefaultValue(); - return (java.lang.Boolean) defaultValue; - } - return null; - } - - @Override - public java.lang.Boolean getCSSMaintainAspectRatio() { - CSSValue cssValue = engine.retrievePropertyValue(imageBufferStyle, "maintainAspectRatio"); - if (cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getImageStyle_MaintainAspectRatio().getDefaultValue(); - return (java.lang.Boolean) defaultValue; - } - return null; - } -} +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.style.impl;
+
+import org.eclipse.gmf.runtime.notation.ImageBufferStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
+import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSImageBufferStyle;
+import org.w3c.dom.css.CSSValue;
+
+public class CSSImageBufferStyleDelegate implements CSSImageBufferStyle {
+
+ private ImageBufferStyle imageBufferStyle;
+
+ private ExtendedCSSEngine engine;
+
+ public CSSImageBufferStyleDelegate(ImageBufferStyle imageBufferStyle, ExtendedCSSEngine engine) {
+ this.imageBufferStyle = imageBufferStyle;
+ this.engine = engine;
+ }
+
+ // //////////////////////////////////////////////
+ // Implements a getter for each CSS property //
+ // //////////////////////////////////////////////
+
+ @Override
+ public java.lang.Boolean getCSSAntiAlias() {
+ CSSValue cssValue = engine.retrievePropertyValue(imageBufferStyle, "antiAlias");
+ if (cssValue == null) {
+ Object defaultValue = NotationPackage.eINSTANCE.getImageStyle_AntiAlias().getDefaultValue();
+ return (java.lang.Boolean) defaultValue;
+ }
+
+ return (Boolean) engine.convert(cssValue, Boolean.class, null);
+ }
+
+ @Override
+ public java.lang.Boolean getCSSMaintainAspectRatio() {
+ CSSValue cssValue = engine.retrievePropertyValue(imageBufferStyle, "maintainAspectRatio");
+ if (cssValue == null) {
+ Object defaultValue = NotationPackage.eINSTANCE.getImageStyle_MaintainAspectRatio().getDefaultValue();
+ return (java.lang.Boolean) defaultValue;
+ }
+
+ return (Boolean) engine.convert(cssValue, Boolean.class, null);
+ }
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSImageStyleDelegate.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSImageStyleDelegate.java index a1a23e0013f..569de488320 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSImageStyleDelegate.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSImageStyleDelegate.java @@ -1,54 +1,54 @@ -/***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * - * 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: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.ImageStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSImageStyle; -import org.w3c.dom.css.CSSValue; - -public class CSSImageStyleDelegate implements CSSImageStyle { - - private ImageStyle imageStyle; - - private ExtendedCSSEngine engine; - - public CSSImageStyleDelegate(ImageStyle imageStyle, ExtendedCSSEngine engine) { - this.imageStyle = imageStyle; - this.engine = engine; - } - - // ////////////////////////////////////////////// - // Implements a getter for each CSS property // - // ////////////////////////////////////////////// - - @Override - public java.lang.Boolean getCSSAntiAlias() { - CSSValue cssValue = engine.retrievePropertyValue(imageStyle, "antiAlias"); - if (cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getImageStyle_AntiAlias().getDefaultValue(); - return (java.lang.Boolean) defaultValue; - } - return null; - } - - @Override - public java.lang.Boolean getCSSMaintainAspectRatio() { - CSSValue cssValue = engine.retrievePropertyValue(imageStyle, "maintainAspectRatio"); - if (cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getImageStyle_MaintainAspectRatio().getDefaultValue(); - return (java.lang.Boolean) defaultValue; - } - return null; - } -} +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.style.impl;
+
+import org.eclipse.gmf.runtime.notation.ImageStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
+import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSImageStyle;
+import org.w3c.dom.css.CSSValue;
+
+public class CSSImageStyleDelegate implements CSSImageStyle {
+
+ private ImageStyle imageStyle;
+
+ private ExtendedCSSEngine engine;
+
+ public CSSImageStyleDelegate(ImageStyle imageStyle, ExtendedCSSEngine engine) {
+ this.imageStyle = imageStyle;
+ this.engine = engine;
+ }
+
+ // //////////////////////////////////////////////
+ // Implements a getter for each CSS property //
+ // //////////////////////////////////////////////
+
+ @Override
+ public java.lang.Boolean getCSSAntiAlias() {
+ CSSValue cssValue = engine.retrievePropertyValue(imageStyle, "antiAlias");
+ if (cssValue == null) {
+ Object defaultValue = NotationPackage.eINSTANCE.getImageStyle_AntiAlias().getDefaultValue();
+ return (java.lang.Boolean) defaultValue;
+ }
+ return (Boolean) engine.convert(cssValue, Boolean.class, null);
+ }
+
+ @Override
+ public java.lang.Boolean getCSSMaintainAspectRatio() {
+ CSSValue cssValue = engine.retrievePropertyValue(imageStyle, "maintainAspectRatio");
+ if (cssValue == null) {
+ Object defaultValue = NotationPackage.eINSTANCE.getImageStyle_MaintainAspectRatio().getDefaultValue();
+ return (java.lang.Boolean) defaultValue;
+ }
+ return (Boolean) engine.convert(cssValue, Boolean.class, null);
+ }
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java index 482aee3969c..58321119f24 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java @@ -260,7 +260,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan humanType = notationElement.getType();
}
- pseudoInstances.add(new StringIgnoreCase(humanType));
+ pseudoInstances.add(normalizeString(humanType));
}
}
@@ -691,51 +691,15 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan getEngine().handleDispose(notationElement);
}
- private final Set<StringIgnoreCase> pseudoInstances = new HashSet<StringIgnoreCase>();
-
- private final static class StringIgnoreCase {
-
- private final String sourceString;
-
- private final String sourceStringToLower;
-
- public StringIgnoreCase(String source) {
- this.sourceString = source;
- this.sourceStringToLower = source == null ? null : source.toLowerCase();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other instanceof String) {
- return ((String) other).equalsIgnoreCase(sourceString);
- }
-
- if (other instanceof StringIgnoreCase) {
- return equals(((StringIgnoreCase) other).sourceString);
- }
-
- return false;
- }
-
- @Override
- public int hashCode() {
- if (sourceStringToLower == null) {
- return 0;
- }
-
- return sourceStringToLower.hashCode();
- }
-
- @Override
- public String toString() {
- return sourceStringToLower;
- }
+ private final Set<String> pseudoInstances = new HashSet<String>();
+ private String normalizeString(String string) {
+ return string.toUpperCase().toLowerCase();
}
@Override
public boolean isPseudoInstanceOf(String pseudo) {
- return pseudoInstances.contains(new StringIgnoreCase(pseudo));
+ return pseudoInstances.contains(normalizeString(pseudo));
}
@@ -760,7 +724,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan @Override
public void addStates(Set<String> states) {
for (String state : states) {
- this.pseudoInstances.add(new StringIgnoreCase(state));
+ this.pseudoInstances.add(normalizeString(state));
}
getEngine().notifyChange(this);
}
@@ -773,17 +737,13 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan @Override
public void removeStates(Set<String> states) {
for (String state : states) {
- this.pseudoInstances.remove(new StringIgnoreCase(state));
+ this.pseudoInstances.remove(normalizeString(state));
}
getEngine().notifyChange(this);
}
@Override
public Set<String> getStates() {
- Set<String> result = new HashSet<String>();
- for (StringIgnoreCase element : pseudoInstances) {
- result.add(element.toString());
- }
- return result;
+ return pseudoInstances;
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/META-INF/MANIFEST.MF index 6404fe8b557..82f6d7bb0ae 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/META-INF/MANIFEST.MF @@ -1,12 +1,12 @@ Manifest-Version: 1.0
-Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.css3.xtext;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.css3.xtext;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.xtext.ui;bundle-version="[2.10.0,3.0.0)";visibility:=reexport,
org.eclipse.xtext.ui.shared;bundle-version="[2.10.0,3.0.0)",
org.eclipse.xtext.builder;bundle-version="[2.10.0,3.0.0)",
org.eclipse.xtext.common.types.ui;bundle-version="[2.10.0,3.0.0)",
org.eclipse.xtext.ui.codetemplates.ui;bundle-version="[2.10.0,3.0.0)",
org.eclipse.compare;bundle-version="[3.6.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.0.0,3.0.0)",
org.eclipse.ui.editors;bundle-version="[3.10.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.108.0,4.0.0)",
org.eclipse.xtext.xbase.lib;bundle-version="[2.10.0,3.0.0)"
@@ -17,7 +17,7 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.css3.ui.quickfix, org.eclipse.papyrus.infra.gmfdiag.css3.ui.contentassist.antlr.internal
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Name: CSS3 Xtext Editor (UI)
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.css3.ui.internal.CSSActivator
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/pom.xml b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/pom.xml index fbf5aec7d55..020f7bf9061 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/pom.xml +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/pom.xml @@ -1,52 +1,52 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui</artifactId> - <version>2.0.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-clean-plugin</artifactId> - <configuration> - <fileset> - <directory>xtend-gen</directory> - <includes> - <include>**/*</include> - </includes> - <excludes> - <exclude>.gitignore</exclude> - </excludes> - </fileset> - </configuration> - </plugin> - <plugin> - <groupId>org.eclipse.xtend</groupId> - <artifactId>xtend-maven-plugin</artifactId> - <executions> - <execution> - <phase>generate-sources</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - </executions> - <configuration> - <outputDirectory>xtend-gen</outputDirectory> - <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> - </configuration> - </plugin> - </plugins> - </build> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <fileset>
+ <directory>xtend-gen</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>.gitignore</exclude>
+ </excludes>
+ </fileset>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <outputDirectory>xtend-gen</outputDirectory>
+ <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext/META-INF/MANIFEST.MF index b513856b2ea..683640b4112 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext/META-INF/MANIFEST.MF @@ -28,7 +28,7 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.css3, org.eclipse.papyrus.infra.gmfdiag.css3.formatting2
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Name: CSS3 Xtext Editor
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.css3.xtext; singleton:=true
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext/pom.xml b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext/pom.xml index 4fb3123cc5f..db68058d6a6 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext/pom.xml +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext/pom.xml @@ -1,52 +1,52 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.css3.xtext</artifactId> - <version>2.0.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-clean-plugin</artifactId> - <configuration> - <fileset> - <directory>xtend-gen</directory> - <includes> - <include>**/*</include> - </includes> - <excludes> - <exclude>.gitignore</exclude> - </excludes> - </fileset> - </configuration> - </plugin> - <plugin> - <groupId>org.eclipse.xtend</groupId> - <artifactId>xtend-maven-plugin</artifactId> - <executions> - <execution> - <phase>generate-sources</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - </executions> - <configuration> - <outputDirectory>xtend-gen</outputDirectory> - <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> - </configuration> - </plugin> - </plugins> - </build> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag-css</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.css3.xtext</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <fileset>
+ <directory>xtend-gen</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>.gitignore</exclude>
+ </excludes>
+ </fileset>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <outputDirectory>xtend-gen</outputDirectory>
+ <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF index e7eceb42fa6..1e6b2ee315e 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.gmf.runtime.diagram.ui;bundle-version="[1.8.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.ui;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)" Export-Package: org.eclipse.papyrus.extensionpoints.editors, org.eclipse.papyrus.extensionpoints.editors.configuration, org.eclipse.papyrus.extensionpoints.editors.definition, @@ -12,7 +12,7 @@ Export-Package: org.eclipse.papyrus.extensionpoints.editors, org.eclipse.papyrus.extensionpoints.editors.utils Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Name: %pluginName Bundle-Localization: plugin Bundle-Activator: org.eclipse.papyrus.extensionpoints.editors.Activator diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml index cb528176aa6..dfcca2cd2c1 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.extensionpoints.editors</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.extensionpoints.editors</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java index 7eaed5533a3..834f4b813cb 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java @@ -37,6 +37,8 @@ import org.eclipse.swt.graphics.Image; */ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint { + private static volatile DirectEditorExtensionPoint instance = null; + /** Array that stores registered transformations */ private static IDirectEditorExtensionPoint[] configurations; @@ -59,18 +61,12 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint { /** an optional additional constraint to filter the supported elements (In addition to the Metaclass) */ private IDirectEditorConstraint constraint; - /** - * Returns the set of transformations registered in the platform - * - * @return the set of transformations registered in the platform - */ - public static IDirectEditorExtensionPoint[] getDirectEditorConfigurations() { - - // Computed only once - if (configurations != null) { - return configurations; - } + private DirectEditorExtensionPoint() { + super(); + init(); + } + protected void init() { // It was not already computed, // returns the new Collection of DirectEditorExtensionPoint List<DirectEditorExtensionPoint> directEditorExtensionPoints = new ArrayList<DirectEditorExtensionPoint>(); @@ -95,18 +91,26 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint { configurations = directEditorExtensionPoints.toArray(new DirectEditorExtensionPoint[directEditorExtensionPoints.size()]); directEditorProvider = new DirectEditorRegistry(); directEditorProvider.init(configurations); + } + public final synchronized static DirectEditorExtensionPoint getInstance() { + if (DirectEditorExtensionPoint.instance == null) { + DirectEditorExtensionPoint.instance = new DirectEditorExtensionPoint(); + } + return DirectEditorExtensionPoint.instance; + } + + /** + * Returns the set of transformations registered in the platform + * + * @return the set of transformations registered in the platform + */ + public IDirectEditorExtensionPoint[] getDirectEditorConfigurations() { return configurations; } - public static DirectEditorRegistry getDirectEditorProvider() { - if (directEditorProvider != null) { - return directEditorProvider; - } else { - directEditorProvider = new DirectEditorRegistry(); - directEditorProvider.init(getDirectEditorConfigurations()); - return directEditorProvider; - } + public DirectEditorRegistry getDirectEditorProvider() { + return directEditorProvider; } /** @@ -118,7 +122,7 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint { * @deprecated Use {@link DirectEditorsUtil#getDefautDirectEditorConfiguration(Object, Object)} instead */ @Deprecated - public static DirectEditorExtensionPoint getDefautDirectEditorConfiguration(EObject semanticObjectToEdit, Object selectedObject) { + public DirectEditorExtensionPoint getDefautDirectEditorConfiguration(EObject semanticObjectToEdit, Object selectedObject) { return (DirectEditorExtensionPoint) DirectEditorsUtil.getDefautDirectEditorConfiguration(semanticObjectToEdit, selectedObject); } @@ -134,7 +138,7 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint { * @deprecated Use {@link DirectEditorsUtil#getDirectEditorConfigurations(Object, Object)} instead */ @Deprecated - public static Collection<DirectEditorExtensionPoint> getDirectEditorConfigurations(EObject semanticObjectToEdit, Object selectedObject) { + public Collection<DirectEditorExtensionPoint> getDirectEditorConfigurations(EObject semanticObjectToEdit, Object selectedObject) { Collection<IDirectEditorExtensionPoint> directEditorConfigurations = DirectEditorsUtil.getDirectEditorConfigurations(semanticObjectToEdit, selectedObject); List<DirectEditorExtensionPoint> returnList = new ArrayList<DirectEditorExtensionPoint>(); @@ -153,7 +157,7 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint { * the element that declares the extension * @return a new configuration, given the information of the specified configElt */ - public static DirectEditorExtensionPoint parseDirectEditorConfiguration(IConfigurationElement configElt) { + public DirectEditorExtensionPoint parseDirectEditorConfiguration(IConfigurationElement configElt) { // check that the ConfigElement is a transformation if (!IDirectEditorConfigurationIds.TAG_DIRECT_EDITOR_CONFIGURATION.equals(configElt.getName())) { diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java index b7f885b69e6..ab55c008b38 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java @@ -345,7 +345,7 @@ public class PapyrusEmbeddedEditorsPreferencePage extends PreferencePage impleme Map<String, List<IDirectEditorExtensionPoint>> elements = new HashMap<String, List<IDirectEditorExtensionPoint>>(); // Populate the table with the items - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); + IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations(); List<IDirectEditorExtensionPoint> configurations; for (IDirectEditorExtensionPoint extensionPoint : extensionPoints) { if (!elements.containsKey(extensionPoint.getObjectToEdit())) { diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java index 52684ea0e63..f0f0aaa6a98 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java @@ -44,9 +44,6 @@ public class ExtendedDirectEditionDialog extends LabelEditorDialog { /** Document used by the dialog */
protected Document document;
- /** initial text value */
- protected String value;
-
/** extension configuration */
protected IDirectEditorConfiguration configuration;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java index e024103999f..8809416701b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java @@ -1,295 +1,295 @@ -/***************************************************************************** - * Copyright (c) 2008 CEA LIST. - * - * - * 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: - * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.extensionpoints.editors.utils; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint; -import org.eclipse.papyrus.extensionpoints.editors.definition.DirectEditorExtensionPoint; -import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint; - -public class DirectEditorsUtil { - - /** The Constant UNKNOWN_PRIORITY. */ - private static final int UNKNOWN_PRIORITY = 100; - - /** - * Finds a editor for specific language and object to edit type - * - * @param language - * the language to edit - * @param objectToEdit - * the type of object to edit - * @return the extension point proxy that manages this kind of editor - * - * @deprecated Use {@link #findEditorConfiguration(String language, EObject eObjectToEdit)} instead - */ - @Deprecated - public static IDirectEditorConfiguration findEditorConfiguration(String language, String objectToEdit) { - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); - for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) { - final String lang = directEditorExtensionPoint.getLanguage(); - final String oToEdit = directEditorExtensionPoint.getObjectToEdit(); - if (lang.equals(language) && oToEdit.equals(objectToEdit)) { - // extension point found! - return directEditorExtensionPoint.getDirectEditorConfiguration(); - } - } - return new DefaultDirectEditorConfiguration(); - } - - /** - * Finds a editor for specific language and object to edit type - * - * @param language - * the language to edit - * @param semanticObjectToEdit - * the semantic object to edit - * @param selectedElement - * The real selected element (e.g. widget, edit part, ...) - * @return the extension point proxy that manages this kind of editor - */ - public static IDirectEditorConfiguration findEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) { - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); - IDirectEditorConfiguration editorConfiguration = new DefaultDirectEditorConfiguration(); - int configurationPriority = UNKNOWN_PRIORITY; - for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) { - final String lang = directEditorExtensionPoint.getLanguage(); - final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit(); - if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) { - IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint(); - if ((constraint == null || constraint.appliesTo(selectedElement)) && directEditorExtensionPoint.getPriority() < configurationPriority) { - // extension point found! - editorConfiguration = directEditorExtensionPoint.getDirectEditorConfiguration(); - configurationPriority = directEditorExtensionPoint.getPriority(); - } - } - } - return editorConfiguration; - } - - /** - * finds if an editor for specific language and object is available to edit type - * - * @param language - * the language to edit - * @param objectToEdit - * the object to edit - * @return <code>true</code> if an editor exists - * - * @deprecated Use {@link #hasSpecificEditorConfiguration(String language, EObject eObjectToEdit)} instead - */ - @Deprecated - public static boolean hasSpecificEditorConfiguration(String language, String objectToEdit) { - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); - for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) { - final String lang = directEditorExtensionPoint.getLanguage(); - final String oToEdit = directEditorExtensionPoint.getObjectToEdit(); - if (lang.equals(language) && oToEdit.equals(objectToEdit)) { - // extension point found! - return true; - } - } - return false; - } - - /** - * finds if an editor for specific language and object is available to edit type - * - * @param language - * the language to edit - * @param semanticObjectToEdit - * the semantic object to edit - * @param selectedElement - * The real selected element (e.g. widget, edit part, ...) - * @return <code>true</code> if an editor exists - */ - public static boolean hasSpecificEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) { - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); - for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) { - final String lang = directEditorExtensionPoint.getLanguage(); - final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit(); - if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) { - IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint(); - if (constraint == null || constraint.appliesTo(selectedElement)) { - // extension point found! - return true; - } - } - } - return false; - } - - /** - * finds if an editor for specific object is available to edit type - * - * @param language - * the language to edit - * @param objectToEdit - * the type of object to edit - * @return <code>true</code> if an editor exists - * - * @deprecated Use {@link #hasSpecificEditorConfiguration(EObject)} instead - */ - @Deprecated - public static boolean hasSpecificEditorConfiguration(String objectToEdit) { - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); - for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) { - final String oToEdit = directEditorExtensionPoint.getObjectToEdit(); - if (oToEdit.equals(objectToEdit)) { - // extension point found! - return true; - } - } - return false; - } - - /** - * finds if an editor for specific object is available to edit type - * - * @param language - * the language to edit - * @param semanticObjectToEdit - * the semantic object to edit - * @param selectedElement - * The real selected element (e.g. widget, edit part, ...) - * @return <code>true</code> if an editor exists - */ - public static boolean hasSpecificEditorConfiguration(Object semanticObjectToEdit, Object selectedElement) { - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); - for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) { - final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit(); - if (classToEdit.isInstance(semanticObjectToEdit)) { - IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint(); - if (constraint == null || constraint.appliesTo(selectedElement)) { - // extension point found! - return true; - } - } - } - return false; - } - - /** - * Retrieves the preferred editor configuration for the specified type - * - * @param class_ - * the type of element to edit - * @return the preferred editor configuration for the specified type or <code>null</code> - */ - public static IDirectEditorExtensionPoint getDefautDirectEditorConfiguration(Object semanticObjectToEdit, Object selectedObject) { - // retrieves preference for this element - String language = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticObjectToEdit.getClass().asSubclass(EObject.class)); - if (language == null || IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(language)) { - return null; - } - IDirectEditorExtensionPoint currentConfiguration = null; - int currentPriority = UNKNOWN_PRIORITY; - Collection<IDirectEditorExtensionPoint> configs = getDirectEditorConfigurations(semanticObjectToEdit, selectedObject); - - for (IDirectEditorExtensionPoint extensionPoint : configs) { - if (language.equals(extensionPoint.getLanguage()) && extensionPoint.getPriority() < currentPriority) { - currentConfiguration = extensionPoint; - currentPriority = extensionPoint.getPriority(); - } - } - - return currentConfiguration; - } - - /** - * Returns the set of transformations registered in the platform for the specified kind of - * element - * - * @param the - * type of element to be edited - * @return the set of transformations registered in the platform for the specified kind of - * element - */ - public static Collection<IDirectEditorExtensionPoint> getDirectEditorConfigurations(Object semanticObjectToEdit, Object selectedObject) { - // list of configuration to be returned. They correspond to - // configuration to edit the - // specified type - final List<IDirectEditorExtensionPoint> elementConfigurations = new ArrayList<IDirectEditorExtensionPoint>(); - - // check each configuration in the platform and select corresponding - // ones. - for (IDirectEditorExtensionPoint configuration : DirectEditorExtensionPoint.getDirectEditorConfigurations()) { - // both class are compatibles ? - if (configuration.getObjectClassToEdit() != null) { - if (configuration.getObjectClassToEdit().isInstance(semanticObjectToEdit)) { - IDirectEditorConstraint constraint = configuration.getAdditionalConstraint(); - if (constraint == null || constraint.appliesTo(selectedObject)) - elementConfigurations.add(configuration); - } - } - } - return elementConfigurations; - } - - /** - * Finds a editor for specific language and object to edit type with the higher priority. - * - * @param language - * the language to edit - * @param objectToEdit - * the type of object to edit - * @return the extension point proxy that manages this kind of editor - */ - public static IDirectEditorConfiguration findEditorConfigurationWithPriority(String language, String objectToEdit) { - IDirectEditorConfiguration result = null; - int currentPrority = UNKNOWN_PRIORITY; - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); - for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) { - final String lang = directEditorExtensionPoint.getLanguage(); - final String oToEdit = directEditorExtensionPoint.getObjectToEdit(); - if (lang.equals(language) && oToEdit.equals(objectToEdit)) { - // extension point found! - int directEditorExtensionPointPriority = directEditorExtensionPoint.getPriority() != null ? directEditorExtensionPoint.getPriority() : UNKNOWN_PRIORITY; - if (result == null || (directEditorExtensionPointPriority < currentPrority)) { - result = directEditorExtensionPoint.getDirectEditorConfiguration(); - currentPrority = directEditorExtensionPointPriority; - } - } - } - return result != null ? result : new DefaultDirectEditorConfiguration(); - } - - /** - * returns the list of languages that are available from extension points - * - * @return the list of languages that have an extended editor - */ - public static List<String> getLanguages(String objectToEdit) { - List<String> languages = new ArrayList<String>(); - IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getDirectEditorConfigurations(); - for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) { - if (objectToEdit == null || directEditorExtensionPoint.getObjectToEdit().equals(objectToEdit)) { - String lang = directEditorExtensionPoint.getLanguage(); - if (!languages.contains(lang)) { - languages.add(lang); - } - } - } - return languages; - } - -} +/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.extensionpoints.editors.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.papyrus.extensionpoints.editors.definition.DirectEditorExtensionPoint;
+import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+
+public class DirectEditorsUtil {
+
+ /** The Constant UNKNOWN_PRIORITY. */
+ private static final int UNKNOWN_PRIORITY = 100;
+
+ /**
+ * Finds a editor for specific language and object to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param objectToEdit
+ * the type of object to edit
+ * @return the extension point proxy that manages this kind of editor
+ *
+ * @deprecated Use {@link #findEditorConfiguration(String language, EObject eObjectToEdit)} instead
+ */
+ @Deprecated
+ public static IDirectEditorConfiguration findEditorConfiguration(String language, String objectToEdit) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
+ if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
+ // extension point found!
+ return directEditorExtensionPoint.getDirectEditorConfiguration();
+ }
+ }
+ return new DefaultDirectEditorConfiguration();
+ }
+
+ /**
+ * Finds a editor for specific language and object to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return the extension point proxy that manages this kind of editor
+ */
+ public static IDirectEditorConfiguration findEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ IDirectEditorConfiguration editorConfiguration = new DefaultDirectEditorConfiguration();
+ int configurationPriority = UNKNOWN_PRIORITY;
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
+ if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
+ if ((constraint == null || constraint.appliesTo(selectedElement)) && directEditorExtensionPoint.getPriority() < configurationPriority) {
+ // extension point found!
+ editorConfiguration = directEditorExtensionPoint.getDirectEditorConfiguration();
+ configurationPriority = directEditorExtensionPoint.getPriority();
+ }
+ }
+ }
+ return editorConfiguration;
+ }
+
+ /**
+ * finds if an editor for specific language and object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param objectToEdit
+ * the object to edit
+ * @return <code>true</code> if an editor exists
+ *
+ * @deprecated Use {@link #hasSpecificEditorConfiguration(String language, EObject eObjectToEdit)} instead
+ */
+ @Deprecated
+ public static boolean hasSpecificEditorConfiguration(String language, String objectToEdit) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
+ if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
+ // extension point found!
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * finds if an editor for specific language and object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return <code>true</code> if an editor exists
+ */
+ public static boolean hasSpecificEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
+ if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
+ if (constraint == null || constraint.appliesTo(selectedElement)) {
+ // extension point found!
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * finds if an editor for specific object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param objectToEdit
+ * the type of object to edit
+ * @return <code>true</code> if an editor exists
+ *
+ * @deprecated Use {@link #hasSpecificEditorConfiguration(EObject)} instead
+ */
+ @Deprecated
+ public static boolean hasSpecificEditorConfiguration(String objectToEdit) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
+ if (oToEdit.equals(objectToEdit)) {
+ // extension point found!
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * finds if an editor for specific object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return <code>true</code> if an editor exists
+ */
+ public static boolean hasSpecificEditorConfiguration(Object semanticObjectToEdit, Object selectedElement) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
+ if (classToEdit.isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
+ if (constraint == null || constraint.appliesTo(selectedElement)) {
+ // extension point found!
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Retrieves the preferred editor configuration for the specified type
+ *
+ * @param class_
+ * the type of element to edit
+ * @return the preferred editor configuration for the specified type or <code>null</code>
+ */
+ public static IDirectEditorExtensionPoint getDefautDirectEditorConfiguration(Object semanticObjectToEdit, Object selectedObject) {
+ // retrieves preference for this element
+ String language = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticObjectToEdit.getClass().asSubclass(EObject.class));
+ if (language == null || IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(language)) {
+ return null;
+ }
+ IDirectEditorExtensionPoint currentConfiguration = null;
+ int currentPriority = UNKNOWN_PRIORITY;
+ Collection<IDirectEditorExtensionPoint> configs = getDirectEditorConfigurations(semanticObjectToEdit, selectedObject);
+
+ for (IDirectEditorExtensionPoint extensionPoint : configs) {
+ if (language.equals(extensionPoint.getLanguage()) && extensionPoint.getPriority() < currentPriority) {
+ currentConfiguration = extensionPoint;
+ currentPriority = extensionPoint.getPriority();
+ }
+ }
+
+ return currentConfiguration;
+ }
+
+ /**
+ * Returns the set of transformations registered in the platform for the specified kind of
+ * element
+ *
+ * @param the
+ * type of element to be edited
+ * @return the set of transformations registered in the platform for the specified kind of
+ * element
+ */
+ public static Collection<IDirectEditorExtensionPoint> getDirectEditorConfigurations(Object semanticObjectToEdit, Object selectedObject) {
+ // list of configuration to be returned. They correspond to
+ // configuration to edit the
+ // specified type
+ final List<IDirectEditorExtensionPoint> elementConfigurations = new ArrayList<IDirectEditorExtensionPoint>();
+
+ // check each configuration in the platform and select corresponding
+ // ones.
+ for (IDirectEditorExtensionPoint configuration : DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations()) {
+ // both class are compatibles ?
+ if (configuration.getObjectClassToEdit() != null) {
+ if (configuration.getObjectClassToEdit().isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = configuration.getAdditionalConstraint();
+ if (constraint == null || constraint.appliesTo(selectedObject))
+ elementConfigurations.add(configuration);
+ }
+ }
+ }
+ return elementConfigurations;
+ }
+
+ /**
+ * Finds a editor for specific language and object to edit type with the higher priority.
+ *
+ * @param language
+ * the language to edit
+ * @param objectToEdit
+ * the type of object to edit
+ * @return the extension point proxy that manages this kind of editor
+ */
+ public static IDirectEditorConfiguration findEditorConfigurationWithPriority(String language, String objectToEdit) {
+ IDirectEditorConfiguration result = null;
+ int currentPrority = UNKNOWN_PRIORITY;
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
+ if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
+ // extension point found!
+ int directEditorExtensionPointPriority = directEditorExtensionPoint.getPriority() != null ? directEditorExtensionPoint.getPriority() : UNKNOWN_PRIORITY;
+ if (result == null || (directEditorExtensionPointPriority < currentPrority)) {
+ result = directEditorExtensionPoint.getDirectEditorConfiguration();
+ currentPrority = directEditorExtensionPointPriority;
+ }
+ }
+ }
+ return result != null ? result : new DefaultDirectEditorConfiguration();
+ }
+
+ /**
+ * returns the list of languages that are available from extension points
+ *
+ * @return the list of languages that have an extended editor
+ */
+ public static List<String> getLanguages(String objectToEdit) {
+ List<String> languages = new ArrayList<String>();
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ if (objectToEdit == null || directEditorExtensionPoint.getObjectToEdit().equals(objectToEdit)) {
+ String lang = directEditorExtensionPoint.getLanguage();
+ if (!languages.contains(lang)) {
+ languages.add(lang);
+ }
+ }
+ }
+ return languages;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical/META-INF/MANIFEST.MF index c76ed03201d..477f657f2c6 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical/META-INF/MANIFEST.MF @@ -1,5 +1,5 @@ Manifest-Version: 1.0 -Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, +Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)" Export-Package: org.eclipse.papyrus.infra.gmfdiag.canonical.editpolicy, org.eclipse.papyrus.infra.gmfdiag.canonical.internal, @@ -7,7 +7,7 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.canonical.editpolicy, org.eclipse.papyrus.infra.gmfdiag.canonical.strategy Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Name: %pluginName Bundle-Localization: plugin Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.canonical.internal.Activator diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical/pom.xml index 457f16020be..75db42a6ff9 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.canonical</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.canonical</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/META-INF/MANIFEST.MF index bfc23a9e5f6..a3d544e8994 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/META-INF/MANIFEST.MF @@ -4,14 +4,14 @@ Require-Bundle: org.eclipse.emf.transaction.ui;bundle-version="[1.4.0,2.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, org.eclipse.gmf.runtime.diagram.ui.resources.editor;bundle-version="[1.7.0,2.0.0)", - org.eclipse.papyrus.infra.ui;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)";visibility:=reexport Export-Package: org.eclipse.papyrus.commands, org.eclipse.papyrus.commands.util, org.eclipse.papyrus.commands.wrappers Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 3.0.0.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-ManifestVersion: 2 diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/pom.xml index a7331fd7697..38c6b1c03cc 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.commands</artifactId> - <version>2.0.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.commands</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStack.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStack.java index 2e64c17bf91..75a41923ba3 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStack.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStack.java @@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.transaction.RollbackException; +import org.eclipse.papyrus.infra.emf.gmf.command.NotifyingWorkspaceCommandStack; /** * @deprecated Use the {@link org.eclipse.papyrus.infra.emf.gmf.command.NestingNotifyingWorkspaceCommandStack} API, instead. diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java deleted file mode 100644 index 35f99697feb..00000000000 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011, 2016 Atos, CEA, Christian W. Damus, and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Mathieu Velten (Atos) - Initial API and implementation - * Arthur Daussy (Atos) - 363826: [Model Explorer] Drag and drop and undo, incorrect behavior - * Christian W. Damus (CEA) - 404220: Add contexts for tracking objects changed by operations (CDO) - * Christian W. Damus (CEA) - bugs 402525, 430648, 431023, 384169 - * Christian W. Damus - bugs 459746, 485220 - * - *****************************************************************************/ -package org.eclipse.papyrus.commands; - -import org.eclipse.core.commands.operations.IOperationHistory; - -/** - * @deprecated Use the {@link org.eclipse.papyrus.infra.emf.gmf.command.NotifyingWorkspaceCommandStack} API, instead. - */ -@Deprecated -public class NotifyingWorkspaceCommandStack extends org.eclipse.papyrus.infra.emf.gmf.command.NotifyingWorkspaceCommandStack { - - /** - * Initializes me with the operation history to which I delegate command - * execution. - * - * @param history - * my operation history - */ - public NotifyingWorkspaceCommandStack(IOperationHistory history) { - super(history); - } - -} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/wrappers/EMFtoGMFCommandWrapper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/wrappers/EMFtoGMFCommandWrapper.java deleted file mode 100644 index 85f9c98fd13..00000000000 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/wrappers/EMFtoGMFCommandWrapper.java +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2007, 2014 Conselleria de Infraestructuras y Transporte, Generalitat de la Comunitat Valenciana, CEA, Christian W. Damus, and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Mario Cervera Ubeda (Prodevelop) - * Christian W. Damus (CEA) - bug 430701 - * Christian W. Damus - bug 485220 - * - ******************************************************************************/ -package org.eclipse.papyrus.commands.wrappers; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.papyrus.commands.INonDirtying; - -/** - * A GMF Command that wraps an EMF command. Each method is redirected to the EMF one. - * - * @deprecated Use the {@link org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper} API, instead. - */ -@Deprecated -public class EMFtoGMFCommandWrapper extends org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper { - - static { - // Configure legacy compatibility - setWrapperFunction(EMFtoGMFCommandWrapper::new); - setNonDirtyingWrapperFunction(NonDirtying::new); - } - - /** - * Constructor. - * - * @param emfCommand - * the emf command - */ - public EMFtoGMFCommandWrapper(Command emfCommand) { - super(emfCommand); - } - - /** - * Wraps the given {@code command}, accounting for possible non-dirty state. - * - * @param command - * a command to wrap - * @return the best wrapper for the {@code command} - */ - public static ICommand wrap(Command command) { - return org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper.wrap(command); - } - - // - // Nested types - // - - /** - * A non-dirtying wrapper for non-dirtying commands. - * - * @deprecated Use the {@link org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper.NonDirtying} API, instead. - */ - @Deprecated - public static class NonDirtying extends org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper.NonDirtying implements INonDirtying { - - public NonDirtying(org.eclipse.emf.common.command.Command command) { - super(command); - } - - } -} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/wrappers/GMFtoEMFCommandWrapper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/wrappers/GMFtoEMFCommandWrapper.java deleted file mode 100644 index 7cb2bf5a9c4..00000000000 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/wrappers/GMFtoEMFCommandWrapper.java +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2007, 2014 Conselleria de Infraestructuras y Transporte, Generalitat de la Comunitat Valenciana, CEA, Christian W. Damus, and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Mario Cervera Ubeda (Prodevelop) - * Christian W. Damus (CEA) - bug 430701 - * Christian W. Damus - bug 485220 - * - ******************************************************************************/ -package org.eclipse.papyrus.commands.wrappers; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.gmf.runtime.common.core.command.ICommand; - -/** - * A EMF Command that wraps a GMF command. Each method is redirected to the GMF one. - * - * @deprecated Use the {@link org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper} API, instead. - */ -@Deprecated -public class GMFtoEMFCommandWrapper extends org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper { - - static { - // Configure legacy compatibility - setWrapperFunction(GMFtoEMFCommandWrapper::new); - setNonDirtyingWrapperFunction(NonDirtying::new); - } - - /** - * Constructor. - * - * @param gmfCommand - * the gmf command - */ - public GMFtoEMFCommandWrapper(ICommand gmfCommand) { - super(gmfCommand); - } - - /** - * Wraps the given {@code command}, accounting for possible non-dirty state. - * - * @param command - * a command to wrap - * @return the best wrapper for the {@code command} - */ - public static Command wrap(ICommand command) { - return org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper.wrap(command); - } - - // - // Nested types - // - - /** - * A non-dirtying wrapper for non-dirtying commands. - * - * @deprecated Use the {@link org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper.NonDirtying} API, instead. - */ - @Deprecated - public static class NonDirtying extends org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper.NonDirtying { - - public NonDirtying(ICommand command) { - super(command); - } - - } - -} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF index 32b56b70010..84840f206fb 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF @@ -48,7 +48,7 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.common, Require-Bundle: org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)", org.eclipse.gmf.runtime.diagram.ui.resources.editor;bundle-version="[1.7.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf.appearance;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="[1.7.0,2.0.0)";visibility:=reexport, org.eclipse.gmf.runtime.draw2d.ui.render.awt;bundle-version="[1.8.0,2.0.0)", org.apache.batik.util;bundle-version="[1.6.0,1.7.0)", @@ -61,14 +61,15 @@ Require-Bundle: org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)", com.ibm.icu, org.eclipse.papyrus.infra.services.decoration;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.7.0,2.0.0)", - org.eclipse.papyrus.infra.emf.readonly;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.emf.readonly;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.types.core;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.sync;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.services.edit.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport + org.eclipse.papyrus.infra.services.edit.ui;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.emf.gmf Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-ClassPath: . -Bundle-Version: 2.0.100.qualifier +Bundle-Version: 3.0.0.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.common.Activator diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/pom.xml index b50589776be..a58268e02b4 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.common</artifactId> - <version>2.0.100-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.common</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java index 2f704380cf2..4f3279cc705 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java @@ -55,12 +55,12 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.papyrus.commands.CheckedDiagramCommandStack;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe;
import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconcilersReader;
import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.CommandIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
import org.eclipse.papyrus.infra.sync.service.ISyncService;
import org.eclipse.papyrus.infra.ui.editor.reload.IReloadContextProvider;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/GMFObservableList.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/GMFObservableList.java index d5b5056fc73..97358318b09 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/GMFObservableList.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/GMFObservableList.java @@ -18,7 +18,7 @@ import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.services.edit.ui.databinding.PapyrusObservableList; /** diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/GMFObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/GMFObservableValue.java index 9e367ff66bc..f3be3e47a7e 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/GMFObservableValue.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/GMFObservableValue.java @@ -20,7 +20,7 @@ import org.eclipse.core.databinding.observable.Realm; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.services.edit.ui.databinding.PapyrusObservableValue; /** diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java index 7c8e9257c23..aa729046467 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java @@ -312,7 +312,7 @@ public abstract class AbstractShowHideRelatedLinkEditPolicy extends AbstractEdit private boolean cleanContains(Collection<? extends UpdaterLinkDescriptor> collection, UpdaterLinkDescriptor umlLinkDescriptor) { for (UpdaterLinkDescriptor descriptor : collection) { if (descriptor.getModelElement() == umlLinkDescriptor.getModelElement() && descriptor.getSource() == umlLinkDescriptor.getSource() && descriptor.getDestination() == umlLinkDescriptor.getDestination() - && descriptor.getVisualID() == umlLinkDescriptor.getVisualID()) { + && descriptor.getVisualID().equals(umlLinkDescriptor.getVisualID())) { return true; } } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/HighlightEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/HighlightEditPolicy.java index 80c51c180d1..02fc1dd7549 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/HighlightEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/HighlightEditPolicy.java @@ -11,17 +11,15 @@ *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
-import org.eclipse.draw2d.Ellipse;
-import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.HighlightUtil;
-import org.eclipse.swt.SWT;
/**
* EditPolicy dedicated to highligh node/edge in case of mouseover.
+ *
* @author flefevre
*
*/
@@ -29,16 +27,12 @@ public class HighlightEditPolicy extends GraphicalEditPolicy { public static final String HIGHLIGHT_ROLE = "Highlight Edit Policy";
- protected Indicator sourceIndicator;
- protected Indicator targetIndicator;
-
- @SuppressWarnings({ "rawtypes" })
@Override
public void showTargetFeedback(Request request) {
EditPart host = getHost();
- if(RequestConstants.REQ_DROP_OBJECTS.equals(request.getType())) {
+ if (RequestConstants.REQ_DROP_OBJECTS.equals(request.getType())) {
highlight(host);
}
}
@@ -64,41 +58,18 @@ public class HighlightEditPolicy extends GraphicalEditPolicy { HighlightUtil.unhighlight();
}
- private void safeRemoveFeedback(IFigure feedback) {
- if (feedback == null || feedback.getParent() == null) {
- return;
- }
- feedback.getParent().remove(feedback);
- }
+
@Override
public void eraseTargetFeedback(Request request) {
unhighlight();
- safeRemoveFeedback(sourceIndicator);
- sourceIndicator = null;
- safeRemoveFeedback(targetIndicator);
- targetIndicator = null;
}
@Override
public void eraseSourceFeedback(Request request) {
super.eraseSourceFeedback(request);
- safeRemoveFeedback(sourceIndicator);
- sourceIndicator = null;
- safeRemoveFeedback(targetIndicator);
- targetIndicator = null;
+
}
- private static class Indicator extends Ellipse {
- /**
- * Constructor.
- *
- */
- public Indicator() {
- setLineWidth(2);
- setAntialias(SWT.ON);
- setSize(10, 10);
- }
- }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/expansion/InducedRepresentationCreationEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/expansion/InducedRepresentationCreationEditPolicy.java index 10d55539565..3cfc4c96fef 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/expansion/InducedRepresentationCreationEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/expansion/InducedRepresentationCreationEditPolicy.java @@ -21,17 +21,17 @@ import org.eclipse.gef.editpolicies.GraphicalEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe;
import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.expansionmodel.InducedRepresentation;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.NotificationManager;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
/**
* this edit policy can be apply only on {@link IPapyrusEditPart} in order to
* access to primary figure. the primary figure has to be a {@link IPapyrusNodeUMLElementFigure}.
-
+ *
* it creates the compartment displaying shapes for an element by reading the expansion model
* see #Req org.eclipse.papyrus.infra.gmfdiag.expansion.Req_011
*/
@@ -102,23 +102,22 @@ public class InducedRepresentationCreationEditPolicy extends GraphicalEditPolicy * @param appliedstereotype
* the stereotype application
*/
- protected void executeShapeCompartmentCreation(final IGraphicalEditPart editPart, HashMap<String, View> existedDynamicCompartment, List<String> wantedChildreenID,ChildrenListRepresentation listRepresentation) {
+ protected void executeShapeCompartmentCreation(final IGraphicalEditPart editPart, HashMap<String, View> existedDynamicCompartment, List<String> wantedChildreenID, ChildrenListRepresentation listRepresentation) {
for (String wantedID : wantedChildreenID) {
- if( existedDynamicCompartment.get(wantedID)==null){
- if( listRepresentation.IDMap.get(wantedID) instanceof InducedRepresentation){
+ if (existedDynamicCompartment.get(wantedID) == null) {
+ if (listRepresentation.IDMap.get(wantedID) instanceof InducedRepresentation) {
try {
TransactionalEditingDomain domain = getEditingDomain(editPart);
- CreateInducedRepresentationViewCommand command = new CreateInducedRepresentationViewCommand
- (domain,
- "view Creation",
- wantedID,
- "view Creation",
- editPart.getNotationView(),
- true,
- editPart.getDiagramPreferencesHint());
- // This should not change the command stack, as this transaction will only manipulate transient views. Create a transaction manually, if needed
- GMFUnsafe.write(domain, command);
+ CreateInducedRepresentationViewCommand command = new CreateInducedRepresentationViewCommand(domain,
+ "view Creation",
+ wantedID,
+ "view Creation",
+ editPart.getNotationView(),
+ true,
+ editPart.getDiagramPreferencesHint());
+ // This should not change the command stack, as this transaction will only manipulate transient views. Create a transaction manually, if needed
+ GMFUnsafe.write(domain, command);
} catch (Exception e) {
Activator.log.error(e);
}
@@ -142,17 +141,17 @@ public class InducedRepresentationCreationEditPolicy extends GraphicalEditPolicy protected String getDiagramType(View currentView) {
- Diagram diagram=currentView.getDiagram();
- String currentDiagramType=null;
- ViewPrototype viewPrototype=org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram);
- if(viewPrototype!=null){
- currentDiagramType=viewPrototype.getLabel();
- }
- else{
- currentDiagramType=diagram.getType();
+ Diagram diagram = currentView.getDiagram();
+ String currentDiagramType = null;
+ ViewPrototype viewPrototype = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram);
+ if (viewPrototype != null) {
+ currentDiagramType = viewPrototype.getLabel();
+ } else {
+ currentDiagramType = diagram.getType();
}
return currentDiagramType;
}
+
/**
* this method creates a node for the compartment of stereotype if it does not exist.
*
@@ -162,19 +161,19 @@ public class InducedRepresentationCreationEditPolicy extends GraphicalEditPolicy public void updateAddedCompartment() {
final IGraphicalEditPart editPart = (IGraphicalEditPart) getHost();
final View view = editPart.getNotationView();
- String diagramType= getDiagramType(view);
- ChildrenListRepresentation listRepresentation=diagramExpansionRegistry.mapChildreen.get(diagramType);
- if( listRepresentation==null){
+ String diagramType = getDiagramType(view);
+ ChildrenListRepresentation listRepresentation = diagramExpansionRegistry.mapChildreen.get(diagramType);
+ if (listRepresentation == null) {
return;
}
- List<String> childreenID=listRepresentation.parentChildrenRelation.get(view.getType());
- if( childreenID==null){
+ List<String> childreenID = listRepresentation.parentChildrenRelation.get(view.getType());
+ if (childreenID == null) {
return;
}
// Look for the node for the shape compartment
- HashMap<String,View> dynamicCompartments = getAddedCompartmentView(view, childreenID);
+ HashMap<String, View> dynamicCompartments = getAddedCompartmentView(view, childreenID);
// it does not exist
- if (dynamicCompartments.size()<childreenID.size()) {
+ if (dynamicCompartments.size() < childreenID.size()) {
executeShapeCompartmentCreation(editPart, dynamicCompartments, childreenID, listRepresentation);
}
@@ -183,12 +182,12 @@ public class InducedRepresentationCreationEditPolicy extends GraphicalEditPolicy /**
* Returns the view corresponding to the shape compartment
*
- * @param view
+ * @param view
* @return
*/
- private HashMap<String,View> getAddedCompartmentView(View view, List<String> childreenID) {
+ private HashMap<String, View> getAddedCompartmentView(View view, List<String> childreenID) {
- HashMap<String,View> dynamicCompartments= new HashMap<String,View>();
+ HashMap<String, View> dynamicCompartments = new HashMap<String, View>();
for (Object child : view.getChildren()) {
if (child instanceof View && childreenID.contains(((View) child).getType())) {
dynamicCompartments.put((((View) child).getType()), (View) child);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/EditPartSyncTrigger.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/EditPartSyncTrigger.java index 5ef2d80cab3..970c1c1760b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/EditPartSyncTrigger.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/EditPartSyncTrigger.java @@ -1,127 +1,127 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.gmfdiag.common.sync; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RollbackException; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; -import org.eclipse.papyrus.infra.gmfdiag.common.Activator; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrus.infra.sync.SyncRegistry; -import org.eclipse.papyrus.infra.sync.service.AbstractSyncTrigger; -import org.eclipse.papyrus.infra.sync.service.ISyncAction; -import org.eclipse.papyrus.infra.sync.service.ISyncService; - -/** - * Trigger to engage synchronization on edit parts that have the master/slave synchronization styles set. - */ -public abstract class EditPartSyncTrigger<M extends EObject, T extends EditPart, X> extends AbstractSyncTrigger { - - private final Class<? extends SyncRegistry<M, T, X>> registryType; - - public EditPartSyncTrigger(Class<? extends SyncRegistry<M, T, X>> registryType) { - super(); - - this.registryType = registryType; - } - - @Override - public ISyncAction trigger(ISyncService syncService, Object object) { - ISyncAction result = null; - - if (object instanceof EditPart) { - EditPart editPart = (EditPart) object; - Object model = editPart.getModel(); - if (model instanceof View) { - SyncKind kind = SyncStyles.getSyncKind((View) model); - result = trigger(kind); - } - } - - return result; - } - - protected ISyncAction trigger(final SyncKind syncKind) { - return new ISyncAction() { - - @Override - public IStatus perform(final ISyncService syncService, Object object) { - final IStatus[] result = { Status.OK_STATUS }; - final EditPart editPart = (EditPart) object; - final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain((View) editPart.getModel()); - - try { - GMFUnsafe.write(domain, new Runnable() { - - @Override - public void run() { - result[0] = doTrigger(syncService, editPart, syncKind); - } - }); - } catch (InterruptedException e) { - result[0] = new Status(IStatus.ERROR, Activator.ID, "Synchronization trigger was interrupted", e); - } catch (RollbackException e) { - result[0] = e.getStatus(); - } - - return result[0]; - } - }; - } - - protected IStatus doTrigger(ISyncService syncService, EditPart editPart, SyncKind syncKind) { - IStatus result = Status.OK_STATUS; - - SyncRegistry<M, T, X> registry = null; - M model = null; - T backend = null; - - try { - registry = syncService.getSyncRegistry(registryType); - model = AdapterUtils.adapt(editPart, registry.getModelType(), null); - backend = registry.getBackendType().cast(editPart); - } catch (Exception e) { - result = new Status(IStatus.ERROR, Activator.ID, "Failed to access synchronization registry", e); - } - - if ((registry != null) && (model != null)) { - switch (syncKind) { - case MASTER: - SyncBucket<M, T, X> bucket = registry.getBucket(model); - if (bucket == null) { - bucket = createSyncBucket(model, backend); - registry.register(bucket); - } - break; - case SLAVE: - registry.synchronize(backend); - break; - default: - result = new Status(IStatus.ERROR, Activator.ID, "Unsupported synchronization kind: " + syncKind, null); - break; - } - } - - return result; - } - - protected abstract SyncBucket<M, T, X> createSyncBucket(M model, T editPart); -} +/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.sync;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RollbackException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
+import org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.papyrus.infra.sync.SyncBucket;
+import org.eclipse.papyrus.infra.sync.SyncRegistry;
+import org.eclipse.papyrus.infra.sync.service.AbstractSyncTrigger;
+import org.eclipse.papyrus.infra.sync.service.ISyncAction;
+import org.eclipse.papyrus.infra.sync.service.ISyncService;
+
+/**
+ * Trigger to engage synchronization on edit parts that have the master/slave synchronization styles set.
+ */
+public abstract class EditPartSyncTrigger<M extends EObject, T extends EditPart, X> extends AbstractSyncTrigger {
+
+ private final Class<? extends SyncRegistry<M, T, X>> registryType;
+
+ public EditPartSyncTrigger(Class<? extends SyncRegistry<M, T, X>> registryType) {
+ super();
+
+ this.registryType = registryType;
+ }
+
+ @Override
+ public ISyncAction trigger(ISyncService syncService, Object object) {
+ ISyncAction result = null;
+
+ if (object instanceof EditPart) {
+ EditPart editPart = (EditPart) object;
+ Object model = editPart.getModel();
+ if (model instanceof View) {
+ SyncKind kind = SyncStyles.getSyncKind((View) model);
+ result = trigger(kind);
+ }
+ }
+
+ return result;
+ }
+
+ protected ISyncAction trigger(final SyncKind syncKind) {
+ return new ISyncAction() {
+
+ @Override
+ public IStatus perform(final ISyncService syncService, Object object) {
+ final IStatus[] result = { Status.OK_STATUS };
+ final EditPart editPart = (EditPart) object;
+ final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain((View) editPart.getModel());
+
+ try {
+ GMFUnsafe.write(domain, new Runnable() {
+
+ @Override
+ public void run() {
+ result[0] = doTrigger(syncService, editPart, syncKind);
+ }
+ });
+ } catch (InterruptedException e) {
+ result[0] = new Status(IStatus.ERROR, Activator.ID, "Synchronization trigger was interrupted", e);
+ } catch (RollbackException e) {
+ result[0] = e.getStatus();
+ }
+
+ return result[0];
+ }
+ };
+ }
+
+ protected IStatus doTrigger(ISyncService syncService, EditPart editPart, SyncKind syncKind) {
+ IStatus result = Status.OK_STATUS;
+
+ SyncRegistry<M, T, X> registry = null;
+ M model = null;
+ T backend = null;
+
+ try {
+ registry = syncService.getSyncRegistry(registryType);
+ model = AdapterUtils.adapt(editPart, registry.getModelType(), null);
+ backend = registry.getBackendType().cast(editPart);
+ } catch (Exception e) {
+ result = new Status(IStatus.ERROR, Activator.ID, "Failed to access synchronization registry", e);
+ }
+
+ if ((registry != null) && (model != null)) {
+ switch (syncKind) {
+ case MASTER:
+ SyncBucket<M, T, X> bucket = registry.getBucket(model);
+ if (bucket == null) {
+ bucket = createSyncBucket(model, backend);
+ registry.register(bucket);
+ }
+ break;
+ case SLAVE:
+ registry.synchronize(backend);
+ break;
+ default:
+ result = new Status(IStatus.ERROR, Activator.ID, "Unsupported synchronization kind: " + syncKind, null);
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ protected abstract SyncBucket<M, T, X> createSyncBucket(M model, T editPart);
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/NodePositionSyncFeature.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/NodePositionSyncFeature.java index 94d5d496093..9a5a178a7bb 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/NodePositionSyncFeature.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/NodePositionSyncFeature.java @@ -1,157 +1,157 @@ -/***************************************************************************** - * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Christian W. Damus - bug 465416 - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.gmfdiag.common.sync; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; -import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.sync.EMFDispatch; -import org.eclipse.papyrus.infra.sync.EMFDispatchManager; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrus.infra.sync.SyncFeature; -import org.eclipse.papyrus.infra.sync.SyncItem; -import org.eclipse.papyrus.infra.tools.util.TypeUtils; - -/** - * Represents a synchronization feature for the position of GMF notation nodes - * - * @author Laurent Wouters - * - * @param <M> - * The type of the underlying model element common to all synchronized items in a single bucket - * @param <T> - * The type of the backend element to synchronize - */ -public class NodePositionSyncFeature<M extends EObject, T extends EditPart> extends SyncFeature<M, T, Notification> { - /** - * Represents a dispatcher for this feature - * - * @author Laurent Wouters - */ - private class Dispatcher extends NodePositionSyncDispatcher<M, T> { - public Dispatcher(SyncItem<M, T> item) { - super(item); - } - - @Override - public void onClear() { - // clears the parent bucket - getBucket().clear(); - } - - @Override - protected void onFilteredChange(Notification notification) { - NodePositionSyncFeature.this.onChange(item, notification); - } - } - - private EMFDispatchManager<Dispatcher> dispatchMgr = createSingleDispatchManager(); - - /** - * Initialized this feature - * - * @param bucket - * The bucket doing the synchronization - */ - public NodePositionSyncFeature(SyncBucket<M, T, Notification> bucket) { - super(bucket); - } - - @Override - public void observe(SyncItem<M, T> item) { - dispatchMgr.add(item, new Dispatcher(item)); - } - - @Override - public void unobserve(SyncItem<M, T> item) { - dispatchMgr.remove(item); - } - - @Override - protected void onClear() { - dispatchMgr.removeAll(); - } - - @Override - public void synchronize(SyncItem<M, T> from, SyncItem<M, T> to, Notification message) { - EditPart fromEditPart = from.getBackend(); - EditPart toEditPart = to.getBackend(); - - // retrieve the locations - Point locationFrom = getLocation(fromEditPart); - Point locationTo = getLocation(toEditPart); - - if (!locationFrom.equals(locationTo)) { - // compute the reaction command - Command reaction = GMFtoEMFCommandWrapper.wrap(new SetBoundsCommand(getEditingDomain(), "Synchronize Node Location", toEditPart, locationFrom)); - - // dispatch the reaction - if (message == null) { - // this is an initial sync request - execute(reaction); - } else { - // this is reaction to a change - Dispatcher dispatcher = dispatchMgr.getDispatcher(from, message.getFeature()); - if (dispatcher != null) { - dispatcher.react(reaction); - } - } - } - } - - Point getLocation(EditPart editPart) { - Point result = null; - - Node node = (Node) editPart.getModel(); - Location location = TypeUtils.as(node.getLayoutConstraint(), Location.class); - if (location != null) { - result = new Point(location.getX(), location.getY()); - } else { - IFigure figure = ((GraphicalEditPart) editPart).getFigure(); - result = figure.getBounds().getLocation(); - } - - return result; - } - - public static <M extends EObject, T extends EditPart> NotationSyncPolicyDelegate<M, T> createPolicyDelegate() { - return new NotationSyncPolicyDelegate<M, T>(NotationPackage.Literals.LOCATION.getName()) { - - @Override - protected EMFDispatch createDispatcher(SyncItem<M, T> syncTarget) { - return new NodePositionSyncDispatcher<M, T>(syncTarget) { - @Override - public void onClear() { - // Nothing to do do - } - - @Override - protected void onFilteredChange(Notification notification) { - overrideOccurred(this, getItem()); - } - }; - } - }; - } -} +/*****************************************************************************
+ * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 465416
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.sync;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.sync.EMFDispatch;
+import org.eclipse.papyrus.infra.sync.EMFDispatchManager;
+import org.eclipse.papyrus.infra.sync.SyncBucket;
+import org.eclipse.papyrus.infra.sync.SyncFeature;
+import org.eclipse.papyrus.infra.sync.SyncItem;
+import org.eclipse.papyrus.infra.tools.util.TypeUtils;
+
+/**
+ * Represents a synchronization feature for the position of GMF notation nodes
+ *
+ * @author Laurent Wouters
+ *
+ * @param <M>
+ * The type of the underlying model element common to all synchronized items in a single bucket
+ * @param <T>
+ * The type of the backend element to synchronize
+ */
+public class NodePositionSyncFeature<M extends EObject, T extends EditPart> extends SyncFeature<M, T, Notification> {
+ /**
+ * Represents a dispatcher for this feature
+ *
+ * @author Laurent Wouters
+ */
+ private class Dispatcher extends NodePositionSyncDispatcher<M, T> {
+ public Dispatcher(SyncItem<M, T> item) {
+ super(item);
+ }
+
+ @Override
+ public void onClear() {
+ // clears the parent bucket
+ getBucket().clear();
+ }
+
+ @Override
+ protected void onFilteredChange(Notification notification) {
+ NodePositionSyncFeature.this.onChange(item, notification);
+ }
+ }
+
+ private EMFDispatchManager<Dispatcher> dispatchMgr = createSingleDispatchManager();
+
+ /**
+ * Initialized this feature
+ *
+ * @param bucket
+ * The bucket doing the synchronization
+ */
+ public NodePositionSyncFeature(SyncBucket<M, T, Notification> bucket) {
+ super(bucket);
+ }
+
+ @Override
+ public void observe(SyncItem<M, T> item) {
+ dispatchMgr.add(item, new Dispatcher(item));
+ }
+
+ @Override
+ public void unobserve(SyncItem<M, T> item) {
+ dispatchMgr.remove(item);
+ }
+
+ @Override
+ protected void onClear() {
+ dispatchMgr.removeAll();
+ }
+
+ @Override
+ public void synchronize(SyncItem<M, T> from, SyncItem<M, T> to, Notification message) {
+ EditPart fromEditPart = from.getBackend();
+ EditPart toEditPart = to.getBackend();
+
+ // retrieve the locations
+ Point locationFrom = getLocation(fromEditPart);
+ Point locationTo = getLocation(toEditPart);
+
+ if (!locationFrom.equals(locationTo)) {
+ // compute the reaction command
+ Command reaction = GMFtoEMFCommandWrapper.wrap(new SetBoundsCommand(getEditingDomain(), "Synchronize Node Location", toEditPart, locationFrom));
+
+ // dispatch the reaction
+ if (message == null) {
+ // this is an initial sync request
+ execute(reaction);
+ } else {
+ // this is reaction to a change
+ Dispatcher dispatcher = dispatchMgr.getDispatcher(from, message.getFeature());
+ if (dispatcher != null) {
+ dispatcher.react(reaction);
+ }
+ }
+ }
+ }
+
+ Point getLocation(EditPart editPart) {
+ Point result = null;
+
+ Node node = (Node) editPart.getModel();
+ Location location = TypeUtils.as(node.getLayoutConstraint(), Location.class);
+ if (location != null) {
+ result = new Point(location.getX(), location.getY());
+ } else {
+ IFigure figure = ((GraphicalEditPart) editPart).getFigure();
+ result = figure.getBounds().getLocation();
+ }
+
+ return result;
+ }
+
+ public static <M extends EObject, T extends EditPart> NotationSyncPolicyDelegate<M, T> createPolicyDelegate() {
+ return new NotationSyncPolicyDelegate<M, T>(NotationPackage.Literals.LOCATION.getName()) {
+
+ @Override
+ protected EMFDispatch createDispatcher(SyncItem<M, T> syncTarget) {
+ return new NodePositionSyncDispatcher<M, T>(syncTarget) {
+ @Override
+ public void onClear() {
+ // Nothing to do do
+ }
+
+ @Override
+ protected void onFilteredChange(Notification notification) {
+ overrideOccurred(this, getItem());
+ }
+ };
+ }
+ };
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/NodeSizeSyncFeature.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/NodeSizeSyncFeature.java index e2c9c5aca37..25c9f8fb2b8 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/NodeSizeSyncFeature.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/NodeSizeSyncFeature.java @@ -1,164 +1,164 @@ -/***************************************************************************** - * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Christian W. Damus - bug 465416 - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.gmfdiag.common.sync; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.Size; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.sync.EMFDispatch; -import org.eclipse.papyrus.infra.sync.EMFDispatchManager; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrus.infra.sync.SyncFeature; -import org.eclipse.papyrus.infra.sync.SyncItem; -import org.eclipse.papyrus.infra.tools.util.TypeUtils; - -/** - * Represents a synchronization feature for the position of GMF notation nodes - * - * @author Laurent Wouters - * - * @param <M> - * The type of the underlying model element common to all synchronized items in a single bucket - * @param <T> - * The type of the backend element to synchronize - */ -public class NodeSizeSyncFeature<M extends EObject, T extends EditPart> extends SyncFeature<M, T, Notification> { - /** - * Represents a dispatcher for this feature - * - * @author Laurent Wouters - */ - private class Dispatcher extends NodeSizeSyncDispatcher<M, T> { - public Dispatcher(SyncItem<M, T> item) { - super(item); - } - - @Override - public void onClear() { - // clears the parent bucket - getBucket().clear(); - } - - @Override - protected void onFilteredChange(Notification notification) { - NodeSizeSyncFeature.this.onChange(item, notification); - } - } - - /** - * The active dispatchers - */ - private EMFDispatchManager<Dispatcher> dispatchMgr = createSingleDispatchManager(); - - /** - * Initialized this feature - * - * @param bucket - * The bucket doing the synchronization - */ - public NodeSizeSyncFeature(SyncBucket<M, T, Notification> bucket) { - super(bucket); - } - - @Override - public void observe(SyncItem<M, T> item) { - dispatchMgr.add(item, new Dispatcher(item)); - } - - @Override - public void unobserve(SyncItem<M, T> item) { - dispatchMgr.remove(item); - } - - @Override - protected void onClear() { - dispatchMgr.removeAll(); - } - - @Override - public void synchronize(SyncItem<M, T> from, SyncItem<M, T> to, Notification message) { - EditPart fromEditPart = from.getBackend(); - EditPart toEditPart = to.getBackend(); - - // retrieve the sizes - Dimension sizeFrom = getSize(fromEditPart); - Dimension sizeTo = getSize(toEditPart); - - if (!sizeFrom.equals(sizeTo)) { - // compute the reaction command - Command reaction = GMFtoEMFCommandWrapper.wrap(new SetBoundsCommand(getEditingDomain(), "Synchronize Node Size", toEditPart, sizeFrom)); - - // dispatch the reaction - if (message == null) { - // this is an initial sync request - execute(reaction); - } else { - // this is reaction to a change - Dispatcher dispatcher = dispatchMgr.getDispatcher(from, message.getFeature()); - if (dispatcher != null) { - dispatcher.react(reaction); - } - } - } - } - - Dimension getSize(EditPart editPart) { - Dimension result = null; - - Node node = (Node) editPart.getModel(); - Size size = TypeUtils.as(node.getLayoutConstraint(), Size.class); - if ((size != null) && (size.getWidth() >= 0) && (size.getHeight() >= 0)) { - // Nice. We have non-default (non-computed) size - result = new Dimension(size.getWidth(), size.getHeight()); - } - - if (result == null) { - // Need to get the actual dimensions from the edit-part's figure - IFigure figure = ((GraphicalEditPart) editPart).getFigure(); - result = figure.getBounds().getSize(); - } - - return result; - } - - public static <M extends EObject, T extends EditPart> NotationSyncPolicyDelegate<M, T> createPolicyDelegate() { - return new NotationSyncPolicyDelegate<M, T>(NotationPackage.Literals.SIZE.getName()) { - - @Override - protected EMFDispatch createDispatcher(SyncItem<M, T> syncTarget) { - return new NodeSizeSyncDispatcher<M, T>(syncTarget) { - @Override - public void onClear() { - // Nothing to do do - } - - @Override - protected void onFilteredChange(Notification notification) { - overrideOccurred(this, getItem()); - } - }; - } - }; - } -} +/*****************************************************************************
+ * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 465416
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.sync;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Size;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.sync.EMFDispatch;
+import org.eclipse.papyrus.infra.sync.EMFDispatchManager;
+import org.eclipse.papyrus.infra.sync.SyncBucket;
+import org.eclipse.papyrus.infra.sync.SyncFeature;
+import org.eclipse.papyrus.infra.sync.SyncItem;
+import org.eclipse.papyrus.infra.tools.util.TypeUtils;
+
+/**
+ * Represents a synchronization feature for the position of GMF notation nodes
+ *
+ * @author Laurent Wouters
+ *
+ * @param <M>
+ * The type of the underlying model element common to all synchronized items in a single bucket
+ * @param <T>
+ * The type of the backend element to synchronize
+ */
+public class NodeSizeSyncFeature<M extends EObject, T extends EditPart> extends SyncFeature<M, T, Notification> {
+ /**
+ * Represents a dispatcher for this feature
+ *
+ * @author Laurent Wouters
+ */
+ private class Dispatcher extends NodeSizeSyncDispatcher<M, T> {
+ public Dispatcher(SyncItem<M, T> item) {
+ super(item);
+ }
+
+ @Override
+ public void onClear() {
+ // clears the parent bucket
+ getBucket().clear();
+ }
+
+ @Override
+ protected void onFilteredChange(Notification notification) {
+ NodeSizeSyncFeature.this.onChange(item, notification);
+ }
+ }
+
+ /**
+ * The active dispatchers
+ */
+ private EMFDispatchManager<Dispatcher> dispatchMgr = createSingleDispatchManager();
+
+ /**
+ * Initialized this feature
+ *
+ * @param bucket
+ * The bucket doing the synchronization
+ */
+ public NodeSizeSyncFeature(SyncBucket<M, T, Notification> bucket) {
+ super(bucket);
+ }
+
+ @Override
+ public void observe(SyncItem<M, T> item) {
+ dispatchMgr.add(item, new Dispatcher(item));
+ }
+
+ @Override
+ public void unobserve(SyncItem<M, T> item) {
+ dispatchMgr.remove(item);
+ }
+
+ @Override
+ protected void onClear() {
+ dispatchMgr.removeAll();
+ }
+
+ @Override
+ public void synchronize(SyncItem<M, T> from, SyncItem<M, T> to, Notification message) {
+ EditPart fromEditPart = from.getBackend();
+ EditPart toEditPart = to.getBackend();
+
+ // retrieve the sizes
+ Dimension sizeFrom = getSize(fromEditPart);
+ Dimension sizeTo = getSize(toEditPart);
+
+ if (!sizeFrom.equals(sizeTo)) {
+ // compute the reaction command
+ Command reaction = GMFtoEMFCommandWrapper.wrap(new SetBoundsCommand(getEditingDomain(), "Synchronize Node Size", toEditPart, sizeFrom));
+
+ // dispatch the reaction
+ if (message == null) {
+ // this is an initial sync request
+ execute(reaction);
+ } else {
+ // this is reaction to a change
+ Dispatcher dispatcher = dispatchMgr.getDispatcher(from, message.getFeature());
+ if (dispatcher != null) {
+ dispatcher.react(reaction);
+ }
+ }
+ }
+ }
+
+ Dimension getSize(EditPart editPart) {
+ Dimension result = null;
+
+ Node node = (Node) editPart.getModel();
+ Size size = TypeUtils.as(node.getLayoutConstraint(), Size.class);
+ if ((size != null) && (size.getWidth() >= 0) && (size.getHeight() >= 0)) {
+ // Nice. We have non-default (non-computed) size
+ result = new Dimension(size.getWidth(), size.getHeight());
+ }
+
+ if (result == null) {
+ // Need to get the actual dimensions from the edit-part's figure
+ IFigure figure = ((GraphicalEditPart) editPart).getFigure();
+ result = figure.getBounds().getSize();
+ }
+
+ return result;
+ }
+
+ public static <M extends EObject, T extends EditPart> NotationSyncPolicyDelegate<M, T> createPolicyDelegate() {
+ return new NotationSyncPolicyDelegate<M, T>(NotationPackage.Literals.SIZE.getName()) {
+
+ @Override
+ protected EMFDispatch createDispatcher(SyncItem<M, T> syncTarget) {
+ return new NodeSizeSyncDispatcher<M, T>(syncTarget) {
+ @Override
+ public void onClear() {
+ // Nothing to do do
+ }
+
+ @Override
+ protected void onFilteredChange(Notification notification) {
+ overrideOccurred(this, getItem());
+ }
+ };
+ }
+ };
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafe.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafe.java deleted file mode 100644 index 5838683d503..00000000000 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafe.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2014, 2016 CEA, Christian W. Damus, and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus (CEA) - Initial API and implementation - * Christian W. Damus - bug 485220 - * - */ -package org.eclipse.papyrus.infra.gmfdiag.common.utils; - -import java.util.Collection; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.transaction.RollbackException; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.ICommand; - - -/** - * Utilities for operations in the GMF context that we might consider as "unsafe" or exceptional cases. - * - * @deprecated use the {@link org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe} API, instead. - */ -@Deprecated -public class GMFUnsafe { - - /** - * Not instantiable by clients. - */ - private GMFUnsafe() { - super(); - } - - /** - * Performs an unsafe write to the model. The editing domain may or may not already have an active transaction, which may or may not be read-only; - * it does not matter. In any case, the changes performed will not be recorded for undo/redo or roll-back. Thus, this is appropriate only for use - * cases such as synchronization of canonical views, which are not considered logically as abstract model edits (though they be concrete changes). - * - * @param domain - * an editing domain that may or may not have a transaction in progress - * @param writeOperation - * an operation that will make unchecked/unsafe changes to the editing {@code domain} - * - * @throws RollbackException - * if the unprotected write transaction fails to commit. Note that this could occlude an uncaught exception thrown by the {@code writeOperation} runnable - * @throws InterruptedException - * if the current thread is interrupted while waiting for the unprotected write transaction to start - */ - public static void write(TransactionalEditingDomain domain, Runnable writeOperation) throws InterruptedException, RollbackException { - org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe.write(domain, writeOperation); - } - - /** - * Executes an unsafe command on the model. The editing domain may or may not already have an active transaction, which may or may not be - * read-only; it does not matter. In any case, the changes performed will not be recorded for undo/redo or roll-back. Thus, this is appropriate - * only for use cases such as synchronization of canonical views, which are not considered logically as abstract model edits (though they be - * concrete changes). - * - * @param domain - * an editing domain that may or may not have a transaction in progress - * @param command - * a command that will make unchecked/unsafe changes to the editing {@code domain} - * - * @throws RollbackException - * if the unprotected write transaction fails to commit. Note that this could occlude an uncaught exception thrown by the {@code writeOperation} runnable - * @throws InterruptedException - * if the current thread is interrupted while waiting for the unprotected write transaction to start - * - * @see #write(TransactionalEditingDomain, Runnable) - */ - public static void write(TransactionalEditingDomain domain, Command command) throws InterruptedException, RollbackException { - org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe.write(domain, command); - } - - /** - * Executes an unsafe command on the model. The editing domain may or may not already have an active transaction, which may or may not be - * read-only; it does not matter. In any case, the changes performed will not be recorded for undo/redo or roll-back. Thus, this is appropriate - * only for use cases such as synchronization of canonical views, which are not considered logically as abstract model edits (though they be - * concrete changes). - * - * @param domain - * an editing domain that may or may not have a transaction in progress - * @param command - * a command that will make unchecked/unsafe changes to the editing {@code domain} - * - * @throws RollbackException - * if the unprotected write transaction fails to commit. Note that this could occlude an uncaught exception thrown by the {@code writeOperation} runnable - * @throws InterruptedException - * if the current thread is interrupted while waiting for the unprotected write transaction to start - * @throws ExecutionException - * if the {@code command} fails to execute - * - * @see #write(TransactionalEditingDomain, Runnable) - */ - public static void write(TransactionalEditingDomain domain, ICommand command) throws InterruptedException, RollbackException, ExecutionException { - org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe.write(domain, command); - } - - /** - * Wraps a command for unprotected execution, undo, and redo on the command stack. - * - * @param domain - * a transactional editing domain on which the {@code command} operates - * @param command - * a command to wrap - * @return the wrapped command - */ - public static Command wrap(TransactionalEditingDomain domain, Command command) { - return new UnsafeCommandWrapper(domain, command); - } - - // - // Nested types - // - - /** - * A useful base class for commands that need to execute, undo, and redo in unprotected mode on the command stack. - * - * @deprecated Use the {@link org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe.UnsafeCommand} API, instead. - */ - @Deprecated - public static abstract class UnsafeCommand extends org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe.UnsafeCommand { - - protected UnsafeCommand(TransactionalEditingDomain domain) { - super(domain); - } - - protected UnsafeCommand(TransactionalEditingDomain domain, String label, String description) { - super(domain, label, description); - } - - protected UnsafeCommand(TransactionalEditingDomain domain, String label) { - super(domain, label); - } - } - - private static class UnsafeCommandWrapper extends UnsafeCommand { - - private final Command command; - - UnsafeCommandWrapper(TransactionalEditingDomain domain, Command command) { - super(domain, command.getLabel(), command.getDescription()); - - this.command = command; - } - - @Override - public void dispose() { - command.dispose(); - } - - @Override - public boolean canExecute() { - return command.canExecute(); - } - - @Override - protected void doExecute() { - command.execute(); - } - - @Override - public boolean canUndo() { - return command.canUndo(); - } - - @Override - protected void doUndo() { - command.undo(); - } - - @Override - protected void doRedo() { - command.redo(); - } - - @Override - public Collection<?> getAffectedObjects() { - return command.getAffectedObjects(); - } - - @Override - public Collection<?> getResult() { - return command.getResult(); - } - - @Override - public String toString() { - return String.format("Unsafe(%s)", command.toString()); //$NON-NLS-1$ - } - } - -} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.controlmode/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.controlmode/META-INF/MANIFEST.MF index 36b6bc60272..e648180ed87 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.controlmode/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.controlmode/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.papyrus.infra.services.controlmode;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/META-INF/MANIFEST.MF index 64b3aa36216..2edbd19ba1b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.gmfdiag.dnd.policy, org.eclipse.papyrus.infra.gmfdiag.dnd.strategy -Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", +Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/preferences/DropStrategyEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/preferences/DropStrategyEditor.java index 826c4ea2ed4..cb7c9f5868a 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/preferences/DropStrategyEditor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/preferences/DropStrategyEditor.java @@ -119,16 +119,22 @@ public class DropStrategyEditor extends MultipleReferenceEditor { if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Boolean isActive = findIsActive(structuredSelection);
-
- Iterator<?> iterator = structuredSelection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (element instanceof DropStrategy) {
- DropStrategy strategy = (DropStrategy) element;
- Button button = checkboxes.get(strategy);
-
- updateStrategy(strategy, button, isActive);
+ Activation isActive = findIsActive(structuredSelection);
+
+ if (isActive != Activation.UNDEFINED) {
+ Iterator<?> iterator = structuredSelection.iterator();
+ while (iterator.hasNext()) {
+ Object element = iterator.next();
+ if (element instanceof DropStrategy) {
+ DropStrategy strategy = (DropStrategy) element;
+ Button button = checkboxes.get(strategy);
+
+ if (isActive != Activation.TRUE) {
+ updateStrategy(strategy, button, true);
+ } else {
+ updateStrategy(strategy, button, false);
+ }
+ }
}
}
@@ -143,18 +149,26 @@ public class DropStrategyEditor extends MultipleReferenceEditor { });
}
+ private enum Activation {
+ TRUE, FALSE, UNDEFINED
+ }
+
// Returns the new status of the first DropStrategy in the selection.
// Returns null if the selection doesn't contain any DropStrategy
- private Boolean findIsActive(IStructuredSelection selection) {
+ private Activation findIsActive(IStructuredSelection selection) {
Iterator<?> iterator = selection.iterator();
while (iterator.hasNext()) {
Object element = iterator.next();
if (element instanceof DropStrategy) {
boolean isActive = DropStrategyManager.instance.isActive((DropStrategy) element); // Current status
- return !isActive; // New status (Toggle)
+ if (isActive) {
+ return Activation.FALSE;
+ } else {
+ return Activation.TRUE;
+ }
}
}
- return null; // No DropStrategy found in the selection
+ return Activation.UNDEFINED; // No DropStrategy found in the selection
}
private void updateStrategy(DropStrategy strategy, Button button, boolean isActive) {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/ExpansionElementDropStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/ExpansionElementDropStrategy.java index 79dcc714a75..9a13f98cfff 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/ExpansionElementDropStrategy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/ExpansionElementDropStrategy.java @@ -1,217 +1,217 @@ -/***************************************************************************** - * Copyright (c) 2015 CEA LIST. - * - * 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: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.dnd.strategy; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.diagram.core.services.ViewService; -import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; -import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation; -import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton; -import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry; -import org.eclipse.papyrus.infra.gmfdiag.common.expansionmodel.AbstractRepresentation; -import org.eclipse.papyrus.infra.gmfdiag.common.expansionmodel.Representation; -import org.eclipse.papyrus.infra.gmfdiag.dnd.Activator; -import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; -import org.eclipse.swt.graphics.Image; - -/** - * This strategy has been added in order allow dropping new element done by using expansion model - * See Requirement #org.eclipse.papyrus.infra.gmfdiag.expansion.Req_020 - * - */ -public class ExpansionElementDropStrategy extends TransactionalDropStrategy { - - private DiagramExpansionsRegistry diagramExpansionRegistry; - - /** - * Constructor. - * - */ - public ExpansionElementDropStrategy() { - this.diagramExpansionRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry(); - } - - public String getLabel() { - return "Expansion element drag and drop"; - } - - public String getID() { - return "org.eclipse.papyrus.infra.gmfdiag.dnd.expansiondropsteategy"; - } - - public String getDescription() { - return "This strategy is used to allow dropping of expansion of elements in extended diagrams."; - } - - public Image getImage() { - return null; - } - - public int getPriority() { - return 0; - } - - public void setOptions(Map<String, Object> options) { - // Nothing - } - - /** - * get the diagram type from a view. - * - * @param currentView - * the current view - * @return the diagram type it can be also a view point - */ - protected String getDiagramType(View currentView) { - Diagram diagram = currentView.getDiagram(); - String currentDiagramType = null; - ViewPrototype viewPrototype = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram); - if (viewPrototype != null) { - currentDiagramType = viewPrototype.getLabel(); - } else { - currentDiagramType = diagram.getType(); - } - return currentDiagramType; - } - - @Override - public Command doGetCommand(Request request, final EditPart targetEditPart) { - - CompositeCommand cc = new CompositeCommand(getLabel()); - if (targetEditPart instanceof GraphicalEditPart) { - IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) targetEditPart; - String diagramType = getDiagramType(graphicalEditPart.getNotationView()); - ChildrenListRepresentation listRepresentation = diagramExpansionRegistry.mapChildreen.get(diagramType); - // to the current diagram, a expansion is added. - if (listRepresentation == null) { - return null; - } - // look for all possible children for the current target. - List<String> childrenList = null; - if (graphicalEditPart instanceof DiagramEditPart) { - childrenList = listRepresentation.parentChildrenRelation.get(diagramType); - } else { - childrenList = listRepresentation.parentChildrenRelation.get(graphicalEditPart.getNotationView().getType()); - } - - if (childrenList == null) { - return null; - } - List<EObject> sourceElements = getSourceEObjects(request); - if (sourceElements.size() == 0) { - return null; - } - final List<EObject> valuesToAdd = new ArrayList<EObject>(sourceElements.size()); - // getList of accepted ElementType - final ArrayList<ISpecializationType> acceptedElementTypes = new ArrayList<ISpecializationType>(); - - - for (String posibleID : childrenList) { - AbstractRepresentation abstractRepresentation = listRepresentation.IDMap.get(posibleID); - if (abstractRepresentation instanceof Representation) { - String elementTypeID = ((Representation) abstractRepresentation).getGraphicalElementType(); - if (elementTypeID != null && elementTypeID != "") { - final IElementType elementType = ElementTypeRegistry.getInstance().getType(elementTypeID); - if (elementType instanceof ISpecializationType) { - acceptedElementTypes.add((ISpecializationType) elementType); - } - } - } - } - Activator.log.trace(Activator.EXPANSION_TRACE, "try to drop " + sourceElements + " inside " + graphicalEditPart.getNotationView().getType() + " accepts " + childrenList); - // get the sub list of accepted source element that match to elementType - for (EObject sourceElement : sourceElements) { - // the source element must be a children of the container - if (sourceElement.eContainer() == graphicalEditPart.resolveSemanticElement()) { - Command cmd = null; - int acceptedElementTypesIndex = 0; - while (cmd == null && acceptedElementTypesIndex < acceptedElementTypes.size()) { - final ISpecializationType iSpecializationType = acceptedElementTypes.get(acceptedElementTypesIndex); - IElementMatcher matcher = iSpecializationType.getMatcher(); - IElementType[] superElementTypes = iSpecializationType.getSpecializedTypes(); - if (matcher == null) { - int index = superElementTypes.length - 1; - while (matcher == null && index > 0) { - if (superElementTypes[index] instanceof ISpecializationType) { - matcher = ((ISpecializationType) superElementTypes[index]).getMatcher(); - } - index--; - } - } - if (matcher != null && matcher.matches(sourceElement)) { - cmd = addCommandDrop(targetEditPart, cc, valuesToAdd, sourceElement, iSpecializationType); - } else if (matcher == null) { - EClass eclass = iSpecializationType.getEClass(); - if (eclass.isSuperTypeOf(sourceElement.eClass())) { - cmd = addCommandDrop(targetEditPart, cc, valuesToAdd, sourceElement, iSpecializationType); - } else { - acceptedElementTypesIndex++; - } - } else { - acceptedElementTypesIndex++; - } - - } - - } - } - } - - return cc.canExecute() ? new ICommandProxy(cc.reduce()) : null; - } - - protected Command addCommandDrop(final EditPart targetEditPart, CompositeCommand cc, final List<EObject> valuesToAdd, EObject sourceElement, final ISpecializationType iSpecializationType) { - - valuesToAdd.add(sourceElement); - Activator.log.trace(Activator.EXPANSION_TRACE, "try to drop command created for " + sourceElement + " " + iSpecializationType); - Command cmd = new Command() { - @Override - public void execute() { - if (iSpecializationType instanceof IHintedType) { - ViewService.createNode(((GraphicalEditPart) targetEditPart).getNotationView(), valuesToAdd.get(0), ((IHintedType) iSpecializationType).getSemanticHint(), ((GraphicalEditPart) targetEditPart).getDiagramPreferencesHint()); - } - } - - }; - cc.add(new CommandProxy(cmd)); - return cmd; - } - - - public String getCategoryID() { - return "org.eclipse.papyrus.infra.gmfdiag.dnd.expansiondropsteategy"; - } - - public String getCategoryLabel() { - return "Expansion element drag and drop"; - } -} +/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.dnd.strategy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansionmodel.AbstractRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansionmodel.Representation;
+import org.eclipse.papyrus.infra.gmfdiag.dnd.Activator;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This strategy has been added in order allow dropping new element done by using expansion model
+ * See Requirement #org.eclipse.papyrus.infra.gmfdiag.expansion.Req_020
+ *
+ */
+public class ExpansionElementDropStrategy extends TransactionalDropStrategy {
+
+ private DiagramExpansionsRegistry diagramExpansionRegistry;
+
+ /**
+ * Constructor.
+ *
+ */
+ public ExpansionElementDropStrategy() {
+ this.diagramExpansionRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ }
+
+ public String getLabel() {
+ return "Expansion element drag and drop";
+ }
+
+ public String getID() {
+ return "org.eclipse.papyrus.infra.gmfdiag.dnd.expansiondropsteategy";
+ }
+
+ public String getDescription() {
+ return "This strategy is used to allow dropping of expansion of elements in extended diagrams.";
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public int getPriority() {
+ return 0;
+ }
+
+ public void setOptions(Map<String, Object> options) {
+ // Nothing
+ }
+
+ /**
+ * get the diagram type from a view.
+ *
+ * @param currentView
+ * the current view
+ * @return the diagram type it can be also a view point
+ */
+ protected String getDiagramType(View currentView) {
+ Diagram diagram = currentView.getDiagram();
+ String currentDiagramType = null;
+ ViewPrototype viewPrototype = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram);
+ if (viewPrototype != null) {
+ currentDiagramType = viewPrototype.getLabel();
+ } else {
+ currentDiagramType = diagram.getType();
+ }
+ return currentDiagramType;
+ }
+
+ @Override
+ public Command doGetCommand(Request request, final EditPart targetEditPart) {
+
+ CompositeCommand cc = new CompositeCommand(getLabel());
+ if (targetEditPart instanceof GraphicalEditPart) {
+ IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) targetEditPart;
+ String diagramType = getDiagramType(graphicalEditPart.getNotationView());
+ ChildrenListRepresentation listRepresentation = diagramExpansionRegistry.mapChildreen.get(diagramType);
+ // to the current diagram, a expansion is added.
+ if (listRepresentation == null) {
+ return null;
+ }
+ // look for all possible children for the current target.
+ List<String> childrenList = null;
+ if (graphicalEditPart instanceof DiagramEditPart) {
+ childrenList = listRepresentation.parentChildrenRelation.get(diagramType);
+ } else {
+ childrenList = listRepresentation.parentChildrenRelation.get(graphicalEditPart.getNotationView().getType());
+ }
+
+ if (childrenList == null) {
+ return null;
+ }
+ List<EObject> sourceElements = getSourceEObjects(request);
+ if (sourceElements.size() == 0) {
+ return null;
+ }
+ final List<EObject> valuesToAdd = new ArrayList<EObject>(sourceElements.size());
+ // getList of accepted ElementType
+ final ArrayList<ISpecializationType> acceptedElementTypes = new ArrayList<ISpecializationType>();
+
+
+ for (String posibleID : childrenList) {
+ AbstractRepresentation abstractRepresentation = listRepresentation.IDMap.get(posibleID);
+ if (abstractRepresentation instanceof Representation) {
+ String elementTypeID = ((Representation) abstractRepresentation).getGraphicalElementType();
+ if (elementTypeID != null && !elementTypeID.isEmpty()) {
+ final IElementType elementType = ElementTypeRegistry.getInstance().getType(elementTypeID);
+ if (elementType instanceof ISpecializationType) {
+ acceptedElementTypes.add((ISpecializationType) elementType);
+ }
+ }
+ }
+ }
+ Activator.log.trace(Activator.EXPANSION_TRACE, "try to drop " + sourceElements + " inside " + graphicalEditPart.getNotationView().getType() + " accepts " + childrenList);
+ // get the sub list of accepted source element that match to elementType
+ for (EObject sourceElement : sourceElements) {
+ // the source element must be a children of the container
+ if (sourceElement.eContainer() == graphicalEditPart.resolveSemanticElement()) {
+ Command cmd = null;
+ int acceptedElementTypesIndex = 0;
+ while (cmd == null && acceptedElementTypesIndex < acceptedElementTypes.size()) {
+ final ISpecializationType iSpecializationType = acceptedElementTypes.get(acceptedElementTypesIndex);
+ IElementMatcher matcher = iSpecializationType.getMatcher();
+ IElementType[] superElementTypes = iSpecializationType.getSpecializedTypes();
+ if (matcher == null) {
+ int index = superElementTypes.length - 1;
+ while (matcher == null && index > 0) {
+ if (superElementTypes[index] instanceof ISpecializationType) {
+ matcher = ((ISpecializationType) superElementTypes[index]).getMatcher();
+ }
+ index--;
+ }
+ }
+ if (matcher != null && matcher.matches(sourceElement)) {
+ cmd = addCommandDrop(targetEditPart, cc, valuesToAdd, sourceElement, iSpecializationType);
+ } else if (matcher == null) {
+ EClass eclass = iSpecializationType.getEClass();
+ if (eclass.isSuperTypeOf(sourceElement.eClass())) {
+ cmd = addCommandDrop(targetEditPart, cc, valuesToAdd, sourceElement, iSpecializationType);
+ } else {
+ acceptedElementTypesIndex++;
+ }
+ } else {
+ acceptedElementTypesIndex++;
+ }
+
+ }
+
+ }
+ }
+ }
+
+ return cc.canExecute() ? new ICommandProxy(cc.reduce()) : null;
+ }
+
+ protected Command addCommandDrop(final EditPart targetEditPart, CompositeCommand cc, final List<EObject> valuesToAdd, EObject sourceElement, final ISpecializationType iSpecializationType) {
+
+ valuesToAdd.add(sourceElement);
+ Activator.log.trace(Activator.EXPANSION_TRACE, "try to drop command created for " + sourceElement + " " + iSpecializationType);
+ Command cmd = new Command() {
+ @Override
+ public void execute() {
+ if (iSpecializationType instanceof IHintedType) {
+ ViewService.createNode(((GraphicalEditPart) targetEditPart).getNotationView(), valuesToAdd.get(0), ((IHintedType) iSpecializationType).getSemanticHint(), ((GraphicalEditPart) targetEditPart).getDiagramPreferencesHint());
+ }
+ }
+
+ };
+ cc.add(new CommandProxy(cmd));
+ return cmd;
+ }
+
+
+ public String getCategoryID() {
+ return "org.eclipse.papyrus.infra.gmfdiag.dnd.expansiondropsteategy";
+ }
+
+ public String getCategoryLabel() {
+ return "Expansion element drag and drop";
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF index 81b81099c9a..8b2ea8f5430 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF @@ -7,12 +7,12 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.export, org.eclipse.papyrus.infra.gmfdiag.export.utils, org.eclipse.papyrus.infra.gmfdiag.export.wizard Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.services.validation;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.services.semantic;bundle-version="[1.2.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.export.Activator diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml index a06e4b6f4f1..f7f953048b2 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.export</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.export</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/Activator.java index 53d61a348f9..ea6720645e3 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/Activator.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/Activator.java @@ -1,151 +1,67 @@ -/******************************************************************************* - * Copyright (c) 2005 Anyware Technologies - * 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: - * David Sciamma (Anyware Technologies) - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.infra.gmfdiag.export; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.infra.core.log.LogHelper; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.gmfdiag.export"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - public static LogHelper log; - - /** - * The constructor - */ - public Activator() { - plugin = this; - } - - /** - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - log = new LogHelper(this); - } - - /** - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns the active workbench shell - * - * @return the active workbench shell - */ - public static Shell getActiveWorkbenchShell() { - IWorkbenchWindow workBenchWindow = getActiveWorkbenchWindow(); - if (workBenchWindow == null) { - return null; - } - return workBenchWindow.getShell(); - } - - /** - * Returns the active workbench page or <code>null</code> if none. - * - * @return the active workbench page - */ - public static IWorkbenchPage getActivePage() { - IWorkbenchWindow window = getActiveWorkbenchWindow(); - if (window != null) { - return window.getActivePage(); - } - return null; - } - - /** - * Returns the active workbench window - * - * @return the active workbench window - */ - public static IWorkbenchWindow getActiveWorkbenchWindow() { - if (getDefault() == null) { - return null; - } - IWorkbench workBench = getDefault().getWorkbench(); - if (workBench == null) { - return null; - } - return workBench.getActiveWorkbenchWindow(); - } - - /** - * Display a dialog box with the specified level - * - * @param title - * title dialog box - * @param message - * message displayed - * @param level - * message level - */ - public static void displayDialog(final String title, final String message, final int level) { - if (level == IStatus.INFO) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - MessageDialog.openInformation(getActiveWorkbenchShell(), (title == null) ? "Information" : title, (message == null) ? "" : message); - } - }); - } else if (level == IStatus.WARNING) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - MessageDialog.openWarning(getActiveWorkbenchShell(), (title == null) ? "Warning" : title, (message == null) ? "" : message); - } - }); - } else if (level == IStatus.ERROR) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - MessageDialog.openError(getActiveWorkbenchShell(), (title == null) ? "Error" : title, (message == null) ? "" : message); - } - }); - } - } -} +/*******************************************************************************
+ * Copyright (c) 2005 Anyware Technologies
+ * 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:
+ * David Sciamma (Anyware Technologies) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.export;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.gmfdiag.export"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ log = null;
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/DialogDisplayUtils.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/DialogDisplayUtils.java new file mode 100644 index 00000000000..aedce33140b --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/DialogDisplayUtils.java @@ -0,0 +1,104 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.gmfdiag.export; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; + +public class DialogDisplayUtils { + /** + * Returns the active workbench shell + * + * @return the active workbench shell + */ + public static Shell getActiveWorkbenchShell() { + IWorkbenchWindow workBenchWindow = getActiveWorkbenchWindow(); + if (workBenchWindow == null) { + return null; + } + return workBenchWindow.getShell(); + } + + /** + * Returns the active workbench page or <code>null</code> if none. + * + * @return the active workbench page + */ + public static IWorkbenchPage getActivePage() { + IWorkbenchWindow window = getActiveWorkbenchWindow(); + if (window != null) { + return window.getActivePage(); + } + return null; + } + + /** + * Returns the active workbench window + * + * @return the active workbench window + */ + public static IWorkbenchWindow getActiveWorkbenchWindow() { + if (Activator.getDefault() == null) { + return null; + } + IWorkbench workBench = Activator.getDefault().getWorkbench(); + if (workBench == null) { + return null; + } + return workBench.getActiveWorkbenchWindow(); + } + + /** + * Display a dialog box with the specified level + * + * @param title + * title dialog box + * @param message + * message displayed + * @param level + * message level + */ + public static void displayDialog(final String title, final String message, final int level) { + if (level == IStatus.INFO) { + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + MessageDialog.openInformation(getActiveWorkbenchShell(), (title == null) ? "Information" : title, (message == null) ? "" : message); + } + }); + } else if (level == IStatus.WARNING) { + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + MessageDialog.openWarning(getActiveWorkbenchShell(), (title == null) ? "Warning" : title, (message == null) ? "" : message); + } + }); + } else if (level == IStatus.ERROR) { + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + MessageDialog.openError(getActiveWorkbenchShell(), (title == null) ? "Error" : title, (message == null) ? "" : message); + } + }); + } + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java index 727a6bb4b97..af901b2b516 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java @@ -27,7 +27,7 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ResourceUtils; -import org.eclipse.papyrus.infra.gmfdiag.export.Activator; +import org.eclipse.papyrus.infra.gmfdiag.export.DialogDisplayUtils; import org.eclipse.papyrus.infra.gmfdiag.export.engine.ExportAllDiagramsEngine; import org.eclipse.papyrus.infra.gmfdiag.export.utils.SelectionHelper; import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForSelection; @@ -117,7 +117,7 @@ public class ExportAllDiagramsAction extends AbstractHandler { } - ExportAllDiagramsDialog exportPopup = new ExportAllDiagramsDialog(Activator.getActiveWorkbenchShell(), uriFile); + ExportAllDiagramsDialog exportPopup = new ExportAllDiagramsDialog(DialogDisplayUtils.getActiveWorkbenchShell(), uriFile); if (exportPopup.open() == Window.OK) { // Complete export configuration diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java index 8a3e8168257..f58f4591de4 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java @@ -20,6 +20,7 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.gmf.runtime.diagram.ui.image.ImageFileFormat; import org.eclipse.jface.window.Window; import org.eclipse.papyrus.infra.gmfdiag.export.Activator; +import org.eclipse.papyrus.infra.gmfdiag.export.DialogDisplayUtils; import org.eclipse.papyrus.infra.gmfdiag.export.messages.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -42,7 +43,7 @@ public class ExportComposite extends Composite { private Text outputPathTxt; private Button outputDirectoryBtn; - + private Combo outputFormatCb; private Button btnCheckButton; @@ -128,7 +129,7 @@ public class ExportComposite extends Composite { @Override public void widgetSelected(SelectionEvent e) { - ContainerSelectionDialog csDialog = new ContainerSelectionDialog(Activator.getActiveWorkbenchShell(), ResourcesPlugin.getWorkspace().getRoot(), true, Messages.ExportAllDiagramsDialog_3); + ContainerSelectionDialog csDialog = new ContainerSelectionDialog(DialogDisplayUtils.getActiveWorkbenchShell(), ResourcesPlugin.getWorkspace().getRoot(), true, Messages.ExportAllDiagramsDialog_3); if (csDialog.open() == Window.OK) { @@ -178,7 +179,7 @@ public class ExportComposite extends Composite { Activator.log.error(e); } } - if(outputDirectory ==null) { + if (outputDirectory == null) { Activator.log.error("Impossible to find the output directory", null); return; } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/engine/ExportAllDiagramsEngine.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/engine/ExportAllDiagramsEngine.java index a2299d6fb42..00e6e602cdb 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/engine/ExportAllDiagramsEngine.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/engine/ExportAllDiagramsEngine.java @@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.gmfdiag.css.service.CssMarkerEventManagerService; import org.eclipse.papyrus.infra.gmfdiag.css.service.MarkerToPseudoSelectorMappingService; import org.eclipse.papyrus.infra.gmfdiag.export.Activator; +import org.eclipse.papyrus.infra.gmfdiag.export.DialogDisplayUtils; import org.eclipse.papyrus.infra.gmfdiag.export.actions.ExportAllDiagramsParameter; import org.eclipse.papyrus.infra.gmfdiag.export.messages.Messages; import org.eclipse.papyrus.infra.services.decoration.DecorationService; @@ -465,9 +466,9 @@ public class ExportAllDiagramsEngine { @Override public void run() { if (diagnostic.getSeverity() == Diagnostic.OK) { - MessageDialog.openInformation(Activator.getActiveWorkbenchShell(), Messages.ExportAllDiagrams_25, Messages.ExportAllDiagrams_26 + exportParameter.getOutputDirectoryPath()); + MessageDialog.openInformation(DialogDisplayUtils.getActiveWorkbenchShell(), Messages.ExportAllDiagrams_25, Messages.ExportAllDiagrams_26 + exportParameter.getOutputDirectoryPath()); } else { - DiagnosticDialog.open(Activator.getActiveWorkbenchShell(), Messages.ExportAllDiagrams_27, "", diagnostic); //$NON-NLS-1$ + DiagnosticDialog.open(DialogDisplayUtils.getActiveWorkbenchShell(), Messages.ExportAllDiagrams_27, "", diagnostic); //$NON-NLS-1$ } } }); diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java index 0bf0faa0795..8a3af3115b6 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java @@ -118,19 +118,26 @@ public class ExportAllWizard extends Wizard implements IExportWizard { if (file != null) { IContainer parentResource = file.getParent(); parentResource = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(parentResource.getLocation()); - uriFile = URI.createPlatformResourceURI(parentResource.getLocation().toString(), true); - - } - - if (parameter == null) { - pageError = new ExportDiagramsErrorPage(); - addPage(pageError); + if (parentResource != null) { + uriFile = URI.createPlatformResourceURI(parentResource.getLocation().toString(), true); + + if (parameter == null) { + addErrorPage(); + } else { + page = new ExportDiagramsPage(uriFile); + addPage(page); + } + } else { + addErrorPage(); + } } else { - page = new ExportDiagramsPage(uriFile); - addPage(page); + addErrorPage(); } + } - + private void addErrorPage() { + pageError = new ExportDiagramsErrorPage(); + addPage(pageError); } /** diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/META-INF/MANIFEST.MF index 7d1b7a75d07..521be1b2c0e 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gef/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.gmfdiag.gef.internal;x-internal:=true, org.eclipse.papyrus.infra.gmfdiag.gef.internal.editor;x-internal:=true Require-Bundle: org.eclipse.gef;bundle-version="[3.11.0,4.0.0)", - org.eclipse.papyrus.infra.ui;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gmfmenu.filter/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gmfmenu.filter/META-INF/MANIFEST.MF index 2cee761f7be..24b12fac28c 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gmfmenu.filter/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.gmfmenu.filter/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.7.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)" Export-Package: org.eclipse.papyrus.infra.gmfdiag.gmfmenu.filter Bundle-Vendor: %Bundle-Vendor Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF index 1dde2f12f9c..6e7e082e88d 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF @@ -1,8 +1,8 @@ Manifest-Version: 1.0 -Require-Bundle: org.eclipse.papyrus.infra.hyperlink;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[2.0.0,3.0.0)", +Require-Bundle: org.eclipse.papyrus.infra.hyperlink;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="[1.2.0,2.0.0)" Export-Package: org.eclipse.papyrus.infra.gmfdiag.hyperlink, org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies, @@ -11,7 +11,7 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.hyperlink, org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 3.0.0.qualifier Bundle-Name: GMF Diagram Hyperlink Bundle-ManifestVersion: 2 Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/pom.xml index 7cc1de4a243..e18c96032eb 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.hyperlink</artifactId> - <version>2.0.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.hyperlink</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java index 72e40231f41..cfc4ccd495d 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java @@ -16,7 +16,6 @@ package org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -47,7 +46,6 @@ import org.eclipse.papyrus.infra.emf.gmf.util.CommandUtils; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart; import org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator; -import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigableElement; import org.eclipse.papyrus.infra.gmfdiag.navigation.preference.INavigationPreferenceConstant; import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkHelper; import org.eclipse.papyrus.infra.hyperlink.helper.HyperLinkHelperFactory; @@ -111,8 +109,6 @@ public class NavigationEditPolicy extends OpenEditPolicy { // defaultHyperlinks final ArrayList<HyperLinkObject> defaultHyperLinkObject = new ArrayList<HyperLinkObject>(); final ArrayList<HyperLinkObject> hyperLinkObjectList; - // Diagrams that will be found by using heuristic - HashMap<NavigableElement, List<Diagram>> existingDiagrams = new HashMap<NavigableElement, List<Diagram>>(); if (semanticElement == null) { return UnexecutableCommand.INSTANCE; diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/META-INF/MANIFEST.MF index 5490a46d2cf..2f8e868d68c 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 -Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", +Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)", - org.eclipse.papyrus.infra.emf.readonly;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.emf.readonly;bundle-version="[3.0.0,4.0.0)" Export-Package: org.eclipse.papyrus.infra.gmfdiag.menu, org.eclipse.papyrus.infra.gmfdiag.menu.handlers, org.eclipse.papyrus.infra.gmfdiag.menu.utils diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF index ed6b314cd4a..60578c27e04 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF @@ -1,9 +1,9 @@ Manifest-Version: 1.0 -Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", +Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.views.modelexplorer;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java index 9f6e58a705e..c8b292288bb 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java @@ -32,6 +32,7 @@ import org.eclipse.jface.window.Window; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.gmfdiag.modelexplorer.messages.Messages; import org.eclipse.papyrus.views.modelexplorer.DirectEditorEditingSupport; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.swt.widgets.Display; /** @@ -69,7 +70,7 @@ public class RenameDiagramHandler extends AbstractDiagramCommandHandler { } } }; - return new org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper(cmd); + return new GMFtoEMFCommandWrapper(cmd); } } return UnexecutableCommand.INSTANCE; diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF index dcf26dc0f4a..38d7348e08b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF @@ -1,11 +1,11 @@ Manifest-Version: 1.0 -Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", +Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)", org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.services.navigation;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.services.openelement;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.services.navigation;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.services.openelement;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.services.viewersearch;bundle-version="[2.0.0,3.0.0)";visibility:=reexport Export-Package: org.eclipse.papyrus.infra.gmfdiag.navigation, org.eclipse.papyrus.infra.gmfdiag.navigation.decorator, @@ -16,7 +16,7 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.navigation, org.eclipse.papyrus.infra.gmfdiag.navigation.menu.button Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Name: %pluginName Bundle-Localization: plugin Bundle-ManifestVersion: 2 diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/pom.xml index 5e5c8ce62f2..434b09bfb27 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.navigation</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.navigation</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/menu/DefaultNavigationMenu.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/menu/DefaultNavigationMenu.java index 5686a217f81..26f840a10e3 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/menu/DefaultNavigationMenu.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/menu/DefaultNavigationMenu.java @@ -30,9 +30,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.gmfdiag.navigation.Activator; -import org.eclipse.papyrus.infra.gmfdiag.navigation.menu.button.MoreButton; import org.eclipse.papyrus.infra.gmfdiag.navigation.menu.listener.NavigationMenuKeyListener; -import org.eclipse.papyrus.infra.gmfdiag.navigation.menu.listener.SelectionMenuMouseTrackListener; import org.eclipse.papyrus.infra.gmfdiag.navigation.menu.listener.SelectionMenuSelectionChangedListener; import org.eclipse.papyrus.infra.gmfdiag.navigation.menu.provider.SelectionMenuLabelProvider; import org.eclipse.papyrus.infra.services.navigation.service.ExtendedNavigableElement; @@ -56,7 +54,7 @@ public class DefaultNavigationMenu implements NavigationMenu { private Shell parentShell; private NavigationService navigationService; - + private ViewerSearchService viewerSearchService; private EObject currentModel; @@ -72,9 +70,9 @@ public class DefaultNavigationMenu implements NavigationMenu { private boolean wasUnderlined; private WrappingLabel lastWrappingLabel; - - private static boolean altReleasedPostNavigation = true; - + + private boolean altReleasedPostNavigation = true; + private View selectedView; public class NavigationMenuInitializationException extends Exception { @@ -280,13 +278,13 @@ public class DefaultNavigationMenu implements NavigationMenu { if (navigationMenuElements.isEmpty()) { return; } - + // Add "More..." button - //navigationMenuElements.add(new MoreButton()); - + // navigationMenuElements.add(new MoreButton()); + // The semantic element EObject umlElement = EMFHelper.getEObject(source); - + // Create the selection menu and subMenus list selectionMenu = new SelectionMenu(shell); subMenus = new LinkedList<SelectionMenu>(); @@ -313,7 +311,7 @@ public class DefaultNavigationMenu implements NavigationMenu { selectionMenu.addSelectionChangedListener(new SelectionMenuSelectionChangedListener(DefaultNavigationMenu.this, selectionMenu, navigationMenuElements, umlElement, subMenus)); selectionMenu.addKeyListener(new NavigationMenuKeyListener(this)); - //selectionMenu.addMouseTrackListener(new SelectionMenuMouseTrackListener(DefaultNavigationMenu.this, selectionMenu, subMenus, umlElement)); + // selectionMenu.addMouseTrackListener(new SelectionMenuMouseTrackListener(DefaultNavigationMenu.this, selectionMenu, subMenus, umlElement)); } public void addContextualMenus(List<Object> navigationMenuElements, Object umlElement) { @@ -330,22 +328,22 @@ public class DefaultNavigationMenu implements NavigationMenu { if (navElement == null) { return null; } - + EObject element = null; if (navElement instanceof ExtendedNavigableElement && ((ExtendedNavigableElement) navElement).getSemanticElement() instanceof EObject) { element = (EObject) ((ExtendedNavigableElement) navElement).getSemanticElement(); } - + if (element != null) { ViewerSearchService viewerSearchService = null; - + try { viewerSearchService = getViewerSearchService(); } catch (NavigationMenuInitializationException e) { Activator.log.error(e); } - + if (viewerSearchService != null) { return viewerSearchService.getViewersInCurrentModel(element, null, false, onlyOpened); } @@ -353,13 +351,13 @@ public class DefaultNavigationMenu implements NavigationMenu { return new LinkedList<Object>(); } - + public void showInModelExplorer(NavigableElement navigableElement) { Object semanticElement = null; if (navigableElement instanceof ExtendedNavigableElement) { semanticElement = ((ExtendedNavigableElement) navigableElement).getSemanticElement(); } - + if (semanticElement != null) { try { getNavigationService().navigate(semanticElement, "org.eclipse.papyrus.views.modelexplorer.navigation.target"); @@ -402,21 +400,21 @@ public class DefaultNavigationMenu implements NavigationMenu { return servicesRegistry; } - private NavigationService getNavigationService() throws NavigationMenuInitializationException { + private NavigationService getNavigationService() throws NavigationMenuInitializationException { if (navigationService == null) { throw new NavigationMenuInitializationException(navigationService); } return navigationService; } - - public ViewerSearchService getViewerSearchService() throws NavigationMenuInitializationException { + + public ViewerSearchService getViewerSearchService() throws NavigationMenuInitializationException { if (viewerSearchService == null) { throw new NavigationMenuInitializationException(viewerSearchService); } return viewerSearchService; } - private Shell getParentShell() throws NavigationMenuInitializationException { + private Shell getParentShell() throws NavigationMenuInitializationException { if (parentShell == null) { throw new NavigationMenuInitializationException(parentShell); } @@ -566,7 +564,7 @@ public class DefaultNavigationMenu implements NavigationMenu { Activator.log.error(e); } } - + public View getSelectedView() { return selectedView; } @@ -579,8 +577,8 @@ public class DefaultNavigationMenu implements NavigationMenu { public void setParentShell(Shell parentShell) { this.parentShell = parentShell; } - + public void altReleased() { - this.altReleasedPostNavigation = true; + altReleasedPostNavigation = true; } }
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF index cd05cedb8b9..e6edf305583 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.outline, org.eclipse.papyrus.infra.gmfdiag.outline.overview Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 2.0.0.qualifier diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF index c412a7859eb..589e1300acb 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF @@ -10,12 +10,12 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.preferences, org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor, org.eclipse.papyrus.infra.gmfdiag.preferences.utils Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="[1.7.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", com.ibm.icu, - org.eclipse.papyrus.infra.ui;bundle-version="[1.2.0,2.0.0)";visibility:=reexport + org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 3.0.0.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.preferences.Activator diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/pom.xml index 2dc30f36794..efa81d6d836 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.preferences</artifactId> - <version>2.0.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.preferences</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java index 086bab5f0de..9a9899e1537 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java @@ -14,10 +14,10 @@ package org.eclipse.papyrus.infra.gmfdiag.preferences.pages; import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
+import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Layout;
/**
@@ -35,7 +35,6 @@ import org.eclipse.swt.widgets.Layout; */
public abstract class AbstractPapyrusElementPreferencePage extends AbstractPapyrusPreferencePage {
- private Group toolbar;
protected Layout getToolbarLayout() {
return new GridLayout(2, false);
@@ -56,13 +55,10 @@ public abstract class AbstractPapyrusElementPreferencePage extends AbstractPapyr @Override
protected void createPageContents(Composite parent) {
FontGroup fontGroupComposite = new FontGroup(parent, getPreferenceKey(), this);
- addAbstractGroup(fontGroupComposite);
+ addPreferenceGroup(fontGroupComposite);
}
- protected Group getToolbar() {
- return toolbar;
- }
/**
* Get the specified preference type associated with this preference page.
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusLinkPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusLinkPreferencePage.java index 4c9ca6718a0..63b30461c20 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusLinkPreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusLinkPreferencePage.java @@ -44,16 +44,16 @@ public abstract class AbstractPapyrusLinkPreferencePage extends AbstractPapyrusE super.createPageContents(parent);
// color pref for links
LinkColorGroup colorGroupComposite = new LinkColorGroup(parent, getPreferenceKey(), this);
- addAbstractGroup(colorGroupComposite);
+ addPreferenceGroup(colorGroupComposite);
// router for links
ConnectionGroup connectionGroupComposite = new ConnectionGroup(parent, getPreferenceKey(), this);
- addAbstractGroup(connectionGroupComposite);
+ addPreferenceGroup(connectionGroupComposite);
// Label role group
if (!getLabelRole().isEmpty()) {
LabelGroup compartmentGroup = new LabelGroup(parent, getPreferenceKey(), this, getLabelRole());
- addAbstractGroup(compartmentGroup);
+ addPreferenceGroup(compartmentGroup);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusNodePreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusNodePreferencePage.java index f63b3761991..cd9f19f0ca6 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusNodePreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusNodePreferencePage.java @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.List;
import java.util.TreeMap;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LabelGroup;
@@ -57,20 +58,20 @@ public abstract class AbstractPapyrusNodePreferencePage extends AbstractPapyrusE protected void createPageContents(Composite parent) {
super.createPageContents(parent);
NodeColorGroup colorGroupForNodeComposite = new NodeColorGroup(parent, getPreferenceKey(), this);
- addAbstractGroup(colorGroupForNodeComposite);
+ addPreferenceGroup(colorGroupForNodeComposite);
BackgroundColor backgroundColorGroup = new BackgroundColor(parent, getPreferenceKey(), this);
- addAbstractGroup(backgroundColorGroup);
+ addPreferenceGroup(backgroundColorGroup);
DecorationGroup decorationGroup = new DecorationGroup(parent, getPreferenceKey(), this);
- addAbstractGroup(decorationGroup);
+ addPreferenceGroup(decorationGroup);
if (!compartmentsList.isEmpty()) {
- NodeCompartmentGroup compartmentGroup = new NodeCompartmentGroup(parent, getPreferenceKey(), this, compartmentsList, getCompartmentTitleVisibilityPreferences().keySet(), getPreferenceStore());
- addAbstractGroup(compartmentGroup);
+ NodeCompartmentGroup compartmentGroup = new NodeCompartmentGroup(parent, getPreferenceKey(), this, compartmentsList, getCompartmentTitleVisibilityPreferences().keySet(), Activator.getDefault().getPreferenceStore());
+ addPreferenceGroup(compartmentGroup);
}
// Label role group
if (!getLabelRole().isEmpty()) {
LabelGroup compartmentGroup = new LabelGroup(parent, getPreferenceKey(), this, getLabelRole());
- addAbstractGroup(compartmentGroup);
+ addPreferenceGroup(compartmentGroup);
}
}
@@ -84,7 +85,7 @@ public abstract class AbstractPapyrusNodePreferencePage extends AbstractPapyrusE /**
*
* @return
- * the label roles
+ * the label roles
*/
protected TreeMap<String, String> getLabelRole() {
return new TreeMap<String, String>();
@@ -93,7 +94,7 @@ public abstract class AbstractPapyrusNodePreferencePage extends AbstractPapyrusE /**
*
* @return
- * the compartment title visibility
+ * the compartment title visibility
*/
protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
return new TreeMap<String, Boolean>();
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusPreferencePage.java deleted file mode 100644 index f4083f0579e..00000000000 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusPreferencePage.java +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** - * Copyright (c) 2008 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: - * Thibault Landre (Atos Origin) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.preferences.pages; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator; -import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup; - -/** - * An abstract implementation of a Preference page. - * - * This preference page allows clients to define preference page in the preference of Eclipse, and - * in the properties of a project in the workspace. - * <p> - * Clients must implement : - * <ul> - * <li><code>getBundleId()</code> method in order to define the preference scope (Project or Instance) of the preference page.</li> - * <li><code>createPageContents()</code> method to populate the preference page with the different {@link AbstractGroup}. </br> - * Each group added has to be declared through the <code>addAbstractGroup(AbstractGroup fe)</code> method</li> - * </ul> - * </p> - * - * @deprecated Use the {@link org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage} API, instead. - */ -@Deprecated -public abstract class AbstractPapyrusPreferencePage extends org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage { - - @Override - public IPreferenceStore getPreferenceStore() { - return Activator.getDefault().getPreferenceStore(); - } - - /** - * Add the given {@code group} of field editors to the page. - */ - protected void addAbstractGroup(AbstractGroup fe) { - addPreferenceGroup(fe); - } -} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java index ac34173993b..4021a412d9e 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java @@ -38,6 +38,7 @@ import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorFontGroup; import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorNodeColorGroup; import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorRulersAndGridGroup; import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter; +import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -56,31 +57,31 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP // FontGroup FontGroup fontGroupComposite = new EditorFontGroup(contentGroup, getTitle(), this); - addAbstractGroup(fontGroupComposite); + addPreferenceGroup(fontGroupComposite); // color NodeColorGroup colorGroupForNodeComposite = new EditorNodeColorGroup(contentGroup, getTitle(), this); - addAbstractGroup(colorGroupForNodeComposite); + addPreferenceGroup(colorGroupForNodeComposite); // router for links ConnectionGroup connectionGroupComposite = new EditorConnectionGroup(contentGroup, getTitle(), this); - addAbstractGroup(connectionGroupComposite); + addPreferenceGroup(connectionGroupComposite); // background BackgroundColor backgroundColorGroup = new EditorBackgroundColor(contentGroup, getTitle(), this); - addAbstractGroup(backgroundColorGroup); + addPreferenceGroup(backgroundColorGroup); DecorationGroup decorationGroupComposite = new EditorDecorationGroup(contentGroup, getTitle(), this); - addAbstractGroup(decorationGroupComposite); + addPreferenceGroup(decorationGroupComposite); DimensionGroup dimensionGroup = new EditorDimensionGroup(contentGroup, getTitle(), this); - addAbstractGroup(dimensionGroup); + addPreferenceGroup(dimensionGroup); RulersAndGridGroup viewGroupComposite = new EditorRulersAndGridGroup(parent, getTitle(), this); - addAbstractGroup(viewGroupComposite); + addPreferenceGroup(viewGroupComposite); final RestoreElementGroup restoreElementGroup = new RestoreElementGroup(parent, getTitle(), this); - addAbstractGroup(restoreElementGroup); + addPreferenceGroup(restoreElementGroup); } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusUML2PreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusUML2PreferencePage.java index 8f176dfe3cc..cb8c5ee4ff6 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusUML2PreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusUML2PreferencePage.java @@ -14,7 +14,7 @@ package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusPreferencePage;
+import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage;
import org.eclipse.swt.widgets.Composite;
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/VisiblePageSingleton.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/VisiblePageSingleton.java index 8c131f5c7de..0143e9aa9bd 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/VisiblePageSingleton.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/VisiblePageSingleton.java @@ -14,8 +14,8 @@ package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal; import org.eclipse.jface.preference.IPreferencePage; -import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusPreferencePage; import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage; +import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage; /** * This singleton has bee created to manage the button ok and apply of preference page. diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java index 2a308726297..e7a84af5460 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java @@ -75,7 +75,7 @@ public class LabelGroup extends AbstractGroup { String key = PreferencesConstantsHelper.getLabelElementConstant(getKey(), role, PreferencesConstantsHelper.LABEL_VISIBILITY);
Image im = null;
String iconPath = myRoles.get(role);
- if (iconPath != null && iconPath != "") { //$NON-NLS-1$
+ if (iconPath != null && !iconPath.isEmpty()) { // $NON-NLS-1$
try {
im = ImageDescriptor.createFromURL(new URL(iconPath)).createImage();
} catch (MalformedURLException e) {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java index 8327041b728..67f13097fa3 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java @@ -24,11 +24,6 @@ import org.eclipse.swt.widgets.Composite; */
public class NodeColorGroup extends LinkColorGroup {
- /** The font color editor. */
- protected ColorFieldEditor fontColorEditor;
-
- /** The line color editor. */
- protected ColorFieldEditor lineColorEditor;
/** The fill color editor. */
protected ColorFieldEditor fillColorEditor;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java index f8d211f7801..466788328d0 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java @@ -95,7 +95,7 @@ public class OrderedLabelGroup extends AbstractGroup { String key = PreferencesConstantsHelper.getLabelElementConstant(getKey(), role, PreferencesConstantsHelper.LABEL_VISIBILITY);
Image im = null;
String iconPath = myRoles.get(role);
- if (iconPath != null && iconPath != "") { //$NON-NLS-1$
+ if (iconPath != null && !iconPath.isEmpty()) { // $NON-NLS-1$
try {
im = ImageDescriptor.createFromURL(new URL(iconPath)).createImage();
} catch (MalformedURLException e) {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF index 1f13d1954fa..219350da220 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF @@ -1,13 +1,13 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.gmfdiag.properties.extension, org.eclipse.papyrus.infra.gmfdiag.properties.modelelement -Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[1.3.0,2.0.0)";visibility:=reexport, +Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.core.databinding.beans;bundle-version="[1.3.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="[2.0.0,3.0.0)" Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.papyrus.infra.gmfdiag.properties.constraint" -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 3.0.0.qualifier Bundle-Localization: plugin Bundle-Name: %Bundle-Name Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.properties.Activator diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/pom.xml index 608d34faf06..5e35cba73b1 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/pom.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.infra.gmfdiag.properties</artifactId> - <version>2.0.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> +<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.properties</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/CanonicalObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/CanonicalObservableValue.java index 8d105b60478..11e6fa0625d 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/CanonicalObservableValue.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/CanonicalObservableValue.java @@ -21,7 +21,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.EditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.notation.CanonicalStyle; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.gmfdiag.canonical.editpolicy.CanonicalStateListener; import org.eclipse.papyrus.infra.gmfdiag.common.commands.SetCanonicalCommand; import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper; diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF index e4fadf4e5f5..5bf9dfe020a 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF @@ -1,8 +1,8 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.papyrus.infra.services.viewersearch;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.views.search;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.views.search;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)" Bundle-Vendor: %vendorName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.welcome/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.welcome/META-INF/MANIFEST.MF index 9d86b081795..c03af419703 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.welcome/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.welcome/META-INF/MANIFEST.MF @@ -3,10 +3,10 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.welcome.internal;x-internal:=t org.eclipse.papyrus.infra.gmfdiag.welcome.internal.modelelements;x-internal:=true, org.eclipse.papyrus.infra.gmfdiag.welcome.internal.widgets;x-internal:=true Require-Bundle: org.eclipse.papyrus.infra.editor.welcome;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.services.navigation;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.services.navigation;bundle-version="[3.0.0,4.0.0)", org.eclipse.jface.databinding;bundle-version="[1.8.0,2.0.0)", - org.eclipse.papyrus.infra.editor.welcome.nattable;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.editor.welcome.nattable;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,3.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.welcome/src/org/eclipse/papyrus/infra/gmfdiag/welcome/internal/modelelements/NotationObservableProperty.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.welcome/src/org/eclipse/papyrus/infra/gmfdiag/welcome/internal/modelelements/NotationObservableProperty.java index 17a94ecb16f..c34a3ce1e47 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.welcome/src/org/eclipse/papyrus/infra/gmfdiag/welcome/internal/modelelements/NotationObservableProperty.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.welcome/src/org/eclipse/papyrus/infra/gmfdiag/welcome/internal/modelelements/NotationObservableProperty.java @@ -144,8 +144,12 @@ public class NotationObservableProperty implements Supplier<IObservableList<Nota if (rset instanceof ModelSet) { result = ((ModelSet) rset).isUserModelResource(resource.getURI()); } else { - URI uri = resource.getURI(); - result = uri.isPlatformResource() || uri.isFile(); + if (resource != null) { + URI uri = resource.getURI(); + result = uri.isPlatformResource() || uri.isFile(); + } else { + result = false; + } } return result; diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.widgets/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.widgets/META-INF/MANIFEST.MF index cef74806ec2..bcc21ca45c6 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.widgets/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.widgets/META-INF/MANIFEST.MF @@ -1,13 +1,13 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.ui;bundle-version="[3.107.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)", - org.eclipse.papyrus.infra.widgets;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)", org.eclipse.gmf.runtime.diagram.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="[1.7.0,2.0.0)", org.eclipse.core.databinding;bundle-version="[1.4.0,2.0.0)", org.eclipse.jface.databinding;bundle-version="[1.5.0,2.0.0)", org.eclipse.core.databinding.property;bundle-version="[1.4.0,2.0.0)", - org.eclipse.papyrus.infra.properties.ui;bundle-version="[1.3.0,2.0.0)", + org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)", org.eclipse.e4.ui.css.core;bundle-version="[0.11.0,1.0.0)" Export-Package: org.eclipse.papyrus.infra.gmfdiag.widgets, org.eclipse.papyrus.infra.gmfdiag.widgets.editors |