Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348689

Summary: [ModelExplorer] Deleting an element that "contains" a diagram/table corrupts the model
Product: [Modeling] Papyrus Reporter: Yann Tanguy <yann.tanguy>
Component: CoreAssignee: Vincent Lorenzo <vincent.lorenzo>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: cedric.dumoulin, cletavernier, mathieu.velten, scott.lee, toni.heimala, vincent.lorenzo
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 403620    
Bug Blocks: 360243    

Description Yann Tanguy CLA 2011-06-08 05:40:01 EDT
To reproduce :
- Create a Block 
- Create an IBD on the Block 
- Destroy the Block in the Model Explorer -> the diagram is not closed
- Save and reopen -> the model cannot be reopened, the following exception occurs:

java.lang.IllegalArgumentException: No Part found for the model 'org.eclipse.papyrus.sashwindows.di.impl.PageRefImpl@250656 (objectPageIdentifier: null)'
	at org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer.createPagePart(SashWindowsContainer.java:275)
	at org.eclipse.papyrus.sasheditor.internal.TabFolderPart.createChildPart(TabFolderPart.java:913)
	at org.eclipse.papyrus.sasheditor.internal.TabFolderPart.createTabItem(TabFolderPart.java:842)
	at org.eclipse.papyrus.sasheditor.internal.TabFolderPart.synchronize2(TabFolderPart.java:757)
	at org.eclipse.papyrus.sasheditor.internal.RootPart.synchronize2(RootPart.java:139)
	at org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer.refreshTabsInternal(SashWindowsContainer.java:431)
	at org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer.refreshTabs(SashWindowsContainer.java:384)
	at org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer.createPartControl(SashWindowsContainer.java:173)
	at org.eclipse.papyrus.sasheditor.editor.AbstractMultiPageSashEditor.createPartControl(AbstractMultiPageSashEditor.java:130)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2945)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
	at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842)
	at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:355)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:164)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
	at org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:50)
	at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:221)
	at org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:185)
	at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
	at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:462)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
	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:4163)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	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:344)
	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:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Comment 1 Yann Tanguy CLA 2011-06-24 11:06:57 EDT
*** Bug 350254 has been marked as a duplicate of this bug. ***
Comment 2 Toni Heimala CLA 2011-09-28 10:21:30 EDT
This bug has basically corrupted my whole UML project. How can I recover from it?
Comment 3 Vincent Lorenzo CLA 2011-09-28 10:56:20 EDT
Hi Tony, 
  I tested on a very simple model. The corrupt file is the .di. I think you should have these things in this file : 
somewhere you should find  <availablePage/> and in another place : <children/> 
These xml tags are empty, so, you should remove it in order to fix your model.

Best regards, 
/Vincent
Comment 4 Toni Heimala CLA 2011-09-29 08:52:53 EDT
Thanks Vincent! Removing <availablePage/> and <children/> from the .di file helped and I can view my model again!
Comment 5 Mathieu Velten CLA 2011-10-07 11:16:07 EDT
so as stated the PageRef is not removed from the sashWindow and the pageList when a diagram is deleted, but the pageIdentifier is set to null by tearDown*References in the DestroyElementCommand of the Diagram.

I changed a bit the sash code to handle the case gracefully by just ignoring the diagram if the pageIdentifier is null but the underlying problem is still there.

commited on branch and trunk.
Comment 6 Vincent Lorenzo CLA 2011-10-07 11:41:44 EDT
Hi, I'm writing a patch for this bug, but currently, I have an Undo/Redo problem, which seems be linked to the bug 348689. So we need to correct the bug 348689 before to provide a solution for this bug.
Comment 7 Mathieu Velten CLA 2011-10-07 11:49:11 EDT
ok nice, we also ran into the reparent bug and it will be a relief when fixed.

anyway my "fix" can't hurt, and we can at least open "corrupted" files now.
Comment 8 Camille Letavernier CLA 2012-07-30 08:21:26 EDT
As the model corruption can be avoided, this task is not critical anymore.

Changing the severity to normal.
Comment 9 Camille Letavernier CLA 2013-02-21 13:15:48 EST
See Bug 401109, which tracks the current progress on this issue.

I mark this one as a duplicate.

*** This bug has been marked as a duplicate of bug 401109 ***
Comment 10 Camille Letavernier CLA 2013-05-06 14:27:36 EDT
*** Bug 324080 has been marked as a duplicate of this bug. ***