initial commit
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.classpath b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.project b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.project
new file mode 100644
index 0000000..a0d8989
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.refactor.refactorings.papyrus.uml24</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f287d53
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/META-INF/MANIFEST.MF b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..291cf65
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: RefactoringsPapyrusUML24
+Bundle-SymbolicName: org.eclipse.emf.refactor.refactorings.papyrus.uml24;singleton:=true
+Bundle-Version: 0.7.0
+Bundle-Activator: org.eclipse.emf.refactor.refactorings.papyrus.uml24.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.refactor.refactoring,
+ org.eclipse.emf.refactor.refactoring.runtime;bundle-version="0.8.0",
+ org.eclipse.emf.refactor.refactoring.papyrus;bundle-version="0.8.0",
+ org.eclipse.ltk.core.refactoring;bundle-version="3.6.0",
+ org.eclipse.ltk.ui.refactoring;bundle-version="3.7.0",
+ org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
+ org.eclipse.emf.ecore;bundle-version="2.8.3",
+ org.eclipse.uml2.uml;bundle-version="4.0.2",
+ org.eclipse.emf.refactor.refactorings.uml24;bundle-version="0.7.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/papyrus/uml24/Activator.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/papyrus/uml24/Activator.class
new file mode 100644
index 0000000..e16f636
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/papyrus/uml24/Activator.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/papyrus/uml24/UmlUtils.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/papyrus/uml24/UmlUtils.class
new file mode 100644
index 0000000..577a7c3
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/papyrus/uml24/UmlUtils.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController$1.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController$1.class
new file mode 100644
index 0000000..2e87ae0
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController$1.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController$InternalRefactoringProcessor.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController$InternalRefactoringProcessor.class
new file mode 100644
index 0000000..707dc05
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController$InternalRefactoringProcessor.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController.class
new file mode 100644
index 0000000..79eab18
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringDataManagement.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringDataManagement.class
new file mode 100644
index 0000000..8b70165
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringDataManagement.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringGuiHandler.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringGuiHandler.class
new file mode 100644
index 0000000..4cce466
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringGuiHandler.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizard.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizard.class
new file mode 100644
index 0000000..f6f4305
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizard.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizardPage.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizardPage.class
new file mode 100644
index 0000000..6f6318b
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizardPage.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController$1.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController$1.class
new file mode 100644
index 0000000..aae4b0f
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController$1.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController$InternalRefactoringProcessor.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController$InternalRefactoringProcessor.class
new file mode 100644
index 0000000..78297d0
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController$InternalRefactoringProcessor.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController.class
new file mode 100644
index 0000000..c1f7760
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringDataManagement.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringDataManagement.class
new file mode 100644
index 0000000..b7b789a
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringDataManagement.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringGuiHandler.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringGuiHandler.class
new file mode 100644
index 0000000..bd8f976
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringGuiHandler.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizard.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizard.class
new file mode 100644
index 0000000..9ebd519
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizard.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizardPage.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizardPage.class
new file mode 100644
index 0000000..c09efad
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizardPage.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController$1.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController$1.class
new file mode 100644
index 0000000..4418c5c
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController$1.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController$InternalRefactoringProcessor.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController$InternalRefactoringProcessor.class
new file mode 100644
index 0000000..fdb1c13
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController$InternalRefactoringProcessor.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController.class
new file mode 100644
index 0000000..487272b
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringDataManagement.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringDataManagement.class
new file mode 100644
index 0000000..df578c1
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringDataManagement.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringGuiHandler.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringGuiHandler.class
new file mode 100644
index 0000000..400e1b6
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringGuiHandler.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizard.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizard.class
new file mode 100644
index 0000000..63316cd
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizard.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizardPage.class b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizardPage.class
new file mode 100644
index 0000000..8571b89
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizardPage.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/build.properties b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/plugin.xml b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/plugin.xml
new file mode 100644
index 0000000..e7c74c4
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/plugin.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.emf.refactor.refactorings">
+ <refactoring
+ controller="org.eclipse.emf.refactor.refactorings.uml24.pullupattribute.RefactoringController"
+ gui="org.eclipse.emf.refactor.refactorings.uml24.pullupattribute.RefactoringGuiHandler"
+ id="org.eclipse.emf.refactor.refactorings.uml24.pullupattribute"
+ menulabel="Pull Up Attribute"
+ namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML">
+ </refactoring>
+ <refactoring
+ controller="org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute.RefactoringController"
+ gui="org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute.RefactoringGuiHandler"
+ id="org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute"
+ menulabel="Push Down Attribute"
+ namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML">
+ </refactoring>
+ <refactoring
+ controller="org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass.RefactoringController"
+ gui="org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass.RefactoringGuiHandler"
+ id="org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass"
+ menulabel="Remove Empty Superclass"
+ namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML">
+ </refactoring>
+ </extension>
+</plugin>
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/papyrus/uml24/Activator.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/papyrus/uml24/Activator.java
new file mode 100644
index 0000000..1454f5a
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/papyrus/uml24/Activator.java
@@ -0,0 +1,50 @@
+package org.eclipse.emf.refactor.refactorings.papyrus.uml24;
+
+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.emf.refactor.refactorings.papyrus.uml24"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ 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;
+ }
+
+}
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/papyrus/uml24/UmlUtils.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/papyrus/uml24/UmlUtils.java
new file mode 100644
index 0000000..ec3745d
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/papyrus/uml24/UmlUtils.java
@@ -0,0 +1,854 @@
+package org.eclipse.emf.refactor.refactorings.papyrus.uml24;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.Usage;
+import org.eclipse.uml2.uml.VisibilityKind;
+
+public abstract class UmlUtils {
+
+ public static boolean haveSameSignatures(Operation op1, Operation op2) { // 23
+ EList<Parameter> inputParametersOp1 = getInputParameterList(op1.getOwnedParameters());
+ EList<Parameter> inputParametersOp2 = getInputParameterList(op2.getOwnedParameters());
+ if (inputParametersOp1.size() != inputParametersOp2.size()) return false;
+ for (int i=0; i < inputParametersOp1.size(); i++) {
+ Parameter par1 = inputParametersOp1.get(i);
+ Parameter par2 = inputParametersOp2.get(i);
+ if (! (haveSameNames(par1, par2)
+ && haveSameTypes(par1, par2)
+ && haveSameDirections(par1, par2)
+ && haveSameMultiplicities(par1, par2))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean haveSameMultiplicities(Parameter par1, Parameter par2) { // 3
+ if (par1.getLower() != par2.getLower()) return false;
+ if (par1.getUpper() != par2.getUpper()) return false;
+ return true;
+ }
+
+ private static boolean haveSameDirections(Parameter par1, Parameter par2) { // 1
+ return par1.getDirection().equals(par2.getDirection());
+ }
+
+ private static boolean haveSameTypes(Parameter par1, Parameter par2) { // 4
+ if (par1.getType() == null && par2.getType() == null) return true;
+ if (par1.getType() == null && par2.getType() != null) return false;
+ if (par1.getType() != null && par2.getType() == null) return false;
+ return (par1.getType().equals(par2.getType()));
+ }
+
+ private static boolean haveSameNames(Parameter par1, Parameter par2) { // 1
+ return par1.getName().equals(par2.getName());
+ }
+
+ public static EList<Parameter> getInputParameterList( // 5
+ EList<Parameter> parameters) {
+ EList<Parameter> inputParameterList = new BasicEList<Parameter>();
+ for (Parameter param : parameters) {
+ if (param.getDirection().getValue() != ParameterDirectionKind.RETURN) {
+ inputParameterList.add(param);
+ }
+ }
+ return inputParameterList;
+ }
+
+ public static boolean haveSameTypes(Operation op1, Operation op2) { // 4
+ if (op1.getType() == null && op2.getType() == null) return true;
+ if (op1.getType() == null && op2.getType() != null) return false;
+ if (op1.getType() != null && op2.getType() == null) return false;
+ return (op1.getType().equals(op2.getType()));
+ }
+
+ public static boolean hasAttributes(Class cl) { // 1
+ return (! cl.getOwnedAttributes().isEmpty());
+ }
+
+ public static boolean hasOperations(Class cl) { // 1
+ return (! cl.getOwnedOperations().isEmpty());
+ }
+
+ public static boolean hasSuperclasses(Class cl) { // 1
+ return (! cl.getSuperClasses().isEmpty());
+ }
+
+ public static boolean hasInnerClasses(Class cl) { // 1
+ return (! cl.getNestedClassifiers().isEmpty());
+ }
+
+ public static boolean hasOutgoingAssociations(Class cl) { // 13
+ ArrayList<Association> associations = getAllAssociations(cl.getModel());
+ for (Association association : associations) {
+ for (Property associationEnd : association.getMemberEnds()) {
+ if (associationEnd.getType().equals(cl) && (! associationEnd.isNavigable()))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static ArrayList<Association> getAllAssociations(Model model) { // 7
+ ArrayList<Association> associations = new ArrayList<Association>();
+ TreeIterator<EObject> iter = model.eResource().getAllContents();
+ while (iter.hasNext()) {
+ EObject eObject = iter.next();
+ if (eObject instanceof Association) {
+ associations.add((Association) eObject);
+ }
+ }
+ return associations;
+ }
+
+ public static boolean hasIncomingAssociations(Class cl) { // 13
+ ArrayList<Association> associations = getAllAssociations(cl.getModel());
+ for (Association association : associations) {
+ for (Property associationEnd : association.getMemberEnds()) {
+ if (associationEnd.getType().equals(cl) && associationEnd.isNavigable())
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean implementsInterfaces(Class cl) { // 1
+ return (! cl.getInterfaceRealizations().isEmpty());
+ }
+
+ public static boolean usesInterfaces(Class cl) { // 14
+ ArrayList<Usage> usages = getAllUsages(cl.getModel());
+ for (Usage usage : usages) {
+ if (usage.getClients().contains(cl)) {
+ EList<NamedElement> suppliers = usage.getSuppliers();
+ for (NamedElement supplier : suppliers) {
+ if (supplier instanceof Interface) return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static ArrayList<Usage> getAllUsages(Model model) { // 7
+ ArrayList<Usage> usages = new ArrayList<Usage>();
+ TreeIterator<EObject> iter = model.eResource().getAllContents();
+ while (iter.hasNext()) {
+ EObject eObject = iter.next();
+ if (eObject instanceof Usage) {
+ usages.add((Usage) eObject);
+ }
+ }
+ return usages;
+ }
+
+ public static boolean isUsedAsAttributeType(Class cl) { // 12
+ ArrayList<Property> attributes = getAllAttributes(cl.getModel());
+ for (Property attribute : attributes) {
+ if (attribute.getType() != null
+ && attribute.getType().equals(cl)) return true;
+ }
+ return false;
+ }
+
+ private static ArrayList<Property> getAllAttributes(Model model) { // 8
+ ArrayList<Property> attributes = new ArrayList<Property>();
+ TreeIterator<EObject> iter = model.eResource().getAllContents();
+ while (iter.hasNext()) {
+ EObject eObject = iter.next();
+ if (eObject instanceof Property) {
+ Property attribute = (Property) eObject;
+ if (attribute.getClass_() != null) attributes.add(attribute);
+ }
+ }
+ return attributes;
+ }
+
+ public static boolean isUsedAsParameterType(Class cl) { // 11
+ ArrayList<Parameter> parameters = getAllParameters(cl.getModel());
+ for (Parameter parameter : parameters) {
+ if (parameter.getType() != null
+ && parameter.getType().equals(cl)) return true;
+ }
+ return false;
+ }
+
+ private static ArrayList<Parameter> getAllParameters(Model model) { // 7
+ ArrayList<Parameter> parameters = new ArrayList<Parameter>();
+ TreeIterator<EObject> iter = model.eResource().getAllContents();
+ while (iter.hasNext()) {
+ EObject eObject = iter.next();
+ if (eObject instanceof Parameter) {
+ parameters.add((Parameter) eObject);
+ }
+ }
+ return parameters;
+ }
+
+ public static EList<Type> getTypes(Model model) { // 11
+ EList<Type> types = new BasicEList<Type>();
+ TreeIterator<EObject> iter = model.eResource().getAllContents();
+ while (iter.hasNext()) {
+ EObject eObject = iter.next();
+ if ((eObject instanceof Type)
+ && !(eObject instanceof Association)) {
+ types.add((Type) eObject);
+ }
+ }
+ EList<PackageableElement> importedElements = model.getImportedMembers();
+ for (PackageableElement elem : importedElements) {
+ if ((elem instanceof Type)
+ && !(elem instanceof Association)) {
+ types.add((Type) elem);
+ }
+ }
+ return types;
+ }
+
+ public static EList<NamedElement> getNamedElementsFromList( // 4
+ EList<Type> types, String name) {
+ EList<NamedElement> namedElements = new BasicEList<NamedElement>();
+ for (Type ne : types) {
+ if (ne.getName().equals(name)) namedElements.add(ne);
+ }
+ return namedElements;
+ }
+
+ public static boolean hasSubclasses(Class cl) { // 11
+ ArrayList<Class> classes = getAllClasses(cl.getModel());
+ for (Class cls : classes) {
+ if (cls.getSuperClasses().contains(cl)) return true;
+ }
+ return false;
+ }
+
+ public static ArrayList<Class> getAllClasses(Model model) { // 7
+ ArrayList<Class> classes = new ArrayList<Class>();
+ TreeIterator<EObject> iter = model.eResource().getAllContents();
+ while (iter.hasNext()) {
+ EObject eObject = iter.next();
+ if (eObject instanceof Class) {
+ classes.add((Class) eObject);
+ }
+ }
+ return classes;
+ }
+
+ private static Collection<? extends Class> getOtherAssociationEndsTypeClasses( // 6
+ Property assocend) {
+ ArrayList<Class> classes = new ArrayList<Class>();
+ Association assoc = assocend.getAssociation();
+ for (Property ae : assoc.getMemberEnds()) {
+ if ((! ae.equals(assocend))
+ && (! ae.getType().equals(assocend.getType()))) {
+ classes.add((Class) ae.getType());
+ }
+ }
+ return classes;
+ }
+
+ public static List<Class> getOne2OneAssociatedClasses(Class cl) { // 59
+ ArrayList<Class> result = new ArrayList<Class>();
+ ArrayList<Association> incomingAssociations =
+ getIncomingAssociations(cl);
+ ArrayList<Association> outgoingAssociations =
+ getOutgoingAssociations(cl);
+ ArrayList<Class> classesFromIncomingAssociations =
+ getOtherClassesFromAssociations(cl, incomingAssociations);
+ ArrayList<Class> classesFromOutgoingAssociations =
+ getOtherClassesFromAssociations(cl, outgoingAssociations);
+ ArrayList<Class> associatedClasses = new ArrayList<Class>();
+ for (Class associatedClass : classesFromIncomingAssociations) {
+ if (classesFromOutgoingAssociations.contains(associatedClass))
+ associatedClasses.add(associatedClass);
+ }
+ for (Class associatedClass : associatedClasses) {
+ if (incomingAssociationHasOne2OneMultiplicityAndIsPublic
+ (cl, incomingAssociations, associatedClass)
+ && outgoingAssociationHasOne2OneMultiplicityAndIsPublic
+ (cl, outgoingAssociations, associatedClass)){
+ result.add(associatedClass);
+ }
+ }
+ return result;
+ }
+
+ private static boolean outgoingAssociationHasOne2OneMultiplicityAndIsPublic( // 8
+ Class cl,
+ ArrayList<Association> outgoingAssociations,
+ Class associatedClass) {
+ for (Association assoc : outgoingAssociations) {
+ for (Property ae1 : assoc.getMemberEnds()) {
+ if (ae1.getType().equals(cl)) {
+ for (Property ae2 : assoc.getMemberEnds()) {
+ if (ae2.getType().equals(associatedClass)) {
+ if ((ae2.getLower() == 1)
+ && (ae2.getUpper() == 1)
+ && (ae2.getVisibility().equals(VisibilityKind.PUBLIC_LITERAL)))
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private static boolean incomingAssociationHasOne2OneMultiplicityAndIsPublic( // 8
+ Class cl,
+ ArrayList<Association> incomingAssociations,
+ Class associatedClass) {
+ for (Association assoc : incomingAssociations) {
+ for (Property ae1 : assoc.getMemberEnds()) {
+ if (ae1.getType().equals(cl)) {
+ for (Property ae2 : assoc.getMemberEnds()) {
+ if (ae2.getType().equals(associatedClass)) {
+ if ((ae1.getLower() == 1)
+ && (ae1.getUpper() == 1)
+ && (ae2.getVisibility().equals(VisibilityKind.PUBLIC_LITERAL)))
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private static ArrayList<Class> getOtherClassesFromAssociations( // 8
+ Class cl, ArrayList<Association> incomingAssociations) {
+ ArrayList<Class> result = new ArrayList<Class>();
+ for (Association assoc : incomingAssociations) {
+ for (Property associationEnd1 : assoc.getMemberEnds()) {
+ if (associationEnd1.getType().equals(cl)){
+ for (Property associationEnd2 : assoc.getMemberEnds()) {
+ if ((! associationEnd1.equals(associationEnd2))
+ && associationEnd2.getType() instanceof Class
+ && (! associationEnd2.getType().equals(cl))) {
+ result.add((Class) associationEnd2.getType());
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ private static ArrayList<Association> getOutgoingAssociations(Class cl) { // 16
+ ArrayList<Association> associations = getAllAssociations(cl.getModel());
+ ArrayList<Association> result = new ArrayList<Association>();
+ for (Association association : associations) {
+ for (Property associationEnd1 : association.getMemberEnds()) {
+ if (associationEnd1.getType().equals(cl)){
+ for (Property associationEnd2 : association.getMemberEnds()) {
+ if ((! associationEnd1.equals(associationEnd2))
+ && associationEnd2.isNavigable()) {
+ result.add(association);
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ private static ArrayList<Association> getIncomingAssociations(Class cl) { // 14
+ ArrayList<Association> associations = getAllAssociations(cl.getModel());
+ ArrayList<Association> result = new ArrayList<Association>();
+ for (Association association : associations) {
+ for (Property associationEnd : association.getMemberEnds()) {
+ if (associationEnd.getType().equals(cl) && associationEnd.isNavigable())
+ result.add(association);
+ }
+ }
+ return result;
+ }
+
+ public static Class getAssociatedClass(List<Class> classes, String className) { // 4
+ Class associatedClass = null;
+ for (Class cl : classes) {
+ if (cl.getName().equals(className)) associatedClass = cl;
+ }
+ return associatedClass;
+ }
+
+ public static boolean isAssociatedClass(List<Class> classes, String className) { // 3
+ for (Class cl : classes) {
+ if (cl.getName().equals(className)) return true;
+ }
+ return false;
+ }
+
+ private static boolean haveSameStaticProperties(Operation op, Operation oper) { // 1
+ return (op.isStatic() == oper.isStatic());
+ }
+
+ private static boolean haveSameAbstractProperties(Operation op, // 1
+ Operation oper) {
+ return (op.isAbstract() == oper.isAbstract());
+ }
+
+ private static boolean haveSameQueryProperties(Operation op, Operation oper) { // 1
+ return (op.isQuery() == oper.isQuery());
+ }
+
+ private static boolean haveSameLeafProperties(Operation op, Operation oper) { // 1
+ return (op.isLeaf() == oper.isLeaf());
+ }
+
+ private static boolean haveSameMultiplicities(Operation op, Operation oper) { // 1
+ return ((op.getLower() == oper.getLower())
+ && (op.getUpper() == oper.getUpper()));
+ }
+
+ private static boolean haveSameVisibilities(Operation op, Operation oper) { // 1
+ return op.getVisibility().equals(oper.getVisibility());
+ }
+
+ public static boolean haveSameType(Operation op, Operation oper) { // 3
+ if ((op.getType() == null) && (oper.getType() == null)) return true;
+ if ((op.getType() != null)
+ && (oper.getType() != null)
+ && (op.getType().equals(oper.getType()))) return true;
+ return false;
+ }
+
+ public static boolean haveSameNames(Operation op, Operation oper) { // 1
+ return op.getName().equals(oper.getName());
+ }
+
+ private static int getOtherSideUpper(Property attribute) { // 4
+ int upper = 0;
+ for (Property ae : attribute.getAssociation().getMemberEnds()) {
+ if (! ae.equals(attribute)) upper = ae.getUpper();
+ }
+ return upper;
+ }
+
+ private static boolean haveSameDerivedUnionProperties(Property att1, Property att2) { // 1
+ return (att1.isDerivedUnion() == att2.isDerivedUnion());
+ }
+
+ private static boolean haveSameStaticProperties(Property att1, Property att2) { // 1
+ return (att1.isStatic() == att2.isStatic());
+ }
+
+ private static boolean haveSameOrderedProperties(Property att1, Property att2) { // 1
+ return (att1.isOrdered() == att2.isOrdered());
+ }
+
+ private static boolean haveSameUniqueProperties(Property att1, Property att2) { // 1
+ return (att1.isUnique() == att2.isUnique());
+ }
+
+ private static boolean haveSameReadOnlyProperties(Property att1, Property att2) { // 1
+ return (att1.isReadOnly() == att2.isReadOnly());
+ }
+
+ private static boolean haveSameLeafProperties(Property att1, Property att2) { // 1
+ return (att1.isLeaf() == att2.isLeaf());
+ }
+
+ private static boolean haveSameDerivedProperties(Property att1, Property att2) { // 1
+ return (att1.isDerived() == att2.isDerived());
+ }
+
+ private static boolean haveSameDefaultValues(Property att1, Property att2) { // 3
+ if ((att1.getDefault() == null) && (att2.getDefault() == null)) return true;
+ if ((att1.getDefault() != null)
+ && (att2.getDefault() != null)
+ && (att1.getDefault().equals(att2.getDefault()))) return true;
+ return false;
+ }
+
+ private static boolean haveSameAggregations(Property att1, Property att2) { // 1
+ return att1.getAggregation().equals(att2.getAggregation());
+ }
+
+ private static boolean haveSameMultiplicities(Property att1, Property att2) { // 1
+ return ((att1.getLower() == att2.getLower())
+ && (att1.getUpper() == att2.getUpper()));
+ }
+
+ private static boolean haveSameVisibilities(Property att1, Property att2) { // 1
+ return att1.getVisibility().equals(att2.getVisibility());
+ }
+
+ private static boolean haveSameNames(Property att1, Property att2) { // 1
+ return att1.getName().equals(att2.getName());
+ }
+
+ private static boolean haveSameType(Property att1, Property att2) { // 3
+ if ((att1.getType() == null) && (att2.getType() == null)) return true;
+ if ((att1.getType() != null)
+ && (att2.getType() != null)
+ && (att1.getType().equals(att2.getType()))) return true;
+ return false;
+ }
+
+ public static ArrayList<Class> getAllSubClasses(Class superClass) { // 12
+ ArrayList<Class> classes = getAllClasses(superClass.getModel());
+ ArrayList<Class> subClasses = new ArrayList<Class>();
+ for (Class cls : classes) {
+ if (cls.getSuperClasses().contains(superClass)) subClasses.add(cls);
+ }
+ return subClasses;
+ }
+
+ public static boolean operationHasParameters(Operation op, // 16
+ ArrayList<Parameter> parameters) {
+ for (Parameter param : parameters) {
+ if (! operationHasParameter(op, param)) return false;
+ }
+ return true;
+ }
+
+ private static boolean operationHasParameter(Operation op, Parameter param) { // 13
+ for (Parameter par : op.getOwnedParameters()) {
+ if (haveSameNames(param, par)
+ && haveSameTypes(param, par)
+ && haveSameDirections(param, par)
+ && haveSameMultiplicities(param, par)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static Parameter getEqualParameterInOperation(Operation op, // 13
+ Parameter param) {
+ for (Parameter par : op.getOwnedParameters()) {
+ if (haveSameNames(param, par)
+ && haveSameTypes(param, par)
+ && haveSameDirections(param, par)
+ && haveSameMultiplicities(param, par)) {
+ return par;
+ }
+ }
+ return null;
+ }
+
+ public static boolean isInputParameter(Parameter param) { // 3
+ if (param.getDirection().equals(ParameterDirectionKind.IN_LITERAL)) return true;
+ if (param.getDirection().equals(ParameterDirectionKind.INOUT_LITERAL)) return true;
+ return false;
+ }
+
+ public static boolean oneSubClassInheritsEquallyOperation( // 47
+ Class superClass,
+ Operation operation) {
+ ArrayList<Class> classes = getAllSubClasses(superClass);
+ for (Class cls : classes) {
+ for (NamedElement ne: cls.getInheritedMembers()) {
+ if ((! ne.equals(operation))
+ && (ne instanceof Operation)) {
+ Operation op = (Operation) ne;
+ if (haveSameNames(op, operation)
+ && haveSameType(op, operation)
+ && haveSameSignatures(op, operation)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean oneSubClassHasEquallyOperation( // 47
+ Class superClass,
+ Operation operation) {
+ ArrayList<Class> classes = getAllSubClasses(superClass);
+ for (Class cls : classes) {
+ for (Operation op : cls.getOwnedOperations()) {
+ if (haveSameNames(op, operation)
+ && haveSameType(op, operation)
+ && haveSameSignatures(op, operation)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean oneSubClassInheritsEquallyNamedAttribute( // 18
+ Class superClass,
+ Property attribute) {
+ ArrayList<Class> classes = getAllSubClasses(superClass);
+ for (Class cls : classes) {
+ for (NamedElement ne: cls.getInheritedMembers()) {
+ if ((! ne.equals(attribute))
+ && (ne.getName().equals(attribute.getName()))) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean oneSubClassHasEquallyNamedAttribute( // 18
+ Class superClass,
+ Property attribute) {
+ ArrayList<Class> classes = getAllSubClasses(superClass);
+ for (Class cls : classes) {
+ for (Property attr : cls.getOwnedAttributes()) {
+ if (attr.getName().equals(attribute.getName())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static ArrayList<String> getReasonsWhySubClassDoesNotHaveOperation( // 55
+ Class cls, Operation op) {
+ ArrayList<String> reasons = new ArrayList<String>();
+ Operation equalOperation = null;
+ for (Operation oper : cls.getOwnedOperations()) {
+ if (haveSameNames(op, oper)
+ && haveSameType(op, oper)
+ && haveSameSignatures(op, oper)) {
+ equalOperation = oper;
+ break;
+ }
+ }
+ if (equalOperation == null) {
+ reasons.add("Class '" + cls.getName() +
+ "' does not have an operation named '" + op.getName() +
+ "' and with the same type and parameter list!");
+ } else {
+ if (! haveSameVisibilities(equalOperation, op))
+ reasons.add("Class '" + cls.getName() + "' has an operation named '" +
+ op.getName() + "' of different visibility!");
+ if (! haveSameMultiplicities(equalOperation, op))
+ reasons.add("Class '" + cls.getName() + "' has an operation named '" +
+ op.getName() + "' with different multiplicity!");
+ if (! haveSameLeafProperties(equalOperation, op))
+ reasons.add("Class '" + cls.getName() + "' has an operation named '" +
+ op.getName() + "' with different leaf property!");
+ if (! haveSameStaticProperties(equalOperation, op))
+ reasons.add("Class '" + cls.getName() + "' has an operation named '" +
+ op.getName() + "' with different static property!");
+ if (! haveSameQueryProperties(equalOperation, op))
+ reasons.add("Class '" + cls.getName() + "' has an operation named '" +
+ op.getName() + "' with different query property!");
+ if (! haveSameAbstractProperties(equalOperation, op))
+ reasons.add("Class '" + cls.getName() + "' has an operation named '" +
+ op.getName() + "' with different abstract property!");
+ }
+ return reasons;
+ }
+
+
+ public static ArrayList<String> getReasonsWhySubClassesDoNotHaveOperation( // 74
+ Class superClass, Operation op) {
+ ArrayList<Class> classes = getAllSubClasses(superClass);
+ ArrayList<String> reasons = new ArrayList<String>();
+ for (Class cls : classes) {
+ ArrayList<String> reasonsWhySubClassDoesNotHaveOperation =
+ getReasonsWhySubClassDoesNotHaveOperation(cls, op);
+ if (! reasonsWhySubClassDoesNotHaveOperation.isEmpty()) {
+ reasons.addAll(reasonsWhySubClassDoesNotHaveOperation);
+ }
+ }
+ return reasons;
+ }
+
+
+ private static ArrayList<String> getReasonsWhyClassDoesNotHaveAttribute( // 58
+ Class cls, Property attribute) {
+ ArrayList<String> reasons = new ArrayList<String>();
+ Property equalAttribute = null;
+ for (Property attr : cls.getOwnedAttributes()) {
+ if (haveSameNames(attr, attribute)) {
+ equalAttribute = attr;
+ break;
+ }
+ }
+ if (equalAttribute == null) {
+ reasons.add("Class '" + cls.getName() +
+ "' does not have an attribute named '" +
+ attribute.getName() + "'!");
+ } else {
+ if (! haveSameType(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' of different type!");
+ if (! haveSameVisibilities(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' of different visibility!");
+ if (! haveSameMultiplicities(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different multiplicity!");
+ if (! haveSameAggregations(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' of different aggregation kind!");
+ if (! haveSameDefaultValues(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different default value!");
+ if (! haveSameDerivedProperties(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different derived property!");
+ if (! haveSameLeafProperties(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different leaf property!");
+ if (! haveSameReadOnlyProperties(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different read only property!");
+ if (! haveSameUniqueProperties(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different unique property!");
+ if (! haveSameOrderedProperties(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different ordered property!");
+ if (! haveSameStaticProperties(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different static property!");
+ if (! haveSameDerivedUnionProperties(equalAttribute, attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' with different derived union property!");
+ if ((equalAttribute.getAssociation() != null) && (attribute.getAssociation() != null)) {
+ if (getOtherSideUpper(equalAttribute) != getOtherSideUpper(attribute))
+ reasons.add("Class '" + cls.getName() + "' has an attribute named '" +
+ attribute.getName() + "' as end of an association whose " +
+ "opposite end has an upper multiplicity bound " +
+ "different from " + getOtherSideUpper(attribute) + "!");
+ }
+ }
+ return reasons;
+ }
+
+ public static ArrayList<String> getReasonsWhySubClassesDoNotHaveAttribute( // 77
+ Class superClass, Property attribute) {
+ ArrayList<Class> classes = getAllSubClasses(superClass);
+ ArrayList<String> reasons = new ArrayList<String>();
+ for (Class cls : classes) {
+ ArrayList<String> reasonsWhySubClassDoesNotHaveAttribute =
+ getReasonsWhyClassDoesNotHaveAttribute(cls, attribute);
+ if (! reasonsWhySubClassDoesNotHaveAttribute.isEmpty()) {
+ reasons.addAll(reasonsWhySubClassDoesNotHaveAttribute);
+ }
+ }
+ return reasons;
+ }
+
+ public static boolean classHasEqualOperation(Class cls, Operation op) { // 48
+ if (op.getClass_().equals(cls)) return true;
+ boolean classHasEqualOperation = false;
+ for (Operation oper : cls.getOwnedOperations()) {
+ if (! haveSameNames(op, oper)) continue;
+ if (! haveSameType(op, oper)) continue;
+ if (! haveSameVisibilities(op, oper)) continue;
+ if (! haveSameMultiplicities(op, oper)) continue;
+ if (! haveSameSignatures(op, oper)) continue;
+ if (! haveSameLeafProperties(op, oper)) continue;
+ if (! haveSameQueryProperties(op, oper)) continue;
+ if (! haveSameAbstractProperties(op, oper)) continue;
+ if (! haveSameStaticProperties(op, oper)) continue;
+ classHasEqualOperation = true;
+ break;
+ }
+ return classHasEqualOperation;
+ }
+
+ private static boolean classHasEqualAttribute(Class cls, Property attribute) { // 41
+ if (attribute.getClass_().equals(cls)) return true;
+ boolean classHasEqualAttribute = false;
+ for (Property attr : cls.getOwnedAttributes()) {
+ if (! haveSameNames(attr, attribute)) continue;
+ if (! haveSameType(attr, attribute)) continue;
+ if (! haveSameVisibilities(attr, attribute)) continue;
+ if (! haveSameMultiplicities(attr, attribute)) continue;
+ if (! haveSameAggregations(attr, attribute)) continue;
+ if (! haveSameDefaultValues(attr, attribute)) continue;
+ if (! haveSameDerivedProperties(attr, attribute)) continue;
+ if (! haveSameLeafProperties(attr, attribute)) continue;
+ if (! haveSameReadOnlyProperties(attr, attribute)) continue;
+ if (! haveSameUniqueProperties(attr, attribute)) continue;
+ if (! haveSameOrderedProperties(attr, attribute)) continue;
+ if (! haveSameStaticProperties(attr, attribute)) continue;
+ if (! haveSameDerivedUnionProperties(attr, attribute)) continue;
+ if ((attr.getAssociation() != null) && (attribute.getAssociation() != null)) {
+ if (getOtherSideUpper(attr) != getOtherSideUpper(attribute)) continue;
+ }
+ classHasEqualAttribute = true;
+ break;
+ }
+ return classHasEqualAttribute;
+ }
+
+ public static boolean subClassesHaveAttribute(Class superClass, Property attribute) { // 60
+ ArrayList<Class> classes = getAllSubClasses(superClass);
+ boolean eachSubclassHasAttribute = true;
+ for (Class cls : classes) {
+ if (! classHasEqualAttribute(cls, attribute)) {
+ eachSubclassHasAttribute = false;
+ break;
+ }
+ }
+ return eachSubclassHasAttribute;
+ }
+
+ public static boolean subClassesHaveOperation(Class superClass, Operation operation) { // 67
+ ArrayList<Class> classes = getAllSubClasses(superClass);
+ boolean eachSubclassHasAttribute = true;
+ for (Class cls : classes) {
+ if (! classHasEqualOperation(cls, operation)) {
+ eachSubclassHasAttribute = false;
+ break;
+ }
+ }
+ return eachSubclassHasAttribute;
+ }
+
+ public static List<Association> getAssociations(Class cl) { // 14
+ ArrayList<Association> allAssociations = getAllAssociations(cl.getModel());
+ ArrayList<Association> associations = new ArrayList<Association>();
+ for (Association association : allAssociations) {
+ for (Property associationEnd : association.getMemberEnds()) {
+ if (associationEnd.getType().equals(cl))
+ if (! associations.contains(association)) associations.add(association);
+ }
+ }
+ return associations;
+ }
+
+ public static boolean isUsedAsFurtherAttributeType(Class cl) { // 12
+ ArrayList<Property> attributes = getAllAttributes(cl.getModel());
+ for (Property attribute : attributes) {
+ if (attribute.getType() != null
+ && attribute.getType().equals(cl)
+ && (attribute.getAssociation() == null)) return true;
+ }
+ return false;
+ }
+
+ public static ArrayList<Class> getOtherAssociatedClasses(Class cl) { // 20
+ ArrayList<Class> classes = new ArrayList<Class>();
+ ArrayList<Association> associations = getAllAssociations(cl.getModel());
+ for (Association assoc : associations) {
+ for (Property assocend : assoc.getMemberEnds()) {
+ if (assocend.getType().equals(cl)) {
+ classes.addAll(getOtherAssociationEndsTypeClasses(assocend));
+ }
+ }
+ }
+ return classes;
+ }
+
+}
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController.java
new file mode 100644
index 0000000..7fcfabb
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringController.java
@@ -0,0 +1,400 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringController.javajet,v 1.2 2012/10/16 21:03:02 tarendt Exp $
+ */
+package org.eclipse.emf.refactor.refactorings.uml24.pullupattribute;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.refactor.refactoring.core.Refactoring;
+import org.eclipse.emf.refactor.refactoring.interfaces.IController;
+import org.eclipse.emf.refactor.refactoring.interfaces.IDataManagement;
+import org.eclipse.emf.refactor.refactoring.papyrus.managers.PapyrusManager;
+import org.eclipse.emf.refactor.refactoring.runtime.ltk.LtkEmfRefactoringProcessorAdapter;
+import org.eclipse.emf.refactor.refactorings.papyrus.uml24.UmlUtils;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.VisibilityKind;
+
+public final class RefactoringController implements IController{
+
+ /**
+ * Refactoring supported by the controller.
+ * @generated
+ */
+ private Refactoring parent;
+
+ /**
+ * DataManagement object of the model refactoring.
+ * @generated
+ */
+ private RefactoringDataManagement dataManagement =
+ new RefactoringDataManagement();
+
+ /**
+ * Invocation context of the model refactoring.
+ * @generated
+ */
+ private List<EObject> selection = new ArrayList<EObject>();
+
+ /**
+ * Ltk RefactoringProcessor of the model refactoring.
+ * @generated
+ */
+ private InternalRefactoringProcessor refactoringProcessor = null;
+
+ /**
+ * Gets the Refactoring supported by the controller.
+ * @return Refactoring supported by the controller.
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IController#getParent()
+ * @generated
+ */
+ @Override
+ public Refactoring getParent() {
+ return this.parent;
+ }
+
+ /**
+ * Sets the Refactoring supported by the controller.
+ * @param emfRefactoring Refactoring supported by the controller.
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IController#
+ * setParent(org.eclipse.emf.refactor.refactoring.core.Refactoring)
+ * @generated
+ */
+ @Override
+ public void setParent(Refactoring emfRefactoring) {
+ this.parent = emfRefactoring;
+ }
+
+ /**
+ * Returns the DataManagement object of the model refactoring.
+ * @return DataManagement object of the model refactoring.
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IController#
+ * getDataManagementObject()
+ * @generated
+ */
+ @Override
+ public IDataManagement getDataManagementObject() {
+ return this.dataManagement;
+ }
+
+ /**
+ * Returns the ltk RefactoringProcessor of the model refactoring.
+ * @return Ltk RefactoringProcessor of the model refactoring.
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IController#
+ * getLtkRefactoringProcessor()
+ * @generated
+ */
+ @Override
+ public RefactoringProcessor getLtkRefactoringProcessor() {
+ return this.refactoringProcessor;
+ }
+
+ /**
+ * Sets the selected EObject (invocation context of the model refactoring).
+ * @param selection Invocation context of the model refactoring.
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IController#
+ * setSelection(java.util.List)
+ * @generated
+ */
+ @Override
+ public void setSelection(List<EObject> selection) {
+ this.selection = selection;
+ System.out.println("===> selection: " + this.selection);
+ this.refactoringProcessor =
+ new InternalRefactoringProcessor(this.selection);
+ }
+
+ /**
+ * Returns a Runnable object that executes the model refactoring.
+ * @return Runnable object that executes the model refactoring.
+ * @generated
+ */
+ private Runnable applyRefactoring() {
+ return new Runnable() {
+ /**
+ * @see java.lang.Runnable#run()
+ * @generated
+ */
+ @Override
+ public void run() {
+ org.eclipse.uml2.uml.Property selectedEObject =
+ (org.eclipse.uml2.uml.Property) dataManagement.
+ getInPortByName(dataManagement.SELECTEDEOBJECT).getValue();
+ String className =
+ (String) dataManagement.getInPortByName("className").getValue();
+
+
+ // execute: move selected attribute to specified superclass
+ Class oldClass = selectedEObject.getClass_();
+ Class newClass = oldClass.getSuperClass(className);
+ oldClass.getOwnedAttributes().remove(selectedEObject);
+ newClass.getOwnedAttributes().add(selectedEObject);
+ // if attribute is no association end: move shape to attribute compartment
+ View view = null;
+ if (selectedEObject.getAssociation() == null) {
+ view = getView(selectedEObject);
+ if (view != null) {
+ System.out.println("--> View: " + view);
+ BasicCompartment bcOld = (BasicCompartment) view.eContainer();
+ bcOld.removeChild(view);
+ BasicCompartment bcNew = getAttributeCompartment(newClass);
+ bcNew.insertChild(view);
+ }
+ }
+
+ // if attribute is association end: change opposite end type
+// if (selectedEObject.getAssociation() != null) {
+// Property associationEndToMove = null;
+// for (Property ae : selectedEObject.getAssociation().getMemberEnds()) {
+// if ((! ae.equals(selectedEObject)) && (ae.getClass_() != null)) {
+// associationEndToMove = ae;
+// break;
+// }
+// }
+// if (associationEndToMove != null) // change opposite end type
+// associationEndToMove.setType(newClass);
+// }
+
+
+ // execute: remove equivalent attributes from subclasses
+ ArrayList<Class> classes = UmlUtils.getAllSubClasses(newClass);
+ classes.remove(oldClass);
+ for (Class cls : classes) {
+ Property attributeToRemove = null;
+ for (Property attr : cls.getOwnedAttributes()) {
+ if (attr.getName().equals(selectedEObject.getName())) {
+ attributeToRemove = attr;
+ break;
+ }
+ }
+// if (attributeToRemove.getAssociation() != null) {
+// Association assoc = attributeToRemove.getAssociation();
+// Property associationEndToRemove = null;
+// for (Property ae : attributeToRemove.getAssociation().getMemberEnds()) {
+// if ((! ae.equals(attributeToRemove)) && (ae.getClass_() != null)) {
+// associationEndToRemove = ae;
+// break;
+// }
+// }
+// if (associationEndToRemove != null) { // remove opposite association end if owned by a class
+// Class owningClass = associationEndToRemove.getClass_();
+// owningClass.getOwnedAttributes().remove(associationEndToRemove);
+// }
+// // remove association from owning package
+// Package owningPackage = assoc.getPackage();
+// owningPackage.getPackagedElements().remove(assoc);
+// }
+ // remove equivalent attribute from subclass
+ Class owningSubClass = attributeToRemove.getClass_();
+ owningSubClass.getOwnedAttributes().remove(attributeToRemove);
+ // if attribute is no association end: remove shape from attribute compartment
+ if (attributeToRemove.getAssociation() == null) {
+ if (view != null) {
+ BasicCompartment bc = getAttributeCompartment(owningSubClass);
+ View viewToRemove = null;
+ for (Object o : bc.getChildren()) {
+ if (((View) o).getElement() == attributeToRemove) {
+ viewToRemove = (View) o;
+ }
+ }
+ System.out.println("viewToRemove: " + viewToRemove);
+ bc.removeChild(viewToRemove);
+ }
+ }
+ }
+ }
+
+ private View getView(Property property) {
+ Diagram diagram = null;
+ if (selection.size() > 1) {
+ diagram = (Diagram) selection.get(1);
+ } else {
+ diagram = PapyrusManager.getInstance().getDiagram();
+ }
+ if (diagram != null) {
+ TreeIterator<EObject> iter = diagram.eAllContents();
+ while (iter.hasNext()) {
+ EObject eo = iter.next();
+ if (eo instanceof View) {
+ View view = (View) eo;
+ if (view.getElement() == property) {
+ return view;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private BasicCompartment getAttributeCompartment(Class clazz) {
+ Shape shapeNewClass = getShapeNewClass(clazz);
+ System.out.println("shapeNewClass : " + shapeNewClass);
+ System.out.println("children index 1: " + shapeNewClass.getChildren().get(1));
+ return (BasicCompartment) shapeNewClass.getChildren().get(1);
+ }
+
+ private Shape getShapeNewClass(Class clazz) {
+ EList<Shape> shapes = getAllShapes();
+ System.out.println("number of shapes : " + shapes.size());
+ for (Shape shape : shapes) {
+ if (shape.getElement() == clazz) {
+ return shape;
+ }
+ }
+ return null;
+ }
+
+ private EList<Shape> getAllShapes() {
+ EList<Shape> shapes = new BasicEList<Shape>();
+ Diagram diagram = null;
+ if (selection.size() > 1) {
+ diagram = (Diagram) selection.get(1);
+ } else {
+ diagram = PapyrusManager.getInstance().getDiagram();
+ }
+ if (diagram != null) {
+ for (Object o : diagram.getChildren()) {
+ Node node = (Node) o;
+ shapes.addAll(getAllShapes(node));
+ }
+ }
+ return shapes;
+ }
+
+ private EList<Shape> getAllShapes(Node node) {
+ EList<Shape> shapes = new BasicEList<Shape>();
+ if (node instanceof Shape) {
+ shapes.add((Shape) node);
+ }
+ for (Object o : node.getChildren()) {
+ Node innerNode = (Node) o;
+ shapes.addAll(getAllShapes(innerNode));
+ }
+ return shapes;
+ }
+ };
+ }
+
+ /**
+ * Internal class for providing an instance of a LTK RefactoringProcessor
+ * used for EMF model refactorings.
+ * @generated
+ */
+ public final class InternalRefactoringProcessor extends
+ LtkEmfRefactoringProcessorAdapter {
+
+ /**
+ * Constructor using the invocation context of the model refactoring.
+ * @param selection Invocation context of the model refactoring.
+ * @generated
+ */
+ private InternalRefactoringProcessor(List<EObject> selection){
+ super(getParent(), selection, applyRefactoring());
+ }
+
+ /**
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#
+ * checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
+ * @generated
+ */
+ @Override
+ public RefactoringStatus checkInitialConditions(){
+ RefactoringStatus result = new RefactoringStatus();
+ org.eclipse.uml2.uml.Property selectedEObject =
+ (org.eclipse.uml2.uml.Property) dataManagement.
+ getInPortByName(dataManagement.SELECTEDEOBJECT).getValue();
+ // test: the selected property must be an attribute (owned by a class)
+ String msg = "This refactoring can only be applied" +
+ " on properties which are owned attributes of a class" +
+ " (but no association ends)!";
+ if (selectedEObject.getClass_() == null || selectedEObject.getAssociation() != null) {
+ result.addFatalError(msg);
+ } else {
+ // test: the selected attribute must be public
+ msg = "This refactoring can only be applied on public class attributes!";
+ if (! selectedEObject.getVisibility().equals(VisibilityKind.PUBLIC_LITERAL))
+ result.addFatalError(msg);
+ // test: the selected attribute must not redefine another one
+ msg = "This refactoring can not be applied because the selected attribute" +
+ " redefines another one in the inheritance hierarchy!";
+ if (! selectedEObject.getRedefinedElements().isEmpty())
+ result.addFatalError(msg);
+ // test: the owning class must have at least one superclass
+ msg = "This refactoring can not be applied because the owning class " +
+ "of the selected attribute does not have any superclasses!";
+ if (selectedEObject.getClass_().getSuperClasses().isEmpty())
+ result.addFatalError(msg);
+ }
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#
+ * checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
+ * @generated
+ */
+ @Override
+ public RefactoringStatus checkFinalConditions(){
+ RefactoringStatus result = new RefactoringStatus();
+ org.eclipse.uml2.uml.Property selectedEObject =
+ (org.eclipse.uml2.uml.Property) dataManagement.
+ getInPortByName(dataManagement.SELECTEDEOBJECT).getValue();
+ String className =
+ (String) dataManagement.getInPortByName("className").getValue();
+ // test: the owning class must have a superclass with the specified name
+ String msg = "The owning class does not have a superclass named '" +
+ className + "'!";
+ Class superClass = selectedEObject.getClass_().getSuperClass(className);
+ if (superClass == null) {
+ result.addFatalError(msg);
+ } else {
+ // test: each subclass of the specified superclass must have an
+ // attribute equal to the selected attribute
+ if (! UmlUtils.subClassesHaveAttribute(superClass, selectedEObject)) {
+ ArrayList<String> msgs =
+ UmlUtils.getReasonsWhySubClassesDoNotHaveAttribute(superClass, selectedEObject);
+ for (String str : msgs) {
+ result.addFatalError(str);
+ }
+ } else {
+ // test: the super class must not own an attribute with the
+ // same name as the selected attribute
+ msg = "The superclass already owns an attribute named '" +
+ selectedEObject.getName() + "'!";
+ for (Property att : superClass.getOwnedAttributes()) {
+ if (att.getName().equals(selectedEObject.getName()))
+ result.addFatalError(msg);
+ }
+ // test: the superclass must already inherit an element with the
+ // same name as the selected attribute
+ msg = "The superclass already inherits an element named '" +
+ selectedEObject.getName() + "'!";
+ for (NamedElement att : superClass.getInheritedMembers()) {
+ if (att.getName().equals(selectedEObject.getName()))
+ result.addFatalError(msg);
+ }
+ }
+ }
+ return result;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringDataManagement.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringDataManagement.java
new file mode 100644
index 0000000..73a0f2f
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringDataManagement.java
@@ -0,0 +1,57 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringDataManagement.javajet,v 1.3 2012/11/26 15:39:40 tarendt Exp $
+ */
+package org.eclipse.emf.refactor.refactorings.uml24.pullupattribute;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.refactor.refactoring.runtime.DataManagementAdapter;
+import org.eclipse.emf.refactor.refactoring.core.Port;
+
+/**
+ * Class for specific data concerning a model refactoring.
+ * @generated
+ */
+public class RefactoringDataManagement extends DataManagementAdapter {
+
+ protected final String SELECTEDEOBJECT = "selectedEObject";
+
+ /**
+ * Default constructor.
+ * @generated
+ */
+ public RefactoringDataManagement() {
+ this.addPorts();
+ }
+
+ /**
+ * Adds the ports to the data management used for parameter passing.
+ * @generated
+ */
+ private void addPorts(){
+ this.inPorts.add
+ (new Port<org.eclipse.uml2.uml.Property>
+ (SELECTEDEOBJECT, org.eclipse.uml2.uml.Property.class));
+ this.inPorts.add
+ (new Port<String>
+ ("className", String.class, "unspecified"));
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IDataManagement#
+ * preselect(java.util.List)
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void preselect(List<EObject> selection) {
+ getInPortByName(SELECTEDEOBJECT).
+ setValue((org.eclipse.uml2.uml.Property) selection.get(0));
+ }
+
+}
+
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringGuiHandler.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringGuiHandler.java
new file mode 100644
index 0000000..202cb6a
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringGuiHandler.java
@@ -0,0 +1,79 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringGuiHandler.javajet,v 1.3 2012/11/26 15:39:40 tarendt Exp $
+ */
+package org.eclipse.emf.refactor.refactorings.uml24.pullupattribute;
+
+import java.util.List;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.refactor.refactoring.core.Refactoring;
+import org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+
+/**
+ * Class used for specifying gui topics of a specific model refactoring.
+ * @generated
+ */
+public class RefactoringGuiHandler implements IGuiHandler {
+
+ /**
+ * Refactoring supported by the GuiHandler.
+ * @generated
+ */
+ private Refactoring parent;
+
+ /**
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#getParent()
+ * @generated
+ */
+ @Override
+ public Refactoring getParent() {
+ return parent;
+ }
+
+ /**
+ * @see oorg.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#
+ * setParent(Refactoring)
+ * @generated
+ */
+ @Override
+ public void setParent(Refactoring refactoring) {
+ this.parent = refactoring;
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#show()
+ * @generated
+ */
+ @Override
+ public RefactoringWizard show() {
+ return new org.eclipse.emf.refactor.refactorings.uml24.pullupattribute.RefactoringWizard
+ ((RefactoringController)this.parent.getController());
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#
+ * showInMenu(java.util.List)
+ * @generated
+ */
+ @Override
+ public boolean showInMenu(List<EObject> selection) {
+ if (selection.size() > 2) return false;
+ EObject o = selection.get(0);
+ if(null != o){
+ if (o instanceof org.eclipse.uml2.uml.Property) {
+ if (selection.size() == 2) {
+ EObject eo = selection.get(1);
+ if (eo.eClass().getName().equals("Diagram")) return true;
+ } else {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
+
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizard.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizard.java
new file mode 100644
index 0000000..eb9f5f5
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizard.java
@@ -0,0 +1,40 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringWizard.javajet,v 1.3 2012/11/26 15:39:40 tarendt Exp $
+ */
+package org.eclipse.emf.refactor.refactorings.uml24.pullupattribute;
+
+import org.eclipse.emf.refactor.refactoring.interfaces.IController;
+import org.eclipse.emf.refactor.refactoring.runtime.ltk.ui.AbstractRefactoringWizard;
+
+/**
+ * Class used for providing an implementation of an LTK
+ * RefactoringWizard in EMF Refactor.
+ * @generated
+ */
+public class RefactoringWizard
+ extends AbstractRefactoringWizard {
+
+ /**
+ * Default constructor implementation.
+ * @param controller Controller of the EMF model refactoring.
+ * @generated
+ */
+ public RefactoringWizard(IController controller) {
+ super(controller);
+ }
+
+ /**
+ * @see org.eclipse.ltk.ui.refactoring.RefactoringWizard#
+ * addUserInputPages()
+ * @generated
+ */
+ @Override
+ protected void addUserInputPages() {
+ addPage(new RefactoringWizardPage
+ (controller.getParent().getName(), (RefactoringController)controller));
+ }
+
+}
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizardPage.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizardPage.java
new file mode 100644
index 0000000..6fa9291
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pullupattribute/RefactoringWizardPage.java
@@ -0,0 +1,115 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringWizardPage.javajet,v 1.2 2012/10/16 21:03:02 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.pullupattribute;
+
+import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Class for setting model refactoring specific parameters
+ * by the user.
+ * @generated
+ */
+public class RefactoringWizardPage extends
+ UserInputWizardPage implements Listener {
+
+ /**
+ * Controller of the EMF model refactoring.
+ * @generated
+ */
+ private final RefactoringController controller;
+
+ /**
+ * Label for each parameter.
+ * @generated
+ */
+ private Label classNameLabel;
+
+ /**
+ * TextField for each parameter.
+ * @generated
+ */
+ private Text classNameWidget;
+
+ /**
+ * Default constructor using a name and the controller of the
+ * EMF model refactoring.
+ * @param name Name of the WizardPage.
+ * @param controller Controller of the EMF model refactoring.
+ * @generated
+ */
+ public RefactoringWizardPage
+ (String name, RefactoringController controller) {
+ super(name);
+ this.controller = controller;
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Listener#
+ * handleEvent(org.eclipse.swt.widgets.Event)
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void handleEvent(Event event) {
+ getWizard().getContainer().updateButtons();
+
+ if (classNameWidget != null) {
+ String className = classNameWidget.getText();
+ if (!className.isEmpty()){
+ ((RefactoringDataManagement)
+ this.controller.getDataManagementObject()).
+ getInPortByName("className").
+ setValue(className);
+ } else {
+ ((RefactoringDataManagement)
+ this.controller.getDataManagementObject()).
+ getInPortByName("className").
+ setValue("unspecified");
+ }
+ }
+
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.IDialogPage#
+ * createControl(org.eclipse.swt.widgets.Composite)
+ * @generated
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ composite.setLayout(gl);
+
+
+ classNameLabel = new Label(composite, SWT.NONE);
+ classNameLabel.setText("Name of the superclass the attribute should be moved to: ");
+ classNameLabel.setEnabled(true);
+
+ classNameWidget = new Text(composite, SWT.BORDER);
+ classNameWidget.setToolTipText
+ ("value of variable 'className'");
+ classNameWidget.setEnabled(true);
+ classNameWidget.setLayoutData(gd);
+ classNameWidget.addListener(SWT.Modify, this);
+
+
+ setControl(composite);
+ }
+
+}
+
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController.java
new file mode 100644
index 0000000..2b71f41
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringController.java
@@ -0,0 +1,354 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringController.javajet,v 1.3 2011/01/21 13:08:06 tarendt Exp $
+ */
+package org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
+import org.eclipse.emf.refactor.refactoring.core.Refactoring;
+import org.eclipse.emf.refactor.refactoring.interfaces.IController;
+import org.eclipse.emf.refactor.refactoring.interfaces.IDataManagement;
+import org.eclipse.emf.refactor.refactoring.papyrus.managers.PapyrusManager;
+import org.eclipse.emf.refactor.refactoring.runtime.ltk.LtkEmfRefactoringProcessorAdapter;
+import org.eclipse.emf.refactor.refactorings.uml24.UmlUtils;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.VisibilityKind;
+
+
+public final class RefactoringController implements IController{
+
+ /**
+ * Refactoring supported by the controller.
+ * @generated
+ */
+ private Refactoring parent;
+
+ /**
+ * DataManagement object of the model refactoring.
+ * @generated
+ */
+ private RefactoringDataManagement dataManagement =
+ new RefactoringDataManagement();
+
+ /**
+ * Invocation context of the model refactoring.
+ * @generated
+ */
+ private List<EObject> selection = new ArrayList<EObject>();
+
+ /**
+ * Ltk RefactoringProcessor of the model refactoring.
+ * @generated
+ */
+ private InternalRefactoringProcessor refactoringProcessor = null;
+
+ /**
+ * Gets the Refactoring supported by the controller.
+ * @return Refactoring supported by the controller.
+ * @see org.eclipse.emf.refactor.common.core.IController#getParent()
+ * @generated
+ */
+ @Override
+ public Refactoring getParent() {
+ return this.parent;
+ }
+
+ /**
+ * Sets the Refactoring supported by the controller.
+ * @param Refactoring Refactoring supported by the controller.
+ * @see org.eclipse.emf.refactor.common.core.IController#
+ * setParent(org.eclipse.emf.refactor.common.core.Refactoring)
+ * @generated
+ */
+ @Override
+ public void setParent(Refactoring Refactoring) {
+ this.parent = Refactoring;
+ }
+
+ /**
+ * Returns the DataManagement object of the model refactoring.
+ * @return DataManagement object of the model refactoring.
+ * @see org.eclipse.emf.refactor.common.core.IController#
+ * getDataManagementObject()
+ * @generated
+ */
+ @Override
+ public IDataManagement getDataManagementObject() {
+ return this.dataManagement;
+ }
+
+ /**
+ * Returns the ltk RefactoringProcessor of the model refactoring.
+ * @return Ltk RefactoringProcessor of the model refactoring.
+ * @see org.eclipse.emf.refactor.common.core.IController#
+ * getLtkRefactoringProcessor()
+ * @generated
+ */
+ @Override
+ public RefactoringProcessor getLtkRefactoringProcessor() {
+ return this.refactoringProcessor;
+ }
+
+ /**
+ * Sets the selected EObject (invocation context of the model refactoring).
+ * @param selection Invocation context of the model refactoring.
+ * @see org.eclipse.emf.refactor.common.core.IController#
+ * setSelection(java.util.List)
+ * @generated
+ */
+ @Override
+ public void setSelection(List<EObject> selection) {
+ this.selection = selection;
+ this.refactoringProcessor =
+ new InternalRefactoringProcessor(this.selection);
+ }
+
+ /**
+ * Returns a Runnable object that executes the model refactoring.
+ * @return Runnable object that executes the model refactoring.
+ * @generated
+ */
+ private Runnable applyRefactoring() {
+ return new Runnable() {
+ /**
+ * @see java.lang.Runnable#run()
+ * @generated
+ */
+ @Override
+ public void run() {
+ org.eclipse.uml2.uml.Property selectedEObject =
+ (org.eclipse.uml2.uml.Property) dataManagement.
+ getInPortByName(dataManagement.SELECTEDEOBJECT).getValue();
+ // execute: copy selected attribute to each subclass
+ System.out.println(">>>> hallloooo >>>");
+ Class owningClass = selectedEObject.getClass_();
+ ArrayList<Class> subClasses = UmlUtils.getAllSubClasses(owningClass);
+ for (Class subClass : subClasses) {
+ // create copy of the selected attribute
+ Copier attCopier = new Copier();
+ Property newAttribute = (Property) attCopier.copy(selectedEObject);
+ attCopier.copyReferences();
+ // add copied attribute to subclass
+ subClass.getOwnedAttributes().add(newAttribute);
+ // if attribute is no association end: add shape copy to attribute compartments of each subclass
+ if (selectedEObject.getAssociation() == null) {
+ View view = getView(selectedEObject);
+ if (view != null) {
+ System.out.println("--> View: " + view);
+ Copier viewCopier = new Copier();
+ View newView = (View) viewCopier.copy(view);
+ newView.setElement(newAttribute);
+ BasicCompartment bc = getAttributeCompartment(subClass);
+ bc.insertChild(newView);
+ }
+ }
+
+// if (selectedEObject.getAssociation() != null) {
+// // selected attribute is member end of an association
+// Association assoc = selectedEObject.getAssociation();
+// Property oldOppositeEnd = assoc.getOwnedEnds().get(0);
+// // create copy of the opposite association end
+// Copier aeCopier = new Copier();
+// Property newAssocEnd = (Property) aeCopier.copy(oldOppositeEnd);
+// aeCopier.copyReferences();
+// newAssocEnd.setType(subClass);
+// // create new association and add association ends
+// Package owningPackage = assoc.getPackage();
+// Association newAssociation = UMLFactory.eINSTANCE.createAssociation();
+// String assocName = "a_" + subClass.getName().toLowerCase() + "_" +
+// newAttribute.getType().getName().toLowerCase();
+// newAssociation.setName(assocName);
+// owningPackage.getPackagedElements().add(newAssociation);
+// newAssociation.getOwnedEnds().add(newAssocEnd);
+// newAssociation.getMemberEnds().add(newAttribute);
+// }
+ }
+ // execute: remove selected attribute from owning class
+// if (selectedEObject.getAssociation() != null) {
+// // selected attribute is member end of an association
+// // delete association from owning package
+// Association assoc = selectedEObject.getAssociation();
+// Package owningPackage = assoc.getPackage();
+// owningPackage.getPackagedElements().remove(assoc);
+// }
+ // if attribute is no association end: remove shape from attribute compartment
+ if (selectedEObject.getAssociation() == null) {
+ View view = getView(selectedEObject);
+ if (view != null) {
+ System.out.println("--> View: " + view);
+ BasicCompartment bcOld = (BasicCompartment) view.eContainer();
+ bcOld.removeChild(view);
+ }
+ }
+ // execute: remove selected attribute from owning class
+ owningClass.getOwnedAttributes().remove(selectedEObject);
+ }
+
+ private View getView(Property property) {
+ Diagram diagram = null;
+ if (selection.size() > 1) {
+ diagram = (Diagram) selection.get(1);
+ System.out.println(">> diagram 1: " + diagram);
+ } else {
+ diagram = PapyrusManager.getInstance().getDiagram();
+ System.out.println(">> diagram 2: " + diagram);
+ }
+ System.out.println(">> diagram: " + diagram);
+ if (diagram != null) {
+ TreeIterator<EObject> iter = diagram.eAllContents();
+ while (iter.hasNext()) {
+ EObject eo = iter.next();
+ if (eo instanceof View) {
+ View view = (View) eo;
+ if (view.getElement() == property) {
+ System.out.println(">> view: " + view);
+ System.out.println(">> diagram: " + diagram);
+ return view;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private BasicCompartment getAttributeCompartment(Class clazz) {
+ Shape shapeNewClass = getShapeNewClass(clazz);
+ System.out.println("shapeNewClass : " + shapeNewClass);
+ System.out.println("children index 1: " + shapeNewClass.getChildren().get(1));
+ return (BasicCompartment) shapeNewClass.getChildren().get(1);
+ }
+
+ private Shape getShapeNewClass(Class clazz) {
+ EList<Shape> shapes = getAllShapes();
+ System.out.println("number of shapes : " + shapes.size());
+ for (Shape shape : shapes) {
+ if (shape.getElement() == clazz) {
+ return shape;
+ }
+ }
+ return null;
+ }
+
+ private EList<Shape> getAllShapes() {
+ EList<Shape> shapes = new BasicEList<Shape>();
+ Diagram diagram = null;
+ if (selection.size() > 1) {
+ diagram = (Diagram) selection.get(1);
+ } else {
+ diagram = PapyrusManager.getInstance().getDiagram();
+ }
+ if (diagram != null) {
+ for (Object o : diagram.getChildren()) {
+ Node node = (Node) o;
+ shapes.addAll(getAllShapes(node));
+ }
+ }
+ return shapes;
+ }
+
+ private EList<Shape> getAllShapes(Node node) {
+ EList<Shape> shapes = new BasicEList<Shape>();
+ if (node instanceof Shape) {
+ shapes.add((Shape) node);
+ }
+ for (Object o : node.getChildren()) {
+ Node innerNode = (Node) o;
+ shapes.addAll(getAllShapes(innerNode));
+ }
+ return shapes;
+ }
+ };
+ }
+
+ /**
+ * Internal class for providing an instance of a LTK RefactoringProcessor
+ * used for EMF model refactorings.
+ * @generated
+ */
+ public final class InternalRefactoringProcessor extends
+ LtkEmfRefactoringProcessorAdapter {
+
+ /**
+ * Constructor using the invocation context of the model refactoring.
+ * @param selection Invocation context of the model refactoring.
+ * @generated
+ */
+ private InternalRefactoringProcessor(List<EObject> selection){
+ super(getParent(), selection, applyRefactoring());
+ }
+
+ /**
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#
+ * checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
+ * @generated
+ */
+ @Override
+ public RefactoringStatus checkInitialConditions(){
+ RefactoringStatus result = new RefactoringStatus();
+ org.eclipse.uml2.uml.Property selectedEObject =
+ (org.eclipse.uml2.uml.Property) dataManagement.
+ getInPortByName(dataManagement.SELECTEDEOBJECT).getValue();
+ // test: the selected property must be an attribute (owned by a class)
+ String msg = "This refactoring can only be applied" +
+ " on properties which are owned attributes of a class!";
+ if (selectedEObject.getClass_() == null) {
+ result.addFatalError(msg);
+ } else {
+ // test: the selected attribute must be public
+ msg = "This refactoring can only be applied on public class attributes!";
+ if (! selectedEObject.getVisibility().equals(VisibilityKind.PUBLIC_LITERAL))
+ result.addFatalError(msg);
+ // test: the owning class must have at least one subclass
+ msg = "This refactoring can not be applied because the owning class " +
+ "of the selected attribute does not have any subclasses!";
+ if (! UmlUtils.hasSubclasses(selectedEObject.getClass_()))
+ result.addFatalError(msg);
+ // test: the owning class must not have any subclasses which own
+ // attributes with the same name as the selected attribute
+ msg = "This refactoring can not be applied because at least one subclass " +
+ "already owns an attribute named '" + selectedEObject.getName() +"'!";
+ if (UmlUtils.oneSubClassHasEquallyNamedAttribute
+ (selectedEObject.getClass_(), selectedEObject)) result.addFatalError(msg);
+ // test: the owning class must not have any subclasses which inherit
+ // elements with the same name as the selected attribute
+ msg = "This refactoring can not be applied because at least one subclass " +
+ "already inherits an element named '" + selectedEObject.getName() +"'!";
+ if (UmlUtils.oneSubClassInheritsEquallyNamedAttribute
+ (selectedEObject.getClass_(), selectedEObject)) result.addFatalError(msg);
+ }
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#
+ * checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
+ * @generated
+ */
+ @Override
+ public RefactoringStatus checkFinalConditions(){
+ RefactoringStatus result = new RefactoringStatus();
+ // the refactoring has no final checks
+ return result;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringDataManagement.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringDataManagement.java
new file mode 100644
index 0000000..110313c
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringDataManagement.java
@@ -0,0 +1,54 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringDataManagement.javajet,v 1.2 2011/01/21 13:08:06 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.refactor.refactoring.core.Port;
+import org.eclipse.emf.refactor.refactoring.runtime.DataManagementAdapter;
+
+/**
+ * Class for specific data concerning a model refactoring.
+ * @generated
+ */
+public class RefactoringDataManagement extends DataManagementAdapter {
+
+ protected final String SELECTEDEOBJECT = "selectedEObject";
+
+ /**
+ * Default constructor.
+ * @generated
+ */
+ public RefactoringDataManagement() {
+ this.addPorts();
+ }
+
+ /**
+ * Adds the ports to the data management used for parameter passing.
+ * @generated
+ */
+ private void addPorts(){
+ this.inPorts.add
+ (new Port<org.eclipse.uml2.uml.Property>
+ (SELECTEDEOBJECT, org.eclipse.uml2.uml.Property.class));
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.IDataManagement#
+ * preselect(java.util.List)
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void preselect(List<EObject> selection) {
+ getInPortByName(SELECTEDEOBJECT).
+ setValue((org.eclipse.uml2.uml.Property) selection.get(0));
+ }
+
+}
+
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringGuiHandler.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringGuiHandler.java
new file mode 100644
index 0000000..68b0328
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringGuiHandler.java
@@ -0,0 +1,80 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringGuiHandler.javajet,v 1.1 2010/07/15 13:08:44 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.refactor.refactoring.core.Refactoring;
+import org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+
+/**
+ * Class used for specifying gui topics of a specific model refactoring.
+ * @generated
+ */
+public class RefactoringGuiHandler implements IGuiHandler {
+
+ /**
+ * Refactoring supported by the GuiHandler.
+ * @generated
+ */
+ Refactoring parent;
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.ui.IGuiHandler#getParent()
+ * @generated
+ */
+ @Override
+ public Refactoring getParent() {
+ return parent;
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.ui.IGuiHandler#
+ * setParent(org.eclipse.emf.refactor.common.core.Refactoring)
+ * @generated
+ */
+ @Override
+ public void setParent(Refactoring Refactoring) {
+ this.parent = Refactoring;
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.ui.IGuiHandler#show()
+ * @generated
+ */
+ @Override
+ public RefactoringWizard show() {
+ return new org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute.RefactoringWizard
+ ((RefactoringController)this.parent.getController());
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.ui.IGuiHandler#
+ * showInMenu(java.util.List)
+ * @generated
+ */
+ @Override
+ public boolean showInMenu(List<EObject> selection) {
+ if (selection.size() > 2) return false;
+ EObject o = selection.get(0);
+ if(null != o){
+ if (o instanceof org.eclipse.uml2.uml.Property) {
+ if (selection.size() == 2) {
+ EObject eo = selection.get(1);
+ if (eo.eClass().getName().equals("Diagram")) return true;
+ } else {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
+
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizard.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizard.java
new file mode 100644
index 0000000..26a982b
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizard.java
@@ -0,0 +1,40 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringWizard.javajet,v 1.1 2010/07/15 13:08:44 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute;
+
+import org.eclipse.emf.refactor.refactoring.interfaces.IController;
+import org.eclipse.emf.refactor.refactoring.runtime.ltk.ui.AbstractRefactoringWizard;
+
+/**
+ * Class used for providing an implementation of an LTK
+ * RefactoringWizard in EMF Refactor.
+ * @generated
+ */
+public class RefactoringWizard
+ extends AbstractRefactoringWizard {
+
+ /**
+ * Default constructor implementation.
+ * @param controller Controller of the EMF model refactoring.
+ * @generated
+ */
+ public RefactoringWizard(IController controller) {
+ super(controller);
+ }
+
+ /**
+ * @see org.eclipse.ltk.ui.refactoring.RefactoringWizard#
+ * addUserInputPages()
+ * @generated
+ */
+ @Override
+ protected void addUserInputPages() {
+ addPage(new RefactoringWizardPage
+ (controller.getParent().getName(), (RefactoringController)controller));
+ }
+
+}
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizardPage.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizardPage.java
new file mode 100644
index 0000000..b41fd16
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/pushdownattribute/RefactoringWizardPage.java
@@ -0,0 +1,80 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringWizardPage.javajet,v 1.1 2010/07/15 13:08:44 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.pushdownattribute;
+
+import java.util.List;
+
+import org.eclipse.emf.refactor.refactoring.runtime.ltk.ui.AbstractRefactoringWizard;
+import org.eclipse.emf.refactor.refactoring.runtime.ui.IInputPageButtonCreator;
+import org.eclipse.emf.refactor.refactoring.runtime.ui.InputPageButtonLoader;
+import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * Class for setting model refactoring specific parameters
+ * by the user.
+ * @generated
+ */
+public class RefactoringWizardPage extends
+ UserInputWizardPage implements Listener {
+
+ /**
+ * Controller of the EMF model refactoring.
+ * @generated
+ */
+ private final RefactoringController controller;
+
+
+ /**
+ * Default constructor using a name and the controller of the
+ * EMF model refactoring.
+ * @param name Name of the WizardPage.
+ * @param controller Controller of the EMF model refactoring.
+ * @generated
+ */
+ public RefactoringWizardPage
+ (String name, RefactoringController controller) {
+ super(name);
+ this.controller = controller;
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Listener#
+ * handleEvent(org.eclipse.swt.widgets.Event)
+ * @generated
+ */
+ @Override
+ public void handleEvent(Event event) {
+ getWizard().getContainer().updateButtons();
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.IDialogPage#
+ * createControl(org.eclipse.swt.widgets.Composite)
+ * @generated
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ composite.setLayout(gl);
+
+ List<IInputPageButtonCreator> buttonCreators = InputPageButtonLoader.iNSTANCE.getInputPageButtonCreatorClasses();
+ for(IInputPageButtonCreator creator : buttonCreators){
+ creator.createButton(composite, controller, (AbstractRefactoringWizard)this.getWizard());
+ }
+
+ setControl(composite);
+ }
+
+}
+
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController.java
new file mode 100644
index 0000000..dce7ca6
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringController.java
@@ -0,0 +1,296 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringController.javajet,v 1.3 2011/01/21 13:08:06 tarendt Exp $
+ */
+package org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.refactor.refactoring.core.Refactoring;
+import org.eclipse.emf.refactor.refactoring.interfaces.IController;
+import org.eclipse.emf.refactor.refactoring.interfaces.IDataManagement;
+import org.eclipse.emf.refactor.refactoring.papyrus.managers.PapyrusManager;
+import org.eclipse.emf.refactor.refactoring.runtime.ltk.LtkEmfRefactoringProcessorAdapter;
+import org.eclipse.emf.refactor.refactorings.uml24.UmlUtils;
+import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Package;
+
+
+public final class RefactoringController implements IController{
+
+ /**
+ * Refactoring supported by the controller.
+ * @generated
+ */
+ private Refactoring parent;
+
+ /**
+ * DataManagement object of the model refactoring.
+ * @generated
+ */
+ private RefactoringDataManagement dataManagement =
+ new RefactoringDataManagement();
+
+ /**
+ * Invocation context of the model refactoring.
+ * @generated
+ */
+ private List<EObject> selection = new ArrayList<EObject>();
+
+ /**
+ * Ltk RefactoringProcessor of the model refactoring.
+ * @generated
+ */
+ private InternalRefactoringProcessor refactoringProcessor = null;
+
+ /**
+ * Gets the Refactoring supported by the controller.
+ * @return Refactoring supported by the controller.
+ * @see org.eclipse.emf.refactor.common.core.IController#getParent()
+ * @generated
+ */
+ @Override
+ public Refactoring getParent() {
+ return this.parent;
+ }
+
+ /**
+ * Sets the Refactoring supported by the controller.
+ * @param emfRefactoring Refactoring supported by the controller.
+ * @see org.eclipse.emf.refactor.common.core.IController#
+ * setParent(org.eclipse.emf.refactor.common.core.Refactoring)
+ * @generated
+ */
+ @Override
+ public void setParent(Refactoring emfRefactoring) {
+ this.parent = emfRefactoring;
+ }
+
+ /**
+ * Returns the DataManagement object of the model refactoring.
+ * @return DataManagement object of the model refactoring.
+ * @see org.eclipse.emf.refactor.common.core.IController#
+ * getDataManagementObject()
+ * @generated
+ */
+ @Override
+ public IDataManagement getDataManagementObject() {
+ return this.dataManagement;
+ }
+
+ /**
+ * Returns the ltk RefactoringProcessor of the model refactoring.
+ * @return Ltk RefactoringProcessor of the model refactoring.
+ * @see org.eclipse.emf.refactor.common.core.IController#
+ * getLtkRefactoringProcessor()
+ * @generated
+ */
+ @Override
+ public RefactoringProcessor getLtkRefactoringProcessor() {
+ return this.refactoringProcessor;
+ }
+
+ /**
+ * Sets the selected EObject (invocation context of the model refactoring).
+ * @param selection Invocation context of the model refactoring.
+ * @see org.eclipse.emf.refactor.common.core.IController#
+ * setSelection(java.util.List)
+ * @generated
+ */
+ @Override
+ public void setSelection(List<EObject> selection) {
+ this.selection = selection;
+ this.refactoringProcessor =
+ new InternalRefactoringProcessor(this.selection);
+ }
+
+ /**
+ * Returns a Runnable object that executes the model refactoring.
+ * @return Runnable object that executes the model refactoring.
+ * @generated
+ */
+ private Runnable applyRefactoring() {
+ return new Runnable() {
+ /**
+ * @see java.lang.Runnable#run()
+ * @generated
+ */
+ @Override
+ public void run() {
+ org.eclipse.uml2.uml.Class selectedEObject =
+ (org.eclipse.uml2.uml.Class) dataManagement.
+ getInPortByName(dataManagement.SELECTEDEOBJECT).getValue();
+ View view = getView(selectedEObject);
+ // execute: delete generalizations to selected class
+ List<Class> allClasses = UmlUtils.getAllClasses(selectedEObject.getModel());
+ for (Class cl : allClasses) {
+ if (cl.getSuperClasses().contains(selectedEObject)){
+ Generalization gen = cl.getGeneralization(selectedEObject);
+ // remove edge from diagram
+ if (view != null) {
+ removeConnector(gen);
+ }
+ // remove generalization
+ cl.getGeneralizations().remove(gen);
+ }
+ }
+ // execute: delete selected class from owning package
+ Package p = selectedEObject.getPackage();
+ // remove shape
+ if (view != null) {
+ System.out.println("--> View: " + view);
+ View owningView = (View) view.eContainer();
+ owningView.removeChild(view);
+ }
+ // remove class
+ p.getPackagedElements().remove(selectedEObject);
+ }
+
+ private void removeConnector(Generalization gen) {
+ Diagram diagram = null;
+ if (selection.size() > 1) {
+ diagram = (Diagram) selection.get(1);
+ } else {
+ diagram = PapyrusManager.getInstance().getDiagram();
+ }
+ Connector connector = null;
+ if (diagram != null) {
+ TreeIterator<EObject> iter = diagram.eAllContents();
+ while (iter.hasNext()) {
+ EObject eo = iter.next();
+ if (eo instanceof Connector) {
+ Connector con = (Connector) eo;
+ if (con.getElement() == gen) {
+ connector = con;
+ break;
+ }
+ }
+ }
+ System.out.println(">> Connector: " + connector);
+ if (connector != null) {
+ connector.unsetElement();
+ connector.setSource(null);
+ connector.setTarget(null);
+ diagram.removeEdge(connector);
+ }
+ }
+ }
+
+ private View getView(org.eclipse.uml2.uml.Class clazz) {
+ Diagram diagram = null;
+ if (selection.size() > 1) {
+ diagram = (Diagram) selection.get(1);
+ } else {
+ diagram = PapyrusManager.getInstance().getDiagram();
+ }
+ if (diagram != null) {
+ TreeIterator<EObject> iter = diagram.eAllContents();
+ while (iter.hasNext()) {
+ EObject eo = iter.next();
+ if (eo instanceof View) {
+ View view = (View) eo;
+ if (view.getElement() == clazz) {
+ return view;
+ }
+ }
+ }
+ }
+ return null;
+ }
+ };
+ }
+
+ /**
+ * Internal class for providing an instance of a LTK RefactoringProcessor
+ * used for EMF model refactorings.
+ * @generated
+ */
+ public final class InternalRefactoringProcessor extends
+ LtkEmfRefactoringProcessorAdapter {
+
+ /**
+ * Constructor using the invocation context of the model refactoring.
+ * @param selection Invocation context of the model refactoring.
+ * @generated
+ */
+ private InternalRefactoringProcessor(List<EObject> selection){
+ super(getParent(), selection, applyRefactoring());
+ }
+
+ /**
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#
+ * checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
+ * @generated
+ */
+ @Override
+ public RefactoringStatus checkInitialConditions(){
+ RefactoringStatus result = new RefactoringStatus();
+ Class selectedEObject =
+ (Class) dataManagement.getInPortByName(dataManagement.SELECTEDEOBJECT).getValue();
+ // test: the selected class must be owned by a package
+ String msg = "This refactoring can only be applied" +
+ " on classes which are owned by a package!";
+ if (selectedEObject.getPackage() == null) result.addFatalError(msg);
+ // test: the selected class must have at least one subclass
+ msg = "Class '" + selectedEObject.getName() + "' does not have any subclasses!";
+ if (! UmlUtils.hasSubclasses(selectedEObject)) result.addFatalError(msg);
+ // test: the selected class must not own any attributes
+ msg = "Class '" + selectedEObject.getName() + "' owns at least one attribute!";
+ if (UmlUtils.hasAttributes(selectedEObject)) result.addFatalError(msg);
+ // test: the selected class must not own any operations
+ msg = "Class '" + selectedEObject.getName() + "' owns at least one operation!";
+ if (UmlUtils.hasOperations(selectedEObject)) result.addFatalError(msg);
+ // test: the selected class must not have any superclasses
+ msg = "Class '" + selectedEObject.getName() + "' has at least one superclass!";
+ if (UmlUtils.hasSuperclasses(selectedEObject)) result.addFatalError(msg);
+ // test: the class must not have any inner classes
+ msg = "Class '" + selectedEObject.getName() + "' has at least one inner class!";
+ if (UmlUtils.hasInnerClasses(selectedEObject)) result.addFatalError(msg);
+ // test: the class must not have any outgoing associations
+ msg = "Class '" + selectedEObject.getName() + "' has at least one outgoing association!";
+ if (UmlUtils.hasOutgoingAssociations(selectedEObject)) result.addFatalError(msg);
+ // test: the class must not have any incoming associations
+ msg = "Class '" + selectedEObject.getName() + "' has at least one incoming association!";
+ if (UmlUtils.hasIncomingAssociations(selectedEObject)) result.addFatalError(msg);
+ // test: the class must not implement any interfaces
+ msg = "Class '" + selectedEObject.getName() + "' implements at least one interface!";
+ if (UmlUtils.implementsInterfaces(selectedEObject)) result.addFatalError(msg);
+ // test: the class must not use any interfaces
+ msg = "Class '" + selectedEObject.getName() + "' uses at least one interface!";
+ if (UmlUtils.usesInterfaces(selectedEObject)) result.addFatalError(msg);
+ // test: the class must not be used as attribute type
+ msg = "Class '" + selectedEObject.getName() + "' is used as attribute type!";
+ if (UmlUtils.isUsedAsAttributeType(selectedEObject)) result.addFatalError(msg);
+ // test: the class must not be used as operation/parameter type
+ msg = "Class '" + selectedEObject.getName() + "' is used as operation/parameter type!";
+ if (UmlUtils.isUsedAsParameterType(selectedEObject)) result.addFatalError(msg);
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#
+ * checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
+ * @generated
+ */
+ @Override
+ public RefactoringStatus checkFinalConditions(){
+ RefactoringStatus result = new RefactoringStatus();
+ // no final checks
+ return result;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringDataManagement.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringDataManagement.java
new file mode 100644
index 0000000..f4b2451
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringDataManagement.java
@@ -0,0 +1,54 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringDataManagement.javajet,v 1.2 2011/01/21 13:08:06 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.refactor.refactoring.core.Port;
+import org.eclipse.emf.refactor.refactoring.runtime.DataManagementAdapter;
+
+/**
+ * Class for specific data concerning a model refactoring.
+ * @generated
+ */
+public class RefactoringDataManagement extends DataManagementAdapter {
+
+ protected final String SELECTEDEOBJECT = "selectedEObject";
+
+ /**
+ * Default constructor.
+ * @generated
+ */
+ public RefactoringDataManagement() {
+ this.addPorts();
+ }
+
+ /**
+ * Adds the ports to the data management used for parameter passing.
+ * @generated
+ */
+ private void addPorts(){
+ this.inPorts.add
+ (new Port<org.eclipse.uml2.uml.Class>
+ (SELECTEDEOBJECT, org.eclipse.uml2.uml.Class.class));
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.IDataManagement#
+ * preselect(java.util.List)
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void preselect(List<EObject> selection) {
+ getInPortByName(SELECTEDEOBJECT).
+ setValue((org.eclipse.uml2.uml.Class) selection.get(0));
+ }
+
+}
+
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringGuiHandler.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringGuiHandler.java
new file mode 100644
index 0000000..6c58616
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringGuiHandler.java
@@ -0,0 +1,80 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringGuiHandler.javajet,v 1.1 2010/07/15 13:08:44 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.refactor.refactoring.core.Refactoring;
+import org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+
+/**
+ * Class used for specifying gui topics of a specific model refactoring.
+ * @generated
+ */
+public class RefactoringGuiHandler implements IGuiHandler {
+
+ /**
+ * Refactoring supported by the GuiHandler.
+ * @generated
+ */
+ Refactoring parent;
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.ui.IGuiHandler#getParent()
+ * @generated
+ */
+ @Override
+ public Refactoring getParent() {
+ return parent;
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.ui.IGuiHandler#
+ * setParent(org.eclipse.emf.refactor.common.core.Refactoring)
+ * @generated
+ */
+ @Override
+ public void setParent(Refactoring emfRefactoring) {
+ this.parent = emfRefactoring;
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.ui.IGuiHandler#show()
+ * @generated
+ */
+ @Override
+ public RefactoringWizard show() {
+ return new org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass.RefactoringWizard
+ ((RefactoringController)this.parent.getController());
+ }
+
+ /**
+ * @see org.eclipse.emf.refactor.common.core.ui.IGuiHandler#
+ * showInMenu(java.util.List)
+ * @generated
+ */
+ @Override
+ public boolean showInMenu(List<EObject> selection) {
+ if (selection.size() > 2) return false;
+ EObject o = selection.get(0);
+ if(null != o){
+ if (o instanceof org.eclipse.uml2.uml.Class) {
+ if (selection.size() == 2) {
+ EObject eo = selection.get(1);
+ if (eo.eClass().getName().equals("Diagram")) return true;
+ } else {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
+
\ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizard.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizard.java
new file mode 100644
index 0000000..20df562
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizard.java
@@ -0,0 +1,40 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringWizard.javajet,v 1.1 2010/07/15 13:08:44 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass;
+
+import org.eclipse.emf.refactor.refactoring.interfaces.IController;
+import org.eclipse.emf.refactor.refactoring.runtime.ltk.ui.AbstractRefactoringWizard;
+
+/**
+ * Class used for providing an implementation of an LTK
+ * RefactoringWizard in EMF Refactor.
+ * @generated
+ */
+public class RefactoringWizard
+ extends AbstractRefactoringWizard {
+
+ /**
+ * Default constructor implementation.
+ * @param controller Controller of the EMF model refactoring.
+ * @generated
+ */
+ public RefactoringWizard(IController controller) {
+ super(controller);
+ }
+
+ /**
+ * @see org.eclipse.ltk.ui.refactoring.RefactoringWizard#
+ * addUserInputPages()
+ * @generated
+ */
+ @Override
+ protected void addUserInputPages() {
+ addPage(new RefactoringWizardPage
+ (controller.getParent().getName(), (RefactoringController)controller));
+ }
+
+}
diff --git a/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizardPage.java b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizardPage.java
new file mode 100644
index 0000000..db5f5d5
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactorings.papyrus.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/removeemptysuperclass/RefactoringWizardPage.java
@@ -0,0 +1,80 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: RefactoringWizardPage.javajet,v 1.1 2010/07/15 13:08:44 tarendt Exp $
+ */
+ package org.eclipse.emf.refactor.refactorings.uml24.removeemptysuperclass;
+
+import java.util.List;
+
+import org.eclipse.emf.refactor.refactoring.runtime.ltk.ui.AbstractRefactoringWizard;
+import org.eclipse.emf.refactor.refactoring.runtime.ui.IInputPageButtonCreator;
+import org.eclipse.emf.refactor.refactoring.runtime.ui.InputPageButtonLoader;
+import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * Class for setting model refactoring specific parameters
+ * by the user.
+ * @generated
+ */
+public class RefactoringWizardPage extends
+ UserInputWizardPage implements Listener {
+
+ /**
+ * Controller of the EMF model refactoring.
+ * @generated
+ */
+ private final RefactoringController controller;
+
+
+ /**
+ * Default constructor using a name and the controller of the
+ * EMF model refactoring.
+ * @param name Name of the WizardPage.
+ * @param controller Controller of the EMF model refactoring.
+ * @generated
+ */
+ public RefactoringWizardPage
+ (String name, RefactoringController controller) {
+ super(name);
+ this.controller = controller;
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Listener#
+ * handleEvent(org.eclipse.swt.widgets.Event)
+ * @generated
+ */
+ @Override
+ public void handleEvent(Event event) {
+ getWizard().getContainer().updateButtons();
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.IDialogPage#
+ * createControl(org.eclipse.swt.widgets.Composite)
+ * @generated
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ composite.setLayout(gl);
+
+ List<IInputPageButtonCreator> buttonCreators = InputPageButtonLoader.iNSTANCE.getInputPageButtonCreatorClasses();
+ for(IInputPageButtonCreator creator : buttonCreators){
+ creator.createButton(composite, controller, (AbstractRefactoringWizard)this.getWizard());
+ }
+
+ setControl(composite);
+ }
+
+}
+
\ No newline at end of file