Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 55162 - IPresentablePart needs to be able to opt out of done state
Summary: IPresentablePart needs to be able to opt out of done state
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-17 16:00 EST by Tod Creasey CLA
Modified: 2004-05-18 11:21 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2004-03-17 16:00:42 EST
20040317

We need to be able to allow an IPresentablePart to opt out of showing bold 
when it is done.

Currently any part that is not the focus part will show  bold when it is done. 
For the marker views in particular this is only desired when the markers 
change.
Comment 1 Tod Creasey CLA 2004-03-17 16:03:33 EST
From Nick:

The current code in PartTabFolderPresentation.updateGradient only sets the 
font if the part is active and not busy.
This doesn't seem to handle all the cases.  There doesn't seem to be anybody 
setting the default font for the initial case anymore (independent of 
activation).
It's also not clear to me that we're handling the multiple concurrent jobs 
case.

Also, PartTabFolderPresentation is only used for views.  Need to ensure that 
this works for editors too, in EditorPresentation too.
The font logic there now is different than for PartTabFolderPresentation.

We want to maintain the following invariants, for both views and editors:
- if any jobs running in the part, then font is italic
- else if any jobs were running, but have all completed, and part not yet 
activated, then font is bold
- else font is plain

I suggest having a common updateFont(IPresentablePart) method in 
PartTabFolderPresentation, calling this from the subclasses for the initial 
case and when the busy state changes.

This will require maintaining a separate latch for the "all jobs completed but 
part not yet activated" state, for each part.
Any logic that is independent of how the busy state is presented should be 
encapsulated in IPresentablePart.  That is, it should be easy to move to using 
colours rather than fonts to show the busy state without having to worry about 
the logic above.  I suggest changing IPresentablePart.isBusy() to be a 3-
valued int getBusyState() method (not busy, busy, and done), and maintaining 
the latch there.
Comment 2 Nick Edgar CLA 2004-03-17 16:09:36 EST
My comments above are really independent of the subject of this PR.
Whether or not parts can opt out, we still need to handle the busy state
presentation properly, and have the proper separation of presentation and
non-presentation aspects.
Comment 3 Tod Creasey CLA 2004-03-17 16:14:54 EST
Created Bug 55167 to track the other issues
Comment 4 Tod Creasey CLA 2004-03-22 11:50:33 EST
Added jean-Michel and John.

I think what might be the easiest opt out for the view developer is to change 
ViewPart.showBusy() to return a boolean with true indicating that we should 
bold the viewer and let the viewer decide what to do.

This is a breaking change so we should hold off until early M9 if we want to 
do it this way.
Comment 5 Nick Edgar CLA 2004-03-22 14:10:49 EST
The Workbench should not refer directly to ViewPart or WorkbenchPart. 
IWorkbenchPart and IViewPart are the API types.  WorkbenchPart and ViewPart are
just conveniences, on the client side of the fence.

It would be better if it was just API on the part's job service, rather than
adding API to the generic part interfaces that is specific to a particular
service.  E.g. setShowBusy(boolean), int getBusyState() and addPropertyListener
for busy state changes.

Comment 6 Tod Creasey CLA 2004-03-29 11:06:25 EST
This needs to be decided on once and for all in M9.
Comment 7 Tod Creasey CLA 2004-03-30 10:44:40 EST
This needs to be resolved for M9
Comment 8 Tod Creasey CLA 2004-03-30 16:53:06 EST
Please see http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-ui-
home/responsive-ui/M9proposal.html for the proposed solutions to the 
outstaning progress issues in M9.
Comment 9 Nick Edgar CLA 2004-04-01 14:26:13 EST
The proposal still mentions adding API to WorkbenchPart.
Please see comment #5.
Comment 10 Stefan Xenos CLA 2004-04-01 16:24:55 EST
IPresentablePart already has a "isDirty" flag that indicates that it contains
interesting changes. Views can choose to set this when their contents change and
clear it when they become visible. This seems to be exactly what is needed here.

This isn't a "done" state. A view may have interesting new changes that did not
involve running a background job.

The workbench may decide to display an "are you sure?" dialog before closing a
dirty part.

There don't seem to be any changes necessary in the presentation API.
Comment 11 Nick Edgar CLA 2004-04-01 16:51:36 EST
Careful.  The isDirty flag is used to capture the dirty editor state, i.e. a
user-initiated change to the content shown in the editor.  Views can also get
exactly the same semantics via ISaveablePart (this used to be used by the Sync
view in 2.1, but is not currently used in the SDK in 3.0).

isDirty should not be overloaded for showing busy/completed state.
Comment 12 Tod Creasey CLA 2004-04-01 16:56:07 EST
This was my feeling too. It turns out that the requirement the dynamic tea 
came up with was different anyways - we need a way to say showUpdatedContent() 
which would then forward to the presentation which would (in our case) make 
the tab bold.

I currently intend to implement this on IWorkbenchSiteProgressService and not 
touch the ViewPart at all.
Comment 13 Tod Creasey CLA 2004-04-02 16:58:06 EST
Fix released. IWorkbenchSiteProgressService now has a method 
warnOfContentChange which calls site.getPane().showHighlight() (from the 
internal class).

This in turn sends a property change event which the IPartPresentation listens 
to. BasicStackPresentation now highlights for this.

The main change this has is that bolding does <not> happen by default now. I 
have hooked up the marker view to do the same thing as before - I will make it 
smarter in the upcoming days.
Comment 14 Tod Creasey CLA 2004-04-12 10:11:56 EDT
This has been added. By default all views opt out of this state and can get it 
back by calling getProgressService().warnOfContentChange();