Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321890 - [Composite Structure Diagram] Delete Port from the model explorer fails when the Port appears in diagram
Summary: [Composite Structure Diagram] Delete Port from the model explorer fails when ...
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Yann Tanguy CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 317609 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-05 11:08 EDT by Yann Tanguy CLA
Modified: 2010-08-06 08:26 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Tanguy CLA 2010-08-05 11:08:03 EDT
To reproduce:
- Create a Composite Structure Diagram
- Create a Class
- Create a Port
- Try to delete the Port from the model explorer

--> A exception is thrown (see below)

eclipse.buildId=I20100608-0911
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
Framework arguments:  -product org.eclipse.platform.ide
Command-line arguments:  -product org.eclipse.platform.ide -data D:\Workspaces\Helios\p2_dev_07X_ws/../runtime-07X -dev file:D:/Workspaces/Helios/p2_dev_07X_ws/.metadata/.plugins/org.eclipse.pde.core/Runtime-07X/dev.properties -os win32 -ws win32 -arch x86 -consoleLog


Error
Thu Aug 05 17:03:39 CEST 2010
Uncaught exception during post-commit listener notifications

java.lang.ClassCastException: org.eclipse.uml2.uml.internal.impl.ClassImpl cannot be cast to org.eclipse.uml2.uml.Property
at org.eclipse.papyrus.diagram.composite.custom.edit.policies.PropertyLabelEditPolicy.getUMLElement(PropertyLabelEditPolicy.java:126)
at org.eclipse.papyrus.diagram.composite.custom.edit.policies.PropertyLabelEditPolicy.addAdditionalListeners(PropertyLabelEditPolicy.java:48)
at org.eclipse.papyrus.diagram.common.editpolicies.AbstractMaskManagedEditPolicy.activate(AbstractMaskManagedEditPolicy.java:60)
at org.eclipse.gef.editparts.AbstractEditPart.activateEditPolicies(AbstractEditPart.java:173)
at org.eclipse.gef.editparts.AbstractEditPart.activate(AbstractEditPart.java:155)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.activate(AbstractGraphicalEditPart.java:195)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$0(GraphicalEditPart.java:1)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.activate(GraphicalEditPart.java:205)
at org.eclipse.gef.editparts.AbstractEditPart.activate(AbstractEditPart.java:159)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.activate(AbstractGraphicalEditPart.java:195)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$0(GraphicalEditPart.java:1)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.activate(GraphicalEditPart.java:205)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:214)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.addChild(GraphicalEditPart.java:1319)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:771)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refreshChild(GraphicalEditPart.java:1232)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.handleMajorSemanticChange(GraphicalEditPart.java:1258)
at org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart.handleNotificationEvent(ShapeEditPart.java:165)
at org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart.handleNotificationEvent(ShapeNodeEditPart.java:236)
at org.eclipse.papyrus.diagram.common.editparts.BorderNodeEditPart.handleNotificationEvent(BorderNodeEditPart.java:151)
at org.eclipse.papyrus.diagram.common.editparts.BorderUMLNodeEditPart.handleNotificationEvent(BorderUMLNodeEditPart.java:107)
at org.eclipse.papyrus.diagram.common.editparts.BorderNamedElementEditPart.handleNotificationEvent(BorderNamedElementEditPart.java:57)
at org.eclipse.papyrus.diagram.common.editparts.AbstractBorderEditPart.handleNotificationEvent(AbstractBorderEditPart.java:38)
at org.eclipse.papyrus.diagram.composite.edit.parts.PortEditPart.handleNotificationEvent(PortEditPart.java:123)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.notifyChanged(GraphicalEditPart.java:1438)
at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.fireNotification(DiagramEventBroker.java:500)
at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.resourceSetChanged(DiagramEventBroker.java:395)
at org.eclipse.gmf.runtime.diagram.ui.DiagramEventBrokerThreadSafe.resourceSetChanged(DiagramEventBrokerThreadSafe.java:73)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$1.run(TransactionalEditingDomainImpl.java:781)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.postcommit(TransactionalEditingDomainImpl.java:771)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:511)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
at org.eclipse.emf.edit.ui.action.CommandActionHandler.run(CommandActionHandler.java:92)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168)
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)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Yann Tanguy CLA 2010-08-05 11:12:29 EDT
The Port is deleted from the model but its view is not removed from diagram.
This results from the diagram trying to recreate the EditPart for the Port view while the Port no more exists.

The view is not remove during Port deletion because the OrphanViewPolicy is not installed on Port (and more generally affixed child owners) in the Composite Structure Diagram. Currently this EditPart is installed on the Diagram, and every compartment. It should be added on all EncapsulatedClassifiers supported in the diagram.
Comment 2 Yann Tanguy CLA 2010-08-06 08:04:13 EDT
Done in r2540.
RemoveOrphanViewPolicy installed on Composite elements, and declaration of the Name EditPart also declared as Not orphan nodes in the RemoveOrphanViewPolicy.
Comment 3 Yann Tanguy CLA 2010-08-06 08:14:03 EDT
RemoveOrphanViewPolicy modified, replacing tests on Visual IDs by tests on View nature.
BasicCompartment and DecorationNode views are always considered as non orphan nodes.

(in r2541)
Comment 4 Yann Tanguy CLA 2010-08-06 08:26:32 EDT
*** Bug 317609 has been marked as a duplicate of this bug. ***