Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Parameter / Argument to Part Descriptor(Pass an argument from handler / command to Pat Descriptor)
Parameter / Argument to Part Descriptor [message #1703877] Wed, 05 August 2015 14:35
Dominic Hilsbos is currently offline Dominic HilsbosFriend
Messages: 9
Registered: May 2012
Junior Member
I am building an e4 RCP application, and have run into a puzzling situation.

I have data which is hierarchical, which is being displayed in a TreeView.

The domain objects look something like this:
public class HierarchyObject {
   private HierarchyObject parent;
   private List<HierarchyObject> children;

I have a popup (context) menu defined on the TreeView with 2 options: Create Child and Display.

Both situations lead to display / editing of an instance of the hierarchical domain object. I'm using the ESelectionService to move the selected object instance the part's creating object. The editor is defined as a Part Descriptor in the Application.xmi file, which references a POJO with a method annotated with @PostConstruct.

The editor then looks something like this:
public class HierarchicalObjectEditor {
   private HierarchicalObject domain;
   public void postConstruct() {
      HierarchicalObject selected = selectionService.getSelected(...);

      // This is where I have an issue
      if (create new) {
          domain = new HierarchicalObject();
         domain.parent = selected;
      } else {
         domain = selected;

I'd like to be able to use the same editor for both situations, but I can't figure out how to pass the information to the editor object.

I'm using a Command Parameter to pass which menu item was used to the menu handler, but since the menu's handler calls EPartService.showPart(...), the handler doesn't have access to the underlying object. The value passed (a boolean would suffice) does not need to survive the creation of the part.

I'm hoping there's a simple way to accomplish this. I've tried Googling, but I can't seem to frame the problem such that Google returns anything useful. I've also tried looking through Lars Vogel's RCP book, and his tutorials, also with no success.

If you can point me in the right direction (is there a StateService?), I can probably find the details myself.

Thank you for taking the time to read my question.

Dominic Hilsbos
Previous Topic:e4 equivalent for Perspective.saveState(IMemento memento)
Next Topic:Eclipse 4 and p2
Goto Forum:

Current Time: Sat Oct 20 12:56:24 GMT 2018

Powered by FUDForum. Page generated in 0.21466 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top