svn commit: r16199 - trunk/src/argouml-app/src/org/argouml/uml/diagram: . ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-11-28 09:33:36-0800
New Revision: 16199

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ArgoDiagramImpl.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/UMLDiagram.java

Log:
Protect against null current project

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ArgoDiagramImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ArgoDiagramImpl.java?view=diff&rev=16199&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ArgoDiagramImpl.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ArgoDiagramImpl.java&r1=16198&r2=16199
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ArgoDiagramImpl.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ArgoDiagramImpl.java	2008-11-28 09:33:36-0800
@@ -166,8 +166,10 @@
     private void constructorInit() {
         // TODO: These should get replaced immediately by the creating
         // initialization code, but make sure we've got a default just in case.
-        settings = ProjectManager.getManager().getCurrentProject()
-                .getProjectSettings().getDefaultDiagramSettings();
+        Project project = ProjectManager.getManager().getCurrentProject();
+        if (project != null) {
+            settings = project.getProjectSettings().getDefaultDiagramSettings();
+        }
         // TODO: we should be given an Undo manager to use rather than looking
         // for a global one
         if (!(UndoManager.getInstance() instanceof DiagramUndoManager)) {

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/UMLDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/UMLDiagram.java?view=diff&rev=16199&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/UMLDiagram.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/UMLDiagram.java&r1=16198&r2=16199
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/UMLDiagram.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/UMLDiagram.java	2008-11-28 09:33:36-0800
@@ -603,11 +603,10 @@
      */
     protected String getNewDiagramName() {
         String name = getLabelName() + " " + getNextDiagramSerial();
-        //        Project project = getProject();
-        // TODO: If this gets called from the constructor the project
-        // won't be set yet. Figure out another way to handle it
-        Project project = ProjectManager.getManager().getCurrentProject();
-        if (!project.isValidDiagramName(name)) {
+        Project project = getProject();
+        // If this gets called from the constructor the project
+        // won't be set yet, so we'll allow anything
+        if (project != null && !project.isValidDiagramName(name)) {
             name = getNewDiagramName();
         }
         return name;
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.