Archi Forum

Archi => Archi Development => Topic started by: saffko on April 22, 2016, 14:09:50 PM

Title: Simulate PaletteEntry event programmatically
Post by: saffko on April 22, 2016, 14:09:50 PM
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.
Title: Re: Simulate PaletteEntry event programmatically
Post by: Phil Beauvoir on April 22, 2016, 16:49:57 PM
Hi,

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

Phil
Title: Re: Simulate PaletteEntry event programmatically
Post by: saffko on April 22, 2016, 17:46:25 PM
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).
Title: Re: Simulate PaletteEntry event programmatically
Post by: Phil Beauvoir on April 23, 2016, 09:35:33 AM
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.
Title: Re: Simulate PaletteEntry event programmatically
Post by: saffko on April 25, 2016, 08:14:07 AM
Thank you Philip, this is exactly what I need :)

Have a nice day !

Saffet.