Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sapphire-dev] ClassCastException in ShowInSource context menu action

Hey guys,

In my sapphire editor I have a model where I am representing a relationship between two nodes in the diagram that is only a logical relationship by that I mean there is no single xml element that is backing the relationship, rather the logical relationship is present when there is a certain combination of elements and attributes in separate parts of the DOM.  I'm implementing this by using a custom binding on a particular list property.  The individual items in this list are of supertype MemoryResource because I'm just creating these on the fly (based on analyzing the model) whenever the list property is read.  In the diagram editor, the connection type which is what I'm using to show these "relationships" has a context menu item for "Show in Source".  In my case this fails with this ClassCastException [1].

What is the recommended course of action?  Am I doing something with my relationship modeling that I shouldn't?  Or should we make the "Show In Source" action have some type of condition where if the resource is not of type XmlResource then that action is not visible?   


java.lang.ClassCastException: com.liferay.ide.eclipse.service.core.model.internal.RelationshipResource cannot be cast to org.eclipse.sapphire.modeling.xml.XmlResource
at org.eclipse.sapphire.ui.swt.xml.editor.XmlEditorResourceStore$XmlSourceEditorService.show(XmlEditorResourceStore.java:583)
at org.eclipse.sapphire.ui.diagram.actions.DiagramShowInSourceActionHandler.run(DiagramShowInSourceActionHandler.java:39)
at org.eclipse.sapphire.ui.SapphireActionHandler.execute(SapphireActionHandler.java:89)
at org.eclipse.sapphire.ui.swt.graphiti.actions.SapphireActionHandlerDelegate.run(SapphireActionHandlerDelegate.java:70)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)



--
Greg Amerson (@greg_amerson)
Liferay, Inc. (#liferay)

Back to the top