コード例 #1
0
ファイル: CorpusEditor.java プロジェクト: kzn/gate
 public void actionPerformed(ActionEvent e) {
   Component root = SwingUtilities.getRoot(CorpusEditor.this);
   if (!(root instanceof MainFrame)) {
     return;
   }
   final MainFrame mainFrame = (MainFrame) root;
   final int[] selectedRows = docTable.getSelectedRows();
   if (selectedRows.length > 10) {
     Object[] possibleValues = {"Open the " + selectedRows.length + " documents", "Don't open"};
     int selectedValue =
         JOptionPane.showOptionDialog(
             docTable,
             "Do you want to open "
                 + selectedRows.length
                 + " documents in the central tabbed pane ?",
             "Warning",
             JOptionPane.DEFAULT_OPTION,
             JOptionPane.QUESTION_MESSAGE,
             null,
             possibleValues,
             possibleValues[1]);
     if (selectedValue == 1 || selectedValue == JOptionPane.CLOSED_OPTION) {
       return;
     }
   }
   for (int row : selectedRows) {
     // load the document if inside a datastore
     corpus.get(docTable.rowViewToModel(row));
   }
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           for (int row : selectedRows) {
             Document doc = (Document) corpus.get(docTable.rowViewToModel(row));
             // show the document in the central view
             mainFrame.select(doc);
           }
         }
       });
 }