Simulate PaletteEntry event programmatically

Started by saffko, April 22, 2016, 14:09:50 PM

Previous topic - Next topic

saffko

Hi Philip,

I'm trying to add a Palette entry without clicking and do not find how to proceed.
So, what I want to do is to fire an event that simulates a click on a palette entry (like a click on "Business Object" palette entry).
Event will be fired from a button in a ViewPart.

Best regards.

Phil Beauvoir

Hi,

Why do you want to do this? What is your actual goal? Are you sure this is the correct approach?

Phil
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

saffko

I have a view with non editable archimate objects. This view is more or less like a specification view.
So I have an archimate model, which is not editable by the user.
The goal is to use this model as palette.

That's why I want to simulate the same behaviour as the GraphicalEditor' palette.
So what I want to do is: when user right-clicks on an archimate object in my "read-only archimate model", he can chose to add this object to the opened view ("opened view"= active editor).

Phil Beauvoir

It seems then that the real requirement is - given a model object add it to a given View at given co-ordinates. Assuming you have the model object, then I think this will be similar to when you drag and drop an object from the tree to a View. Take a look at that portion of code in com.archimatetool.editor.diagram.policies.ArchimateDNDEditPolicy class as a start.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

saffko

Thank you Philip, this is exactly what I need :)

Have a nice day !

Saffet.