Community
Participate
Working Groups
Created attachment 279536 [details] Example project From the forum: https://www.eclipse.org/forums/index.php/t/1099667/ In eclipse 4.11, there is a new feature where a ui element can be marked to not be persisted (https://www.eclipse.org/eclipse/news/4.11/platform_isv.php) part.getPersistedState().put(IWorkbench.PERSIST_STATE, "false"); When I use this feature, the view will not be persisted to the workbench.xmi file, but eclipse still persists that this view was selected in the partstack when I closed the application and when I restart, the application throws an exception and resets the perspective together with all other views which should be persisted. Here is the tag that cannot be parsed by eclipse <children xsi:type="basic:PartStack" xmi:id="_PYv99KL2EemRTJKPOqiKJQ" elementId="persist.partstack.sample" contributorURI="platform:/plugin/persist" containerData="5000" selectedElement="_PYv99qL2EemRTJKPOqiKJQ"> The exception mentions the ID in selectedElement Is this a glitch in the new feature or am I missing something? Here is the exception Caused by: org.eclipse.emf.ecore.xmi.UnresolvedReferenceException: Unresolved reference '_PYv99qL2EemRTJKPOqiKJQ'. (file:/C:/Users/stefan.folkesson/runtime-persist.product/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi, 8, 219) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardReferences(XMLHandler.java:1197) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.endDocument(XMLHandler.java:1282) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endDocument(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261) at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563) at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1342) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274) ... 20 more I have attached an example project with two views. One is always open and should be persisted. The other is opened through the open command and is marked not to be persisted, see OpenHandler.java. To reproduce the error, open the second view (leave the new view selected in the partstack), close the application, and open the application again. This gives the exception and the perspective is reset.
How should this be handled? Cleanout selected elements which will not be persisted during persistence?
(In reply to Lars Vogel from comment #1) > How should this be handled? Cleanout selected elements which will not be > persisted during persistence? References to elements that are not persisted should not be persisted as well. If the resulting model is still valid, depends on if the reference is mandatory or not. Filter should be done in E4XMISave, probably by custom implementation of getElementIDRefSingleSimple and friends.
Again I have seen the same error, but now I was not able to recover the original workbench.xmi. At least the error message should give some more context otherwise we cannot analyze this one at all.