Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » [RCP] Constraining views on perspectives
[RCP] Constraining views on perspectives [message #266278] Tue, 10 August 2004 11:23 Go to next message
Eclipse UserFriend
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 #266388 is a reply to message #266278] Wed, 11 August 2004 03:17 Go to previous messageGo to next message
Eclipse UserFriend
Daniel Krügler schrieb:

> is it possible in a multiple perspective app to constrain the
> visibility of selected views on selected perspectives?

I don't know an answer to your question, but I want to ask: Why? As a
user of your plugin I would really dislike this kind of restriction. I
assume that you want to solve a problem with this "hack" that could also
be solved with some other solution.

Ciao, Michael.
Re: [RCP] Constraining views on perspectives [message #266414 is a reply to message #266278] Wed, 11 August 2004 07:23 Go to previous messageGo to next message
Eclipse UserFriend
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 #267034 is a reply to message #266414] Mon, 16 August 2004 08:31 Go to previous messageGo to next message
Eclipse UserFriend
Hello Jean-Michel Lemieux,

Jean-Michel Lemieux schrieb:
> 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
>

thank you for that idea, I will follow your advice.

Greetings from Bremen,

Daniel Krügler
Re: [RCP] Constraining views on perspectives [message #267036 is a reply to message #266388] Mon, 16 August 2004 08:34 Go to previous messageGo to next message
Eclipse UserFriend
Hello Michael Keppler,

Michael Keppler schrieb:
> Daniel Krügler schrieb:
>
>> is it possible in a multiple perspective app to constrain the
>> visibility of selected views on selected perspectives?
>
>
> I don't know an answer to your question, but I want to ask: Why? As a
> user of your plugin I would really dislike this kind of restriction. I
> assume that you want to solve a problem with this "hack" that could also
> be solved with some other solution.
>

Sorry for the late reply - I was on vacations.

I think there do exist situations where a given view does not make sense
to be available for every perspective. As an example consider an RCP
with two perspectives, lets name them AdminPerspective and
NormalUserPerspective. Each perspective is selected programmatically
through a login dialog. A simple logic would present the
AdminPerspective after an administrator login or the
NormalUserPerspective for others.

Now both perspectives are rather different in some aspects and I don't
want to allow a NormalUserPerspective to select my special AdminOnlyView
which makes only sense in admin mode (security reasons aside). I can
imagine that there do exist other scenarios related or similar to that
presented one.

Accepting the current state I will have to write my own constraining
VIEWS_SHORTLIST factory, although I think that my request would be
useful for others, too.


Greetings from Bremen,

Daniel Krügler
Re: [RCP] Constraining views on perspectives [message #267113 is a reply to message #266278] Mon, 16 August 2004 12:34 Go to previous messageGo to next message
Eclipse UserFriend
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.

Grüßle from Stuttgart,
Ilya
Re: [RCP] Constraining views on perspectives [message #267296 is a reply to message #267113] Tue, 17 August 2004 09:13 Go to previous message
Eclipse UserFriend
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
Previous Topic:New Wizard
Next Topic:How to develop new types of resources
Goto Forum:
  


Current Time: Fri Jul 18 02:08:17 EDT 2025

Powered by FUDForum. Page generated in 0.12493 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top