Posts Tagged MagicDraw
I’m working on a shared project (a “teamwork project” in MagicDraw parlance), so I think I’d better ask before removing corrupted elements. (You never know, those corrupted elements could be what’s keeping us going! :)
Today I moved a concepts-n-usage document from MagicDraw out to Subversion, and made a link from MagicDraw out to the Subversion, uh, version. The problem being, when I go there, it is rendered as raw HTML!
I tried “view page source” and it looked just the same. I tried to find a URL parameter to pass to tell it to render the HTML, but didn’t come up with anything.
Visions began to go through my mind of having to maintain the document in MagicDraw (but the html text control in MagicDraw is clunky… response is sluggish, and it’s too easy to accidentally delete things from your document, possibly without knowing it — it really seems like it’s designed for use as a possibly multiline text box, not multipage documents); or export a copy of what’s in Subversion to some location on the network that is then referenced (but how to automatically keep that up to date with the repository? Ug…) or have two versions, one in Subversion and one in MagicDraw and try to always remember to keep them in sync (I don’t know that I could ever be happy with that though, especially not after reading Test-Driven Development!)
So it was with angst and worry that I started looking for information about Subversion, and rendered vs. raw html. My search eventually led me to the section in the online Subversion book dealing with file content type. It took a few minutes for it to sink in, but finally I realized that there was a subversion property named svn:mime-type, and it looked like if I could set that, it might help with my rendering issue.
I wondered if you could set the Subversion properties in Eclipse. You can:
But what to set it to? (Now stop your snickering, all you MIME-savvy folks, I’m not hip on all this stuff so I have to look it up, okay? ;)
I looked through the MIME text media types, and text/html looked like the best thing, so I set that:
…and committed my changes…
…and now my link from MagicDraw renders beautifully:
I think there’s a way to set up Subversion to do this automatically for .html documents so that I wouldn’t have to explicitly set a property, but this is good enough for me today!
I wanted to create a class diagram for a method returning a Collection<Object> (that is, a Collection of Object arrays).
Why would I need something returning that type of thing? For JUnit parameterized tests.
It wasn’t immediately clear to me how to do this… but here’s how it ended up:
- Create a class. Name it Collection<Object> (which is what it will be in the end if this works!)
- In its Specification, go to Relations:
- Choose Create Outgoing…
- …Template Binding:
- In box that pops up, open the JDK 5.0 Classes folder and navigate to java.util. Find the Collection interfaces. Interestingly enough, we want the Collection one, not the Collection<E> one — Select the “< >” under the plain Collection interface:
…and click OK.
- Back at the class’s Relations page, press the Edit button:
- On the Template Binding dialog that comes up, go to the Template Parameter Substitutions page:
- Then choose press Create, and check the template parameter you want to fill in:
- Fill in the Actual field as Object… but because we want an object array, we also need to choose to show All properties, and then choose  for the Type Modifier field:
…and we’re done.
Or, we could just reverse engineer the code… : )
In MagicDraw (version 15.5) I was trying to link from methods in my class to the sequence diagrams for those methods, which works ok the first time, but when I try to link a second method to its sequence diagram, this time MagicDraw just seems to sit there after I press the Edit button:
At this point, MagicDraw is not responsive (I waited several minutes once) until I press the Escape key — that seems to cancel the operation so I can do other things.
I can work around this by commiting any changes I have made, exiting MagicDraw and coming back in, so that’s what I had been doing… but with three more links to do, I was interested in a better solution.
I also upped the memory available to MagicDraw to 900M in my mduml.properties file:
JAVA_ARGS=-Xmx900M -Xms900M -XX\:PermSize\=40M -XX\:MaxPermSize\=150M -Duser.language\=en -DLOCALCONFIG\=true -Dsun.java2d.noddraw
That didn’t seem to make a difference, though.
Then a co-worker nailed the reason: apparently MagicDraw (we’re on 15.5 at the moment) can ‘lose’ your popup dialog window when are running MagicDraw on the secondary monitor. As I told him:
I was running it on my secondary monitor.
Put it on my primary monitor.
Now it works.
Will try to remember to put time in the task estimate for this type of thing, next time. ;)
(Actually, Lock ‘n’ Commit…)
I opened a Teamwork (that is, shared) project from the MagicDraw Teamwork Server, but I couldn’t do much until I locked the elements I wanted to modify. When I right-clicked the diagram in the containment tree though, there was a Lock for Edit and a Lock for Edit Content:
Which should I choose?
MagicDraw provides a very fine-grained locking mechanism — there is a separate lock for each model element (class, method, property…) and each symbol element (diagram, class symbol, sequence diagram lifeline, note, class symbol, line of association…) If you’re going to be changing several things though, it really breaks the flow to keep having to lock things one by one.
When Editing a Diagram, Use Lock for Edit Content
That’s where Lock Content and Lock Recursively come in. At the diagram level, Lock for Edit only locks the diagram element itself, not everything on the diagram. So what I generally want is Lock for Edit Content there.
When Locking at the Folder Level, Use Lock Recursively
Later this week I was working on several sequence diagrams depicting different aspects of the same classes in the model. Rather than lock each new class in the model separately, I wanted to lock at the folder level. Right-clicking the folder in the containment tree, I can choose Lock Recursively to lock everything in the folder:
(Plain “Lock for Edit” would only lock the folder element itself, which is not what I generally need.)
Saving and Locks
To my current knowledge, saving a teamwork project means commiting your changes back to the teamwork server — I don’t think there’s a notion of a local working copy as there is with CVS or Subversion; I think the changes are all in memory until you commit.
By default, when you commit your changes you don’t release any locks that you have on the elements. To do that, on the Commit Settings dialog you go to the Locked Elements tab and select the elements you want to unlock on commit (normally “All”):
I’m just starting to use MagicDraw to make some class diagrams and sequence diagrams, and I’m experiencing some usage hiccups — things I expect to just be able to do, but can’t figure out how.
Here’s an issue that came up: I was working with a class diagram and had added a new initializeSystem method to a class, and it had shown up in the diagram… but then something I did led to the diagram not showing that method anymore. Instead it shows ellipses:
I tried several things but couldn’t seem to get it to show up.
Finally I had the idea to delete the class from the diagram and drag it back on from the model. That worked:
Is there a better way? This has more of the feel of a workaround…