Author Topic: Easy to use copy/paste for packages and elements  (Read 5378 times)

jamessher

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Easy to use copy/paste for packages and elements
« on: August 23, 2006, 02:19:46 am »
Hi, There appears to be no convenient way to copy and paste packages and elements. The only way I can see to do it is to export and re-import but this is clunky and error-prone.
I would suggest that it should be possible to copy and paste packages and elements in the Project View. When the new package or element is pasted it should be automatically be given a new name (eg. old name with something prepended or appended, eg. _).
Thanks
 James

Jan ´Bary´ Glas

  • EA User
  • **
  • Posts: 408
  • Karma: +0/-0
  • Bary
    • View Profile
Re: Easy to use copy/paste for packages and elemen
« Reply #1 on: August 23, 2006, 03:43:43 am »
If this should work than just different GUID is enough.
BTW: I have no problem with export/import.
Jan 'Bary' Glas

thomaskilian

  • Guest
Re: Easy to use copy/paste for packages and elemen
« Reply #2 on: August 23, 2006, 06:32:05 am »
More convenient is to use a transformation template, since you normally would not simply copy data, but have some sort of clone with a few differences.

jamessher

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Easy to use copy/paste for packages and elemen
« Reply #3 on: August 23, 2006, 06:52:44 am »
Huh ? A transformation template seems like a lot of hassle compared to just copying and pasting a class in the Project View.
Other UML tools can do this basic sort of C&P.

thomaskilian

  • Guest
Re: Easy to use copy/paste for packages and elemen
« Reply #4 on: August 23, 2006, 02:59:09 pm »
Actually not. Once you have it, and it's easy to create, it's just two clicks to create the clone.

jamessher

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Easy to use copy/paste for packages and elemen
« Reply #5 on: August 24, 2006, 12:33:38 am »
Would you mind showing me the template ?

thomaskilian

  • Guest
Re: Easy to use copy/paste for packages and elemen
« Reply #6 on: August 24, 2006, 12:33:08 pm »
Save the following as XML and import via Import Reference Data. You should then have a Duplicate template (hope that works with copy/paste):
<?xml version="1.0" encoding="windows-1252"?>
<RefData version="1.0" exporter="EA.25">
<DataSet name="Duplicate_Transform_Template" table="t_template" filter="TemplateType='#TemplateType#' and TemplateName='#TemplateName#' and Style='#Style#'">
<DataRow>
<Column name="TemplateID" value="{BC474B33-1506-49d5-A3A1-18CCC03FBA9C}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="File"/>
<Column name="Template" value="Package&#xA;{&#xA;  name=&quot;Duplicate&quot;&#xA;  namespaceroot=&quot;true&quot;&#xA;%list=&quot;Namespace&quot; @separator=&quot;\n\n&quot; @indent=&quot;  &quot;%&#xA;}"/>
</DataRow>
<DataRow>
<Column name="TemplateID" value="{E26CEA53-E4B4-4669-922F-0EE935000A4B}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="Namespace"/>
<Column name="Template" value="%if packagePath == &quot;&quot;%&#xA;%list=&quot;Namespace&quot; @separator=&quot;\n&quot;%&#xA;%list=&quot;Class&quot; @separator=&quot;\n&quot;%&#xA;%endTemplate%&#xA;&#xA;Package&#xA;{&#xA;  %TRANSFORM_CURRENT()%&#xA;%list=&quot;Namespace&quot; @separator=&quot;\n&quot; @indent=&quot;  &quot;%&#xA;%list=&quot;Class&quot; @separator=&quot;\n&quot; @indent=&quot;  &quot;%&#xA;}"/>
</DataRow>
<DataRow>
<Column name="TemplateID" value="{3940E821-0C28-4223-A549-4ECE09A16B22}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="Class"/>
<Column name="Template" value="%if elemType != &quot;Class&quot; and elemType != &quot;Interface&quot;%&#xA;%endTemplate%&#xA;&#xA;%elemType%&#xA;{&#xA;  %TRANSFORM_REFERENCE(&quot;Class&quot;)%&#xA;  %TRANSFORM_CURRENT(&quot;language&quot;)%&#xA;  language=%qt%%classLanguage%%qt%&#xA;%list=&quot;ClassBase&quot; @separator=&quot;\n&quot; @indent=&quot;  &quot;%&#xA;%list=&quot;ClassInterface&quot; @separator=&quot;\n&quot; @indent=&quot;  &quot;%&#xA;%list=&quot;InnerClass&quot; @separator=&quot;\n&quot; @indent=&quot;  &quot;%&#xA;%if elemType==&quot;Class&quot;%&#xA;%list=&quot;Attribute&quot; @separator=&quot;\n&quot; @indent=&quot;  &quot;%&#xA;%endIf%&#xA;%list=&quot;Operation&quot; @separator=&quot;\n&quot; @indent=&quot;  &quot;%&#xA;}&#xA;%list=&quot;Connector&quot; @separator=&quot;\n&quot;%"/>
</DataRow>
<DataRow>
<Column name="TemplateID" value="{1FF546D5-AB09-426f-9050-372F745A25B6}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="Class Base"/>
<Column name="Template" value="Parent&#xA;{&#xA;  name=%qt%%classBaseName%%qt%&#xA;  type=&quot;Parent&quot;&#xA;}"/>
</DataRow>
<DataRow>
<Column name="TemplateID" value="{3F05BD71-4881-4e73-91D9-1306142ABA08}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="Class Interface"/>
<Column name="Template" value="Parent&#xA;{&#xA;  name=%qt%%classBaseName%%qt%&#xA;  type=&quot;Implements&quot;&#xA;}"/>
</DataRow>
<DataRow>
<Column name="TemplateID" value="{07D0E331-A480-4ba7-8A2D-50B50D1898AB}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="Attribute"/>
<Column name="Template" value="Attribute&#xA;{&#xA;  %TRANSFORM_REFERENCE()%&#xA;  %TRANSFORM_CURRENT(&quot;scope&quot;,&quot;type&quot;)%&#xA;  scope=%qt%%attScope == &quot;Public&quot; ? &quot;Private&quot; : value%%qt%&#xA;  type=%qt%%CONVERT_TYPE(&quot;C#&quot;,attType)%%qt%&#xA;}"/>
</DataRow>
<DataRow>
<Column name="TemplateID" value="{C295E53F-E825-4dd3-8625-5D2FFAB538CB}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="Operation"/>
<Column name="Template" value="Operation&#xA;{&#xA;  %TRANSFORM_REFERENCE()%&#xA;  %TRANSFORM_CURRENT(&quot;code&quot;)%&#xA;$sqt=%qt%&#xA;$bsl=%LEFT(&quot;\\&quot;,1)%&#xA;$dqt=$bsl+$sqt&#xA;$nl=&quot;\n&quot;&#xA;$nlx=$sqt+&quot;+&quot;+$bsl+&quot;n+&quot;+$sqt&#xA;$code=%REPLACE(opCode,$sqt,$dqt)%&#xA;$code=%REPLACE($code,$nl,$nlx)%&#xA;  code=%qt%$code%qt%&#xA;%list=&quot;Parameter&quot; @separator=&quot;\n&quot; @indent=&quot;  &quot;%&#xA;}"/>
</DataRow>
<DataRow>
<Column name="TemplateID" value="{ECBDC804-9968-4eca-8210-4038C7D596F0}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="Parameter"/>
<Column name="Template" value="Parameter&#xA;{&#xA;  %TRANSFORM_CURRENT(&quot;type&quot;)%&#xA;  type=%qt%%CONVERT_TYPE(&quot;C#&quot;,paramType)%%qt%&#xA;}"/>
</DataRow>
<DataRow>
<Column name="TemplateID" value="{41E12AFF-E7EA-43ae-A933-4C77F08C08CD}"/>
<Column name="TemplateType" value="Duplicate_Transform_Template"/>
<Column name="TemplateName" value="Connector"/>
<Column name="Template" value="%if connectorType==&quot;Dependency&quot;%&#xA;%endTemplate%&#xA;&#xA;%connectorType%&#xA;%PI=&quot;\n  &quot;%&#xA;{&#xA;%TRANSFORM_CURRENT()%&#xA;%TRANSFORM_REFERENCE(&quot;Connector&quot;,connectorGUID)%&#xA;Source&#xA;{&#xA;%TRANSFORM_REFERENCE(&quot;Class&quot;,connectorSourceElemGUID)%&#xA;%TRANSFORM_CURRENT(&quot;Source&quot;)%&#xA;}&#xA;Target&#xA;{&#xA;%TRANSFORM_REFERENCE(&quot;Class&quot;,connectorDestElemGUID)%&#xA;%TRANSFORM_CURRENT(&quot;Target&quot;)%&#xA;%PI=&quot;\n&quot;%&#xA;}&#xA;}"/>
</DataRow>
</DataSet>
</RefData>

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Easy to use copy/paste for packages and elemen
« Reply #7 on: August 24, 2006, 03:03:34 pm »
It's also worth noting that 6.5 makes writing such a transformation much easier.  It includes template templates for all new transformations that simply copy the existing data.  Then all you need to do is modify at least one template so that you can use the defaults.

jamessher

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Easy to use copy/paste for packages and elemen
« Reply #8 on: August 25, 2006, 01:34:04 am »
Hi Thomas,

I tried the template and while it sort of worked it doesn't really do what I want. For example I cannot figure out how to copy and paste an individual element (class, component, interface, etc).
Before I started with EA I was using StarUML and it was a breeze to do this - just select class in Project View (Model Explorer), copy, paste, and StarUML created an exact copy and changed the name to be equal to original with trailing _
Actually this worked for elements, diagrams, packages and was very useful.

While I greatly appreciate your suggestion (transformation template) I would really like the EA folks to consider adding this feature and making this type of C&P simple and intuitive (as it is in StarUML).
Thanks
  James