Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 55156

Summary: [RCP] Need access to view toolbar from presentation
Product: [Eclipse Project] Platform Reporter: Nick Edgar <n.a.edgar>
Component: UIAssignee: Stefan Xenos <sxenos>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2 CC: eclipse, ed.burnette, hudsonr, Matthew_Hatem, michaelvanmeekeren, n.a.edgar
Version: 3.0   
Target Milestone: 3.0 M9   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Patch for org.eclipse.ui.workbench
none
Screenshot showing toolbar manipulation in action
none
Replacement patch where the theme reaction code works property (including the toolbar change)
none
Some work in progress
none
Cumulative patch for 55156, 55155, and 55437
none
Screenshot of the java perspective with the latest patch
none
Screenshot of the java perspective with the latest patch
none
Screenshot of the debug perspective with the latest patch none

Description Nick Edgar CLA 2004-03-17 15:21:20 EST
build I20040317

As with view menus (bug 55155), how the view toolbar is presented needs to be
moved from ViewPane (internal) to the view presentation.

This is needed to make the presentation story complete for 3.0.
Though not critical for LWP, it would be nice to have for M8.
Comment 1 Stefan Xenos CLA 2004-03-17 19:03:31 EST
This lines up with some of my other commitments for M8. At the very least, I
hope to allow the presentation to control the position of the toolbar in the
next few days.
Comment 2 Stefan Xenos CLA 2004-03-18 07:21:59 EST
Okay... I've got a patch working that gives access to the view toolbar, and I've
updated the new look presentation to align the view toolbar with the tabs when
there is extra space. 

There are still a few problems with the new look changes, though.

1. The vertical gradient at the top of CTabFolder doesn't work with toolbars. I
had to change it to a horizontal gradient (I recommend using a flat color).

2. The tab area has been shrunk recently, and it now truncates the bottom of the
toolbar.

The API is pretty simple: IPresentablePart has a getToolBar() method, which
returns the view's Toolbar instance. The Presentation can move it around, change
its colour, etc.

Comment 3 Stefan Xenos CLA 2004-03-18 07:55:12 EST
Created attachment 8649 [details]
Patch for org.eclipse.ui.workbench

I haven't committed this to HEAD because the view menu is currently broken, and
there is a lot of ugly code that is still visibly "in progress"...

However, this patch should run reliably enough to start fixing the theming
issues (above) and to get some feedback on the new API.

Although the presentation can now manipulate the toolbar, I still need to
create a factory method to allow the presentation to create the toolbar.. but
if moving the toolbar and changing its colour is enough for M8, I suggest that
we defer the rest until M9.
Comment 4 Stefan Xenos CLA 2004-03-18 07:58:01 EST
Adding Kim... she's probably best able to address the theme issues in comment 2.
Comment 5 Stefan Xenos CLA 2004-03-18 08:06:34 EST
Created attachment 8650 [details]
Screenshot showing toolbar manipulation in action
Comment 6 Kim Horne CLA 2004-03-18 08:39:35 EST
Personally I think it looks fine with either a horizontal gradient or a flat
color, but that decision isn't really mine.  (I own the engine, not the look. 
Everyone should be thankful for that).  Michael, care to comment?
   
Comment 7 Kim Horne CLA 2004-03-18 09:02:12 EST
Created attachment 8652 [details]
Replacement patch where the theme reaction code works property (including the toolbar change)

This patch is the same as the previous patch except that the code in
ColorSchemeService does the right thing (as per Stefans directives) and the
toolbar reacts to color preference changes.
Comment 8 Randy Hudson CLA 2004-03-18 16:14:04 EST
Notice in the provided attachment that the problems view still wastes space to 
display how many problems exist.  In 2.1, this would have been displayed 
together with the view's name.

Does the theme control this labeling?  Can the default 3.0 theme do better, 
i.e. 2.1 behavior
Comment 9 Kim Horne CLA 2004-03-18 19:43:50 EST
This is more of a presentation problem than a theme problem... a property could
be described on a theme to change the presentations behaviour to be "2.1 like",
but it'd be up to the presentation implementor to actually honour it.
Comment 10 Stefan Xenos CLA 2004-03-18 21:07:28 EST
Yes, the plan is to give the presentation (but not the theme) control of the
status text too... but there is very little chance of this being ready for M8.

Unfortunately, the view title is shown in a tab so there is no room for the
status text there. The status text could be placed to the right of the tab
(space permitting), but the trouble is that short status messages would look
just like additional tabs. 

I suppose we could experiment with fonts and colours to try to make this less
confusing... but my inclination would be to simply remove the marker count from
the problems view and make better use of the status line (the one at the bottom
of the window) when the problem view has focus.

Comment 11 Kim Horne CLA 2004-03-18 21:15:51 EST
+1 to that.  Every use of the title text that I've seen would make much more
sense as a status line contribution of some flavour.
Comment 12 Stefan Xenos CLA 2004-03-18 21:21:56 EST
Re: comment 7

Thanks, Kim.
Comment 13 Nick Edgar CLA 2004-03-18 21:25:24 EST
Kim, isn't it past your bed time <g>?

The problem with using the status line is that the part has to be active in
order for its status line message or status line contributions to be visible.

It's a desirable feature to be able to glance at the Problems view or Search
view while making changes in the editor and see its "extra info".

Also, keep in mind that there are a whole whack of WSAD views (not to mention
other plugins) that probably take advantage of ye olde setTitle trick and can't
be expected to migrate (at least not right away).
Comment 14 Kim Horne CLA 2004-03-18 21:39:08 EST
I watch professional wrestling on Thursday night.  I get to stay up late and eat
cookies and shout like an idiot. :)

What if we migrated for them...take the text that we're scraping from the title
now and just shunted it into a status line item...  it doesn't solve the casual
glancing problem, but I dont know if that's worth keeping the title area around.
 It just looks so slick without it.
Comment 15 Randy Hudson CLA 2004-03-19 10:02:54 EST
Would problem count always appear in the status line?  If it were based on part 
being active, that would be frustrating because I would have to click on the 
view first in order to see if any problems were being filtered from it.

"The status text could be placed to the right of the tab (space permitting)"
-What about inside the tab if there is only one view.  For stacked views, even 
2.1 used an extra row of space to display status. You could also consider not 
having the appearance of a tabItem when there is just a single view.

Being able to get the toolbar is one thing. But what about being able to hook 
its updating? If contributions are added to the toolbar dynamically, this would 
require re-layout of the view presentation.  Is this possible?
Comment 16 Ed Burnette CLA 2004-03-19 10:35:54 EST
As a user I'd like to have certain status information be visible all the time; 
besides the problem count, consider the Console view. I often have more than 
one program running at a time and each one has output that goes to it's own 
page in the console view. The application name used to be in the view title 
bar, now it's in the title text next to the view toolbar. If you moved it to 
the status line then I'd have to click on the Console window to see who the 
output belongs to.

So I think the options are:
- bring back view titlebars and put the title text there, with an option to 
turn titlebars off for RCP applications,
- put the title text in the tab name, or a shortened form of the title text 
(new api for shortened form?),
- leave the title text next to the view toolbar (though imo it could use some 
sprucing up, maybe a border or gradient or something)

It would be nice (and maybe you already have this) if a presentation could 
choose to do any of the above options it wanted, or even something different 
like not having tabs at all.
Comment 17 Michael Van Meekeren CLA 2004-03-19 15:22:37 EST
I think the status text discussions should move elsewhere.  This bug is 
concerning view toolbars.

I just don't want the information (and Ed and Randys comments) lost if the 
original request is fixed.
Comment 18 Stefan Xenos CLA 2004-03-19 23:31:34 EST
Created attachment 8722 [details]
Some work in progress

Regarding comment 15: you're totally right Randy, we will need the ability to
monitor changes to the toolbar. I'm working on that (and something similar for
the view menu) now.

BTW, here's my current work in progress. This version addresses some layout
issues and has a placeholder for the view menu (currently does nothing). Some
things (like proper computation of the horizontal gradient) have been
temporarily disabled. I've also temporarily removed the status text from the
marker views to see what it looks like.
Comment 19 Stefan Xenos CLA 2004-03-21 05:44:07 EST
Created attachment 8730 [details]
Cumulative patch for 55156, 55155, and 55437

This version is pretty much finished. The API should be complete, and the
general look and behavior is finished.

There is still a known bug: it isn't responding to theme changes correctly yet.
However, I'm posting this early version here to elicit feedback. In particular,
I want to make sure of the following:

1. The minimal view menu API I've offered is sufficient for LWP.
2. Nobody objects strongly to the increased tab size and horizontal background
gradient.
3. There are no use cases I overlooked.
Comment 20 Stefan Xenos CLA 2004-03-21 05:50:57 EST
Created attachment 8731 [details]
Screenshot of the java perspective with the latest patch
Comment 21 Stefan Xenos CLA 2004-03-21 05:51:55 EST
Created attachment 8732 [details]
Screenshot of the java perspective with the latest patch
Comment 22 Stefan Xenos CLA 2004-03-21 05:52:42 EST
Created attachment 8733 [details]
Screenshot of the debug perspective with the latest patch
Comment 23 Ed Burnette CLA 2004-03-21 13:05:22 EST
The screenshots look good to me. It's looking closer and closer to 2.1 :).

This is somewhat off topic but has anyone thought of treating editor toolbars 
and menus the same way as view toolbars and menus? One example - (Team) 
Compare with > Latest from HEAD brings up an editor that contributes three 
toolbar buttons to the main toolbar (ignore white space, next change, and 
previous change). To me it would make more sense for those three buttons to be 
closer to the editor, in fact just above it like views.
Comment 24 Matthew Hatem CLA 2004-03-21 21:14:14 EST
To give Presentations a higher level of control over how contributions are 
presented, why not just provide access to the relevant set of contributions.

IPresentablePart...

public Action[] getViewMenuContributions();
public Action[] getViewActionContributions();



Comment 25 Matthew Hatem CLA 2004-03-21 21:36:08 EST
Correction:

The APIs should not have any references to "View".

This would also help satisfy the request made by Ed in comment #23.

Comment 26 Nick Edgar CLA 2004-03-21 21:43:56 EST
Several reasons:

- Contribution managers can take different kinds of contribution items than
ActionContributionItem (and adding an IAction is just a convenience for creating
one of these).  E.g. parts can (and do) create a ControlContributionItem
subclass which creates a drop-down combobox.

- There is a one-to-one relationship between the contribution managers (and
their contributions) and the part, but a one-to-many relationship between a part
and its presentations.  JFace assumes a one-to-one relationship between a
contribution manager and its controls, so the presentation cannot be responsible
for creating the controls for the contribution managers (or contributions), only
positioning the previously created controls.

- The simple list of items does not capture their order relative to other items.
 (This is really only an issue for editor contributions which add to the main
menu/toolbar.)

Comment 27 Stefan Xenos CLA 2004-03-22 03:46:20 EST
To elaborate on comment 26

Although there is a one-to-many relationship between parts and their
presentations, there can only ever be one presentation visible at any given time.

This means that there may be the possibility of giving the presentation the
ability of managing its own toolbar widgetry (possibly by destroying and
recreating the widgetry or by carefully moving state between presentations). 

Nick and I have discussed this, but it is complicated and would need to make
assumptions about the lifecycle of client contribution items (which may cause
breakage). Until we can think of a safe way to expose this, we've settled for
the more restrictive API you see here.
Comment 28 Stefan Xenos CLA 2004-03-22 07:13:54 EST
Okay... committed to head.
Comment 29 Stefan Xenos CLA 2004-03-22 07:15:30 EST
Can we try to get this fix into M8?