Method is used in OpenDSAction @return the opened datastore or null if an error occurs
()
| 3598 | * @return the opened datastore or null if an error occurs |
| 3599 | */ |
| 3600 | protected DataStore openSearchableDataStore() { |
| 3601 | DataStore ds = null; |
| 3602 | |
| 3603 | // get the URL (a file in this case) |
| 3604 | fileChooser.setDialogTitle("Select the datastore directory"); |
| 3605 | fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
| 3606 | fileChooser.setResource("gate.DataStore.data"); |
| 3607 | if(fileChooser.showOpenDialog(MainFrame.this) |
| 3608 | == JFileChooser.APPROVE_OPTION) { |
| 3609 | try { |
| 3610 | URL dsURL = fileChooser.getSelectedFile().toURI().toURL(); |
| 3611 | ds = |
| 3612 | Factory.openDataStore("gate.persist.LuceneDataStoreImpl", dsURL |
| 3613 | .toExternalForm()); |
| 3614 | } |
| 3615 | catch(MalformedURLException mue) { |
| 3616 | JOptionPane.showMessageDialog(MainFrame.this, |
| 3617 | "Invalid location for the datastore\n " + mue.toString(), "GATE", |
| 3618 | JOptionPane.ERROR_MESSAGE); |
| 3619 | } |
| 3620 | catch(PersistenceException pe) { |
| 3621 | JOptionPane.showMessageDialog(MainFrame.this, |
| 3622 | "Datastore opening error!\n " + pe.toString(), "GATE", |
| 3623 | JOptionPane.ERROR_MESSAGE); |
| 3624 | } // catch |
| 3625 | } // if |
| 3626 | |
| 3627 | return ds; |
| 3628 | } // openSerialDataStore() |
| 3629 | |
| 3630 | class NewDSAction extends AbstractAction { |
| 3631 | private static final long serialVersionUID = 1L; |
no test coverage detected