Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Geert Bellekens

Pages: 1 ... 478 479 [480] 481 482 ... 548
7186
Yes, common issue.
GetByName is an operation defined on the generic EA.Collection class, but it is only supported on some actual collections. I think there's a list of supported types somewhere in the documentation.
That is one of the reasons I've never used it. Whenever I need something like that I'll write it myself.

Geert

7187
Isn't that because of the difference between VBA and VBScript?
IIRC VBA is strong typed while VBScript is not.
If that is the case it makes sense doesn't it?

Geert

7188
An EA.DiagramObject is not an EA.Element.
In order to get the EA.Element from the EA.DiagramObject you need to use Repository.GetElementByID (long ElementID)

Geert

7189
 ;D

7190
(meta) attributes on stereotypes will result in tagged values in on the actual elements.

Geert

7191
You can't

Geert

PS. If you search for "Sharepoint" using the top left search button you should find a whole lot of explanations on this subject.

7192
Automation Interface, Add-Ins and Tools / Re: Export diagram to image
« on: February 06, 2012, 06:13:51 pm »
This is how I use it to get an Image property from my Diagram wrapper class:
Code: [Select]
public Image image
{
      get
      {
            EA.Project projectInterface = this.model.getWrappedModel().GetProjectInterface();
            string diagramGUID = projectInterface.GUIDtoXML(this.wrappedDiagram.DiagramGUID);
            string filename = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".png";
            //save diagram image to file (format ".png")
            projectInterface.PutDiagramImageToFile(diagramGUID, filename, 1);
            //load the contents of the file into a memorystream
            MemoryStream imageStream = new MemoryStream(File.ReadAllBytes(filename));
            //then create the image from the memorystream.
            //this allows us to delete the temporary file right after loading it.
            //When using Image.FromFile the file would have been locked for the lifetime of the Image
            Image diagramImage = Image.FromStream(imageStream);
            //delete the temorary file
            System.IO.File.Delete(filename);

            return diagramImage;
      }
}

Geert

7193
Would be a nice addition.
Do you register the feature request?

Geert

7194
Ian,

This code snippet is where we read the user defined searches and create our own EAModelSearch objects:
Code: [Select]
/// <summary>
        /// reads name, customsearch and sql statement from XML document, created by EA
        /// </summary>
        public List<UMLModelSearch> ModelSearches
        {
            get
            {
                string appData = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                string path = Path.Combine(appData, @"Sparx Systems\EA\Search Data");
                string filename = System.IO.Path.Combine(path, "EA_Search.xml");
                List<UMLModelSearch> searchQuery = new List<UMLModelSearch>();

                
                using (XmlTextReader reader = new XmlTextReader(filename))
                {
                    EAModelSearch modelSearch = null;
                    while (reader.Read())
                    {
                        string elementName = reader.Name;
                        if (elementName == "Search")
                        {
                            
                            
                            //name given to the query and used by the EA user to select the query to execute
                            modelSearch = new EAModelSearch(reader.GetAttribute("Name"), "", UML.UMLSearchType.UserDefined);
                            if (string.IsNullOrEmpty(modelSearch.Name))
                                continue;
                            //customSearch defines if statement is built-in(0)
                            //or customMade(1) by the EA user
                            
                            
                        }
                        else if (elementName == "RootTable")
                        {
                            if (modelSearch == null)
                                continue;
                            //filter contains SQL statement from xml document
                            modelSearch.Filter = reader.GetAttribute("Filter");
                            searchQuery.Add(modelSearch);
                            modelSearch = null;
                        }
                    }
                }
                searchQuery.AddRange(modelSearchTranslation);
                return searchQuery;
            }
        }

Geert

7195
Automation Interface, Add-Ins and Tools / Re: Deleting stereotypes
« on: February 03, 2012, 05:15:14 pm »
Depends on whether you want to delete the stereotype definitions, or the stereotypes on an element.

Geert

7196
Yes, you have to remember that in the API a package is both an EA.Package and an EA.Element, and both objects have their own different PackageID/ElementID

Geert

7197
Quote
and how can i create new packages in model? thanks a lot :)
Use Package.Packages.AddNew()

Geert

7198
q.

Its not really an option (as in Tools|Options) but a context dependent action (right click on package).
It might potentially cause havoc, but it's not as bad as you thought.

Geert

7199
Use Element.TreePos and make sure you allow free sorting in the General Options.

Geert

7200
Daniel,

If you found solutions using the database then that probably means there are no alternatives.
This is often the case when programming against the EA API. Cheating sort of becomes the standard :/

Geert

Pages: 1 ... 478 479 [480] 481 482 ... 548