svn commit: r16017 - trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramUtils.java
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: tfmorris
Date: 2008-11-10 15:35:32-0800
New Revision: 16017
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramUtils.java
Log:
Make getActiveLayer more bulletproof
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramUtils.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramUtils.java?view=diff&rev=16017&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramUtils.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramUtils.java&r1=16016&r2=16017
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramUtils.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramUtils.java 2008-11-10 15:35:32-0800
@@ -25,8 +25,10 @@
package org.argouml.uml.diagram;
import org.apache.log4j.Logger;
+import org.tigris.gef.base.Editor;
import org.tigris.gef.base.Globals;
import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.LayerManager;
import org.tigris.gef.base.LayerPerspective;
/**
@@ -58,9 +60,15 @@
* return null.
*/
private static LayerPerspective getActiveLayer() {
- Layer layer = Globals.curEditor().getLayerManager().getActiveLayer();
- if (layer instanceof LayerPerspective) {
- return (LayerPerspective) layer;
+ Editor editor = Globals.curEditor();
+ if (editor != null) {
+ LayerManager manager = editor.getLayerManager();
+ if (manager != null) {
+ Layer layer = getActiveLayer();
+ if (layer instanceof LayerPerspective) {
+ return (LayerPerspective) layer;
+ }
+ }
}
return null;
}