Community
Participate
Working Groups
Created attachment 278676 [details] Sample e4 application to reproduce the error Besides this error from yesterday (https://bugs.eclipse.org/bugs/show_bug.cgi?id=547485) I have another finding concerning the persisted state of a shared element, which is defined in a fragment.e4xmi file. This is the implementation of a SampleView part, which is referenced as shared element. public class SampleView { private static final String PERSISTED_TEXT = "text"; private Text text; @PostConstruct public void createPartControl(Composite parent, MPart part) { text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); text.setMessage("Type text to be persited here"); text.setText(part.getPersistedState().getOrDefault(PERSISTED_TEXT, "")); } @PersistState public void persist(MPart part) { part.getPersistedState().put(PERSISTED_TEXT, text.getText()); } } When I type "Test" into the Text control and close the application, the persisted state is correctly persisted: <sharedElements xsi:type="basic:Part" xmi:id="_-5fZQHsAEemM37NvJ3qSlQ" elementId="brokenmodel.part.sharedpart" contributorURI="platform:/plugin/brokenmodelfragment" contributionURI="bundleclass://brokenmodelfragment/brokenmodel.parts.SampleView" label="Shared Part"> <persistedState key="text" value="Test"/> <tags>active</tags> </sharedElements> But when I restart the application (of course WITHOUT -clearPersistedState flag or anything else, which clears the workspace) the persisted state cannot be restored, which means that the Text control remains empty even though "text.setText(part.getPersistedState().getOrDefault(PERSISTED_TEXT, ""));" is used. I also tried each and every combination for applying different fragment behavior: <extension id="brokenmodel.fragment" point="org.eclipse.e4.workbench.model"> <fragment apply="{Tried each kind of apply method}" uri="fragment.e4xmi"> </fragment> </extension> It seems that having placeholders and shared elements in a fragment is severely broken. I also attached a sample application, steps to reproduce are: 1) Start the application by using the product 2) Click on the "Shared Part" part and type some text into the textfield 3) Close the application (causes save of persisted state in workbench.xmi file) 4) Restart the application (without -clearPersistedState flag -> loads workbench.xmi) 5) Click on "Shared Part" tab and still have an empty Text control without the previously typed text, even though it is visible in the workbench.xmi file
I also assume this is not a regression in 4.12?
*** This bug has been marked as a duplicate of bug 487748 ***
*** This bug has been marked as a duplicate of bug 440030 ***