refactorings ADD PAPAMETER and HIDE ATTRIBUTE added
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/.settings/org.eclipse.core.resources.prefs b/org.eclipse.emf.refactor.refactorings.uml24.henshin/.settings/org.eclipse.core.resources.prefs index fa36405..17ac041 100644 --- a/org.eclipse.emf.refactor.refactorings.uml24.henshin/.settings/org.eclipse.core.resources.prefs +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,5 @@ eclipse.preferences.version=1 +encoding//transformation/hide_attribute_check_1.henshin_diagram=UTF-8 encoding//transformation/rename_attribute_exe.henshin=UTF-8 encoding//transformation/rename_attribute_exe.henshin_diagram=UTF-8 encoding//transformation/rename_attribute_final.henshin_diagram=UTF-8
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController$1.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController$1.class new file mode 100644 index 0000000..4d7777a --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController$1.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController$InternalRefactoringProcessor.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController$InternalRefactoringProcessor.class new file mode 100644 index 0000000..d406fa6 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController$InternalRefactoringProcessor.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController.class new file mode 100644 index 0000000..1b36c28 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringDataManagement.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringDataManagement.class new file mode 100644 index 0000000..d65b9ed --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringDataManagement.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringGuiHandler.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringGuiHandler.class new file mode 100644 index 0000000..e848503 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringGuiHandler.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringInformation.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringInformation.class new file mode 100644 index 0000000..f3cdf40 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringInformation.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest$1.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest$1.class new file mode 100644 index 0000000..5f25ace --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest$1.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest.class new file mode 100644 index 0000000..690dffd --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizard.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizard.class new file mode 100644 index 0000000..2ab0991 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizard.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizardPage.class b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizardPage.class new file mode 100644 index 0000000..2a1e8ed --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/bin/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizardPage.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/plugin.xml b/org.eclipse.emf.refactor.refactorings.uml24.henshin/plugin.xml index 3c67172..4c0e0d2 100644 --- a/org.eclipse.emf.refactor.refactorings.uml24.henshin/plugin.xml +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/plugin.xml
@@ -1,6 +1,17 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <plugin> <extension point="org.eclipse.emf.refactor.refactorings"> -<refactoring controller="org.eclipse.emf.refactor.refactorings.uml24.renameattribute.RefactoringController" gui="org.eclipse.emf.refactor.refactorings.uml24.renameattribute.RefactoringGuiHandler" id="org.eclipse.emf.refactor.refactorings.uml24.RenameAttribute" menulabel="Rename Attribute" namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML"/> +<refactoring + controller="org.eclipse.emf.refactor.refactorings.uml24.renameattribute.RefactoringController" + gui="org.eclipse.emf.refactor.refactorings.uml24.renameattribute.RefactoringGuiHandler" + id="org.eclipse.emf.refactor.refactorings.uml24.RenameAttribute" + menulabel="Rename Attribute" + namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML"/> +<refactoring + controller="org.eclipse.emf.refactor.refactorings.uml24.hideattribute.RefactoringController" + gui="org.eclipse.emf.refactor.refactorings.uml24.hideattribute.RefactoringGuiHandler" + id="org.eclipse.emf.refactor.refactorings.uml24.HideAttribute" + menulabel="Hide Attribute" + namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML"/> </extension> </plugin>
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController.java b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController.java new file mode 100644 index 0000000..fc23dd9 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringController.java
@@ -0,0 +1,173 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringControllerHenshin.javajet,v 1.1 2010/07/15 13:09:58 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.hideattribute; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.refactor.refactoring.core.Refactoring; +import org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinController; +import org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinDataManagement; +import org.eclipse.emf.refactor.refactoring.henshin.managers.HenshinRuntimeManager; +import org.eclipse.emf.refactor.refactoring.henshin.runtime.HenshinLtkEmfRefactoringProcessorAdapter; +import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor; + + +/** + * Concrete EMF model refactoring class implementing IHenshinController. + * @generated + */ +public final class RefactoringController implements IHenshinController{ + + /** + * 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>(); + + /** + * HenshinRuntimeManager that executes Henshin transformations using + * the Henshin interpreter. + * @generated + */ + private HenshinRuntimeManager henshinRunner = + new HenshinRuntimeManager(new ArrayList<EObject>(0), dataManagement); + + /** + * 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.henshin.core.IHenshinController# + * getDataManagementObject() + * @generated + */ + @Override + public IHenshinDataManagement getDataManagementObject() { + return this.dataManagement; + } + + /** + * Gets a HenshinRuntimeManager that executes Henshin transformations using + * the Henshin interpreter. + * @return HenshinRuntimeManager that executes Henshin transformations using + * the Henshin interpreter. + * @see org.eclipse.emf.refactor.henshin.core.IHenshinController# + * getHenshinRuntimeManager() + * @generated + */ + @Override + public HenshinRuntimeManager getHenshinRuntimeManager() { + return this.henshinRunner; + } + + /** + * 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.henshinRunner = new HenshinRuntimeManager(this.selection, this.dataManagement); + 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() { + henshinRunner = new HenshinRuntimeManager(selection, dataManagement); + henshinRunner.run(); + } + }; + } + + /** + * Internal class for providing an instance of a LTK RefactoringProcessor + * used for EMF model refactorings using Henshin transformations. + * @generated + */ + public final class InternalRefactoringProcessor extends + HenshinLtkEmfRefactoringProcessorAdapter { + + /** + * 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()); + } + } + +} \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringDataManagement.java b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringDataManagement.java new file mode 100644 index 0000000..56f9f02 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringDataManagement.java
@@ -0,0 +1,123 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringDataManagementHenshin.javajet,v 1.1 2010/07/15 13:09:58 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.hideattribute; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.refactor.refactoring.core.Port; +import org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinDataManagement; +import org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinInformation; +import org.eclipse.emf.refactor.refactoring.runtime.DataManagementAdapter; + +/** + * Class for specific data concerning a model refactoring. + * @generated + */ +public class RefactoringDataManagement extends DataManagementAdapter + implements IHenshinDataManagement { + + private final String SELECTEDEOBJECT = "selectedEObject"; + + /** + * HenshinInformation object used for checking the initial + * conditions of the EMF model refactoring. + * @generated + */ + private RefactoringInformation initialConditionsInformation = + new RefactoringInformation(this); + + /** + * HenshinInformation object used for checking the final + * conditions of the EMF model refactoring. + * @generated + */ + private RefactoringInformation finalConditionsInformation = + new RefactoringInformation(this); + + /** + * HenshinInformation object used for executing the EMF + * model refactoring. + * @generated + */ + private RefactoringInformation createChangeInformation = + new RefactoringInformation(this); + + /** + * Default constructor. + * @generated + */ + public RefactoringDataManagement() { + this.addPorts(); + this.addInformation(); + } + + /** + * 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)); + } + + /** + * Adds the Henshin informations to the data management. + * @generated + */ + private void addInformation() { + this.initialConditionsInformation. + setTransformationFileName("hide_attribute_check_1"); + this.createChangeInformation. + setTransformationFileName("hide_attribute_execute"); + } + + /** + * @see org.eclipse.emf.refactor.henshin.core.IHenshinDataManagement# + * getCreateChangeHenshinInformation() + * @generated + */ + @Override + public IHenshinInformation getCreateChangeHenshinInformation() { + return this.createChangeInformation; + } + + /** + * @see org.eclipse.emf.refactor.henshin.core.IHenshinDataManagement# + * getFinalConditionsHenshinInformation() + * @generated + */ + @Override + public IHenshinInformation getFinalConditionsHenshinInformation() { + return this.finalConditionsInformation; + } + + /** + * @see org.eclipse.emf.refactor.henshin.core.IHenshinDataManagement# + * getInitialConditionsHenshinInformation() + * @generated + */ + @Override + public IHenshinInformation getInitialConditionsHenshinInformation() { + return this.initialConditionsInformation; + } + + /** + * @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.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringGuiHandler.java b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringGuiHandler.java new file mode 100644 index 0000000..5d45d9e --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringGuiHandler.java
@@ -0,0 +1,76 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringGuiHandlerHenshin.javajet,v 1.1 2010/07/15 13:09:58 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.hideattribute; + +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.hideattribute.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() > 1) return false; + for(EObject o:selection){ + if(null != o){ + if (o instanceof org.eclipse.uml2.uml.Property) { + return true; + } + } + } + return false; + } + +} + \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringInformation.java b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringInformation.java new file mode 100644 index 0000000..31d22cb --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringInformation.java
@@ -0,0 +1,79 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringInformationHenshin.javajet,v 1.2 2011/03/16 14:39:16 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.hideattribute; + +import java.io.File; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinDataManagement; +import org.eclipse.emf.refactor.refactoring.henshin.runtime.HenshinInformationAdapter; +import org.eclipse.emf.refactor.refactorings.uml24.henshin.Activator; +import org.osgi.framework.Bundle; + +/** + * Class used for specifying a Henshin file that shall be used by + * a specific EMF model refactoring. + * @generated + */ +public class RefactoringInformation extends HenshinInformationAdapter { + + /** + * HenshinDataManagement object of the specific EMF model refactoring. + * @generated + */ + private RefactoringDataManagement dataManagement; + + /** + * Default constructor using a RefactoringDataManagement object. + * @param dataManagement HenshinDataManagement object of the specific + * EMF model refactoring. + * @generated + */ + public RefactoringInformation + (RefactoringDataManagement dataManagement) { + super(); + this.dataManagement = dataManagement; + } + + /** + * @see org.eclipse.emf.refactor.henshin.core.IHenshinInformation# + * getHenshinDataManagement() + * @generated + */ + @Override + public IHenshinDataManagement getHenshinDataManagement() { + return this.dataManagement; + } + + /** + * @see org.eclipse.emf.refactor.henshin.runtime. + * HenshinInformationAdapter#getTransformationFileName() + * @generated + */ + @Override + public String getTransformationFileName() { + String emtPath = ""; + final Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); + try { + if (bundle != null) { + emtPath = FileLocator.toFileURL + (bundle.getEntry("transformation")).getFile(); + emtPath += this.transformationFileName; + } else { + emtPath = new File(".").getCanonicalPath() + + "\\transformation\\" + + this.transformationFileName; + } + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println(emtPath); + return emtPath; + } + +} \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest.java b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest.java new file mode 100644 index 0000000..78cc9e7 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringTest.java
@@ -0,0 +1,101 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringTestHenshin.javajet,v 1.2 2011/03/16 16:14:22 tarendt Exp $ + */ + +package org.eclipse.emf.refactor.refactorings.uml24.hideattribute; + +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; +import org.eclipse.emf.henshin.model.HenshinPackage; +import org.eclipse.emf.refactor.refactoring.core.Refactoring; +import org.eclipse.emf.refactor.refactoring.runtime.test.JUnitTestCaseAdapter; +import org.eclipse.uml2.uml.UMLPackage; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * Class used for running individual JUnit test cases + * of the specific model refactoring. + * @generated + */ +@RunWith(value = Parameterized.class) +public class RefactoringTest extends JUnitTestCaseAdapter { + + /** + * Number of test cases. + * @generated + */ + private String number; + + /** + * Constructor implementation. + * @param number Number of test cases. + * @generated + */ + public RefactoringTest(String number) throws IOException { + super("icse.hideattributehenshin", + "uml", + new File(".").getCanonicalPath(), + new Refactoring(null, "", "http://www.eclipse.org/uml2/3.0.0/UML", new RefactoringGuiHandler(), new RefactoringController())); + register(UMLPackage.eINSTANCE); + register(HenshinPackage.eINSTANCE); + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("henshin", new XMIResourceFactoryImpl()); + this.number = number; + } + + @Parameters + public static Collection<Object[]> data() { + List<String> testNumbers = getTestNumbers(); + Object[][] data = new Object[testNumbers.size()][1]; + for (int i = 0; i < testNumbers.size(); i++) { + data[i][0] = testNumbers.get(i); + } + return Arrays.asList(data); + } + + private static List<String> getTestNumbers() { + List<String> numbers = new ArrayList<String>(); + try { + String pathPrefix = new File(".").getCanonicalPath() + "/tests/" + "icse.hideattributehenshin"; + File testCaseDir = new File(pathPrefix,"/"); + FilenameFilter filter = new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.startsWith("test_"); + } + }; + String[] children = testCaseDir.list(filter); + if (children != null) { + for (String child : children) { + numbers.add( + child.substring( + child.indexOf('_') + 1)); + } + } + } catch (IOException e) { + e.printStackTrace(); + } + return numbers; + } + + /** + * Runs the test. + */ + @Test + public void test(){ + System.out.println("running test test_" + number); + executeTestCase(number); + } +} \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizard.java b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizard.java new file mode 100644 index 0000000..784d412 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizard.java
@@ -0,0 +1,40 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringWizardHenshin.javajet,v 1.1 2010/07/15 13:09:58 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.hideattribute; + +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)); + } + +} \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizardPage.java b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizardPage.java new file mode 100644 index 0000000..ed56c9b --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/hideattribute/RefactoringWizardPage.java
@@ -0,0 +1,80 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringWizardPageHenshin.javajet,v 1.1 2010/07/15 13:09:58 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.hideattribute; + +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.uml24.henshin/transformation/hide_attribute_check_1.henshin b/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_check_1.henshin new file mode 100644 index 0000000..433d92f --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_check_1.henshin
@@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<henshin:Module xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:henshin="http://www.eclipse.org/emf/2011/Henshin" xmi:id="_h14nQKKuEeKVq9bLGfaZZA"> + <imports href="http://www.eclipse.org/uml2/4.0.0/UML#/"/> + <units xsi:type="henshin:IndependentUnit" xmi:id="_h3Dr8KKuEeKVq9bLGfaZZA" name="mainUnit" subUnits="_h3Dr9aKuEeKVq9bLGfaZZA _h3DsAqKuEeKVq9bLGfaZZA _h3DsEKKuEeKVq9bLGfaZZA"> + <parameters xmi:id="_h3Dr8aKuEeKVq9bLGfaZZA" name="selectedEObject"/> + <parameterMappings xmi:id="_h3Dr8qKuEeKVq9bLGfaZZA" source="_h3Dr8aKuEeKVq9bLGfaZZA" target="_h3Dr9qKuEeKVq9bLGfaZZA"/> + <parameterMappings xmi:id="_h3Dr86KuEeKVq9bLGfaZZA" source="_h3Dr8aKuEeKVq9bLGfaZZA" target="_h3DsA6KuEeKVq9bLGfaZZA"/> + <parameterMappings xmi:id="_h3Dr9KKuEeKVq9bLGfaZZA" source="_h3Dr8aKuEeKVq9bLGfaZZA" target="_h3DsEaKuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:Rule" xmi:id="_h3Dr9aKuEeKVq9bLGfaZZA" name="check_isAttribute" description="This refactoring can be applied on class attributes only!"> + <parameters xmi:id="_h3Dr9qKuEeKVq9bLGfaZZA" name="prop"/> + <lhs xmi:id="_h3Dr96KuEeKVq9bLGfaZZA" name="LHS"> + <nodes xmi:id="_h3Dr-KKuEeKVq9bLGfaZZA" name="prop"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + <formula xsi:type="henshin:Not" xmi:id="_h3Nc8KKuEeKVq9bLGfaZZA"> + <child xsi:type="henshin:NestedCondition" xmi:id="_h3Dr-aKuEeKVq9bLGfaZZA"> + <conclusion xmi:id="_h3Dr-qKuEeKVq9bLGfaZZA"> + <nodes xmi:id="_h3Dr-6KuEeKVq9bLGfaZZA" name="prop" incoming="_h3Dr_aKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + <nodes xmi:id="_h3Dr_KKuEeKVq9bLGfaZZA" name="cl" outgoing="_h3Dr_aKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/> + </nodes> + <edges xmi:id="_h3Dr_aKuEeKVq9bLGfaZZA" source="_h3Dr_KKuEeKVq9bLGfaZZA" target="_h3Dr-6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/> + </edges> + </conclusion> + <mappings xmi:id="_h3Dr_qKuEeKVq9bLGfaZZA" origin="_h3Dr-KKuEeKVq9bLGfaZZA" image="_h3Dr-6KuEeKVq9bLGfaZZA"/> + </child> + </formula> + </lhs> + <rhs xmi:id="_h3Dr_6KuEeKVq9bLGfaZZA" name="RHS"> + <nodes xmi:id="_h3DsAKKuEeKVq9bLGfaZZA" name="prop"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + </rhs> + <mappings xmi:id="_h3DsAaKuEeKVq9bLGfaZZA" origin="_h3Dr-KKuEeKVq9bLGfaZZA" image="_h3DsAKKuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:Rule" xmi:id="_h3DsAqKuEeKVq9bLGfaZZA" name="check_isNotPrivate" description="This refactoring can be applied on non-private attributes only!"> + <parameters xmi:id="_h3DsA6KuEeKVq9bLGfaZZA" name="att"/> + <parameters xmi:id="_h3DsBKKuEeKVq9bLGfaZZA" name="vis" description=""/> + <lhs xmi:id="_h3DsBaKuEeKVq9bLGfaZZA" name="LHS"> + <nodes xmi:id="_h3DsBqKuEeKVq9bLGfaZZA" name="att"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + <formula xsi:type="henshin:NestedCondition" xmi:id="_h3DsB6KuEeKVq9bLGfaZZA"> + <conclusion xmi:id="_h3DsCKKuEeKVq9bLGfaZZA"> + <nodes xmi:id="_h3DsCaKuEeKVq9bLGfaZZA" name="att"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + <attributes xmi:id="_h3DsCqKuEeKVq9bLGfaZZA" value="vis"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/visibility"/> + </attributes> + </nodes> + </conclusion> + <mappings xmi:id="_h3DsC6KuEeKVq9bLGfaZZA" origin="_h3DsBqKuEeKVq9bLGfaZZA" image="_h3DsCaKuEeKVq9bLGfaZZA"/> + </formula> + </lhs> + <rhs xmi:id="_h3DsDKKuEeKVq9bLGfaZZA" name="RHS"> + <nodes xmi:id="_h3DsDaKuEeKVq9bLGfaZZA" name="att"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + </rhs> + <attributeConditions xmi:id="_h3DsDqKuEeKVq9bLGfaZZA" description="" conditionText="vis == "private""/> + <mappings xmi:id="_h3DsD6KuEeKVq9bLGfaZZA" origin="_h3DsBqKuEeKVq9bLGfaZZA" image="_h3DsDaKuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:Rule" xmi:id="_h3DsEKKuEeKVq9bLGfaZZA" name="check_hasType" description="This refactoring can be applied on typed attributes only!"> + <parameters xmi:id="_h3DsEaKuEeKVq9bLGfaZZA" name="att"/> + <lhs xmi:id="_h3DsEqKuEeKVq9bLGfaZZA" name="LHS"> + <nodes xmi:id="_h3DsE6KuEeKVq9bLGfaZZA" name="att"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + <formula xsi:type="henshin:Not" xmi:id="_h3Nc8aKuEeKVq9bLGfaZZA"> + <child xsi:type="henshin:NestedCondition" xmi:id="_h3DsFKKuEeKVq9bLGfaZZA"> + <conclusion xmi:id="_h3DsFaKuEeKVq9bLGfaZZA"> + <nodes xmi:id="_h3DsFqKuEeKVq9bLGfaZZA" name="att" outgoing="_h3DsGKKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + <nodes xmi:id="_h3DsF6KuEeKVq9bLGfaZZA" name="t" incoming="_h3DsGKKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Type"/> + </nodes> + <edges xmi:id="_h3DsGKKuEeKVq9bLGfaZZA" source="_h3DsFqKuEeKVq9bLGfaZZA" target="_h3DsF6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/> + </edges> + </conclusion> + <mappings xmi:id="_h3DsGaKuEeKVq9bLGfaZZA" origin="_h3DsE6KuEeKVq9bLGfaZZA" image="_h3DsFqKuEeKVq9bLGfaZZA"/> + </child> + </formula> + </lhs> + <rhs xmi:id="_h3DsGqKuEeKVq9bLGfaZZA" name="RHS"> + <nodes xmi:id="_h3DsG6KuEeKVq9bLGfaZZA" name="att"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + </rhs> + <mappings xmi:id="_h3DsHKKuEeKVq9bLGfaZZA" origin="_h3DsE6KuEeKVq9bLGfaZZA" image="_h3DsG6KuEeKVq9bLGfaZZA"/> + </units> +</henshin:Module>
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_check_1.henshin_diagram b/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_check_1.henshin_diagram new file mode 100644 index 0000000..a92f912 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_check_1.henshin_diagram
@@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:henshin="http://www.eclipse.org/emf/2011/Henshin" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_4aQvoBuuEeOptZXdwj-NJQ" type="Henshin" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_4w3RwBuuEeOptZXdwj-NJQ" type="2002" fontName="Segoe UI" italic="true" fillColor="14808535" lineColor="0"> + <children xmi:type="notation:DecorationNode" xmi:id="_4w6VEBuuEeOptZXdwj-NJQ" type="5004"/> + <children xmi:type="notation:DecorationNode" xmi:id="_4w6VERuuEeOptZXdwj-NJQ" type="7003"/> + <element xmi:type="henshin:IndependentUnit" href="hide_attribute_check_1.henshin#_h3Dr8KKuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4w3RwRuuEeOptZXdwj-NJQ"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_4yY7wBuuEeOptZXdwj-NJQ" type="2001" fontName="Segoe UI" italic="true" fillColor="16114135" lineColor="0"> + <children xmi:type="notation:DecorationNode" xmi:id="_4yY7whuuEeOptZXdwj-NJQ" type="5001"/> + <children xmi:type="notation:DecorationNode" xmi:id="_4yY7wxuuEeOptZXdwj-NJQ" type="7001"> + <children xmi:type="notation:Shape" xmi:id="_44jOIBuuEeOptZXdwj-NJQ" type="3001" fontName="Segoe UI"> + <children xmi:type="notation:DecorationNode" xmi:id="_44jOIhuuEeOptZXdwj-NJQ" type="5002"/> + <children xmi:type="notation:DecorationNode" xmi:id="_44jOIxuuEeOptZXdwj-NJQ" type="5003"/> + <children xmi:type="notation:DecorationNode" xmi:id="_44kcQBuuEeOptZXdwj-NJQ" type="7002"> + <styles xmi:type="notation:SortingStyle" xmi:id="_44kcQRuuEeOptZXdwj-NJQ"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_44kcQhuuEeOptZXdwj-NJQ"/> + </children> + <element xmi:type="henshin:Node" href="hide_attribute_check_1.henshin#_h3Dr-KKuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_44jOIRuuEeOptZXdwj-NJQ" x="10" y="11"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_44lDUBuuEeOptZXdwj-NJQ" type="3001" fontName="Segoe UI"> + <children xmi:type="notation:DecorationNode" xmi:id="_44lDUhuuEeOptZXdwj-NJQ" type="5002"/> + <children xmi:type="notation:DecorationNode" xmi:id="_44lDUxuuEeOptZXdwj-NJQ" type="5003"/> + <children xmi:type="notation:DecorationNode" xmi:id="_44lDVBuuEeOptZXdwj-NJQ" type="7002"> + <styles xmi:type="notation:SortingStyle" xmi:id="_44lDVRuuEeOptZXdwj-NJQ"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_44lDVhuuEeOptZXdwj-NJQ"/> + </children> + <element xmi:type="henshin:Node" href="hide_attribute_check_1.henshin#_h3Dr_KKuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_44lDURuuEeOptZXdwj-NJQ" x="139" y="62"/> + </children> + </children> + <element xmi:type="henshin:Rule" href="hide_attribute_check_1.henshin#_h3Dr9aKuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4yY7wRuuEeOptZXdwj-NJQ" x="11" y="245"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_4yZi0BuuEeOptZXdwj-NJQ" type="2001" fontName="Segoe UI" italic="true" fillColor="16114135" lineColor="0"> + <children xmi:type="notation:DecorationNode" xmi:id="_4yZi0huuEeOptZXdwj-NJQ" type="5001"/> + <children xmi:type="notation:DecorationNode" xmi:id="_4yZi0xuuEeOptZXdwj-NJQ" type="7001"> + <children xmi:type="notation:Shape" xmi:id="_45H14BuuEeOptZXdwj-NJQ" type="3001" fontName="Segoe UI"> + <children xmi:type="notation:DecorationNode" xmi:id="_45H14huuEeOptZXdwj-NJQ" type="5002"/> + <children xmi:type="notation:DecorationNode" xmi:id="_45H14xuuEeOptZXdwj-NJQ" type="5003"/> + <children xmi:type="notation:DecorationNode" xmi:id="_45H15BuuEeOptZXdwj-NJQ" type="7002"> + <styles xmi:type="notation:SortingStyle" xmi:id="_45H15RuuEeOptZXdwj-NJQ"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_45Ic8BuuEeOptZXdwj-NJQ"/> + </children> + <element xmi:type="henshin:Node" href="hide_attribute_check_1.henshin#_h3DsBqKuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_45H14RuuEeOptZXdwj-NJQ" x="24" y="2"/> + </children> + </children> + <element xmi:type="henshin:Rule" href="hide_attribute_check_1.henshin#_h3DsAqKuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4yZi0RuuEeOptZXdwj-NJQ" x="554" y="245"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_4yaJ4BuuEeOptZXdwj-NJQ" type="2001" fontName="Segoe UI" italic="true" fillColor="16114135" lineColor="0"> + <children xmi:type="notation:DecorationNode" xmi:id="_4yaJ4huuEeOptZXdwj-NJQ" type="5001"/> + <children xmi:type="notation:DecorationNode" xmi:id="_4yaJ4xuuEeOptZXdwj-NJQ" type="7001"> + <children xmi:type="notation:Shape" xmi:id="_45WfYBuuEeOptZXdwj-NJQ" type="3001" fontName="Segoe UI"> + <children xmi:type="notation:DecorationNode" xmi:id="_45WfYhuuEeOptZXdwj-NJQ" type="5002"/> + <children xmi:type="notation:DecorationNode" xmi:id="_45WfYxuuEeOptZXdwj-NJQ" type="5003"/> + <children xmi:type="notation:DecorationNode" xmi:id="_45WfZBuuEeOptZXdwj-NJQ" type="7002"> + <styles xmi:type="notation:SortingStyle" xmi:id="_45WfZRuuEeOptZXdwj-NJQ"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_45WfZhuuEeOptZXdwj-NJQ"/> + </children> + <element xmi:type="henshin:Node" href="hide_attribute_check_1.henshin#_h3DsE6KuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_45WfYRuuEeOptZXdwj-NJQ" x="29" y="11"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_45XGcBuuEeOptZXdwj-NJQ" type="3001" fontName="Segoe UI"> + <children xmi:type="notation:DecorationNode" xmi:id="_45XGchuuEeOptZXdwj-NJQ" type="5002"/> + <children xmi:type="notation:DecorationNode" xmi:id="_45XGcxuuEeOptZXdwj-NJQ" type="5003"/> + <children xmi:type="notation:DecorationNode" xmi:id="_45XGdBuuEeOptZXdwj-NJQ" type="7002"> + <styles xmi:type="notation:SortingStyle" xmi:id="_45XGdRuuEeOptZXdwj-NJQ"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_45XGdhuuEeOptZXdwj-NJQ"/> + </children> + <element xmi:type="henshin:Node" href="hide_attribute_check_1.henshin#_h3DsF6KuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_45XGcRuuEeOptZXdwj-NJQ" x="132" y="77"/> + </children> + </children> + <element xmi:type="henshin:Rule" href="hide_attribute_check_1.henshin#_h3DsEKKuEeKVq9bLGfaZZA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4yaJ4RuuEeOptZXdwj-NJQ" x="284" y="245"/> + </children> + <styles xmi:type="notation:DiagramStyle" xmi:id="_4aQvoRuuEeOptZXdwj-NJQ"/> + <element xmi:type="henshin:Module" href="hide_attribute_check_1.henshin#_h14nQKKuEeKVq9bLGfaZZA"/> +</notation:Diagram>
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_execute.henshin b/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_execute.henshin new file mode 100644 index 0000000..2ca1e1d --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_execute.henshin
@@ -0,0 +1,244 @@ +<?xml version="1.0" encoding="ASCII"?> +<henshin:Module xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:henshin="http://www.eclipse.org/emf/2011/Henshin" xmi:id="_vVPIUKKuEeKVq9bLGfaZZA"> + <imports href="http://www.eclipse.org/uml2/4.0.0/UML#/"/> + <units xsi:type="henshin:SequentialUnit" xmi:id="_vWfskKKuEeKVq9bLGfaZZA" name="mainUnit" description="" subUnits="_vWgTqaKuEeKVq9bLGfaZZA _vWfslaKuEeKVq9bLGfaZZA _vWgTo6KuEeKVq9bLGfaZZA"> + <parameters xmi:id="_vWfskaKuEeKVq9bLGfaZZA" name="selectedEObject"/> + <parameterMappings xmi:id="_vWfskqKuEeKVq9bLGfaZZA" source="_vWfskaKuEeKVq9bLGfaZZA" target="_vWgTqqKuEeKVq9bLGfaZZA"/> + <parameterMappings xmi:id="_vWfsk6KuEeKVq9bLGfaZZA" source="_vWfskaKuEeKVq9bLGfaZZA" target="_vWfslqKuEeKVq9bLGfaZZA"/> + <parameterMappings xmi:id="_vWfslKKuEeKVq9bLGfaZZA" source="_vWfskaKuEeKVq9bLGfaZZA" target="_vWgTpKKuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:LoopUnit" xmi:id="_vWfslaKuEeKVq9bLGfaZZA" name="countedGetter" subUnit="_vWgToKKuEeKVq9bLGfaZZA"> + <parameters xmi:id="_vWfslqKuEeKVq9bLGfaZZA" name="selectedEObject"/> + <parameterMappings xmi:id="_vWfsl6KuEeKVq9bLGfaZZA" source="_vWfslqKuEeKVq9bLGfaZZA" target="_vWgToaKuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:IndependentUnit" xmi:id="_vWgToKKuEeKVq9bLGfaZZA" name="indepGetter" subUnits="_vWgTsaKuEeKVq9bLGfaZZA"> + <parameters xmi:id="_vWgToaKuEeKVq9bLGfaZZA" name="selectedEObject"/> + <parameterMappings xmi:id="_vWgToqKuEeKVq9bLGfaZZA" source="_vWgToaKuEeKVq9bLGfaZZA" target="_vWgTsqKuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:LoopUnit" xmi:id="_vWgTo6KuEeKVq9bLGfaZZA" name="countedSetter" subUnit="_vWgTpqKuEeKVq9bLGfaZZA"> + <parameters xmi:id="_vWgTpKKuEeKVq9bLGfaZZA" name="selectedEObject"/> + <parameterMappings xmi:id="_vWgTpaKuEeKVq9bLGfaZZA" source="_vWgTpKKuEeKVq9bLGfaZZA" target="_vWgTp6KuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:IndependentUnit" xmi:id="_vWgTpqKuEeKVq9bLGfaZZA" name="indepSetter" subUnits="_vWgT2aKuEeKVq9bLGfaZZA"> + <parameters xmi:id="_vWgTp6KuEeKVq9bLGfaZZA" name="selectedEObject"/> + <parameterMappings xmi:id="_vWgTqKKuEeKVq9bLGfaZZA" source="_vWgTp6KuEeKVq9bLGfaZZA" target="_vWgT2qKuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:Rule" xmi:id="_vWgTqaKuEeKVq9bLGfaZZA" name="change_visibility"> + <parameters xmi:id="_vWgTqqKuEeKVq9bLGfaZZA" name="att"/> + <lhs xmi:id="_vWgTq6KuEeKVq9bLGfaZZA" name="LHS"> + <nodes xmi:id="_vWgTrKKuEeKVq9bLGfaZZA" name="att"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + </nodes> + </lhs> + <rhs xmi:id="_vWgTraKuEeKVq9bLGfaZZA" name="RHS"> + <nodes xmi:id="_vWgTrqKuEeKVq9bLGfaZZA" name="att"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + <attributes xmi:id="_vWgTr6KuEeKVq9bLGfaZZA" value=""private""> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/visibility"/> + </attributes> + </nodes> + </rhs> + <mappings xmi:id="_vWgTsKKuEeKVq9bLGfaZZA" origin="_vWgTrKKuEeKVq9bLGfaZZA" image="_vWgTrqKuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:Rule" xmi:id="_vWgTsaKuEeKVq9bLGfaZZA" name="create_getter"> + <parameters xmi:id="_vWgTsqKuEeKVq9bLGfaZZA" name="att"/> + <parameters xmi:id="_vWgTs6KuEeKVq9bLGfaZZA" name="attname"/> + <parameters xmi:id="_vWgTtKKuEeKVq9bLGfaZZA" name="opname"/> + <lhs xmi:id="_vWgTtaKuEeKVq9bLGfaZZA" name="LHS"> + <nodes xmi:id="_vWgTtqKuEeKVq9bLGfaZZA" name="att" incoming="_vWgTuqKuEeKVq9bLGfaZZA" outgoing="_vWgTu6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + <attributes xmi:id="_vWgTt6KuEeKVq9bLGfaZZA" value="attname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgTuKKuEeKVq9bLGfaZZA" name="cl" outgoing="_vWgTuqKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/> + </nodes> + <nodes xmi:id="_vWgTuaKuEeKVq9bLGfaZZA" name="type" incoming="_vWgTu6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Type"/> + </nodes> + <edges xmi:id="_vWgTuqKuEeKVq9bLGfaZZA" source="_vWgTuKKuEeKVq9bLGfaZZA" target="_vWgTtqKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/> + </edges> + <edges xmi:id="_vWgTu6KuEeKVq9bLGfaZZA" source="_vWgTtqKuEeKVq9bLGfaZZA" target="_vWgTuaKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/> + </edges> + <formula xsi:type="henshin:Not" xmi:id="_vWiI0aKuEeKVq9bLGfaZZA"> + <child xsi:type="henshin:NestedCondition" xmi:id="_vWgTvKKuEeKVq9bLGfaZZA"> + <conclusion xmi:id="_vWgTvaKuEeKVq9bLGfaZZA"> + <nodes xmi:id="_vWgTvqKuEeKVq9bLGfaZZA" name="cl" outgoing="_vWgTw6KuEeKVq9bLGfaZZA _vWgTxKKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/> + </nodes> + <nodes xmi:id="_vWgTv6KuEeKVq9bLGfaZZA" name="exop" incoming="_vWgTw6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Operation"/> + <attributes xmi:id="_vWgTwKKuEeKVq9bLGfaZZA" value="opname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgTwaKuEeKVq9bLGfaZZA" name="att" incoming="_vWgTxKKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + <attributes xmi:id="_vWgTwqKuEeKVq9bLGfaZZA" value="attname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <edges xmi:id="_vWgTw6KuEeKVq9bLGfaZZA" source="_vWgTvqKuEeKVq9bLGfaZZA" target="_vWgTv6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/ownedOperation"/> + </edges> + <edges xmi:id="_vWgTxKKuEeKVq9bLGfaZZA" source="_vWgTvqKuEeKVq9bLGfaZZA" target="_vWgTwaKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/> + </edges> + </conclusion> + <mappings xmi:id="_vWgTxaKuEeKVq9bLGfaZZA" origin="_vWgTuKKuEeKVq9bLGfaZZA" image="_vWgTvqKuEeKVq9bLGfaZZA"/> + <mappings xmi:id="_vWgTxqKuEeKVq9bLGfaZZA" origin="_vWgTtqKuEeKVq9bLGfaZZA" image="_vWgTwaKuEeKVq9bLGfaZZA"/> + </child> + </formula> + </lhs> + <rhs xmi:id="_vWgTx6KuEeKVq9bLGfaZZA" name="RHS"> + <nodes xmi:id="_vWgTyKKuEeKVq9bLGfaZZA" name="att" incoming="_vWgT0KKuEeKVq9bLGfaZZA" outgoing="_vWgT06KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + <attributes xmi:id="_vWgTyaKuEeKVq9bLGfaZZA" value="attname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgTyqKuEeKVq9bLGfaZZA" name="cl" outgoing="_vWgT0KKuEeKVq9bLGfaZZA _vWgT0aKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/> + </nodes> + <nodes xmi:id="_vWgTy6KuEeKVq9bLGfaZZA" name="op" incoming="_vWgT0aKuEeKVq9bLGfaZZA" outgoing="_vWgT0qKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Operation"/> + <attributes xmi:id="_vWgTzKKuEeKVq9bLGfaZZA" value=""get"+attname.substring(0,1).toUpperCase()+attname.substr(1)"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgTzaKuEeKVq9bLGfaZZA" name="retpar" incoming="_vWgT0qKuEeKVq9bLGfaZZA" outgoing="_vWgT1KKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Parameter"/> + <attributes xmi:id="_vWgTzqKuEeKVq9bLGfaZZA" value=""return""> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/direction"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgTz6KuEeKVq9bLGfaZZA" name="type" incoming="_vWgT06KuEeKVq9bLGfaZZA _vWgT1KKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Type"/> + </nodes> + <edges xmi:id="_vWgT0KKuEeKVq9bLGfaZZA" source="_vWgTyqKuEeKVq9bLGfaZZA" target="_vWgTyKKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/> + </edges> + <edges xmi:id="_vWgT0aKuEeKVq9bLGfaZZA" source="_vWgTyqKuEeKVq9bLGfaZZA" target="_vWgTy6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/ownedOperation"/> + </edges> + <edges xmi:id="_vWgT0qKuEeKVq9bLGfaZZA" source="_vWgTy6KuEeKVq9bLGfaZZA" target="_vWgTzaKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//BehavioralFeature/ownedParameter"/> + </edges> + <edges xmi:id="_vWgT06KuEeKVq9bLGfaZZA" source="_vWgTyKKuEeKVq9bLGfaZZA" target="_vWgTz6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/> + </edges> + <edges xmi:id="_vWgT1KKuEeKVq9bLGfaZZA" source="_vWgTzaKuEeKVq9bLGfaZZA" target="_vWgTz6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/> + </edges> + </rhs> + <attributeConditions xmi:id="_vWgT1aKuEeKVq9bLGfaZZA" conditionText="opname == "get"+attname.substring(0,1).toUpperCase()+attname.substr(1)"/> + <mappings xmi:id="_vWgT1qKuEeKVq9bLGfaZZA" origin="_vWgTtqKuEeKVq9bLGfaZZA" image="_vWgTyKKuEeKVq9bLGfaZZA"/> + <mappings xmi:id="_vWgT16KuEeKVq9bLGfaZZA" origin="_vWgTuKKuEeKVq9bLGfaZZA" image="_vWgTyqKuEeKVq9bLGfaZZA"/> + <mappings xmi:id="_vWgT2KKuEeKVq9bLGfaZZA" origin="_vWgTuaKuEeKVq9bLGfaZZA" image="_vWgTz6KuEeKVq9bLGfaZZA"/> + </units> + <units xsi:type="henshin:Rule" xmi:id="_vWgT2aKuEeKVq9bLGfaZZA" name="create_setter"> + <parameters xmi:id="_vWgT2qKuEeKVq9bLGfaZZA" name="att"/> + <parameters xmi:id="_vWgT26KuEeKVq9bLGfaZZA" name="attname"/> + <parameters xmi:id="_vWgT3KKuEeKVq9bLGfaZZA" name="opname"/> + <lhs xmi:id="_vWgT3aKuEeKVq9bLGfaZZA" name="LHS"> + <nodes xmi:id="_vWgT3qKuEeKVq9bLGfaZZA" name="att" incoming="_vWgT4qKuEeKVq9bLGfaZZA" outgoing="_vWgT46KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + <attributes xmi:id="_vWgT36KuEeKVq9bLGfaZZA" value="attname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgT4KKuEeKVq9bLGfaZZA" name="cl" outgoing="_vWgT4qKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/> + </nodes> + <nodes xmi:id="_vWgT4aKuEeKVq9bLGfaZZA" name="type" incoming="_vWgT46KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Type"/> + </nodes> + <edges xmi:id="_vWgT4qKuEeKVq9bLGfaZZA" source="_vWgT4KKuEeKVq9bLGfaZZA" target="_vWgT3qKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/> + </edges> + <edges xmi:id="_vWgT46KuEeKVq9bLGfaZZA" source="_vWgT3qKuEeKVq9bLGfaZZA" target="_vWgT4aKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/> + </edges> + <formula xsi:type="henshin:Not" xmi:id="_vWiI0KKuEeKVq9bLGfaZZA"> + <child xsi:type="henshin:NestedCondition" xmi:id="_vWgT5KKuEeKVq9bLGfaZZA"> + <conclusion xmi:id="_vWgT5aKuEeKVq9bLGfaZZA"> + <nodes xmi:id="_vWgT5qKuEeKVq9bLGfaZZA" name="cl" outgoing="_vWgT66KuEeKVq9bLGfaZZA _vWgT7KKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/> + </nodes> + <nodes xmi:id="_vWgT56KuEeKVq9bLGfaZZA" name="exop" incoming="_vWgT66KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Operation"/> + <attributes xmi:id="_vWgT6KKuEeKVq9bLGfaZZA" value="opname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgT6aKuEeKVq9bLGfaZZA" name="att" incoming="_vWgT7KKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + <attributes xmi:id="_vWgT6qKuEeKVq9bLGfaZZA" value="attname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <edges xmi:id="_vWgT66KuEeKVq9bLGfaZZA" source="_vWgT5qKuEeKVq9bLGfaZZA" target="_vWgT56KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/ownedOperation"/> + </edges> + <edges xmi:id="_vWgT7KKuEeKVq9bLGfaZZA" source="_vWgT5qKuEeKVq9bLGfaZZA" target="_vWgT6aKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/> + </edges> + </conclusion> + <mappings xmi:id="_vWgT7aKuEeKVq9bLGfaZZA" origin="_vWgT4KKuEeKVq9bLGfaZZA" image="_vWgT5qKuEeKVq9bLGfaZZA"/> + <mappings xmi:id="_vWgT7qKuEeKVq9bLGfaZZA" origin="_vWgT3qKuEeKVq9bLGfaZZA" image="_vWgT6aKuEeKVq9bLGfaZZA"/> + </child> + </formula> + </lhs> + <rhs xmi:id="_vWgT76KuEeKVq9bLGfaZZA" name="RHS"> + <nodes xmi:id="_vWgT8KKuEeKVq9bLGfaZZA" name="att" incoming="_vWgT-aKuEeKVq9bLGfaZZA" outgoing="_vWgT_KKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Property"/> + <attributes xmi:id="_vWgT8aKuEeKVq9bLGfaZZA" value="attname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgT8qKuEeKVq9bLGfaZZA" name="cl" outgoing="_vWgT-aKuEeKVq9bLGfaZZA _vWgT-qKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/> + </nodes> + <nodes xmi:id="_vWgT86KuEeKVq9bLGfaZZA" name="op" incoming="_vWgT-qKuEeKVq9bLGfaZZA" outgoing="_vWgT-6KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Operation"/> + <attributes xmi:id="_vWgT9KKuEeKVq9bLGfaZZA" value=""set"+attname.substring(0,1).toUpperCase()+attname.substr(1)"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgT9aKuEeKVq9bLGfaZZA" name="inpar" incoming="_vWgT-6KuEeKVq9bLGfaZZA" outgoing="_vWgT_aKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Parameter"/> + <attributes xmi:id="_vWgT9qKuEeKVq9bLGfaZZA" value=""in""> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/direction"/> + </attributes> + <attributes xmi:id="_vWgT96KuEeKVq9bLGfaZZA" value="attname"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/> + </attributes> + </nodes> + <nodes xmi:id="_vWgT-KKuEeKVq9bLGfaZZA" name="type" incoming="_vWgT_KKuEeKVq9bLGfaZZA _vWgT_aKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Type"/> + </nodes> + <edges xmi:id="_vWgT-aKuEeKVq9bLGfaZZA" source="_vWgT8qKuEeKVq9bLGfaZZA" target="_vWgT8KKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/> + </edges> + <edges xmi:id="_vWgT-qKuEeKVq9bLGfaZZA" source="_vWgT8qKuEeKVq9bLGfaZZA" target="_vWgT86KuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/ownedOperation"/> + </edges> + <edges xmi:id="_vWgT-6KuEeKVq9bLGfaZZA" source="_vWgT86KuEeKVq9bLGfaZZA" target="_vWgT9aKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//BehavioralFeature/ownedParameter"/> + </edges> + <edges xmi:id="_vWgT_KKuEeKVq9bLGfaZZA" source="_vWgT8KKuEeKVq9bLGfaZZA" target="_vWgT-KKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/> + </edges> + <edges xmi:id="_vWgT_aKuEeKVq9bLGfaZZA" source="_vWgT9aKuEeKVq9bLGfaZZA" target="_vWgT-KKuEeKVq9bLGfaZZA"> + <type href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/> + </edges> + </rhs> + <attributeConditions xmi:id="_vWg6sKKuEeKVq9bLGfaZZA" conditionText="opname == "set"+attname.substring(0,1).toUpperCase()+attname.substr(1)"/> + <mappings xmi:id="_vWg6saKuEeKVq9bLGfaZZA" origin="_vWgT3qKuEeKVq9bLGfaZZA" image="_vWgT8KKuEeKVq9bLGfaZZA"/> + <mappings xmi:id="_vWg6sqKuEeKVq9bLGfaZZA" origin="_vWgT4KKuEeKVq9bLGfaZZA" image="_vWgT8qKuEeKVq9bLGfaZZA"/> + <mappings xmi:id="_vWg6s6KuEeKVq9bLGfaZZA" origin="_vWgT4aKuEeKVq9bLGfaZZA" image="_vWgT-KKuEeKVq9bLGfaZZA"/> + </units> +</henshin:Module>
diff --git a/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_execute.henshin_diagram b/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_execute.henshin_diagram new file mode 100644 index 0000000..6332331 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24.henshin/transformation/hide_attribute_execute.henshin_diagram
@@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:henshin="http://www.eclipse.org/emf/2011/Henshin" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_5E_DwKKxEeKVq9bLGfaZZA" type="Henshin" measurementUnit="Pixel"> + <styles xmi:type="notation:DiagramStyle" xmi:id="_5E_DwaKxEeKVq9bLGfaZZA"/> + <element xmi:type="henshin:Module" href="hide_attribute_execute.henshin#_vVPIUKKuEeKVq9bLGfaZZA"/> +</notation:Diagram>
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController$1.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController$1.class new file mode 100644 index 0000000..84998c0 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController$1.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController$InternalRefactoringProcessor.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController$InternalRefactoringProcessor.class new file mode 100644 index 0000000..a217bf8 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController$InternalRefactoringProcessor.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController.class new file mode 100644 index 0000000..790a4e4 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringDataManagement.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringDataManagement.class new file mode 100644 index 0000000..5daf239 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringDataManagement.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringGuiHandler.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringGuiHandler.class new file mode 100644 index 0000000..e2afc04 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringGuiHandler.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest$1.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest$1.class new file mode 100644 index 0000000..bc7708f --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest$1.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest.class new file mode 100644 index 0000000..508f3f3 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizard.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizard.class new file mode 100644 index 0000000..75d18dc --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizard.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizardPage.class b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizardPage.class new file mode 100644 index 0000000..91d8e54 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/bin/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizardPage.class Binary files differ
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/plugin.xml b/org.eclipse.emf.refactor.refactorings.uml24/plugin.xml index dfeedf0..0421544 100644 --- a/org.eclipse.emf.refactor.refactorings.uml24/plugin.xml +++ b/org.eclipse.emf.refactor.refactorings.uml24/plugin.xml
@@ -1,6 +1,17 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <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 + controller="org.eclipse.emf.refactor.refactorings.uml24.addparameter.RefactoringController" + gui="org.eclipse.emf.refactor.refactorings.uml24.addparameter.RefactoringGuiHandler" + id="org.eclipse.emf.refactor.refactorings.uml24.addparameter" + menulabel="Add Parameter" + namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML"/> +<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"/> </extension> </plugin>
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController.java b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController.java new file mode 100644 index 0000000..db66c33 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringController.java
@@ -0,0 +1,304 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringController.javajet,v 1.3 2011/01/21 13:08:06 tarendt Exp $ + */ +package org.eclipse.emf.refactor.refactorings.uml24.addparameter; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.EList; +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.runtime.ltk.LtkEmfRefactoringProcessorAdapter; +import org.eclipse.emf.refactor.refactorings.uml24.UmlUtils; +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.Operation; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.UMLFactory; + + +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.Operation selectedEObject = + (org.eclipse.uml2.uml.Operation) dataManagement. + getInPortByName(dataManagement.SELECTEDEOBJECT).getValue(); + String paramName = + (String) dataManagement.getInPortByName("paramName").getValue(); + String paramType = + (String) dataManagement.getInPortByName("paramType").getValue(); + // execute: insert a new parameter with the specified name and type + // to the selected operation + Parameter param = UMLFactory.eINSTANCE.createParameter(); + param.setName(paramName); + EList<Type> types = UmlUtils.getTypes(selectedEObject.getModel()); + EList<NamedElement> typesWithName = + UmlUtils.getNamedElementsFromList(types, paramType); + param.setType((Type) typesWithName.get(0)); + selectedEObject.getOwnedParameters().add(param); + } + }; + } + + /** + * 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.Operation selectedEObject = + (org.eclipse.uml2.uml.Operation) dataManagement. + getInPortByName(dataManagement.SELECTEDEOBJECT).getValue(); + // test: the selected operation must be owned by a class + String msg = "This refactoring can only be applied" + + " on operations which are owned by a class!"; + if (selectedEObject.getClass_() == null) 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.Operation selectedEObject = + (org.eclipse.uml2.uml.Operation) dataManagement. + getInPortByName(dataManagement.SELECTEDEOBJECT).getValue(); + String paramName = + (String) dataManagement.getInPortByName("paramName").getValue(); + String paramType = + (String) dataManagement.getInPortByName("paramType").getValue(); + // test: the selected operation must not own a parameter with the + // specified name + String msg = "The selected operation already owns a parameter " + + "named '" + paramName + "'!"; + EList<Parameter> inputParameters = + UmlUtils.getInputParameterList(selectedEObject.getOwnedParameters()); + for (Parameter p : inputParameters) { + if (p.getName().equals(paramName)) result.addFatalError(msg); + } + // test: the specified type must exist + EList<Type> types = UmlUtils.getTypes(selectedEObject.getModel()); + EList<NamedElement> typesWithName = + UmlUtils.getNamedElementsFromList(types, paramType); + msg = "The specified type does not exist in the model!"; + if (typesWithName.isEmpty()) { + result.addFatalError(msg); + } else { + // test: the specified type exists multiply + msg = "The specified type exists multiply in the model!"; + if (typesWithName.size() > 1) { + result.addFatalError(msg); + } else { + // test: the owning class must not own an operation with the name + // of the contextual operation and a similar parameter list after + // inserting a parameter with the given name and type + msg = "The owning class already owns an operation named '" + + selectedEObject.getName() + "' having the same signature " + + "(type and parameter list) after inserting a parameter named '" + + paramName + "' with type '" + paramType + "'!"; + Class cl = selectedEObject.getClass_(); + if (classOwnsOperation(cl, selectedEObject, paramName, paramType)) + result.addFatalError(msg); + // test: the owning class must not own an operation with the name + // of the contextual operation and a similar parameter list after + // inserting a parameter with the given name and type + msg = "The owning class already inherits an operation named '" + + selectedEObject.getName() + "' having the same signature " + + "(type and parameter list) after inserting a parameter named '" + + paramName + "' with type '" + paramType + "'!"; + if (classInheritsOperation(cl, selectedEObject, paramName, paramType)) + result.addFatalError(msg); + } + } + return result; + } + + private boolean classInheritsOperation(Class cl, Operation operation, + String paramName, String paramType) { + // insert new parameter + Parameter param = UMLFactory.eINSTANCE.createParameter(); + param.setName(paramName); + EList<Type> types = UmlUtils.getTypes(operation.getModel()); + EList<NamedElement> typesWithName = + UmlUtils.getNamedElementsFromList(types, paramType); + param.setType((Type) typesWithName.get(0)); + operation.getOwnedParameters().add(param); + // test + for (NamedElement namedElement : cl.getInheritedMembers()) { + if (namedElement instanceof Operation) { + Operation inheritedOperation = (Operation) namedElement; + if (inheritedOperation.getName().equals(operation.getName()) + && UmlUtils.haveSameTypes(inheritedOperation, operation) + && UmlUtils.haveSameSignatures(inheritedOperation, operation)) { + // remove temporary parameter and return + operation.getOwnedParameters().remove(param); + return true; + } + } + } + // remove temporary parameter + operation.getOwnedParameters().remove(param); + return false; + } + + private boolean classOwnsOperation(Class cl, Operation operation, + String paramName, String paramType) { + // insert new parameter + Parameter param = UMLFactory.eINSTANCE.createParameter(); + param.setName(paramName); + EList<Type> types = UmlUtils.getTypes(operation.getModel()); + EList<NamedElement> typesWithName = + UmlUtils.getNamedElementsFromList(types, paramType); + param.setType((Type) typesWithName.get(0)); + operation.getOwnedParameters().add(param); + // test + for (Operation op : cl.getOwnedOperations()) { + if (op != operation) { + if (op.getName().equals(operation.getName()) + && UmlUtils.haveSameTypes(op, operation) + && UmlUtils.haveSameSignatures(op, operation)) { + // remove temporary parameter and return + operation.getOwnedParameters().remove(param); + return true; + } + } + } + // remove temporary parameter + operation.getOwnedParameters().remove(param); + return false; + } + + } + +} \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringDataManagement.java b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringDataManagement.java new file mode 100644 index 0000000..485b94d --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringDataManagement.java
@@ -0,0 +1,60 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringDataManagement.javajet,v 1.2 2011/01/21 13:08:06 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.addparameter; + +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.Operation> + (SELECTEDEOBJECT, org.eclipse.uml2.uml.Operation.class)); + this.inPorts.add + (new Port<String> + ("paramName", String.class, "unspecified")); + this.inPorts.add + (new Port<String> + ("paramType", String.class, "unspecified")); + } + + /** + * @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.Operation) selection.get(0)); + } + +} + \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringGuiHandler.java b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringGuiHandler.java new file mode 100644 index 0000000..d167135 --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringGuiHandler.java
@@ -0,0 +1,76 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringGuiHandler.javajet,v 1.1 2010/07/15 13:08:44 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.addparameter; + +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.addparameter.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() > 1) return false; + for(EObject o:selection){ + if(null != o){ + if (o instanceof org.eclipse.uml2.uml.Operation) { + return true; + } + } + } + return false; + } + +} + \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest.java b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest.java new file mode 100644 index 0000000..3b87a9c --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringTest.java
@@ -0,0 +1,97 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringTest.javajet,v 1.2 2011/03/16 16:14:21 tarendt Exp $ + */ + +package org.eclipse.emf.refactor.refactorings.uml24.addparameter; + +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.refactor.refactoring.core.Refactoring; +import org.eclipse.emf.refactor.refactoring.runtime.test.JUnitTestCaseAdapter; +import org.eclipse.uml2.uml.UMLPackage; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * Class used for running individual JUnit test cases + * of the specific model refactoring. + * @generated + */ +@RunWith(value = Parameterized.class) +public class RefactoringTest extends JUnitTestCaseAdapter { + + /** + * Number of test cases. + * @generated + */ + private String number; + + /** + * Constructor implementation. + * @param number Number of test cases. + * @generated + */ + public RefactoringTest(String number) throws IOException { + super("de.unimarburg.swt.refactorings.uml.addparameter", + "uml", + new File(".").getCanonicalPath(), + new Refactoring(null, "", "http://www.eclipse.org/uml2/3.0.0/UML", new RefactoringGuiHandler(), new RefactoringController())); + register(UMLPackage.eINSTANCE); + this.number = number; + } + + @Parameters + public static Collection<Object[]> data() { + List<String> testNumbers = getTestNumbers(); + Object[][] data = new Object[testNumbers.size()][1]; + for (int i = 0; i < testNumbers.size(); i++) { + data[i][0] = testNumbers.get(i); + } + return Arrays.asList(data); + } + + private static List<String> getTestNumbers() { + List<String> numbers = new ArrayList<String>(); + try { + String pathPrefix = new File(".").getCanonicalPath() + "/tests/" + "de.unimarburg.swt.refactorings.uml.addparameter"; + File testCaseDir = new File(pathPrefix,"/"); + FilenameFilter filter = new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.startsWith("test_"); + } + }; + String[] children = testCaseDir.list(filter); + if (children != null) { + for (String child : children) { + numbers.add( + child.substring( + child.indexOf('_') + 1)); + } + } + } catch (IOException e) { + e.printStackTrace(); + } + return numbers; + } + + /** + * Runs the test. + */ + @Test + public void test() { + System.out.println("running test test_" + number); + executeTestCase(number); + } + +} \ No newline at end of file
diff --git a/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizard.java b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizard.java new file mode 100644 index 0000000..4a7368a --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/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.addparameter; + +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.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizardPage.java b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizardPage.java new file mode 100644 index 0000000..4fb657b --- /dev/null +++ b/org.eclipse.emf.refactor.refactorings.uml24/src/org/eclipse/emf/refactor/refactorings/uml24/addparameter/RefactoringWizardPage.java
@@ -0,0 +1,161 @@ +/** + * <copyright> + * </copyright> + * + * $Id: RefactoringWizardPage.javajet,v 1.1 2010/07/15 13:08:44 tarendt Exp $ + */ + package org.eclipse.emf.refactor.refactorings.uml24.addparameter; + +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.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 paramNameLabel; + + /** + * TextField for each parameter. + * @generated + */ + private Text paramNameWidget; + /** + * Label for each parameter. + * @generated + */ + private Label paramTypeLabel; + + /** + * TextField for each parameter. + * @generated + */ + private Text paramTypeWidget; + + /** + * 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 (paramNameWidget != null) { + String paramName = paramNameWidget.getText(); + if (!paramName.isEmpty()){ + ((RefactoringDataManagement) + this.controller.getDataManagementObject()). + getInPortByName("paramName"). + setValue(paramName); + } else { + ((RefactoringDataManagement) + this.controller.getDataManagementObject()). + getInPortByName("paramName"). + setValue("unspecified"); + } + } + if (paramTypeWidget != null) { + String paramType = paramTypeWidget.getText(); + if (!paramType.isEmpty()){ + ((RefactoringDataManagement) + this.controller.getDataManagementObject()). + getInPortByName("paramType"). + setValue(paramType); + } else { + ((RefactoringDataManagement) + this.controller.getDataManagementObject()). + getInPortByName("paramType"). + 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); + + + paramNameLabel = new Label(composite, SWT.NONE); + paramNameLabel.setText("Name of the new parameter: "); + paramNameLabel.setEnabled(true); + + paramNameWidget = new Text(composite, SWT.BORDER); + paramNameWidget.setToolTipText + ("value of variable 'paramName'"); + paramNameWidget.setEnabled(true); + paramNameWidget.setLayoutData(gd); + paramNameWidget.addListener(SWT.Modify, this); + + + paramTypeLabel = new Label(composite, SWT.NONE); + paramTypeLabel.setText("Type of the new parameter: "); + paramTypeLabel.setEnabled(true); + + paramTypeWidget = new Text(composite, SWT.BORDER); + paramTypeWidget.setToolTipText + ("value of variable 'paramType'"); + paramTypeWidget.setEnabled(true); + paramTypeWidget.setLayoutData(gd); + paramTypeWidget.addListener(SWT.Modify, this); + + 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