19 package org.sleuthkit.autopsy.keywordsearch;
 
   21 import java.awt.EventQueue;
 
   22 import java.awt.event.ActionListener;
 
   23 import java.awt.event.KeyEvent;
 
   24 import java.beans.PropertyChangeEvent;
 
   25 import java.beans.PropertyChangeListener;
 
   27 import java.util.ArrayList;
 
   28 import java.util.List;
 
   29 import javax.swing.JFileChooser;
 
   30 import javax.swing.JOptionPane;
 
   31 import javax.swing.event.ListSelectionEvent;
 
   32 import javax.swing.event.ListSelectionListener;
 
   33 import javax.swing.filechooser.FileNameExtensionFilter;
 
   34 import javax.swing.table.AbstractTableModel;
 
   35 import org.netbeans.spi.options.OptionsPanelController;
 
   36 import org.openide.util.NbBundle;
 
   43 class GlobalListsManagementPanel 
extends javax.swing.JPanel implements OptionsPanel {
 
   45     private static final long serialVersionUID = 1L;
 
   46     private final KeywordListTableModel tableModel;
 
   50         this.globalListSettingsPanel = gsp;
 
   51         tableModel = 
new KeywordListTableModel();
 
   53         customizeComponents();
 
   56     private void customizeComponents() {
 
   57         listsTable.setAutoscrolls(
true);
 
   58         listsTable.setTableHeader(null);
 
   59         listsTable.setShowHorizontalLines(
false);
 
   60         listsTable.setShowVerticalLines(
false);
 
   61         exportButton.setToolTipText(NbBundle.getMessage(
this.getClass(), 
"KeywordSearchEditListPanel.customizeComponents.exportToFile"));
 
   62         copyListButton.setToolTipText(NbBundle.getMessage(
this.getClass(), 
"KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip"));
 
   63         listsTable.getParent().setBackground(listsTable.getBackground());
 
   65         listsTable.setCellSelectionEnabled(
false);
 
   66         listsTable.setRowSelectionAllowed(
true);
 
   70         listsTable.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
 
   72             public void valueChanged(ListSelectionEvent e) {
 
   73                 globalListSettingsPanel.setFocusOnKeywordTextBox();
 
   78         IngestManager.getInstance().addIngestJobEventListener(
new PropertyChangeListener() {
 
   80             public void propertyChange(PropertyChangeEvent evt) {
 
   81                 Object source = evt.getSource();
 
   82                 if (source instanceof String && ((String) source).equals(
"LOCAL")) { 
 
   83                     EventQueue.invokeLater(() -> {
 
   84                         globalListSettingsPanel.setFocusOnKeywordTextBox();
 
   92     void addDeleteButtonActionPerformed(ActionListener l) {
 
   93         deleteListButton.addActionListener(l);
 
   96     void addRenameButtonActionPerformed(ActionListener l) {
 
   97         renameListButton.addActionListener(l);
 
  100     void addCopyButtonActionPerformed(ActionListener l) {
 
  101         copyListButton.addActionListener(l);
 
  107     private void newKeywordListAction() {
 
  108         XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
 
  109         String listName = 
"";
 
  112         listName = (String) JOptionPane.showInputDialog(null, NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.newKwListTitle"),
 
  113                 NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.newKeywordListMsg"), JOptionPane.PLAIN_MESSAGE, null, null, listName);
 
  115         if (listName == null || listName.trim().isEmpty()) {
 
  118         boolean shouldAdd = 
false;
 
  119         if (writer.listExists(listName)) {
 
  120             if (writer.getList(listName).isEditable()) {
 
  121                 boolean replace = KeywordSearchUtil.displayConfirmDialog(
 
  122                         NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.newKeywordListMsg"),
 
  123                         NbBundle.getMessage(
this.getClass(), 
"KeywordSearchListsManagementPanel.newKeywordListDescription", listName),
 
  124                         KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
 
  129                 boolean replace = KeywordSearchUtil.displayConfirmDialog(
 
  130                         NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.newKeywordListMsg"),
 
  131                         NbBundle.getMessage(
this.getClass(), 
"KeywordSearchListsManagementPanel.newKeywordListDescription2", listName),
 
  132                         KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
 
  141             writer.addList(listName, 
new ArrayList<>());
 
  147         for (
int i = 0; i < listsTable.getRowCount(); i++) {
 
  148             if (listsTable.getValueAt(i, 0).equals(listName)) {
 
  149                 listsTable.getSelectionModel().addSelectionInterval(i, i);
 
  157     void setButtonStates() {
 
  158         boolean isIngestRunning = IngestManager.getInstance().isIngestRunning();
 
  159         boolean isListSelected = !listsTable.getSelectionModel().isSelectionEmpty();
 
  160         boolean canEditList = isListSelected && !isIngestRunning;
 
  162         importButton.setEnabled(!isIngestRunning);
 
  165         deleteListButton.setEnabled(canEditList);
 
  166         renameListButton.setEnabled(canEditList);
 
  169         copyListButton.setEnabled(isListSelected);
 
  170         exportButton.setEnabled(isListSelected);
 
  178     @SuppressWarnings(
"unchecked")
 
  180     private 
void initComponents() {
 
  182         jScrollPane1 = 
new javax.swing.JScrollPane();
 
  183         listsTable = 
new javax.swing.JTable();
 
  184         newListButton = 
new javax.swing.JButton();
 
  185         importButton = 
new javax.swing.JButton();
 
  186         keywordListsLabel = 
new javax.swing.JLabel();
 
  187         exportButton = 
new javax.swing.JButton();
 
  188         copyListButton = 
new javax.swing.JButton();
 
  189         deleteListButton = 
new javax.swing.JButton();
 
  190         renameListButton = 
new javax.swing.JButton();
 
  192         setMinimumSize(
new java.awt.Dimension(250, 0));
 
  194         listsTable.setModel(tableModel);
 
  195         listsTable.setMaximumSize(
new java.awt.Dimension(30000, 30000));
 
  196         listsTable.setShowHorizontalLines(
false);
 
  197         listsTable.setShowVerticalLines(
false);
 
  198         listsTable.getTableHeader().setReorderingAllowed(
false);
 
  199         listsTable.addKeyListener(
new java.awt.event.KeyAdapter() {
 
  200             public void keyPressed(java.awt.event.KeyEvent evt) {
 
  201                 listsTableKeyPressed(evt);
 
  204         jScrollPane1.setViewportView(listsTable);
 
  206         newListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/add16.png"))); 
 
  207         newListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, 
"GlobalListsManagementPanel.newListButton.text")); 
 
  208         newListButton.setIconTextGap(2);
 
  209         newListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
 
  210         newListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
 
  211         newListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
 
  212         newListButton.setPreferredSize(
new java.awt.Dimension(111, 25));
 
  213         newListButton.addActionListener(
new java.awt.event.ActionListener() {
 
  214             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  215                 newListButtonActionPerformed(evt);
 
  219         importButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/import16.png"))); 
 
  220         importButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, 
"GlobalListsManagementPanel.importButton.text")); 
 
  221         importButton.setIconTextGap(2);
 
  222         importButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
 
  223         importButton.setMaximumSize(
new java.awt.Dimension(111, 25));
 
  224         importButton.setMinimumSize(
new java.awt.Dimension(111, 25));
 
  225         importButton.setPreferredSize(
new java.awt.Dimension(111, 25));
 
  226         importButton.addActionListener(
new java.awt.event.ActionListener() {
 
  227             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  228                 importButtonActionPerformed(evt);
 
  232         keywordListsLabel.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, 
"GlobalListsManagementPanel.keywordListsLabel.text")); 
 
  234         exportButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/export16.png"))); 
 
  235         exportButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, 
"GlobalListsManagementPanel.exportButton.text")); 
 
  236         exportButton.setIconTextGap(2);
 
  237         exportButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
 
  238         exportButton.setMaximumSize(
new java.awt.Dimension(111, 25));
 
  239         exportButton.setMinimumSize(
new java.awt.Dimension(111, 25));
 
  240         exportButton.setPreferredSize(
new java.awt.Dimension(111, 25));
 
  241         exportButton.addActionListener(
new java.awt.event.ActionListener() {
 
  242             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  243                 exportButtonActionPerformed(evt);
 
  247         copyListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/new16.png"))); 
 
  248         copyListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, 
"GlobalListsManagementPanel.copyListButton.text")); 
 
  249         copyListButton.setIconTextGap(2);
 
  250         copyListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
 
  251         copyListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
 
  252         copyListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
 
  253         copyListButton.setPreferredSize(
new java.awt.Dimension(111, 25));
 
  254         copyListButton.addActionListener(
new java.awt.event.ActionListener() {
 
  255             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  256                 copyListButtonActionPerformed(evt);
 
  260         deleteListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); 
 
  261         deleteListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, 
"GlobalListsManagementPanel.deleteListButton.text")); 
 
  262         deleteListButton.setIconTextGap(2);
 
  263         deleteListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
 
  264         deleteListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
 
  265         deleteListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
 
  266         deleteListButton.setPreferredSize(
new java.awt.Dimension(111, 25));
 
  267         deleteListButton.addActionListener(
new java.awt.event.ActionListener() {
 
  268             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  269                 deleteListButtonActionPerformed(evt);
 
  273         renameListButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/edit16.png"))); 
 
  274         renameListButton.setText(
org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, 
"GlobalListsManagementPanel.renameListButton.text")); 
 
  275         renameListButton.setIconTextGap(2);
 
  276         renameListButton.setMargin(
new java.awt.Insets(2, 6, 2, 6));
 
  277         renameListButton.setMaximumSize(
new java.awt.Dimension(111, 25));
 
  278         renameListButton.setMinimumSize(
new java.awt.Dimension(111, 25));
 
  279         renameListButton.setPreferredSize(
new java.awt.Dimension(111, 25));
 
  280         renameListButton.addActionListener(
new java.awt.event.ActionListener() {
 
  281             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  282                 renameListButtonActionPerformed(evt);
 
  286         javax.swing.GroupLayout layout = 
new javax.swing.GroupLayout(
this);
 
  287         this.setLayout(layout);
 
  288         layout.setHorizontalGroup(
 
  289             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  290             .addGroup(layout.createSequentialGroup()
 
  292                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  293                     .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  294                     .addGroup(layout.createSequentialGroup()
 
  295                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 
  296                             .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  297                             .addComponent(copyListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 
  299                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  300                             .addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  301                             .addComponent(renameListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 
  303                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  304                             .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  305                             .addComponent(deleteListButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
 
  306                         .addGap(0, 0, Short.MAX_VALUE))
 
  307                     .addComponent(keywordListsLabel))
 
  311         layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, 
new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, newListButton, renameListButton});
 
  313         layout.setVerticalGroup(
 
  314             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  315             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
 
  317                 .addComponent(keywordListsLabel)
 
  318                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  319                 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
 
  320                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  321                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 
  322                     .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  323                     .addComponent(renameListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  324                     .addComponent(deleteListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 
  326                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 
  327                     .addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  328                     .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  329                     .addComponent(copyListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 
  333         layout.linkSize(javax.swing.SwingConstants.VERTICAL, 
new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, newListButton, renameListButton});
 
  337     private void newListButtonActionPerformed(java.awt.event.ActionEvent evt) {
 
  338         newKeywordListAction();
 
  339         firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
 
  340         globalListSettingsPanel.setFocusOnKeywordTextBox();
 
  343     private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {
 
  345         JFileChooser chooser = 
new JFileChooser();
 
  346         final String[] AUTOPSY_EXTENSIONS = 
new String[]{
"xml"}; 
 
  347         final String[] ENCASE_EXTENSIONS = 
new String[]{
"txt"}; 
 
  348         FileNameExtensionFilter autopsyFilter = 
new FileNameExtensionFilter(
 
  349                 NbBundle.getMessage(
this.getClass(), 
"KeywordSearchListsManagementPanel.fileExtensionFilterLbl"), AUTOPSY_EXTENSIONS);
 
  350         FileNameExtensionFilter encaseFilter = 
new FileNameExtensionFilter(
 
  351                 NbBundle.getMessage(
this.getClass(), 
"KeywordSearchListsManagementPanel.fileExtensionFilterLb2"), ENCASE_EXTENSIONS);
 
  352         chooser.addChoosableFileFilter(autopsyFilter);
 
  353         chooser.addChoosableFileFilter(encaseFilter);
 
  354         chooser.setAcceptAllFileFilterUsed(
false);
 
  355         chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
 
  357         String listName = null;
 
  358         int returnVal = chooser.showOpenDialog(
this);
 
  359         if (returnVal == JFileChooser.APPROVE_OPTION) {
 
  360             File selFile = chooser.getSelectedFile();
 
  361             if (selFile == null) {
 
  366             String fileAbs = selFile.getAbsolutePath();
 
  368             final KeywordSearchList reader;
 
  370             if (KeywordSearchUtil.isXMLList(fileAbs)) {
 
  371                 reader = 
new XmlKeywordSearchList(fileAbs);
 
  373                 reader = 
new EnCaseKeywordSearchList(fileAbs);
 
  376             if (!reader.load()) {
 
  377                 KeywordSearchUtil.displayDialog(
 
  378                         NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.importListFileDialogMsg", fileAbs), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
 
  382             List<KeywordList> toImport = reader.getListsL();
 
  383             List<KeywordList> toImportConfirmed = 
new ArrayList<>();
 
  385             final XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent();
 
  387             for (KeywordList list : toImport) {
 
  389                 listName = list.getName();
 
  390                 if (writer.listExists(listName)) {
 
  391                     Object[] options = {NbBundle.getMessage(this.getClass(), 
"KeywordSearch.yesOwMsg"),
 
  392                         NbBundle.getMessage(this.getClass(), 
"KeywordSearch.noSkipMsg"),
 
  393                         NbBundle.getMessage(this.getClass(), 
"KeywordSearch.cancelImportMsg")};
 
  394                     int choice = JOptionPane.showOptionDialog(
this,
 
  395                             NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.overwriteListPrompt", listName),
 
  396                             NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.importOwConflict"),
 
  397                             JOptionPane.YES_NO_CANCEL_OPTION,
 
  398                             JOptionPane.QUESTION_MESSAGE,
 
  402                     if (choice == JOptionPane.OK_OPTION) {
 
  403                         toImportConfirmed.add(list);
 
  404                     } 
else if (choice == JOptionPane.CANCEL_OPTION) {
 
  410                     toImportConfirmed.add(list);
 
  415             if (toImportConfirmed.isEmpty()) {
 
  419             if (!writer.writeLists(toImportConfirmed)) {
 
  420                 KeywordSearchUtil.displayDialog(
 
  421                         NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(
this.getClass(), 
"KeywordSearch.kwListFailImportMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
 
  428         if (listName != null) {
 
  429             for (
int i = 0; i < listsTable.getRowCount(); i++) {
 
  430                 if (listsTable.getValueAt(i, 0).equals(listName)) {
 
  431                     listsTable.getSelectionModel().addSelectionInterval(i, i);
 
  435         firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
 
  437     private void listsTableKeyPressed(java.awt.event.KeyEvent evt) {
 
  438         if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
 
  439             int[] selected = listsTable.getSelectedRows();
 
  440             if (selected.length == 0) {
 
  442             } 
else if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(
this.getClass(), 
"KeywordSearchConfigurationPanel1.customizeComponents.title"), NbBundle.getMessage(
this.getClass(), 
"KeywordSearchConfigurationPanel1.customizeComponents.body"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
 
  443                 String listName = (String) listsTable.getModel().getValueAt(selected[0], 0);
 
  444                 XmlKeywordSearchList.getCurrent().deleteList(listName);
 
  445                 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
 
  453     private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {
 
  455         final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
 
  456                 "KeywordSearchEditListPanel.exportButtonAction.featureName.text");
 
  458         JFileChooser chooser = 
new JFileChooser();
 
  459         final String EXTENSION = 
"xml"; 
 
  460         FileNameExtensionFilter filter = 
new FileNameExtensionFilter(
 
  461                 NbBundle.getMessage(
this.getClass(), 
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION);
 
  462         chooser.setFileFilter(filter);
 
  463         String listName = listsTable.getValueAt(listsTable.getSelectedRow(), 0).toString();
 
  465         chooser.setSelectedFile(
new File(listName));
 
  466         chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
 
  468         int returnVal = chooser.showSaveDialog(
this);
 
  469         if (returnVal == JFileChooser.APPROVE_OPTION) {
 
  470             File selFile = chooser.getSelectedFile();
 
  471             if (selFile == null) {
 
  476             String fileAbs = selFile.getAbsolutePath();
 
  477             if (!fileAbs.endsWith(
"." + EXTENSION)) {
 
  478                 fileAbs = fileAbs + 
"." + EXTENSION;
 
  479                 selFile = 
new File(fileAbs);
 
  482             boolean shouldWrite = 
true;
 
  483             if (selFile.exists()) {
 
  484                 shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
 
  485                         NbBundle.getMessage(
this.getClass(), 
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt",
 
  486                                 selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
 
  492             XmlKeywordSearchList reader = XmlKeywordSearchList.getCurrent();
 
  494             List<KeywordList> toWrite = 
new ArrayList<>();
 
  495             toWrite.add(reader.getList(listName));
 
  496             final XmlKeywordSearchList exporter = 
new XmlKeywordSearchList(fileAbs);
 
  497             boolean written = exporter.saveLists(toWrite);
 
  499                 KeywordSearchUtil.displayDialog(FEATURE_NAME,
 
  500                         NbBundle.getMessage(
this.getClass(), 
"KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"),
 
  501                         KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
 
  506     private void copyListButtonActionPerformed(java.awt.event.ActionEvent evt) {
 
  507         firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
 
  510     private void deleteListButtonActionPerformed(java.awt.event.ActionEvent evt) {
 
  511         firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
 
  514     private void renameListButtonActionPerformed(java.awt.event.ActionEvent evt) {
 
  515         firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
 
  519     private javax.swing.JButton copyListButton;
 
  520     private javax.swing.JButton deleteListButton;
 
  521     private javax.swing.JButton exportButton;
 
  522     private javax.swing.JButton importButton;
 
  523     private javax.swing.JScrollPane jScrollPane1;
 
  524     private javax.swing.JLabel keywordListsLabel;
 
  525     private javax.swing.JTable listsTable;
 
  526     private javax.swing.JButton newListButton;
 
  527     private javax.swing.JButton renameListButton;
 
  531     public void store() {
 
  537         listsTable.clearSelection();
 
  546         private static final long serialVersionUID = 1L;
 
  548         private final XmlKeywordSearchList 
listsHandle = XmlKeywordSearchList.getCurrent();
 
  557             return listsHandle.getNumberLists(
false);
 
  562             return NbBundle.getMessage(this.getClass(), 
"KeywordSearchListsManagementPanel.getColName.text");
 
  567             return listsHandle.getListNames(
false).get(rowIndex);
 
  576         public void setValueAt(Object aValue, 
int rowIndex, 
int columnIndex) {
 
  577             throw new UnsupportedOperationException(
 
  578                     NbBundle.getMessage(
this.getClass(), 
"KeywordSearchListsManagementPanel.setValueAt.exception.msg"));
 
  587         void deleteSelected(
int[] selected) {
 
  588             List<String> toDel = 
new ArrayList<>();
 
  589             for (
int i = 0; i < selected.length; i++) {
 
  590                 toDel.add((String) 
getValueAt(0, selected[i]));
 
  592             for (String del : toDel) {
 
  593                 listsHandle.deleteList(del);
 
  599             fireTableDataChanged();
 
  603     void addListSelectionListener(ListSelectionListener l) {
 
  604         listsTable.getSelectionModel().addListSelectionListener(l);
 
final XmlKeywordSearchList listsHandle
 
Object getValueAt(int rowIndex, int columnIndex)
 
void setValueAt(Object aValue, int rowIndex, int columnIndex)
 
Class<?> getColumnClass(int c)
 
String getColumnName(int column)
 
boolean isCellEditable(int rowIndex, int columnIndex)