You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2018/06/04 10:27:20 UTC
svn commit: r1832807 - in
/sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui:
Main.java metadata/ResourceView.java
Author: desruisseaux
Date: Mon Jun 4 10:27:20 2018
New Revision: 1832807
URL: http://svn.apache.org/viewvc?rev=1832807&view=rev
Log:
Remember the filter used last time the user opened a file.
Modified:
sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/Main.java
sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/ResourceView.java
Modified: sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/Main.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/Main.java?rev=1832807&r1=1832806&r2=1832807&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/Main.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/Main.java [UTF-8] Mon Jun 4 10:27:20 2018
@@ -16,6 +16,7 @@
*/
package org.apache.sis.gui;
+import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
@@ -74,6 +75,11 @@ public class Main extends Application {
private FileChooser.ExtensionFilter[] openFilters;
/**
+ * The last filter used by the {@link #open()} action.
+ */
+ private FileChooser.ExtensionFilter lastFilter;
+
+ /**
* Creates a new Apache SIS application.
*/
public Main() {
@@ -174,12 +180,17 @@ public class Main extends Application {
private void open() {
if (openFilters == null) {
createFileFilters();
+ lastFilter = openFilters[1];
}
final FileChooser chooser = new FileChooser();
chooser.setTitle(Resources.format(Resources.Keys.OpenDataFile));
chooser.getExtensionFilters().addAll(openFilters);
- chooser.setSelectedExtensionFilter(openFilters[1]); // TODO: remember last filter used.
- content.open(chooser.showOpenMultipleDialog(window));
+ chooser.setSelectedExtensionFilter(lastFilter);
+ final List<File> files = chooser.showOpenMultipleDialog(window);
+ if (files != null) {
+ lastFilter = chooser.getSelectedExtensionFilter();
+ content.open(files);
+ }
}
/**
Modified: sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/ResourceView.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/ResourceView.java?rev=1832807&r1=1832806&r2=1832807&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/ResourceView.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/ResourceView.java [UTF-8] Mon Jun 4 10:27:20 2018
@@ -210,13 +210,11 @@ public class ResourceView {
}
public void open(final List<File> files) {
- if (files != null) {
- for (final File file : files) {
- if (file.isDirectory()) {
- openDirectory(file);
- } else {
- openFile(file);
- }
+ for (final File file : files) {
+ if (file.isDirectory()) {
+ openDirectory(file);
+ } else {
+ openFile(file);
}
}
}