Bug 55656 - [RCP] [ViewMgmt] want to have the possibility to dynamically change the tab name of the view for multiple view instances
Summary: [RCP] [ViewMgmt] want to have the possibility to dynamically change the tab ...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P1 enhancement (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Stefan Xenos CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
: 56304 62636 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-23 07:23 EST by guillaume DUC CLA
Modified: 2004-05-20 18:56 EDT (History)
6 users (show)

See Also:


Attachments
Patch that fixes the remaining issues (48.34 KB, patch)
2004-05-19 23:50 EDT, Stefan Xenos CLA
no flags Details | Diff
Adds a new view to the test suites that excercises the new APIs (3.34 KB, patch)
2004-05-19 23:51 EDT, Stefan Xenos CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description guillaume DUC CLA 2004-03-23 07:23:03 EST
on Eclipse RCP V3.0M7, it is possible to open dynamically multiple instances of 
a view :
   showView ( String view Id, String secondary Id, int mode)

the text shown in the tab of the view is tne name of the view defined in 
plugin.xml ( <view name=".." ). When you open several instances of a view, all 
of the tabs show this text.

The problem is that it is not possible to modify programmatically this text.

It is possible to see it but not to change it :
   IViewpart.getViewSite().getRegisteredName() gives the name of the view

Is it possible to have the setRegisteredName (String name) function ??
Comment 1 Nick Edgar CLA 2004-03-23 11:55:16 EST
Investigate for M9.
Comment 2 Nick Edgar CLA 2004-03-23 11:55:51 EST
Matt, you're probably interested in this too.
Comment 3 Nick Edgar CLA 2004-05-04 22:16:36 EDT
We have added IViewPart2 defining new properties getPartName() and 
getStatusText(), and specifying property id(s) for notifying about changes to 
these (currently using PROP_TITLE, but we may change to have separate ids).

Stefan to complete the implementation and hook this up to the presentations.
Comment 4 Nick Edgar CLA 2004-05-04 22:26:50 EDT
*** Bug 56304 has been marked as a duplicate of this bug. ***
Comment 5 Nick Edgar CLA 2004-05-05 11:54:04 EDT
Just to be clear: setPartName will change the tab text in presentations that use
tab folders, including the default one.
Comment 6 Nick Edgar CLA 2004-05-07 15:40:48 EDT
How about setDescription instead of setStatusText?
Comment 7 Stefan Xenos CLA 2004-05-07 23:14:06 EDT
The API is in place (check out IWorkbenchPart2), but it's not hooked up to
anything yet.
Comment 8 Stefan Xenos CLA 2004-05-19 21:28:58 EDT
*** Bug 62636 has been marked as a duplicate of this bug. ***
Comment 9 Stefan Xenos CLA 2004-05-19 23:50:25 EDT
Created attachment 10879 [details]
Patch that fixes the remaining issues
Comment 10 Stefan Xenos CLA 2004-05-19 23:51:02 EDT
Created attachment 10880 [details]
Adds a new view to the test suites that excercises the new APIs
Comment 11 Stefan Xenos CLA 2004-05-19 23:53:17 EDT
AFAIK, these patches should be ready to go... unfortunately, I'm getting test
failures in the testObjectStateContentType test. I can't see how this is related
to my patch, but I'm CC'ing doug since I think the test is his.

It would be nice (although extremely unlikely) if this could make it in for
tonight's build.
Comment 12 Douglas Pollock CLA 2004-05-20 00:00:08 EDT
Are you using a recent integration build and sync'ed with head?  Fixes/changes 
went in recently, so you need >=I200405181622. 
Comment 13 Nick Edgar CLA 2004-05-20 00:22:25 EDT
The patch is extensive enough that I'd want to go over it with you.

I did notice that the spec for WorkbenchPage.setContentDescription still talks
in terms of "status text" though.
Comment 14 Nick Edgar CLA 2004-05-20 00:23:01 EDT
And IWorkbenchPart2.getContentDescription too.
Comment 15 Nick Edgar CLA 2004-05-20 00:39:16 EDT
Some preliminary comments on the patch:

WorkbenchPartReference:
- Should use Util.safeString in getPartName() and getContentDescription().

ViewFactory:
- The getViewState method and callers are ignoring secondaryId (this wasn't
being handled properly before either)
  - it would be better if getViewState took the IViewReference as the arg, and
used ViewFactory.getKey for the map key

- In saveViewState it casts down to ViewReference.  \ I'd just as soon add
getPartName() to IWorkbenchPartReference.
  - Presumably this should be persisted for editors as well.
Comment 16 Nick Edgar CLA 2004-05-20 00:40:22 EDT
It would also help to have some documentation, at least in the implementation if
not in the spec, on the automatic updating and interplay between partName, title
and contentDescription.
Comment 17 Stefan Xenos CLA 2004-05-20 02:06:36 EDT
Nick, thanks for looking this over at such a late hour. These are all good
suggestions.

FYI, the title is persisted for editors too (at least, it's supposed to be <g>).
Comment 18 Stefan Xenos CLA 2004-05-20 02:12:39 EDT
Note: some of the subtleties of the title behavior can only be observed in the
R21 presentation.
Comment 19 Stefan Xenos CLA 2004-05-20 16:25:38 EDT
Fixed in head
Comment 20 Jim des Rivieres CLA 2004-05-20 18:54:43 EDT
IWorkbenchPartReference.getContentDescription() and getPartName() should be 
marked @since 3.0

The comments for EditorPart.setPartName and setTitle, and for 
ViewPart.setContentDescription and setTitle should be reviewed. These are 
protected methods overriding methods declared on WorkbenchPart. Do these 
methods need/deserve specs at all?

Comment 21 Stefan Xenos CLA 2004-05-20 18:56:39 EDT
Note: this patch added the following new APIs:

IPresentablePart.PROP_PART_NAME
IPresentablePart.PROP_CONTENT_DESCRIPTION

These were added since the presentation needs to be notified of changes to these
properties and it shouldn't be referring directly to the workbench's constant pool.


IWorkbenchPartReference.getPartName()
IWorkbenchPartReference.getContentDescription()

These were added to allow the workbench to access the new properties of
IWorkbenchPart2 without downcasting the IWorkbenchPartReference to a
WorkbenchPartReference.