|
@@ -33,7 +33,6 @@ import java.util.ArrayList;
|
33
|
33
|
import java.util.List;
|
34
|
34
|
|
35
|
35
|
import javax.swing.JFileChooser;
|
36
|
|
-import javax.swing.filechooser.FileSystemView;
|
37
|
36
|
|
38
|
37
|
/**
|
39
|
38
|
* JFileChooser that uses KDialog to show the actual chooser.
|
|
@@ -64,9 +63,6 @@ public class KFileChooser extends JFileChooser {
|
64
|
63
|
*/
|
65
|
64
|
private static final long serialVersionUID = 200806141;
|
66
|
65
|
|
67
|
|
- /** File Filter */
|
68
|
|
- private String fileFilter = null;
|
69
|
|
-
|
70
|
66
|
/** The plugin that this file chooser is for. */
|
71
|
67
|
private final DCCManager plugin;
|
72
|
68
|
/** Used to read settings from. */
|
|
@@ -97,33 +93,6 @@ public class KFileChooser extends JFileChooser {
|
97
|
93
|
this.config = config;
|
98
|
94
|
}
|
99
|
95
|
|
100
|
|
- /**
|
101
|
|
- * Constructs a FileChooser using the given current directory and FileSystemView.
|
102
|
|
- *
|
103
|
|
- * @param plugin The plugin that owns this KFileChooser
|
104
|
|
- * @param currentDirectory Directory to use as the base directory
|
105
|
|
- * @param fsv The FileSystemView to use
|
106
|
|
- */
|
107
|
|
- private KFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final File currentDirectory, final FileSystemView fsv) {
|
108
|
|
- super(currentDirectory, fsv);
|
109
|
|
-
|
110
|
|
- this.plugin = plugin;
|
111
|
|
- this.config = config;
|
112
|
|
- }
|
113
|
|
-
|
114
|
|
- /**
|
115
|
|
- * Constructs a FileChooser using the given FileSystemView.
|
116
|
|
- *
|
117
|
|
- * @param plugin The plugin that owns this KFileChooser
|
118
|
|
- * @param fsv The FileSystemView to use
|
119
|
|
- */
|
120
|
|
- private KFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final FileSystemView fsv) {
|
121
|
|
- super(fsv);
|
122
|
|
-
|
123
|
|
- this.plugin = plugin;
|
124
|
|
- this.config = config;
|
125
|
|
- }
|
126
|
|
-
|
127
|
96
|
/**
|
128
|
97
|
* Constructs a FileChooser using the given path.
|
129
|
98
|
*
|
|
@@ -137,20 +106,6 @@ public class KFileChooser extends JFileChooser {
|
137
|
106
|
this.config = config;
|
138
|
107
|
}
|
139
|
108
|
|
140
|
|
- /**
|
141
|
|
- * Constructs a FileChooser using the given current directory path and FileSystemView.
|
142
|
|
- *
|
143
|
|
- * @param plugin The plugin that owns this KFileChooser
|
144
|
|
- * @param currentDirectoryPath Directory to use as the base directory
|
145
|
|
- * @param fsv The FileSystemView to use
|
146
|
|
- */
|
147
|
|
- private KFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final String currentDirectoryPath, final FileSystemView fsv) {
|
148
|
|
- super(currentDirectoryPath, fsv);
|
149
|
|
-
|
150
|
|
- this.plugin = plugin;
|
151
|
|
- this.config = config;
|
152
|
|
- }
|
153
|
|
-
|
154
|
109
|
/**
|
155
|
110
|
* Should a KFileChooser be used rather than a JFileChooser?
|
156
|
111
|
*
|
|
@@ -186,31 +141,6 @@ public class KFileChooser extends JFileChooser {
|
186
|
141
|
return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin, currentDirectory) : new JFileChooser(currentDirectory);
|
187
|
142
|
}
|
188
|
143
|
|
189
|
|
- /**
|
190
|
|
- * Constructs a FileChooser using the given current directory and FileSystemView.
|
191
|
|
- *
|
192
|
|
- * @param config Config provider used to retrieve settings
|
193
|
|
- * @param plugin The DCC Plugin that is requesting a chooser
|
194
|
|
- * @param currentDirectory Directory to use as the base directory
|
195
|
|
- * @param fsv The FileSystemView to use
|
196
|
|
- * @return The relevant FileChooser
|
197
|
|
- */
|
198
|
|
- public static JFileChooser getFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final File currentDirectory, final FileSystemView fsv) {
|
199
|
|
- return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin, currentDirectory, fsv) : new JFileChooser(currentDirectory, fsv);
|
200
|
|
- }
|
201
|
|
-
|
202
|
|
- /**
|
203
|
|
- * Constructs a FileChooser using the given FileSystemView.
|
204
|
|
- *
|
205
|
|
- * @param config Config provider used to retrieve settings
|
206
|
|
- * @param plugin The DCC Plugin that is requesting a chooser
|
207
|
|
- * @param fsv The FileSystemView to use
|
208
|
|
- * @return The relevant FileChooser
|
209
|
|
- */
|
210
|
|
- public static JFileChooser getFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final FileSystemView fsv) {
|
211
|
|
- return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin, fsv) : new JFileChooser(fsv);
|
212
|
|
- }
|
213
|
|
-
|
214
|
144
|
/**
|
215
|
145
|
* Constructs a FileChooser using the given path.
|
216
|
146
|
*
|
|
@@ -223,37 +153,6 @@ public class KFileChooser extends JFileChooser {
|
223
|
153
|
return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin, currentDirectoryPath) : new JFileChooser(currentDirectoryPath);
|
224
|
154
|
}
|
225
|
155
|
|
226
|
|
- /**
|
227
|
|
- * Constructs a FileChooser using the given current directory path and FileSystemView.
|
228
|
|
- *
|
229
|
|
- * @param config Config provider used to retrieve settings
|
230
|
|
- * @param plugin The DCC Plugin that is requesting a chooser
|
231
|
|
- * @param currentDirectoryPath Directory to use as the base directory
|
232
|
|
- * @param fsv The FileSystemView to use
|
233
|
|
- * @return The relevant FileChooser
|
234
|
|
- */
|
235
|
|
- public static JFileChooser getFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final String currentDirectoryPath, final FileSystemView fsv) {
|
236
|
|
- return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin, currentDirectoryPath, fsv) : new JFileChooser(currentDirectoryPath, fsv);
|
237
|
|
- }
|
238
|
|
-
|
239
|
|
- /**
|
240
|
|
- * Set the file filter.
|
241
|
|
- *
|
242
|
|
- * @param fileFilter File filter (eg "*.php *.jpg" or null for no filter)
|
243
|
|
- */
|
244
|
|
- public void setKDEFileFilter(final String fileFilter) {
|
245
|
|
- this.fileFilter = fileFilter;
|
246
|
|
- }
|
247
|
|
-
|
248
|
|
- /**
|
249
|
|
- * Get the file filter.
|
250
|
|
- *
|
251
|
|
- * @return File filter (eg "*.php *.jpg" or null for no filter)
|
252
|
|
- */
|
253
|
|
- public String getKDEFileFilter() {
|
254
|
|
- return fileFilter;
|
255
|
|
- }
|
256
|
|
-
|
257
|
156
|
/** {@inheritDoc} */
|
258
|
157
|
@Override
|
259
|
158
|
public int showOpenDialog(final Component parent) throws HeadlessException {
|
|
@@ -288,10 +187,6 @@ public class KFileChooser extends JFileChooser {
|
288
|
187
|
params.add(getCurrentDirectory().getPath());
|
289
|
188
|
}
|
290
|
189
|
|
291
|
|
- if (getFileSelectionMode() != DIRECTORIES_ONLY && fileFilter != null && !fileFilter.isEmpty()) {
|
292
|
|
- params.add(fileFilter);
|
293
|
|
- }
|
294
|
|
-
|
295
|
190
|
KDialogProcess kdp;
|
296
|
191
|
try {
|
297
|
192
|
kdp = new KDialogProcess(params.toArray(new String[params.size()]));
|