Bug 160189 - [Dialogs] jface Window class should provide data properties
Summary: [Dialogs] jface Window class should provide data properties
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-09 03:48 EDT by Daniel Krügler CLA
Modified: 2019-09-06 16:09 EDT (History)
1 user (show)

See Also:


Attachments
Patch to add set/getData (4.36 KB, patch)
2006-10-09 04:59 EDT, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Krügler CLA 2006-10-09 03:48:11 EDT
User-defined dialog classes based on the Window class often need to accumulate data based on user-input, which is typically requested after a successful Window.open(). Although Window.open() returns the closing result, there exists no common interface for related user-data from the dialog and each and every dialog has to document non-generic getter methods to request these results (e.g. InputDialog has a "getValue" method). I propose to add a generic meta-data interface to either org.eclipse.jface.window.Window or org.eclipse.jface.dialogs.Dialog. Interestingly there already exists a similar
interface in org.eclipse.swt.widgets.Widget:

public Object getData (String key);
public void setData (String key, Object value);

which fulfills the above mentioned requirements. Because this interface is well-known to every SWT programmer, it would be natural to expect a similar one in the jface Window/Dialog classes.

I would like to mention that this request was inspired by a current newsgroup thread

eclipse.platform.swt, 2006-09-30 17:14 by Ali Naddaf:
"How to get control values from a dialog?"

Especially Tom Schindl's answer to that question lead to this proposal.
Comment 1 Thomas Schindl CLA 2006-10-09 04:59:00 EDT
Created attachment 51621 [details]
Patch to add set/getData
Comment 2 Susan McCourt CLA 2006-10-10 13:18:59 EDT
Since the SWT user data fulfills your requirements, can you not just attach your dialog data to the widget data of the underlying widget?
Comment 3 Daniel Krügler CLA 2006-10-11 02:51:23 EDT
(In reply to comment #2)
AFAIK, there exist no public accessor for "the" underlying widget available in one of the base classes (Window or Dialog). I don't think that the shell is appropriate, because it is not owned by the dialog. The only option I see is the public available member buttonBar. But this is also problematic, because according to its docs "[..] null until dialog is layed out.". This is bad, because the typical use case is:
1) Create some dialog.
2) Feed the dialog with input data. At this point the "setter" activity of the proposed getData interface would be used. But buttunBar is null at this point.
3) Open the dialog.
4) Close the dialog and read data. That is, after close has been called, the
data needs to be available.
Comment 4 Susan McCourt CLA 2007-07-01 10:39:42 EDT
This message is part of a mass update...the bug is likely legitimate, but not a priority. Marking P5.  Patches would be entertained.
Comment 5 Susan McCourt CLA 2009-07-09 17:18:34 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 6 Eclipse Webmaster CLA 2019-09-06 16:09:02 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.