| Line 30... |
Line 30... |
| 30 |
worker.processPackage( thePackage );
|
30 |
worker.processPackage( thePackage );
|
| 31 |
|
31 |
|
| 32 |
foreach (EA.Element theElement in thePackage.Elements)
|
32 |
foreach (EA.Element theElement in thePackage.Elements)
|
| 33 |
{
|
33 |
{
|
| 34 |
worker.processElement( theElement );
|
34 |
worker.processElement( theElement );
|
| - |
|
35 |
|
| - |
|
36 |
if (Main.mustAbort)
|
| - |
|
37 |
return;
|
| 35 |
}
|
38 |
}
|
| 36 |
|
39 |
|
| 37 |
if (recurse == true)
|
40 |
if (recurse == true)
|
| 38 |
{
|
41 |
{
|
| 39 |
foreach (EA.Package subPackage in thePackage.Packages)
|
42 |
foreach (EA.Package subPackage in thePackage.Packages)
|
| 40 |
{
|
43 |
{
|
| 41 |
// RECURSION
|
44 |
// RECURSION
|
| 42 |
findAndProcessPackageElements( subPackage, worker, true);
|
45 |
findAndProcessPackageElements( subPackage, worker, true);
|
| - |
|
46 |
|
| - |
|
47 |
if (Main.mustAbort)
|
| - |
|
48 |
return;
|
| 43 |
}
|
49 |
}
|
| 44 |
}
|
50 |
}
|
| 45 |
|
- |
|
| 46 |
}
|
51 |
}
|
| 47 |
|
52 |
|
| 48 |
|
- |
|
| 49 |
public static string ReadTag(EA.Element theElement, string tagName)
|
53 |
public static void deletePackage(EA.Package packageToDelete)
|
| 50 |
{
|
54 |
{
|
| 51 |
string result;
|
- |
|
| 52 |
|
- |
|
| 53 |
EA.TaggedValue tag = (EA.TaggedValue)theElement.TaggedValues.GetByName(tagName);
|
55 |
EA.Package parentPackage = Main.EA_Repository.GetPackageByID(packageToDelete.ParentID);
|
| 54 |
if (null != tag)
|
56 |
if (parentPackage != null)
|
| 55 |
{
|
57 |
{
|
| 56 |
result = tag.Value;
|
58 |
short i = 0;
|
| - |
|
59 |
foreach(EA.Package pkg in parentPackage.Packages)
|
| 57 |
}
|
60 |
{
|
| - |
|
61 |
if (pkg.PackageID == packageToDelete.PackageID)
|
| 58 |
else
|
62 |
{
|
| - |
|
63 |
parentPackage.Packages.Delete(i);
|
| - |
|
64 |
break;
|
| 59 |
{
|
65 |
}
|
| 60 |
result = "";
|
66 |
i++;
|
| - |
|
67 |
}
|
| - |
|
68 |
parentPackage.Packages.Refresh();
|
| 61 |
}
|
69 |
}
|
| 62 |
return result;
|
- |
|
| 63 |
}
|
70 |
}
|
| 64 |
|
71 |
|
| 65 |
|
- |
|
| 66 |
public static bool WriteTag(EA.Element theElement, string tagName, string value)
|
72 |
public static EA.Element get_selected_element(ArrayList allowedElementTypes)
|
| 67 |
{
|
73 |
{
|
| 68 |
bool result;
|
74 |
object o;
|
| 69 |
EA.TaggedValue tag;
|
75 |
EA.ObjectType type;
|
| 70 |
|
- |
|
| 71 |
tag = (EA.TaggedValue)theElement.TaggedValues.GetByName(tagName);
|
- |
|
| 72 |
if (null != tag)
|
- |
|
| 73 |
{
|
- |
|
| 74 |
tag.Value = value;
|
- |
|
| 75 |
}
|
- |
|
| 76 |
else
|
- |
|
| 77 |
{
|
- |
|
| 78 |
tag = (EA.TaggedValue)theElement.TaggedValues.AddNew(tagName, value);
|
- |
|
| 79 |
}
|
- |
|
| 80 |
|
76 |
|
| 81 |
if (tag != null)
|
77 |
type = Main.EA_Repository.GetTreeSelectedItem(out o);
|
| 82 |
{
|
- |
|
| 83 |
result = tag.Update();
|
78 |
if (type == EA.ObjectType.otElement)
|
| 84 |
}
|
- |
|
| 85 |
else
|
- |
|
| 86 |
{
|
79 |
{
|
| - |
|
80 |
if (allowedElementTypes == null)
|
| 87 |
result = false;
|
81 |
return (EA.Element)o;
|
| - |
|
82 |
|
| - |
|
83 |
if (allowedElementTypes.Contains( ((EA.Element)o).Type ))
|
| - |
|
84 |
return (EA.Element)o;
|
| 88 |
}
|
85 |
}
|
| 89 |
return result;
|
86 |
return null;
|
| 90 |
}
|
87 |
}
|
| 91 |
|
88 |
|
| 92 |
|
- |
|
| 93 |
public static EA.Package get_selected_package()
|
89 |
public static EA.Package get_selected_package()
|
| 94 |
{
|
90 |
{
|
| 95 |
object o;
|
91 |
object o;
|
| 96 |
EA.ObjectType type;
|
92 |
EA.ObjectType type;
|
| 97 |
|
93 |
|
| 98 |
type = Main.EA_Repository.GetTreeSelectedItem(out o);
|
94 |
type = Main.EA_Repository.GetTreeSelectedItem(out o);
|
| 99 |
if (type == EA.ObjectType.otElement)
|
95 |
if (type == EA.ObjectType.otElement)
|
| 100 |
{
|
96 |
{
|
| 101 |
return Main.EA_Repository.GetPackageByID( ((EA.Element)o).PackageID );
|
97 |
return Main.EA_Repository.GetPackageByID(((EA.Element)o).PackageID);
|
| - |
|
98 |
}
|
| - |
|
99 |
else if (type == EA.ObjectType.otDiagram)
|
| - |
|
100 |
{
|
| - |
|
101 |
return Main.EA_Repository.GetPackageByID(((EA.Diagram)o).PackageID);
|
| 102 |
}
|
102 |
}
|
| 103 |
else if (type == EA.ObjectType.otPackage)
|
103 |
else if (type == EA.ObjectType.otPackage)
|
| 104 |
{
|
104 |
{
|
| 105 |
return (EA.Package)o;
|
105 |
return (EA.Package)o;
|
| 106 |
}
|
106 |
}
|
| Line 121... |
Line 121... |
| 121 |
newobj.TreePos = treePos;
|
121 |
newobj.TreePos = treePos;
|
| 122 |
newobj.Update();
|
122 |
newobj.Update();
|
| 123 |
return newobj;
|
123 |
return newobj;
|
| 124 |
}
|
124 |
}
|
| 125 |
|
125 |
|
| - |
|
126 |
/// <summary>
|
| - |
|
127 |
/// Adds a connection between one EA element and another
|
| - |
|
128 |
/// </summary>
|
| - |
|
129 |
/// <param name="repository"></param>
|
| - |
|
130 |
/// <param name="rq_artifact"></param>
|
| - |
|
131 |
/// <param name="ea_req"></param>
|
| - |
|
132 |
public static void add_connection(EA.Element src_element, EA.Element dest_element)
|
| - |
|
133 |
{
|
| - |
|
134 |
if (false == ea_element_traces_to_or_from(src_element, dest_element))
|
| - |
|
135 |
{
|
| - |
|
136 |
// Add the new connection between the src_element and dest_element
|
| - |
|
137 |
EA.Connector c = (EA.Connector)src_element.Connectors.AddNew("", "Dependency");
|
| - |
|
138 |
c.SupplierID = dest_element.ElementID;
|
| - |
|
139 |
c.Direction = "Source -> Destination";
|
| - |
|
140 |
c.Update();
|
| - |
|
141 |
src_element.Connectors.Refresh();
|
| - |
|
142 |
}
|
| - |
|
143 |
}
|
| - |
|
144 |
|
| - |
|
145 |
private static bool ea_element_traces_to_or_from(EA.Element src_element, EA.Element dest_element)
|
| - |
|
146 |
{
|
| - |
|
147 |
foreach(EA.Connector ea_c in src_element.Connectors)
|
| - |
|
148 |
{
|
| - |
|
149 |
int destId = -1;
|
| - |
|
150 |
|
| - |
|
151 |
// we dont care about direction of relationship, so test for both
|
| - |
|
152 |
if (ea_c.ClientID == src_element.ElementID)
|
| - |
|
153 |
destId = ea_c.SupplierID;
|
| - |
|
154 |
else if (ea_c.SupplierID == src_element.ElementID)
|
| - |
|
155 |
destId = ea_c.ClientID;
|
| - |
|
156 |
|
| - |
|
157 |
// and make sure we filter out self-referential connectors
|
| - |
|
158 |
if (destId != src_element.ElementID)
|
| - |
|
159 |
{
|
| - |
|
160 |
if (destId == dest_element.ElementID)
|
| - |
|
161 |
return true;
|
| - |
|
162 |
}
|
| - |
|
163 |
}
|
| - |
|
164 |
|
| - |
|
165 |
return false;
|
| - |
|
166 |
}
|
| - |
|
167 |
|
| - |
|
168 |
|
| - |
|
169 |
|
| 126 |
public static void DumpEAElement()
|
170 |
public static void DumpEAElement()
|
| 127 |
{
|
171 |
{
|
| 128 |
EA.Element ea_ele = (EA.Element)Main.EA_Repository.GetTreeSelectedObject();
|
172 |
EA.Element ea_ele = (EA.Element)Main.EA_Repository.GetTreeSelectedObject();
|
| 129 |
|
173 |
|
| 130 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "EA Element : " + ea_ele.Name, ea_ele.ElementID);
|
174 |
Main.WriteOutput("EA Element : " + ea_ele.Name, ea_ele.ElementID);
|
| 131 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Author : " + ea_ele.Author, -1);
|
175 |
Main.WriteOutput( "Author : " + ea_ele.Author, -1);
|
| 132 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ClassfierID : " + ea_ele.ClassfierID.ToString(), -1);
|
176 |
Main.WriteOutput( "ClassfierID : " + ea_ele.ClassfierID.ToString(), -1);
|
| 133 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ClassifierName : " + ea_ele.ClassifierName, -1);
|
177 |
Main.WriteOutput( "ClassifierName : " + ea_ele.ClassifierName, -1);
|
| 134 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ClassifierType : " + ea_ele.ClassifierType, -1);
|
178 |
Main.WriteOutput( "ClassifierType : " + ea_ele.ClassifierType, -1);
|
| 135 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Complexity : " + ea_ele.Complexity, -1);
|
179 |
Main.WriteOutput( "Complexity : " + ea_ele.Complexity, -1);
|
| 136 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Difficulty : " + ea_ele.Difficulty, -1);
|
180 |
Main.WriteOutput( "Difficulty : " + ea_ele.Difficulty, -1);
|
| 137 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ElementGUID : " + ea_ele.ElementGUID, -1);
|
181 |
Main.WriteOutput( "ElementGUID : " + ea_ele.ElementGUID, -1);
|
| 138 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ElementID : " + ea_ele.ElementID.ToString(), ea_ele.ElementID);
|
182 |
Main.WriteOutput( "ElementID : " + ea_ele.ElementID.ToString(), ea_ele.ElementID);
|
| 139 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "EventFlags : " + ea_ele.EventFlags, -1);
|
183 |
Main.WriteOutput( "EventFlags : " + ea_ele.EventFlags, -1);
|
| 140 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ExtensionPoints : " + ea_ele.ExtensionPoints, -1);
|
184 |
Main.WriteOutput( "ExtensionPoints : " + ea_ele.ExtensionPoints, -1);
|
| 141 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Genfile : " + ea_ele.Genfile, -1);
|
185 |
Main.WriteOutput( "Genfile : " + ea_ele.Genfile, -1);
|
| 142 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Genlinks : " + ea_ele.Genlinks, -1);
|
186 |
Main.WriteOutput( "Genlinks : " + ea_ele.Genlinks, -1);
|
| 143 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Gentype : " + ea_ele.Gentype, -1);
|
187 |
Main.WriteOutput( "Gentype : " + ea_ele.Gentype, -1);
|
| 144 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "GetLastError : " + ea_ele.GetLastError(), -1);
|
188 |
Main.WriteOutput( "GetLastError : " + ea_ele.GetLastError(), -1);
|
| 145 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "GetLinkedDocument : " + ea_ele.GetLinkedDocument(), -1);
|
189 |
Main.WriteOutput( "GetLinkedDocument : " + ea_ele.GetLinkedDocument(), -1);
|
| 146 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "GetStereotypeList : " + ea_ele.GetStereotypeList(), -1);
|
190 |
Main.WriteOutput( "GetStereotypeList : " + ea_ele.GetStereotypeList(), -1);
|
| 147 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "MetaType : " + ea_ele.MetaType, -1);
|
191 |
Main.WriteOutput( "MetaType : " + ea_ele.MetaType, -1);
|
| 148 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Multiplicity : " + ea_ele.Multiplicity, -1);
|
192 |
Main.WriteOutput( "Multiplicity : " + ea_ele.Multiplicity, -1);
|
| 149 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Notes : " + ea_ele.Notes, -1);
|
193 |
Main.WriteOutput( "Notes : " + ea_ele.Notes, -1);
|
| 150 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "PackageID : " + ea_ele.PackageID.ToString(), ea_ele.PackageID);
|
194 |
Main.WriteOutput( "PackageID : " + ea_ele.PackageID.ToString(), ea_ele.PackageID);
|
| 151 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ParentID : " + ea_ele.ParentID.ToString(), ea_ele.ParentID);
|
195 |
Main.WriteOutput( "ParentID : " + ea_ele.ParentID.ToString(), ea_ele.ParentID);
|
| 152 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Persistence : " + ea_ele.Persistence, -1);
|
196 |
Main.WriteOutput( "Persistence : " + ea_ele.Persistence, -1);
|
| 153 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Phase : " + ea_ele.Phase, -1);
|
197 |
Main.WriteOutput( "Phase : " + ea_ele.Phase, -1);
|
| 154 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Priority : " + ea_ele.Priority, -1);
|
198 |
Main.WriteOutput( "Priority : " + ea_ele.Priority, -1);
|
| 155 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "PropertyType : " + ea_ele.PropertyType.ToString(), -1);
|
199 |
Main.WriteOutput( "PropertyType : " + ea_ele.PropertyType.ToString(), -1);
|
| 156 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "RunState : " + ea_ele.RunState, -1);
|
200 |
Main.WriteOutput( "RunState : " + ea_ele.RunState, -1);
|
| 157 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Status : " + ea_ele.Status, -1);
|
201 |
Main.WriteOutput( "Status : " + ea_ele.Status, -1);
|
| 158 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Stereotype : " + ea_ele.Stereotype, -1);
|
202 |
Main.WriteOutput( "Stereotype : " + ea_ele.Stereotype, -1);
|
| 159 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "StereotypeEx : " + ea_ele.StereotypeEx, -1);
|
203 |
Main.WriteOutput( "StereotypeEx : " + ea_ele.StereotypeEx, -1);
|
| 160 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "StyleEx : " + ea_ele.StyleEx, -1);
|
204 |
Main.WriteOutput( "StyleEx : " + ea_ele.StyleEx, -1);
|
| 161 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Subtype : " + ea_ele.Subtype.ToString(), -1);
|
205 |
Main.WriteOutput( "Subtype : " + ea_ele.Subtype.ToString(), -1);
|
| 162 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Tablespace : " + ea_ele.Tablespace, -1);
|
206 |
Main.WriteOutput( "Tablespace : " + ea_ele.Tablespace, -1);
|
| 163 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Tag : " + ea_ele.Tag, -1);
|
207 |
Main.WriteOutput( "Tag : " + ea_ele.Tag, -1);
|
| 164 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "TreePos : " + ea_ele.TreePos.ToString(), -1);
|
208 |
Main.WriteOutput( "TreePos : " + ea_ele.TreePos.ToString(), -1);
|
| 165 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Type : " + ea_ele.Type, -1);
|
209 |
Main.WriteOutput( "Type : " + ea_ele.Type, -1);
|
| 166 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Version : " + ea_ele.Version, -1);
|
210 |
Main.WriteOutput( "Version : " + ea_ele.Version, -1);
|
| 167 |
Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Visibility : " + ea_ele.Visibility, -1);
|
211 |
Main.WriteOutput( "Visibility : " + ea_ele.Visibility, -1);
|
| 168 |
}
|
212 |
}
|
| 169 |
|
213 |
|
| 170 |
|
214 |
|
| 171 |
}
|
215 |
}
|
| 172 |
|
216 |
|