Coverage Report - org.argouml.model.euml.ExtensionMechanismsFactoryEUMLImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ExtensionMechanismsFactoryEUMLImpl
0%
0/25
N/A
1.062
ExtensionMechanismsFactoryEUMLImpl$1
0%
0/7
0%
0/2
1.062
ExtensionMechanismsFactoryEUMLImpl$2
0%
0/3
N/A
1.062
 
 1  
 // $Id: ExtensionMechanismsFactoryEUMLImpl.java 19079 2011-02-27 17:02:41Z bobtarling $
 2  
 /*******************************************************************************
 3  
  * Copyright (c) 2007,2010 Tom Morris and other contributors
 4  
  * All rights reserved. This program and the accompanying materials
 5  
  * are made available under the terms of the Eclipse Public License v1.0
 6  
  * which accompanies this distribution, and is available at
 7  
  * http://www.eclipse.org/legal/epl-v10.html
 8  
  *
 9  
  * Contributors:
 10  
  *    Tom Morris - initial implementation
 11  
  *    thn
 12  
  *****************************************************************************/
 13  
 
 14  
 package org.argouml.model.euml;
 15  
 
 16  
 import java.util.Collection;
 17  
 
 18  
 import org.argouml.model.AbstractModelFactory;
 19  
 import org.argouml.model.ExtensionMechanismsFactory;
 20  
 import org.eclipse.emf.edit.domain.EditingDomain;
 21  
 import org.eclipse.uml2.uml.Namespace;
 22  
 import org.eclipse.uml2.uml.Package;
 23  
 import org.eclipse.uml2.uml.Stereotype;
 24  
 import org.eclipse.uml2.uml.UMLFactory;
 25  
 
 26  
 /**
 27  
  * The implementation of the ExtensionMechanismsFactory for EUML2.
 28  
  */
 29  0
 class ExtensionMechanismsFactoryEUMLImpl implements
 30  
         ExtensionMechanismsFactory, AbstractModelFactory {
 31  
 
 32  
     /**
 33  
      * The model implementation.
 34  
      */
 35  
     private EUMLModelImplementation modelImpl;
 36  
     private EditingDomain editingDomain;
 37  
 
 38  
 
 39  
     /**
 40  
      * Constructor.
 41  
      * 
 42  
      * @param implementation
 43  
      *            The ModelImplementation.
 44  
      */
 45  
     public ExtensionMechanismsFactoryEUMLImpl(
 46  0
             EUMLModelImplementation implementation) {
 47  0
         modelImpl = implementation;
 48  0
         editingDomain = implementation.getEditingDomain();
 49  0
     }
 50  
 
 51  
     public Stereotype buildStereotype(Object element, Object name,
 52  
             Object namespace) {
 53  0
         Stereotype stereo = buildStereotype((String) name, 
 54  
                 (Namespace) namespace);
 55  
         // TODO: Add base classes - the following might not even be close!
 56  
 //        for (Class i : ((Element) element).getClass().getInterfaces()) {
 57  
 //            if (i instanceof umlmetaclass) {
 58  
 //                stereo.getExtendedMetaclasses().add(i);
 59  
 //            }
 60  
 //        }
 61  0
         return stereo;
 62  
     }
 63  
 
 64  
     public Object buildStereotype(Object element, String name,
 65  
             Object model, Collection models) {
 66  
         // TODO: Auto-generated method stub
 67  0
         return null;
 68  
     }
 69  
 
 70  
     public Stereotype buildStereotype(final String name, final Object namespace) {
 71  0
         RunnableClass run = new RunnableClass() {
 72  
             public void run() {
 73  0
                 Stereotype stereo = createStereotype();
 74  0
                 stereo.setName(name);
 75  0
                 if (namespace instanceof Package) {
 76  0
                     stereo.setPackage((Package) namespace);
 77  
                 }
 78  0
                 getParams().add(stereo);
 79  0
         }
 80  
         };
 81  0
         ChangeCommand cmd = new ChangeCommand(
 82  
                 modelImpl, run,
 83  
                 "Build a stereotype");
 84  0
         editingDomain.getCommandStack().execute(cmd);
 85  
 //        cmd.setObjects(run.getParams().get(0));
 86  0
         return (Stereotype) run.getParams().get(0);
 87  
     }
 88  
 
 89  
     public Object buildTagDefinition(String name, Object stereotype, Object ns) {
 90  
         // TODO: Auto-generated method stub
 91  0
         return null;
 92  
     }
 93  
     
 94  
     public Object buildTagDefinition(String name, Object stereotype, 
 95  
             Object namespace, String tagType) {
 96  
         // TODO: Auto-generated method stub
 97  0
         return null;
 98  
     }
 99  
 
 100  
     @Deprecated
 101  
     public Object buildTaggedValue(String tag, String value) {
 102  
         // TODO: Auto-generated method stub
 103  0
         return null;
 104  
     }
 105  
     
 106  
     public Object buildTaggedValue(Object type, String[] value) {
 107  
         // TODO: Auto-generated method stub
 108  0
         return null;
 109  
     }
 110  
 
 111  
     public Stereotype copyStereotype(Object source, Object ns) {
 112  
         // TODO: Auto-generated method stub
 113  0
         return null;
 114  
     }
 115  
 
 116  
     public Object copyTagDefinition(Object aTd, Object aNs) {
 117  
         // TODO: Auto-generated method stub
 118  0
         return null;
 119  
     }
 120  
 
 121  
     public void copyTaggedValues(Object source, Object target) {
 122  
         // TODO: Auto-generated method stub
 123  
 
 124  0
     }
 125  
 
 126  
     public Stereotype createStereotype() {
 127  0
         RunnableClass run = new RunnableClass() {
 128  
             public void run() {
 129  0
                 getParams().add(UMLFactory.eINSTANCE.createStereotype());
 130  0
             }
 131  
         };
 132  0
         ChangeCommand cmd = new ChangeCommand(
 133  
                 modelImpl, run,
 134  
                 "Create a stereotype");
 135  0
         editingDomain.getCommandStack().execute(cmd);
 136  
 //        cmd.setObjects(run.getParams().get(0));
 137  0
         return (Stereotype) run.getParams().get(0);
 138  
     }
 139  
 
 140  
     public Object createTagDefinition() {
 141  0
         return UMLFactory.eINSTANCE.createProperty();
 142  
     }
 143  
 
 144  
     public Object createTaggedValue() {
 145  
         // TODO: Auto-generated method stub
 146  0
         return null;
 147  
     }
 148  
 }