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

Bug 313066

Summary: [Workbench] Workbench.createDisplay() needs to call Display.setAppVersion()
Product: [Eclipse Project] Platform Reporter: Carolyn MacLeod <carolynmacleod4>
Component: UIAssignee: Paul Webster <pwebster>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: bokowski, john.arthorne, kim.moir, remy.suen, Silenio_Quarti, susan
Version: 3.6Flags: john.arthorne: review+
bokowski: review+
Target Milestone: 3.6 RC2   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Set version v01
none
Set version v02
none
Set version v03 none

Description Carolyn MacLeod CLA 2010-05-17 01:39:23 EDT
The first few lines of Workbench.createDisplay() are:

// setup the application name used by SWT to lookup resources on some
// platforms
String applicationName = WorkbenchPlugin.getDefault().getAppName();
if (applicationName != null) {
	Display.setAppName(applicationName);
}

In fact, the application name - and now the application version - are also being used by screen readers. These strings are used to announce the name and version of the application, and they are used to determine any special handling that may be needed for that application and version.

There is a new API on Display called setAppVersion(String). The string should be "3.6" (or "3.6.0") for Eclipse 3.6, and "3.6.1", etc. for maintenance builds. Do not use "3.6M7" or "3.6RC1".

(The crash in Bug 311434 would not have happened if this had been set).
Comment 1 Paul Webster CLA 2010-05-17 08:07:32 EDT
John, Kim, any idea what would be good to set to the version?  Does the product that's currently running come with a matching version number?

PW
Comment 2 Kim Moir CLA 2010-05-17 09:22:39 EDT
The product files specify 3.6.0.@qualifier@ now, where @qualifier@ is replaced by the build id at build time.  Not sure if this answers your question...
Comment 3 Paul Webster CLA 2010-05-17 12:59:05 EDT
Susan, from your time in About land, do you have a good candidate for a product version number?

Not enough info:
eclipse.buildId=I20100513-1500

Probably wrong guy to ask:
osgi.framework.version=3.6.0.v20100512

from scanning the org.eclipse.sdk plugin, there's nothing in the product specifically and the plugin.properties defines 3.6.0 in productBlurb directly.

PW
Comment 4 Carolyn MacLeod CLA 2010-05-17 14:06:08 EDT
I think that the screen reader developers would be ok with "3.6.0.v20100512" (if you decide that it is ok to ask the osgi framework for the version number... or if you find that same value in a more logical place). They are looking for something that can be easily collated and logically compared to the previous version, and I think that even with the 'v' in there, they would probably be ok. And I think the user would not mind having the extra info spoken. And since it is actually a very precise version number, that may be useful somewhere down the road.
Comment 5 John Arthorne CLA 2010-05-17 14:58:38 EDT
The framework version isn't too helpful since it doesn't say much about the product you are running. My suggestion is something like:

name = Platform.getProduct().getName()
ver = Platform.getProduct().getDefiningBundle().getVersion()

If you want only three parts for the version number you could do something like this afterward:

ver = new Version(ver.getMajor(), ver.getMinor(), ver.getMicro(), null)
Comment 6 Paul Webster CLA 2010-05-17 15:33:29 EDT
Created attachment 168807 [details]
Set version v01

With this option I'll get a version like:  3.6.0.v201005131500 or the empty version 0.0.0

PW
Comment 7 John Arthorne CLA 2010-05-17 15:42:53 EDT
You need a null check on the result of Platform.getProduct().
Comment 8 Boris Bokowski CLA 2010-05-17 15:45:47 EDT
Platform.getProduct() can return null, can you please add a null check? Also, if there is no product, wouldn't it be better to default to something like the version of the RCP feature, or the version of the org.eclipse.ui bundle rather than 0.0.0?
Comment 9 Paul Webster CLA 2010-05-18 08:08:08 EDT
Created attachment 168901 [details]
Set version v02

New version of the patch.  Uses the same pattern as getAppName() and adds the null protection.

re: a default version

If we don't have a product, I don't think we can return a useful answer re: what version am I running, and I think that 0.0.0 is appropriate.  If that's not sufficient and we want something other than 0.0.0 I'd suggest the org.eclipse.ui.workbench bundle version.  At least you would have a concrete thing that is running (the workbench).

PW
Comment 10 Paul Webster CLA 2010-05-18 11:44:37 EDT
Created attachment 168955 [details]
Set version v03

Same as version 2, but if we can't find a product plugin we use the version for org.eclipse.ui.  If we can't find that, *then* we return the empty string "0.0.0"

Boris and John, could you please review.

PW
Comment 11 Paul Webster CLA 2010-05-18 12:50:29 EDT
Released for I20100520-0800
PW
Comment 12 Paul Webster CLA 2010-05-18 12:54:38 EDT
My browser killed the flags.  John, Boris, could you please reset them.  I'd do it myself, except then it would look like I give myself +2 :-)

PW
Comment 13 Paul Webster CLA 2010-05-21 10:00:28 EDT
Verified in I20100520-1744

Carolyn, it's set to 3.6.0.v201005201744

Does that produce the kind of output you/they expect?

PW
Comment 14 Paul Webster CLA 2010-05-21 10:00:38 EDT
.
Comment 15 Carolyn MacLeod CLA 2010-05-21 10:24:04 EDT
At the moment, they are not parsing the string. They just want a string that makes some sense when spoken to a user. The current one fits the bill well enough. If/when they need to parse the string, if they decide that they prefer 3.6.0, then I will strip off the extra .v... before I send it to them.

I have spoken to some folks about fully specifying the version string (at present, the spec for IAccessibleApplication::appVersion is too vague). They are still mulling it over <g>.

Thanks!