[RCP] Constraining views on perspectives [message #266278] |
Tue, 10 August 2004 11:23  |
Eclipse User |
|
|
|
Hello RCP programmers,
is it possible in a multiple perspective app to constrain the
visibility of selected views on selected perspectives?
In my RCP app I have two perspectives defined , which add their
corresponding views. Now there does exist a view (AView), which
should never be visible in one of those perspectives (BPerspective).
This was no problem until the point was reached, when I added to my
workbench advisor the "Show View" submenu (as shown in
WorkbenchActionBuilder):
private MenuManager createWindowMenu(IWorkbenchWindow window) {
MenuManager menu = new
MenuManager(Messages.getString("action.file.window"), //$NON-NLS-1$
IWorkbenchActionConstants.M_WINDOW);
showNavigatorAction = new ShowNavigatorAction();
menu.add(showNavigatorAction);
menu.add(ActionFactory.RESET_PERSPECTIVE.create(window));
MenuManager showViewMenuMgr = new
MenuManager(Messages.getString("action.window.showView.label "),
"showView"); //$NON-NLS-1$ //$NON-NLS-2$
IContributionItem showViewMenu =
ContributionItemFactory.VIEWS_SHORTLIST.create(window);
showViewMenuMgr.add(showViewMenu);
menu.add(showViewMenuMgr);
return menu;
}
Of course this "Show View" menu is visible in all perspectives (as it
should), but regrettably it is also now possible by the user to select
the forbidden AView in the BPerspective.
My question is: Is it possible to control
org.eclipse.ui.actions.ContributionItemFactory.VIEWS_SHORTLI ST
such that I get the wanted effect? I could of course write my own
ShowViewMenu class, but I assume there does exist a much less
brutal solution.
Thank you very much for your help,
Daniel Krügler
|
|
|
|
Re: [RCP] Constraining views on perspectives [message #266414 is a reply to message #266278] |
Wed, 11 August 2004 07:23   |
Eclipse User |
|
|
|
I don't think so. Eclipse doesn't support constraints on what views can
be shown in which perspective. You should enter an enhancement request.
Jean-Michel
Daniel Krügler wrote:
> Hello RCP programmers,
>
> is it possible in a multiple perspective app to constrain the
> visibility of selected views on selected perspectives?
>
> In my RCP app I have two perspectives defined , which add their
> corresponding views. Now there does exist a view (AView), which
> should never be visible in one of those perspectives (BPerspective).
>
> This was no problem until the point was reached, when I added to my
> workbench advisor the "Show View" submenu (as shown in
> WorkbenchActionBuilder):
>
> private MenuManager createWindowMenu(IWorkbenchWindow window) {
> MenuManager menu = new
> MenuManager(Messages.getString("action.file.window"), //$NON-NLS-1$
> IWorkbenchActionConstants.M_WINDOW);
> showNavigatorAction = new ShowNavigatorAction();
> menu.add(showNavigatorAction);
> menu.add(ActionFactory.RESET_PERSPECTIVE.create(window));
> MenuManager showViewMenuMgr = new
> MenuManager(Messages.getString("action.window.showView.label "),
> "showView"); //$NON-NLS-1$ //$NON-NLS-2$
> IContributionItem showViewMenu =
> ContributionItemFactory.VIEWS_SHORTLIST.create(window);
> showViewMenuMgr.add(showViewMenu);
> menu.add(showViewMenuMgr);
> return menu;
> }
>
> Of course this "Show View" menu is visible in all perspectives (as it
> should), but regrettably it is also now possible by the user to select
> the forbidden AView in the BPerspective.
>
> My question is: Is it possible to control
> org.eclipse.ui.actions.ContributionItemFactory.VIEWS_SHORTLI ST
> such that I get the wanted effect? I could of course write my own
> ShowViewMenu class, but I assume there does exist a much less
> brutal solution.
>
> Thank you very much for your help,
>
> Daniel Krügler
>
|
|
|
|
|
|
Re: [RCP] Constraining views on perspectives [message #267296 is a reply to message #267113] |
Tue, 17 August 2004 09:13  |
Eclipse User |
|
|
|
Hello Ilya,
Ilya Shinkarenko schrieb:
> Hello Daniel,
>
> seems that we are facing just the same problem. We came to idea to use
> our own switch perspectives action, which closes/opens all relevant
> views, and restrict views shortcutlist creating own views factory for
> each perspective.
>
> Also interesting may be the ext. point ui.workbench.activities, which
> allows to cut some certain contributions from the workbench (seems that
> it is what you need when you wanna implement user roles and so), but I
> had no time to investigate it :-(
>
> It's very interesting, which pattern would you use for implementing user
> roles in RCP.
I assume, you mean org.eclipse.ui.activities here? My first step was in
the direction of org.eclipse.ui.perspectiveExtensions until I realized
that it only helps in **extending** the visiblities, not in
**constraining** them (I should have reflected about its name ;-))
I will study the implications and effects of org.eclipse.ui.activities
and provide a more detailed answer if that ext. point proves to be
useful.
Generally I would realize activities/roles similar to actions, which are
a quite related issue, I think.
Thanks for your ideas,
Daniel
|
|
|
Powered by
FUDForum. Page generated in 0.12493 seconds