Skip to content

Commit

Permalink
Add FileWidget.FILE_AND_DIRECTORY_STYLE
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Jun 27, 2024
1 parent d4ab47a commit 00512f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
<url>https://imagej.net/people/jaywarrick</url>
<properties><id>jaywarrick</id></properties>
</contributor>
<contributor>
<name>Christian Tischer</name>
<url>https://imagej.net/people/tischi</url>
<properties><id>tischi</id></properties>
</contributor>
</contributors>

<mailingLists>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/scijava/ui/UserInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ default File chooseFile(final File file, final String style) {
// TODO use a utility class for style handling, e.g. StyleUtils.isStyle(style, ...)
if (style == null) title = "Choose a file";
else if (style.toLowerCase().contains(FileWidget.DIRECTORY_STYLE)) title = "Choose a directory";
else if (style.toLowerCase().contains(FileWidget.FILE_AND_DIRECTORY_STYLE )) title = "Choose a file or directory";
else if (style.toLowerCase().contains(FileWidget.OPEN_STYLE)) title = "Open";
else if (style.toLowerCase().contains(FileWidget.SAVE_STYLE)) title = "Save";
else title = "Choose a file";
Expand All @@ -180,6 +181,7 @@ default File chooseFile(final File file, final String style) {
* <li>{@link FileWidget#OPEN_STYLE}</li>
* <li>{@link FileWidget#SAVE_STYLE}</li>
* <li>{@link FileWidget#DIRECTORY_STYLE}</li>
* <li>{@link FileWidget#FILE_AND_DIRECTORY_STYLE}</li>
* </ul>
* @return The {@link File} chosen by the user, or null if prompt is not
* available
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/scijava/widget/FileWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@ public interface FileWidget<U> extends InputWidget<File, U> {
*/
String DIRECTORY_STYLE = "directory";

/**
* Widget style for directory chooser dialogs.
*
* @see org.scijava.plugin.Parameter#style()
*/
String FILE_AND_DIRECTORY_STYLE = "both";

}

0 comments on commit 00512f5

Please sign in to comment.