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.


Topics - Dave_Bullet

Pages: 1 ... 3 4 [5]
61
Hi,

I'm using the EA_OnPreNewElement() event to:
1. Capture the name of the new element the user wants to add
2. See if the same element already exists in the repository
3. Warn the user if it already exists, and whether the user really wants to create a "duplicate".

The logic works fine, however if the user wants to duplicate the element, I want to be able to default the name of the element in the new element dialog (the first modal window EA pops up where you set the name, stereotype, notes etc...) to the one the user searched.

The dialog appears between the Pre and Post events.  I can't see any way of returning a "modified" element on the Pre event for EA to use (IMHO - I would have EA pass in an empty element in the Pre event that you could modify and return for it to use in the rest of the processing).

any ideas? (apart from a hack to grab the active window and send it the text to display)?

Thanks,
David.

62
Here's what I want to do.

To improve model integrity, I want to prevent a user from adding an element to a diagram that doesn't belong to the default toolbox for the diagram.

I know how to inspect / check the type of element being added in the the SDK, but not about the toolbox linked to the diagram to check membership of the to be newly created element or connector.

Is there any support for:
1. Identifying the toolbox selected for the diagram
2. Identifying which toolbox belongs to the diagram
3. Checking the defined stereotypes (elements and connectors) of the toolbox that belongs to the diagram

The above 3 functions will allow me to compare the stereotype of the new element / connector with those defined on the default toolbox for the diagram - thereby allowing / disallowing the element create.

Thanks,
David.

63
Maybe I'm missing something really basic in the help...

I can add a "Date retired" attribute to my stereotype in my UML profile of type "date".  How do I enforce users to only enter a date (ie. dd/mm/yyyy) in the tagged value window when creating a new element based on my stereotype (from my UML profile?)

Thanks,
DAvid.

64
Hi there,

Can Repository.GetElementsByQuery() run custom (ie. SQL) searches?

If not - can this facility be added?  It would be quite useful to utilise custom searches already defined in the EA interface (especially SQL ones).  The other option is have both the add-in and the custom search call the same stored procedure

David.

65
I know Repository.GetElementsByQuery returns an EA.Collection - but what types of objects are returned and how can I access their properties?

I'm pretty rusty at programming and learning C#.  I can't for the life of me figure out how to inspect the returned collection to find the underlying object types returned.

The collection contains a count of 5 after the method call and objecttype = otCollection.  What I want to know is what type of objects are contained in the collection so I can cast and use them appropriately.

Thanks,
David.

66
I'm trying to write an add-in to detect when a user creates a duplicate element (ie. same stereotype / type and name).

There are 2 ways a user can create an element - drag/drop from the toolbox onto a diagram or adding to a package via the project browser.

I can use the EA_OnPreNewElement event from the project browser as that fires after the prompt for the new element name.  I can check for a duplicate, prompt the user and cancel and the element is not created.

Problem is when an element is created via the toolbox - drag & drop to a diagram.  In this case, the "Pre" event is created before the element is created - but this is no use as it uses EA default element name.  The "Post" even then fires, and then the dialog is displayed to the user to get the element name.  No further events fire.

I need to be able to either prevent the creation of a duplicate element via the toolbox - or do a retrospective delete on the duplicate.  Problem is - no further events fire that I can capture / use (short of a workaround like posting an asynchronous call or monitoring windows level messages...)

Any ideas?  Or could this be a feature request to Sparx to implement the event calling order consistently between the two ways of adding the element (especially the post event - which happens in one case (projetc browser) after the dialog to edit element details, and in the other case before)(toolbox drag / drop).

Thanks,
David.

Pages: 1 ... 3 4 [5]