Changeset 6209
- Timestamp:
- 2003-12-10T16:40:41+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/FileAssociationDialog.java
r6154 r6209 39 39 import java.awt.*; 40 40 import java.awt.event.*; 41 import java.io. *;41 import java.io.File; 42 42 import java.util.*; 43 43 import javax.swing.*; 44 44 import javax.swing.event.*; 45 import javax.swing.filechooser.*; 45 46 import javax.swing.table.*; 46 47 import org.greenstone.gatherer.Dictionary; … … 54 55 import org.greenstone.gatherer.util.TableUtils; 55 56 import org.greenstone.gatherer.util.Utility; 56 import org.outerj.pollo.util.*;57 57 58 58 /** The file association allows the entry of new file associations and the modification of existing ones. … … 253 253 } 254 254 255 /** Batch filter shows only files ending in bat. Based on ImageFilter.java which is a 1.4 example used by FileChooserDemo2.java. */ 256 private class BatchFileFilter 257 extends FileFilter { 258 259 /** Accept all .exe files 260 * @param file a File 261 * @return true is this file should be shown, false otherwise 262 */ 263 public boolean accept(File file) { 264 return file.getName().toLowerCase().endsWith(".bat"); 265 } 266 267 /** The description of this filter 268 * @return a String 269 */ 270 public String getDescription() { 271 return Dictionary.get("FileAssociationDialog.Batch_File"); 272 } 273 } 274 255 275 /** Whenever the user clicks the browse button, we should open up a file browser to allow them to select an executable file from somewhere in the file system. */ 256 276 private class BrowseButtonListener … … 263 283 OpenCollectionDialog.disableRename(chooser); 264 284 chooser.setDialogTitle(Dictionary.get("FileAssociationDialog.Browse_Title")); 265 chooser.setFileFilter(new ExtensionFileFilter(".bat", Dictionary.get("FileAssociationDialog.Batch_File")));266 chooser.setFileFilter(new ExtensionFileFilter(".com", Dictionary.get("FileAssociationDialog.Command_File")));267 chooser.setFileFilter(new Ex tensionFileFilter(".exe", Dictionary.get("FileAssociationDialog.Executable_File")));285 chooser.setFileFilter(new BatchFileFilter()); 286 chooser.setFileFilter(new CoreObjectModelFileFilter()); 287 chooser.setFileFilter(new ExecutableFileFilter()); 268 288 chooser.setAcceptAllFileFilterUsed(true); 269 289 if(chooser.showOpenDialog(Gatherer.g_man) == JFileChooser.APPROVE_OPTION) { … … 281 301 replace_button.setEnabled(false); 282 302 self.dispose(); 303 } 304 } 305 306 /** Command filter shows only files ending in com. Based on ImageFilter.java which is a 1.4 example used by FileChooserDemo2.java. */ 307 private class CoreObjectModelFileFilter 308 extends FileFilter { 309 310 /** Accept all .exe files 311 * @param file a File 312 * @return true is this file should be shown, false otherwise 313 */ 314 public boolean accept(File file) { 315 return file.getName().toLowerCase().endsWith(".com"); 316 } 317 318 /** The description of this filter 319 * @return a String 320 */ 321 public String getDescription() { 322 return Dictionary.get("FileAssociationDialog.Command_File"); 283 323 } 284 324 } … … 368 408 } 369 409 410 /** Executable filter shows only files ending in exe. Based on ImageFilter.java which is a 1.4 example used by FileChooserDemo2.java. */ 411 private class ExecutableFileFilter 412 extends FileFilter { 413 414 /** Accept all .exe files 415 * @param file a File 416 * @return true is this file should be shown, false otherwise 417 */ 418 public boolean accept(File file) { 419 return file.getName().toLowerCase().endsWith(".exe"); 420 } 421 422 /** The description of this filter 423 * @return a String 424 */ 425 public String getDescription() { 426 return Dictionary.get("FileAssociationDialog.Executable_File"); 427 } 428 } 429 370 430 private class ExistingAssociationsTableListener 371 431 implements ListSelectionListener {
Note:
See TracChangeset
for help on using the changeset viewer.