Author Topic: Simulate PaletteEntry event programmatically  (Read 2294 times)

saffko

  • Member
  • **
  • Posts: 10
Simulate PaletteEntry event programmatically
« 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.

Phil Beauvoir

  • Archi Guy
  • Hero Member
  • *****
  • Posts: 1514
  • Archi Guy
    • Archi
Re: Simulate PaletteEntry event programmatically
« Reply #1 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
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

saffko

  • Member
  • **
  • Posts: 10
Re: Simulate PaletteEntry event programmatically
« Reply #2 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).

Phil Beauvoir

  • Archi Guy
  • Hero Member
  • *****
  • Posts: 1514
  • Archi Guy
    • Archi
Re: Simulate PaletteEntry event programmatically
« Reply #3 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.
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

saffko

  • Member
  • **
  • Posts: 10
Re: Simulate PaletteEntry event programmatically
« Reply #4 on: April 25, 2016, 08:14:07 AM »
Thank you Philip, this is exactly what I need :)

Have a nice day !

Saffet.