Project

General

Profile

« Previous | Next » 

Revision bd04ac7c

Added by Patrick Plitzner almost 7 years ago

ref #6596 Add SaveHandler for specimen editor

View differences:

eu.etaxonomy.taxeditor.editor/fragment.e4xmi
2 2
<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/descriptor/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" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
3 3
  <imports xsi:type="commands:Command" xmi:id="_WPjpoDSnEeek0dKsFNy--Q" elementId="eu.etaxonomy.taxeditor.command.openPart"/>
4 4
  <imports xsi:type="commands:Command" xmi:id="_Qz6EMD62EeekvPZafWEv7w" elementId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"/>
5
  <imports xsi:type="commands:Command" xmi:id="_majwMEaQEeeXMc6kSYO7Xg" elementId="org.eclipse.ui.file.save"/>
5 6
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_gSpRsDQDEeeTNOFVGI4q2w" featurename="descriptors" parentElementId="xpath:/">
6 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="Sample Category" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
7 8
      <tags>View</tags>
......
21 22
      <handlers xmi:id="_ed9ZoDumEeeOtqC_3qh40A" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler.removeSingleRead" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadRemoveHandler" command="_K4DxEDumEeeOtqC_3qh40A"/>
22 23
      <handlers xmi:id="_CQjyIDvaEeeOtqC_3qh40A" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler" command="_YPp1wDvREeeOtqC_3qh40A"/>
23 24
      <handlers xmi:id="_OJK8QD62EeekvPZafWEv7w" elementId="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntityE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntityE4" command="_Qz6EMD62EeekvPZafWEv7w"/>
25
      <handlers xmi:id="_BWBGgEaQEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_majwMEaQEeeXMc6kSYO7Xg"/>
24 26
      <menus xsi:type="menu:PopupMenu" xmi:id="_CYXZ0DQEEeeTNOFVGI4q2w" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.specimeneditor">
25 27
        <children xsi:type="menu:Menu" xmi:id="_cdjzEDmAEeeOos_QXKSXcA" elementId="eu.etaxonomy.taxeditor.editor.menu.add" label="%menu.label.5">
26 28
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_ASKmMDpCEeecM-jyCkToYw" coreExpressionId="isAddDerivateAllowed"/>
eu.etaxonomy.taxeditor.workbench/META-INF/MANIFEST.MF
4 4
Bundle-SymbolicName: eu.etaxonomy.taxeditor.workbench;singleton:=true
5 5
Bundle-Version: 4.8.0.qualifier
6 6
Bundle-Activator: eu.etaxonomy.taxeditor.workbench.Activator
7
Bundle-Vendor: EDIT
7 8
Require-Bundle: org.eclipse.ui,
8 9
 org.eclipse.core.runtime,
9 10
 org.eclipse.e4.ui.workbench,
......
12 13
 org.apache.log4j;bundle-version="1.2.15",
13 14
 org.eclipse.equinox.p2.ui,
14 15
 org.eclipse.equinox.p2.metadata;bundle-version="2.3.100",
15
 org.eclipse.equinox.p2.operations;bundle-version="2.4.200"
16
 org.eclipse.equinox.p2.operations;bundle-version="2.4.200",
17
 org.eclipse.e4.core.di,
18
 org.eclipse.e4.ui.services
16 19
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
20
Import-Package: javax.inject;version="1.0.0"
17 21
Bundle-ActivationPolicy: lazy
18
Bundle-Vendor: EDIT
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/SaveHandler.java
1

  
2
package eu.etaxonomy.taxeditor.workbench;
3

  
4
import javax.inject.Named;
5

  
6
import org.eclipse.e4.core.di.annotations.CanExecute;
7
import org.eclipse.e4.core.di.annotations.Execute;
8
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
9
import org.eclipse.e4.ui.services.IServiceConstants;
10
import org.eclipse.e4.ui.workbench.modeling.EPartService;
11

  
12
public class SaveHandler {
13

  
14
	@Execute
15
	public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, EPartService partService) {
16
	    partService.savePart(activePart, false);
17
	}
18

  
19

  
20
	@CanExecute
21
	public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
22
		return activePart.isDirty();
23
	}
24

  
25
}

Also available in: Unified diff