You can subscribe to this list here.
| 2006 |
Jan
(30) |
Feb
(15) |
Mar
(1) |
Apr
(14) |
May
(31) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
(53) |
Nov
(6) |
Dec
|
|---|
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:35
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/exporters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/src/net/sourceforge/modelWizard/chameleon/exporters Modified Files: UmlOutExport.java Log Message: prior to release Index: UmlOutExport.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/exporters/UmlOutExport.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UmlOutExport.java 26 Jan 2006 15:15:54 -0000 1.3 --- UmlOutExport.java 19 Apr 2006 21:26:27 -0000 1.4 *************** *** 49,53 **** "Name of extract","Model Extract")); params.put(EXTRACT_DESC,new StringExportParameter(EXTRACT_DESC,"Description","")); ! params.put(BASE_PACKAGE,new StringExportParameter(BASE_PACKAGE,"Base package for export","com.cisco.nm.imo")); return params; } --- 49,53 ---- "Name of extract","Model Extract")); params.put(EXTRACT_DESC,new StringExportParameter(EXTRACT_DESC,"Description","")); ! params.put(BASE_PACKAGE,new StringExportParameter(BASE_PACKAGE,"Base package for export","com.cisco.nm.cmp")); return params; } |
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:33
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/xsl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/xsl Modified Files: createProfile.xsl Log Message: prior to release Index: createProfile.xsl =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/xsl/createProfile.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** createProfile.xsl 7 Dec 2005 18:17:35 -0000 1.1 --- createProfile.xsl 19 Apr 2006 21:26:26 -0000 1.2 *************** *** 1,52 **** ! <?xml version="1.0" encoding="UTF-8"?> ! <?altova_samplexml C:\Documents and Settings\stjerman\My Documents\Eclipse Workspaces\runtime-workspace\Model Wizard\blueprints\AccessPoints.xml?> ! <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:uml="http://www.eclipse.org/uml2/1.0.0/UML"> ! <xsl:template match="/"> ! <xsl:apply-templates select="cimPackage"/> ! </xsl:template> ! <xsl:template match="cimPackage"> ! <xsl:element name="profile"> ! <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> ! <xsl:attribute name="organization">CISCO</xsl:attribute> ! <xsl:attribute name="version"><xsl:value-of select="@version"/></xsl:attribute> ! <xsl:attribute name="modelVersion"><xsl:value-of select="//cim-cx/@version"/></xsl:attribute> ! <xsl:attribute name="cvsVersion">$Revision$</xsl:attribute> ! <xsl:attribute name="type">PRELIMINARY</xsl:attribute> ! <synopsis> ! <xsl:value-of select="description"/> ! </synopsis> ! <elements> ! <xsl:apply-templates select="./cimClass"/> ! <diagramPage pageNo="1" id="p1"> ! <pageTitle>Profile Diagram</pageTitle> ! <pageTab>Diagram</pageTab> ! </diagramPage> ! </elements> ! </xsl:element> ! </xsl:template> ! <xsl:template match="cimClass"> ! <xsl:choose> ! <xsl:when test="@isAssoc"> ! </xsl:when> ! <xsl:otherwise> ! <xsl:element name="class"> ! <xsl:attribute name="className"><xsl:value-of select="@name"/></xsl:attribute> ! <xsl:attribute name="requirementsLevel">CONDITIONAL</xsl:attribute> ! <xsl:attribute name="isTop">false</xsl:attribute> ! <description> ! <xsl:value-of select="description"/> ! </description> ! <xsl:apply-templates select="cimProperty[cimQualifier/@name='Required']"> ! <xsl:sort select="@name"/> ! </xsl:apply-templates> ! </xsl:element> ! </xsl:otherwise> ! </xsl:choose> ! </xsl:template> ! <xsl:template match="cimProperty"> ! <xsl:element name="property"> ! <xsl:attribute name="propertyName"><xsl:value-of select="@name"/></xsl:attribute> ! <xsl:attribute name="requirementsLevel">MANDATORY</xsl:attribute> ! </xsl:element> ! </xsl:template> ! </xsl:stylesheet> --- 1,52 ---- ! <?xml version="1.0" encoding="UTF-8"?> ! <?altova_samplexml C:\Documents and Settings\stjerman\My Documents\Eclipse Workspaces\runtime-workspace\Model Wizard\blueprints\AccessPoints.xml?> ! <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:uml="http://www.eclipse.org/uml2/1.0.0/UML"> ! <xsl:template match="/"> ! <xsl:apply-templates select="cimPackage"/> ! </xsl:template> ! <xsl:template match="cimPackage"> ! <xsl:element name="profile"> ! <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> ! <xsl:attribute name="organization">CISCO</xsl:attribute> ! <xsl:attribute name="version"><xsl:value-of select="@version"/></xsl:attribute> ! <xsl:attribute name="modelVersion"><xsl:value-of select="//cim-cx/@version"/></xsl:attribute> ! <xsl:attribute name="cvsVersion">$Revision$</xsl:attribute> ! <xsl:attribute name="type">PRELIMINARY</xsl:attribute> ! <synopsis> ! <xsl:value-of select="description"/> ! </synopsis> ! <elements> ! <xsl:apply-templates select="./cimClass"/> ! <diagramPage pageNo="1" id="p1"> ! <pageTitle>Profile Diagram</pageTitle> ! <pageTab>Diagram</pageTab> ! </diagramPage> ! </elements> ! </xsl:element> ! </xsl:template> ! <xsl:template match="cimClass"> ! <xsl:choose> ! <xsl:when test="@isAssoc"> ! </xsl:when> ! <xsl:otherwise> ! <xsl:element name="class"> ! <xsl:attribute name="className"><xsl:value-of select="@name"/></xsl:attribute> ! <xsl:attribute name="requirementsLevel">CONDITIONAL</xsl:attribute> ! <xsl:attribute name="isTop">false</xsl:attribute> ! <description> ! <xsl:value-of select="description"/> ! </description> ! <xsl:apply-templates select="cimProperty[cimQualifier/@name='Required']"> ! <xsl:sort select="@name"/> ! </xsl:apply-templates> ! </xsl:element> ! </xsl:otherwise> ! </xsl:choose> ! </xsl:template> ! <xsl:template match="cimProperty"> ! <xsl:element name="property"> ! <xsl:attribute name="propertyName"><xsl:value-of select="@name"/></xsl:attribute> ! <xsl:attribute name="requirementsLevel">MANDATORY</xsl:attribute> ! </xsl:element> ! </xsl:template> ! </xsl:stylesheet> |
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:33
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/transforms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/src/net/sourceforge/modelWizard/chameleon/transforms Modified Files: MofTransformer.java CimV2QualifierDeclarations.java Log Message: prior to release Index: MofTransformer.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/transforms/MofTransformer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MofTransformer.java 12 Jan 2006 07:43:23 -0000 1.3 --- MofTransformer.java 19 Apr 2006 21:26:27 -0000 1.4 *************** *** 1,3 **** ! package net.sourceforge.modelWizard.chameleon.transforms; import java.io.StringBufferInputStream; --- 1,3 ---- ! package net.sourceforge.modelWizard.chameleon.transforms; import java.io.StringBufferInputStream; *************** *** 47,51 **** public static MofTransformer INSTANCE = new MofTransformer(); ! private static final String CLASS_PREFIX="CHAMELEON_"; public MofQualifierFactoryImpl qualifierFactory = new MofQualifierFactoryImpl(); --- 47,51 ---- public static MofTransformer INSTANCE = new MofTransformer(); ! private static final String CLASS_PREFIX="Cisco_"; public MofQualifierFactoryImpl qualifierFactory = new MofQualifierFactoryImpl(); *************** *** 103,107 **** outputMof = outputMof +"// Qualifier Definitions\n"; outputMof = outputMof +"//##################################################\n"; ! outputMof = outputMof + addQualifiersDeclarations(); //then add the classes ordered by inOrder --- 103,107 ---- outputMof = outputMof +"// Qualifier Definitions\n"; outputMof = outputMof +"//##################################################\n"; ! outputMof = outputMof + addQualifiersDeclarations(theModel); //then add the classes ordered by inOrder *************** *** 117,122 **** } ! private String addQualifiersDeclarations() { ! return CimV2QualifierDeclarations.getMofDeclarations(); } --- 117,122 ---- } ! private String addQualifiersDeclarations(Model model) throws ModelTransformationException { ! return CimV2QualifierDeclarations.getMofDeclarations(model); } *************** *** 289,292 **** --- 289,294 ---- elements.add(createFakeKey()); addProperties(c, UmlUtilities.getProperties(c,false), elements,classDependencies); + if (c instanceof AssociationClass) + addProperties(c, ((AssociationClass)c).getMemberEnds().iterator(), elements,classDependencies); addMethods(c, elements,classDependencies); *************** *** 395,399 **** if (p.getAppliedStereotype("MODEL::ComplexDataType")!= null){ ArrayList tmp = new ArrayList(); ! handleComplexType(p,tmp,classDependencies); Iterator i = tmp.iterator(); while (i.hasNext()){ --- 397,401 ---- if (p.getAppliedStereotype("MODEL::ComplexDataType")!= null){ ArrayList tmp = new ArrayList(); ! handleComplexType(p,tmp,classDependencies,p.isMultivalued()); Iterator i = tmp.iterator(); while (i.hasNext()){ *************** *** 462,466 **** if (p.getAppliedStereotype("MODEL::ComplexDataType")!= null){ //handle complex type ... ! handleComplexType(p,elements,classDependencies); } else { String pStr = " "; --- 464,468 ---- if (p.getAppliedStereotype("MODEL::ComplexDataType")!= null){ //handle complex type ... ! handleComplexType(p,elements,classDependencies,p.isMultivalued()); } else { String pStr = " "; *************** *** 525,537 **** } ! private void addComplexInfo(Class c, ArrayList typeNames, ArrayList valueNames,String baseName, ArrayList elements ){ //handle properties and then cycle through class specializations. EList ps = c.getOwnedAttributes(); if (ps.size()>0) { - typeNames.add(c.getName()); String comment = UmlUtilities.getComment(c); if (!comment.equals("")) elements.add ("//"+c.getName()+" : "+comment); } Iterator ip = ps.iterator(); while (ip.hasNext()){ --- 527,542 ---- } ! private void addComplexInfo(Class c, String baseName, ArrayList elements, ! ArrayList dependencies, boolean multiValued) throws ModelTransformationException{ //handle properties and then cycle through class specializations. EList ps = c.getOwnedAttributes(); if (ps.size()>0) { String comment = UmlUtilities.getComment(c); if (!comment.equals("")) elements.add ("//"+c.getName()+" : "+comment); } + String base = baseName+"_"; + if (!UmlUtilities.getSpecializations(c).isEmpty()) + base = baseName+"_"+c.getName()+"_"; Iterator ip = ps.iterator(); while (ip.hasNext()){ *************** *** 539,546 **** Type t = p.getType(); if (p.getAppliedStereotype("MODEL::ComplexDataType")!= null){ ! addComplexInfo((Class)t,typeNames,valueNames,baseName+"-"+p.getName(), elements); ! } else ! if (!valueNames.contains(p.getName())) ! valueNames.add(p.getName()); } ArrayList a = UmlUtilities.getSpecializations(c); --- 544,560 ---- Type t = p.getType(); if (p.getAppliedStereotype("MODEL::ComplexDataType")!= null){ ! addComplexInfo((Class)t,base+p.getName(), elements,dependencies, multiValued); ! } else { ! elements.add(parseProp(p,base,multiValued)); ! if (p.isMultivalued() && multiValued){ ! ArrayList q = new ArrayList(); ! String pName = base+p.getName()+"_index"; ! q.add( (qualifierFactory.createStringQualifier("Description","Index into "+p.getName()))); ! String quals = printQualifiers(" ",q); ! String indexProp = quals + "\n" + " uint16 "+pName+"[];"; ! elements.add(indexProp); ! } ! } ! } ArrayList a = UmlUtilities.getSpecializations(c); *************** *** 551,558 **** baseName = s.getName(); else ! baseName = baseName+"-"+s.getName(); ! addComplexInfo(s,typeNames,valueNames,baseName,elements); } ! } --- 565,612 ---- baseName = s.getName(); else ! baseName = baseName+s.getName(); ! addComplexInfo(s,baseName+c.getName(),elements,dependencies,multiValued); } ! } ! ! private String parseProp(Property prop, String base, boolean multiValued) throws ModelTransformationException{ ! String pStr = " "; ! String pName = base+prop.getName(); ! Type t = prop.getType(); ! ArrayList q = qualListFactory.getQualifiers(prop); ! if (t instanceof PrimitiveType){ ! if (!UmlUtilities.getComment(prop).equals("")) ! q.add(qualifierFactory.createStringQualifier("Description",UmlUtilities.getComment(prop))); ! String mappedType = MofTypeMap.INSTANCE.getMappedTypeName(t.getName()); ! pStr = pStr + mappedType +" "+pName; ! if (prop.isMultivalued() || multiValued){ ! if (prop.getUpper()!= MultiplicityElement.UNLIMITED_UPPER_BOUND && !multiValued) ! pStr = pStr + "[" +Integer.toString(prop.getUpper()) +"];"; ! else ! pStr = pStr + "[];"; ! } else ! pStr = pStr +";"; ! } else if (t instanceof Enumeration) { ! pStr = pStr + "uint32 "+pName; ! if (prop.isMultivalued() || multiValued){ ! if (prop.getUpper()!= MultiplicityElement.UNLIMITED_UPPER_BOUND && !multiValued) ! pStr = pStr + "[" +Integer.toString(prop.getUpper()) +"];"; ! else ! pStr = pStr + "[];"; ! } else ! pStr = pStr +";"; ! if (!UmlUtilities.getComment(prop).equals("")) ! q.add(qualifierFactory.createStringQualifier("Description",UmlUtilities.getComment(prop))); ! q.addAll(qualifierFactory.mapEnumToQualifiers((Enumeration) t)); ! } else if (t instanceof Class){ ! pStr += "string "+pName; ! if (prop.isMultivalued() || multiValued) ! pStr = pStr + "[];"; ! else ! pStr = pStr +";"; ! } else { ! throw new ModelTransformationException("Model format error 4 "+t.toString()); ! } ! return printQualifiers(" ",q) +"\n "+ pStr; } *************** *** 573,581 **** } ! private void handleComplexType(TypedElement p, ArrayList elements, ArrayList classDependencies) throws ModelTransformationException { if (!(p.getType() instanceof Class)) throw new ModelTransformationException("Complex type should be a class!!! "+p.getQualifiedName()); ! ArrayList typeNames = new ArrayList(); ! ArrayList valueNames = new ArrayList(); Class ct = (Class) p.getType();; --- 627,634 ---- } ! private void handleComplexType(TypedElement p, ArrayList elements, ArrayList classDependencies, boolean multiValued) throws ModelTransformationException { if (!(p.getType() instanceof Class)) throw new ModelTransformationException("Complex type should be a class!!! "+p.getQualifiedName()); ! ArrayList types = new ArrayList(); Class ct = (Class) p.getType();; *************** *** 584,606 **** if (!comment.equals("")) elements.add ("//"+comment); - addComplexInfo (ct,typeNames,valueNames,"", elements); ! String dataTypeDef = ! " ["+ createValueMap(typeNames) +"]"+ ! "\n string "+p.getName()+"DataType;"; ! ! String propertyNamesDef = ! " ["+ createValueMap(valueNames) +",\n"+ ! " CrossIndexedArray(\""+ p.getName()+"PropertyValues" + "\")]\n"+ ! " string "+p.getName()+"PropertyNames[];"; ! ! String propertyValuesDef = ! " [CrossIndexedArray(\""+ p.getName()+"PropertyNames" + "\")]\n"+ ! " string "+p.getName()+"PropertyValues[];"; ! ! ! elements.add(dataTypeDef); ! elements.add(propertyNamesDef); ! elements.add(propertyValuesDef); elements.add("//**** end of complex type"); } --- 637,642 ---- if (!comment.equals("")) elements.add ("//"+comment); ! addComplexInfo (ct, p.getName(), elements, classDependencies, multiValued); elements.add("//**** end of complex type"); } Index: CimV2QualifierDeclarations.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/transforms/CimV2QualifierDeclarations.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CimV2QualifierDeclarations.java 12 Jan 2006 07:43:23 -0000 1.3 --- CimV2QualifierDeclarations.java 19 Apr 2006 21:26:27 -0000 1.4 *************** *** 8,11 **** --- 8,25 ---- import java.util.ArrayList; + import java.util.Iterator; + import java.util.Set; + + import net.sourceforge.modelWizard.backingModelAbstraction.ModelTransformationException; + + import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.uml2.Enumeration; + import org.eclipse.uml2.EnumerationLiteral; + import org.eclipse.uml2.Model; + import org.eclipse.uml2.Profile; + import org.eclipse.uml2.Class; + import org.eclipse.uml2.ProfileApplication; + import org.eclipse.uml2.Property; + import org.eclipse.uml2.Stereotype; /** *************** *** 28,287 **** private static int SCOPE_PARAMETER = 1<<7; - // qualifier defintions - private static CimV2QualifierDeclarations CASCADED_DELETE = new CimV2QualifierDeclarations( - "CascadedDelete", //name - "boolean", //TYPE - SCOPE_REFERENCE, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations COMPLEXDATATYPE = new CimV2QualifierDeclarations( - "ComplexDataType", //name - "boolean", //TYPE - SCOPE_PROPERTY | SCOPE_PROPERTY, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations CORRELATABLE = new CimV2QualifierDeclarations( - "Correlatable", //name - "string", //TYPE - SCOPE_PROPERTY, //SCOPE - true, //toSubclass - true, //isArray - true, //overrideable - null //defaultValue - ); - private static CimV2QualifierDeclarations COUNTER = new CimV2QualifierDeclarations( - "Counter", //name - "boolean", //TYPE - SCOPE_PROPERTY | SCOPE_PARAMETER, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations CROSSINDEXEDARRAY = new CimV2QualifierDeclarations( - "CrossIndexedArray", //name - "string", //TYPE - SCOPE_PROPERTY | SCOPE_PARAMETER, //SCOPE - true, //toSubclass - false, //isArray - true, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations DEPRECATED = new CimV2QualifierDeclarations( - "Deprecated", //name - "string", //TYPE - SCOPE_PROPERTY | SCOPE_ASSOCIATION | - SCOPE_CLASS | SCOPE_INDICATION | SCOPE_REFERENCE | SCOPE_METHOD, //SCOPE - true, //toSubclass - true, //isArray - true, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations DEVELOPMENTOWNER = new CimV2QualifierDeclarations( - "DevelopmentOwner", //name - "string", //TYPE - SCOPE_ASSOCIATION | SCOPE_CLASS | SCOPE_INDICATION , //SCOPE - false, //toSubclass - false, //isArray - false, //overrideable - null //defaultValue - ); - - - private static CimV2QualifierDeclarations EMBEDDEDENTITY = new CimV2QualifierDeclarations( - "EmbeddedEntity", //name - "boolean", //TYPE - SCOPE_PROPERTY | SCOPE_PARAMETER, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations EXPLICITGETSETNAMES = new CimV2QualifierDeclarations( - "ExplicitGetSetNames", //name - "boolean", //TYPE - SCOPE_CLASS | SCOPE_ASSOCIATION | SCOPE_INDICATION, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations EXTENSIBILITY = new CimV2QualifierDeclarations( - "Extensibility", //name - "uint32", //TYPE - SCOPE_PARAMETER | SCOPE_PROPERTY, //SCOPE - true, //toSubclass - true, //isArray - false, //overrideable - "0" //defaultValue - ); - - private static CimV2QualifierDeclarations GAUGE = new CimV2QualifierDeclarations( - "Gauge", //name - "boolean", //TYPE - SCOPE_PROPERTY | SCOPE_PARAMETER, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations KEY = new CimV2QualifierDeclarations( - "Key", //name - "boolean", //TYPE - SCOPE_REFERENCE | SCOPE_PROPERTY, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations INTERVALONLY = new CimV2QualifierDeclarations( - "IntervalOnly", //name - "boolean", //TYPE - SCOPE_PARAMETER | SCOPE_PROPERTY, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations INTERNALUSEONLY = new CimV2QualifierDeclarations( - "InternalUseOnly", //name - "boolean", //TYPE - SCOPE_CLASS | SCOPE_ASSOCIATION | SCOPE_INDICATION, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations MODELCORRESPONDENCE = new CimV2QualifierDeclarations( - "ModelCorrespondence", //name - "string", //TYPE - SCOPE_ASSOCIATION |SCOPE_PARAMETER | SCOPE_PROPERTY | SCOPE_REFERENCE | SCOPE_METHOD, //SCOPE - true, //toSubclass - true, //isArray - true, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations MAPPINGSTRINGS = new CimV2QualifierDeclarations( - "MappingStrings", //name - "string", //TYPE - SCOPE_ASSOCIATION | SCOPE_CLASS | SCOPE_PARAMETER | SCOPE_PROPERTY | SCOPE_REFERENCE | SCOPE_METHOD, //SCOPE - true, //toSubclass - true, //isArray - true, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations NAMEALIAS = new CimV2QualifierDeclarations( - "NameAlias", //name - "string", //TYPE - SCOPE_ASSOCIATION | SCOPE_CLASS | SCOPE_PARAMETER | SCOPE_PROPERTY | SCOPE_REFERENCE, //SCOPE - true, //toSubclass - false, //isArray - true, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations OVERRIDE = new CimV2QualifierDeclarations( - "Override", //name - "string", //TYPE - SCOPE_PARAMETER | SCOPE_PROPERTY | SCOPE_REFERENCE | SCOPE_METHOD, //SCOPE - true, //toSubclass - false, //isArray - true, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations OPCLASS = new CimV2QualifierDeclarations( - "OpClass", //name - "boolean", //TYPE - SCOPE_CLASS | SCOPE_ASSOCIATION, //SCOPE - true, //toSubclass - false, //isArray - true, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations PATTERNS = new CimV2QualifierDeclarations( - "Patterns", //name - "string", //TYPE - SCOPE_PROPERTY, //SCOPE - true, //toSubclass - true, //isArray - true, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations PRELIMINARY = new CimV2QualifierDeclarations( - "Preliminary", //name - "boolean", //TYPE - SCOPE_PROPERTY | SCOPE_ASSOCIATION | - SCOPE_CLASS | SCOPE_INDICATION | SCOPE_REFERENCE | SCOPE_METHOD, //SCOPE - false, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations PROPOSEDCHANGE = new CimV2QualifierDeclarations( - "ProposedChange", //name - "string", //TYPE - SCOPE_PROPERTY | SCOPE_ASSOCIATION | - SCOPE_CLASS | SCOPE_INDICATION | SCOPE_REFERENCE | SCOPE_METHOD, //SCOPE - false, //toSubclass - true, //isArray - false, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations PROVISIONAL = new CimV2QualifierDeclarations( - "Provisional", //name - "boolean", //TYPE - SCOPE_PROPERTY | SCOPE_ASSOCIATION | - SCOPE_CLASS | SCOPE_INDICATION | SCOPE_REFERENCE | SCOPE_METHOD, //SCOPE - false, //toSubclass - false, //isArray - false, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations UNITS = new CimV2QualifierDeclarations( - "Units", //name - "string", //TYPE - SCOPE_PROPERTY | SCOPE_PARAMETER, //SCOPE - true, //toSubclass - false, //isArray - true, //overrideable - null //defaultValue - ); - - private static CimV2QualifierDeclarations VERSION = new CimV2QualifierDeclarations( - "Version", //name - "string", //TYPE - SCOPE_CLASS |SCOPE_ASSOCIATION |SCOPE_INDICATION, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - null //defaultValue - ); - private static CimV2QualifierDeclarations ABSTRACT = new CimV2QualifierDeclarations( "Abstract", //name --- 42,46 ---- *************** *** 425,438 **** ); - private static CimV2QualifierDeclarations TYPEDEFINITION = new CimV2QualifierDeclarations( - "TypeDefintion", //name - "boolean", //TYPE - SCOPE_CLASS, //SCOPE - true, //toSubclass - false, //isArray - false, //overrideable - "true" //defaultValue - ); - private static CimV2QualifierDeclarations VALUES = new CimV2QualifierDeclarations( "Values", //name --- 184,187 ---- *************** *** 475,511 **** ); - private static CimV2QualifierDeclarations USERINSTANTIABLE = new CimV2QualifierDeclarations( - "UserInstantiable", //name - "boolean", //TYPE - SCOPE_CLASS | SCOPE_ASSOCIATION, //SCOPE - true, //toSubclass - false, //isArray - true, //overrideable - "false" //defaultValue - ); - - private static CimV2QualifierDeclarations TYPEOFURI = new CimV2QualifierDeclarations( - "TypeOfURI", //name - "string", //TYPE - SCOPE_PROPERTY | SCOPE_PARAMETER, //SCOPE - true, //toSubclass - true, //isArray - true, //overrideable - null //defaultValue - ); - //the collection private static CimV2QualifierDeclarations[] QUALIFIER_DECLARATIONS = { - CASCADED_DELETE, COMPLEXDATATYPE,CORRELATABLE,COUNTER, - CROSSINDEXEDARRAY, DEPRECATED, DEVELOPMENTOWNER, EMBEDDEDENTITY, - EXPLICITGETSETNAMES, EXTENSIBILITY, GAUGE, KEY, - INTERVALONLY, INTERNALUSEONLY, MODELCORRESPONDENCE, - MAPPINGSTRINGS, NAMEALIAS, OVERRIDE, PATTERNS, - PRELIMINARY, PROPOSEDCHANGE, PROVISIONAL, UNITS, VERSION, ABSTRACT, READ, MIN, MAX, IN, OUT, REQUIRED, ASSOCIATION, ! COMPOSITION, AGGREGATION, AGGREGATE, DESCRIPTION, TYPEDEFINITION, VALUES, ! VALUEMAP, OCTETSTRING, WRITE,EMBEDDEDOBJECT,INDICATION, OPCLASS, ! USERINSTANTIABLE, TYPEOFURI}; ! //this declaration private String mofText; --- 224,234 ---- ); //the collection private static CimV2QualifierDeclarations[] QUALIFIER_DECLARATIONS = { ABSTRACT, READ, MIN, MAX, IN, OUT, REQUIRED, ASSOCIATION, ! COMPOSITION, AGGREGATION, AGGREGATE, DESCRIPTION, VALUES, ! VALUEMAP, OCTETSTRING, WRITE, EMBEDDEDOBJECT, INDICATION }; ! ! //this declaration private String mofText; *************** *** 568,572 **** return mof; } ! --- 291,365 ---- return mof; } ! ! public static String getMofDeclarations(Model model) throws ModelTransformationException{ ! String qualDefs = getMofDeclarations(); ! Profile modelprofile = null; ! for (Iterator pi = model.getAppliedProfiles().iterator();pi.hasNext();){ ! ProfileApplication p = (ProfileApplication) pi.next(); ! Profile prof = p.getImportedProfile(); ! if (prof.getName().equals("MODEL")){ ! modelprofile = prof; ! } ! } ! if (modelprofile==null) ! throw new ModelTransformationException("Cannot find Chameleon UML profile."); ! for (Iterator pi = modelprofile.getOwnedStereotypes().iterator();pi.hasNext();){ ! String qualDef = ""; ! Stereotype s = (Stereotype) pi.next(); ! String type = "boolean = false"; ! Property value = s.getAttribute("value"); ! if (value != null){ ! String uType = value.getType().getName(); ! if (value.getType() instanceof Enumeration){ ! uType = "string"; ! qualDef += "// Enumeration of "; ! Enumeration e = (Enumeration) value.getType(); ! for (Iterator ei = e.getOwnedLiterals().iterator();ei.hasNext();){ ! EnumerationLiteral lit = (EnumerationLiteral) ei.next(); ! qualDef += lit.getName()+" "; ! } ! qualDef += "\n"; ! } ! type = uType; ! if (value.isMultivalued()) ! type += "[]"; ! } ! qualDef += "Qualifier "+s.getName()+" : "; ! qualDef += type+",\n Scope ("; ! boolean first = true; ! boolean skip = false; ! for (Iterator metas = s.getExtendedMetaclasses().iterator();metas.hasNext();){ ! Class theMeta = (Class) metas.next(); ! if (theMeta.getName().equalsIgnoreCase("EnumerationLiteral") && s.getExtendedMetaclasses().size()==1) ! skip=true; ! String meta = mappedMeta (theMeta.getName()); ! if (meta == null) ! continue; ! if (first) ! first = false; ! else ! qualDef += ", "; ! qualDef += meta; ! } ! if (qualDef.indexOf("property")!= -1) ! qualDef +=", reference"; ! qualDef +=");\n\n"; ! if (!skip) ! qualDefs += qualDef; ! } ! return qualDefs; ! ! } ! ! ! private static String mappedMeta(String name) { ! if (name.equalsIgnoreCase("Property") || name.equalsIgnoreCase("Parameter") || name.equalsIgnoreCase("Association")) ! return name.toLowerCase(); ! if (name.equalsIgnoreCase("Class")) ! return "class, indication"; ! if (name.equalsIgnoreCase("Operation")) ! return "method"; ! return null; ! } |
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:33
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/ModelAbstraction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/src/net/sourceforge/modelWizard/chameleon/ModelAbstraction Modified Files: UmlUtilities.java Log Message: prior to release Index: UmlUtilities.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/ModelAbstraction/UmlUtilities.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UmlUtilities.java 1 Feb 2006 09:18:40 -0000 1.3 --- UmlUtilities.java 19 Apr 2006 21:26:27 -0000 1.4 *************** *** 70,74 **** public static String cleanText(String txt) { ! txt = txt.replaceAll("[\\t\\n]*", ""); txt = txt.replaceAll("\\s+", " "); --- 70,74 ---- public static String cleanText(String txt) { ! txt = txt.replaceAll("[\\t\\n]+", " "); txt = txt.replaceAll("\\s+", " "); |
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:33
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145 Modified Files: plugin.xml Log Message: prior to release Index: plugin.xml =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/plugin.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** plugin.xml 1 Feb 2006 09:18:39 -0000 1.8 --- plugin.xml 19 Apr 2006 21:26:27 -0000 1.9 *************** *** 19,45 **** </action> </objectContribution> - <objectContribution - objectClass="org.eclipse.core.resources.IFile" - id="net.sourceforge.modelWizard.chameleon.splitModelPopUp"> - <enablement> - <or> - <and> - <objectClass name="org.eclipse.core.resources.IFile"/> - <objectState name="extension" value="emx"/> - </and> - <and> - <objectClass name="org.eclipse.core.resources.IFile"/> - <objectState name="extension" value="uml2"/> - </and> - </or> - </enablement> - <action - class="net.sourceforge.modelWizard.chameleon.actions.SplitModelAction" - enablesFor="1" - id="com.cisco.nm.cto.cimcx.comparePopUp" - label="Split Model" - tooltip="Split a model up into multiple files."> - </action> - </objectContribution> </extension> --- 19,22 ---- *************** *** 60,73 **** id="Abstract.model1" menu="menu" ! modelFile="model/chameleon.emx" name="Chameleon" primary="true" profileFolder="blueprints"> <modelExport - class="net.sourceforge.modelWizard.chameleon.exporters.IntermediateModelExport" - fileExtension="uml2" - name="AndroMDA Intermediate Model" - targetType="file"/> - <modelExport class="net.sourceforge.modelWizard.chameleon.exporters.MofExport" fileExtension="mof" --- 37,45 ---- id="Abstract.model1" menu="menu" ! modelFile="model/Merged.emx" name="Chameleon" primary="true" profileFolder="blueprints"> <modelExport class="net.sourceforge.modelWizard.chameleon.exporters.MofExport" fileExtension="mof" |
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:32
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/compare In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/src/net/sourceforge/modelWizard/chameleon/compare Modified Files: OpenModelOp.java Log Message: prior to release Index: OpenModelOp.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/compare/OpenModelOp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OpenModelOp.java 1 Feb 2006 09:18:39 -0000 1.2 --- OpenModelOp.java 19 Apr 2006 21:26:27 -0000 1.3 *************** *** 18,22 **** import org.eclipse.uml2.Model; import org.eclipse.uml2.util.UML2Resource; - import org.eclipse.uml2.util.UML2Util; public final class OpenModelOp implements IRunnableWithProgress { --- 18,21 ---- |
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:32
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/META-INF Modified Files: MANIFEST.MF Log Message: prior to release Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/META-INF/MANIFEST.MF,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** MANIFEST.MF 1 Feb 2006 09:18:39 -0000 1.13 --- MANIFEST.MF 19 Apr 2006 21:26:27 -0000 1.14 *************** *** 2,6 **** Bundle-Name: Chameleon UML Model Plugin Bundle-SymbolicName: net.sourceforge.modelWizard.chameleon;singleton=true ! Bundle-Version: 4.0.18 Bundle-Vendor: Cisco Bundle-Localization: plugin --- 2,6 ---- Bundle-Name: Chameleon UML Model Plugin Bundle-SymbolicName: net.sourceforge.modelWizard.chameleon;singleton=true ! Bundle-Version: 4.0.21 Bundle-Vendor: Cisco Bundle-Localization: plugin *************** *** 12,16 **** org.eclipse.uml2, org.eclipse.compare, ! org.eclipse.jdt.core Bundle-ClassPath: model.jar Bundle-Activator: net.sourceforge.modelWizard.chameleon.Plugin --- 12,19 ---- org.eclipse.uml2, org.eclipse.compare, ! org.eclipse.jdt.core, ! org.eclipse.emf, ! org.eclipse.emf.common, ! org.eclipse.uml2.resources Bundle-ClassPath: model.jar Bundle-Activator: net.sourceforge.modelWizard.chameleon.Plugin |
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:31
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/src/net/sourceforge/modelWizard/chameleon/actions Removed Files: SplitModelAction.java Log Message: prior to release --- SplitModelAction.java DELETED --- |
|
From: Steve J. <sj...@us...> - 2006-04-19 21:26:17
|
Update of /cvsroot/modelwizard/source/Chameleon Feature In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv816 Modified Files: feature.xml Log Message: prior to release Index: feature.xml =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Feature/feature.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** feature.xml 1 Feb 2006 09:17:47 -0000 1.11 --- feature.xml 19 Apr 2006 21:26:03 -0000 1.12 *************** *** 3,7 **** id="net.sourceforge.modelWizard.chameleon" label="Chameleon Model" ! version="4.0.18" provider-name="Cisco"> --- 3,7 ---- id="net.sourceforge.modelWizard.chameleon" label="Chameleon Model" ! version="4.0.21" provider-name="Cisco"> |
|
From: Steve J. <sj...@us...> - 2006-03-21 21:01:22
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/umlProfile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32445/umlProfile Modified Files: Model.Profile.uml2 Log Message: change 'oidkey' to 'selector' Index: Model.Profile.uml2 =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/umlProfile/Model.Profile.uml2,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Model.Profile.uml2 1 Feb 2006 09:18:40 -0000 1.16 --- Model.Profile.uml2 21 Mar 2006 21:01:17 -0000 1.17 *************** *** 225,229 **** <eAnnotations xmi:id="_UaKDQIOdEdqU-MLLYBRYwg" source="stereotype" references="_nicYMIOcEdqU-MLLYBRYwg"/> </eClassifiers> ! <eClassifiers xmi:type="ecore:EClass" xmi:id="_pe5YkI42Edq4-8bDUkICZA" name="MODEL__OIDKey"> <eAnnotations xmi:id="_vbucAI45Edq4-8bDUkICZA" source="stereotype" references="_PG2PtfVfEdmX2r2IirNfog"/> </eClassifiers> --- 225,229 ---- <eAnnotations xmi:id="_UaKDQIOdEdqU-MLLYBRYwg" source="stereotype" references="_nicYMIOcEdqU-MLLYBRYwg"/> </eClassifiers> ! <eClassifiers xmi:type="ecore:EClass" xmi:id="_pe5YkI42Edq4-8bDUkICZA" name="MODEL__Selector"> <eAnnotations xmi:id="_vbucAI45Edq4-8bDUkICZA" source="stereotype" references="_PG2PtfVfEdmX2r2IirNfog"/> </eClassifiers> *************** *** 2233,2242 **** </nestedClassifier> </ownedMember> ! <ownedMember xmi:type="uml:Stereotype" xmi:id="_PG2PtfVfEdmX2r2IirNfog" name="OIDKey"> <ownedAttribute xmi:id="_PG2PtvVfEdmX2r2IirNfog" name="base$Property" association="_PG2P7_VfEdmX2r2IirNfog"> <type xmi:type="uml:Class" href="pathmap://UML2_METAMODELS/UML2.metamodel.uml2#_m9C1la86EdiEh75YJ_3n8g"/> </ownedAttribute> ! <nestedClassifier xmi:type="uml:Extension" xmi:id="_PG2P7_VfEdmX2r2IirNfog" name="Property_OIDKey" memberEnd="_PG2P8PVfEdmX2r2IirNfog _PG2PtvVfEdmX2r2IirNfog"> ! <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_PG2P8PVfEdmX2r2IirNfog" name="extension$OIDKey" type="_PG2PtfVfEdmX2r2IirNfog" association="_PG2P7_VfEdmX2r2IirNfog" aggregation="composite"> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PG2P8fVfEdmX2r2IirNfog"/> </ownedEnd> --- 2233,2242 ---- </nestedClassifier> </ownedMember> ! <ownedMember xmi:type="uml:Stereotype" xmi:id="_PG2PtfVfEdmX2r2IirNfog" name="Selector"> <ownedAttribute xmi:id="_PG2PtvVfEdmX2r2IirNfog" name="base$Property" association="_PG2P7_VfEdmX2r2IirNfog"> <type xmi:type="uml:Class" href="pathmap://UML2_METAMODELS/UML2.metamodel.uml2#_m9C1la86EdiEh75YJ_3n8g"/> </ownedAttribute> ! <nestedClassifier xmi:type="uml:Extension" xmi:id="_PG2P7_VfEdmX2r2IirNfog" name="Property_Selector" memberEnd="_PG2P8PVfEdmX2r2IirNfog _PG2PtvVfEdmX2r2IirNfog"> ! <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_PG2P8PVfEdmX2r2IirNfog" name="extension$Selector" type="_PG2PtfVfEdmX2r2IirNfog" association="_PG2P7_VfEdmX2r2IirNfog" aggregation="composite"> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PG2P8fVfEdmX2r2IirNfog"/> </ownedEnd> *************** *** 2456,2459 **** --- 2456,2462 ---- <type xmi:type="uml:Class" href="pathmap://UML2_METAMODELS/UML2.metamodel.uml2#_m9bRea86EdiEh75YJ_3n8g"/> </ownedAttribute> + <ownedAttribute xmi:id="_SYNGwLO6EdqnK7Wv3y50Mg" name="base$Constraint" association="_WZys4LO6EdqnK7Wv3y50Mg"> + <type xmi:type="uml:Class" href="pathmap://UML2_METAMODELS/UML2.metamodel.uml2#_m8whsa86EdiEh75YJ_3n8g"/> + </ownedAttribute> <nestedClassifier xmi:type="uml:Extension" xmi:id="_PG2QU_VfEdmX2r2IirNfog" name="Class_Version" memberEnd="_PG2QVPVfEdmX2r2IirNfog _PG2P1vVfEdmX2r2IirNfog"> <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_PG2QVPVfEdmX2r2IirNfog" name="extension$Version" type="_PG2P1PVfEdmX2r2IirNfog" association="_PG2QU_VfEdmX2r2IirNfog" aggregation="composite"/> *************** *** 2468,2471 **** --- 2471,2477 ---- <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_zJq_4Y6mEdqcOdCAUsLE_Q" name="extension$Version" type="_PG2P1PVfEdmX2r2IirNfog" association="_zJq_4I6mEdqcOdCAUsLE_Q" aggregation="composite"/> </nestedClassifier> + <nestedClassifier xmi:type="uml:Extension" xmi:id="_WZys4LO6EdqnK7Wv3y50Mg" name="Constraint_Version" memberEnd="_WZys4bO6EdqnK7Wv3y50Mg _SYNGwLO6EdqnK7Wv3y50Mg"> + <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_WZys4bO6EdqnK7Wv3y50Mg" name="constraint$Version" type="_PG2P1PVfEdmX2r2IirNfog" association="_WZys4LO6EdqnK7Wv3y50Mg" aggregation="composite"/> + </nestedClassifier> </ownedMember> <ownedMember xmi:type="uml:Stereotype" xmi:id="_PG2QVfVfEdmX2r2IirNfog" name="MappingStrings"> |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:26:50
|
Update of /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/cartEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14309/src/net/sourceforge/modelWizard/cartEditor Modified Files: ExpertPage.java CartEditorActionBarContributor.java Log Message: feb1 release Index: ExpertPage.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/cartEditor/ExpertPage.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExpertPage.java 28 Nov 2005 15:56:18 -0000 1.3 --- ExpertPage.java 1 Feb 2006 09:26:38 -0000 1.4 *************** *** 1,376 **** ! /* ! * Created on Apr 29, 2005 ! * ! * TODO To change the template for this generated file go to ! * Window - Preferences - Java - Code Style - Code Templates ! */ ! package net.sourceforge.modelWizard.cartEditor; ! ! import java.util.ArrayList; ! ! import org.eclipse.emf.common.notify.Adapter; ! import org.eclipse.emf.common.notify.Notification; ! import org.eclipse.emf.common.notify.Notifier; ! import org.eclipse.emf.common.util.URI; ! import org.eclipse.jface.action.Action; ! import org.eclipse.jface.action.IMenuListener; ! import org.eclipse.jface.action.IMenuManager; ! import org.eclipse.jface.action.MenuManager; ! import org.eclipse.jface.action.Separator; ! import org.eclipse.jface.viewers.CheckStateChangedEvent; ! import org.eclipse.jface.viewers.CheckboxTreeViewer; ! import org.eclipse.jface.viewers.DoubleClickEvent; ! import org.eclipse.jface.viewers.ICheckStateListener; ! import org.eclipse.jface.viewers.IDoubleClickListener; ! import org.eclipse.jface.viewers.ISelection; ! import org.eclipse.jface.viewers.IStructuredContentProvider; ! import org.eclipse.jface.viewers.IStructuredSelection; ! import org.eclipse.jface.viewers.ITreeContentProvider; ! import org.eclipse.jface.viewers.LabelProvider; ! import org.eclipse.jface.viewers.Viewer; ! import org.eclipse.swt.SWT; ! import org.eclipse.swt.dnd.DND; ! import org.eclipse.swt.dnd.DropTargetAdapter; ! import org.eclipse.swt.dnd.DropTargetEvent; ! import org.eclipse.swt.dnd.FileTransfer; ! import org.eclipse.swt.dnd.TextTransfer; ! import org.eclipse.swt.dnd.Transfer; ! import org.eclipse.swt.graphics.Image; ! import org.eclipse.swt.layout.FillLayout; ! import org.eclipse.swt.layout.GridData; ! import org.eclipse.swt.layout.GridLayout; ! import org.eclipse.swt.widgets.Composite; ! import org.eclipse.swt.widgets.Display; ! import org.eclipse.swt.widgets.Group; ! import org.eclipse.swt.widgets.Menu; ! import org.eclipse.swt.widgets.MessageBox; ! import org.eclipse.swt.widgets.Shell; ! import org.eclipse.swt.widgets.TreeItem; ! import org.eclipse.ui.IWorkbenchActionConstants; ! import org.eclipse.ui.actions.ActionFactory; ! import org.eclipse.ui.help.WorkbenchHelp; ! ! import net.sourceforge.modelWizard.ModelWizardPlugin; ! import net.sourceforge.modelWizard.Profile.ProfileType1; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Class; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Profile; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ProfilePointer; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Required; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartType; ! import net.sourceforge.modelWizard.utilities.ExceptionDetailsDialog; ! import net.sourceforge.modelWizard.utilities.ProfileUtilities; ! ! /** ! * @author stjerman ! * ! * TODO To change the template for this generated type comment go to ! * Window - Preferences - Java - Code Style - Code Templates ! */ ! public class ExpertPage extends Composite{ ! ! ! ! private CheckboxTreeViewer checkboxTreeViewer; ! private CartEditor cartEditor; ! private Action deleteAction; ! private Action doubleClickAction; ! final ShoppingCartType cart; ! ! class TreeLabelProvider extends LabelProvider { ! public String getText(Object element) { ! if (element instanceof Profile){ ! Profile p = (Profile) element; ! if (p.getRequired()== Required.get(Required.MANDATORY)){ ! checkboxTreeViewer.setGrayChecked(element,true); ! } else if (p.getRequired()== Required.get(Required.CONDITIONAL)){ ! checkboxTreeViewer.setChecked(element,true); ! }else ! checkboxTreeViewer.setChecked(element,p.isExport()); ! return p.getName(); ! } else if (element instanceof Class){ ! Class c = (Class) element; ! if (c.getRequired()== Required.get(Required.MANDATORY)){ ! checkboxTreeViewer.setGrayChecked(element,true); ! } else if (c.getRequired()== Required.get(Required.CONDITIONAL)){ ! checkboxTreeViewer.setChecked(element,true); ! }else ! checkboxTreeViewer.setChecked(element,c.isExport()); ! return c.getName(); ! } else if (element instanceof ProfilePointer){ ! ProfilePointer p = (ProfilePointer) element; ! checkboxTreeViewer.setGrayChecked(element,true); ! return p.getName(); ! } ! return ""; ! } ! public Image getImage(Object element) { ! if (element instanceof Profile){ ! return ModelWizardPlugin.getIconPath("profileIcon.gif").createImage(); ! } else if (element instanceof Class){ ! return ModelWizardPlugin.getIconPath("classIcon.gif").createImage(); ! } else if (element instanceof ProfilePointer){ ! return ModelWizardPlugin.getIconPath("profilePointerIcon.gif").createImage(); ! } ! return null; ! } ! } ! class TreeContentProvider implements IStructuredContentProvider, ITreeContentProvider, Adapter { ! private CheckboxTreeViewer viewer = null; ! private ShoppingCartType cart; ! ! public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { ! if (viewer instanceof CheckboxTreeViewer){ ! this.viewer = (CheckboxTreeViewer) viewer; ! if (newInput instanceof ShoppingCartType){ ! cart = (ShoppingCartType) newInput; ! cart.eAdapters().add(this); ! } ! } ! } ! ! public void dispose() { ! if (cart != null) ! cart.eAdapters().remove(this); ! } ! ! public Object[] getElements(Object inputElement) { ! if (inputElement instanceof ShoppingCartType) ! return ((ShoppingCartType) inputElement).getProfile().toArray(); ! return null; ! } ! public Object[] getChildren(Object parentElement) { ! ArrayList children = new ArrayList(); ! if (parentElement instanceof Profile) { ! children.addAll( ((Profile)parentElement).getProfile()); ! children.addAll( ((Profile)parentElement).getClass_()); ! } ! return children.toArray(); ! } ! ! public Object getParent(Object element) { ! if (element instanceof Profile) { ! Profile p = (Profile) element; ! if (p.eContainer() instanceof Profile) ! return p.eContainer(); ! else ! return cart; ! } ! if (element instanceof Class) ! return ((Class)element).eContainer(); ! return null; ! } ! public boolean hasChildren(Object element) { ! return getChildren(element).length > 0; ! } ! ! /* (non-Javadoc) ! * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification) ! */ ! public void notifyChanged(Notification arg0) { ! if (arg0.getEventType() != Notification.REMOVING_ADAPTER) ! viewer.refresh(arg0.getNotifier()); ! } ! ! private Notifier notifier; ! /* (non-Javadoc) ! * @see org.eclipse.emf.common.notify.Adapter#getTarget() ! */ ! public Notifier getTarget() { ! return notifier; ! } ! ! /* (non-Javadoc) ! * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier) ! */ ! public void setTarget(Notifier arg0) { ! notifier = arg0; ! } ! ! /* (non-Javadoc) ! * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object) ! */ ! public boolean isAdapterForType(Object arg0) { ! return true; ! } ! ! } ! ! public ExpertPage(Composite parent, int style, ShoppingCartType theCart, CartEditor editor) { ! super(parent, style); ! setLayout(new GridLayout()); ! cartEditor = editor; ! cart = theCart; ! WorkbenchHelp.setHelp(parent,"net.sourceforge.modelwizard.documentation.cartEditorHelpId"); ! ! final Group group = new Group(this, SWT.NONE); ! group.setText("Blueprints"); ! group.setLayoutData(new GridData(GridData.FILL_BOTH)); ! group.setLayout(new FillLayout()); ! checkboxTreeViewer = new CheckboxTreeViewer(group, SWT.BORDER){ ! ! protected void preservingSelection(Runnable updateCode) { ! super.preservingSelection(updateCode); ! ! TreeItem[] children = getTree().getItems(); ! for (int i = 0; i < children.length; i++) { ! TreeItem item = children[i]; ! Profile prof = (Profile) item.getData(); ! item.setChecked(prof.isExport()); ! } ! } ! }; ! checkboxTreeViewer.setLabelProvider(new TreeLabelProvider()); ! checkboxTreeViewer.setContentProvider(new TreeContentProvider()); ! checkboxTreeViewer.setInput(cart); ! checkboxTreeViewer.addCheckStateListener(new ICheckStateListener(){ ! ! public void checkStateChanged(CheckStateChangedEvent event) { ! if (event.getElement() instanceof Profile){ ! Profile p = (Profile) event.getElement(); ! p.setExport(event.getChecked()); ! cartEditor.setDirty(); ! } else if (event.getElement() instanceof Class){ ! Class c = (Class) event.getElement(); ! if (checkboxTreeViewer.getGrayed(c)) ! checkboxTreeViewer.setChecked(c,true); ! else { ! c.setExport(event.getChecked()); ! cartEditor.setDirty(); ! } ! } else if (event.getElement() instanceof ProfilePointer){ ! checkboxTreeViewer.setGrayChecked(event.getElement(),true); ! } ! }}); ! checkboxTreeViewer.addDropSupport(DND.DROP_COPY|DND.DROP_MOVE,new Transfer[]{FileTransfer.getInstance()}, ! new DropTargetAdapter() { ! ! public void drop(DropTargetEvent e) { ! String fileName = null; ! if (FileTransfer.getInstance().isSupportedType(e.currentDataType) && ! e.data instanceof String[]){ ! e.detail = DND.DROP_COPY; ! String c[] = (String[]) e.data; ! boolean added = false; ! for (int n = 0;n<c.length;n++){ ! if (c[n].endsWith(".prf")) { ! try { ! ProfileType1 model = ! ProfileUtilities.INSTANCE.getAbsoluteProfile(c[n]); ! ! if (ProfileUtilities.INSTANCE.handlePossibleProfileInCart(cart, ! model.getName())) { ! ProfileUtilities.INSTANCE.addProfileToCart(cart,c[n]); ! added = true; ! } ! } catch (Exception ex) { ! ExceptionDetailsDialog dialog = new ExceptionDetailsDialog( ! getShell(), ! "Can't add blueprint "+c[n], ! null, ! null, ! ex ! ); ! dialog.open(); ! } ! } ! if (added){ ! cartEditor.setDirty(); ! checkboxTreeViewer.refresh(); ! } ! } ! } else ! e.detail = DND.DROP_NONE; ! } ! }); ! makeActions(); ! hookContextMenu(); ! hookDoubleClick(); ! hookGlobalActions(); ! WorkbenchHelp.setHelp(checkboxTreeViewer.getControl(),"net.sourceforge.modelwizard.documentation.cartEditorHelpId"); ! } ! ! /** ! * ! */ ! private void hookGlobalActions() { ! cartEditor.getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(),deleteAction); ! } ! ! /** ! * ! */ ! private void hookDoubleClick() { ! checkboxTreeViewer.addDoubleClickListener(new IDoubleClickListener() { ! public void doubleClick(DoubleClickEvent event) { ! doubleClickAction.run(); ! } ! }); ! } ! ! // public void dispose() { ! // super.dispose(); ! // } ! ! private void hookContextMenu() { ! MenuManager menuMgr = new MenuManager("#PopupMenu"); ! menuMgr.setRemoveAllWhenShown(true); ! menuMgr.addMenuListener(new IMenuListener() { ! public void menuAboutToShow(IMenuManager manager) { ! fillContextMenu(manager); ! } ! }); ! Menu menu = menuMgr.createContextMenu(checkboxTreeViewer.getControl()); ! checkboxTreeViewer.getControl().setMenu(menu); ! cartEditor.getSite().registerContextMenu(menuMgr, checkboxTreeViewer); ! } ! ! protected void checkSubclass() { ! } ! /** ! * @param cart ! */ ! ! private void fillContextMenu(IMenuManager manager) { ! manager.add(deleteAction); ! // manager.add(action2); ! // Other plug-ins can contribute there actions here ! manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); ! } ! ! private void makeActions() { ! deleteAction = new Action() { ! public void run() { ! ISelection selection = checkboxTreeViewer.getSelection(); ! if (selection!=null && selection.isEmpty()==false && selection instanceof IStructuredSelection) { ! IStructuredSelection ssel = (IStructuredSelection)selection; ! Object obj = ssel.getFirstElement(); ! if (obj instanceof Profile){ ! Profile p = (Profile) obj; ! MessageBox mb = new MessageBox(new Shell(Display.getDefault()), SWT.ICON_QUESTION | SWT.YES | SWT.NO); ! mb.setMessage("Delete blueprint '"+ p.getName()+"'?"); ! int status = mb.open(); ! if (status == SWT.YES){ ! cart.getProfile().remove(p); ! cartEditor.setDirty(); ! } ! } ! } ! } ! }; ! deleteAction.setText("Delete Blueprint"); ! deleteAction.setToolTipText("Delete selected blueprint"); ! deleteAction.setImageDescriptor(ModelWizardPlugin.getIconPath("delProfile.gif")); ! ! doubleClickAction = new Action() { ! public void run() { ! ISelection selection = checkboxTreeViewer.getSelection(); ! Object obj = ((IStructuredSelection)selection).getFirstElement(); ! if (obj instanceof Profile){ ! Profile p = (Profile) obj; ! ProfileUtilities.INSTANCE.openProfileFromUri(ProfileUtilities.INSTANCE.getRelativeProfile(p.getHref())); ! } ! } ! }; ! } ! ! } --- 1,376 ---- ! /* ! * Created on Apr 29, 2005 ! * ! * TODO To change the template for this generated file go to ! * Window - Preferences - Java - Code Style - Code Templates ! */ ! package net.sourceforge.modelWizard.cartEditor; ! ! import java.util.ArrayList; ! ! import org.eclipse.emf.common.notify.Adapter; ! import org.eclipse.emf.common.notify.Notification; ! import org.eclipse.emf.common.notify.Notifier; ! import org.eclipse.emf.common.util.URI; ! import org.eclipse.jface.action.Action; ! import org.eclipse.jface.action.IMenuListener; ! import org.eclipse.jface.action.IMenuManager; ! import org.eclipse.jface.action.MenuManager; ! import org.eclipse.jface.action.Separator; ! import org.eclipse.jface.viewers.CheckStateChangedEvent; ! import org.eclipse.jface.viewers.CheckboxTreeViewer; ! import org.eclipse.jface.viewers.DoubleClickEvent; ! import org.eclipse.jface.viewers.ICheckStateListener; ! import org.eclipse.jface.viewers.IDoubleClickListener; ! import org.eclipse.jface.viewers.ISelection; ! import org.eclipse.jface.viewers.IStructuredContentProvider; ! import org.eclipse.jface.viewers.IStructuredSelection; ! import org.eclipse.jface.viewers.ITreeContentProvider; ! import org.eclipse.jface.viewers.LabelProvider; ! import org.eclipse.jface.viewers.Viewer; ! import org.eclipse.swt.SWT; ! import org.eclipse.swt.dnd.DND; ! import org.eclipse.swt.dnd.DropTargetAdapter; ! import org.eclipse.swt.dnd.DropTargetEvent; ! import org.eclipse.swt.dnd.FileTransfer; ! import org.eclipse.swt.dnd.TextTransfer; ! import org.eclipse.swt.dnd.Transfer; ! import org.eclipse.swt.graphics.Image; ! import org.eclipse.swt.layout.FillLayout; ! import org.eclipse.swt.layout.GridData; ! import org.eclipse.swt.layout.GridLayout; ! import org.eclipse.swt.widgets.Composite; ! import org.eclipse.swt.widgets.Display; ! import org.eclipse.swt.widgets.Group; ! import org.eclipse.swt.widgets.Menu; ! import org.eclipse.swt.widgets.MessageBox; ! import org.eclipse.swt.widgets.Shell; ! import org.eclipse.swt.widgets.TreeItem; ! import org.eclipse.ui.IWorkbenchActionConstants; ! import org.eclipse.ui.actions.ActionFactory; ! import org.eclipse.ui.help.WorkbenchHelp; ! ! import net.sourceforge.modelWizard.ModelWizardPlugin; ! import net.sourceforge.modelWizard.Profile.ProfileType1; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Class; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Profile; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ProfilePointer; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Required; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartType; ! import net.sourceforge.modelWizard.utilities.ExceptionDetailsDialog; ! import net.sourceforge.modelWizard.utilities.ProfileUtilities; ! ! /** ! * @author stjerman ! * ! * TODO To change the template for this generated type comment go to ! * Window - Preferences - Java - Code Style - Code Templates ! */ ! public class ExpertPage extends Composite{ ! ! ! ! private CheckboxTreeViewer checkboxTreeViewer; ! private CartEditor cartEditor; ! private Action deleteAction; ! private Action doubleClickAction; ! final ShoppingCartType cart; ! ! class TreeLabelProvider extends LabelProvider { ! public String getText(Object element) { ! if (element instanceof Profile){ ! Profile p = (Profile) element; ! if (p.getRequired()== Required.get(Required.MANDATORY)){ ! checkboxTreeViewer.setGrayChecked(element,true); ! } else if (p.getRequired()== Required.get(Required.CONDITIONAL)){ ! checkboxTreeViewer.setChecked(element,true); ! }else ! checkboxTreeViewer.setChecked(element,p.isExport()); ! return p.getName(); ! } else if (element instanceof Class){ ! Class c = (Class) element; ! if (c.getRequired()== Required.get(Required.MANDATORY)){ ! checkboxTreeViewer.setGrayChecked(element,true); ! } else if (c.getRequired()== Required.get(Required.CONDITIONAL)){ ! checkboxTreeViewer.setChecked(element,true); ! }else ! checkboxTreeViewer.setChecked(element,c.isExport()); ! return c.getName(); ! } else if (element instanceof ProfilePointer){ ! ProfilePointer p = (ProfilePointer) element; ! checkboxTreeViewer.setGrayChecked(element,true); ! return p.getName(); ! } ! return ""; ! } ! public Image getImage(Object element) { ! if (element instanceof Profile){ ! return ModelWizardPlugin.getIconPath("profileIcon.gif").createImage(); ! } else if (element instanceof Class){ ! return ModelWizardPlugin.getIconPath("classIcon.gif").createImage(); ! } else if (element instanceof ProfilePointer){ ! return ModelWizardPlugin.getIconPath("profilePointerIcon.gif").createImage(); ! } ! return null; ! } ! } ! class TreeContentProvider implements IStructuredContentProvider, ITreeContentProvider, Adapter { ! private CheckboxTreeViewer viewer = null; ! private ShoppingCartType cart; ! ! public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { ! if (viewer instanceof CheckboxTreeViewer){ ! this.viewer = (CheckboxTreeViewer) viewer; ! if (newInput instanceof ShoppingCartType){ ! cart = (ShoppingCartType) newInput; ! cart.eAdapters().add(this); ! } ! } ! } ! ! public void dispose() { ! if (cart != null) ! cart.eAdapters().remove(this); ! } ! ! public Object[] getElements(Object inputElement) { ! if (inputElement instanceof ShoppingCartType) ! return ((ShoppingCartType) inputElement).getProfile().toArray(); ! return null; ! } ! public Object[] getChildren(Object parentElement) { ! ArrayList children = new ArrayList(); ! if (parentElement instanceof Profile) { ! children.addAll( ((Profile)parentElement).getProfile()); ! children.addAll( ((Profile)parentElement).getClass_()); ! } ! return children.toArray(); ! } ! ! public Object getParent(Object element) { ! if (element instanceof Profile) { ! Profile p = (Profile) element; ! if (p.eContainer() instanceof Profile) ! return p.eContainer(); ! else ! return cart; ! } ! if (element instanceof Class) ! return ((Class)element).eContainer(); ! return null; ! } ! public boolean hasChildren(Object element) { ! return getChildren(element).length > 0; ! } ! ! /* (non-Javadoc) ! * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification) ! */ ! public void notifyChanged(Notification arg0) { ! if (arg0.getEventType() != Notification.REMOVING_ADAPTER) ! viewer.refresh(arg0.getNotifier()); ! } ! ! private Notifier notifier; ! /* (non-Javadoc) ! * @see org.eclipse.emf.common.notify.Adapter#getTarget() ! */ ! public Notifier getTarget() { ! return notifier; ! } ! ! /* (non-Javadoc) ! * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier) ! */ ! public void setTarget(Notifier arg0) { ! notifier = arg0; ! } ! ! /* (non-Javadoc) ! * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object) ! */ ! public boolean isAdapterForType(Object arg0) { ! return true; ! } ! ! } ! ! public ExpertPage(Composite parent, int style, ShoppingCartType theCart, CartEditor editor) { ! super(parent, style); ! setLayout(new GridLayout()); ! cartEditor = editor; ! cart = theCart; ! WorkbenchHelp.setHelp(parent,"net.sourceforge.modelwizard.documentation.cartEditorHelpId"); ! ! final Group group = new Group(this, SWT.NONE); ! group.setText("Blueprints"); ! group.setLayoutData(new GridData(GridData.FILL_BOTH)); ! group.setLayout(new FillLayout()); ! checkboxTreeViewer = new CheckboxTreeViewer(group, SWT.BORDER){ ! ! protected void preservingSelection(Runnable updateCode) { ! super.preservingSelection(updateCode); ! ! TreeItem[] children = getTree().getItems(); ! for (int i = 0; i < children.length; i++) { ! TreeItem item = children[i]; ! Profile prof = (Profile) item.getData(); ! item.setChecked(prof.isExport()); ! } ! } ! }; ! checkboxTreeViewer.setLabelProvider(new TreeLabelProvider()); ! checkboxTreeViewer.setContentProvider(new TreeContentProvider()); ! checkboxTreeViewer.setInput(cart); ! checkboxTreeViewer.addCheckStateListener(new ICheckStateListener(){ ! ! public void checkStateChanged(CheckStateChangedEvent event) { ! if (event.getElement() instanceof Profile){ ! Profile p = (Profile) event.getElement(); ! p.setExport(event.getChecked()); ! cartEditor.setDirty(); ! } else if (event.getElement() instanceof Class){ ! Class c = (Class) event.getElement(); ! if (checkboxTreeViewer.getGrayed(c)) ! checkboxTreeViewer.setChecked(c,true); ! else { ! c.setExport(event.getChecked()); ! cartEditor.setDirty(); ! } ! } else if (event.getElement() instanceof ProfilePointer){ ! checkboxTreeViewer.setGrayChecked(event.getElement(),true); ! } ! }}); ! checkboxTreeViewer.addDropSupport(DND.DROP_COPY|DND.DROP_MOVE,new Transfer[]{FileTransfer.getInstance()}, ! new DropTargetAdapter() { ! ! public void drop(DropTargetEvent e) { ! String fileName = null; ! if (FileTransfer.getInstance().isSupportedType(e.currentDataType) && ! e.data instanceof String[]){ ! e.detail = DND.DROP_COPY; ! String c[] = (String[]) e.data; ! boolean added = false; ! for (int n = 0;n<c.length;n++){ ! if (c[n].endsWith(".prf")) { ! try { ! ProfileType1 model = ! ProfileUtilities.INSTANCE.getAbsoluteProfile(c[n]); ! ! if (ProfileUtilities.INSTANCE.handlePossibleProfileInCart(cart, ! model.getName())) { ! ProfileUtilities.INSTANCE.addProfileToCart(cart,c[n]); ! added = true; ! } ! } catch (Exception ex) { ! ExceptionDetailsDialog dialog = new ExceptionDetailsDialog( ! getShell(), ! "Can't add blueprint "+c[n], ! null, ! null, ! ex ! ); ! dialog.open(); ! } ! } ! if (added){ ! cartEditor.setDirty(); ! checkboxTreeViewer.refresh(); ! } ! } ! } else ! e.detail = DND.DROP_NONE; ! } ! }); ! makeActions(); ! hookContextMenu(); ! hookDoubleClick(); ! hookGlobalActions(); ! WorkbenchHelp.setHelp(checkboxTreeViewer.getControl(),"net.sourceforge.modelwizard.documentation.cartEditorHelpId"); ! } ! ! /** ! * ! */ ! private void hookGlobalActions() { ! cartEditor.getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(),deleteAction); ! } ! ! /** ! * ! */ ! private void hookDoubleClick() { ! checkboxTreeViewer.addDoubleClickListener(new IDoubleClickListener() { ! public void doubleClick(DoubleClickEvent event) { ! doubleClickAction.run(); ! } ! }); ! } ! ! // public void dispose() { ! // super.dispose(); ! // } ! ! private void hookContextMenu() { ! MenuManager menuMgr = new MenuManager("#PopupMenu"); ! menuMgr.setRemoveAllWhenShown(true); ! menuMgr.addMenuListener(new IMenuListener() { ! public void menuAboutToShow(IMenuManager manager) { ! fillContextMenu(manager); ! } ! }); ! Menu menu = menuMgr.createContextMenu(checkboxTreeViewer.getControl()); ! checkboxTreeViewer.getControl().setMenu(menu); ! cartEditor.getSite().registerContextMenu(menuMgr, checkboxTreeViewer); ! } ! ! protected void checkSubclass() { ! } ! /** ! * @param cart ! */ ! ! private void fillContextMenu(IMenuManager manager) { ! manager.add(deleteAction); ! // manager.add(action2); ! // Other plug-ins can contribute there actions here ! manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); ! } ! ! private void makeActions() { ! deleteAction = new Action() { ! public void run() { ! ISelection selection = checkboxTreeViewer.getSelection(); ! if (selection!=null && selection.isEmpty()==false && selection instanceof IStructuredSelection) { ! IStructuredSelection ssel = (IStructuredSelection)selection; ! Object obj = ssel.getFirstElement(); ! if (obj instanceof Profile){ ! Profile p = (Profile) obj; ! MessageBox mb = new MessageBox(new Shell(Display.getDefault()), SWT.ICON_QUESTION | SWT.YES | SWT.NO); ! mb.setMessage("Delete blueprint '"+ p.getName()+"'?"); ! int status = mb.open(); ! if (status == SWT.YES){ ! cart.getProfile().remove(p); ! cartEditor.setDirty(); ! } ! } ! } ! } ! }; ! deleteAction.setText("Delete Blueprint"); ! deleteAction.setToolTipText("Delete selected blueprint"); ! deleteAction.setImageDescriptor(ModelWizardPlugin.getIconPath("delProfile.gif")); ! ! doubleClickAction = new Action() { ! public void run() { ! ISelection selection = checkboxTreeViewer.getSelection(); ! Object obj = ((IStructuredSelection)selection).getFirstElement(); ! if (obj instanceof Profile){ ! Profile p = (Profile) obj; ! ProfileUtilities.INSTANCE.openProfileFromUri(ProfileUtilities.INSTANCE.getRelativeProfile(p.getPath())); ! } ! } ! }; ! } ! ! } Index: CartEditorActionBarContributor.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/cartEditor/CartEditorActionBarContributor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CartEditorActionBarContributor.java 23 Nov 2005 23:27:07 -0000 1.2 --- CartEditorActionBarContributor.java 1 Feb 2006 09:26:38 -0000 1.3 *************** *** 1,113 **** ! package net.sourceforge.modelWizard.cartEditor; ! ! import java.util.HashSet; ! ! import org.eclipse.emf.common.util.TreeIterator; ! import org.eclipse.emf.ecore.EObject; ! import org.eclipse.jface.action.Action; ! import org.eclipse.jface.action.IMenuManager; ! import org.eclipse.jface.action.IToolBarManager; ! import org.eclipse.jface.action.MenuManager; ! import org.eclipse.jface.wizard.WizardDialog; ! import org.eclipse.swt.SWT; ! import org.eclipse.swt.widgets.Display; ! import org.eclipse.swt.widgets.MessageBox; ! import org.eclipse.swt.widgets.Shell; ! import org.eclipse.ui.IEditorPart; ! import org.eclipse.ui.IWorkbenchActionConstants; ! import org.eclipse.ui.part.EditorActionBarContributor; ! ! ! import net.sourceforge.modelWizard.ModelWizardPlugin; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Class; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Profile; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Required; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartType; ! import net.sourceforge.modelWizard.wizards.ModelExtractWizard; ! ! /** ! * Manages the installation/deinstallation of global actions for multi-page editors. ! * Responsible for the redirection of global actions to the active editor. ! * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor. ! */ ! public class CartEditorActionBarContributor extends EditorActionBarContributor { ! private CartEditor cartEditor; ! private Action exportAction; ! ! /** ! * Creates a multi-page contributor. ! */ ! public CartEditorActionBarContributor() { ! super(); ! createActions(); ! } ! ! /* (non-JavaDoc) ! * Method declared in AbstractMultiPageEditorActionBarContributor. ! */ ! ! public void setActiveEditor(IEditorPart editor) { ! ! if (cartEditor == editor) ! return; ! ! if (editor instanceof CartEditor) { ! cartEditor = (CartEditor) editor; ! } ! ! } ! ! private void createActions() { ! exportAction = new Action() { ! public void run() { ! HashSet set = new HashSet(); ! ShoppingCartType cart = cartEditor.getCart(); ! ! if(cart.getProfile().size()>0){ ! TreeIterator i = cart.eAllContents(); ! while (i.hasNext()){ ! EObject eo = (EObject) i.next(); ! if (eo instanceof Profile){ ! Profile p = (Profile) eo; ! if (!(p.isExport() || p.getRequired().equals(Required.MANDATORY_LITERAL))){ ! i.prune(); ! } ! } ! if (eo instanceof Class){ ! if (((Class) eo).isExport()) ! set.add(((Class)eo).getName()); ! } ! } ! ModelExtractWizard wiz = new ModelExtractWizard(cartEditor.getProject(),set.iterator()); ! WizardDialog dialog = new WizardDialog (cartEditor.getShell(), wiz); ! dialog.open(); ! } else { ! MessageBox mb = new MessageBox(new Shell(Display.getDefault()), SWT.ICON_INFORMATION | SWT.OK); ! mb.setMessage("There are no blueprints in the shopping cart."); ! mb.open(); ! } ! } ! }; ! exportAction.setText("Export..."); ! exportAction.setToolTipText("Export"); ! exportAction.setImageDescriptor(ModelWizardPlugin.getIconPath("exportIcon.gif")); ! ! } ! ! public void contributeToMenu(IMenuManager manager) { ! IMenuManager wizMenu = new MenuManager("Shopping Cart","cart"); ! manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, wizMenu); ! wizMenu.add(exportAction); ! } ! ! public void contributeToToolBar(IToolBarManager manager) { ! // manager.add(new Separator()); ! // manager.add(exportAction); ! } ! /** ! * @return Returns the cartEditor. ! */ ! public CartEditor getCartEditor() { ! return cartEditor; ! } ! } --- 1,209 ---- ! package net.sourceforge.modelWizard.cartEditor; ! ! import java.lang.reflect.InvocationTargetException; ! ! import java.util.ArrayList; ! import java.util.Collection; ! import java.util.HashSet; ! import java.util.Iterator; ! ! import net.sourceforge.modelWizard.ModelWizardPlugin; ! import net.sourceforge.modelWizard.Profile.Association; ! import net.sourceforge.modelWizard.Profile.ProfileType1; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Class; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Profile; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Required; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartType; ! import net.sourceforge.modelWizard.backingModelAbstraction.ModelTransformationException; ! import net.sourceforge.modelWizard.utilities.ProfileUtilities; ! import net.sourceforge.modelWizard.wizards.ModelExtractWizard; ! ! import org.eclipse.emf.common.util.TreeIterator; ! import org.eclipse.emf.ecore.EObject; ! import org.eclipse.jface.action.Action; ! import org.eclipse.jface.action.IMenuManager; ! import org.eclipse.jface.action.IToolBarManager; ! import org.eclipse.jface.action.MenuManager; ! import org.eclipse.jface.dialogs.MessageDialog; ! import org.eclipse.jface.wizard.WizardDialog; ! import org.eclipse.swt.SWT; ! import org.eclipse.swt.widgets.Display; ! import org.eclipse.swt.widgets.MessageBox; ! import org.eclipse.swt.widgets.Shell; ! import org.eclipse.ui.IEditorPart; ! import org.eclipse.ui.IWorkbenchActionConstants; ! import org.eclipse.ui.part.EditorActionBarContributor; ! ! ! /** ! * Manages the installation/deinstallation of global actions for multi-page editors. ! * Responsible for the redirection of global actions to the active editor. ! * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor. ! */ ! public class CartEditorActionBarContributor ! extends EditorActionBarContributor ! { ! private CartEditor cartEditor; ! private Action exportAction; ! ! /** ! * Creates a multi-page contributor. ! */ ! public CartEditorActionBarContributor() ! { ! super(); ! createActions(); ! } ! ! /* (non-JavaDoc) ! * Method declared in AbstractMultiPageEditorActionBarContributor. ! */ ! public void setActiveEditor(IEditorPart editor) ! { ! if (cartEditor == editor) ! { ! return; ! } ! ! if (editor instanceof CartEditor) ! { ! cartEditor = (CartEditor)editor; ! } ! } ! ! private void createActions() ! { ! exportAction = ! new Action() ! { ! private Collection getAssociations(ProfileType1 profile, String name){ ! ArrayList assocRefs = new ArrayList(); ! for (Iterator i = profile.getElements().getClass_().iterator();i.hasNext();){ ! net.sourceforge.modelWizard.Profile.Class c = (net.sourceforge.modelWizard.Profile.Class) i.next(); ! if (c.getClassName().equalsIgnoreCase(name)) ! for (Iterator j = c.getAssociation().iterator();j.hasNext();){ ! Association a = (Association) j.next(); ! assocRefs.add(a.getAssociationName()); ! } ! } ! return assocRefs; ! } ! ! public void run() ! { ! ArrayList set = new ArrayList(); ! ! ShoppingCartType cart = cartEditor.getCart(); ! if (cart.getProfile().size() > 0) ! { ! for (Iterator i = cart.getProfile().iterator(); i.hasNext();) ! { ! ProfileType1 actualProfile; ! Profile cartProfile = (Profile)i.next(); ! if (!cartProfile.isExport()) ! continue; ! try ! { ! actualProfile = ! ProfileUtilities.INSTANCE.openProfile( ! ProfileUtilities.INSTANCE.getRelativeProfile(cartProfile.getPath())); ! } ! catch (Exception e) ! { ! ModelWizardPlugin.logError(e); ! MessageDialog.openError( ! cartEditor.getShell(), ! "Cannot open profile referenced in shopping cart.", ! e.getMessage()); ! return; ! } ! for (Iterator n = cartProfile.getClass_().iterator(); n.hasNext();) ! { ! Class profileClass = (Class)n.next(); ! if (!profileClass.isExport()) ! continue; ! set.add(profileClass.getName()); ! set.addAll(getAssociations(actualProfile,profileClass.getName())); ! } ! } ! ModelExtractWizard wiz = new ModelExtractWizard( ! cartEditor.getProject(), ! set.iterator()); ! WizardDialog dialog = new WizardDialog( ! cartEditor.getShell(), ! wiz); ! dialog.open(); ! } ! else ! { ! MessageBox mb = ! new MessageBox( ! new Shell(Display.getDefault()), ! SWT.ICON_INFORMATION | SWT.OK); ! mb.setMessage("There are no blueprints in the shopping cart."); ! mb.open(); ! } ! ! // if(cart.getProfile().size()>0){ ! // TreeIterator i = cart.eAllContents(); ! // while (i.hasNext()){ ! // EObject eo = (EObject) i.next(); ! // if (eo instanceof Profile){ ! // Profile p = (Profile) eo; ! // try { ! // ProfileType1 actualProfile = ProfileUtilities.INSTANCE.openProfile( ! // ProfileUtilities.INSTANCE.getRelativeProfile(p.getHref())); ! // } catch (InvocationTargetException e) { ! // // TODO Auto-generated catch block ! // e.printStackTrace(); ! // } catch (InterruptedException e) { ! // // TODO Auto-generated catch block ! // e.printStackTrace(); ! // } ! // if (!(p.isExport() || p.getRequired().equals(Required.MANDATORY_LITERAL))){ ! // i.prune(); ! // } ! // } ! // if (eo instanceof Class){ ! // if (((Class) eo).isExport()) ! // set.add(((Class)eo).getName()); ! // } ! // } ! // ModelExtractWizard wiz = new ModelExtractWizard(cartEditor.getProject(),set.iterator()); ! // WizardDialog dialog = new WizardDialog (cartEditor.getShell(), wiz); ! // dialog.open(); ! // } else { ! // MessageBox mb = new MessageBox(new Shell(Display.getDefault()), SWT.ICON_INFORMATION | SWT.OK); ! // mb.setMessage("There are no blueprints in the shopping cart."); ! // mb.open(); ! // } ! } ! }; ! exportAction.setText("Export..."); ! exportAction.setToolTipText("Export"); ! exportAction.setImageDescriptor(ModelWizardPlugin.getIconPath("exportIcon.gif")); ! } ! ! public void contributeToMenu(IMenuManager manager) ! { ! IMenuManager wizMenu = new MenuManager("Shopping Cart", "cart"); ! manager.prependToGroup( ! IWorkbenchActionConstants.MB_ADDITIONS, ! wizMenu); ! wizMenu.add(exportAction); ! } ! ! public void contributeToToolBar(IToolBarManager manager) ! { ! // manager.add(new Separator()); ! // manager.add(exportAction); ! } ! ! /** ! * @return Returns the cartEditor. ! */ ! public CartEditor getCartEditor() ! { ! return cartEditor; ! } ! } \ No newline at end of file |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:26:48
|
Update of /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/ShoppingCartSchema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14309/src/net/sourceforge/modelWizard/ShoppingCartSchema Modified Files: ShoppingCartSchemaPackage.java Profile.java Log Message: feb1 release Index: ShoppingCartSchemaPackage.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/ShoppingCartSchema/ShoppingCartSchemaPackage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShoppingCartSchemaPackage.java 6 Oct 2005 15:59:05 -0000 1.1 --- ShoppingCartSchemaPackage.java 1 Feb 2006 09:26:38 -0000 1.2 *************** *** 1,661 **** ! /** ! * <copyright> ! * </copyright> ! * ! * $Id$ ! */ ! package net.sourceforge.modelWizard.ShoppingCartSchema; ! ! import org.eclipse.emf.ecore.EAttribute; ! import org.eclipse.emf.ecore.EClass; [...1293 lines suppressed...] ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @return the meta object for data type '<em>Required Object</em>'. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.Required ! * @model instanceClass="net.sourceforge.modelWizard.ShoppingCartSchema.Required" ! * extendedMetaData="name='required:Object' baseType='required'" ! * @generated ! */ ! EDataType getRequiredObject(); ! ! /** ! * Returns the factory that creates the instances of the model. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @return the factory that creates the instances of the model. ! * @generated ! */ ! ShoppingCartSchemaFactory getShoppingCartSchemaFactory(); ! ! } //ShoppingCartSchemaPackage Index: Profile.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/ShoppingCartSchema/Profile.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Profile.java 6 Oct 2005 15:59:05 -0000 1.1 --- Profile.java 1 Feb 2006 09:26:38 -0000 1.2 *************** *** 1,297 **** ! /** ! * <copyright> ! * </copyright> ! * ! * $Id$ ! */ ! package net.sourceforge.modelWizard.ShoppingCartSchema; ! ! import org.eclipse.emf.common.util.EList; ! ! import org.eclipse.emf.ecore.EObject; ! ! import org.eclipse.emf.ecore.util.FeatureMap; ! ! /** ! * <!-- begin-user-doc --> ! * A representation of the model object '<em><b>Profile</b></em>'. ! * <!-- end-user-doc --> ! * ! * <!-- begin-model-doc --> ! * the type of a profile ! * <!-- end-model-doc --> ! * ! * <p> ! * The following features are supported: ! * <ul> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getGroup <em>Group</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getDescription <em>Description</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getClass_ <em>Class</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getProfile <em>Profile</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#isExport <em>Export</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getHref <em>Href</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getName <em>Name</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getRequired <em>Required</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getVersion <em>Version</em>}</li> ! * </ul> ! * </p> ! * ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile() ! * @model extendedMetaData="name='Profile' kind='elementOnly'" ! * @generated ! */ ! public interface Profile extends EObject { ! /** ! * Returns the value of the '<em><b>Group</b></em>' attribute list. ! * The list contents are of type {@link org.eclipse.emf.ecore.util.FeatureMap.Entry}. ! * <!-- begin-user-doc --> ! * <p> ! * If the meaning of the '<em>Group</em>' attribute list isn't clear, ! * there really should be more of a description here... ! * </p> ! * <!-- end-user-doc --> ! * @return the value of the '<em>Group</em>' attribute list. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Group() ! * @model unique="false" dataType="org.eclipse.emf.ecore.EFeatureMapEntry" many="true" ! * extendedMetaData="kind='group' name='group:0'" ! * @generated ! */ ! FeatureMap getGroup(); ! ! /** ! * Returns the value of the '<em><b>Description</b></em>' attribute list. ! * The list contents are of type {@link java.lang.String}. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * description for the profile ! * <!-- end-model-doc --> ! * @return the value of the '<em>Description</em>' attribute list. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Description() ! * @model type="java.lang.String" unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" transient="true" volatile="true" derived="true" ! * extendedMetaData="kind='element' name='description' namespace='##targetNamespace' group='group:0'" ! * @generated ! */ ! EList getDescription(); ! ! /** ! * Returns the value of the '<em><b>Class</b></em>' containment reference list. ! * The list contents are of type {@link net.sourceforge.modelWizard.ShoppingCartSchema.Class}. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * One per class. As defined in the profile defintion,... ! * <!-- end-model-doc --> ! * @return the value of the '<em>Class</em>' containment reference list. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Class() ! * @model type="net.sourceforge.modelWizard.ShoppingCartSchema.Class" containment="true" resolveProxies="false" transient="true" volatile="true" derived="true" ! * extendedMetaData="kind='element' name='Class' namespace='##targetNamespace' group='group:0'" ! * @generated ! */ ! EList getClass_(); ! ! /** ! * Returns the value of the '<em><b>Profile</b></em>' containment reference list. ! * The list contents are of type {@link net.sourceforge.modelWizard.ShoppingCartSchema.ProfilePointer}. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * Referenced profiles... ! * <!-- end-model-doc --> ! * @return the value of the '<em>Profile</em>' containment reference list. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Profile() ! * @model type="net.sourceforge.modelWizard.ShoppingCartSchema.ProfilePointer" containment="true" resolveProxies="false" transient="true" volatile="true" derived="true" ! * extendedMetaData="kind='element' name='Profile' namespace='##targetNamespace' group='group:0'" ! * @generated ! */ ! EList getProfile(); ! ! /** ! * Returns the value of the '<em><b>Export</b></em>' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * indicates whether the profile is to be exported from the cart or not ! * <!-- end-model-doc --> ! * @return the value of the '<em>Export</em>' attribute. ! * @see #isSetExport() ! * @see #unsetExport() ! * @see #setExport(boolean) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Export() ! * @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Boolean" required="true" ! * extendedMetaData="kind='attribute' name='export' namespace='##targetNamespace'" ! * @generated ! */ ! boolean isExport(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#isExport <em>Export</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Export</em>' attribute. ! * @see #isSetExport() ! * @see #unsetExport() ! * @see #isExport() ! * @generated ! */ ! void setExport(boolean value); ! ! /** ! * Unsets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#isExport <em>Export</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @see #isSetExport() ! * @see #isExport() ! * @see #setExport(boolean) ! * @generated ! */ ! void unsetExport(); ! ! /** ! * Returns whether the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#isExport <em>Export</em>}' attribute is set. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @return whether the value of the '<em>Export</em>' attribute is set. ! * @see #unsetExport() ! * @see #isExport() ! * @see #setExport(boolean) ! * @generated ! */ ! boolean isSetExport(); ! ! /** ! * Returns the value of the '<em><b>Href</b></em>' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * path to the profile relative to the profiles directory. ! * <!-- end-model-doc --> ! * @return the value of the '<em>Href</em>' attribute. ! * @see #setHref(String) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Href() ! * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true" ! * extendedMetaData="kind='attribute' name='href' namespace='##targetNamespace'" ! * @generated ! */ ! String getHref(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getHref <em>Href</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Href</em>' attribute. ! * @see #getHref() ! * @generated ! */ ! void setHref(String value); ! ! /** ! * Returns the value of the '<em><b>Name</b></em>' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * The name of the profile (from the profile defintion) ! * <!-- end-model-doc --> ! * @return the value of the '<em>Name</em>' attribute. ! * @see #setName(String) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Name() ! * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true" ! * extendedMetaData="kind='attribute' name='name' namespace='##targetNamespace'" ! * @generated ! */ ! String getName(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getName <em>Name</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Name</em>' attribute. ! * @see #getName() ! * @generated ! */ ! void setName(String value); ! ! /** ! * Returns the value of the '<em><b>Required</b></em>' attribute. ! * The default value is <code>"mandatory"</code>. ! * The literals are from the enumeration {@link net.sourceforge.modelWizard.ShoppingCartSchema.Required}. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * Indicates whether the profile is required or not. ! * <!-- end-model-doc --> ! * @return the value of the '<em>Required</em>' attribute. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.Required ! * @see #isSetRequired() ! * @see #unsetRequired() ! * @see #setRequired(Required) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Required() ! * @model default="mandatory" unique="false" unsettable="true" ! * extendedMetaData="kind='attribute' name='required' namespace='##targetNamespace'" ! * @generated ! */ ! Required getRequired(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getRequired <em>Required</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Required</em>' attribute. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.Required ! * @see #isSetRequired() ! * @see #unsetRequired() ! * @see #getRequired() ! * @generated ! */ ! void setRequired(Required value); ! ! /** ! * Unsets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getRequired <em>Required</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @see #isSetRequired() ! * @see #getRequired() ! * @see #setRequired(Required) ! * @generated ! */ ! void unsetRequired(); ! ! /** ! * Returns whether the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getRequired <em>Required</em>}' attribute is set. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @return whether the value of the '<em>Required</em>' attribute is set. ! * @see #unsetRequired() ! * @see #getRequired() ! * @see #setRequired(Required) ! * @generated ! */ ! boolean isSetRequired(); ! ! /** ! * Returns the value of the '<em><b>Version</b></em>' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * The version of the profile (from the profile defintion) ! * <!-- end-model-doc --> ! * @return the value of the '<em>Version</em>' attribute. ! * @see #setVersion(String) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Version() ! * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true" ! * extendedMetaData="kind='attribute' name='version' namespace='##targetNamespace'" ! * @generated ! */ ! String getVersion(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getVersion <em>Version</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Version</em>' attribute. ! * @see #getVersion() ! * @generated ! */ ! void setVersion(String value); ! ! } // Profile --- 1,297 ---- ! /** ! * <copyright> ! * </copyright> ! * ! * $Id$ ! */ ! package net.sourceforge.modelWizard.ShoppingCartSchema; ! ! import org.eclipse.emf.common.util.EList; ! ! import org.eclipse.emf.ecore.EObject; ! ! import org.eclipse.emf.ecore.util.FeatureMap; ! ! /** ! * <!-- begin-user-doc --> ! * A representation of the model object '<em><b>Profile</b></em>'. ! * <!-- end-user-doc --> ! * ! * <!-- begin-model-doc --> ! * the type of a profile ! * <!-- end-model-doc --> ! * ! * <p> ! * The following features are supported: ! * <ul> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getGroup <em>Group</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getDescription <em>Description</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getClass_ <em>Class</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getProfile <em>Profile</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#isExport <em>Export</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getName <em>Name</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getPath <em>Path</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getRequired <em>Required</em>}</li> ! * <li>{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getVersion <em>Version</em>}</li> ! * </ul> ! * </p> ! * ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile() ! * @model extendedMetaData="name='Profile' kind='elementOnly'" ! * @generated ! */ ! public interface Profile extends EObject{ ! /** ! * Returns the value of the '<em><b>Group</b></em>' attribute list. ! * The list contents are of type {@link org.eclipse.emf.ecore.util.FeatureMap.Entry}. ! * <!-- begin-user-doc --> ! * <p> ! * If the meaning of the '<em>Group</em>' attribute list isn't clear, ! * there really should be more of a description here... ! * </p> ! * <!-- end-user-doc --> ! * @return the value of the '<em>Group</em>' attribute list. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Group() ! * @model unique="false" dataType="org.eclipse.emf.ecore.EFeatureMapEntry" many="true" ! * extendedMetaData="kind='group' name='group:0'" ! * @generated ! */ ! FeatureMap getGroup(); ! ! /** ! * Returns the value of the '<em><b>Description</b></em>' attribute list. ! * The list contents are of type {@link java.lang.String}. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * description for the profile ! * <!-- end-model-doc --> ! * @return the value of the '<em>Description</em>' attribute list. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Description() ! * @model type="java.lang.String" unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" transient="true" volatile="true" derived="true" ! * extendedMetaData="kind='element' name='description' namespace='##targetNamespace' group='group:0'" ! * @generated ! */ ! EList getDescription(); ! ! /** ! * Returns the value of the '<em><b>Class</b></em>' containment reference list. ! * The list contents are of type {@link net.sourceforge.modelWizard.ShoppingCartSchema.Class}. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * One per class. As defined in the profile defintion,... ! * <!-- end-model-doc --> ! * @return the value of the '<em>Class</em>' containment reference list. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Class() ! * @model type="net.sourceforge.modelWizard.ShoppingCartSchema.Class" containment="true" resolveProxies="false" transient="true" volatile="true" derived="true" ! * extendedMetaData="kind='element' name='Class' namespace='##targetNamespace' group='group:0'" ! * @generated ! */ ! EList getClass_(); ! ! /** ! * Returns the value of the '<em><b>Profile</b></em>' containment reference list. ! * The list contents are of type {@link net.sourceforge.modelWizard.ShoppingCartSchema.ProfilePointer}. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * Referenced profiles... ! * <!-- end-model-doc --> ! * @return the value of the '<em>Profile</em>' containment reference list. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Profile() ! * @model type="net.sourceforge.modelWizard.ShoppingCartSchema.ProfilePointer" containment="true" resolveProxies="false" transient="true" volatile="true" derived="true" ! * extendedMetaData="kind='element' name='Profile' namespace='##targetNamespace' group='group:0'" ! * @generated ! */ ! EList getProfile(); ! ! /** ! * Returns the value of the '<em><b>Export</b></em>' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * indicates whether the profile is to be exported from the cart or not ! * <!-- end-model-doc --> ! * @return the value of the '<em>Export</em>' attribute. ! * @see #isSetExport() ! * @see #unsetExport() ! * @see #setExport(boolean) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Export() ! * @model unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Boolean" required="true" ! * extendedMetaData="kind='attribute' name='export' namespace='##targetNamespace'" ! * @generated ! */ ! boolean isExport(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#isExport <em>Export</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Export</em>' attribute. ! * @see #isSetExport() ! * @see #unsetExport() ! * @see #isExport() ! * @generated ! */ ! void setExport(boolean value); ! ! /** ! * Unsets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#isExport <em>Export</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @see #isSetExport() ! * @see #isExport() ! * @see #setExport(boolean) ! * @generated ! */ ! void unsetExport(); ! ! /** ! * Returns whether the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#isExport <em>Export</em>}' attribute is set. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @return whether the value of the '<em>Export</em>' attribute is set. ! * @see #unsetExport() ! * @see #isExport() ! * @see #setExport(boolean) ! * @generated ! */ ! boolean isSetExport(); ! ! /** ! * Returns the value of the '<em><b>Name</b></em>' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * The name of the profile (from the profile defintion) ! * <!-- end-model-doc --> ! * @return the value of the '<em>Name</em>' attribute. ! * @see #setName(String) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Name() ! * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true" ! * extendedMetaData="kind='attribute' name='name' namespace='##targetNamespace'" ! * @generated ! */ ! String getName(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getName <em>Name</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Name</em>' attribute. ! * @see #getName() ! * @generated ! */ ! void setName(String value); ! ! /** ! * Returns the value of the '<em><b>Path</b></em>' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * path to the profile relative to the profiles directory. ! * <!-- end-model-doc --> ! * @return the value of the '<em>Path</em>' attribute. ! * @see #setPath(String) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Path() ! * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true" ! * extendedMetaData="kind='attribute' name='path' namespace='##targetNamespace'" ! * @generated ! */ ! String getPath(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getPath <em>Path</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Path</em>' attribute. ! * @see #getPath() ! * @generated ! */ ! void setPath(String value); ! ! /** ! * Returns the value of the '<em><b>Required</b></em>' attribute. ! * The default value is <code>"mandatory"</code>. ! * The literals are from the enumeration {@link net.sourceforge.modelWizard.ShoppingCartSchema.Required}. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * Indicates whether the profile is required or not. ! * <!-- end-model-doc --> ! * @return the value of the '<em>Required</em>' attribute. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.Required ! * @see #isSetRequired() ! * @see #unsetRequired() ! * @see #setRequired(Required) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Required() ! * @model default="mandatory" unique="false" unsettable="true" ! * extendedMetaData="kind='attribute' name='required' namespace='##targetNamespace'" ! * @generated ! */ ! Required getRequired(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getRequired <em>Required</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Required</em>' attribute. ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.Required ! * @see #isSetRequired() ! * @see #unsetRequired() ! * @see #getRequired() ! * @generated ! */ ! void setRequired(Required value); ! ! /** ! * Unsets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getRequired <em>Required</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @see #isSetRequired() ! * @see #getRequired() ! * @see #setRequired(Required) ! * @generated ! */ ! void unsetRequired(); ! ! /** ! * Returns whether the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getRequired <em>Required</em>}' attribute is set. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @return whether the value of the '<em>Required</em>' attribute is set. ! * @see #unsetRequired() ! * @see #getRequired() ! * @see #setRequired(Required) ! * @generated ! */ ! boolean isSetRequired(); ! ! /** ! * Returns the value of the '<em><b>Version</b></em>' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * <!-- begin-model-doc --> ! * The version of the profile (from the profile defintion) ! * <!-- end-model-doc --> ! * @return the value of the '<em>Version</em>' attribute. ! * @see #setVersion(String) ! * @see net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartSchemaPackage#getProfile_Version() ! * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true" ! * extendedMetaData="kind='attribute' name='version' namespace='##targetNamespace'" ! * @generated ! */ ! String getVersion(); ! ! /** ! * Sets the value of the '{@link net.sourceforge.modelWizard.ShoppingCartSchema.Profile#getVersion <em>Version</em>}' attribute. ! * <!-- begin-user-doc --> ! * <!-- end-user-doc --> ! * @param value the new value of the '<em>Version</em>' attribute. ! * @see #getVersion() ! * @generated ! */ ! void setVersion(String value); ! ! } // Profile |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:26:48
|
Update of /cvsroot/modelwizard/source/Model Wizard Plugin/xsl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14309/xsl Modified Files: profileDetail.xsl Log Message: feb1 release Index: profileDetail.xsl =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/xsl/profileDetail.xsl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** profileDetail.xsl 27 Sep 2005 18:42:20 -0000 1.1.1.1 --- profileDetail.xsl 1 Feb 2006 09:26:39 -0000 1.2 *************** *** 1,218 **** ! <?xml version="1.0" encoding="UTF-8"?> ! <?altova_samplexml C:\Documents and Settings\stjerman\My Documents\protoEclipseWorkspace\CIM Wizard Data\profile\networking\IP.prf?> ! <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"> ! <xsl:template match="/"> ! <html> ! <xsl:apply-templates select="/profile"/> ! </html> ! </xsl:template> ! <xsl:template match="/profile"> ! <head> ! <title> ! <xsl:value-of select="@name"/> ! </title> ! <style> ! <xsl:comment> ! h1 { font-family: Arial; color: #FFFFFF; background-color: #C0C0C0 } ! h2 { font-family: Arial; font-style: italic } ! body { font-family: Arial; background-color: white; margin-top:0 } ! .classNorm { font-family: Arial; color: #FFFFFF; background-color: #000000; font-style: bold;} ! </xsl:comment> ! </style> ! </head> ! <body> ! <h1> ! <xsl:value-of select="@name"/> ! </h1> ! <b>Version:</b> ! <xsl:value-of select="@version"/> ! <br/> ! <b>Synopsis:</b> ! <br/> ! <xsl:value-of select="synopsis"/> ! <br/> ! <b>Description:</b> ! <br/> ! <xsl:copy-of select="description"/> ! <br/> ! <xsl:if test="count(useCases/case)>0"> ! <h2>Use Cases</h2> ! <ul> ! <xsl:for-each select="useCases/case"> ! <li> ! <xsl:element name="a"> ! <xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute> ! <xsl:value-of select="@name"/> ! </xsl:element> ! </li> ! </xsl:for-each> ! </ul> ! <xsl:apply-templates select="useCases/case"/> ! </xsl:if> ! <xsl:if test="count(proposedChange/changeRequest)>0"> ! <h2>Change Requests</h2> ! <xsl:for-each select="proposedChange/changeRequest"> ! <xsl:element name="a"> ! <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute> ! <xsl:value-of select="."/> ! </xsl:element> ! </xsl:for-each> ! </xsl:if> ! <xsl:if test="count(otherProfiles/profile)>0"> ! <h2>Other Profiles</h2> ! <xsl:apply-templates select="otherProfiles/profile" mode="detail"/> ! </xsl:if> ! <xsl:if test="count(standardDependencies/specificationRef)>0"> ! <h2>Standards Dependencies.</h2> ! <xsl:apply-templates select="standardDependencies/specificationRef"/> ! </xsl:if> ! <xsl:if test="count(elements)>0"> ! <h2>Required Elements.</h2> ! <table border="=1" width="100%"> ! <tbody> ! <xsl:apply-templates select="elements/class"/> ! </tbody> ! </table> ! </xsl:if> ! ! </body> ! </xsl:template> ! <xsl:template match="class"> ! <xsl:if test="@requirementsLevel != 'INFORMATIONAL'"> ! <tr class="classNorm "> ! <td> ! <b>Class:</b> ! <xsl:value-of select="@className"/> ! </td> ! <td> ! <b>Requirements level:</b> ! <xsl:value-of select="@requirementsLevel"/> ! </td> ! </tr> ! <tr> ! <td colspan="2"> ! <xsl:copy-of select="description"/> ! </td> ! </tr> ! <xsl:if test="count(property)>0"> ! <tr> ! <td colspan="2"> ! <b>Properties:</b> ! </td> ! </tr> ! <xsl:apply-templates select="property"/> ! </xsl:if> ! </xsl:if> ! <xsl:if test="count(association)>0"> ! <tr> ! <td colspan="2"> ! <b>Associations:</b> ! </td> ! </tr> ! <xsl:apply-templates select="association"/> ! </xsl:if> ! </xsl:template> ! <xsl:template match="association"> ! <xsl:if test="@requirementsLevel != 'INFORMATIONAL'"> ! <tr> ! <td> ! <xsl:value-of select="@associationName"/> ! </td> ! <td> ! <xsl:value-of select="@requirementsLevel"/> ! </td> ! </tr> ! <tr> ! <td colspan="2" align="right">End Class:<xsl:value-of select="reference/@endClass"/>, ! End Role:<xsl:value-of select="reference/@endRole"/> ! </td> ! </tr> ! </xsl:if> ! </xsl:template> ! <xsl:template match="property"> ! <tr> ! <td> ! <xsl:value-of select="@propertyName"/> ! </td> ! <td> ! <xsl:value-of select="@requirementsLevel"/> ! </td> ! </tr> ! </xsl:template> ! <xsl:template match="case"> ! <xsl:element name="a"> ! <xsl:attribute name="name">#<xsl:value-of select="@name"/></xsl:attribute> ! <h3> ! <xsl:value-of select="@name"/> ! </h3> ! </xsl:element> ! <p/> ! <xsl:copy-of select="body"/> ! </xsl:template> ! <xsl:template match="profile" mode="detail"> ! <p> ! <table border="=1" width="100%"> ! <tbody> ! <tr> ! <td> ! <b>Name:</b> ! <xsl:value-of select="@name"/> ! </td> ! <td> ! <b>Version:</b> ! <xsl:value-of select="@version"/> ! </td> ! </tr> ! <tr> ! <td> ! <b>Org:</b> ! <xsl:value-of select="@organization"/> ! </td> ! <td> ! <b>Requirements level:</b> ! <xsl:value-of select="@requirementsLevel"/> ! </td> ! </tr> ! <tr> ! <td colspan="2"> ! <xsl:copy-of select="description"/> ! </td> ! </tr> ! </tbody> ! </table> ! </p> ! </xsl:template> ! <xsl:template match="specificationRef"> ! <p> ! <table border="=1" width="100%"> ! <tbody> ! <tr> ! <td> ! <b>Name:</b> ! <xsl:value-of select="@name"/> ! </td> ! <td> ! <b>Version:</b> ! <xsl:value-of select="@version"/> ! </td> ! </tr> ! <tr> ! <td> ! <b>Org:</b> ! <xsl:value-of select="@organization"/> ! </td> ! <td> ! <b>URI:</b> ! <xsl:if test="@uriRef"> ! <xsl:element name="a"> ! <xsl:attribute name="href"><xsl:value-of select="@uriRef"/></xsl:attribute> ! <xsl:value-of select="@uriRef"/> ! </xsl:element> ! </xsl:if> ! </td> ! </tr> ! </tbody> ! </table> ! </p> ! </xsl:template> ! </xsl:stylesheet> --- 1,228 ---- ! <?xml version="1.0" encoding="UTF-8"?> ! <?altova_samplexml C:\Documents and Settings\stjerman\My Documents\protoEclipseWorkspace\CIM Wizard Data\profile\networking\IP.prf?> ! <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"> ! <xsl:template match="/"> ! <html> ! <xsl:apply-templates select="/profile"/> ! </html> ! </xsl:template> ! <xsl:template match="/profile"> ! <head> ! <title> ! <xsl:value-of select="@name"/> ! </title> ! <style> ! <xsl:comment> ! h1 { font-family: Arial; color: #FFFFFF; background-color: #C0C0C0 } ! h2 { font-family: Arial; font-style: italic } ! body { font-family: Arial; background-color: white; margin-top:0 } ! .classNorm { font-family: Arial; color: #FFFFFF; background-color: #000000; font-style: bold;} ! </xsl:comment> ! </style> ! </head> ! <body> ! <h1> ! <xsl:value-of select="@name"/> ! </h1> ! <b>Version:</b> ! <xsl:value-of select="@version"/> ! <br/> ! <b>Synopsis:</b> ! <br/> ! <xsl:value-of select="synopsis"/> ! <br/> ! <b>Description:</b> ! <br/> ! <xsl:copy-of select="description"/> ! <br/> ! <xsl:if test="count(useCases/case)>0"> ! <h2>Use Cases</h2> ! <ul> ! <xsl:for-each select="useCases/case"> ! <li> ! <xsl:element name="a"> ! <xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute> ! <xsl:value-of select="@name"/> ! </xsl:element> ! </li> ! </xsl:for-each> ! </ul> ! <xsl:apply-templates select="useCases/case"/> ! </xsl:if> ! <xsl:if test="count(proposedChange/changeRequest)>0"> ! <h2>Change Requests</h2> ! <xsl:for-each select="proposedChange/changeRequest"> ! <xsl:element name="a"> ! <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute> ! <xsl:value-of select="."/> ! </xsl:element> ! </xsl:for-each> ! </xsl:if> ! <xsl:if test="count(otherProfiles/profile)>0"> ! <h2>Other Profiles</h2> ! <xsl:apply-templates select="otherProfiles/profile" mode="detail"/> ! </xsl:if> ! <xsl:if test="count(standardDependencies/specificationRef)>0"> ! <h2>Standards Dependencies.</h2> ! <xsl:apply-templates select="standardDependencies/specificationRef"/> ! </xsl:if> ! <xsl:if test="count(elements)>0"> ! <h2>Required Elements.</h2> ! <table border="=1" width="100%"> ! <tbody> ! <xsl:apply-templates select="elements/class"/> ! </tbody> ! </table> ! </xsl:if> ! ! </body> ! </xsl:template> ! <xsl:template match="class"> ! <xsl:if test="@requirementsLevel != 'INFORMATIONAL'"> ! <tr class="classNorm "> ! <td> ! <b>Class:</b> ! <xsl:value-of select="@className"/> ! </td> ! <td> ! <b>Requirements level:</b> ! <xsl:value-of select="@requirementsLevel"/> ! </td> ! </tr> ! <tr> ! <td colspan="2"> ! <xsl:copy-of select="description"/> ! </td> ! </tr> ! <xsl:if test="count(property)>0"> ! <tr> ! <td colspan="2"> ! <b>Properties:</b> ! </td> ! </tr> ! <xsl:apply-templates select="property"/> ! </xsl:if> ! </xsl:if> ! <xsl:if test="count(association)>0"> ! <tr> ! <td colspan="2"> ! <b>Associations:</b> ! </td> ! </tr> ! <xsl:apply-templates select="association"/> ! </xsl:if> ! </xsl:template> ! <xsl:template match="association"> ! <xsl:if test="@requirementsLevel != 'INFORMATIONAL'"> ! <tr> ! <td> ! <xsl:value-of select="@associationName"/> ! </td> ! <td> ! <xsl:value-of select="@requirementsLevel"/> ! </td> ! </tr> ! <tr> ! <td colspan="2" align="right">End Class:<xsl:value-of select="reference/@endClass"/>, ! End Role:<xsl:value-of select="reference/@endRole"/> ! </td> ! </tr> ! <tr> ! <td colspan="2"> ! <i><xsl:value-of select="description"/></i> ! </td> ! </tr> ! </xsl:if> ! </xsl:template> ! <xsl:template match="property"> ! <tr> ! <td> ! <xsl:value-of select="@propertyName"/> ! </td> ! <td> ! <xsl:value-of select="@requirementsLevel"/> ! </td> ! </tr> ! <tr> ! <td colspan="2"> ! <i><xsl:value-of select="description"/></i> ! </td> ! </tr> ! </xsl:template> ! <xsl:template match="case"> ! <xsl:element name="a"> ! <xsl:attribute name="name">#<xsl:value-of select="@name"/></xsl:attribute> ! <h3> ! <xsl:value-of select="@name"/> ! </h3> ! </xsl:element> ! <p/> ! <xsl:copy-of select="body"/> ! </xsl:template> ! <xsl:template match="profile" mode="detail"> ! <p> ! <table border="=1" width="100%"> ! <tbody> ! <tr> ! <td> ! <b>Name:</b> ! <xsl:value-of select="@name"/> ! </td> ! <td> ! <b>Version:</b> ! <xsl:value-of select="@version"/> ! </td> ! </tr> ! <tr> ! <td> ! <b>Org:</b> ! <xsl:value-of select="@organization"/> ! </td> ! <td> ! <b>Requirements level:</b> ! <xsl:value-of select="@requirementsLevel"/> ! </td> ! </tr> ! <tr> ! <td colspan="2"> ! <xsl:copy-of select="description"/> ! </td> ! </tr> ! </tbody> ! </table> ! </p> ! </xsl:template> ! <xsl:template match="specificationRef"> ! <p> ! <table border="=1" width="100%"> ! <tbody> ! <tr> ! <td> ! <b>Name:</b> ! <xsl:value-of select="@name"/> ! </td> ! <td> ! <b>Version:</b> ! <xsl:value-of select="@version"/> ! </td> ! </tr> ! <tr> ! <td> ! <b>Org:</b> ! <xsl:value-of select="@organization"/> ! </td> ! <td> ! <b>URI:</b> ! <xsl:if test="@uriRef"> ! <xsl:element name="a"> ! <xsl:attribute name="href"><xsl:value-of select="@uriRef"/></xsl:attribute> ! <xsl:value-of select="@uriRef"/> ! </xsl:element> ! </xsl:if> ! </td> ! </tr> ! </tbody> ! </table> ! </p> ! </xsl:template> ! </xsl:stylesheet> |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:26:47
|
Update of /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/utilities In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14309/src/net/sourceforge/modelWizard/utilities Modified Files: ProfileUtilities.java Log Message: feb1 release Index: ProfileUtilities.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/utilities/ProfileUtilities.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ProfileUtilities.java 7 Dec 2005 18:19:17 -0000 1.5 --- ProfileUtilities.java 1 Feb 2006 09:26:38 -0000 1.6 *************** *** 1,354 **** ! /* ! * Created on Sep 27, 2005 ! * @author stjerman ! * <copyright> ! * ! * Copyright (c) 2005 Cisco Systems Inc, ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the BSD License ! * which accompanies this distribution. ! * ! * Contributors: ! * CISCO - Initial API and implementation ! * ! * </copyright> ! */ ! ! package net.sourceforge.modelWizard.utilities; ! ! import java.io.IOException; ! import java.lang.reflect.InvocationTargetException; ! import java.net.MalformedURLException; ! import java.util.Iterator; ! ! import net.sourceforge.modelWizard.ModelWizardPlugin; ! import net.sourceforge.modelWizard.Profile.Class; ! import net.sourceforge.modelWizard.Profile.DocumentRoot; ! import net.sourceforge.modelWizard.Profile.ProfileType1; ! import net.sourceforge.modelWizard.Profile.RelatedProfile; ! import net.sourceforge.modelWizard.Profile.RequirementsLevel; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Profile; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ProfilePointer; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Required; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartType; ! import net.sourceforge.modelWizard.ShoppingCartSchema.impl.ShoppingCartSchemaFactoryImpl; ! import net.sourceforge.modelWizard.backingModelAbstraction.ModelAbstractionError; ! import net.sourceforge.modelWizard.modelAbstraction.ModelAccess; ! ! import org.eclipse.core.resources.IContainer; ! import org.eclipse.core.resources.IFile; ! import org.eclipse.core.resources.IProject; ! import org.eclipse.core.runtime.CoreException; ! import org.eclipse.core.runtime.IProgressMonitor; ! import org.eclipse.core.runtime.IStatus; ! import org.eclipse.core.runtime.Path; ! import org.eclipse.core.runtime.Status; ! import org.eclipse.emf.common.util.EList; ! import org.eclipse.emf.common.util.TreeIterator; ! import org.eclipse.emf.common.util.URI; ! import org.eclipse.emf.ecore.EObject; ! import org.eclipse.emf.ecore.resource.Resource; ! import org.eclipse.emf.ecore.resource.ResourceSet; ! import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; ! import org.eclipse.jface.dialogs.ProgressMonitorDialog; ! import org.eclipse.jface.operation.IRunnableWithProgress; ! import org.eclipse.swt.SWT; ! import org.eclipse.swt.widgets.Display; ! import org.eclipse.swt.widgets.MessageBox; ! import org.eclipse.swt.widgets.Shell; ! import org.eclipse.ui.IEditorDescriptor; ! import org.eclipse.ui.IEditorRegistry; ! import org.eclipse.ui.IWorkbenchPage; ! import org.eclipse.ui.IWorkbenchWindow; ! import org.eclipse.ui.PlatformUI; ! import org.eclipse.ui.internal.WorkbenchPlugin; ! import org.eclipse.emf.common.ui.URIEditorInput; ! ! ; ! ! /** ! * @author sschlmr ! * ! */ ! public class ProfileUtilities { ! ! /** ! * singleton instance ! */ ! public static ProfileUtilities INSTANCE = new ProfileUtilities(); ! ! /** ! * @param defaultCart ! * @param cartProfile ! * @return ! */ ! public boolean containsProfile(ShoppingCartType cart, Profile profile) { ! return findProfileInCart(cart, profile.getName()) != null; ! } ! ! public Profile findProfileInCart(ShoppingCartType cart, String profileName) { ! for (TreeIterator i = cart.eAllContents(); i.hasNext();) { ! EObject eo = (EObject) i.next(); ! if (eo instanceof Profile){ ! Profile p = (Profile)eo; ! if (p.getName().equals(profileName)) { ! return p; ! } ! } ! } ! return null; ! ! } ! ! public void createReferencedProfiles(ShoppingCartType cart, ProfileType1 profile, Profile parent) throws MalformedURLException, InvocationTargetException, InterruptedException, IOException{ ! if (profile.getOtherProfiles() != null){ ! EList incProfs = profile.getOtherProfiles().getProfile(); ! for (int i = 0; i<incProfs.size();i++){ ! RelatedProfile p = (RelatedProfile) incProfs.get(i); ! if (findProfileInCart(cart, p.getName()) == null){ ! Profile sp = ShoppingCartSchemaFactoryImpl.eINSTANCE.createProfile(); ! sp.setExport(true); ! sp.setHref(p.getFile()); ! sp.setName(p.getName()); ! RequirementsLevel c= p.getRequirementsLevel(); ! if (c.equals(RequirementsLevel.MANDATORY_LITERAL)) ! sp.setRequired(Required.MANDATORY_LITERAL); ! if (c.equals(RequirementsLevel.CONDITIONAL_LITERAL)) ! sp.setRequired(Required.CONDITIONAL_LITERAL); ! if (c.equals(RequirementsLevel.OPTIONAL_LITERAL)) ! sp.setRequired(Required.OPTIONAL_LITERAL); ! ProfileType1 incProf = ! ProfileUtilities.INSTANCE.openProfile(getRelativeProfile(p.getFile())); ! addClassesFromProfile(incProf, sp); ! cart.getProfile().add(sp); ! ProfilePointer pp = ShoppingCartSchemaFactoryImpl.eINSTANCE.createProfilePointer(); ! pp.setName(p.getName()); ! pp.setPath(p.getFile()); ! parent.getProfile().add(pp); ! createReferencedProfiles(cart,incProf,sp); ! } ! } ! } ! } ! ! public void addProfileToCart (ShoppingCartType cart, URI profileUri) throws MalformedURLException, InvocationTargetException, InterruptedException, IOException{ ! ProfileType1 profile = ! ProfileUtilities.INSTANCE.openProfile(profileUri); ! if (findProfileInCart(cart, profile.getName()) == null){ ! Profile newProfile = ShoppingCartSchemaFactoryImpl.eINSTANCE.createProfile(); ! newProfile.setName(profile.getName()); ! newProfile.setExport(true); ! newProfile.setHref(profileUri.toString()); ! addClassesFromProfile(profile, newProfile); ! cart.getProfile().add(newProfile); ! createReferencedProfiles(cart,profile, newProfile); ! } ! } ! ! public void addProfileToCart (ShoppingCartType cart, String pPath) throws MalformedURLException, InvocationTargetException, InterruptedException, IOException{ ! URI profileUri = URI.createFileURI(pPath); ! addProfileToCart(cart,profileUri); ! } ! ! /** ! * @param classes ! * @param profile ! */ ! private void addClassesFromProfile(ProfileType1 sourceProfile, Profile profile) { ! Iterator classes = sourceProfile.getElements().getClass_().iterator(); ! for (Iterator i = classes; i.hasNext();) { ! net.sourceforge.modelWizard.ShoppingCartSchema.Class cpc = ShoppingCartSchemaFactoryImpl.eINSTANCE.createClass(); ! Class ct =(Class) i.next(); ! if (!ct.getRequirementsLevel().equals(RequirementsLevel.INFORMATIONAL_LITERAL)){ ! cpc.setName(ct.getClassName()); ! if (ct.getRequirementsLevel() == RequirementsLevel.CONDITIONAL_LITERAL){ ! cpc.setExport(true); ! cpc.setRequired(Required.get(Required.CONDITIONAL)); ! } ! else if (ct.getRequirementsLevel() == RequirementsLevel.MANDATORY_LITERAL) { ! cpc.setExport(true); ! cpc.setRequired(Required.get(Required.MANDATORY)); ! } ! else if (ct.getRequirementsLevel() == RequirementsLevel.OPTIONAL_LITERAL){ ! cpc.setExport(false); ! cpc.setRequired(Required.get(Required.OPTIONAL)); ! } ! profile.getClass_().add(cpc); ! } ! } ! } ! ! /** ! * @param name ! */ ! public void removeProfile(ShoppingCartType cart, String profileName) { ! Profile profile = findProfileInCart(cart, profileName); ! if (profile == null) { ! return; ! } ! ! cart.getProfile().remove(profile); ! } ! ! /** ! * returns false if the cart contains the named profile and the user does not ! * want to replace it ! * returns true otherwise ! * ! * @param cart ! * @param profileName ! * @return ! */ ! public boolean handlePossibleProfileInCart(ShoppingCartType cart, String profileName) { ! ! Profile cartProfile = ShoppingCartSchemaFactoryImpl.eINSTANCE.createProfile(); ! cartProfile.setName(profileName); ! if (containsProfile(cart,cartProfile)) { ! MessageBox mb = new MessageBox(new Shell(Display.getDefault()), SWT.ICON_WARNING | SWT.YES | SWT.NO); ! mb.setMessage("Blueprint " + profileName + " is already in your cart. Do you want to replace it?"); ! switch (mb.open()) { ! case SWT.NO: ! return false; ! case SWT.YES: ! removeProfile(cart, profileName); ! break; ! default: ! break; ! } ! } ! return true; ! } ! ! public Class findClassInProfile(ProfileType1 profile, String className) { ! for (Iterator i = profile.getElements().getClass_().iterator(); i ! .hasNext();) { ! Class ct = (Class) i.next(); ! if (ct.getClassName().equals(className)) { ! return ct; ! } ! } ! return null; ! } ! ! class OpenProfileRunnable implements IRunnableWithProgress { ! ! final URI fileUri; ! ! private ProfileType1 theProfile = null; ! ! OpenProfileRunnable(URI profileName) { ! this.fileUri = profileName; ! } ! ! public void run(IProgressMonitor monitor) ! throws InvocationTargetException { ! monitor.beginTask("Opening " + fileUri, IProgressMonitor.UNKNOWN); ! try { ! ! Resource resource = null; ! DocumentRoot docRoot = null; ! ! if (fileUri == null) { ! IStatus status = new Status(IStatus.ERROR, "shoppingCart", ! IStatus.OK, "Blueprint " + fileUri ! + " doesn't exist yet.", null); ! throw new CoreException(status); ! } ! ResourceSet resourceSet = new ResourceSetImpl(); ! try { ! resource = resourceSet.getResource(fileUri, true); ! } catch (Exception e) { ! IStatus status = new Status(IStatus.ERROR, "shoppingCart", ! IStatus.OK, "Can't open model :" + fileUri, e); ! throw new CoreException(status); ! } ! if (resource.isLoaded()) { ! docRoot = (DocumentRoot) resource.getContents().get(0); // must ! // be a ! // single ! // document ! // root ! theProfile = docRoot.getProfile(); ! } else { ! IStatus status = new Status(IStatus.ERROR, "shoppingCart", ! IStatus.OK, "Can't open model :" + fileUri, null); ! throw new CoreException(status); ! } ! } catch (CoreException e) { ! throw new InvocationTargetException(e); ! } finally { ! monitor.done(); ! } ! } ! ! public ProfileType1 getProfile() { ! return theProfile; ! } ! }; ! ! /** ! * Relative to profile folder!! ! * @param profilePath ! * @return ! */ ! public URI getRelativeProfile(String profilePath) { ! ! URI pPath = ModelAccess.INSTANCE.getCurrentProfileFolder(); ! URI relPath = URI.createURI(profilePath); ! return relPath.resolve(pPath); ! } ! ! ! public ProfileType1 getAbsoluteProfile(String profilePath) ! throws InvocationTargetException, InterruptedException, ! MalformedURLException, IOException { ! ! URI pPath = URI.createFileURI(profilePath); ! return openProfile(pPath); ! } ! ! public ProfileType1 openProfile(URI pPath) throws InvocationTargetException, InterruptedException { ! OpenProfileRunnable op = new OpenProfileRunnable(pPath); ! ! new ProgressMonitorDialog(ModelWizardPlugin.getDefault().getWorkbench() ! .getActiveWorkbenchWindow().getShell()).run(true, true, op); ! return op.getProfile(); ! } ! ! public IFile getProfileFile(String profileFileName, IProject project) { ! IContainer theContainer = project.getFolder(new Path("profile")); ! return theContainer.getFile(new Path(profileFileName)); ! } ! ! public void openProfileFromUri(URI profileUri) { ! // ! // get default editor descriptor ! // ! IEditorRegistry editorRegistry = WorkbenchPlugin.getDefault() ! .getEditorRegistry(); ! ! IEditorDescriptor defaultEditorDescriptor = editorRegistry ! .getDefaultEditor("dummy.prf"); ! // Open new file in editor ! IWorkbenchWindow dw = PlatformUI.getWorkbench() ! .getActiveWorkbenchWindow(); ! try { ! ! URIEditorInput uei = new URIEditorInput(profileUri); ! if (!uei.exists()) ! throw new ModelAbstractionError("Can't find "+uei.getName()); ! IWorkbenchPage page = dw.getActivePage(); ! if (page != null) ! page.openEditor(uei, defaultEditorDescriptor.getId()); ! } catch (Exception e) { ! ExceptionDetailsDialog dialog = new ExceptionDetailsDialog( ! new Shell(Display.getDefault()), ! "Profile Error", ! null, ! "Sorry this blueprint does not yet exist or cannot be accessed for some reason.", ! e); ! dialog.open(); ! ModelWizardPlugin.logError(e); ! } ! } ! } --- 1,354 ---- ! /* ! * Created on Sep 27, 2005 ! * @author stjerman ! * <copyright> ! * ! * Copyright (c) 2005 Cisco Systems Inc, ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the BSD License ! * which accompanies this distribution. ! * ! * Contributors: ! * CISCO - Initial API and implementation ! * ! * </copyright> ! */ ! ! package net.sourceforge.modelWizard.utilities; ! ! import java.io.IOException; ! import java.lang.reflect.InvocationTargetException; ! import java.net.MalformedURLException; ! import java.util.Iterator; ! ! import net.sourceforge.modelWizard.ModelWizardPlugin; ! import net.sourceforge.modelWizard.Profile.Class; ! import net.sourceforge.modelWizard.Profile.DocumentRoot; ! import net.sourceforge.modelWizard.Profile.ProfileType1; ! import net.sourceforge.modelWizard.Profile.RelatedProfile; ! import net.sourceforge.modelWizard.Profile.RequirementsLevel; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Profile; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ProfilePointer; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Required; ! import net.sourceforge.modelWizard.ShoppingCartSchema.ShoppingCartType; ! import net.sourceforge.modelWizard.ShoppingCartSchema.impl.ShoppingCartSchemaFactoryImpl; ! import net.sourceforge.modelWizard.backingModelAbstraction.ModelAbstractionError; ! import net.sourceforge.modelWizard.modelAbstraction.ModelAccess; ! ! import org.eclipse.core.resources.IContainer; ! import org.eclipse.core.resources.IFile; ! import org.eclipse.core.resources.IProject; ! import org.eclipse.core.runtime.CoreException; ! import org.eclipse.core.runtime.IProgressMonitor; ! import org.eclipse.core.runtime.IStatus; ! import org.eclipse.core.runtime.Path; ! import org.eclipse.core.runtime.Status; ! import org.eclipse.emf.common.util.EList; ! import org.eclipse.emf.common.util.TreeIterator; ! import org.eclipse.emf.common.util.URI; ! import org.eclipse.emf.ecore.EObject; ! import org.eclipse.emf.ecore.resource.Resource; ! import org.eclipse.emf.ecore.resource.ResourceSet; ! import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; ! import org.eclipse.jface.dialogs.ProgressMonitorDialog; ! import org.eclipse.jface.operation.IRunnableWithProgress; ! import org.eclipse.swt.SWT; ! import org.eclipse.swt.widgets.Display; ! import org.eclipse.swt.widgets.MessageBox; ! import org.eclipse.swt.widgets.Shell; ! import org.eclipse.ui.IEditorDescriptor; ! import org.eclipse.ui.IEditorRegistry; ! import org.eclipse.ui.IWorkbenchPage; ! import org.eclipse.ui.IWorkbenchWindow; ! import org.eclipse.ui.PlatformUI; ! import org.eclipse.ui.internal.WorkbenchPlugin; ! import org.eclipse.emf.common.ui.URIEditorInput; ! ! ; ! ! /** ! * @author sschlmr ! * ! */ ! public class ProfileUtilities { ! ! /** ! * singleton instance ! */ ! public static ProfileUtilities INSTANCE = new ProfileUtilities(); ! ! /** ! * @param defaultCart ! * @param cartProfile ! * @return ! */ ! public boolean containsProfile(ShoppingCartType cart, Profile profile) { ! return findProfileInCart(cart, profile.getName()) != null; ! } ! ! public Profile findProfileInCart(ShoppingCartType cart, String profileName) { ! for (TreeIterator i = cart.eAllContents(); i.hasNext();) { ! EObject eo = (EObject) i.next(); ! if (eo instanceof Profile){ ! Profile p = (Profile)eo; ! if (p.getName().equals(profileName)) { ! return p; ! } ! } ! } ! return null; ! ! } ! ! public void createReferencedProfiles(ShoppingCartType cart, ProfileType1 profile, Profile parent) throws MalformedURLException, InvocationTargetException, InterruptedException, IOException{ ! if (profile.getOtherProfiles() != null){ ! EList incProfs = profile.getOtherProfiles().getProfile(); ! for (int i = 0; i<incProfs.size();i++){ ! RelatedProfile p = (RelatedProfile) incProfs.get(i); ! if (findProfileInCart(cart, p.getName()) == null){ ! Profile sp = ShoppingCartSchemaFactoryImpl.eINSTANCE.createProfile(); ! sp.setExport(true); ! sp.setPath(p.getFile()); ! sp.setName(p.getName()); ! RequirementsLevel c= p.getRequirementsLevel(); ! if (c.equals(RequirementsLevel.MANDATORY_LITERAL)) ! sp.setRequired(Required.MANDATORY_LITERAL); ! if (c.equals(RequirementsLevel.CONDITIONAL_LITERAL)) ! sp.setRequired(Required.CONDITIONAL_LITERAL); ! if (c.equals(RequirementsLevel.OPTIONAL_LITERAL)) ! sp.setRequired(Required.OPTIONAL_LITERAL); ! ProfileType1 incProf = ! ProfileUtilities.INSTANCE.openProfile(getRelativeProfile(p.getFile())); ! addClassesFromProfile(incProf, sp); ! cart.getProfile().add(sp); ! ProfilePointer pp = ShoppingCartSchemaFactoryImpl.eINSTANCE.createProfilePointer(); ! pp.setName(p.getName()); ! pp.setPath(p.getFile()); ! parent.getProfile().add(pp); ! createReferencedProfiles(cart,incProf,sp); ! } ! } ! } ! } ! ! public void addProfileToCart (ShoppingCartType cart, URI profileUri) throws MalformedURLException, InvocationTargetException, InterruptedException, IOException{ ! ProfileType1 profile = ! ProfileUtilities.INSTANCE.openProfile(profileUri); ! if (findProfileInCart(cart, profile.getName()) == null){ ! Profile newProfile = ShoppingCartSchemaFactoryImpl.eINSTANCE.createProfile(); ! newProfile.setName(profile.getName()); ! newProfile.setExport(true); ! newProfile.setPath(profileUri.toString()); ! addClassesFromProfile(profile, newProfile); ! cart.getProfile().add(newProfile); ! createReferencedProfiles(cart,profile, newProfile); ! } ! } ! ! public void addProfileToCart (ShoppingCartType cart, String pPath) throws MalformedURLException, InvocationTargetException, InterruptedException, IOException{ ! URI profileUri = URI.createFileURI(pPath); ! addProfileToCart(cart,profileUri); ! } ! ! /** ! * @param classes ! * @param profile ! */ ! private void addClassesFromProfile(ProfileType1 sourceProfile, Profile profile) { ! Iterator classes = sourceProfile.getElements().getClass_().iterator(); ! for (Iterator i = classes; i.hasNext();) { ! net.sourceforge.modelWizard.ShoppingCartSchema.Class cpc = ShoppingCartSchemaFactoryImpl.eINSTANCE.createClass(); ! Class ct =(Class) i.next(); ! if (!ct.getRequirementsLevel().equals(RequirementsLevel.INFORMATIONAL_LITERAL)){ ! cpc.setName(ct.getClassName()); ! if (ct.getRequirementsLevel() == RequirementsLevel.CONDITIONAL_LITERAL){ ! cpc.setExport(true); ! cpc.setRequired(Required.get(Required.CONDITIONAL)); ! } ! else if (ct.getRequirementsLevel() == RequirementsLevel.MANDATORY_LITERAL) { ! cpc.setExport(true); ! cpc.setRequired(Required.get(Required.MANDATORY)); ! } ! else if (ct.getRequirementsLevel() == RequirementsLevel.OPTIONAL_LITERAL){ ! cpc.setExport(false); ! cpc.setRequired(Required.get(Required.OPTIONAL)); ! } ! profile.getClass_().add(cpc); ! } ! } ! } ! ! /** ! * @param name ! */ ! public void removeProfile(ShoppingCartType cart, String profileName) { ! Profile profile = findProfileInCart(cart, profileName); ! if (profile == null) { ! return; ! } ! ! cart.getProfile().remove(profile); ! } ! ! /** ! * returns false if the cart contains the named profile and the user does not ! * want to replace it ! * returns true otherwise ! * ! * @param cart ! * @param profileName ! * @return ! */ ! public boolean handlePossibleProfileInCart(ShoppingCartType cart, String profileName) { ! ! Profile cartProfile = ShoppingCartSchemaFactoryImpl.eINSTANCE.createProfile(); ! cartProfile.setName(profileName); ! if (containsProfile(cart,cartProfile)) { ! MessageBox mb = new MessageBox(new Shell(Display.getDefault()), SWT.ICON_WARNING | SWT.YES | SWT.NO); ! mb.setMessage("Blueprint " + profileName + " is already in your cart. Do you want to replace it?"); ! switch (mb.open()) { ! case SWT.NO: ! return false; ! case SWT.YES: ! removeProfile(cart, profileName); ! break; ! default: ! break; ! } ! } ! return true; ! } ! ! public Class findClassInProfile(ProfileType1 profile, String className) { ! for (Iterator i = profile.getElements().getClass_().iterator(); i ! .hasNext();) { ! Class ct = (Class) i.next(); ! if (ct.getClassName().equals(className)) { ! return ct; ! } ! } ! return null; ! } ! ! class OpenProfileRunnable implements IRunnableWithProgress { ! ! final URI fileUri; ! ! private ProfileType1 theProfile = null; ! ! OpenProfileRunnable(URI profileName) { ! this.fileUri = profileName; ! } ! ! public void run(IProgressMonitor monitor) ! throws InvocationTargetException { ! monitor.beginTask("Opening " + fileUri, IProgressMonitor.UNKNOWN); ! try { ! ! Resource resource = null; ! DocumentRoot docRoot = null; ! ! if (fileUri == null) { ! IStatus status = new Status(IStatus.ERROR, "shoppingCart", ! IStatus.OK, "Blueprint " + fileUri ! + " doesn't exist yet.", null); ! throw new CoreException(status); ! } ! ResourceSet resourceSet = new ResourceSetImpl(); ! try { ! resource = resourceSet.getResource(fileUri, true); ! } catch (Exception e) { ! IStatus status = new Status(IStatus.ERROR, "shoppingCart", ! IStatus.OK, "Can't open model :" + fileUri, e); ! throw new CoreException(status); ! } ! if (resource.isLoaded()) { ! docRoot = (DocumentRoot) resource.getContents().get(0); // must ! // be a ! // single ! // document ! // root ! theProfile = docRoot.getProfile(); ! } else { ! IStatus status = new Status(IStatus.ERROR, "shoppingCart", ! IStatus.OK, "Can't open model :" + fileUri, null); ! throw new CoreException(status); ! } ! } catch (CoreException e) { ! throw new InvocationTargetException(e); ! } finally { ! monitor.done(); ! } ! } ! ! public ProfileType1 getProfile() { ! return theProfile; ! } ! }; ! ! /** ! * Relative to profile folder!! ! * @param profilePath ! * @return ! */ ! public URI getRelativeProfile(String profilePath) { ! ! URI pPath = ModelAccess.INSTANCE.getCurrentProfileFolder(); ! URI relPath = URI.createURI(profilePath); ! return relPath.resolve(pPath); ! } ! ! ! public ProfileType1 getAbsoluteProfile(String profilePath) ! throws InvocationTargetException, InterruptedException, ! MalformedURLException, IOException { ! ! URI pPath = URI.createFileURI(profilePath); ! return openProfile(pPath); ! } ! ! public ProfileType1 openProfile(URI pPath) throws InvocationTargetException, InterruptedException { ! OpenProfileRunnable op = new OpenProfileRunnable(pPath); ! ! new ProgressMonitorDialog(ModelWizardPlugin.getDefault().getWorkbench() ! .getActiveWorkbenchWindow().getShell()).run(true, true, op); ! return op.getProfile(); ! } ! ! public IFile getProfileFile(String profileFileName, IProject project) { ! IContainer theContainer = project.getFolder(new Path("profile")); ! return theContainer.getFile(new Path(profileFileName)); ! } ! ! public void openProfileFromUri(URI profileUri) { ! // ! // get default editor descriptor ! // ! IEditorRegistry editorRegistry = WorkbenchPlugin.getDefault() ! .getEditorRegistry(); ! ! IEditorDescriptor defaultEditorDescriptor = editorRegistry ! .getDefaultEditor("dummy.prf"); ! // Open new file in editor ! IWorkbenchWindow dw = PlatformUI.getWorkbench() ! .getActiveWorkbenchWindow(); ! try { ! ! URIEditorInput uei = new URIEditorInput(profileUri); ! if (!uei.exists()) ! throw new ModelAbstractionError("Can't find "+uei.getName()); ! IWorkbenchPage page = dw.getActivePage(); ! if (page != null) ! page.openEditor(uei, defaultEditorDescriptor.getId()); ! } catch (Exception e) { ! ExceptionDetailsDialog dialog = new ExceptionDetailsDialog( ! new Shell(Display.getDefault()), ! "Profile Error", ! null, ! "Sorry this blueprint does not yet exist or cannot be accessed for some reason.", ! e); ! dialog.open(); ! ModelWizardPlugin.logError(e); ! } ! } ! } |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:26:47
|
Update of /cvsroot/modelwizard/source/Model Wizard Plugin/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14309/META-INF Modified Files: MANIFEST.MF Log Message: feb1 release Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/META-INF/MANIFEST.MF,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MANIFEST.MF 26 Jan 2006 16:24:13 -0000 1.10 --- MANIFEST.MF 1 Feb 2006 09:26:38 -0000 1.11 *************** *** 3,7 **** Bundle-Name: Model Wizard Bundle-SymbolicName: net.sourceforge.modelWizard; singleton:=true ! Bundle-Version: 2.0.10 Bundle-Localization: plugin Bundle-ClassPath: modelWizard.jar, --- 3,7 ---- Bundle-Name: Model Wizard Bundle-SymbolicName: net.sourceforge.modelWizard; singleton:=true ! Bundle-Version: 2.0.13 Bundle-Localization: plugin Bundle-ClassPath: modelWizard.jar, |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:26:46
|
Update of /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/ShoppingCartSchema/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14309/src/net/sourceforge/modelWizard/ShoppingCartSchema/impl Modified Files: ShoppingCartSchemaPackageImpl.java ProfileImpl.java Log Message: feb1 release Index: ShoppingCartSchemaPackageImpl.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/ShoppingCartSchema/impl/ShoppingCartSchemaPackageImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShoppingCartSchemaPackageImpl.java 6 Oct 2005 15:59:05 -0000 1.1 --- ShoppingCartSchemaPackageImpl.java 1 Feb 2006 09:26:38 -0000 1.2 *************** *** 1,764 **** ! /** ! * <copyright> ! * </copyright> ! * ! * $Id$ ! */ ! package net.sourceforge.modelWizard.ShoppingCartSchema.impl; ! ! import net.sourceforge.modelWizard.ShoppingCartSchema.DocumentRoot; ! import net.sourceforge.modelWizard.ShoppingCartSchema.Profile; [...1499 lines suppressed...] ! }); ! addAnnotation ! (getShoppingCartType_Group(), ! source, ! new String[] { ! "kind", "group", ! "name", "group:0" ! }); ! addAnnotation ! (getShoppingCartType_Profile(), ! source, ! new String[] { ! "kind", "element", ! "name", "Profile", ! "namespace", "##targetNamespace", ! "group", "group:0" ! }); ! } ! ! } //ShoppingCartSchemaPackageImpl Index: ProfileImpl.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/ShoppingCartSchema/impl/ProfileImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProfileImpl.java 6 Oct 2005 15:59:05 -0000 1.1 --- ProfileImpl.java 1 Feb 2006 09:26:38 -0000 1.2 *************** *** 1,577 **** ! /** ! * <copyright> ! * </copyright> ! * ! * $Id$ ! */ ! package net.sourceforge.modelWizard.ShoppingCartSchema.impl; ! ! import java.util.Collection; ! [...1125 lines suppressed...] ! if (eIsProxy()) return super.toString(); ! ! StringBuffer result = new StringBuffer(super.toString()); ! result.append(" (group: "); ! result.append(group); ! result.append(", export: "); ! if (exportESet) result.append(export); else result.append("<unset>"); ! result.append(", name: "); ! result.append(name); ! result.append(", path: "); ! result.append(path); ! result.append(", required: "); ! if (requiredESet) result.append(required); else result.append("<unset>"); ! result.append(", version: "); ! result.append(version); ! result.append(')'); ! return result.toString(); ! } ! ! } //ProfileImpl |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:22:53
|
Update of /cvsroot/modelwizard/source/Model Wizard Feature In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12858 Modified Files: feature.xml Log Message: feb1 release Index: feature.xml =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Feature/feature.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** feature.xml 26 Jan 2006 16:24:17 -0000 1.10 --- feature.xml 1 Feb 2006 09:22:46 -0000 1.11 *************** *** 3,7 **** id="net.sourceforge.modelWizard" label="Model Wizard" ! version="2.0.10" provider-name="Cisco"> --- 3,7 ---- id="net.sourceforge.modelWizard" label="Model Wizard" ! version="2.0.13" provider-name="Cisco"> |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:19:24
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11362 Modified Files: plugin.xml xmlOutput.genmodel XmlOut.ecore Log Message: feb1 release Index: xmlOutput.genmodel =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/xmlOutput.genmodel,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** xmlOutput.genmodel 7 Dec 2005 18:17:37 -0000 1.3 --- xmlOutput.genmodel 1 Feb 2006 09:18:39 -0000 1.4 *************** *** 1,85 **** ! <?xml version="1.0" encoding="UTF-8"?> ! <genmodel:GenModel xmi:version="2.0" ! xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" ! xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="(c) Cisco Systems Inc 2005" ! modelDirectory="/Chameleon Plugin/src" editDirectory="/Main_Plugin.edit/src" editorDirectory="/Main_Plugin.editor/src" ! modelPluginID="net.sourceforge.modelWizard.chameleon.Plugin" runtimeJar="true" ! modelName="net.sourceforge.modelWizard.chameleon.XmlOut" editPluginClass="XmlOut.provider.XmlOutputEditPlugin" ! editorPluginClass="XmlOut.presentation.XmlOutputEditorPlugin" importerID="org.eclipse.xsd.ecore.importer"> ! <foreignModel>xmlOut.xsd</foreignModel> ! <genPackages prefix="XmlOut" basePackage="net.sourceforge.modelWizard.chameleon" ! resource="XML" disposableProviderFactory="true" ecorePackage="XmlOut.ecore#/"> ! <genClasses ecoreClass="XmlOut.ecore#//CimClass"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/description"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimClass/cimQualifier"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimClass/cimProperty"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimClass/cimMethod"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/isAssoc"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/superClass"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimEnumeration"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/description"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/literal"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/superClass"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimMethod"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimMethod/description"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimMethod/cimType"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimMethod/cimQualifier"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimMethod/cimParameter"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimMethod/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimMethod/isLocal"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimMethod/name"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimPackage"> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/group"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/description"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//CimPackage/cimEnumeration"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//CimPackage/cimPackage"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//CimPackage/cimClass"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/basePackage"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/version"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimParameter"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimParameter/description"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimParameter/cimType"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimParameter/cimQualifier"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimParameter/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimParameter/name"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimProperty"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/description"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimProperty/cimType"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimProperty/cimQualifier"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/value"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/isEnd"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/isLocal"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/name"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimQualifier"> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimQualifier/group"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimQualifier/value"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimQualifier/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimQualifier/type"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimType"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimType/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimType/lower"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimType/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimType/upper"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//DocumentRoot"> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute XmlOut.ecore#//DocumentRoot/mixed"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//DocumentRoot/xMLNSPrefixMap"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//DocumentRoot/xSISchemaLocation"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//DocumentRoot/cimCx"/> ! </genClasses> ! </genPackages> ! </genmodel:GenModel> --- 1,85 ---- ! <?xml version="1.0" encoding="UTF-8"?> ! <genmodel:GenModel xmi:version="2.0" ! xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" ! xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="(c) Cisco Systems Inc 2005" ! modelDirectory="/Chameleon Plugin/src" editDirectory="/Main_Plugin.edit/src" editorDirectory="/Main_Plugin.editor/src" ! modelPluginID="net.sourceforge.modelWizard.chameleon.Plugin" runtimeJar="true" ! modelName="net.sourceforge.modelWizard.chameleon.XmlOut" editPluginClass="XmlOut.provider.XmlOutputEditPlugin" ! editorPluginClass="XmlOut.presentation.XmlOutputEditorPlugin" importerID="org.eclipse.xsd.ecore.importer"> ! <foreignModel>xmlOut.xsd</foreignModel> ! <genPackages prefix="XmlOut" basePackage="net.sourceforge.modelWizard.chameleon" ! resource="XML" disposableProviderFactory="true" ecorePackage="XmlOut.ecore#/"> ! <genClasses ecoreClass="XmlOut.ecore#//CimClass"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/description"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimClass/cimQualifier"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimClass/cimProperty"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimClass/cimMethod"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/isAssoc"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimClass/superClass"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimEnumeration"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/description"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/literal"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimEnumeration/superClass"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimMethod"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimMethod/description"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimMethod/cimType"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimMethod/cimQualifier"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimMethod/cimParameter"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimMethod/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimMethod/isLocal"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimMethod/name"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimPackage"> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/group"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/description"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//CimPackage/cimEnumeration"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//CimPackage/cimPackage"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//CimPackage/cimClass"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/basePackage"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimPackage/version"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimParameter"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimParameter/description"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimParameter/cimType"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimParameter/cimQualifier"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimParameter/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimParameter/name"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimProperty"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/description"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimProperty/cimType"/> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference XmlOut.ecore#//CimProperty/cimQualifier"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/value"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/isEnd"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/isLocal"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimProperty/name"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimQualifier"> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimQualifier/group"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimQualifier/value"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimQualifier/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimQualifier/type"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//CimType"> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimType/id"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimType/lower"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimType/name"/> ! <genFeatures createChild="false" ecoreFeature="ecore:EAttribute XmlOut.ecore#//CimType/upper"/> ! </genClasses> ! <genClasses ecoreClass="XmlOut.ecore#//DocumentRoot"> ! <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute XmlOut.ecore#//DocumentRoot/mixed"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//DocumentRoot/xMLNSPrefixMap"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//DocumentRoot/xSISchemaLocation"/> ! <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference XmlOut.ecore#//DocumentRoot/cimCx"/> ! </genClasses> ! </genPackages> ! </genmodel:GenModel> Index: plugin.xml =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/plugin.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** plugin.xml 8 Jan 2006 12:46:20 -0000 1.7 --- plugin.xml 1 Feb 2006 09:18:39 -0000 1.8 *************** *** 19,22 **** --- 19,46 ---- </action> </objectContribution> + <objectContribution + objectClass="org.eclipse.core.resources.IFile" + id="net.sourceforge.modelWizard.chameleon.splitModelPopUp"> + <enablement> + <or> + <and> + <objectClass name="org.eclipse.core.resources.IFile"/> + <objectState name="extension" value="emx"/> + </and> + <and> + <objectClass name="org.eclipse.core.resources.IFile"/> + <objectState name="extension" value="uml2"/> + </and> + </or> + </enablement> + <action + class="net.sourceforge.modelWizard.chameleon.actions.SplitModelAction" + enablesFor="1" + id="com.cisco.nm.cto.cimcx.comparePopUp" + label="Split Model" + tooltip="Split a model up into multiple files."> + </action> + </objectContribution> + </extension> <extension Index: XmlOut.ecore =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/XmlOut.ecore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XmlOut.ecore 7 Dec 2005 18:17:37 -0000 1.2 --- XmlOut.ecore 1 Feb 2006 09:18:39 -0000 1.3 *************** *** 1,506 **** ! <?xml version="1.0" encoding="UTF-8"?> ! <ecore:EPackage xmi:version="2.0" ! xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ! xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="XmlOut" ! nsURI="platform:/resource/Chameleon%20Plugin/xmlOut.xsd" nsPrefix="XmlOut"> ! <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> ! <details key="qualified" value="false"/> ! </eAnnotations> ! <eClassifiers xsi:type="ecore:EClass" name="CimClass"> ! <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> [...983 lines suppressed...] ! </eStructuralFeatures> ! <eStructuralFeatures xsi:type="ecore:EReference" name="xSISchemaLocation" upperBound="-1" ! eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStringToStringMapEntry" ! transient="true" containment="true" resolveProxies="false"> ! <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> ! <details key="kind" value="attribute"/> ! <details key="name" value="xsi:schemaLocation"/> ! </eAnnotations> ! </eStructuralFeatures> ! <eStructuralFeatures xsi:type="ecore:EReference" name="cimCx" upperBound="-2" ! eType="#//CimPackage" volatile="true" transient="true" derived="true" containment="true" ! resolveProxies="false"> ! <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> ! <details key="kind" value="element"/> ! <details key="name" value="cim-cx"/> ! <details key="namespace" value="##targetNamespace"/> ! </eAnnotations> ! </eStructuralFeatures> ! </eClassifiers> ! </ecore:EPackage> |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:19:23
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/transforms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11362/src/net/sourceforge/modelWizard/chameleon/transforms Modified Files: XmlTransformer.java Log Message: feb1 release Index: XmlTransformer.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/transforms/XmlTransformer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XmlTransformer.java 8 Jan 2006 12:46:07 -0000 1.3 --- XmlTransformer.java 1 Feb 2006 09:18:40 -0000 1.4 *************** *** 60,63 **** --- 60,64 ---- public QualifierListFactory qualListFactory = new QualifierListFactory(new XmlQualifierFactoryImpl()); + public QualifierFactory qualFactory = new XmlQualifierFactoryImpl(); *************** *** 252,255 **** --- 253,257 ---- neeedsTypeRef.add(ct); q = qualListFactory.getQualifiers(p); + q.add(qualFactory.createBooleanQualifier("Required",true)); cp.getCimQualifier().addAll(q); cc.getCimProperty().add(cp); *************** *** 331,334 **** --- 333,339 ---- neeedsTypeRef.add(ct); q = qualListFactory.getQualifiers(p); + if (c instanceof Association && ends.contains(p)) { + q.add(qualFactory.createBooleanQualifier("Required",true)); + } cp.getCimQualifier().addAll(q); cc.getCimProperty().add(cp); |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:19:22
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/compare In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11362/src/net/sourceforge/modelWizard/chameleon/compare Modified Files: OpenModelOp.java Log Message: feb1 release Index: OpenModelOp.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/compare/OpenModelOp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpenModelOp.java 15 Nov 2005 20:38:16 -0000 1.1 --- OpenModelOp.java 1 Feb 2006 09:18:39 -0000 1.2 *************** *** 1,90 **** ! package net.sourceforge.modelWizard.chameleon.compare; ! ! import java.io.IOException; ! import java.lang.reflect.InvocationTargetException; ! import java.util.HashMap; ! import java.util.Iterator; ! import java.util.Map; ! ! import org.eclipse.core.resources.IFile; ! import org.eclipse.core.runtime.IProgressMonitor; ! import org.eclipse.emf.common.util.URI; ! import org.eclipse.emf.ecore.EObject; ! import org.eclipse.emf.ecore.resource.Resource; ! import org.eclipse.emf.ecore.resource.ResourceSet; ! import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; ! import org.eclipse.emf.ecore.xmi.XMLResource; ! import org.eclipse.jface.operation.IRunnableWithProgress; ! import org.eclipse.uml2.Model; ! import org.eclipse.uml2.util.UML2Resource; ! ! public final class OpenModelOp implements IRunnableWithProgress { ! private URI fileUri; ! private Resource resource; ! private static ResourceSet resourceSet = new ResourceSetImpl(); ! private Model model; ! ! public OpenModelOp(URI fileUri) { ! super(); ! this.fileUri = fileUri; ! } ! ! public OpenModelOp(IFile file) { ! super(); ! this.fileUri = URI.createPlatformResourceURI(file.getFullPath().toString()); ! } ! ! public void run(IProgressMonitor monitor) throws InvocationTargetException { ! monitor.beginTask("Opening "+fileUri.lastSegment(),IProgressMonitor.UNKNOWN); ! boolean added = false; ! Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put( ! "emx", UML2Resource.Factory.INSTANCE); ! ! Map options = new HashMap(); ! options.put(UML2Resource.OPTION_DISABLE_NOTIFY, Boolean.TRUE); ! options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); ! try { ! resource = resourceSet.createResource(fileUri); ! resource.load(options); ! } catch (Exception e) { ! monitor.done(); ! throw new InvocationTargetException(e, "Cannot open model file :"+fileUri); ! } ! if (resource.isLoaded()) { ! Iterator i = resource.getContents().iterator(); ! while (i.hasNext()){ ! EObject eo = (EObject) i.next(); ! if (eo instanceof Model){ ! model = (Model) eo; ! monitor.done(); ! break; ! } ! } ! } else { ! monitor.done(); ! throw new InvocationTargetException (null,"Can't find model :"+fileUri.toFileString()); ! } ! } ! ! public Model getModel() { ! return model; ! } ! ! public void unload(){ ! resource.unload(); ! resource = null; ! model = null; ! } ! ! public void saveModel() throws IOException{ ! resource.save(null); ! } ! ! public URI getFileUri() { ! return fileUri; ! } ! ! public void setFileUri(URI fileUri) { ! this.fileUri = fileUri; ! } ! } --- 1,91 ---- ! package net.sourceforge.modelWizard.chameleon.compare; ! ! import java.io.IOException; ! import java.lang.reflect.InvocationTargetException; ! import java.util.HashMap; ! import java.util.Iterator; ! import java.util.Map; ! ! import org.eclipse.core.resources.IFile; ! import org.eclipse.core.runtime.IProgressMonitor; ! import org.eclipse.emf.common.util.URI; ! import org.eclipse.emf.ecore.EObject; ! import org.eclipse.emf.ecore.resource.Resource; ! import org.eclipse.emf.ecore.resource.ResourceSet; ! import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; ! import org.eclipse.emf.ecore.xmi.XMLResource; ! import org.eclipse.jface.operation.IRunnableWithProgress; ! import org.eclipse.uml2.Model; ! import org.eclipse.uml2.util.UML2Resource; ! import org.eclipse.uml2.util.UML2Util; ! ! public final class OpenModelOp implements IRunnableWithProgress { ! private URI fileUri; ! private Resource resource; ! private static ResourceSet resourceSet = new ResourceSetImpl(); ! private Model model; ! ! public OpenModelOp(URI fileUri) { ! super(); ! this.fileUri = fileUri; ! } ! ! public OpenModelOp(IFile file) { ! super(); ! this.fileUri = URI.createPlatformResourceURI(file.getFullPath().toString()); ! } ! ! public void run(IProgressMonitor monitor) throws InvocationTargetException { ! monitor.beginTask("Opening "+fileUri.lastSegment(),IProgressMonitor.UNKNOWN); ! boolean added = false; ! Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put( ! "emx", UML2Resource.Factory.INSTANCE); ! ! Map options = new HashMap(); ! options.put(UML2Resource.OPTION_DISABLE_NOTIFY, Boolean.TRUE); ! options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); ! try { ! resource = resourceSet.createResource(fileUri); ! resource.load(options); ! } catch (Exception e) { ! monitor.done(); ! throw new InvocationTargetException(e, "Cannot open model file :"+fileUri); ! } ! if (resource.isLoaded()) { ! Iterator i = resource.getContents().iterator(); ! while (i.hasNext()){ ! EObject eo = (EObject) i.next(); ! if (eo instanceof Model){ ! model = (Model) eo; ! monitor.done(); ! break; ! } ! } ! } else { ! monitor.done(); ! throw new InvocationTargetException (null,"Can't find model :"+fileUri.toFileString()); ! } ! } ! ! public Model getModel() { ! return model; ! } ! ! public void unload(){ ! resource.unload(); ! resource = null; ! model = null; ! } ! ! public void saveModel() throws IOException{ ! resource.save(null); ! } ! ! public URI getFileUri() { ! return fileUri; ! } ! ! public void setFileUri(URI fileUri) { ! this.fileUri = fileUri; ! } ! } |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:19:18
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/ModelAbstraction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11362/src/net/sourceforge/modelWizard/chameleon/ModelAbstraction Modified Files: UmlUtilities.java Log Message: feb1 release Index: UmlUtilities.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/ModelAbstraction/UmlUtilities.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UmlUtilities.java 8 Jan 2006 12:44:58 -0000 1.2 --- UmlUtilities.java 1 Feb 2006 09:18:40 -0000 1.3 *************** *** 7,15 **** package net.sourceforge.modelWizard.chameleon.ModelAbstraction; - import java.util.ArrayList; - import java.util.HashMap; - import java.util.Iterator; - import java.util.Map; - import net.sourceforge.modelWizard.backingModelAbstraction.ModelAbstractionError; --- 7,10 ---- *************** *** 18,21 **** --- 13,17 ---- import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.uml2.Association; import org.eclipse.uml2.AssociationClass; *************** *** 36,39 **** --- 32,40 ---- import org.eclipse.uml2.TypedElement; + import java.util.ArrayList; + import java.util.HashMap; + import java.util.Iterator; + import java.util.Map; + /** *************** *** 44,292 **** */ public class UmlUtilities { ! ! /** ! * Get the comments for a UML Element. This will be a string with ! * each comment separated by a 2 newlines. ! * @param theElement ! * @return concatenated string ! */ ! public static String getComment(Element theElement) { ! String ret = ""; ! EList comments = theElement.getOwnedComments(); ! Iterator i = comments.iterator(); ! while (i.hasNext()) { ! Comment c = (Comment) i.next(); ! if (!ret.equalsIgnoreCase("")) ! ret = ret +"\n\n"; ! ret = ret.concat(c.getBody()); ! } ! return cleanText(ret); ! } ! ! public static String cleanText(String txt){ ! txt = txt.replaceAll("[\\t\\n]*",""); ! txt = txt.replaceAll("\\s+"," "); ! return txt; ! } ! ! public static String getType (TypedElement el){ ! ! Type t = el.getType(); ! String ret = t.getName(); ! if (ret == null) ! return "**no type **"; ! if (el instanceof MultiplicityElement){ ! MultiplicityElement me = (MultiplicityElement) el; ! if (me.isMultivalued()){ ! ret = ret + "["; ! if (me.lower()>0) ! ret = ret+me.lower()+".."; ! if (me.upper()== MultiplicityElement.UNLIMITED_UPPER_BOUND) ! ret = ret+"*]"; ! else ! ret = ret+me.upper()+"]"; ! } ! } ! return ret; ! } ! ! /** ! * Return the Superclass for this class. If more than one superclass ! * is defined an error will be logged to the console. ! * @param eo ! * @return ! */ ! public static Classifier getGeneral (Classifier c){ ! EList sc = c.getGenerals(); ! if (sc.size() > 1) ! throw new ModelAbstractionError ("Error: found "+sc.size()+" generalizations for "+c.getQualifiedName()); ! if (sc.size() == 1) { ! Object ret = (Object) sc.get(0); ! if (ret instanceof Classifier) ! return (Classifier) ret; ! else { ! throw new ModelAbstractionError ("Error: general for "+c.getQualifiedName()+ ! " is a "+ret.getClass().getName()); ! } ! } ! return null; ! } ! ! /** ! * Return a string array containing all of the properties (UML attributes) ! * for this class. Superclass properties will included if fromSuper is true. Overridden ! * properties will be omitted. ! * @param theClass ! * @param fromSuper ! * @return ! */ ! public static Iterator getProperties (Class theClass, boolean fromSuper){ ! Iterator i; ! ArrayList classProperties = new ArrayList(); ! //first add all the class properties ! if (theClass == null || theClass.getAttributes() == null) { ! return new ArrayList(){}.iterator(); ! } ! i = theClass.getOwnedMembers().iterator(); ! while (i.hasNext()){ ! Object eo = i.next(); ! if (eo instanceof Property) ! classProperties.add(eo); ! } ! if (fromSuper) { ! // then interate through all the inherited members adding those not already ! //defined (ie overridden) ! i = theClass.getInheritedMembers().iterator(); ! while (i.hasNext()) { ! NamedElement el = (NamedElement) i.next(); ! if (el instanceof Property){ ! Iterator propIter = classProperties.iterator(); ! boolean defined = false; ! while (propIter.hasNext()){ ! Property testProp = (Property) propIter.next(); ! if (testProp.getName().equalsIgnoreCase(el.getName())) ! defined = true; ! } ! if (!defined) ! classProperties.add(el); ! ! } ! } ! } ! return classProperties.iterator(); ! } ! public static Property getProperty (Class theClass, String propertyName){ ! Iterator i = getProperties(theClass,true); ! while (i.hasNext()){ ! Property p = (Property) i.next(); ! if (p.getName().equalsIgnoreCase(propertyName)) ! return p; ! } ! throw new ModelAbstractionError("Did not find '"+ propertyName+"' in "+ theClass.getName()); ! } ! /** ! * Return a string array containing all of the methods (UML operations) ! * for this class. Superclass properties will included if fromSuper is true. Overridden ! * methods will be omitted. ! * @param theClass ! * @param fromSuper ! * @return ! */ ! public static Iterator getMethods (Class theClass, boolean fromSuper){ ! Iterator i; ! ArrayList classMethods= new ArrayList(); ! //first add all the class properties ! if (theClass == null || theClass.getOwnedOperations() == null) { ! return new ArrayList(){}.iterator(); ! } ! i = theClass.getOwnedOperations().iterator(); ! while (i.hasNext()){ ! classMethods.add(i.next()); ! } ! if (fromSuper) { ! // then interate through all the inherited members adding those not already ! //defined (ie overridden) ! i = theClass.getInheritedMembers().iterator(); ! while (i.hasNext()) { ! NamedElement el = (NamedElement) i.next(); ! if (el instanceof Operation){ ! Iterator classIter = classMethods.iterator(); ! boolean defined = false; ! while (classIter.hasNext()){ ! Operation testMeth = (Operation) classIter.next(); ! if (testMeth.getName().equalsIgnoreCase(el.getName())) ! defined = true; ! } ! if (!defined) ! classMethods.add(el); ! } ! } ! } ! return classMethods.iterator(); ! } ! /** ! * @param classByName ! * @param name ! * @return ! */ ! public static Operation getMethod(Class theClass, String name) { ! Iterator i = getMethods(theClass,true); ! while (i.hasNext()){ ! Operation o = (Operation) i.next(); ! if (o.getName().equalsIgnoreCase(name)) ! return o; ! } ! throw new ModelAbstractionError("Did not find "+ name+" in "+ theClass.getName()); ! } ! ! /** ! * @param stereotype ! */ ! public static Map getStereotypes(Element object) { ! HashMap stereos = new HashMap(); ! Iterator i = object.getAppliedStereotypes().iterator(); ! while (i.hasNext()){ ! Stereotype s = ((Stereotype) i.next()); ! String stereo = ""; ! Property p = s.getAttribute("value"); ! if (p != null) { ! Type t = p.getType(); ! if (p.isMultivalued()){ ! EList values = (EList) object.getValue(s,p.getName()); ! for (int n=0;n<values.size();n++){ ! if (t instanceof Enumeration) { ! stereo = stereo + ((EnumerationLiteral)values.get(n)).getName(); ! } else { ! stereo = stereo + values.get(n).toString(); ! } ! if (n<values.size()-1) ! stereo = stereo + ", "; ! } ! } else { ! Object value = (Object)object.getValue(s,p.getName()); ! if (t instanceof Enumeration) { ! stereo = stereo + ((EnumerationLiteral)value).getName(); ! } else { ! stereo = stereo + value.toString(); ! } ! } ! } ! stereos.put(s.getName().toLowerCase(),stereo); ! } ! return stereos; ! } ! ! public static ArrayList getSpecializations(Classifier c){ ! ArrayList specials = new ArrayList(); ! TreeIterator ti = EcoreUtil.getRootContainer(c).eAllContents(); ! while (ti.hasNext()){ ! EObject eo = (EObject)ti.next(); ! if (eo instanceof Generalization) { ! Generalization g = (Generalization) eo; ! if (g.getGeneral().equals(c)){ ! specials.add(g.getSpecific()); ! } ! ti.prune(); ! // continue; ! } ! } ! return specials; ! } ! ! /** ! * @return ArrayList of Class objects ! */ ! public static ArrayList getElements(Model model, boolean includeAssociations) { ! ArrayList elementList = new ArrayList(); ! for (TreeIterator i = model.eAllContents(); i.hasNext();){ ! EObject e = (EObject) i.next(); ! if (e instanceof Class || ( includeAssociations && e instanceof Association)) { ! elementList.add(e); ! i.prune(); ! } ! } ! return elementList; ! } ! } --- 45,387 ---- */ public class UmlUtilities { ! /** ! * Get the comments for a UML Element. This will be a string with ! * each comment separated by a 2 newlines. ! * @param theElement ! * @return concatenated string ! */ ! public static String getComment(Element theElement) { ! String ret = ""; ! EList comments = theElement.getOwnedComments(); ! Iterator i = comments.iterator(); ! while (i.hasNext()) { ! Comment c = (Comment) i.next(); ! ! if (!ret.equalsIgnoreCase("")) { ! ret = ret + "\n\n"; ! } ! ! ret = ret.concat(c.getBody()); ! } ! ! return cleanText(ret); ! } ! ! public static String cleanText(String txt) { ! txt = txt.replaceAll("[\\t\\n]*", ""); ! txt = txt.replaceAll("\\s+", " "); ! ! return txt; ! } ! ! public static String getType(TypedElement el) { ! Type t = el.getType(); ! String ret = t.getName(); ! ! if (ret == null) { ! return "**no type **"; ! } ! ! if (el instanceof MultiplicityElement) { ! MultiplicityElement me = (MultiplicityElement) el; ! ! if (me.isMultivalued()) { ! ret = ret + "["; ! ! if (me.lower() > 0) { ! ret = ret + me.lower() + ".."; ! } ! ! if (me.upper() == MultiplicityElement.UNLIMITED_UPPER_BOUND) { ! ret = ret + "*]"; ! } else { ! ret = ret + me.upper() + "]"; ! } ! } ! } ! ! return ret; ! } ! ! /** ! * Return the Superclass for this class. If more than one superclass ! * is defined an error will be logged to the console. ! * @param eo ! * @return ! */ ! public static Classifier getGeneral(Classifier c) { ! EList sc = c.getGenerals(); ! ! if (sc.size() > 1) { ! throw new ModelAbstractionError("Error: found " + sc.size() + ! " generalizations for " + c.getQualifiedName()); ! } ! ! if (sc.size() == 1) { ! Object ret = (Object) sc.get(0); ! ! if (ret instanceof Classifier) { ! return (Classifier) ret; ! } else { ! throw new ModelAbstractionError("Error: general for " + ! c.getQualifiedName() + " is a " + ret.getClass().getName()); ! } ! } ! ! return null; ! } ! ! /** ! * Return a string array containing all of the properties (UML attributes) ! * for this class. Superclass properties will included if fromSuper is true. Overridden ! * properties will be omitted. ! * @param theClass ! * @param fromSuper ! * @return ! */ ! public static Iterator getProperties(Class theClass, boolean fromSuper) { ! ArrayList classProperties = new ArrayList(); ! ! //first add all the class properties ! if ((theClass == null) || (theClass.getAttributes() == null)) { ! return new ArrayList() { ! }.iterator(); ! } ! ! for (Iterator i = theClass.getOwnedAttributes().iterator(); ! i.hasNext();) { ! Property p = (Property) i.next(); ! ! if (p.getAssociation() != null) { ! continue; ! } ! ! classProperties.add(p); ! } ! ! if (fromSuper) { ! for (Iterator i = theClass.getInheritedMembers().iterator(); ! i.hasNext();) { ! NamedElement el = (NamedElement) i.next(); ! ! if (el instanceof Property) { ! Property p = (Property) el; ! ! if (p.getAssociation() != null) { ! continue; ! } ! ! classProperties.add(p); ! } ! } ! } ! ! // i = theClass.getOwnedMembers().iterator(); ! // while (i.hasNext()){ ! // Object eo = i.next(); ! // if (eo instanceof Property) ! // classProperties.add(eo); ! // } ! // if (fromSuper) { ! // // then interate through all the inherited members adding those not already ! // //defined (ie overridden) ! // i = theClass.getInheritedMembers().iterator(); ! // while (i.hasNext()) { ! // NamedElement el = (NamedElement) i.next(); ! // if (el instanceof Property){ ! // Iterator propIter = classProperties.iterator(); ! // boolean defined = false; ! // while (propIter.hasNext()){ ! // Property testProp = (Property) propIter.next(); ! // if (testProp.getName().equalsIgnoreCase(el.getName())) ! // defined = true; ! // } ! // if (!defined) ! // classProperties.add(el); ! // ! // } ! // } ! // } ! return classProperties.iterator(); ! } ! ! public static Property getProperty(Class theClass, String propertyName) { ! Iterator i = getProperties(theClass, true); ! ! while (i.hasNext()) { ! Property p = (Property) i.next(); ! ! if (p.getName().equalsIgnoreCase(propertyName)) { ! return p; ! } ! } ! ! throw new ModelAbstractionError("Did not find '" + propertyName + ! "' in " + theClass.getName()); ! } ! ! /** ! * Return a string array containing all of the methods (UML operations) ! * for this class. Superclass properties will included if fromSuper is true. Overridden ! * methods will be omitted. ! * @param theClass ! * @param fromSuper ! * @return ! */ ! public static Iterator getMethods(Class theClass, boolean fromSuper) { ! Iterator i; ! ArrayList classMethods = new ArrayList(); ! ! //first add all the class properties ! if ((theClass == null) || (theClass.getOwnedOperations() == null)) { ! return new ArrayList() { ! }.iterator(); ! } ! ! i = theClass.getOwnedOperations().iterator(); ! ! while (i.hasNext()) { ! classMethods.add(i.next()); ! } ! ! if (fromSuper) { ! // then interate through all the inherited members adding those not already ! //defined (ie overridden) ! i = theClass.getInheritedMembers().iterator(); ! ! while (i.hasNext()) { ! NamedElement el = (NamedElement) i.next(); ! ! if (el instanceof Operation) { ! Iterator classIter = classMethods.iterator(); ! boolean defined = false; ! ! while (classIter.hasNext()) { ! Operation testMeth = (Operation) classIter.next(); ! ! if (testMeth.getName().equalsIgnoreCase(el.getName())) { ! defined = true; ! } ! } ! ! if (!defined) { ! classMethods.add(el); ! } ! } ! } ! } ! ! return classMethods.iterator(); ! } ! ! /** ! * @param classByName ! * @param name ! * @return ! */ ! public static Operation getMethod(Class theClass, String name) { ! Iterator i = getMethods(theClass, true); ! ! while (i.hasNext()) { ! Operation o = (Operation) i.next(); ! ! if (o.getName().equalsIgnoreCase(name)) { ! return o; ! } ! } ! ! throw new ModelAbstractionError("Did not find " + name + " in " + ! theClass.getName()); ! } ! ! /** ! * @param stereotype ! */ ! public static Map getStereotypes(Element object) { ! HashMap stereos = new HashMap(); ! Iterator i = object.getAppliedStereotypes().iterator(); ! ! while (i.hasNext()) { ! Stereotype s = ((Stereotype) i.next()); ! String stereo = ""; ! Property p = s.getAttribute("value"); ! ! if (p != null) { ! Type t = p.getType(); ! ! if (p.isMultivalued()) { ! EList values = (EList) object.getValue(s, p.getName()); ! ! for (int n = 0; n < values.size(); n++) { ! if (t instanceof Enumeration) { ! stereo = stereo + ! ((EnumerationLiteral) values.get(n)).getName(); ! } else { ! stereo = stereo + values.get(n).toString(); ! } ! ! if (n < (values.size() - 1)) { ! stereo = stereo + ", "; ! } ! } ! } else { ! Object value = (Object) object.getValue(s, p.getName()); ! ! if (t instanceof Enumeration) { ! stereo = stereo + ! ((EnumerationLiteral) value).getName(); ! } else { ! stereo = stereo + value.toString(); ! } ! } ! } ! ! stereos.put(s.getName().toLowerCase(), stereo); ! } ! ! return stereos; ! } ! ! public static ArrayList getSpecializations(Classifier c) { ! ArrayList specials = new ArrayList(); ! TreeIterator ti = EcoreUtil.getRootContainer(c).eAllContents(); ! ! while (ti.hasNext()) { ! EObject eo = (EObject) ti.next(); ! ! if (eo instanceof Generalization) { ! Generalization g = (Generalization) eo; ! ! if (g.getGeneral().equals(c)) { ! specials.add(g.getSpecific()); ! } ! ! ti.prune(); ! ! // continue; ! } ! } ! ! return specials; ! } ! ! /** ! * @return ArrayList of Class objects ! */ ! public static ArrayList getElements(Model model, boolean includeAssociations) { ! ArrayList elementList = new ArrayList(); ! ! for (TreeIterator i = model.eAllContents(); i.hasNext();) { ! EObject e = (EObject) i.next(); ! ! if (e instanceof Class || ! (includeAssociations && e instanceof Association)) { ! elementList.add(e); ! i.prune(); ! } ! } ! ! return elementList; ! } } |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:19:17
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11362/META-INF Modified Files: MANIFEST.MF Log Message: feb1 release Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/META-INF/MANIFEST.MF,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MANIFEST.MF 26 Jan 2006 16:23:47 -0000 1.12 --- MANIFEST.MF 1 Feb 2006 09:18:39 -0000 1.13 *************** *** 2,6 **** Bundle-Name: Chameleon UML Model Plugin Bundle-SymbolicName: net.sourceforge.modelWizard.chameleon;singleton=true ! Bundle-Version: 4.0.16 Bundle-Vendor: Cisco Bundle-Localization: plugin --- 2,6 ---- Bundle-Name: Chameleon UML Model Plugin Bundle-SymbolicName: net.sourceforge.modelWizard.chameleon;singleton=true ! Bundle-Version: 4.0.18 Bundle-Vendor: Cisco Bundle-Localization: plugin |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:19:02
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/umlProfile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11362/umlProfile Modified Files: Model.Profile.uml2 Log Message: feb1 release Index: Model.Profile.uml2 =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/umlProfile/Model.Profile.uml2,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Model.Profile.uml2 31 Jan 2006 07:05:07 -0000 1.15 --- Model.Profile.uml2 1 Feb 2006 09:18:40 -0000 1.16 *************** *** 1999,2003 **** <contents xmi:type="ecore:EPackage" xmi:id="_PG2PgvVfEdmX2r2IirNfog" name="Profile_0" nsURI="http:///_NgPQqNhgEdmwWcfdXIEEOg.profile.uml2" nsPrefix="Profile_0"/> </eAnnotations> ! <ownedComment xmi:id="_PG2Pg_VfEdmX2r2IirNfog" body="This profile defines the 'qualifiers' used for the Model" annotatedElement="_PG2JIfVfEdmX2r2IirNfog"/> <packageImport xmi:id="_PG2PhPVfEdmX2r2IirNfog"> <importedPackage xmi:type="uml:Model" href="pathmap://UML2_LIBRARIES/UML2PrimitiveTypes.library.uml2#_EfRZoK86EdieaYgxtVWN8Q"/> --- 1999,2005 ---- <contents xmi:type="ecore:EPackage" xmi:id="_PG2PgvVfEdmX2r2IirNfog" name="Profile_0" nsURI="http:///_NgPQqNhgEdmwWcfdXIEEOg.profile.uml2" nsPrefix="Profile_0"/> </eAnnotations> ! <ownedComment xmi:id="_PG2Pg_VfEdmX2r2IirNfog" annotatedElement="_PG2JIfVfEdmX2r2IirNfog"> ! <body>This profile defines the 'qualifiers' used for the Model</body> ! </ownedComment> <packageImport xmi:id="_PG2PhPVfEdmX2r2IirNfog"> <importedPackage xmi:type="uml:Model" href="pathmap://UML2_LIBRARIES/UML2PrimitiveTypes.library.uml2#_EfRZoK86EdieaYgxtVWN8Q"/> *************** *** 2014,2018 **** <type xmi:type="uml:Class" href="pathmap://UML2_METAMODELS/UML2.metamodel.uml2#_m9C1la86EdiEh75YJ_3n8g"/> </ownedAttribute> ! <nestedClassifier xmi:type="uml:Extension" xmi:id="_Nmjj0I6mEdqcOdCAUsLE_Q" name="Property_ComplexDataType" memberEnd="_PG2PifVfEdmX2r2IirNfog"/> <nestedClassifier xmi:type="uml:Extension" xmi:id="_PG2PivVfEdmX2r2IirNfog" name="Parameter_ComplexDataType" memberEnd="_PG2Pi_VfEdmX2r2IirNfog _PG2PiPVfEdmX2r2IirNfog"> <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_PG2Pi_VfEdmX2r2IirNfog" name="extension$ComplexDataType" type="_PG2PhvVfEdmX2r2IirNfog" association="_PG2PivVfEdmX2r2IirNfog" aggregation="composite"> --- 2016,2024 ---- <type xmi:type="uml:Class" href="pathmap://UML2_METAMODELS/UML2.metamodel.uml2#_m9C1la86EdiEh75YJ_3n8g"/> </ownedAttribute> ! <nestedClassifier xmi:type="uml:Extension" xmi:id="_Nmjj0I6mEdqcOdCAUsLE_Q" name="Property_ComplexDataType" memberEnd="_PG2PifVfEdmX2r2IirNfog _YxYbwJL_EdqrDtrmXQbe0Q"> ! <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_YxYbwJL_EdqrDtrmXQbe0Q" name="extension$ComplexDataType" type="_PG2PhvVfEdmX2r2IirNfog" association="_Nmjj0I6mEdqcOdCAUsLE_Q" aggregation="composite"> ! <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_YxYbwZL_EdqrDtrmXQbe0Q"/> ! </ownedEnd> ! </nestedClassifier> <nestedClassifier xmi:type="uml:Extension" xmi:id="_PG2PivVfEdmX2r2IirNfog" name="Parameter_ComplexDataType" memberEnd="_PG2Pi_VfEdmX2r2IirNfog _PG2PiPVfEdmX2r2IirNfog"> <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_PG2Pi_VfEdmX2r2IirNfog" name="extension$ComplexDataType" type="_PG2PhvVfEdmX2r2IirNfog" association="_PG2PivVfEdmX2r2IirNfog" aggregation="composite"> *************** *** 2059,2064 **** <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PG2Pm_VfEdmX2r2IirNfog" value="-1"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PG2PnPVfEdmX2r2IirNfog" value="1"/> ! <defaultValue xmi:type="uml:OpaqueExpression" xmi:id="_PG2PnfVfEdmX2r2IirNfog" body="No value"> <type xmi:type="uml:PrimitiveType" href="pathmap://UML2_LIBRARIES/UML2PrimitiveTypes.library.uml2#_IXlH8a86EdieaYgxtVWN8Q"/> </defaultValue> </ownedAttribute> --- 2065,2071 ---- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PG2Pm_VfEdmX2r2IirNfog" value="-1"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PG2PnPVfEdmX2r2IirNfog" value="1"/> ! <defaultValue xmi:type="uml:OpaqueExpression" xmi:id="_PG2PnfVfEdmX2r2IirNfog"> <type xmi:type="uml:PrimitiveType" href="pathmap://UML2_LIBRARIES/UML2PrimitiveTypes.library.uml2#_IXlH8a86EdieaYgxtVWN8Q"/> + <body>No value</body> </defaultValue> </ownedAttribute> |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:18:48
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11362/src/net/sourceforge/modelWizard/chameleon/actions Added Files: SplitModelAction.java Log Message: feb1 release --- NEW FILE: SplitModelAction.java --- package net.sourceforge.modelWizard.chameleon.actions; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import net.sourceforge.modelWizard.chameleon.compare.OpenModelOp; import org.eclipse.uml2.util.UML2Util; import org.eclipse.core.resources.IFile; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.emf.ecore.util.EcoreUtil.Copier; import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.ui.PlatformUI; import org.eclipse.uml2.Model; import org.eclipse.uml2.Package; import org.eclipse.uml2.PackageMerge; import org.eclipse.uml2.ProfileApplication; import org.eclipse.uml2.UML2Factory; import org.eclipse.uml2.UML2Package; public class SplitModelAction implements IObjectActionDelegate { private IWorkbenchWindow window; private ISelection selection; private Copier copier = new Copier(); ResourceSet resourceSet = new ResourceSetImpl(); public SplitModelAction() { } public void dispose() { } public void run(IAction action) { IFile sourceModelFile; if (selection == null || selection.isEmpty()==true || !(selection instanceof IStructuredSelection)) return; IStructuredSelection ssel = (IStructuredSelection)selection; if (ssel.size() != 1) return; Object obj = ssel.getFirstElement(); if (obj instanceof IFile) sourceModelFile = (IFile) obj; else return; OpenModelOp op1 = new OpenModelOp(sourceModelFile); try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true,false,op1); } catch (InvocationTargetException e) { e.printStackTrace(); MessageDialog.openError(window.getShell(), "Error", e.getMessage()); } catch (InterruptedException e) { e.printStackTrace(); MessageDialog.openError(window.getShell(), "Error", e.getMessage()); } Model sourceModel = op1.getModel(); URI modelUri = op1.getFileUri(); try { splitModel (sourceModel, modelUri.trimFileExtension().trimSegments(1)); for (Iterator i = resourceSet.getResources().iterator();i.hasNext();i.next()){ Resource r = (Resource)i.next(); Map options = new HashMap(); options.put(XMLResource.OPTION_ENCODING, "UTF-8"); r.save(options); } op1.saveModel(); op1.unload(); UML2Util.PackageMerger pmerger = new UML2Util.PackageMerger(); // pmerger.merge() } catch (IOException e) { e.printStackTrace(); MessageDialog.openError(window.getShell(), "Error", e.getMessage()); } } private void splitModel(Model sourceModel, URI destFolder) throws IOException { Model baseModel = UML2Factory.eINSTANCE.createModel(); //add packageImports... for (Iterator i = sourceModel.getAppliedProfiles().iterator();i.hasNext();) { ProfileApplication pa = (ProfileApplication)i.next(); EObject o = copier.copy(pa); baseModel.getAppliedProfiles().add(o); } for (Iterator i = sourceModel.getNestedPackages().iterator();i.hasNext();){ Package subPack = (Package) i.next(); Model newModel = copyPackage(subPack); PackageMerge pm = sourceModel.createPackageMerge(UML2Package.eINSTANCE.getPackageMerge()); pm.setMergedPackage(newModel); pm.setMergingPackage(sourceModel); Package p = (Package) sourceModel.createOwnedMember(UML2Package.eINSTANCE.getPackage()); p.setName(subPack.getName()); Resource resource = resourceSet.createResource(destFolder.appendSegment(newModel.getName()).appendFileExtension("emx")); resource.getContents().add(newModel); } } private Model copyPackage(Package subPack) { Model newModel = UML2Factory.eINSTANCE.createModel(); newModel.setName(subPack.getName()); newModel.getOwnedMembers().add(subPack); return newModel; } /** * Selection in the workbench has been changed. We * can change the state of the 'real' action here * if we want, but this can only happen after * the delegate has been created. * @see IWorkbenchWindowActionDelegate#selectionChanged */ public void selectionChanged(IAction action, ISelection selection) { this.selection = selection; } public void setActivePart(IAction action, IWorkbenchPart targetPart) { this.window = targetPart.getSite().getWorkbenchWindow(); } public void saveFile(URI uri, Model model) throws IOException{ Resource resource = resourceSet.createResource(uri); resource.getContents().add(model); Map options = new HashMap(); options.put(XMLResource.OPTION_ENCODING, "UTF-8"); resource.save(options); } } |
|
From: Steve J. <sj...@us...> - 2006-02-01 09:18:00
|
Update of /cvsroot/modelwizard/source/Chameleon Feature In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10832 Modified Files: feature.xml Log Message: feb1 release Index: feature.xml =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Feature/feature.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** feature.xml 26 Jan 2006 16:23:44 -0000 1.10 --- feature.xml 1 Feb 2006 09:17:47 -0000 1.11 *************** *** 3,7 **** id="net.sourceforge.modelWizard.chameleon" label="Chameleon Model" ! version="4.0.16" provider-name="Cisco"> --- 3,7 ---- id="net.sourceforge.modelWizard.chameleon" label="Chameleon Model" ! version="4.0.18" provider-name="Cisco"> |