svn commit: r12529 - trunk/src_new/org/argouml/ui/cmd

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-05-04 10:15:05-0700
New Revision: 12529

Modified:
   trunk/src_new/org/argouml/ui/cmd/GenericArgoMenuBar.java
   trunk/src_new/org/argouml/ui/cmd/InitMenusLater.java
   trunk/src_new/org/argouml/ui/cmd/PrintManager.java
   trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java

Log:
Update deprecated Cmd* usage

Modified: trunk/src_new/org/argouml/ui/cmd/GenericArgoMenuBar.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/cmd/GenericArgoMenuBar.java?view=diff&rev=12529&p1=trunk/src_new/org/argouml/ui/cmd/GenericArgoMenuBar.java&p2=trunk/src_new/org/argouml/ui/cmd/GenericArgoMenuBar.java&r1=12528&r2=12529
==============================================================================
--- trunk/src_new/org/argouml/ui/cmd/GenericArgoMenuBar.java	(original)
+++ trunk/src_new/org/argouml/ui/cmd/GenericArgoMenuBar.java	2007-05-04 10:15:05-0700
@@ -71,10 +71,10 @@
 import org.argouml.uml.ui.ActionSequenceDiagram;
 import org.argouml.uml.ui.ActionStateDiagram;
 import org.argouml.uml.ui.ActionUseCaseDiagram;
-import org.tigris.gef.base.CmdAdjustPageBreaks;
-import org.tigris.gef.base.CmdSelectAll;
-import org.tigris.gef.base.CmdSelectInvert;
-import org.tigris.gef.base.CmdZoom;
+import org.tigris.gef.base.AdjustPageBreaksAction;
+import org.tigris.gef.base.SelectAllAction;
+import org.tigris.gef.base.SelectInvertAction;
+import org.tigris.gef.base.ZoomAction;
 import org.tigris.toolbar.ToolBar;
 
 /**
@@ -401,7 +401,7 @@
         setMnemonic(select, "Select");
         edit.add(select);
 
-        JMenuItem selectAllItem = select.add(new CmdSelectAll());
+        JMenuItem selectAllItem = select.add(new SelectAllAction());
         setMnemonic(selectAllItem, "Select All");
         ShortcutMgr.assignAccelerator(selectAllItem,
                 ShortcutMgr.ACTION_SELECT_ALL);
@@ -416,7 +416,7 @@
                 ShortcutMgr.ACTION_NAVIGATE_FORWARD);
         select.addSeparator();
 
-        JMenuItem selectInvert = select.add(new CmdSelectInvert());
+        JMenuItem selectInvert = select.add(new SelectInvertAction());
         setMnemonic(selectInvert, "Invert Selection");
         ShortcutMgr.assignAccelerator(selectInvert,
                 ShortcutMgr.ACTION_SELECT_INVERT);
@@ -484,17 +484,17 @@
         JMenu zoom = (JMenu) view.add(new JMenu(menuLocalize("Zoom")));
         setMnemonic(zoom, "Zoom");
 
-        CmdZoom cmdZoomOut = new CmdZoom(ZOOM_FACTOR);
-        JMenuItem zoomOut = zoom.add(cmdZoomOut);
+        ZoomAction zoomOutAction = new ZoomAction(ZOOM_FACTOR);
+        JMenuItem zoomOut = zoom.add(zoomOutAction);
         setMnemonic(zoomOut, "Zoom Out");
         ShortcutMgr.assignAccelerator(zoomOut, ShortcutMgr.ACTION_ZOOM_OUT);
 
-        JMenuItem zoomReset = zoom.add(new CmdZoom(0.0));
+        JMenuItem zoomReset = zoom.add(new ZoomAction(0.0));
         setMnemonic(zoomReset, "Zoom Reset");
         ShortcutMgr.assignAccelerator(zoomReset, ShortcutMgr.ACTION_ZOOM_RESET);
 
-        CmdZoom cmdZoomIn = new CmdZoom((1.0) / (ZOOM_FACTOR));
-        JMenuItem zoomIn = zoom.add(cmdZoomIn);
+        ZoomAction zoomInAction = new ZoomAction((1.0) / (ZOOM_FACTOR));
+        JMenuItem zoomIn = zoom.add(zoomInAction);
         setMnemonic(zoomIn, "Zoom In");
         ShortcutMgr.assignAccelerator(zoomIn, ShortcutMgr.ACTION_ZOOM_IN);
 
@@ -532,7 +532,7 @@
                     ShortcutMgr.ACTION_ADJUST_GUIDE + cmdAS.getValue("ID"));
         }
 
-        JMenuItem adjustPageBreaks = view.add(new CmdAdjustPageBreaks());
+        JMenuItem adjustPageBreaks = view.add(new AdjustPageBreaksAction());
         setMnemonic(adjustPageBreaks, "Adjust Pagebreaks");
         ShortcutMgr.assignAccelerator(adjustPageBreaks,
                 ShortcutMgr.ACTION_ADJUST_PAGE_BREAKS);

Modified: trunk/src_new/org/argouml/ui/cmd/InitMenusLater.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/cmd/InitMenusLater.java?view=diff&rev=12529&p1=trunk/src_new/org/argouml/ui/cmd/InitMenusLater.java&p2=trunk/src_new/org/argouml/ui/cmd/InitMenusLater.java&r1=12528&r2=12529
==============================================================================
--- trunk/src_new/org/argouml/ui/cmd/InitMenusLater.java	(original)
+++ trunk/src_new/org/argouml/ui/cmd/InitMenusLater.java	2007-05-04 10:15:05-0700
@@ -27,8 +27,9 @@
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
 
+import org.argouml.i18n.Translator;
 import org.tigris.gef.base.AlignAction;
-import org.tigris.gef.base.CmdReorder;
+import org.tigris.gef.base.ReorderAction;
 import org.tigris.gef.base.DistributeAction;
 
 /**
@@ -184,29 +185,33 @@
      *            the main Reorder menu
      */
     private static void initReorderMenu(JMenu reorder) {
-        JMenuItem reorderBringForward = reorder.add(new CmdReorder(
-                CmdReorder.BRING_FORWARD));
+        JMenuItem reorderBringForward = reorder.add(new ReorderAction(
+                Translator.localize("action.bring-forward"),
+                ReorderAction.BRING_FORWARD));
         GenericArgoMenuBar.setMnemonic(reorderBringForward,
                 "reorder bring forward");
         ShortcutMgr.assignAccelerator(reorderBringForward,
                 ShortcutMgr.ACTION_REORDER_FORWARD);
 
-        JMenuItem reorderSendBackward = reorder.add(new CmdReorder(
-                CmdReorder.SEND_BACKWARD));
+        JMenuItem reorderSendBackward = reorder.add(new ReorderAction(
+                Translator.localize("action.send-backward"),
+                ReorderAction.SEND_BACKWARD));
         GenericArgoMenuBar.setMnemonic(reorderSendBackward,
                 "reorder send backward");
         ShortcutMgr.assignAccelerator(reorderSendBackward,
                 ShortcutMgr.ACTION_REORDER_BACKWARD);
 
-        JMenuItem reorderBringToFront = reorder.add(new CmdReorder(
-                CmdReorder.BRING_TO_FRONT));
+        JMenuItem reorderBringToFront = reorder.add(new ReorderAction(
+                Translator.localize("action.bring-to-front"),
+                ReorderAction.BRING_TO_FRONT));
         GenericArgoMenuBar.setMnemonic(reorderBringToFront,
                 "reorder bring to front");
         ShortcutMgr.assignAccelerator(reorderBringToFront,
                 ShortcutMgr.ACTION_REORDER_TO_FRONT);
 
-        JMenuItem reorderSendToBack = reorder.add(new CmdReorder(
-                CmdReorder.SEND_TO_BACK));
+        JMenuItem reorderSendToBack = reorder.add(new ReorderAction(
+                Translator.localize("action.send-to.back"),
+                ReorderAction.SEND_TO_BACK));
         GenericArgoMenuBar.setMnemonic(reorderSendToBack,
                 "reorder send to back");
         ShortcutMgr.assignAccelerator(reorderSendToBack,

Modified: trunk/src_new/org/argouml/ui/cmd/PrintManager.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/cmd/PrintManager.java?view=diff&rev=12529&p1=trunk/src_new/org/argouml/ui/cmd/PrintManager.java&p2=trunk/src_new/org/argouml/ui/cmd/PrintManager.java&r1=12528&r2=12529
==============================================================================
--- trunk/src_new/org/argouml/ui/cmd/PrintManager.java	(original)
+++ trunk/src_new/org/argouml/ui/cmd/PrintManager.java	2007-05-04 10:15:05-0700
@@ -25,17 +25,15 @@
 package org.argouml.ui.cmd;
 
 import org.argouml.kernel.ProjectManager;
-import org.tigris.gef.base.CmdPrint;
 import org.tigris.gef.base.Diagram;
+import org.tigris.gef.base.PrintAction;
 
-////////////////////////////////////////////////////////////////
-//file menu actions
 /**
  * print the current active diagram.
  */
 public class PrintManager {
 
-    private final CmdPrint printCmd = new CmdPrint();
+    private final PrintAction printCmd = new PrintAction();
 
     private static final PrintManager INSTANCE = new PrintManager();
 
@@ -50,6 +48,7 @@
      * The constructor.
      */
     private PrintManager() {
+        // instantiation not allowed
     }
 
     /**
@@ -59,14 +58,12 @@
         Object target = ProjectManager.getManager().getCurrentProject()
                 .getActiveDiagram();
         if (target instanceof Diagram) {
-            String n = ((Diagram) target).getName();
-            printCmd.setDiagramName(n);
-            printCmd.doIt();
+            printCmd.actionPerformed(null);
         }
     }
 
-    /*
-     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+    /**
+     * Show the page setup dialog.
      */
     public void showPageSetupDialog() {
         printCmd.doPageSetup();

Modified: trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java?view=diff&rev=12529&p1=trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java&p2=trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java&r1=12528&r2=12529
==============================================================================
--- trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java	(original)
+++ trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java	2007-05-04 10:15:05-0700
@@ -69,13 +69,13 @@
 import org.argouml.uml.ui.ActionStateDiagram;
 import org.argouml.uml.ui.ActionUseCaseDiagram;
 import org.argouml.util.KeyEventUtils;
+import org.tigris.gef.base.AdjustPageBreaksAction;
 import org.tigris.gef.base.AlignAction;
-import org.tigris.gef.base.CmdAdjustPageBreaks;
-import org.tigris.gef.base.CmdReorder;
-import org.tigris.gef.base.CmdSelectAll;
-import org.tigris.gef.base.CmdSelectInvert;
-import org.tigris.gef.base.CmdZoom;
 import org.tigris.gef.base.DistributeAction;
+import org.tigris.gef.base.ReorderAction;
+import org.tigris.gef.base.SelectAllAction;
+import org.tigris.gef.base.SelectInvertAction;
+import org.tigris.gef.base.ZoomAction;
 
 /**
  * This class manages all Argo's shortcuts
@@ -597,7 +597,7 @@
 
         // edit menu
         putDefaultShortcut(ACTION_SELECT_ALL, KeyStroke.getKeyStroke(
-                KeyEvent.VK_A, DEFAULT_MASK), new CmdSelectAll());
+                KeyEvent.VK_A, DEFAULT_MASK), new SelectAllAction());
         putDefaultShortcut(ACTION_REDO, KeyStroke.getKeyStroke(KeyEvent.VK_Y,
                 DEFAULT_MASK), ProjectBrowser.getInstance().getRedoAction());
         putDefaultShortcut(ACTION_UNDO, KeyStroke.getKeyStroke(KeyEvent.VK_Z,
@@ -606,7 +606,8 @@
                 new NavigateTargetForwardAction());
         putDefaultShortcut(ACTION_NAVIGATE_BACK, null,
                 new NavigateTargetBackAction());
-        putDefaultShortcut(ACTION_SELECT_INVERT, null, new CmdSelectInvert());
+        putDefaultShortcut(ACTION_SELECT_INVERT, null, 
+                new SelectInvertAction());
         putDefaultShortcut(ACTION_PERSPECTIVE_CONFIG, null,
                 new ActionPerspectiveConfig());
         putDefaultShortcut(ACTION_SETTINGS, null, new ActionSettings());
@@ -619,7 +620,7 @@
 
         // view menu
         putDefaultShortcut(ACTION_GO_TO_DIAGRAM, null, new ActionGotoDiagram());
-        putDefaultShortcut(ACTION_ZOOM_RESET, null, new CmdZoom(0.0));
+        putDefaultShortcut(ACTION_ZOOM_RESET, null, new ZoomAction(0.0));
         
         List gridActions = ActionAdjustGrid.createAdjustGridActions(true);
         Iterator i = gridActions.iterator();
@@ -638,13 +639,13 @@
         }
 
         putDefaultShortcut(ACTION_ADJUST_PAGE_BREAKS, null,
-                new CmdAdjustPageBreaks());
+                new AdjustPageBreaksAction());
         putDefaultShortcut(ACTION_SHOW_XML_DUMP, null, new ActionShowXMLDump());
         putDefaultShortcut(ACTION_ZOOM_IN, KeyStroke.getKeyStroke(
-                KeyEvent.VK_PLUS, DEFAULT_MASK), new CmdZoom(
+                KeyEvent.VK_PLUS, DEFAULT_MASK), new ZoomAction(
                         (1.0) / (GenericArgoMenuBar.ZOOM_FACTOR)));
         putDefaultShortcut(ACTION_ZOOM_OUT, KeyStroke.getKeyStroke(
-                KeyEvent.VK_MINUS, DEFAULT_MASK), new CmdZoom(
+                KeyEvent.VK_MINUS, DEFAULT_MASK), new ZoomAction(
                         GenericArgoMenuBar.ZOOM_FACTOR));
         putDefaultShortcut(ACTION_FIND, KeyStroke.getKeyStroke(KeyEvent.VK_F3,
                 0), new ActionFind());
@@ -721,17 +722,21 @@
                 new DistributeAction(DistributeAction.V_CENTERS));
 
         // reorder submenu
+        // TODO: I think this requires I18N, but not sure - tfm
         putDefaultShortcut(ACTION_REORDER_FORWARD, KeyStroke.getKeyStroke(
-                KeyEvent.VK_F, DEFAULT_MASK), new CmdReorder(
-                        CmdReorder.BRING_FORWARD));
+                KeyEvent.VK_F, DEFAULT_MASK), new ReorderAction("Forward",
+                        ReorderAction.BRING_FORWARD));
         putDefaultShortcut(ACTION_REORDER_BACKWARD, KeyStroke.getKeyStroke(
-                KeyEvent.VK_B, DEFAULT_MASK), new CmdReorder(
-                        CmdReorder.SEND_BACKWARD));
+                KeyEvent.VK_B, DEFAULT_MASK), new ReorderAction(
+                        "Backward",
+                        ReorderAction.SEND_BACKWARD));
         putDefaultShortcut(ACTION_REORDER_TO_FRONT, KeyStroke.getKeyStroke(
-                KeyEvent.VK_F, SHIFTED_DEFAULT_MASK), new CmdReorder(
-                        CmdReorder.BRING_TO_FRONT));
+                KeyEvent.VK_F, SHIFTED_DEFAULT_MASK), new ReorderAction(
+                        "ToFront",
+                        ReorderAction.BRING_TO_FRONT));
         putDefaultShortcut(ACTION_REORDER_TO_BACK, KeyStroke.getKeyStroke(
-                KeyEvent.VK_B, SHIFTED_DEFAULT_MASK), new CmdReorder(
-                        CmdReorder.SEND_TO_BACK));
+                KeyEvent.VK_B, SHIFTED_DEFAULT_MASK), new ReorderAction(
+                        "ToBack",
+                        ReorderAction.SEND_TO_BACK));
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.