Bug 72374 - [Dialogs] Provide a generic info pop dialog
Summary: [Dialogs] Provide a generic info pop dialog
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P4 enhancement (vote)
Target Milestone: 3.2 M3   Edit
Assignee: Susan McCourt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 45095 65092 72977 75844 76341 77345 85313 92901 113104
  Show dependency tree
 
Reported: 2004-08-20 15:26 EDT by Douglas Pollock CLA
Modified: 2019-03-15 07:58 EDT (History)
19 users (show)

See Also:


Attachments
Initial support for the pop up dialog (33.55 KB, patch)
2004-11-26 16:10 EST, Ines Khelifi CLA
no flags Details | Diff
Sample main program that uses the pop up dialog (4.67 KB, text/plain)
2004-11-26 16:13 EST, Ines Khelifi CLA
no flags Details
Hacked DefaultInformationControl (9.95 KB, patch)
2004-12-06 13:21 EST, Dani Megert CLA
no flags Details | Diff
org.eclipse.jface.patch (32.03 KB, patch)
2005-10-07 18:21 EDT, Susan McCourt CLA
no flags Details | Diff
org.eclipse.jdt.ui.patch (43.95 KB, patch)
2005-10-07 18:22 EDT, Susan McCourt CLA
no flags Details | Diff
org.eclipse.ui.workbench.patch (8.30 KB, patch)
2005-10-07 18:23 EDT, Susan McCourt CLA
no flags Details | Diff
org.eclipse.debug.ui.patch (7.22 KB, patch)
2005-10-07 18:24 EDT, Susan McCourt CLA
no flags Details | Diff
org.eclipse.jface.text.patch (10.09 KB, patch)
2005-10-07 18:24 EDT, Susan McCourt CLA
no flags Details | Diff
jface.dialogs.patch - revised PopupDialog (36.02 KB, patch)
2005-10-18 20:30 EDT, Susan McCourt CLA
no flags Details | Diff
jface.dialogs.images.patch (1009 bytes, patch)
2005-10-18 20:31 EDT, Susan McCourt CLA
no flags Details | Diff
jface.text.patch - revised DefaultInformationControl (10.10 KB, patch)
2005-10-18 20:34 EDT, Susan McCourt CLA
no flags Details | Diff
jdt.ui.patch - revised AbstractInformationControl, HierarchyInformationControl (43.96 KB, patch)
2005-10-18 20:35 EDT, Susan McCourt CLA
no flags Details | Diff
revised KeyAssistDialog (9.36 KB, patch)
2005-10-18 20:38 EDT, Susan McCourt CLA
no flags Details | Diff
unified jface patches (37.73 KB, patch)
2005-10-19 09:50 EDT, Susan McCourt CLA
no flags Details | Diff
popup menu gif for org.eclipse.jface.dialogs.images (92 bytes, image/gif)
2005-10-19 10:46 EDT, Susan McCourt CLA
no flags Details
disabled menu image (89 bytes, image/gif)
2005-10-19 10:46 EDT, Susan McCourt CLA
no flags Details
working around recent mac SWT bug (36.34 KB, patch)
2005-10-20 10:28 EDT, Susan McCourt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Pollock CLA 2004-08-20 15:26:46 EDT
There are several places in the GUI where user create a "info pop-up" dialog.  
Unfortunately, as it is now, these dialogs are written from scratch and share 
little common code.  A utility class for creating such dialogs would reduce 
code, and help to ensure a common look & feel. 
 
These are the characteristics I see as being common to these dialogs: 
+ Background colour 
+ Always on top 
+ Does not appear in the window list 
+ Deactivating the shell closes it 
+ Resizable; remembers size 
 
There might be others as well.
Comment 1 Douglas Pollock CLA 2004-08-20 15:29:35 EDT
There might also some default options for sizing and positioning.  For example, 
it could "position at cursor" or "position on right-bottom edge of window". 
 
Comment 2 Dani Megert CLA 2004-08-23 04:18:39 EDT
+ can disable to remember resize
+ can be moved and the new position is remembered (if chosen to be)
+ lightweight look and feel
+ knows the command that triggered it

The Text component has several kinds of info-popups:
- hovers
- content assist popup (list)
- quick views (Outline, Hierarchy)
These behave differently regarding focus and deactivation behavior.
Comment 3 Douglas Pollock CLA 2004-08-23 10:28:53 EDT
Could you describe the ways in which they are different? 
Comment 4 Dani Megert CLA 2004-09-14 10:09:16 EDT
Sorry for taking so long. It somehow got lost in my bug pile.

Hovers
- do not get focus and cannot get it
- cannot be resized
- are only active/visible while mouse cursor is over help requesting/hot area 
  (e.g. a type name). They go away if the mouse cursor leaves that area
- look even more light-weight than quick views (thinner border)

Content assist popup (list)
- initial focus remains on text widget i.e. user can type to narrow down the 
  proposed items. User can transfer focus to it (e.g. via mouse)
- can be resized (and remember its size)
- stays active no matter where the mouse cursor moves but goes away if mouse
  button pressed outside of content assist popup

Quick views (Outline, Hierarchy)
- gets focus when opened
- can be resized (and remember its size and location if user desires so)
- stays active no matter where the mouse cursor moves but goes away if mouse
  button pressed outside of quick view
Comment 5 Douglas Pollock CLA 2004-10-05 11:39:55 EDT
I apologize, but my work on the RAD performance team is continuing longer than 
expected.  This will have to wait until M4. 
Comment 6 Douglas Pollock CLA 2004-10-15 17:26:05 EDT
I have a question for you guys: how do you decide what size to make the text in 
the bottom right of the dialog? 
 
Comment 7 Dani Megert CLA 2004-10-18 05:02:57 EDT
Do you mean the field size or the font?. The font is hand-made:

Font font= statusField.getFont();
FontData[] fontDatas= font.getFontData();
for (int i= 0; i < fontDatas.length; i++)
	fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
fStatusTextFont= new Font(statusField.getDisplay(), fontDatas);
statusField.setFont(fStatusTextFont);
Comment 8 Stefan Xenos CLA 2004-11-01 17:27:28 EST
Note: all dialogs that remember their previous size and position should do so
with coordinates relative to their parent window.

Dialogs that remember their size in display coordinates are currently causing
mischief with multimonitor support. Dialogs are opening up on a different
monitor from the rest of Eclipse because that is the monitor that Eclipse was on
the last time it opened.
Comment 9 Douglas Pollock CLA 2004-11-08 16:11:09 EST
Bumped off my schedule for contributions work. 
Comment 10 Kevin Barnes CLA 2004-11-12 12:42:11 EST
Is the Target Milestone for this supposed to be 3.1 M4? 
Comment 11 Ines Khelifi CLA 2004-11-12 12:49:32 EST
Yes, this on my list of things to do for 3.1M4. Doug, could you update the
Target Milestone to 3.1M4? It is not letting me update it. Thanks.
Comment 12 Ines Khelifi CLA 2004-11-17 13:51:48 EST
By looking primarily at the PopupInformationControl and KeyAssistDialog classes,
here is a proposed draft for a generic PopupDialog implementation.

I started writing a basic "PopupInformationDialog" in "org.eclipse.jface" that
extends Dialog.

Provides basic functionalities, such as:

Public:
- setParentShell(Shell parentShell)
- setBlockOnOpen(boolean value)
- setShellStyle(int shellStyle):
Specify shell styles: SWT.NO_TRIM, SWT.RESIZE...
- setSize(size);
Specify the size of the shell
- setLocation(location):
Specify the location of the shell. The location will be converted to coordinates
relative to the parent shell, or to the display if no parent is set.
- setHasBottomComponent(Boolean value):
If the value is set to true, it would create a dialog with top and bottom
controls, separated by a separator. I noticed that a lot of the pop up dialogs
have this top and bottom control pattern. It could be useful to be able to
specify that behavior.
- setCloseCondition(closeType):
closeOnDeactivate: Will close the dialog when the shell becomes de-activated
mouseExitParent: Will close the dialog when the mouse exits the parent shell
- open():
Creates and opens the dialog. 
- close() and close(bool rememberState):
On close, you can specify if you wish to remember the current colors, location,
size and other properties of the dialog.
- setBackGroundColor(int color) and setBorderColor(int color)
- rememberDialogSettings(boolean value):
Set whether the dialog should remember its properties on close.
- clearDialogSettings():
Would provide a way to reset all the dialog properties to default values
(background and border colors, size, location...)

- createContents(Composite parent):
Creates a simple dialog window, with a border around the shell if a border color
has been specified. The dialog is comprised of a dialog area (top component) as
well as button bar (bottom component if specified) controls. It also sets the
background colors and layouts.
- createTopControl(Composite parent):
Fill in the top component of the dialog ("dialog area"). Current default
implementation is blank. This method would be called from the "createContents"
and would fill the top part of the dialog.
- createBottomControl(Composite parent):
Fill in the bottom component of the dialog ("button bar"), if the "has bottom
flag" has been set to true. This method would be called from the
"createContents" and would fill the bottom part of the dialog.
- getInitialSize():
Overwrites the Window's "getInitialSize". This method is called in Window from
the "createContent()" method, when the dialog is created on opened. Current
implementation uses the Window's default implementation for computing the size.
- "getInitialLocation()": Overwrites the Window's "getInitialLocation()". This
method is called in Window from the "createContent()", when the dialog is
created on opened. Current implementation uses the Window's default
implementation for computing location.


Notes:
- The "getInitialSize()" and "getInitialLocation()" should be overwritten to
provide specific location and size calculations. However, I am thinking of
common "size" and "location" computations that could be set for this dialog. Any
ideas? As Stefan pointed, the position should be set relative to the parent (as
Doug mentioned, maybe provide settings such as "top right corner", "bottom left
corner", "relative to mouse"...)

- I currently have 2 closing scenarios for the dialog: on mouse exit (exit the
parent) and on shell de-activate. Any other common ones that could be added to
the generic pop up implementation? Maybe something based on a timer? Close after
x milliseconds.

- It would be nice to be able to say in the constructor "new
PopupDialog(PopupDialog.Hover)" and have the dialog set all the required
properties: along the lines of black border, info background color background,
no trim, block on open(false), closes on de-activate… Hover would be one type of
dialog. Maybe List could be another.

- The current implementation provides no default implementation for the top and
bottom (if specified) controls. It would be nice to be able to say
myDialog.setTopContent(control) and myDialog.setBottomContent(control). That
would make the "PopupInformationDialog" complete enough to not force the user to
have to subclass to create a simple pop up dialog.  I am not sure how feasible
the latter solution is, as what I have mostly seen in other dialogs is the idea
of "createContent" methods that need to be overwritten to provide specific contents.

- The information that needs to be saved to remember the command that triggered
the dialog. Since the dialog would be in jface, maybe a string representation of
that command.

Thanks for the feedback.
Comment 13 Darin Wright CLA 2004-11-18 08:39:59 EST
Re: closing the popups:

* The debug popups perform an action and close in response to a command/key-
binding. For example, the "display" popup is opened by invoking the "Display" 
command (Ctrl-Shift-D), and then we use the same command to close the dialog 
and persist the result into the Display view. Similarly, the "inspect" dialog 
(Ctrl-Shift-I) can be closed via the same key-binding, which moves the result 
from the pop-up to the expressions view for furture reference. Would it be 
possible to generalize this - i.e. add a "close" command. See 
org.eclipse.debug.internal.ui.views.expression.PopupInformationControl for 
implementation details.
Comment 14 Ines Khelifi CLA 2004-11-18 11:00:21 EST
I had noticed the "close" command support in PopupInformationControl. However,
since this dialog will be in JFace, the most I can do with keys is string
representations. The "close on de-activate" and "close on mouse exit" are
choices of closing types you can set. If they do not fit your needs, you will be
able to just call the dialog's "close" method as you deem appropriate.
Comment 15 Dani Megert CLA 2004-11-19 05:27:44 EST
>By looking primarily at the PopupInformationControl and KeyAssistDialog classes,
>here is a proposed draft for a generic PopupDialog implementation.
What (or who ;-) made you restrict to those, especially why were the quick views
(Ctrl+O, Ctrl+T) left out? They provide additional interesting features like
single-click navigation, resize, move and a view menu.
Comment 16 Ines Khelifi CLA 2004-11-19 13:25:40 EST
My fault, I found hover, content assist and key dialog implementations, but I
omitted quick views :) Any particular class I should look at? Thanks for
pointing that out!
Comment 17 Ines Khelifi CLA 2004-11-19 18:32:34 EST
I have added quick views (AbstractInformationControl) to my list of available
implementations.
Comment 18 Ines Khelifi CLA 2004-11-26 16:10:04 EST
Created attachment 16180 [details]
Initial support for the pop up dialog

Initial support for the pop up dialog, inspired from:
- AbstractInformationControl (org.eclipse.jdt.ui)
- PopupInformationControl (org.eclipse.debug.ui)
- KeyAssistDialog (org.eclipse.ui.workbench)

The attached implementation is a pop up dialog that allows properties to be
set. Here is a summary of some of the components:
- Header and footer components
- Override "createDialogContent(Composite)" to fill in the dialog's content
- Override "createFooterContent(Composite)" and/or
"createHeaderContent(Composite)" to fill in a header and/or footer components
if they have been specified
- Move and resize capabilities (through the pull down menu, as in the quick
view dialogs)
- Move and resize capabilities can also be set using the standard
(setShellStyle(style)) if you do not want to use the pull down menu
- Background and border color
- Shell style
- Size and location for the dialog (the location is internally stored relative
to the parent widget if it's defined, or to the display if the parent is null).
Default location and size computations are in place, as well as other location
computations
- Remember the bounds (size and location)
- Remember the dialog properties
- Set closing type (currently, only close on de-activate can be chosen as a
type, or none)
- Open and close methods

Things to discuss/resolve:
- Key bindings -> key binding support is in the workbench, which means that the
PopupDialog should be appropriately sub classed (outside of JFace) to add the
key component to it.
- The dialog's properties can be remembered. Should they be remembered across
sessions? If so, the PopupDialog should allow support for setting
DialogSettings, or access to a PreferenceStore. Or maybe that part is too
specific and should be left to the class that extends the dialog.
- Is the PopupDialog too customizable? Some features could be removed to make
it a more solid generic base and other features can be added if seen fit.
Comment 19 Ines Khelifi CLA 2004-11-26 16:13:26 EST
Created attachment 16181 [details]
Sample main program that uses the pop up dialog

SWT stand alone snippet that uses the pop up dialog. Primarily to demonstrate
the different look and feels that can be achieved.
Comment 20 Ines Khelifi CLA 2004-11-26 16:14:04 EST
Reassigning to UI.
Comment 21 Dani Megert CLA 2004-11-30 12:44:41 EST
I'll try to provide feedback by the end of the week.
Comment 22 Dani Megert CLA 2004-12-06 13:21:06 EST
I first started to play with the dialog by using the provided Main.java:
- I added myDialog.setCloseCondition(PopupDialog.closeDialogOnDeactivate);
  ==> results in NPE when moving the dialog via view menu.
      this is one of the problems we faced as well: the tracker gets started
      and this causes the dialog to be disposed and later the tracker to fail

- it seems that it's not possible to create a simple hover i.e. a popup
  that doesn't take focus (SWT.NO_FOCUS). I guess this is because you use
  open() instead of setVisible(true).

I then tried to use the dialog in DefaultInformationControl. Besides the above
problem that the hover immediately takes focus I see the following items:
- our programming model assumes control that we can access e.g. the shell
  and its children before it is visible (opened). This is needed e.g. to add
  listeners which can be added via public API of DefaultInformationControl. If
  we loose this functionality we have to add listener management to our
  DefaultInformationControl

- we need API to show the view menu (show method is currently private). This is
  needed in order to open the view menu via keyboard

- there seems to be some space between the top and the first widget (in our
  case the StyledText: the text doesn't show up directly at the top.

I suggest you adapt the current DefaultInformationControl to use the PopupDialog
instead of a custom shell and then adapt the PopupDialog to get the same result
as with the current DefaultInformationControl. Once this is working the next
challenge is to replace the custom shell in the AbstractInformationControl which
introduces the following interesting wattles:
- uses the resizing and position restoring
- use key board to trigger actions like opening the view menu
- opens a dialog out of the view menu (filter dialog) which was hard to achieve
  in the current implementation due to closeDialogOnDeactivate. I'd assume that
  the PopupDialog would also be closed as soon as the filter dialog comes up

Attached find a patch for DefaultInformationControl.java which uses the
PopupDialog (showing status line not yet implemented). To make this work I had
to add a public create() method to PopupDialog:
	public void create() {
		createShell();
		createContents();
		initializeBounds();
	}
and control the visibility via its shell: open() and close() are not used at all.
Comment 23 Dani Megert CLA 2004-12-06 13:21:54 EST
Created attachment 16378 [details]
Hacked DefaultInformationControl
Comment 24 Dani Megert CLA 2004-12-07 06:47:18 EST
Some additional comment: I don't like the smartness in open() i.e. close if
dialog is already open and then reopening again.
Comment 25 Dani Megert CLA 2004-12-08 12:11:29 EST
The popup should also support more close conditions (currently just one
specified through int constant) which can be combined. A simple constant as it
is now won't be enough. Things which come to mind are:

- cursor left area / Rectangle (an area is provided by the client)
    this is e.g. used for hovers: when the mouse leaves the word area it
    needs to close

- parent deactivated
    for cases where the dialog has the SWT.ON_TOP 

- custom closer
    client plugs in a closer which handles the closing of the popup. This
    should also be combinable with the on of the other strategies

- cursor left shape / Region (same as above but with a shape instead of a 
  rectangle)
Comment 26 Billy Biggs CLA 2004-12-14 10:49:27 EST
I did not get to this for M4.
Comment 27 Tod Creasey CLA 2005-01-05 13:02:17 EST
Removing the milestone marking as Billy is now working on SWT. Billy if you 
get to this please feel free to take it.
Comment 28 Kevin Barnes CLA 2005-01-05 16:08:37 EST
Does this mean that this is no longer planned for 3.1?
Comment 29 Tod Creasey CLA 2005-01-05 17:06:39 EST
It means we can't commit to it as the person working on it has left the team. 
If we can get time in the schedule we will try.
Comment 30 Dirk Baeumer CLA 2005-03-09 08:52:47 EST
Tod, any change that something is happening here for M6 ? I would like to make
use of a info pop up as well.
Comment 31 Tod Creasey CLA 2005-03-09 08:55:12 EST
I think we will need to get someone assigned to this - let me negotiate some
time with MVM.
Comment 32 Douglas Pollock CLA 2005-03-09 09:26:30 EST
Yes, I still have a few bugs about the consistency of the look&feel of the key
assist dialog with other info pop-ups.  I'd rather just use a generic info
pop-up, rather than trying to fix these bugs independently.
Comment 33 Tod Creasey CLA 2005-08-08 11:54:55 EDT
*** Bug 27821 has been marked as a duplicate of this bug. ***
Comment 34 Tod Creasey CLA 2005-08-08 11:58:30 EDT
Adding myself and Shujie as we are looking into this issue currently as well.

Darin and Dani can you please tell us where you have written any floating shells
yourself - we want to be sure we have your features convered.
Comment 35 Dani Megert CLA 2005-08-08 12:07:40 EDT
Comment 2 summarizes our needs quite well and the comments I provided about the
prototype should clarify our needs.

Do you plan to restart from scratch on this one?
Comment 36 Tod Creasey CLA 2005-08-08 12:53:21 EDT
We are going to start with what Ines did and have a look from there.
Comment 37 Darin Wright CLA 2005-08-08 17:05:49 EDT
Debug's popup dialog is implemented in PopupInformationControl 
(org.eclipse.debug.internal.ui.views.expression) and its subclasses.
Comment 38 Dani Megert CLA 2005-08-10 09:30:53 EDT
Some additional info: resizing is currently a problem i.e. does not work on all
Platforms, see bug 12238 and its blocking bug 23980 for details.
Comment 39 Susan McCourt CLA 2005-09-07 19:30:53 EDT
Tod - how far did you and Shujie get on this one?
Comment 40 Tod Creasey CLA 2005-09-08 08:58:34 EDT
Shujie didn't manage to get anything done on this before she left.
Comment 41 Susan McCourt CLA 2005-09-28 16:08:26 EDT
I am looking at this one for 3.2 M3.  Will start by reviewing what Ines did, 
taking into account Dani's review and the other examples mentioned by Dani and 
Darin.  If anyone else has requirements, samples, or related bugs to add that 
aren't already covered here, please speak up.

Remembering size and location will be done in a way that satisfies bug #33550 
(generic size/location remembering for all dialogs with multi monitor 
support).  If subclasses of the popup provide settings/section names for this, 
then the size and location will be remembered and used later.
Comment 42 Dani Megert CLA 2005-10-05 04:21:33 EDT
>Remembering size and location will be done in a way that satisfies bug #33550 
Just a reminder that most of our info popup dilags are not related to the Dialog
class since they are not modal. Does above comment indicate that this PR will
introduce a connection to the Dialog class?
Comment 43 Susan McCourt CLA 2005-10-05 12:14:02 EDT
I was working on a dialog extension (with no blocking) when I made that 
comment.  However I've since refactored it to Window and am still deciding 
whether it belongs in there at all (based on problems you originally observed - 
initial focus taking, etc., and the amount of overrides necessary to make it 
behave properly).  You can assume that it will use similar techniques as those 
now in Dialog to save size and location.

btw, my plan is to adapt the known potential clients to use this popup as part 
of testing functionality and post everything here first.
Comment 44 Dani Megert CLA 2005-10-05 12:20:15 EDT
Sounds good.
Comment 45 Susan McCourt CLA 2005-10-07 18:21:21 EDT
Created attachment 28073 [details]
org.eclipse.jface.patch

proposed PopupDialog support
Comment 46 Susan McCourt CLA 2005-10-07 18:22:29 EDT
Created attachment 28074 [details]
org.eclipse.jdt.ui.patch

AbstractInformationControl based on PopupDialog
Comment 47 Susan McCourt CLA 2005-10-07 18:23:29 EDT
Created attachment 28075 [details]
org.eclipse.ui.workbench.patch

KeyAssistDialog based on PopupDialog
Comment 48 Susan McCourt CLA 2005-10-07 18:24:00 EDT
Created attachment 28076 [details]
org.eclipse.debug.ui.patch

PopupInformationControl based on PopupDialog
Comment 49 Susan McCourt CLA 2005-10-07 18:24:54 EDT
Created attachment 28077 [details]
org.eclipse.jface.text.patch

DefaultInformationControl based on popup dialog
Comment 50 Susan McCourt CLA 2005-10-07 18:45:39 EDT
I've attached a first cut at support for a JFace PopupDialog and included 
hacks to the clients I used to test functionality.  Feedback is encouraged.

Doug, Dani,and Darin - Since I may not know the ins and outs of your popups, 
I'd like you to give them a spin and let me know of problems.  In particular I 
barely tested the debug stuff as that was the last one I did ;-)

I tried to minimize the API for this new class by making most of the 
configurable values settable in the constructor only.  My thinking is that 
these are transient dialogs and not likely to have major reconfiguration.  I 
provided API for anything that the information controls needed (such as status 
text, etc.)

The biggest design issue in my mind is where/whether this dialog lives in the 
JFace window hierarchy.  It doesn't have a button bar so I rejected putting it 
in the Dialog hierarchy.  I ended up leaving it a subclass of Window so that 
it can inherit behavior for constraining bounds to the correct monitor, 
storing the shell, etc.  This seems appropriate, but it means that subclasses 
from preexisting classes not in that hierarchy (such as the information 
controls) have new inherited API (create, close, open).

I don't know if this is a big deal or not to Darin and Dani, since it doesn't 
affect IInformationControl.  If this is a problem, then you could change my 
hacks to your classes so that your information controls simply use a 
PopupDialog rather than being one.  This may make override of certain methods 
more awkward.  I'll wait for comment.

I did not convert ContextInformationPopup(2) or CompletionProposalPopup(2) in 
terms of this dialog yet, since I didn't want to continue on a path 
(inheriting from PopupDialog) that may be bogus.  

I'd like to get this in for M3 if possible, so prompt feedback would be much 
appreciated.
Comment 51 Susan McCourt CLA 2005-10-07 19:16:21 EDT
one more note:  I did not add the suggested API for specifying how the popup 
might be positioned (top/center/bottom) or for automatically hiding the popup 
when the mouse exits a rectangle.  If anyone feels strongly that we can 
eliminate a lot of redundancy by doing this, let me know...
Comment 52 Dani Megert CLA 2005-10-10 11:07:29 EDT
Susan, I did not yet start to look at the stuff but have an initial question:
did you test the stuff on all platforms? Those dialogs were always hard to get
working the same way and correctly on all three major platforms.
Comment 53 Susan McCourt CLA 2005-10-10 12:39:27 EDT
No, I have not tested yet on non-Windows platforms.  I don't (easily) have 
access to other platforms, but will be in Ottawa next week and was planning to 
do so at that time.  If you try it on a non-windows platform and see obvious 
problems, let me know, and I'll follow up next week.  Feedback on the API would 
still be useful even if you encounter platform-related problems.
Comment 54 Douglas Pollock CLA 2005-10-11 10:22:34 EDT
I looked at the key assist and the content assist dialogs.  Both seemed to 
work well and look good on GTK+.  I also looked at the code itself, and it 
looked good too.  I've included a few comments below: 
 
Design 
------ 
+ createMainContents should probably be called createDialogArea.  It would be  
more consistent with its sibling, Dialog.   
+ create[MainContents|DialogArea] should probably include a "Subclasses must  
override this method" in the javadoc (see Dialog).  (Basically, any  
public/protected method should mention whether it can be overridden.  If it  
absolutely cannot be overridden, then it should probably be marked "final".)  
   
Nitpicks 
-------- 
+ Extraneous blank line added in org.eclipse.jface/messages.properties   
+ Copyright date on PopupDialog should be 2005 not 2004,2005 ... I think   
+ The javadoc on open and close is probably real javadoc, not (non-Javadoc)  
  
Comment 55 Kevin Barnes CLA 2005-10-13 11:11:46 EDT
Had no luck with the debug patch, but did some experimenting on my own. It would
be really nice if we could tell the popup to position itself according to the
current selection. I realize that may be asking a lot, but if we're going to
build a wish list...

Is it necessary for users to call create() before open()? I expected to be able
to do something like new PopupDialog(...).open() the way I would with most
dialogs. This approach gave me NPEs unless I called create() before open() though.
Comment 56 Susan McCourt CLA 2005-10-13 12:53:29 EDT
Kevin, I'll double check the debug patch against what I'm running.  By "had no 
luck" do you mean it didn't apply correctly, or didn't work, or worked poorly?  

re: create() vs. open().  In general you should just be able to call open() 
like with most dialogs.  However, the preexisting information control classes 
(DefaultInformationControl, AbstractInformationControl, 
PopupInformationControl) created their widgets in the constructor, and all of 
their public API was implemented with this assumption.  So when listeners were 
added, they were just directly added to the widgets.  (See Dani's remarks in 
third paragraph of comment #22).  Rather than recode the information controls 
to keep their own listener lists, check for null widgets, etc., I simply added 
the create() call to their constructor, so that the widget life cycle would be 
similar to the original implementation.  It's really up to the information 
control implementers (debug and text) whether this model is kept or not.  The 
KeyAssistDialog, for example, follows the normal dialog open model.

Doug, thanks for comments and trying on GTK.  I agree with your comments and 
will fix accordingly.
Comment 57 Kevin Barnes CLA 2005-10-13 13:18:24 EDT
It just didn't work. It NPE'd when I executed the Inspect action. If I remember
correctly, ExpressionInformationControl's createControl method no longer got
called so a lot of setup never happened. I played around a bit and got a popup
dialog to appear, but it was only a few pixels tall so wasn't much good.
Ultimately debug would like to get away from using IInformationControl in favour
of simply creating a PopupDialog. Our hope is that our code will be much
simpler. I've started refactoring our display action with this approach. I'll
let you know how that goes.

I've been testing on a mac using an Integration build that was less than
perfect. That may be the source of some of my problems.
Comment 58 Susan McCourt CLA 2005-10-13 15:42:15 EDT
It's possible I attached the wrong patch or otherwise goofed.  I've since made 
changes in both PopupDialog and the clients.  Is it helpful to your refactoring 
for me to repost a working PopupInformationControl or are you well along your 
other path at this point?  You can look at the KeyAssistDialog patch for a more 
traditional dialog approach.  It doesn't do the early widget create, yet does 
support multiple open() calls.
Comment 59 Kevin Barnes CLA 2005-10-13 16:11:53 EDT
I've got my popup dialog working already. I'm just fiddling with the location,
size, and our custom close operations at this point. Overall I'm happy with the
PopupDialog class.

I'm still getting the NPE in open() if I don't call create() early. The first
line of open() calls get shell, this returns null, create gets called, then
later shell.open() is called, but shell is still null because its a local
variable and its value was never set after the create() call. If I replace
shell.open() with getShell().open(), I'm happy again.

I haven't looked at the KeyAssistDialog patch closely, I'll give it a closer look.
Comment 60 Susan McCourt CLA 2005-10-13 16:24:15 EDT
oops...my bad.
Add this line underneath the create() call in PopupDialog.open()

			shell = getShell();

KeyAssistDialog doesn't have the problem because it forces a create in its 
override of open().  I hadn't noticed that before.
Comment 61 Kevin Barnes CLA 2005-10-13 16:37:47 EDT
thanks Susan!
New problem now. I applied the KeyAssistDialog patch and brought up the
KeyAssistDialog, but it only appear briefly for me. Looks like I immediately get
an SWT.Deactivate from the parent shell and the KeyAssistDialog is closed on me.
Comment 62 Susan McCourt CLA 2005-10-13 18:12:21 EDT
It's probably the Mac sending a parent shell deactivate after the shell 
activate (My code was assuming the windows order).  A quick hack you could try 
(I'm basically guessing on what the problem is) is remove the marked line below 
from the PopupDialog.configureShell method.  If this works, I'll verify on all 
the platforms next week while in Ottawa.  If the below hack doesn't get around 
it, you can remove the SWT.ON_TOP style bit from the constant 
PopupDialog.INFOPOPUP_SHELLSTYLE, and I'll get the real fix in next week when I 
have all the platforms at my disposal.

from PopupDialog.configureShell
...
		shell.setLayoutData(gd);

		shell.addListener(SWT.Deactivate, new Listener() {
			public void handleEvent(Event event) {
				if (listenToDeactivate) {
					close();
				}
			}
		});
		shell.addListener(SWT.Activate, new Listener() {
			public void handleEvent(Event event) {
				listenToDeactivate = true;
 >>>>REMOVE THIS LINE           listenToParentDeactivate = true;  
			}
		});

		if ((getShellStyle() & SWT.ON_TOP) != 0 && shell.getParent() != 
null) {
			shell.getParent().addListener(SWT.Deactivate, new 
Listener() {


Comment 63 Kevin Barnes CLA 2005-10-13 19:21:58 EDT
You're probably right about the event ordering. Removing that line does make the
problem go away.
Comment 64 Susan McCourt CLA 2005-10-18 20:26:48 EDT
Comment on attachment 28076 [details]
org.eclipse.debug.ui.patch

marking obsolete since Kevin is using new dialog now
Comment 65 Susan McCourt CLA 2005-10-18 20:30:07 EDT
Created attachment 28414 [details]
jface.dialogs.patch - revised PopupDialog
Comment 66 Susan McCourt CLA 2005-10-18 20:31:02 EDT
Created attachment 28415 [details]
jface.dialogs.images.patch

menu images for PopupDialog
Comment 67 Susan McCourt CLA 2005-10-18 20:34:53 EDT
Created attachment 28416 [details]
jface.text.patch - revised DefaultInformationControl
Comment 68 Susan McCourt CLA 2005-10-18 20:35:46 EDT
Created attachment 28417 [details]
jdt.ui.patch - revised AbstractInformationControl, HierarchyInformationControl
Comment 69 Susan McCourt CLA 2005-10-18 20:38:18 EDT
Created attachment 28418 [details]
revised KeyAssistDialog
Comment 70 Susan McCourt CLA 2005-10-18 20:48:15 EDT
Attached are the latest patches for the popup.
Hoping that Doug and Kim will give these a spin on Linux and Mac.

Doug and Kim - could you load all of the non-obsolete patches and try 
KeyAssistDialog, Content Assist, and the JDT popups (Ctrl-O, Ctrl-T) and 
compare the behavior before and after?  I'll take a look if there's anything 
weird.

Kevin - here's the latest for your new popup.

If this all looks good on Mac and GTK then I will commit the jface changes, 
and let there be popups everywhere...
Comment 71 Susan McCourt CLA 2005-10-19 09:50:41 EDT
Created attachment 28439 [details]
unified jface patches

cleaned up patch and included missing message.properties
Comment 72 Susan McCourt CLA 2005-10-19 10:46:05 EDT
Created attachment 28447 [details]
popup menu gif for org.eclipse.jface.dialogs.images
Comment 73 Susan McCourt CLA 2005-10-19 10:46:43 EDT
Created attachment 28449 [details]
disabled menu image
Comment 74 Kevin Barnes CLA 2005-10-19 11:17:53 EDT
The updated patch looks good to me. Thanks Susan!
Comment 75 Dani Megert CLA 2005-10-19 11:19:22 EDT
Since I will not be able to provide feedback for M3 (out of office) I've asked
Tom to look into this.
Comment 76 Susan McCourt CLA 2005-10-19 11:55:59 EDT
Dani & Tom - I opened bug #113104 and attached the jdt and platform text 
patches so that I can commit/verify this bug independently and you'll have a 
bug assigned to you to track it.  The API is marked experimental so if you 
have issues we can discuss changes.
Comment 77 Kim Horne CLA 2005-10-19 14:12:21 EDT
On the mac, the key assist popup doesn't stay up.  It disappears as soon as it appears.  Other than that 
things look good. 
Comment 78 Douglas Pollock CLA 2005-10-19 16:33:45 EDT
I quickly tested the key assist dialog on Linux GTK+, and it looks okay. 
Comment 79 Susan McCourt CLA 2005-10-20 10:28:49 EDT
Created attachment 28518 [details]
working around recent mac SWT bug
Comment 80 Kim Horne CLA 2005-10-20 10:42:44 EDT
That patch doesn't appear to fix the problem on the Mac.  The shell still flashes and disappears.
Comment 81 Susan McCourt CLA 2005-10-20 11:45:50 EDT
The flash/disappear is due to SWT bug #109952 (an extra shell deactivate 
event), which was fixed just after the integration build. I just tried it on 
the Mac with the nightly build, and it works.

I'm going to go ahead and release the popup so that Kevin and Doug can start 
using it.  Up to you guys if you want to wait for an integration build that 
fixes the Mac problem or not...otherwise you're likely to get popup closing bug 
reports.
Comment 82 Susan McCourt CLA 2005-10-20 11:49:23 EDT
Released >20051020
Comment 83 Ed Burnette CLA 2005-10-31 14:44:51 EST
Anybody have a screenshot of this in action for the most common configurations?
Comment 84 Susan McCourt CLA 2005-11-01 13:54:52 EST
Ed, as far as a screen snap goes, it's not much excitement to look at (most 
popups should look the same, the KeyAssist Dialog will look more like other 
popups)...this is more of a code reorg issue, providing a standard popup so 
everyone doesn't have to build their own.
Comment 85 Ed Burnette CLA 2005-11-01 14:38:47 EST
Looking at the API, shouldn't Dialog and PopupDialog share some common base
class which would have their common methods in it, such as createDialogArea()?
You could do this without breaking the binary compatability of Dialog.

Also, that 8-argument constructor is a bit of a monster. I could easily see you
wanting to add more parameters later, ending up with many variations that are
hard to tell apart. I think it would be much better to follow way Dialog does it
with a simple constructor and setters. This would fit nicely with the idea of
using a common base class.

If these ideas don't make sense then maybe the new class shouldn't have 'Dialog'
in the name, which implies it's a kind of dialog.
Comment 86 Ed Burnette CLA 2005-11-01 14:44:07 EST
FYI: http://www.eclipsezone.com/eclipse/forums/t53457.html .
Comment 87 Susan McCourt CLA 2005-11-01 15:53:53 EST
verified by checking KeyAssistDialog on windows and mac on I20051101-1204.
Will rely on verification of bug #77345 on Linux to validate on Linux.

The text use of this dialog is delayed to M4 and is being tracked in bug 
#113104.
Comment 88 Susan McCourt CLA 2005-11-01 16:11:07 EST
Re:  common superclass.  I felt like this could go either way, and in the end 
decided it didn't buy much in the implementation yet. There's not much code to 
share apart from creating an empty dialog area and saving the bounds (and then 
I considered whether saving bounds should be promoted to window...).  This 
refactoring could occur later if need be, but I don't find it compelling now.

The constructor is a beast.  Most of the options must be set before widget 
creation so I forced the issue by only providing setters for options that will 
be honored after widget creation.  I can consider changing this, but the down 
side is documenting a bunch of API as "not supported after widget 
creation"...the constructor was a way to enforce it.
Comment 89 Noel Grandin CLA 2005-11-03 02:33:45 EST
One way of avoiding massive constructors would be a factory class e.g.

public class PopupDialogFactory {

 .... various setters and getters .....

  // return this to support chaining of calls
  public PopupDialogFactory setXXX() ...

  public PopupDialog create() {
     return new PopupDialog(this)
  }
}

And create a constructor on PopupDialog that takes a PopupDialogFactory as argument.
This simplifies construction and makes it possible to extend&enhance both
PopupDialog and the factory class.