About model driven engineering
How to debug your MagicDraw plugin with Eclipse
After reading this post, you are now MagicDraw open API experts! But you still need to debug your plugins! Here is a short presentation on how to debug your MagicDraw plugin with Eclipse.
Create your MagicDraw user library
First of all you need to create a user library (Window>Preferences>Java>Build Path>User Libraries) in Eclipse containing every *.jar from the “<MagicDraw_Install_Dir>/lib” and its subfolders.
Create your debug project
Create a new Java Project, and then you need to reference your plugin project in the build path of your debug project : (Right click on the project>Configure build path)
Here I take the Eclipse project given in this post.
Then you need to create a main class which will init your plugin and launch MagicDraw :
package fr.free.mdwhatever.magicdrawDebug;
import com.nomagic.magicdraw.core.Application;
import com.nomagic.runtime.ApplicationExitedException;
import fr.free.mdwhatever.simplePlugin.SimplePlugin;
/**
* This class allows you to debug your MagicDraw plugin
*
* @author Xavier Seignard
*/
public class Debug {
/**
* @param args
*/
public static void main(String[] args) {
try {
SimplePlugin plugin = new SimplePlugin();
Application app = Application.getInstance();
// Start the application (visible, not silent,
// don't try to load a project, the given args,
// the StartUp participant)
app.start(true, false, false, args, null);
plugin.init();
} catch (ApplicationExitedException e) {
e.printStackTrace();
}
}
}
Then all you need to do is to right-click on this class and choose “Debug as” to launch MagicDraw within the Eclipse debugger and use all the functionalities it gives us!
Nota : Maybe you’ll need to tune up a bit more your debug configuration by adding “-Xmx1024m” as VM argument as shown below :
Hope this helps! See you!
This entry was posted by xavier on 03/07/2010 at 6 h 08 min, and is filed under Model Driven. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed. |
Comments are closed.
about 13 years ago
Hi!!
I use -Xmx1024m argument but Magicdraw throw an OutOfMemoryException.
Any idea?
Thanks
about 13 years ago
Hello,
I’m glad to see that my tutorial is useful!
What’s your configuration? eclipse, magicdraw, jvm versions?
Maybe you should increase the heap size to -Xmx1536m? Or more if you have enough RAM.
If it doesn’t do the trick, can you send me the full stack trace so we can start to investigate?
Regards,
Xavier
about 12 years ago
Hi,
i have to configure As below for Magic Draw 17
Eclipse ini parameters : -Xmx1536m
RunConfiguration vm parameters : -Xmx1024m -XX:PermSize=40M -XX:MaxPermSize=150m
about 12 years ago
Bonjour,
Je n’arrive pas à faire en sorte que les affichages System.out apparaissent sur la console Eclipse (tout est imprimé sur md.log).
As tu une idée?