0

I am calculating a value in one handler and I need to pass that value to the other handler. In other words, I have created two menu items in which one menu item(XYZ) calculate values when it is clicked and I need to pass those values so that when the other menu item(ABC) get those values and when "ABC" menu item is clicked the value should be displayed in a message dialog box.

Can anyone please suggest me how to do this eclipse rcp e4??

Acjb
  • 505
  • 1
  • 6
  • 21
  • There are many ways to store this. What does the data belong to? Is it a particular MPart or some data model that you have or something else? – greg-449 Mar 07 '14 at 13:21
  • The data is a set of string values that is stored in a Hashmap. Did I answer your question correctly? I couldnt understand what u meant by "data belong to". Sorry. – Acjb Mar 07 '14 at 13:25
  • Can you please suggest me how to show detached view part when clicking on the menuitem? I can pass the value to the view part using `MPart part = partService.findPart("part id ");` and set the value from the handler. @greg-449 – Acjb Mar 07 '14 at 13:42

1 Answers1

0

There are many ways to do this.

If the menus are both on the same MPart you could use MPart.getTransientData() which returns a Map where you can store temporary data. Or you could use MPart.getObject() and store the data in your part object.

If this data needs to be available between parts you could define a class containing the data and store it in the application IEclipseContext so that it can be injected where it is required. You can put the data in the context in a life cycle class or by using an AddOn or by using a ContextFunction.

greg-449
  • 109,219
  • 232
  • 102
  • 145