[ArchiMate 3.2] Swap more figure types from 0 to 1
These ones originally had only one figure type
*/
package com.archimatetool.editor.model.compatibility.handlers;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import com.archimatetool.editor.model.compatibility.CompatibilityHandlerException;
import com.archimatetool.editor.model.compatibility.ICompatibilityHandler;
import com.archimatetool.editor.utils.StringUtils;
+import com.archimatetool.model.FolderType;
import com.archimatetool.model.IArchimateElement;
import com.archimatetool.model.IArchimateModel;
import com.archimatetool.model.IArchimatePackage;
@@ -43,21 +47,30 @@ public class Archimate32Handler implements ICompatibilityHandler {
}
void setDefaultFigures(IArchimateModel model) {
- for(Iterator<EObject> iter = model.eAllContents(); iter.hasNext();) {
+ Set<EClass> set = new HashSet<>();
+ set.add(IArchimatePackage.eINSTANCE.getGrouping());
+ set.add(IArchimatePackage.eINSTANCE.getBusinessObject());
+ set.add(IArchimatePackage.eINSTANCE.getContract());
+ set.add(IArchimatePackage.eINSTANCE.getRepresentation());
+ set.add(IArchimatePackage.eINSTANCE.getProduct());
+ set.add(IArchimatePackage.eINSTANCE.getDataObject());
+ set.add(IArchimatePackage.eINSTANCE.getMeaning());
+ set.add(IArchimatePackage.eINSTANCE.getValue());
+ set.add(IArchimatePackage.eINSTANCE.getDeliverable());
+ set.add(IArchimatePackage.eINSTANCE.getApplicationComponent());
+ set.add(IArchimatePackage.eINSTANCE.getArtifact());
+ set.add(IArchimatePackage.eINSTANCE.getDevice());
+ set.add(IArchimatePackage.eINSTANCE.getNode());
+
+ for(Iterator<EObject> iter = model.getFolder(FolderType.DIAGRAMS).eAllContents(); iter.hasNext();) {
EObject eObject = iter.next();
if(eObject instanceof IDiagramModelArchimateObject) {
IDiagramModelArchimateObject dmo = (IDiagramModelArchimateObject)eObject;
IArchimateElement element = dmo.getArchimateElement();
- if(element.eClass() == IArchimatePackage.eINSTANCE.getGrouping()
- || element.eClass() == IArchimatePackage.eINSTANCE.getApplicationComponent()
- || element.eClass() == IArchimatePackage.eINSTANCE.getArtifact()
- || element.eClass() == IArchimatePackage.eINSTANCE.getDevice()
- || element.eClass() == IArchimatePackage.eINSTANCE.getNode()) {
-
+ if(set.contains(element.eClass())) {
dmo.setType(dmo.getType() ^ 1);
}
}
}
}
-
}
