Update of /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sql/fw/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4902
Modified Files:
TablePopupMenu.java
Log Message:
add undo force edit
Index: TablePopupMenu.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sql/fw/gui/TablePopupMenu.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** TablePopupMenu.java 26 Apr 2004 15:23:31 -0000 1.9
--- TablePopupMenu.java 8 May 2004 23:05:17 -0000 1.10
***************
*** 22,26 ****
import java.awt.event.MouseEvent;
- import javax.swing.Action;
import javax.swing.JMenuItem;
import javax.swing.JTable;
--- 22,25 ----
***************
*** 30,33 ****
--- 29,33 ----
import net.sourceforge.squirrel_sql.fw.gui.action.TableCopyHtmlCommand;
import net.sourceforge.squirrel_sql.fw.gui.action.MakeEditableCommand;
+ import net.sourceforge.squirrel_sql.fw.gui.action.UndoMakeEditableCommand;
import net.sourceforge.squirrel_sql.fw.gui.action.TableSelectAllCellsCommand;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
***************
*** 36,40 ****
import net.sourceforge.squirrel_sql.fw.datasetviewer.DataSetViewerTablePanel;
- import net.sourceforge.squirrel_sql.fw.datasetviewer.MyTableModel;
public class TablePopupMenu extends BasePopupMenu
--- 36,39 ----
***************
*** 62,65 ****
--- 61,65 ----
// private ClearAction _clear = new ClearAction();
private MakeEditableAction _makeEditable = new MakeEditableAction();
+ private UndoMakeEditableAction _undoMakeEditable = new UndoMakeEditableAction();
private DeleteRowsAction _deleteRows = new DeleteRowsAction();
protected InsertRowAction _insertRow = new InsertRowAction();
***************
*** 92,96 ****
_viewer = viewer;
! addMenuItems(allowEditing);
}
--- 92,118 ----
_viewer = viewer;
! // add the menu items to the menu
! _menuItems[IOptionTypes.COPY] = add(_copy);
! _menuItems[IOptionTypes.COPY_HTML] = add(_copyHtml);
! if (allowEditing)
! {
! addSeparator();
! add(_makeEditable);
! }
! // if ( ! allowEditing )
! if (updateableModel != null && updateableModel.editModeIsForced())
! {
! add(_undoMakeEditable);
! }
! addSeparator();
! _menuItems[IOptionTypes.SELECT_ALL] = add(_select);
!
! // add entries for insert and delete rows
! // only if table is updateable and already editable (ie. allowEditing is false)
! if (_updateableModel != null && allowEditing==false) {
! addSeparator();
! add(_insertRow);
! add(_deleteRows);
! }
}
***************
*** 170,193 ****
}
- private void addMenuItems(boolean allowEditing)
- {
- _menuItems[IOptionTypes.COPY] = add(_copy);
- _menuItems[IOptionTypes.COPY_HTML] = add(_copyHtml);
- if (allowEditing)
- {
- addSeparator();
- add(_makeEditable);
- }
- addSeparator();
- _menuItems[IOptionTypes.SELECT_ALL] = add(_select);
-
- // add entries for insert and delete rows
- // only if table is updateable and already editable (ie. allowEditing is false)
- if (_updateableModel != null && allowEditing==false) {
- addSeparator();
- add(_insertRow);
- add(_deleteRows);
- }
- }
// private class ClearAction extends BaseAction
--- 192,195 ----
***************
*** 284,287 ****
--- 286,305 ----
}
+
+ private class UndoMakeEditableAction extends BaseAction
+ {
+ UndoMakeEditableAction()
+ {
+ super(s_stringMgr.getString("TablePopupMenu.undomakeeditable"));
+ }
+
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (_updateableModel != null)
+ {
+ new UndoMakeEditableCommand(_updateableModel).execute();
+ }
+ }
+ }
private class DeleteRowsAction extends BaseAction
{
|