svn commit: r17025 - trunk/src/argouml-app/src/org/argouml/uml/ui/ActionSaveAllGraphics.java

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-04-02 06:56:36-0700
New Revision: 17025

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/ui/ActionSaveAllGraphics.java

Log:
command line support for saving all graphics of all currently open projects

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/ActionSaveAllGraphics.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/ActionSaveAllGraphics.java?view=diff&pathrev=17025&r1=17024&r2=17025
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/ActionSaveAllGraphics.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/ActionSaveAllGraphics.java	2009-04-02 06:56:36-0700
@@ -37,6 +37,7 @@
 import javax.swing.JOptionPane;
 
 import org.apache.log4j.Logger;
+import org.argouml.application.api.CommandLineInterface;
 import org.argouml.application.events.ArgoEventPump;
 import org.argouml.application.events.ArgoEventTypes;
 import org.argouml.application.events.ArgoStatusEvent;
@@ -48,6 +49,7 @@
 import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.DiagramUtils;
 import org.argouml.util.ArgoFrame;
+import org.argouml.util.SuffixFilter;
 import org.tigris.gef.base.Diagram;
 import org.tigris.gef.base.SaveGraphicsAction;
 import org.tigris.gef.util.Util;
@@ -63,7 +65,9 @@
  * @author Leonardo Souza Mario Bueno ([email protected])
  */
 
-public class ActionSaveAllGraphics extends AbstractAction {
+public class ActionSaveAllGraphics extends AbstractAction
+    implements CommandLineInterface {
+
     private static final Logger LOG =
         Logger.getLogger(ActionSaveAllGraphics.class);
     
@@ -281,4 +285,30 @@
         ArgoEventPump.fireEvent(new ArgoStatusEvent(
                 ArgoEventTypes.STATUS_TEXT, this, text));
     }
+
+    /**
+     * Execute this action from the command line.
+     *
+     * @see org.argouml.application.api.CommandLineInterface#doCommand(String)
+     * @param argument is the directory name that we save to.
+     * @return true if it is OK.
+     */
+    public boolean doCommand(String argument) {
+        File dir = new File(argument);
+        if (!dir.exists() || !dir.isDirectory()) {
+            LOG.error("The argument must be a path to an existing directory.");
+            return false;
+        }
+        boolean result = true;
+        for (Project p : ProjectManager.getManager().getOpenProjects()) {
+            TargetManager tm = TargetManager.getInstance();
+            for (ArgoDiagram d : p.getDiagramList()) {
+                tm.setTarget(d);
+                if (!trySaveDiagram(d, dir)) {
+                    result = false;
+                }
+            }
+        }
+        return result;
+    }
 }

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1519239

To unsubscribe from this discussion, e-mail: [[email protected]].
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.