Bug 277200 - [app] API constant for "eclipse.exitdata"
Summary: [app] API constant for "eclipse.exitdata"
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M5   Edit
Assignee: equinox.compendium-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2009-05-20 15:21 EDT by John Arthorne CLA
Modified: 2010-01-08 16:29 EST (History)
1 user (show)

See Also:


Attachments
patch (3.84 KB, patch)
2010-01-07 11:16 EST, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2009-05-20 15:21:35 EDT
Applications are supposed to set the system property "eclipse.exitdata" if they want to alter or suppress the error message printed by the launcher on failure. This system property key should be available as an API constant on IApplicationContext or IApplication. The javadoc for IApplication.EXIT_RELAUNCH mentions this property in the javadoc text.

I was also wondering if we should spec an EXIT_RESTART constant, which would be a convenient place to specify the behaviour of this property (setting to empty string will suppress error dialog, etc).

(not for 3.5)
Comment 1 Thomas Watson CLA 2009-05-20 15:43:38 EDT
Investigate early in 3.6.
Comment 2 Thomas Watson CLA 2010-01-05 16:25:53 EST
(In reply to comment #0)

> I was also wondering if we should spec an EXIT_RESTART constant, which would be
> a convenient place to specify the behaviour of this property (setting to empty
> string will suppress error dialog, etc).

There already is a org.eclipse.equinox.app.IApplication.EXIT_RESTART constant.  Is that what you mean?

I think we need to define org.eclipse.equinox.app.IApplication.EXIT_DATA_PROPERTY constant for "eclipse.exitdata" and use that to define the behavior for the property in javadoc.
Comment 3 John Arthorne CLA 2010-01-06 09:39:19 EST
(In reply to comment #2)
> There already is a org.eclipse.equinox.app.IApplication.EXIT_RESTART constant. 
> Is that what you mean?

Unfortunately I can't remember what I meant by this... I agree there is already an EXIT_RESTART constant so I'm not sure what I was thinking.
> 
> I think we need to define
> org.eclipse.equinox.app.IApplication.EXIT_DATA_PROPERTY constant for
> "eclipse.exitdata" and use that to define the behavior for the property in
> javadoc.

Yes, that sounds good. The core issue is that I was helping someone with a command line app who wanted to suppress the launcher error dialog. The answer was that setting the system property eclipse.exitdata to an empty string, but this property and behaviour weren't specified anywhere. They didn't want to rely on some magic value that might change behaviour in the future.
Comment 4 Thomas Watson CLA 2010-01-07 11:16:46 EST
Created attachment 155513 [details]
patch

Here is a patch that adds the constant EXIT_DATA_PROPERTY = "eclipse.exitdata" to IApplicationContext.  Unfortunately I had to add it to IAppicationContext instead of IApplication because IApplication is implementable by clients and adding a constant flags a breaking API change.

I would prefer to have the constant on IApplication but at least now we can have the javadoc for IApplication reference the constant for eclipse.exitdata in IApplicationContext.  There are two TODOs in the patch:

// TODO need to document the format for providing error messages
// TODO may need to document the format for the command line to relaunch

I'm not sure if we should be documenting these or not since it may expose more internals as API.  For example, I think the error message needs to contain some html like markup for the dialog <title></title> etc.  If we document the format for displaying error dialogs then we will not be able to change this format easily in the future.
Comment 5 John Arthorne CLA 2010-01-08 16:06:33 EST
Looks good. As I said, in my case the user just wanted to suppress the dialog by setting the exit data to "", so they don't need any further specification of the format. We could always specify that in the future if there was a need for it.
Comment 6 Thomas Watson CLA 2010-01-08 16:29:15 EST
I released the patch.  I removed the TODOs for now.  I also incremented the package version for org.eclipse.equinox.app to 1.1 and updated copyrights (is it 2010 already?).