| Summary: | Support placeholders with wildcards | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Uwe Kubosch <uwe> |
| Component: | UI | Assignee: | Platform-UI-Inbox <Platform-UI-Inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | emoffatt, kuebler, uwe |
| Version: | 4.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
Uwe, it's already on our list...;-). *** This bug has been marked as a duplicate of bug 383309 *** Excellent! Thank you! I can't see that this has been fixed, yet. http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.ui.workbench/Eclipse%20UI/org/eclipse/ui/internal/e4/compatibility/ModeledPlaceholderFolderLayout.java Supported is now to add multiple instances of the same view. However it is not supported to specify wildcards for placeholders and expect views to populate to this category once there are instanciated. Jens, I'm not sure what you're asking for. The only pattern I know of is that you can add a placeholder of the format '<viewId>:*' to a stack and that will be used to determine where new instances of 'viewId' views as they're created. What am I missing ? Yes, that is the pattern I'm speaking of. Given the code below I wonder how to add a placeholder with wildcards as the code explicitly states that this is unsupported.
public void addPlaceholder(String viewId) {
boolean containsWildcards = viewId.indexOf('?') != -1;
if (containsWildcards) {
E4Util.unsupported("IPageLayout.addPlacehoder(): wildcard in view id: " + viewId); //$NON-NLS-1$
return;
}
...
That code is looking for '?', not ':'...I'm not even sure where '?' comes into the multi-instance view story...am I missing something?
If you call 'addPlaceholder("MyViewId:*") then the result will be that wherever this placeholder is will be where new instances of "MyViewId" will appear.
|
Given this example using Eclipse RCP 4.2: public class Perspective implements IPerspectiveFactory { @Override public void createInitialLayout(IPageLayout layout) { layout.setEditorAreaVisible(false); IFolderLayout left = layout.createFolder( "left", IPageLayout.LEFT, 0.75f, IPageLayout.ID_EDITOR_AREA); left.addPlaceholder(OrdersView.ID + ":*"); IFolderLayout bottomRight = layout.createFolder( "bottom right", IPageLayout.RIGHT, 0.5f, IPageLayout.ID_EDITOR_AREA); bottomRight.addView(OperatorsView.ID); bottomRight.addView(ShiftsView.ID); layout.addView(VehiclesView.ID, IPageLayout.TOP, 0.5f, "bottom right"); final IWorkbenchWindow window = Activator.getDefault().getWorkbench() .getActiveWorkbenchWindow(); window.getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { window.getActivePage().showView(OrdersView.ID, "42", IWorkbenchPage.VIEW_ACTIVATE); } catch (PartInitException e) { e.printStackTrace(); } } }); } } I would expect OrdersView to open in the "left" folder. It is however opened in the "bottom right" folder. Looking in the code for org.eclipse.ui.internal.e4.compatibility.ModeledPlaceholderFolderLayout.addPlaceholder, I see a check for wildcard usage, and a message: E4Util.unsupported("IPageLayout.addPlacehoder(): wildcard in view id: " + viewId); The result is a NOOP. Could you implement placeholders with wildcards, or explain how to do it with Eclipse RCP 4.2 ? Thank you for your efforts.