Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Exception when trying to add custom icons to Diagram(Custom palette with custom icons and a custom diagram. I followed the library example from Benoit making sure the IDs match but still get an exception)
Exception when trying to add custom icons to Diagram [message #1758357] Tue, 28 March 2017 04:54 Go to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
I have a custom palette with custom icons and I try to add a custom shape(class) to the diagram but I get a forbidden symbol and then the following exception:

What am I missing?

java.lang.NullPointerException
at org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy.getCreateCommand(DefaultSemanticEditPolicy.java:153)
at org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy.getSemanticCommandSwitch(DefaultSemanticEditPolicy.java:118)
at org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy.getSemanticCommand(DefaultSemanticEditPolicy.java:78)
at org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy.getCommand(SemanticEditPolicy.java:69)
at org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy.getCommand(DefaultSemanticEditPolicy.java:72)
at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:502)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$1(GraphicalEditPart.java:1)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$1.run(GraphicalEditPart.java:482)
at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain.runExclusive(PapyrusROTransactionalEditingDomain.java:271)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.getCommand(GraphicalEditPart.java:477)
at org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy.getCreateElementAndViewCommand(CreationEditPolicy.java:340)
at org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy.getCommand(CreationEditPolicy.java:87)
at org.eclipse.papyrus.infra.gmfdiag.dnd.policy.CustomizableDropEditPolicy.getCommand(CustomizableDropEditPolicy.java:118)
at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:502)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$1(GraphicalEditPart.java:1)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$1.run(GraphicalEditPart.java:482)
at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain.runExclusive(PapyrusROTransactionalEditingDomain.java:271)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.getCommand(GraphicalEditPart.java:477)
at org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy.getUnspecifiedTypeCreateCommand(CreationEditPolicy.java:395)
at org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy.getCommand(CreationEditPolicy.java:85)
at org.eclipse.papyrus.infra.gmfdiag.dnd.policy.CustomizableDropEditPolicy.getCommand(CustomizableDropEditPolicy.java:118)
at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:502)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$1(GraphicalEditPart.java:1)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$1.run(GraphicalEditPart.java:482)
at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain.runExclusive(PapyrusROTransactionalEditingDomain.java:271)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.getCommand(GraphicalEditPart.java:477)
at org.eclipse.gef.tools.TargetingTool.getCommand(TargetingTool.java:123)
at org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool.getCommand(CreationTool.java:277)
at org.eclipse.gef.tools.CreationTool.handleMove(CreationTool.java:253)
at org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool.handleMove(CreationTool.java:258)
at org.eclipse.gef.tools.AbstractTool.mouseMove(AbstractTool.java:1182)
at org.eclipse.gef.EditDomain.mouseMove(EditDomain.java:287)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseMoved(DomainEventDispatcher.java:365)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove(LightweightSystem.java:543)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:213)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1313)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3706)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
  • Attachment: Archive.zip
    (Size: 3.84KB, Downloaded 152 times)
Re: Exception when trying to add custom icons to Diagram [message #1758372 is a reply to message #1758357] Tue, 28 March 2017 07:51 Go to previous messageGo to next message
Benoit Maggi is currently offline Benoit MaggiFriend
Messages: 129
Registered: March 2013
Location: Bordeaux, France
Senior Member
Hi,

There is a missing element type, that's why there is a NPE

In any case it shouldn't throw an NPE. I opened a Bug 514289

I checked your files but didn't see any obvious issues.

Can you share a full plugin?

Regards,
Benoît
Re: Exception when trying to add custom icons to Diagram [message #1758379 is a reply to message #1758357] Tue, 28 March 2017 08:06 Go to previous messageGo to next message
Mickael ADAM is currently offline Mickael ADAMFriend
Messages: 31
Registered: February 2014
Member
hi,

I check quickly your files. You forgot to remove comments brace on the declaration of the semantic element type model.
I see that you use matcher. I don't don't how exactly this work but if you goal is to create a stereotyped element, try to use instead stereotype advice helper. I will send you an example as soon as possible if need.

hth.

Mickaël
Re: Exception when trying to add custom icons to Diagram [message #1758388 is a reply to message #1758379] Tue, 28 March 2017 10:00 Go to previous messageGo to next message
Mickael ADAM is currently offline Mickael ADAMFriend
Messages: 31
Registered: February 2014
Member
you can add stereotype with:

<adviceBindingsConfigurations xsi:type="applystereotypeadvice:ApplyStereotypeAdviceConfiguration" identifier="your.id" target="//@elementTypeConfigurations.0">
<stereotypesToApply stereotypeQualifiedName="SysML::Blocks::Block">
<requiredProfiles>SysML</requiredProfiles>
</stereotypesToApply>
</adviceBindingsConfigurations>
Re: Exception when trying to add custom icons to Diagram [message #1758433 is a reply to message #1758379] Tue, 28 March 2017 16:16 Go to previous messageGo to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
I could not find the comments brace you are referring to.
Re: Exception when trying to add custom icons to Diagram [message #1758435 is a reply to message #1758388] Tue, 28 March 2017 16:34 Go to previous messageGo to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
I added the advice binding but it still does not work.
Re: Exception when trying to add custom icons to Diagram [message #1758436 is a reply to message #1758372] Tue, 28 March 2017 16:40 Go to previous messageGo to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
This exception happens when I click on the palette and move the cursor to the diagram view. is that a missing element exception or something related to the Diagram?
Re: Exception when trying to add custom icons to Diagram [message #1758465 is a reply to message #1758372] Wed, 29 March 2017 00:40 Go to previous messageGo to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
Hi Benoit

I am attaching the full project
  • Attachment: cerbac.zip
    (Size: 196.93KB, Downloaded 131 times)
Re: Exception when trying to add custom icons to Diagram [message #1758481 is a reply to message #1758465] Wed, 29 March 2017 07:45 Go to previous messageGo to next message
Benoit Maggi is currently offline Benoit MaggiFriend
Messages: 129
Registered: March 2013
Location: Bordeaux, France
Senior Member
I checked your sources.

Id of elementTypeSet (in your models) should be unique: both are using edu.utd.cse.cerbac.cerbac.elementTypes

Changing one in edu.utd.cse.cerbac.cerbacdi.elementTypes (and un-comment the registration point) allows me to create "Positive Obligation"



Re: Exception when trying to add custom icons to Diagram [message #1758528 is a reply to message #1758481] Wed, 29 March 2017 15:45 Go to previous messageGo to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
Hi Benoit,
Can you send me the files you changed to get it to work? I made the changes but still having the issue.

Thanks.
Re: Exception when trying to add custom icons to Diagram [message #1758536 is a reply to message #1758528] Wed, 29 March 2017 17:23 Go to previous messageGo to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
ok Benoit, I got it to work. I restarted eclipse after the Id changes and I was able to add a few stereotypes. I also noticed that when there is a problem with the typesconfiguration, the exception previous exception is raised.

Thanks for your help.
Re: Exception when trying to add custom icons to Diagram [message #1758550 is a reply to message #1758536] Thu, 30 March 2017 05:18 Go to previous messageGo to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
Hi,
I cant get the associations to work. Do you know what the problem could be?
Re: Exception when trying to add custom icons to Diagram [message #1758564 is a reply to message #1758550] Thu, 30 March 2017 07:29 Go to previous messageGo to next message
Benoit Maggi is currently offline Benoit MaggiFriend
Messages: 129
Registered: March 2013
Location: Bordeaux, France
Senior Member
Hi,

For association you have to use kind="ConnectionTool" in the palette.

If your sources are open, it would help a lot (avoid to re quest it for each question) if you can share them on a repository (Github, Bitbucket, Gitlab or whatever you like)
Re: Exception when trying to add custom icons to Diagram [message #1759196 is a reply to message #1758564] Fri, 07 April 2017 14:40 Go to previous message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
Hi Benoit,

I have added the source to GitHub repository
https://github.com/tonero101/cerbac.git

I resolved the association problem with your answer, Thanks.
Right now I am having a DSML validation and public profile. I created a topic with the issue.
Thanks
Previous Topic:UML Class Diagram attributes compartment issue
Next Topic:delet this
Goto Forum:
  


Current Time: Sat Oct 05 07:30:06 GMT 2024

Powered by FUDForum. Page generated in 0.05056 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top