Search code examples
eclipseeclipse-rcprcpe4

E4 opening a shared view


How can I programmatically open a shared part(placeholder) in perspective 1, if the part is already active in perspective 2 ? I want it to be the exact part, not creating a new one with the same state. Just like I would do if I'd go to Window-Show View. Is there any way to simulate the menu behaviour ?


Solution

  • I believe what you are asking for is something like:

    final MPlaceholder placeholder = partService.createSharedPart(The Part Id);
    final MPart part = (MPart) placeholder.getRef();
    partService.showPart(part, PartState.ACTIVATE);
    

    This assumes you have a placeholder in both perspectives and a part defined in the shared elements.