本文整理汇总了C#中EA.GetDiagramByGuid方法的典型用法代码示例。如果您正苦于以下问题:C# EA.GetDiagramByGuid方法的具体用法?C# EA.GetDiagramByGuid怎么用?C# EA.GetDiagramByGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EA
的用法示例。
在下文中一共展示了EA.GetDiagramByGuid方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: moveDiagramToPackage
/// <summary>
/// method moves diagram into target package
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="diagramGUID">GUID of diagram that should be moved</param>
/// <param name="packageGUID">GUID of target package</param>
public void moveDiagramToPackage(EA.Repository Repository, string diagramGUID, string packageGUID)
{
EA.Package package = (EA.Package)Repository.GetPackageByGuid(packageGUID);
EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
diagram.PackageID = package.PackageID;
diagram.Update();
package.Diagrams.Refresh();
BPAddIn.synchronizationWindow.addToList("Movement of diagram '" + diagram.Name + "' to package '" +
package.Name + "'");
}
示例2: moveDiagramToElement
/// <summary>
/// method moves diagram into target element
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="diagramGUID">GUID of diagram that should be moved</param>
/// <param name="elementGUID">GUID of target element</param>
public void moveDiagramToElement(EA.Repository Repository, string diagramGUID, string elementGUID)
{
EA.Element element = (EA.Element)Repository.GetElementByGuid(elementGUID);
EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
diagram.ParentID = element.ElementID;
diagram.Update();
element.Diagrams.Refresh();
BPAddIn.synchronizationWindow.addToList("Movement of diagram '" + diagram.Name + "' to element '" +
element.Name + "'");
}
示例3: save
public override void save(EA.Repository rep, FindAndReplaceItem.FieldType fieldType)
{
EA.Diagram dia = rep.GetDiagramByGuid(GUID);
if ((fieldType & FindAndReplaceItem.FieldType.Description) > 0)
{ dia.Notes = _Description; }
if ((fieldType & FindAndReplaceItem.FieldType.Name) > 0)
{ dia.Name = _Name; }
if ((fieldType & FindAndReplaceItem.FieldType.Stereotype) > 0)
{ dia.StereotypeEx = _Stereotype; }
_isUpdated = true;
dia.Update();
}
示例4: FindAndReplaceItemDiagram
public FindAndReplaceItemDiagram(EA.Repository rep, string GUID) :base( rep, GUID)
{
this._dia = rep.GetDiagramByGuid(GUID);
this.load(rep);
}
示例5: moveElementInDiagram
/// <summary>
/// method moves diagram object of element in diagram
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="elementGUID">GUID of element which diagram object that should be moved belongs to</param>
/// <param name="diagramGUID">GUID of diagram</param>
/// <param name="coordinates">new coordinates of diagram object that should be moved</param>
public void moveElementInDiagram(EA.Repository Repository, string elementGUID, string diagramGUID, string coordinates)
{
EA.Element element = (EA.Element)Repository.GetElementByGuid(elementGUID);
EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
int left, right, top, bottom, pocet = 0;
Wrapper.Diagram diagramWrapper = new Wrapper.Diagram(model, diagram);
Wrapper.ElementWrapper elWrapper = new Wrapper.ElementWrapper(model, element);
EA.DiagramObject diagramObject = diagramWrapper.getdiagramObjectForElement(elWrapper);
string[] coordinate;
string str;
string[] parts = coordinates.Split(';');
str = parts[0];
coordinate = str.Split('=');
diagramObject.left = Convert.ToInt32(coordinate[1]);
left = Convert.ToInt32(coordinate[1]);
str = parts[1];
coordinate = str.Split('=');
diagramObject.right = Convert.ToInt32(coordinate[1]);
right = Convert.ToInt32(coordinate[1]);
str = parts[2];
coordinate = str.Split('=');
diagramObject.top = Convert.ToInt32(coordinate[1]);
top = Convert.ToInt32(coordinate[1]);
str = parts[3];
coordinate = str.Split('=');
diagramObject.bottom = Convert.ToInt32(coordinate[1]);
bottom = Convert.ToInt32(coordinate[1]);
for (short i = 0; i < diagram.DiagramObjects.Count; i++)
{
EA.DiagramObject diagramObj = (EA.DiagramObject)diagram.DiagramObjects.GetAt(i);
EA.Element el = (EA.Element)Repository.GetElementByID(diagramObj.ElementID);
if (diagramObj.left >= left && diagramObj.right <= right && diagramObj.top <= top && diagramObj.bottom >= bottom)
{
if (diagramObj.ElementID != diagramObject.ElementID)
{
pocet++;
}
}
}
diagramObject.Sequence = 1 + pocet;
diagramObject.Update();
for (short i = 0; i < diagram.DiagramObjects.Count; i++)
{
EA.DiagramObject diagramObj = (EA.DiagramObject)diagram.DiagramObjects.GetAt(i);
EA.Element el = (EA.Element)Repository.GetElementByID(diagramObj.ElementID);
if (diagramObj.left <= left && diagramObj.right >= right && diagramObj.top >= top && diagramObj.bottom <= bottom)
{
if (diagramObj.ElementID != diagramObject.ElementID)
{
diagramObj.Sequence += 1;
diagramObj.Update();
}
}
}
int parentID = diagram.ParentID;
EA.Package package = (EA.Package)Repository.GetPackageByID(diagram.PackageID);
if (parentID == 0)
{
BPAddIn.synchronizationWindow.addToList("Change of coordinates of element '" + element.Name + "' in diagram '" +
diagram.Name + "' (Location of diagram: package '" + package.Name + "')");
}
else {
EA.Element parent = (EA.Element)Repository.GetElementByID(parentID);
BPAddIn.synchronizationWindow.addToList("Change of coordinates of element '" + element.Name + "' in diagram '" +
diagram.Name + "' (Location of diagram: element '" + parent.Name + "' in package '" + package.Name + "')");
}
diagram.DiagramObjects.Refresh();
}
示例6: handleContextItemChange
public void handleContextItemChange(EA.Repository repository, string GUID, ObjectType ot)
{
try
{
switch (ot)
{
case ObjectType.otElement:
this.currentItem = repository.GetElementByGuid(GUID);
if (currentItem.Type == "Class")
{
currentAttributes = new Dictionary<string, EA.Attribute>();
foreach (EA.Attribute attr in currentItem.Attributes)
{
currentAttributes.Add(attr.AttributeGUID, attr);
}
}
if (currentItem.Type == "UseCase")
{
// CONSTRAINTS
currentConstraintsList = new List<ConstraintWrapper>();
foreach (EA.Constraint constraint in currentItem.Constraints)
{
currentConstraintsList.Add(new ConstraintWrapper(constraint));
}
// SCENARIOS
currentScenarioList = new List<ScenarioWrapper>();
currentScenarioStepList = new Dictionary<string, List<EA.ScenarioStep>>();
foreach (EA.Scenario scenario in currentItem.Scenarios)
{
currentScenarioList.Add(new ScenarioWrapper(scenario));
if (!currentScenarioStepList.ContainsKey(scenario.ScenarioGUID))
{
currentScenarioStepList.Add(scenario.ScenarioGUID, new List<ScenarioStep>());
}
foreach (ScenarioStep step in scenario.Steps)
{
currentScenarioStepList[scenario.ScenarioGUID].Add(step);
}
}
}
this.currentConnector = null;
this.currentDiagram = null;
changed = false;
currentAuthor = repository.GetElementByGuid(GUID).Author;
break;
case ObjectType.otPackage:
this.currentItem = repository.GetElementByGuid(GUID);
this.currentConnector = null;
this.currentDiagram = null;
changed = false;
currentAuthor = repository.GetElementByGuid(GUID).Author;
break;
case ObjectType.otConnector:
this.currentConnector = repository.GetConnectorByGuid(GUID);
this.currentItem = null;
this.currentDiagram = null;
changed = false;
break;
case ObjectType.otDiagram:
this.currentDiagram = (EA.Diagram)repository.GetDiagramByGuid(GUID);
this.currentConnector = null;
this.currentItem = null;
changed = false;
currentAuthor = ((EA.Diagram)repository.GetDiagramByGuid(GUID)).Author;
currentParent = currentDiagram.ParentID.ToString();
currentExtensionPoints = new Dictionary<string, string>();
currentDiagramObjectPositions = new Dictionary<int, string>();
foreach (EA.DiagramObject diagramObject in currentDiagram.DiagramObjects)
{
try
{
EA.Collection col = repository.GetElementSet("" + diagramObject.ElementID, 1);
EA.Element element = (EA.Element)col.GetAt(0);
if (element.Type == "UseCase")
{
currentExtensionPoints.Add(element.ElementGUID, element.ExtensionPoints);
}
}
catch (Exception ex)
{
}
string coordinates = "";
coordinates += "l=" + diagramObject.left + ";";
coordinates += "r=" + diagramObject.right + ";";
coordinates += "t=" + diagramObject.top + ";";
coordinates += "b=" + diagramObject.bottom + ";";
currentDiagramObjectPositions.Add(diagramObject.ElementID, coordinates);
}
break;
default:
return;
//.........这里部分代码省略.........
示例7: broadcastEvent
//.........这里部分代码省略.........
{
if (!active.ContainsKey(GUID) || active[GUID].Find(x => x.rule == registeredRule) == null)
{
RuleEntry ruleEntry = createRuleEntry(model, rslt, connector, registeredRule);
if (active.ContainsKey(GUID))
{
active[GUID].Add(ruleEntry);
}
else
{
List<RuleEntry> ruleEntryList = new List<RuleEntry>();
ruleEntryList.Add(ruleEntry);
active.Add(GUID, ruleEntryList);
}
showErrorWindow(Repository);
addToDefectsList(rslt, ruleEntry);
}
else
{
foreach (RuleEntry ruleEntry in active[GUID])
{
if (ruleEntry.rule == registeredRule)
{
addToDefectsList(rslt, ruleEntry);
}
}
}
}
else
{
if (active.ContainsKey(GUID))
{
RuleEntry ruleEntry = active[GUID].Find(x => x.rule == registeredRule);
if (ruleEntry != null)
{
BPAddIn.BPAddIn.defectsWindow.removeFromList(ruleEntry.listBoxObject);
BPAddIn.BPAddIn.defectsWindow.removeFromHiddenList(ruleEntry.listBoxObject);
active.Remove(GUID);
}
}
}
}
}
else if (ot == EA.ObjectType.otDiagram)
{
object diagram = Repository.GetDiagramByGuid(GUID);
foreach (Rule registeredRule in eventWatchers[((EA.Diagram)diagram).Type])
{
string rslt = registeredRule.activate(diagram, model);
if (rslt != "")
{
if (!active.ContainsKey(GUID) || active[GUID].Find(x => x.rule == registeredRule) == null)
{
RuleEntry ruleEntry = createRuleEntry(model, rslt, diagram, registeredRule);
if (active.ContainsKey(GUID))
{
active[GUID].Add(ruleEntry);
}
else
{
List<RuleEntry> ruleEntryList = new List<RuleEntry>();
ruleEntryList.Add(ruleEntry);
active.Add(GUID, ruleEntryList);
}
showErrorWindow(Repository);
addToDefectsList(rslt, ruleEntry);
}
else
{
foreach (RuleEntry ruleEntry in active[GUID])
{
if (ruleEntry.rule == registeredRule)
{
addToDefectsList(rslt, ruleEntry);
}
}
}
}
else
{
if (active.ContainsKey(GUID))
{
RuleEntry ruleEntry = active[GUID].Find(x => x.rule == registeredRule);
if (ruleEntry != null)
{
BPAddIn.BPAddIn.defectsWindow.removeFromList(ruleEntry.listBoxObject);
BPAddIn.BPAddIn.defectsWindow.removeFromHiddenList(ruleEntry.listBoxObject);
active.Remove(GUID);
}
}
}
}
}
}
示例8: addDiagramObject
/// <summary>
/// method adds a new diagram object into diagram
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="elementGUID">GUID of element</param>
/// <param name="diagramGUID">GUID of diagram</param>
/// <param name="coordinates">coordinates of new diagram object</param>
public void addDiagramObject(EA.Repository Repository, string elementGUID, string diagramGUID, string coordinates)
{
int left, right, top, bottom;
string[] coordinate;
string str;
string[] parts = coordinates.Split(';');
str = parts[0];
coordinate = str.Split('=');
left = Convert.ToInt32(coordinate[1]);
str = parts[1];
coordinate = str.Split('=');
right = Convert.ToInt32(coordinate[1]);
str = parts[2];
coordinate = str.Split('=');
top = Convert.ToInt32(coordinate[1]);
str = parts[3];
coordinate = str.Split('=');
bottom = Convert.ToInt32(coordinate[1]);
EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
for (short i = 0; i < diagram.DiagramObjects.Count; i++)
{
EA.DiagramObject diagramObj = (EA.DiagramObject)diagram.DiagramObjects.GetAt(i);
EA.Element el = (EA.Element)Repository.GetElementByID(diagramObj.ElementID);
if (diagramObj.left <= left && diagramObj.right >= right && diagramObj.top >= top && diagramObj.bottom <= bottom)
{
diagramObj.Sequence += 1;
diagramObj.Update();
}
}
diagram.DiagramObjects.Refresh();
EA.Element element = (EA.Element)Repository.GetElementByGuid(elementGUID);
EA.DiagramObject displayElement = (EA.DiagramObject)diagram.DiagramObjects.AddNew(coordinates, "");
displayElement.ElementID = element.ElementID;
displayElement.Sequence = 1;
displayElement.Update();
diagram.DiagramObjects.Refresh();
EA.Package parentPackage = (EA.Package)Repository.GetPackageByID(diagram.PackageID);
if (diagram.ParentID == 0)
{
BPAddIn.synchronizationWindow.addToList("Addition of element '" + element.Name + "' to diagram '"
+ diagram.Name + "' (Location of diagram: package '" + parentPackage.Name + "')");
}
else
{
EA.Element parentElement = (EA.Element)Repository.GetElementByID(diagram.ParentID);
BPAddIn.synchronizationWindow.addToList("Addition of element '" + element.Name + "' to diagram '"
+ diagram.Name + "' (Location of diagram: element '" + parentElement.Name
+ "' in package '" + parentPackage.Name + "')");
}
}
示例9: deleteDiagramObject
/// <summary>
/// method deletes diagram object from diagram
/// </summary>
/// <param name="Repository"></param>
/// <param name="elementGUID">GUID of element which diagram object that should be deleted belongs to</param>
/// <param name="diagramGUID">GUID of diagram owning diagram object that should be deleted</param>
public void deleteDiagramObject(EA.Repository Repository, string elementGUID, string diagramGUID)
{
EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
EA.Element element = (EA.Element)Repository.GetElementByGuid(elementGUID);
for (short i = 0; i < diagram.DiagramObjects.Count; i++)
{
EA.DiagramObject diagramObject = (EA.DiagramObject)diagram.DiagramObjects.GetAt(i);
if (diagramObject.ElementID == element.ElementID)
{
diagram.DiagramObjects.DeleteAt(i, false);
break;
}
}
diagram.DiagramObjects.Refresh();
BPAddIn.synchronizationWindow.addToList("Deletion of element '" + element.Name + "' from diagram '" + diagram.Name +
"' (Location of diagram: " + itemTypes.getLocationOfItem(Repository, diagram.PackageID, diagram.ParentID));
}
示例10: deleteDiagram
/// <summary>
/// method deletes diagram
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="diagramGUID">GUID of diagram that should be deleted</param>
/// <param name="elementType">type of diagram that should be deleted</param>
public void deleteDiagram(EA.Repository Repository, string diagramGUID, int elementType)
{
EA.Diagram diagramToDelete = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
string name = diagramToDelete.Name;
int packageID = diagramToDelete.PackageID;
int parentID = diagramToDelete.ParentID;
EA.Collection diagrams;
if (diagramToDelete.ParentID == 0)
{
diagrams = (EA.Collection)Repository.GetPackageByID(diagramToDelete.PackageID).Diagrams;
}
else
{
diagrams = (EA.Collection)Repository.GetElementByID(diagramToDelete.ParentID).Diagrams;
}
for (short i = 0; i < diagrams.Count; i++)
{
EA.Diagram actualDiagram = (EA.Diagram)diagrams.GetAt(i);
if (actualDiagram.DiagramGUID == diagramGUID)
{
diagrams.DeleteAt(i, false);
break;
}
}
diagrams.Refresh();
BPAddIn.synchronizationWindow.addToList("Deletion of " + itemTypes.getElementTypeInEnglish(elementType) + " '" +
name + "' (Previous location of diagram: " +
itemTypes.getLocationOfItem(Repository, packageID, parentID));
}
示例11: changeDiagramStereotype
/// <summary>
/// method changes stereotype of diagram
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="diagramGUID">GUID of changed diagram</param>
/// <param name="stereotype">new stereotype of changed diagram</param>
/// <param name="oldStereotype">previous stereotype of changed diagram</param>
/// <param name="elementType">type of changed diagram</param>
public void changeDiagramStereotype(EA.Repository Repository, string diagramGUID, string stereotype, string oldStereotype, int elementType)
{
EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
diagram.Stereotype = stereotype;
diagram.Update();
BPAddIn.synchronizationWindow.addToList("Change of stereotype of " + itemTypes.getElementTypeInEnglish(elementType) + " '" + diagram.Name
+ "' - previous stereotype: '" + oldStereotype + "', current stereotype: '" + stereotype +
"' (Location of diagram: " + itemTypes.getLocationOfItem(Repository, diagram.PackageID, diagram.ParentID));
}
示例12: changeDiagramNotes
/// <summary>
/// method changes notes of diagram
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="diagramGUID">GUID of changed diagram</param>
/// <param name="notes">new notes of changed diagram</param>
/// <param name="elementType">type of changed diagram</param>
public void changeDiagramNotes(EA.Repository Repository, string diagramGUID, string notes, int elementType)
{
EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
diagram.Notes = notes;
diagram.Update();
BPAddIn.synchronizationWindow.addToList("Change of notes of " + itemTypes.getElementTypeInEnglish(elementType) + " '" + diagram.Name +
"' (Location of diagram: " + itemTypes.getLocationOfItem(Repository, diagram.PackageID, diagram.ParentID));
}
示例13: changeDiagramAuthor
/// <summary>
/// method changes author of diagram
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="diagramGUID">GUID of changed diagram</param>
/// <param name="author">new author of changed diagram</param>
/// <param name="oldAuthor">previous author of changed diagram</param>
/// <param name="elementType">type of changed diagram</param>
public void changeDiagramAuthor(EA.Repository Repository, string diagramGUID, string author, string oldAuthor, int elementType)
{
EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
diagram.Author = author;
diagram.Update();
BPAddIn.synchronizationWindow.addToList("Change of author " + itemTypes.getElementTypeInEnglish(elementType) + " '" +
diagram.Name + "' - previous author: '" + oldAuthor + "', current autor: '" + author +
"' (Location of diagram: " + itemTypes.getLocationOfItem(Repository, diagram.PackageID, diagram.ParentID));
}