Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] Dialogs remembering their size and position


The JFace Dialog class now supports (in builds >20051004) persisting of a dialog's location and/or
size.  For a detailed history of this topic and explanation of how to get this behavior,
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=33550.

Dialog owners are encouraged to migrate to the new behavior and delete any
code previously used to persist size and location.  (Then all those pesky
multi-monitor bugs won't be your fault anymore!).  It is still up to you to determine
whether persisting location and/or size makes sense for your particular dialog.  
You won't magically get any behavior without doing something.  

Here's how it works.

(1)  Override the method Dialog.getDialogsBoundsSettings() to return the
IDialogSettings appropriate for persisting your dialog's bounds.  

(2)  If you want to persist the last known size and location of the dialog,
you are done.  If you want to persist only the size or only the location,
override the method Dialog.getDialogBoundsStrategy() to return the constant
indicating what strategy to use.  This is a combination of bit mask values which are
currently defined as
  DIALOG.PERSIST_LOCATION - persist the last known location of the dialog
  DIALOG.PERSIST_SIZE - persist the last known size of the dialog

If you think a certain dialog should have its size and/or location persisted,
please open a bug for that dialog.

Back to the top