How to debug with eclipse?

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

How to debug with eclipse?

Postby Petar Blagoev » Fri Jul 06, 2007 9:40 am

Hallo,
I would like to debug my plugin while running the MagicDraw.
Is there a possibility to switch MD to debug modus and to bind it
into eclipse debuger?

regards,
petar
--
Composed with Newz Crawler 1.8 http://www.newzcrawler.com/
Petar Blagoev
 
Posts Rating:

Re: How to debug with eclipse?

Postby Martynas Lelevicius » Mon Jul 09, 2007 2:28 am

Hello,

To debug plugin do these things:
1. Put all MagicDraw jars and your plugin jar to classpath.
2. Put breakpoint in your plugin code.
3. Start in debug mode class com.nomagic.magicdraw.Main for vm arguments
specify this:
-Xmx800M -XX:PermSize=130M

Regards,
--
Martynas Lelevicius
Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
E-mail : marte
WWW: http://www.magicdraw.com

Martynas Lelevicius
 
Posts Rating:

Re: How to debug with eclipse?

Postby Bill Watkins » Thu Aug 02, 2007 4:04 pm

I tried this using the example plugin from the OpenAPI manual. The example
plugin appears to work OK if I use MagicDraw (v12.1 SP2) normally.

If I use Eclipse (3.2) to set a breakpoint in the example source per the
instructions below, the MagicDraw splash screen comes up, and the debugger
pauses twice in Main. After the second resume in the debugger, the splash
screen status message is "Checking floating license..." and the application
freezes. I can kill the application from the debugger without any apparent
problems, but this is at the end of the MD.log file:

2007-08-02 16:49:46,060 [main] INFO PLUGINS - Plugin [ name = Plugin
Example, id = my.first.plugin, provider = Watkins, version = 1.0, class =
MyPlugin.MyPlugin, requires api = 1.0, runtime = [Ljava.net.URL;@7d8e4]
Exception in thread "main" java.lang.NoClassDefFoundError:
com/nomagic/floatinglicense/export/FLTooManyUsersConnectedException
at
com.nomagic.magicdraw.core.Application.getFLManager(Application.java:339)
at
com.nomagic.magicdraw.core.Application.internalStart(Application.java:576)
at com.nomagic.magicdraw.core.Application.start(Application.java:451)
at com.nomagic.magicdraw.core.Application.start(Application.java:435)
at com.nomagic.magicdraw.Main.main(Main.java:13)

There were at least three MD floating licenses available both before and
after I ran the debugger. Does the debugger somehow cause MD to grab
mulitple licenses or is something else locking up?

Thanks,
Bill Watkins

"Martynas Lelevicius" <marte> wrote in message
news:22221156.1183976524794.JavaMail.tadjar@peleda...
> Hello,
>
> To debug plugin do these things:
> 1. Put all MagicDraw jars and your plugin jar to classpath.
> 2. Put breakpoint in your plugin code.
> 3. Start in debug mode class com.nomagic.magicdraw.Main for vm arguments
> specify this:
> -Xmx800M -XX:PermSize=130M


Bill Watkins
 
Posts Rating:

Re: How to debug with eclipse?

Postby Bill Watkins » Thu Aug 02, 2007 4:13 pm

PS - I get the same error if I use an offline floating license.


Bill Watkins
 
Posts Rating:

Re: How to debug with eclipse?

Postby Martynas Lelevicius » Thu Aug 02, 2007 11:41 pm

Hello Bill,

Add <MagicDraw install dir>/lib/fl_common.jar file to your classpath.

Best regards,
--
Martynas Lelevicius
Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
E-mail : marte
WWW: http://www.magicdraw.com

Martynas Lelevicius
 
Posts Rating:

Re: How to debug with eclipse?

Postby Bill Watkins » Fri Aug 03, 2007 11:41 am

Thanks, Martynas, that got me down the road a bit further, but the debugger
then halted on:

Exception in thread "main" java.lang.NoClassDefFoundError:
com/nomagic/teamwork/common/projects/ProjectInfo
at
com.nomagic.magicdraw.actions.ActionsCreator.createGeneralActions(ActionsCreator.java:230)
at
com.nomagic.magicdraw.actions.ActionsProvider.createGeneralActions(ActionsProvider.java:425)
at com.nomagic.magicdraw.actions.q.f(q.java:105)
at com.nomagic.magicdraw.actions.q.a(q.java:48)
at
com.nomagic.magicdraw.core.Application.getActionsManager(Application.java:393)
at com.nomagic.magicdraw.actions.MDAction.updateState(MDAction.java:70)
at com.nomagic.actions.NMAction.setGroup(NMAction.java:434)
at com.nomagic.actions.NMAction.<init>(NMAction.java:84)
at com.nomagic.magicdraw.actions.MDAction.<init>(MDAction.java:38)
at com.nomagic.magicdraw.ui.diagrams.pc.<init>(pc.java:39)
at com.nomagic.magicdraw.ui.diagrams.o.b(o.java:84)
at
com.nomagic.magicdraw.core.Application.internalStart(Application.java:605)
at com.nomagic.magicdraw.core.Application.start(Application.java:451)
at com.nomagic.magicdraw.core.Application.start(Application.java:435)
at com.nomagic.magicdraw.Main.main(Main.java:13)

Given the clue you provided, a took a wild guess and also added <MagicDraw
install dir>/lib/tw_common.jar, and this fixed the problem.

The ability to debug plugins this way is really great!

Thanks,
Bill Watkins


"Martynas Lelevicius" <marte> wrote in message
news:1972552.1186126472906.JavaMail.tadjar@peleda...
> Hello Bill,
>
> Add <MagicDraw install dir>/lib/fl_common.jar file to your classpath.
>
> Best regards,
> --
> Martynas Lelevicius
> Programmer
> No Magic Lithuanian Development Center
> Savanoriu pr. 363, LT-49425, Kaunas
> P.O. box 2166, LT-44011, Kaunas
> Phone: +370 37 324032 Fax: +370 37 320670
> E-mail : marte
> WWW: http://www.magicdraw.com
>


Bill Watkins
 
Posts Rating:

Re: How to debug with eclipse?

Postby Martynas Lelevicius » Mon Aug 06, 2007 2:00 am

Hi,

In priciple you can add all jars (except md_commontw.jar) from the
<MagicDraw install dir>/lib dir to your class path.

Regards,
--
Martynas Lelevicius
Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
E-mail : marte
WWW: http://www.magicdraw.com

Martynas Lelevicius
 
Posts Rating:


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests

cron