Project

General

Profile

« Previous | Next » 

Revision 0cf9635f

Added by Patrick Plitzner almost 7 years ago

fix #6776 ref #6745 Parts with tag "nonRestore" will not be persisted

  • they will be removed from the application model before it is saved

View differences:

eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF
26 26
 org.eclipse.equinox.p2.metadata,
27 27
 org.eclipse.equinox.p2.engine,
28 28
 org.eclipse.equinox.p2.metadata.repository,
29
 org.eclipse.equinox.p2.repository
29
 org.eclipse.equinox.p2.repository,
30
 org.eclipse.e4.ui.workbench;bundle-version="1.4.0",
31
 org.eclipse.e4.ui.model.workbench,
32
 eu.etaxonomy.taxeditor.workbench,
33
 org.eclipse.e4.ui.di,
34
 org.eclipse.e4.core.di.annotations
30 35
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
31 36
Bundle-ActivationPolicy: lazy
32 37
Import-Package: eu.etaxonomy.cdm.database,
eu.etaxonomy.taxeditor.application/plugin.xml
60 60
            restorable="true">
61 61
      </view>
62 62
   </extension-->
63
   <extension
64
         id="product"
65
         point="org.eclipse.core.runtime.products">
66
      <product
67
            application="eu.etaxonomy.taxeditor.application.application"
68
            name="%product.name">
69
         <property
70
               name="windowImages"
71
               value="icons/256color_16x16.gif,icons/256color_32x32.gif,icons/256color_48x48.gif">
72
         </property>
73
         <property
74
               name="aboutText"
75
               value="%productBlurb">
76
         </property>
77
         <!--property
78
               name="startupForegroundColor"
79
               value="#C8D5EA"-->
80
         <property
81
               name="startupForegroundColor"
82
               value="000000">
83
         </property>
84
         <property
85
               name="startupProgressRect"
86
               value="5,447,366,15">
87
         </property>
88
         <property
89
               name="startupMessageRect"
90
               value="7,432,360,20">
91
         </property>
92
         <property
93
               name="appName"
94
               value="EDIT Taxonomic Editor">
95
         </property>
96
         <property
97
               name="preferenceCustomization"
98
               value="plugin_customization.ini">
99
         </property>
100
         <property
101
               name="aboutImage"
102
               value="icons/256color_48x48.gif">
103
         </property>
104
      </product>
105
   </extension>
106 63
   
107 64
   
108 65
	<extension
......
195 152
             name="preferenceCustomization"
196 153
             value="plugin_customization.ini">
197 154
       </property>
155
       <property
156
             name="lifeCycleURI"
157
             value="bundleclass://eu.etaxonomy.taxeditor.application/eu.etaxonomy.taxeditor.LifeCycleManager">
158
       </property>
198 159
    </product>
199 160
 </extension>
200 161
 <extension
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/LifeCycleManager.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor;
11

  
12
import java.util.Arrays;
13
import java.util.List;
14

  
15
import org.eclipse.e4.ui.model.application.MApplication;
16
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
17
import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate;
18
import org.eclipse.e4.ui.workbench.lifecycle.PreSave;
19
import org.eclipse.e4.ui.workbench.lifecycle.ProcessAdditions;
20
import org.eclipse.e4.ui.workbench.lifecycle.ProcessRemovals;
21
import org.eclipse.e4.ui.workbench.modeling.EModelService;
22

  
23
/**
24
 * @author pplitzner
25
 * @date 05.07.2017
26
 *
27
 */
28
public class LifeCycleManager {
29

  
30
    private static final String NON_RESTORE = "nonRestore";
31

  
32
    @PostContextCreate
33
    private void postContextCreate() {
34
    }
35

  
36
    @ProcessAdditions
37
    private void processAdditions() {
38
    }
39

  
40
    @ProcessRemovals
41
    private void processRemovals() {
42
    }
43

  
44
    @PreSave
45
    private void preSave(EModelService modelService, MApplication application){
46
        List<MPart> elements = modelService.findElements(application, null, MPart.class, Arrays.asList(NON_RESTORE));
47
        for (MPart part : elements) {
48
            part.setToBeRendered(false);
49
        }
50
    }
51

  
52
}
eu.etaxonomy.taxeditor.editor/fragment.e4xmi
6 6
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_gSpRsDQDEeeTNOFVGI4q2w" featurename="descriptors" parentElementId="xpath:/">
7 7
    <elements xsi:type="basic:PartDescriptor" xmi:id="_gSpRsTQDEeeTNOFVGI4q2w" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView" label="%command.label.DERIVATIVE_EDITOR" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/derivate_view-16x16-32.png" tooltip="%command.label.DERIVATIVE_EDITOR" allowMultiple="true" category="" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
8 8
      <tags>View</tags>
9
      <tags>categoryTag:Sample Category</tags>
9
      <tags>nonRestore</tags>
10 10
      <handlers xmi:id="_E5l4wDVqEee_b7RlBzTDRw" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.CreateFieldUnitHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.CreateFieldUnitHandler" command="_BjF3ADVqEee_b7RlBzTDRw"/>
11 11
      <handlers xmi:id="_ha1I4DmBEeeOos_QXKSXcA" elementId="eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddSpecimenHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddSpecimenHandler" command="_qqMbcDmBEeeOos_QXKSXcA"/>
12 12
      <handlers xmi:id="_FOiO0DocEeecLdI14WMq7w" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddTissueSampleHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddTissueSampleHandler" command="_I2LD4DocEeecLdI14WMq7w"/>
......
54 54
        <children xsi:type="menu:HandledMenuItem" xmi:id="_wg0-oDulEeeOtqC_3qh40A" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel54" label="%command.label.54" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/deep-delete-16x16-32.png" command="_fKT-wDulEeeOtqC_3qh40A"/>
55 55
      </menus>
56 56
    </elements>
57
    <elements xsi:type="basic:PartDescriptor" xmi:id="_R7vxEECaEeeL5JDzMOYK6g" elementId="eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor" label="Character Editor" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor"/>
57
    <elements xsi:type="basic:PartDescriptor" xmi:id="_R7vxEECaEeeL5JDzMOYK6g" elementId="eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor" label="Character Editor" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor">
58
      <tags>nonRestore</tags>
59
    </elements>
58 60
  </fragments>
59 61
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="__mwtMDVpEee_b7RlBzTDRw" featurename="commands" parentElementId="xpath:/">
60 62
    <elements xsi:type="commands:Command" xmi:id="_BjF3ADVqEee_b7RlBzTDRw" elementId="eu.etaxonomy.taxeditor.editor.command.specimeneditor.create_field_unit" commandName="%command.commandname.1"/>
eu.etaxonomy.taxeditor.store/fragment.e4xmi
3 3
  <imports xsi:type="commands:Command" xmi:id="_bnVKsCZxEeeQLpuomSmVoQ" elementId="eu.etaxonomy.taxeditor.command.openPart"/>
4 4
  <imports xsi:type="commands:Command" xmi:id="_LlbAMEq2EeeN-dEYnw7m3g" elementId="org.eclipse.ui.file.save"/>
5 5
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_xVa1wCXXEeex9MwMOgUeWw" featurename="descriptors" parentElementId="xpath:/">
6
    <elements xsi:type="basic:PartDescriptor" xmi:id="_2xmxoCXXEeex9MwMOgUeWw" elementId="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart" label="%view.name.SESSIONS" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"/>
6
    <elements xsi:type="basic:PartDescriptor" xmi:id="_2xmxoCXXEeex9MwMOgUeWw" elementId="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart" label="%view.name.SESSIONS" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart">
7
      <tags>nonRestore</tags>
8
    </elements>
7 9
    <elements xsi:type="basic:PartDescriptor" xmi:id="_J-3UEEqgEeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor" label="%partdescriptor.label.featureTreeEditor" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor">
10
      <tags>nonRestore</tags>
8 11
      <handlers xmi:id="_H_c_EEq2EeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_LlbAMEq2EeeN-dEYnw7m3g"/>
9 12
    </elements>
10 13
  </fragments>

Also available in: Unified diff