本文整理汇总了C#中EA.GetPackageByGuid方法的典型用法代码示例。如果您正苦于以下问题:C# EA.GetPackageByGuid方法的具体用法?C# EA.GetPackageByGuid怎么用?C# EA.GetPackageByGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EA
的用法示例。
在下文中一共展示了EA.GetPackageByGuid方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: showObjectProperties
public void showObjectProperties(EA.Repository Repository, string GUID, EA.ObjectType ot)
{
eaObjectType.Text = ot.ToString();
eaObjectName.Text = "?";
switch(ot)
{
case EA.ObjectType.otAttribute:
EA.Attribute attribute = Repository.GetAttributeByGuid(GUID);
currentEaObject = attribute;
currentEaObjectCollections = null;
eaObjectName.Text = attribute.Name;
showEmbeddedObjects.Enabled = false;
showEmbeddedObjects.Checked = false;
break;
case EA.ObjectType.otElement:
EA.Element element = Repository.GetElementByGuid(GUID);
currentEaObject = element;
currentEaObjectCollections = new EAElementCollections(element);
eaObjectName.Text = element.Name;
showEmbeddedObjects.Enabled = true;
break;
case EA.ObjectType.otMethod:
EA.Method method = Repository.GetMethodByGuid(GUID);
currentEaObject = method;
currentEaObjectCollections = null;
eaObjectName.Text = method.Name;
showEmbeddedObjects.Enabled = false;
showEmbeddedObjects.Checked = false;
break;
case EA.ObjectType.otPackage:
EA.Package package = Repository.GetPackageByGuid(GUID);
currentEaObject = package;
currentEaObjectCollections = new EAPackageCollections(package);
eaObjectName.Text = package.Name;
showEmbeddedObjects.Enabled = true;
break;
case EA.ObjectType.otConnector:
EA.Connector connector = Repository.GetConnectorByGuid(GUID);
currentEaObject = connector;
currentEaObjectCollections = null;
showEmbeddedObjects.Enabled = false;
showEmbeddedObjects.Checked = false;
break;
default:
currentEaObject = null;
currentEaObjectCollections = null;
propertyGrid.SelectedObject = null;
showEmbeddedObjects.Enabled = false;
showEmbeddedObjects.Checked = false;
break;
}
SynchPropertyGridSelection();
}
示例3: save
public override void save(EA.Repository rep, FindAndReplaceItem.FieldType fieldType)
{
_pkg = rep.GetPackageByGuid(GUID);
if ((fieldType & FindAndReplaceItem.FieldType.Description) > 0)
{ _pkg.Notes = _Description; }
if ((fieldType & (FindAndReplaceItem.FieldType.Name | FindAndReplaceItem.FieldType.Stereotype) ) > 0)
{
// model don't have an element
if (_pkg.ParentID != 0)
{
EA.Element el = rep.GetElementByGuid(GUID);
el.StereotypeEx = _Stereotype;
el.Name = _Name;
el.Update();
}
_pkg.Name = _Name;
}
_isUpdated = true;
_pkg.Update();
}
示例4: moveElementOrPackageToPackage
/// <summary>
/// method moves element or package into target package
/// </summary>
/// <param name="repository">EA repository</param>
/// <param name="itemGUID">GUID of item that should be moved</param>
/// <param name="targetPackageGUID">GUID of target package</param>
/// <param name="elementType">type of element</param>
public void moveElementOrPackageToPackage(EA.Repository repository, string itemGUID, string targetPackageGUID, int elementType)
{
EA.Package targetPackage = (EA.Package)repository.GetPackageByGuid(targetPackageGUID);
if (elementType == 3)
{
EA.Package package = (EA.Package)repository.GetPackageByGuid(itemGUID);
if (package.ParentID != targetPackage.PackageID)
{
package.ParentID = targetPackage.PackageID;
package.Update();
targetPackage.Packages.Refresh();
BPAddIn.synchronizationWindow.addToList("Movement of package '" + package.Name + "' to package '" +
targetPackage.Name + "'");
}
}
else
{
EA.Element element = (EA.Element)repository.GetElementByGuid(itemGUID);
if (element.ParentID != targetPackage.PackageID)
{
element.PackageID = targetPackage.PackageID;
element.Update();
targetPackage.Elements.Refresh();
BPAddIn.synchronizationWindow.addToList("Movement of element '" + element.Name + "' to package '" +
targetPackage.Name + "'");
}
}
}
示例5: GetModelDocumentFromPackage
// Find the operation from Activity / State Machine
// it excludes operations in state machines
public static EA.Package GetModelDocumentFromPackage(EA.Repository rep, EA.Package pkg)
{
EA.Package pkg1 = null;
string repositoryType = "JET";// rep.RepositoryType();
// get object_ID of package
var query = @"select pkg.ea_GUID AS EA_GUID " +
@" from (((t_object o INNER JOIN t_attribute a on (o.object_ID = a.Object_ID AND a.type = 'Package')) " +
@" INNER JOIN t_package pkg on (pkg.Package_ID = o.Package_ID)) " +
@" INNER JOIN t_object o1 on (cstr(o1.object_id) = a.classifier)) " +
@" where o1.ea_guid = '" + pkg.PackageGUID + "' ";
if (repositoryType== "JET")
{
query = @"select pkg.ea_GUID AS EA_GUID " +
@" from (((t_object o INNER JOIN t_attribute a on (o.object_ID = a.Object_ID AND a.type = 'Package')) " +
@" INNER JOIN t_package pkg on (pkg.Package_ID = o.Package_ID)) " +
@" INNER JOIN t_object o1 on (cstr(o1.object_id) = a.classifier)) " +
@" where o1.ea_guid = '" + pkg.PackageGUID + "' ";
}
if (repositoryType == "SQLSVR")
// SQL Server
{
query = @"select pkg.ea_GUID AS EA_GUID " +
@" from (((t_object o INNER JOIN t_attribute a on (o.object_ID = a.Object_ID AND a.type = 'Package')) " +
@" INNER JOIN t_package pkg on (pkg.Package_ID = o.Package_ID)) " +
@" INNER JOIN t_object o1 on o1.object_id = Cast(a.classifier As Int)) " +
@" where o1.ea_guid = '" + pkg.PackageGUID + "' ";
}
string str = rep.SQLQuery(query);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(str);
XmlNode operationGuidNode = xmlDoc.SelectSingleNode("//EA_GUID");
if (operationGuidNode != null)
{
string guid = operationGuidNode.InnerText;
pkg1 = rep.GetPackageByGuid(guid);
}
return pkg1;
}
示例6: GetLatest
public static bool GetLatest(EA.Repository rep, EA.Package pkg, bool recursive, ref int count, int level, ref int errorCount)
{
if (pkg.IsControlled)
{
level = level + 1;
// check if checked out
string path = GetVccFilePath(rep, pkg);
string fText;
//rep.WriteOutput("Debug", "Path:" + pkg.Name + path, 0);
var sLevel = new string(' ', level * 2);
rep.WriteOutput("Debug", sLevel + (count+1).ToString(",0") + " Work for:" + path, 0);
if (path != "")
{
count = count + 1;
rep.ShowInProjectView(pkg);
// delete a potential write protection
try
{
var fileInfo = new FileInfo(path);
var attributes = (FileAttributes)(fileInfo.Attributes - FileAttributes.ReadOnly);
System.IO.File.SetAttributes(fileInfo.FullName, attributes);
System.IO.File.Delete(path);
}
catch (FileNotFoundException e)
{
fText = path + " " + e.Message;
rep.WriteOutput("Debug", fText, 0);
errorCount = errorCount + 1;
}
catch (DirectoryNotFoundException e)
{
fText = path + " " + e.Message;
rep.WriteOutput("Debug", fText, 0);
errorCount = errorCount + 1;
}
// get latest
try
{
// to make sure pkg is the correct reference
// new load of pkg after GetLatest
string pkgGuid = pkg.PackageGUID;
pkg.VersionControlGetLatest(true);
pkg = rep.GetPackageByGuid(pkgGuid);
count = count + 1;
}
catch
{
fText = path + " " + pkg.GetLastError();
rep.WriteOutput("Debug", fText, 0);
errorCount = errorCount + 1;
}
}
else
{
fText = pkg.XMLPath + " invalid path";
rep.WriteOutput("Debug", fText, 0);
errorCount = errorCount + 1;
}
}
//rep.WriteOutput("Debug", "Recursive:" +recursive.ToString(), 0);
if (recursive)
{
//rep.WriteOutput("Debug","Recursive count:" + pkg.Packages.Count.ToString(), 0);
// over all contained packages
foreach (EA.Package pkgNested in pkg.Packages)
{
//rep.WriteOutput("Debug", "Recursive:"+ pkgNested.Name, 0);
GetLatest(rep, pkgNested, true, ref count, level, ref errorCount);
}
}
return true;
}
示例7: addDiagram
/// <summary>
/// method adds a new diagram into parent element or package
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="parentGUID">GUID of parent element</param>
/// <param name="packageGUID">GUID of parent package</param>
/// <param name="elementType">type of new diagram</param>
/// <param name="name">name of new diagram</param>
/// <param name="author">author of new diagram</param>
/// <returns>GUID of new diagram</returns>
public string addDiagram(EA.Repository Repository, string parentGUID, string packageGUID, int elementType, string name, string author)
{
if (getDiagramType(elementType) == "")
{
return "";
}
EA.Collection diagrams;
if (parentGUID == "0")
{
diagrams = (EA.Collection)Repository.GetPackageByGuid(packageGUID).Diagrams;
}
else
{
diagrams = (EA.Collection)Repository.GetElementByGuid(parentGUID).Diagrams;
}
EA.Diagram newDiagram = (EA.Diagram)diagrams.AddNew(name, getDiagramType(elementType));
newDiagram.Author = author;
newDiagram.Update();
diagrams.Refresh();
EA.Package parentPackage = (EA.Package)Repository.GetPackageByGuid(packageGUID);
if (parentGUID == "0")
{
BPAddIn.synchronizationWindow.addToList("Addition of " + itemTypes.getElementTypeInEnglish(elementType) + " '" + name +
"' to package '" + parentPackage.Name + "' - author: '" + author + "'");
}
else
{
EA.Element parentElement = (EA.Element)Repository.GetElementByGuid(parentGUID);
BPAddIn.synchronizationWindow.addToList("Addition of " + itemTypes.getElementTypeInEnglish(elementType) + " '" + name +
"' to element '" + parentElement.Name + "' in package '" + parentPackage.Name + "' - author: '" + author + "'");
}
return newDiagram.DiagramGUID;
}
示例8: addPackage
/// <summary>
/// method adds a new package into parent package
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="packageGUID">GUID of parent package</param>
/// <param name="name">name of new package</param>
/// <param name="author">author of new package</param>
/// <returns>GUID of new package</returns>
public String addPackage(EA.Repository Repository, string packageGUID, string name, string author)
{
EA.Package parentPackage = (EA.Package)Repository.GetPackageByGuid(packageGUID);
EA.Package newPackage = (EA.Package)parentPackage.Packages.AddNew(name, "");
newPackage.Update();
EA.Element packageMetaElement = (EA.Element)newPackage.Element;
packageMetaElement.Author = author;
newPackage.Update();
parentPackage.Packages.Refresh();
BPAddIn.synchronizationWindow.addToList("Addition of package '" + name + "' to package '" + parentPackage.Name
+ "' - author: '" + author + "'");
return newPackage.PackageGUID;
}
示例9: addElement
/// <summary>
/// method adds a new element into parent element or package
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="parentGUID">GUID of parent element</param>
/// <param name="packageGUID">GUID of parent package</param>
/// <param name="coordinates">coordinates of new element</param>
/// <param name="elementType">type of new element</param>
/// <param name="name">name of new element</param>
/// <param name="author">author of new element</param>
/// <returns>GUID of new element</returns>
public string addElement(EA.Repository Repository, string parentGUID, string packageGUID, string coordinates,
int elementType, string name, string author)
{
if (getElementType(elementType) == "" && getElementStereotype(elementType) == "" && getElementSubtype(elementType) == -1)
{
return "";
}
EA.Collection elements;
if (parentGUID == "0")
{
elements = (EA.Collection)Repository.GetPackageByGuid(packageGUID).Elements;
}
else
{
elements = (EA.Collection)Repository.GetElementByGuid(parentGUID).Elements;
}
if (elementType == 6 || (elementType > 30 && elementType < 45))
{
elements = (EA.Collection)Repository.GetPackageByGuid(packageGUID).Elements;
}
EA.Element newElement = (EA.Element)elements.AddNew(name, getElementType(elementType));
if ((elementType >= 7 && elementType <= 10) || (elementType >= 18 && elementType <= 23))
{
newElement.Subtype = getElementSubtype(elementType);
}
if (elementType == 4 || (elementType >= 15 && elementType <= 17) || (elementType >= 31 && elementType <= 44))
{
newElement.Stereotype = getElementStereotype(elementType);
}
newElement.Author = author;
newElement.Update();
elements.Refresh();
EA.Package parentPackage = (EA.Package)Repository.GetPackageByGuid(packageGUID);
if (parentGUID == "0")
{
BPAddIn.synchronizationWindow.addToList("Addition of " + itemTypes.getElementTypeInEnglish(elementType) + " '" + name +
"' to package '" + parentPackage.Name + "' - author: '" + author + "'");
}
else
{
EA.Element parentElement = (EA.Element)Repository.GetElementByGuid(parentGUID);
BPAddIn.synchronizationWindow.addToList("Addition of " + itemTypes.getElementTypeInEnglish(elementType) + " '" + name +
"' to element '" + parentElement.Name + "' in package '" + parentPackage.Name + "' - author: '" + author + "'");
}
return newElement.ElementGUID;
}
示例10: deletePackage
/// <summary>
/// method deletes package
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="packageGUID">GUID of package that should be deleted</param>
public void deletePackage(EA.Repository Repository, string packageGUID)
{
EA.Package packageToDelete = (EA.Package)Repository.GetPackageByGuid(packageGUID);
string name = packageToDelete.Name;
EA.Package parentPackage = (EA.Package)Repository.GetPackageByID(packageToDelete.ParentID);
for (short i = 0; i < parentPackage.Packages.Count; i++)
{
EA.Package actualPackage = (EA.Package)parentPackage.Packages.GetAt(i);
if (actualPackage.PackageGUID == packageGUID)
{
parentPackage.Packages.DeleteAt(i, false);
break;
}
}
parentPackage.Packages.Refresh();
BPAddIn.synchronizationWindow.addToList("Deletion of package '" + name + "' from package '" + parentPackage.Name + "'");
}
示例11: changePackageNotes
/// <summary>
/// method changes notes of package
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="packageGUID">GUID of changed package</param>
/// <param name="notes">new notes of changed package</param>
public void changePackageNotes(EA.Repository Repository, string packageGUID, string notes)
{
EA.Package package = (EA.Package)Repository.GetPackageByGuid(packageGUID);
package.Notes = notes;
package.Update();
BPAddIn.synchronizationWindow.addToList("Change of notes of package '" + package.Name +
"' (Location of package: " + itemTypes.getLocationOfItem(Repository, package.ParentID, 0));
}
示例12: changePackageName
/// <summary>
/// method changes name of package
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="packageGUID">GUID of changed package</param>
/// <param name="name">new name of changed package</param>
/// <param name="oldName">previous name of changed package</param>
public void changePackageName(EA.Repository Repository, string packageGUID, string name, string oldName)
{
EA.Package package = (EA.Package)Repository.GetPackageByGuid(packageGUID);
package.Name = name;
package.Update();
BPAddIn.synchronizationWindow.addToList("Change of name of package '" + name + "' - previous name: '" + oldName +
"' (Location of package: " + itemTypes.getLocationOfItem(Repository, package.ParentID, 0));
}
示例13: changePackageAuthor
/// <summary>
/// method changes author of package
/// </summary>
/// <param name="Repository">EA repository</param>
/// <param name="packageGUID">GUID of changed package</param>
/// <param name="author">new author of changed package</param>
/// <param name="oldAuthor">previous author of changed package</param>
public void changePackageAuthor(EA.Repository Repository, string packageGUID, string author, string oldAuthor)
{
EA.Package package = (EA.Package)Repository.GetPackageByGuid(packageGUID);
EA.Element packageElement = (EA.Element)package.Element;
packageElement.Author = author;
package.Update();
BPAddIn.synchronizationWindow.addToList("Change of author of package '" + package.Name + "' - previous author: '" + oldAuthor +
"', current author: '" + author + "' (Location of package: " + itemTypes.getLocationOfItem(Repository, package.ParentID, 0));
}
示例14: FindAndReplaceItemPackage
/// <summary>
/// Create a package element. Be aware that a package element also contains an element to support
/// element specific things like tagged values.
/// </summary>
/// <param name="rep"></param>
/// <param name="GUID"></param>
public FindAndReplaceItemPackage(EA.Repository rep, string GUID) :base( rep, GUID)
{
this._el = rep.GetElementByGuid(GUID);
this._pkg = rep.GetPackageByGuid(GUID);
this.load(rep);
}