Bug 88816 - [RCP] Support different window advisors for different windows
Summary: [RCP] Support different window advisors for different windows
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, helpwanted
Depends on:
Blocks:
 
Reported: 2005-03-22 17:01 EST by Nick Edgar CLA
Modified: 2019-09-06 16:11 EDT (History)
12 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2005-03-22 17:01:36 EST
build I20050315

From bug 83658 comment 17:
An unfortunate side-effect of this split is that it is technically hard to have
more than one type of WorkbenchWindowAdvisor - but the APIs make this seem
possible. The WorkbenchAdvisor needs information about which type of
WindowAdvisor to create and currently it doesn't have access to either the page
input or perspective id when createWorkbenchWindowAdvisor() is called.

From bug 83658 comment 18:
> it doesn't have access to either the page input or perspective id when
createWorkbenchWindowAdvisor() is called

I'm aware of this limitation, and am planning on making this info available,
either to the create method directly, or via get methods on the
IWorkbenchWindowConfigurer.  Any preference?

From bug 83658 comment 19:
Advantage of method parameters are that they are explicit but the advisor will
have to cache them if they are needed later. If they are available via the
configurer they are automatically cached. I don't have a strong preference.

From bug 83658 comment 20:
> it doesn't have access to either the page input or perspective id when
createWorkbenchWindowAdvisor() is called

It turns out this is harder to handle than I thought.  The page input and
perspective ID are available and can be passed when the window is first opened,
however when a window is restored from a previous session, this info is not
available before the window is created (and is no longer considered an argument
to the window creation).

I'm going to have to leave this for 3.2.
Comment 1 Dejan Glozic CLA 2005-10-07 12:55:45 EDT
+1 from me.

It looks like we need something like this:

1) The ability to declare a specific 'workbench window type'
2) The ability to declare a workbench window advisor for the type
3) The ability to pass the window type to IWorkbench.openWindow() methods.
4) The ability to hide the perspective from 'Open Perspective' window

1) and 2) can be handled through an extension point (or by adding additional 
elements to an existing extension point). The assumption is that the 
functionality is required by a plug-in that has no control over the workbench 
advisor.

3) We can add additional method to IWorkbench:

openWorkbenchWindow(String windowTypeId, String perspectiveId,
			IAdaptable input) throws WorkbenchException;

This should be possible because IWorkbench is not intended to be implemented 
by the clients, so adding a method would not be a breaking change. The window 
type id argument would be used to locate the matching window advisor and use 
it instead of the default one.

4) This can be done by simply adding a boolean attribute 'hideFromMenuBar' to 
the perspective element of org.eclipse.ui.perspectives extension point. The 
default value would be 'false'. If set to true, the perspective would not show 
up in the perspective chooser, but could still be created programmatically.

The 1)-4) would allow UA component to create UA-related windows that can have 
the benefit of part management, tool bar and menu bar management but would 
otherwise be specialized (not general-purpose).
Comment 2 Nick Edgar CLA 2005-10-14 15:56:10 EDT
We'll also need special handling for always-visible action sets such as the
Software Updates and Cheat Sheets ones.  These should probably only appear in
windows with the "default" window type (i.e. we don't want these showing up in
the Help window).  We may also want to allow action set <-> window type
associations.  Alternatively, allow a window type to promote a context, and have
context <-> action set associations.

Another approach to this whole thing, rather than introducing a new concept like
window type, is to allow multiple Workbench instances, each with different
advisors.  We would need to share as much representation as possible (i.e. the
various registries).  Unfortunately, there's lots of code that assumes the
Workbench is a singleton (API too: see PlatformUI.getWorkbench()).
Comment 3 Dejan Glozic CLA 2005-10-14 16:16:55 EDT
(In reply to comment #2)
> Another approach to this whole thing, rather than introducing a new concept 
like
> window type, is to allow multiple Workbench instances, each with different
> advisors.

As always, my proposals for UI changes aim at as little refactoring as 
possible :-). Your alternative scares me because it represents a fundamental 
shift in the design, and I am not sure it is worth it for what we want to 
achieve.
Comment 4 Dejan Glozic CLA 2005-10-14 16:21:54 EDT
(In reply to comment #2)
> We'll also need special handling for always-visible action sets such as the
> Software Updates and Cheat Sheets ones.  These should probably only appear in
> windows with the "default" window type (i.e. we don't want these showing up 
in
> the Help window).

The assumption is that once you can provide your own window advisor, you can 
choose which menus and actions sets are visible in the window. In case of help 
windows, I would start building the menu from scratch, selectively using 
existing action factories to populate the menu and the tool bar. However, my 
knowledge of window advisors is cursory and it is possible that what I am just 
saying makes no sense :-).
Comment 5 Nick Edgar CLA 2005-10-14 16:47:20 EDT
Re comment 3: Yeah, I know.  I debated even mentioning it.  Blame it on it being
late on a Friday afternoon <g>.  Having an explicit notion of window type will
probably be useful anyway, e.g. for hanging other things like contexts off of.

Re comment 4: The advisor does not control which action sets are visible, just
where they are placed.  For example, the IDE's action bar advisor
(WorkbenchActionBuilder) has:
  bar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS))
in both the fillMenuBar and fillCoolBar methods, specifying between which menus
or toolbars the action set contributions go.  

Since action sets are contributed via extension point, the set is open ended and
the advisor can't know about all of them, and therefore can't be responsible for
filtering them (likewise for any other extension point).

I'm not sure what happens if you don't specify an MB_ADDITIONS group marker.  It
probably just adds action set contributions at the end if missing.
So we'll need some way of narrowing what visible="true" means for an action set.

Plus, if we allow customization of the perspective in different window types, we
will want to restrict which action sets are even available for selection.
This applies to other kinds of extensions too, like wizards, views,
perspectives.  Shortcuts for all of these can be configured per-perspective, or
the whole set can be seen via Other... (assuming the advisor includes these
menus).  We may even want to filter commands and key bindings by personality. 
You can see why I started thinking along the lines of a separate workbench.  But
even then, we would want a different partitioning of the extension registry for
different workbenches.

We're actually pushing on a fairly fundamental difference between Eclipse, which
has a bottom-up and open-ended registry of extensions forming a single global
configuration, and other less open-ended systems like Spring which have a
single-rooted configuration (i.e. a fixed tree of configuration files), but
could (theoretically) run multiple instances on different configurations.

Our only recourse with our current architecture is to introduce a new
relationship, like "associated with window type" for each relevant extension
point.  To avoid having to do this for every single extension, we could adopt a
pattern-matching scheme, as was done for the activities extension point.

I'm not trying to scare anyone, and I think we should proceed with what you
outlined above, but I'm confident we're going to run into this issue.

Matt or James, can you comment on whether you've hit similar issues in the
personalities work?
Comment 6 Matthew Hatem CLA 2005-10-14 16:58:41 EDT
Re: comment #2

I have to agree with Dejan, supporting multiple Workbench's in an RCP
application seems very scary to me.  We've had problems with RCP components
making the wrong assumption that there was only ever one WorkbenchWindow.  This
was true an a very early version of our product but when we moved to a model
where we supported multiple WorkbenchWindows we needed to go back and refactor a
lot of code.  This is not to say that supporting multiple Workbench's per
process isn't the absolute right approach.

As for always visible actionSets,  I think it's okay to replicate these across
"window types".  I believe Eclipse docs suggest that the visibility property of
an actionSet be set to false 99% of the time and that an actionSet be associated
with a relevant part or perspective.  Following the "only contribute when
relevant rule" you shouldn't have to worry about these types of actionSets.

I think Dejan makes a good point in that one should be able to contribute a
"window type" that is not extensible by standard Eclipse extension points. 
Meaning the Workbench should not do things like process actionSets (always
visible or not) for the Window's menu or toolbar.  Dejan I don't think this is
possible now for menus.  You may be able to do something funky with the Coolbar.

Comment 7 Matthew Hatem CLA 2005-10-14 17:08:12 EDT
Re: comment #5

We did run into issues with cloned perspectives.  With cloned perspectives the
perspective association for actionSets or anything else starts to breakdown. 
How down.  To workaround this we leveraged the activities feature of Eclipse,
binding actionSet extensions to known activity extensions and mapping the
activity extensions to an instance of a cloned perspective.  We used a
proprietary markup for the mapping.  In the end the activity stuff became messy
and we realized a limitation in that activities were global across workbench
windows.  Thus we could only support one instance of a "window type" that
utilized cloned perspectives.
Comment 8 Nick Edgar CLA 2005-10-17 11:17:13 EDT
Matt, is the problem with cloned perspectives and action sets captured anywhere?
It sounds like this is a separate issue that could be solved, e.g. with having a
primary id vs secondary id (although as we know from multi-instance views, that
approach has problems), or perhaps using contexts (e.g. perspectives P1 and P2
both promote context C; actions sets A1 and A2 are associated with C).
Comment 9 Matthew Hatem CLA 2005-10-17 11:32:12 EDT
Secondary ids won't solve the problem we've had.  The problem is that the clone
is not known about at the time the actionSets are declared.  So declarative
association of actionSets to perspectives that are cloned is just not possible.

We use Activities to work around this today.  We could/should move to using
contexts instead but we have not had the cycles to look at that yet.  Moreover I
think this is just a fundamental problem in working with cloned perspectives.

The point I wanted to get at was that the activity matrix is global for all
workbench windows.  I think it would be useful to be able to scope enabled
activities sets to an instance of a "window type".
Comment 10 James Kebinger CLA 2005-10-17 11:39:01 EDT
Are there separate context services for each window? Activities, as Mat already
noted are hobbled by being linked to the one workbench instance.
I see a register shell method on IContextService which seems to indicate a
window focus, but is that the case?
Comment 11 Nick Edgar CLA 2005-10-17 11:43:15 EDT
But if the primary id was kept, then the associations with it would still work
(assuming they worked against the primary id, not the compound id).

My current thinking is to keep activities global, but to give contexts more
activity-like control over what is presented at the UI.  Contexts can already be
promoted on a per-window and per-part basis.
Comment 12 Nick Edgar CLA 2006-03-15 11:24:29 EST
Reassigning bugs in component areas that are changing ownership.
Comment 13 Boris Bokowski CLA 2006-12-14 12:30:17 EST
I cannot commit to doing this at this point, but I'm marking it for investigation in M5.
Comment 14 Boris Bokowski CLA 2007-02-02 23:13:34 EST
Moving to M6, but unfortunately, I still cannot commit to anything.
Comment 15 Boris Bokowski CLA 2007-03-26 14:43:11 EDT
I'm sorry but this did not make it into 3.3.
Comment 16 Boris Bokowski CLA 2009-11-26 16:15:45 EST
Prakash is now responsible for watching bugs in the [RCP] component area.
Comment 17 Eclipse Webmaster CLA 2019-09-06 16:11:01 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.