Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileWidget.FILE_AND_DIRECTORY_STYLE #480

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
imagejan marked this conversation as resolved.
Show resolved Hide resolved
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";

}
Loading