Merge branch 'subtree'
[fanfix.git] / src / jexer / TTableWindow.java
index 9365892f59cb26b4389c9e7d18f9d5cbe2c248f1..766ceafdd901a0a4044105aba5114093cf7ef7a6 100644 (file)
@@ -112,7 +112,6 @@ public class TTableWindow extends TScrollableWindow {
      */
     public void onFocus() {
         // Enable the table menu items.
-        getApplication().enableMenuItem(TMenu.MID_CUT);
         getApplication().enableMenuItem(TMenu.MID_TABLE_RENAME_COLUMN);
         getApplication().enableMenuItem(TMenu.MID_TABLE_RENAME_ROW);
         getApplication().enableMenuItem(TMenu.MID_TABLE_VIEW_ROW_LABELS);
@@ -171,7 +170,6 @@ public class TTableWindow extends TScrollableWindow {
      */
     public void onUnfocus() {
         // Disable the table menu items.
-        getApplication().disableMenuItem(TMenu.MID_CUT);
         getApplication().disableMenuItem(TMenu.MID_TABLE_RENAME_COLUMN);
         getApplication().disableMenuItem(TMenu.MID_TABLE_RENAME_ROW);
         getApplication().disableMenuItem(TMenu.MID_TABLE_VIEW_ROW_LABELS);
@@ -343,6 +341,20 @@ public class TTableWindow extends TScrollableWindow {
             return;
         }
 
+        if (command.equals(cmSave)) {
+            try {
+                String filename = fileSaveBox(".");
+                if (filename != null) {
+                    tableField.saveToCsvFilename(filename);
+                }
+            } catch (IOException e) {
+                messageBox(i18n.getString("errorDialogTitle"),
+                    MessageFormat.format(i18n.
+                        getString("errorWritingFile"), e.getMessage()));
+            }
+            return;
+        }
+
         // Didn't handle it, let children get it instead
         super.onCommand(command);
     }