Error - trying to load MD project using openAPI from eclipse

Starting point for “ask and learn more about MagicDraw”

Moderator: Moderators

Error - trying to load MD project using openAPI from eclipse

Postby sasii4u@gmail.com » Thu Oct 18, 2018 3:42 am

I am getting the following error when trying to load the magic draw project from eclipse.

Code snippet and error for reference, please let me know the solution

1. projectsManager = Application.getInstance().projectsManager
2. val mdFile = new File("Model.mdzip")
3. projectDescriptor = ProjectDescriptorsFactory.createProjectDescriptor(mdFile.toURI())
4. projectsManager.loadProject(projectDescriptor, true)

Getting following error for line 4 - loadProject

java.lang.NullPointerException
at com.nomagic.runtime.Bridge.GUIUtilitiesconfigureButton(Bridge.java:47)
at com.nomagic.ui.ButtonsPanel.addButton(ButtonsPanel.java:187)
at com.nomagic.ui.ButtonsPanel.<init>(ButtonsPanel.java:119)
at com.nomagic.ui.SimpleBaseDialog.__init(SimpleBaseDialog.java:454)
at com.nomagic.ui.SimpleBaseDialog.<init>(SimpleBaseDialog.java:410)
at com.nomagic.ui.SimpleBaseDialog.<init>(SimpleBaseDialog.java:422)
at com.nomagic.magicdraw.ui.dialogs.ao.<init>(ao.java:87)
at com.nomagic.magicdraw.ui.dialogs.ao.<init>(ao.java:81)
at com.nomagic.magicdraw.core.GUILog.showError(GUILog.java:155)
at com.nomagic.magicdraw.core.GUILog.showError(GUILog.java:196)
at com.nomagic.magicdraw.persistence.ProjectLoadService.loadAndHandleErrors(ProjectLoadService.java:127)
at com.nomagic.magicdraw.persistence.ProjectLoadService.loadAndHandleErrors(ProjectLoadService.java:90)
at com.nomagic.magicdraw.persistence.xmi.load.model.utils.ProjectLoader.lambda$loadProject$1(ProjectLoader.java:116)
at com.nomagic.magicdraw.persistence.xmi.load.model.utils.ProjectLoader.loadProject(ProjectLoader.java:134)
at com.nomagic.magicdraw.persistence.xmi.load.model.utils.ProjectLoader.loadProject(ProjectLoader.java:116)
at com.nomagic.magicdraw.core.project.d.a(d.java:152)
at com.nomagic.magicdraw.core.project.ProjectsManager.loadProject(ProjectsManager.java:641)
at com.nomagic.magicdraw.core.project.ProjectsManager.loadProject(ProjectsManager.java:657)
sasii4u@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Thu Oct 18, 2018 3:34 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby marlel » Fri Oct 19, 2018 12:21 am

Hello,

Have you started MagicDraw application?
Have you checked the documentation to setup Eclipse IDE:
https://docs.nomagic.com/display/MD190/ ... in+Eclipse
Best regards,
Martynas
marlel
No Magic
No Magic
 
Posts: 388
Posts Rating:25
Joined: Wed Jul 11, 2012 2:31 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby sasii4u@gmail.com » Tue Oct 23, 2018 2:22 am

Hi,

Thanks for the response.

Yes, i have gone through the document.

I am trying to start magic draw application from a Eclipse Application with the following code as mentioned in the document.

Now it is not starting the application, but showing following error.

Application.getInstance().start(true, false, false, new String[0], null)

java.lang.IllegalStateException: Application has to be started inside OSGI Framework
at com.nomagic.magicdraw.core.Application.internalStart(Application.java:531)
at com.nomagic.magicdraw.core.Application.start(Application.java:447)
at com.nomagic.magicdraw.core.Application.start(Application.java:420)
at com.bmw.extended.franca2uml.TestApp.start(TestApp.java:24)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
sasii4u@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Thu Oct 18, 2018 3:34 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby marlel » Tue Oct 23, 2018 2:29 am

Hello,

You do not need to start the application explicitly, it is started when you use provided launcher configuration.
Can you please explain what are you trying to achieve.
Best regards,
Martynas
marlel
No Magic
No Magic
 
Posts: 388
Posts Rating:25
Joined: Wed Jul 11, 2012 2:31 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby sasii4u@gmail.com » Tue Oct 23, 2018 3:00 am

Hi,

Trying to achieve:

1. Update the magic draw model elements programmatically from eclipse RCP application
2. Launch the magic draw programmatically from eclipse RCP application

I have created a plugin which has all the magic draw jar files and included that plugin in my application

Thanks and Regards,

Sasi Kiran
sasii4u@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Thu Oct 18, 2018 3:34 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby marlel » Tue Oct 23, 2018 3:59 am

But why RCP? Maybe you do not need to start MagicDraw from RCP? It this a requirement or just one of the ways to achieve your goal? Maybe the goal is just to update the model?
Best regards,
Martynas
marlel
No Magic
No Magic
 
Posts: 388
Posts Rating:25
Joined: Wed Jul 11, 2012 2:31 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby sasii4u@gmail.com » Tue Oct 23, 2018 4:09 am

Hi,

Yes, Goal is to update the model from rcp eclipse application.

Thanks and Regards,

Sasi Kiran
sasii4u@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Thu Oct 18, 2018 3:34 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby vaidas.nargelas@nomagic.com » Tue Oct 23, 2018 8:29 am

Hello,

Eclipse IDE examples in openapi/ide/eclipse.zip contains three projects com.nomagic.magicdraw.integration.demo* that demonstrate example RCP application that integrates starting MagicDraw in itself. Please follow that example in integrating MagicDraw to RCP application.
Sincerely,

Vaidas Nargėlas
No Magic Customer Support
vaidas.nargelas@nomagic.com
Forum Beginner
Forum Beginner
 
Posts: 38
Posts Rating:4
Joined: Thu Aug 06, 2015 12:28 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby sasii4u@gmail.com » Wed Oct 24, 2018 12:29 am

Hi,

Thanks for the Reply.

https://docs.nomagic.com/display/MD190/ ... in+Eclipse

After following the steps as mentioned in document , getting error host plugin com.nomagic.magicdraw 17.0.5 not found for MagicDraw plugin in eclipse.

Please let me know whether any step missing ..

Thanks and Regards,

Sasi Kiran
sasii4u@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Thu Oct 18, 2018 3:34 am

Re: Error - trying to load MD project using openAPI from eclipse

Postby vaidas.nargelas@nomagic.com » Thu Oct 25, 2018 8:34 am

Hello,

It is likely that you have missed step #4 from https://docs.nomagic.com/display/MD190/ ... in+Eclipse about setting the Target Platform.
Sincerely,

Vaidas Nargėlas
No Magic Customer Support
vaidas.nargelas@nomagic.com
Forum Beginner
Forum Beginner
 
Posts: 38
Posts Rating:4
Joined: Thu Aug 06, 2015 12:28 am

Next

Return to New to MagicDraw

Who is online

Users browsing this forum: No registered users and 1 guest