Background of upcoming code:
Adding Views outside a Folder, because in this case the view title is not shown, see
Bug 5684 - [RCP] [ViewMgmt] Ability to show/hide view title programmatically
To Reproduce
With older versions of Eclipse 4.X the maximize/Minimize did work.
Within Eclipse 3.X (and Version before 4.25) I was able to add views like
public class MyPerspectiveLayout implements ICustomPerspectiveLayout {
@Override
public void createLayout(IPageLayout pLayout) {
...
String editorArea = pLayout.getEditorArea();
pLayout.setEditorAreaVisible(false);
pLayout.addStandaloneView(SCREENMANAGER_VIEW_ID, false, IPageLayout.TOP, 0.5f, editorArea);
// Set the screen manager view to not closable.
IViewLayout screenView = pLayout.getViewLayout(SCREENMANAGER_VIEW_ID);
screenView.setCloseable(false);
screenView.setMoveable(false);
//Show System Navigation View as a stand alone view and not a fast view
pLayout.addStandaloneViewPlaceholder(SYSTEMNAVIGATION_VIEW_ID, IPageLayout.BOTTOM, 0.95f, editorArea, false);
// Set the navigation view to not closable.
IViewLayout navigationView = pLayout.getViewLayout(SYSTEMNAVIGATION_VIEW_ID);
navigationView.setCloseable(false);
navigationView.setMoveable(false);
}
...
}
For MAXIMIZE/MINIMIZE I used the following command whcih is marked as DEPRECATED today.
IViewReference tViewReference = activePage.findViewReference(pViewName);
IViewPart part = null;
if (tViewReference != null) {
// [20131029] lm #46981
// Do create a new view if the view is not present
part = tViewReference.getView(true);
} else {
try {
part = activePage.showView(pViewName);
} catch (PartInitException e) {
LOGGER.error("Not able to show view: " + pViewName, e); //$NON-NLS-1$
}
}
if (part == null) {
return;
}
if (!forceMaximize) {
if (tViewReference != null && IWorkbenchPage.STATE_MAXIMIZED == part.getSite().getPage().getPartState(tViewReference)) {
return;
}
}
pWindow.getActivePage().activate(part);
ActionFactory.IWorkbenchAction maximizeAction = ActionFactory.MAXIMIZE.create(pWindow);
if (maximizeAction.isEnabled()) {
maximizeAction.run();
}
Expected behavior
Problem:
The "placeholder" is an instance of PlaceholderImpl and "parent" will be of instance "PartSashContainerImpl".
Because of this the instanceof command will fail
case EModelService.OUTSIDE_PERSPECTIVE:
MUIElement parent = placeholder == null ? model.getParent() : placeholder.getParent();
if (parent instanceof MPartStack) {
element = parent;
}
break;
Background of upcoming code: Adding Views outside a Folder, because in this case the view title is not shown, see Bug 5684 - [RCP] [ViewMgmt] Ability to show/hide view title programmatically
To Reproduce With older versions of Eclipse 4.X the maximize/Minimize did work.
Within Eclipse 3.X (and Version before 4.25) I was able to add views like
For MAXIMIZE/MINIMIZE I used the following command whcih is marked as DEPRECATED today.
Expected behavior Problem:
The "placeholder" is an instance of PlaceholderImpl and "parent" will be of instance "PartSashContainerImpl". Because of this the instanceof command will fail
When i add the view like
The MAXIMIZE/MINIMIZE is working BUT now I do see the View title in the UI
Screenshots When using my original code
it currently looks like![image](https://user-images.githubusercontent.com/40763331/228444263-c1e89946-0587-404b-82d3-7f6e2fa30124.png)
When creating the folder and adding the views into it it looks like![image](https://user-images.githubusercontent.com/40763331/228444288-f6625510-1ff7-4342-bd48-555f6109d7d0.png)
Environment: I do use Version: 2022-09 (4.25.0) as Target Platform on Windows 10