Perspective Editors only! [message #1387030] |
Mon, 23 June 2014 15:02 |
João Rebelo Messages: 28 Registered: December 2013 |
Junior Member |
|
|
Hi,
We have an Luna e4, in Legacy mode, where we are trying to only keep visible the Editors belonging to a Perspective.
In our case each Perspective knows exactly which Editors belongs to it, so that we can filter them out!
To do this, before we call "anActivePage.setPerspective(aPerspectiveDescriptor);" we'll get all editors, and if they belong to the editor list we'll set them to be rendered and to be visible, otherwise we'll negate these properties.
List<MPart> someOpenedEditors = aModelService.findElements(aWindow, "org.eclipse.e4.ui.compatibility.editor", MPart.class, new ArrayList<String>());
AbstractPerspective anAbstractPerspective = (AbstractPerspective) ((PerspectiveDescriptor) aPerspectiveDescriptor).createFactory();
for (MPart anEditorPart : someOpenedEditors) {
for (String aVisibleEditorId : anAbstractPerspective.getVisibleEditorIDs()) {
if (anEditorPart.getTags().contains(aVisibleEditorId)) {
anEditorPart.setToBeRendered(true);
anEditorPart.setVisible(true);
break;
}
anEditorPart.setToBeRendered(false);
anEditorPart.setVisible(false);
}
}
Although at first this seems to fix the issue, after some interactions (changing perspectives) the editors start showing all blank with the error:
"No editor descriptor for id org.eclipse.ui.internal.emptyEditorTab" which by a quick googling takes me to the bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=386648
Although reading the bug description I'm really connecting both operations..
Our first approach was to only use the visibility (instead of also using the toBeRendered) which led to the editors stop opening once we've changed perspectives, or when we close an openned one it would take one of the "invisible" ones.
Any suggestions on:
How to manipulate the Editors to have this behavior?
How to prevent the "emptyEditorTab" error so that this solution can work?
Thanks for the help,
João Rebelo
|
|
|
Powered by
FUDForum. Page generated in 0.02821 seconds