Eclipse RCP - Open a View in the Editor Area (3.8/e4 hybrid)
Asked Answered
C

1

105

I'm working on a 3.8-e4 hybrid (i.e we have the Luna dependencies, but we do not use the Application.e4xmi, yet). So we're basically running the compact layer.

With that being said, it would be nice to find an e4 programmatic way to stack these nasty views onto the editor folder.


1.) Problem

I want to place a generic view folder in the editor area, so that each view which is opened at runtime will be opened there.

View in editor folder

(pic stolen from this question)


2.1) Possible fix no.1: Using plugin.xml

Create a perspective extension, and add each possible view to that extension, with relationship stack over relative org.eclipse.ui.editorss. This is a bit inconvenient if you have too many views awating to be opened, and if the project scales quickly. I also noticed that wildcard view IDs do not work here.

SS of the plugin.xml with perspective extensions

If you find yourself the time to add each possible view to the perspective extension, that would work. Although, IF you open a view which is not added here (ie: opens in a different folder), then each subsequent opened view will be opened in the previous folder, and NOT in the editor area (inquire further explanation if you don't get it).


2.2) Possible fix no.2: Using code in the perspective factory

In the IPerspectiveFactory, we do have access to the IPageLayout, which happens to be org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout (e4 stuff).

Now, this ModeledPageLayout implementation is reasonable, but also no documentation and weird public APIs. This one gives the possibility to stack a view over any other relative

modeledPageLayout.stackView("newView0", IPageLayout.ID_EDITOR_AREA);

This would be the programmatic version of 2.1. Also, the same problem appears here. If a view is opened somewhere else, the code above becomes useless.

Interesting enough, the stackView API does not support wildcards (while others such as addView do).


2.3) Possible fix no.3: Workarounds yaaay!

I have a lot of perspectives, and a lot of different folders in each one. Everything is precisely placed.

Since Eclipse offers the APIs to get all the view IDs from everywhere around the system, I want to do the following, per perspective: each view ID which wasn't added to a specific folder will be appended to the editor area (ie editor folder, editor stack).

This would be my last resort, unless someone offers a more convenient and timesaving solution.

Remember, an e4 programmatic alternative is more flexible!


3.) Related questions

These would be rendered deprecated for the e4 release.


4.) Related Bug on Eclipse's Bugzilla:

This recent bug opened by myself has an attachment with a small SSCCE. The steps to reproduce this are described in this comment, so I'm not going to copy-paste them here.

Cloudburst answered 6/11, 2014 at 10:14 Comment(4)
I think it is very unlikely that this can be done when the 3.x compatibility code is included. You might be able to place a view in the editor area using the e4 APIs but I would expect that to confuse the compatibility code.Autosuggestion
If you don't use any editors, then simply minimize the shared area and design the layout as you want it.Congratulant
move forward to a more recent version where this works out of the box.Congratulant
@Congratulant I do use editors, and I can't move the whole thing to e4 at once. Enterprise software. :-)Cloudburst
H
1

I suggest you go with Possible fix no.3, since i think there isn't a faster method to do this.

Hemipterous answered 8/1, 2016 at 11:57 Comment(1)
any suggestion with pripr answer could be wriiten as a comment instead of a new answer.Tracheo

© 2022 - 2024 — McMap. All rights reserved.