Bug 544490 - Mark spy handler, menus etc as non persistent
Due to Bug 544871, the change was done in an text editor, if the model
fragment is reworked, the model fragment editor will currently remove
the tagged elements.
Also flags the generated key binding in the SpyProcessor as something
that should not get persisted. Potential follow-up, move the keybinding
creating to the model fragment instead of creating is dynamically.
Change-Id: I7e597a1bf508ac61399c72fcf8f023f0785bc9f4
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.e4.tools.spy/fragment.e4xmi b/bundles/org.eclipse.e4.tools.spy/fragment.e4xmi
index b300f3d..5fcc35e 100644
--- a/bundles/org.eclipse.e4.tools.spy/fragment.e4xmi
+++ b/bundles/org.eclipse.e4.tools.spy/fragment.e4xmi
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="ASCII"?>
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_Yv7zwLnQEeWXX4KE4W3FyQ">
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_ZeXAALnQEeWXX4KE4W3FyQ" featurename="menuContributions" parentElementId="xpath:/" positionInList="">
- <elements xsi:type="menu:MenuContribution" xmi:id="_br97sLn_EeWJoqtWvx7b2g" elementId="org.eclipse.e4.tools.spy.menucontribution.0" positionInParent="after=additions" parentId="org.eclipse.ui.main.menu">
- <children xsi:type="menu:Menu" xmi:id="_fUHHELn_EeWJoqtWvx7b2g" elementId="window" label="Window"/>
- </elements>
<elements xsi:type="menu:MenuContribution" xmi:id="_dFxLkLnQEeWXX4KE4W3FyQ" elementId="org.eclipse.e4.tools.spy.menucontribution" positionInParent="after=additions" parentId="window">
+ <persistedState key="persistState" value="false"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_Xncg4LoAEeWJoqtWvx7b2g" elementId="org.eclipse.e4.tools.spy.menuseparator.0"/>
<children xsi:type="menu:Menu" xmi:id="_9DJHILnQEeWXX4KE4W3FyQ" elementId="org.eclipse.e4.tools.spy.menu.e4spies" label="Spies" iconURI="platform:/plugin/org.eclipse.e4.tools.spy/icons/spyicon.png" tooltip="">
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_iCu00LnQEeWXX4KE4W3FyQ" elementId="org.eclipse.e4.tools.spy.dynamicmenucontribution.0" label="E4 Spies" contributionURI="bundleclass://org.eclipse.e4.tools.spy/org.eclipse.e4.tools.spy.SpyProcessor"/>
@@ -13,14 +11,18 @@
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_PV6YoOmnEei5O53ZMcQRyw" featurename="commands" parentElementId="xpath:/">
<elements xsi:type="commands:Command" xmi:id="_QytGwOmnEei5O53ZMcQRyw" elementId="org.eclipse.e4.tools.spy.command" commandName="Open Spy" description="The command to open any spy in the E4 Spies window">
+ <persistedState key="persistState" value="false"/>
<parameters xmi:id="_WFMUEOmnEei5O53ZMcQRyw" elementId="org.eclipse.e4.tools.spy.command.partID" name="viewPart"/>
</elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_bH9DUOmnEei5O53ZMcQRyw" featurename="handlers" parentElementId="xpath:/">
- <elements xsi:type="commands:Handler" xmi:id="_cVMSgOmnEei5O53ZMcQRyw" elementId="org.eclipse.e4.tools.spy.handler.0" contributionURI="bundleclass://org.eclipse.e4.tools.spy/org.eclipse.e4.tools.spy.SpyHandler" command="_QytGwOmnEei5O53ZMcQRyw"/>
+ <elements xsi:type="commands:Handler" xmi:id="_cVMSgOmnEei5O53ZMcQRyw" elementId="org.eclipse.e4.tools.spy.handler.0" contributionURI="bundleclass://org.eclipse.e4.tools.spy/org.eclipse.e4.tools.spy.SpyHandler" command="_QytGwOmnEei5O53ZMcQRyw">
+ <persistedState key="persistState" value="false"/>
+ </elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_D-9ugOmnEei5O53ZMcQRyw" featurename="snippets" parentElementId="xpath:/">
<elements xsi:type="basic:TrimmedWindow" xmi:id="_I_PxgOmnEei5O53ZMcQRyw" elementId="org.eclipse.e4.tools.spy.window" selectedElement="_UUrRUOmqEei5O53ZMcQRyw" label="E4 Spies window" iconURI="platform:/plugin/org.eclipse.e4.tools.spy/icons/spyicon.png" width="600" height="1000">
+ <persistedState key="persistState" value="false"/>
<children xsi:type="basic:PartStack" xmi:id="_UUrRUOmqEei5O53ZMcQRyw" elementId="org.eclipse.e4.tools.spy.partStack"/>
<trimBars xmi:id="_MYxKsOmqEei5O53ZMcQRyw" elementId="org.eclipse.e4.tools.spy.trimbar">
<children xsi:type="menu:ToolBar" xmi:id="_RKEWgOmqEei5O53ZMcQRyw" elementId="org.eclipse.e4.tools.spy.toolbar"/>
diff --git a/bundles/org.eclipse.e4.tools.spy/plugin.xml b/bundles/org.eclipse.e4.tools.spy/plugin.xml
index c6be73b..a9024b2 100644
--- a/bundles/org.eclipse.e4.tools.spy/plugin.xml
+++ b/bundles/org.eclipse.e4.tools.spy/plugin.xml
@@ -9,7 +9,7 @@
class="org.eclipse.e4.tools.spy.SpyProcessor">
</processor>
<fragment
- apply="notexists"
+ apply="always"
uri="fragment.e4xmi">
</fragment>
</extension>
diff --git a/bundles/org.eclipse.e4.tools.spy/src/org/eclipse/e4/tools/spy/SpyProcessor.java b/bundles/org.eclipse.e4.tools.spy/src/org/eclipse/e4/tools/spy/SpyProcessor.java
index afa8338..6b7f2bc 100644
--- a/bundles/org.eclipse.e4.tools.spy/src/org/eclipse/e4/tools/spy/SpyProcessor.java
+++ b/bundles/org.eclipse.e4.tools.spy/src/org/eclipse/e4/tools/spy/SpyProcessor.java
@@ -37,6 +37,7 @@
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
+import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -160,6 +161,7 @@
binding.setElementId(paramViewId + ".binding");
binding.setContributorURI(cmd.getContributorURI());
binding.setKeySequence(keySequence);
+ binding.getPersistedState().put(IWorkbench.PERSIST_STATE, "false");
MParameter p = modelService.createModelElement(MParameter.class);
p.setName(SPY_COMMAND_PARAM);