svn commit: r16684 - trunk/src/argouml-app/src/org/argouml/uml/diagram: collaboration/ui ui

Michiel van der Wulp <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2009-01-21 04:38:45-0800
New Revision: 16684

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java

Log:
Fix for issue 5638: ClassifierRole toolbelt should create uniassociationRole.
Also fixes an exception when testing this toolbelt button.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java?view=diff&pathrev=16684&r1=16683&r2=16684
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java	2009-01-21 04:38:45-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -29,11 +29,17 @@
 import org.argouml.application.helpers.ResourceLoaderWrapper;
 import org.argouml.model.Model;
 import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2;
+import org.tigris.gef.base.Editor;
+import org.tigris.gef.base.Globals;
+import org.tigris.gef.base.Mode;
+import org.tigris.gef.base.ModeManager;
 import org.tigris.gef.presentation.Fig;
+import org.tigris.gef.presentation.Handle;
 
 /**
- * The selection buttons for a classifier role.
- *
+ * The selection buttons for a classifier role. <p>
+ * 
+ * The AssociationRoles created shall be unidirectional.
  */
 public class SelectionClassifierRole extends SelectionNodeClarifiers2 {
 
@@ -114,6 +120,13 @@
 
     @Override
     protected Object getNewEdgeType(int index) {
+        /* The next 4 lines fix the first half of issue 5638.
+         * Is there no better way? */
+        Editor curEditor = Globals.curEditor();
+        ModeManager modeManager = curEditor.getModeManager();
+        Mode mode = modeManager.top();
+        mode.setArg("unidirectional", true);
+
         return Model.getMetaTypes().getAssociationRole();
     }
 
@@ -135,4 +148,16 @@
         return false;
     }
 
+    @Override
+    public void dragHandle(int mx, int my, int anX, int anY, Handle hand) {
+        super.dragHandle(mx, my, anX, anY, hand);
+
+        /* The next 4 lines fix the 2nd half of issue 5638.
+         * Is there no better way? */
+        Editor curEditor = Globals.curEditor();
+        ModeManager modeManager = curEditor.getModeManager();
+        Mode mode = modeManager.top();
+        mode.setArg("unidirectional", true);
+    }
+
 } 

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java?view=diff&pathrev=16684&r1=16683&r2=16684
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java	2009-01-21 04:38:45-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -351,6 +351,11 @@
      * be called from renderingChanged()?
      */
     protected void applyArrowHeads() {
+        if (srcGroup == null || destGroup == null) {
+            /* This only happens if model-change events arrive 
+             * before we are completely constructed. */
+            return;
+        }
         int sourceArrowType = srcGroup.getArrowType();
         int destArrowType = destGroup.getArrowType();

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

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.