| Summary: | [ViewMgmt] [RCP] can't position or move programmatically a view in a specific place of a perspective | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | guillaume DUC <guillaumeduc> |
| Component: | UI | Assignee: | Platform-UI-Inbox <Platform-UI-Inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | bokowski, Serge_Yuschenko |
| Version: | 3.0 | Keywords: | api, helpwanted |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
*** Bug 55837 has been marked as a duplicate of this bug. *** That is intentional. We try to maintain a separation between function and presentation. So if you have some action or other code that shows a view, it should not care about details of the current perspective. The view may appear in multiple perspectives, so we don't want callers to depend on layout aspects like the folder id. Can you explain what you're trying to do at a higher level? There may be other alternatives. thank you for your answer. I develop an RCP application which open some
information pages (superposed views). But I want the user to have the
possibility to compare 2 differents views. Well i want to move a view next to
the others in order to compare then.
My views are dynamic. I have one view in plugin.xml and several instances of
this view (V3M7 -> showView("view Id","secondary Id",int mode) )
The problem is that i can't do 2 perspectives because i don't know all the
views at the beginning because they are dynamic.
If i create 2 perspectives, i must know at the beginning what is the separate
view but it depends on the choice of the user.
The solution is to create a second view for the separate one and to show or
hide it. but when the user want to compare a view this others, i must hide the
view selected by the user and provide the screen to the separate view and show
it. It is not very practical
Another problem is :
- if the separate view is hidden, the user open new dynamic views and they
are superposed to the others.
- now if the separate view is shown, the new views are superposed to the
separate view and not to the other dynamic views.
Sorry for my english, thank you
I see the problem. It seems like, since your dynamic views can be opened in arbitrary perspectives, you wouldn't want to depend on particular folder ids either. If we had some way of saying: open view A below view B, that might help. Something like IPageLayout.addView(String viewId, int relationship, int ratio, String refId) but on IWorkbenchPage (and with support for multi view instances). exactly,
Perhaps a good function would be :
---------------------------------------- for a view
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.addView(String viewId,
int relationship,
int ratio,
String refId);
---------------------------------------- for an instance of a view
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.addView(String viewId,
String SecondaryId,
int relationship,
int ratio,
String refId);
(in order to create an instance of a view and position it correctly in the
perspective.)
----------------------------------------
Perhaps another practical function would be :
---------------------------------------- for a view
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.moveView(String viewId,
int relationship,
int ratio,
String refId);
---------------------------------------- for an instance of a view
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.moveView(String viewId,
String SecondaryId,
int relationship,
int ratio,
String refId);
(in case the view or the instance is already in the perspective, consequently
the view is moved to the good place)
Thank you.
Will consider this for M9. See also the discussion of placeholders in bug 56431. Sorry, while I think this is a good idea, this will not make it into 3.0. Marking for consideration post 3.0. I am wondering why this idea did not go any further? Nobody needs these methods anymore or beacause of some technical limitations in current architecture? I'd like to explain my reason of having this interface. Maybe it'll help to move from this point. My application consists of a number of views. The views can be moved, resized, closed, opened, and duplicated by user. Let us say at some point the apllication has 6 opened views arranged like this: |---------------------------------------| | | | | | 3, 4 | | | | | | | | 1, 2 |--------------------------| | | | | | 5, 6 | | | | | | | |---------------------------------------| Some views may have same primary ID, some diferent, but all of them have "Duplicate" action. When user duplicates view 1, it means he wants to see view 7 over or under view 1 (in the same folder) with the exactly the same content as view 1. In order to copy view contents the showView() arguments perhaps should be extended with IMemento. Maybe it is even better idea to create every new view as detached and let user dock it at ones discretion. This is still a reasonable request, but it was not looked into for 3.1 or 3.2 due to other priorities. If you want to explore these ideas, the logic to layout a new view is done in PerspectiveHelper.addPart(LayoutPart). To see how you end up here, set a breakpoint in WorkbenchPage.busyShowView, then go into where it calls persp.showView. Also, you can get the workbench to show all views as detached (on platforms that support it) by specifying the following in your plugin_customization.ini file: org.eclipse.ui.workbench/OPEN_VIEW_MODE=2 For more details about plugin_customization.ini, see: http://wiki.eclipse.org/index.php/RCP_FAQ#customPrefs As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you. |
on Eclipse RCP, you must create a perspective with views and positions of theses views. But there is no API to move dynamically, programmatically a view in the perspective at another place. in the perspective , we have : -------------------------------- IFolderLayout bottomRight = layout.createFolder("folderID",IPageLayout.LEFT ,0.5f ,layout.getEditorArea()); bottomRight.addView("viewId"); -------------------------------- After that, we have the possibility to show or hide a view but not to specify the position of this view in the perspective. -------------------------------- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView("viewId"); -------------------------------- Is it possible to have new functions to dynamically move and position views in perspective : for example : -------------------------------- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView("viewId" ,"folderId); PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .moveView("viewId" ,"folderId);