@@ -70,7 +70,9 @@ public interface UserInterface extends RichPlugin, Disposable {
7070 boolean isVisible ();
7171
7272 /** Shows the object onscreen using an appropriate UI widget. */
73- void show (Object o );
73+ default void show (final Object o ) {
74+ show (null , o );
75+ }
7476
7577 /**
7678 * Shows the object onscreen using an appropriate UI widget.
@@ -87,25 +89,37 @@ public interface UserInterface extends RichPlugin, Disposable {
8789 * Gets the desktop, for use with multi-document interfaces (MDI), or null if
8890 * not applicable.
8991 */
90- Desktop getDesktop ();
92+ default Desktop getDesktop () {
93+ return null ;
94+ }
9195
9296 /** Gets the main SciJava application frame, or null if not applicable. */
93- ApplicationFrame getApplicationFrame ();
97+ default ApplicationFrame getApplicationFrame () {
98+ return null ;
99+ }
94100
95101 /** Gets the main SciJava toolbar, or null if not applicable. */
96- ToolBar getToolBar ();
102+ default ToolBar getToolBar () {
103+ return null ;
104+ }
97105
98106 /** Gets the main SciJava status bar, or null if not applicable. */
99- StatusBar getStatusBar ();
107+ default StatusBar getStatusBar () {
108+ return null ;
109+ }
100110
101111 /** Gets the main SciJava console pane, or null if not applicable. */
102- ConsolePane <?> getConsolePane ();
112+ default ConsolePane <?> getConsolePane () {
113+ return null ;
114+ }
103115
104116 /**
105117 * Gets the system clipboard associated with this UI, or null if not
106118 * applicable.
107119 */
108- SystemClipboard getSystemClipboard ();
120+ default SystemClipboard getSystemClipboard () {
121+ return null ;
122+ }
109123
110124 /**
111125 * Creates a new display window housing the given display, or null if not
@@ -142,7 +156,15 @@ DialogPrompt dialogPrompt(String message, String title,
142156 * @return The {@link File} chosen by the user, or null if prompt is not
143157 * available
144158 */
145- File chooseFile (File file , String style );
159+ default File chooseFile (final File file , final String style ) {
160+ final String title ;
161+ if (style .equals (FileWidget .DIRECTORY_STYLE )) title = "Choose a directory" ;
162+ else if (style .equals (FileWidget .OPEN_STYLE )) title = "Open" ;
163+ else if (style .equals (FileWidget .SAVE_STYLE )) title = "Save" ;
164+ else title = "Choose a file" ;
165+
166+ return chooseFile (title , file , style );
167+ }
146168
147169 /**
148170 * Prompts the user to choose a file.
@@ -158,7 +180,9 @@ DialogPrompt dialogPrompt(String message, String title,
158180 * @return The {@link File} chosen by the user, or null if prompt is not
159181 * available
160182 */
161- File chooseFile (String title , File file , String style );
183+ default File chooseFile (String title , File file , String style ) {
184+ throw new UnsupportedOperationException ();
185+ }
162186
163187 /**
164188 * Displays a popup context menu for the given display at the specified
0 commit comments