@@ -41,6 +41,7 @@ | |||
| 41 | 41 | import org.scijava.ui.console.ConsolePane; | |
| 42 | 42 | import org.scijava.ui.viewer.DisplayWindow; | |
| 43 | 43 | import org.scijava.widget.FileWidget; | |
| 44 | + import org.scijava.widget.WidgetStyle; | ||
| 44 | 45 | ||
| 45 | 46 | /** | |
| 46 | 47 | * An end-user SciJava application user interface. | |
@@ -160,12 +161,11 @@ DialogPrompt dialogPrompt(String message, String title, | |||
| 160 | 161 | default File chooseFile(final File file, final String style) { | |
| 161 | 162 | final String title; | |
| 162 | 163 | // style can be a string with multiple comma-separated keywords | |
| 163 | - // TODO use a utility class for style handling, e.g. StyleUtils.isStyle(style, ...) | ||
| 164 | 164 | if (style == null) title = "Choose a file"; | |
| 165 | - else if (style.toLowerCase().contains(FileWidget.DIRECTORY_STYLE)) title = "Choose a directory"; | ||
| 166 | - else if (style.toLowerCase().contains(FileWidget.FILE_AND_DIRECTORY_STYLE )) title = "Choose a file or directory"; | ||
| 167 | - else if (style.toLowerCase().contains(FileWidget.OPEN_STYLE)) title = "Open"; | ||
| 168 | - else if (style.toLowerCase().contains(FileWidget.SAVE_STYLE)) title = "Save"; | ||
| 165 | + else if (WidgetStyle.isStyle(style, FileWidget.DIRECTORY_STYLE)) title = "Choose a directory"; | ||
| 166 | + else if (WidgetStyle.isStyle(style, FileWidget.FILE_AND_DIRECTORY_STYLE)) title = "Choose a file or directory"; | ||
| 167 | + else if (WidgetStyle.isStyle(style, FileWidget.OPEN_STYLE)) title = "Open"; | ||
| 168 | + else if (WidgetStyle.isStyle(style, FileWidget.SAVE_STYLE)) title = "Save"; | ||
| 169 | 169 | else title = "Choose a file"; | |
| 170 | 170 | ||
| 171 | 171 | return chooseFile(title, file, style); | |
0 commit comments