Project

General

Profile

« Previous | Next » 

Revision 2864959f

Added by Patrick Plitzner about 4 years ago

fix #7324 Add "Open in.." for GatheringEvents in ReferencingObjectsView

View differences:

eu.etaxonomy.taxeditor.editor/fragment.e4xmi
326 326
    <elements xsi:type="commands:Command" xmi:id="_XO7eUOSjEee9gvnH2Eirpw" elementId="eu.etaxonomy.taxeditor.editor.command.createWorkingSet" commandName="New Working Set"/>
327 327
    <elements xsi:type="commands:Command" xmi:id="_uPmNgOS3EeeKONG__xkGZg" elementId="eu.etaxonomy.taxeditor.editor.command.deleteWorkingSet" commandName="Delete Working Set"/>
328 328
    <elements xsi:type="commands:Command" xmi:id="_4k-uYPycEeeOqKfc2I-67A" elementId="eu.etaxonomy.taxeditor.editor.command.refresh" commandName="Refresh"/>
329
    <elements xsi:type="commands:Command" xmi:id="_eTTa4C0vEeiiqYcnQ2drEA" elementId="eu.etaxonomy.taxeditor.openSpecimenEditorForGatheringEvent" commandName="Open specimen editor for gathering event"/>
329 330
  </fragments>
330 331
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.navigation">
331 332
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_FPIHQKNwEeebGZ23ERGMGw" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.conceptGraph" label="%view.name.3" iconURI="" tooltip="%view.name.3" command="_WPjpoDSnEeek0dKsFNy--Q">
......
362 363
    <elements xsi:type="commands:Handler" xmi:id="_Xi9w8K22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewNameHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewNameHandler" command="_1CaG8K21EeeykrJkROy5EA"/>
363 364
    <elements xsi:type="commands:Handler" xmi:id="_ahCroK22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewTeamHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewTeamHandler" command="_2vSfgK21EeeykrJkROy5EA"/>
364 365
    <elements xsi:type="commands:Handler" xmi:id="_c0Ba4K22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewPersonHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewPersonHandler" command="_4nv18K21EeeykrJkROy5EA"/>
366
    <elements xsi:type="commands:Handler" xmi:id="_jkqm0C0vEeiiqYcnQ2drEA" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForGatheringEvent" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForGatheringEvent" command="_eTTa4C0vEeiiqYcnQ2drEA"/>
365 367
  </fragments>
366 368
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_OyvD8KNOEee5fYT78qEx0A" featurename="children" parentElementId="bulkeditor.menus.openmenu" positionInList="last">
367 369
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_SZZBkKNOEee5fYT78qEx0A" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.specimen_editor" label="%command.label.DERIVATIVE_EDITOR" tooltip="%command.label.DERIVATIVE_EDITOR" command="_PDjFMLsKEeeQJq8FDGEi1g"/>
eu.etaxonomy.taxeditor.editor/plugin.xml
619 619
            selection="eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache"
620 620
            viewerName="Working Set Editor">
621 621
      </viewCommandMapping>
622
      <viewCommandMapping
623
            commandId="eu.etaxonomy.taxeditor.openSpecimenEditorForGatheringEvent"
624
            selection="eu.etaxonomy.cdm.model.occurrence.GatheringEvent"
625
            viewerName="%viewCommandMapping.viewerName.SPECIMEN_EDITOR">
626
      </viewCommandMapping>
622 627
    </extension>
623 628
   <extension
624 629
         id="eu.etaxonomy.taxeditor.editor.workbench.model"
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForGatheringEvent.java
1
package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
2

  
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.List;
6
import java.util.UUID;
7

  
8
import org.eclipse.e4.ui.workbench.modeling.EPartService;
9
import org.eclipse.swt.widgets.Shell;
10

  
11
import eu.etaxonomy.cdm.api.service.IEventBaseService;
12
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
13
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
14
import eu.etaxonomy.cdm.model.common.ICdmBase;
15
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
16
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
17
import eu.etaxonomy.taxeditor.editor.EditorUtil;
18
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
19
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
20
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

  
23
public class OpenDerivativeEditorForGatheringEvent extends DefaultOpenHandlerBaseE4<GatheringEvent> {
24

  
25
    protected static final String OPEN_DERIVATIVE_EDITOR_FOR_TAXON_NODE_COULD_NOT_OPEN = Messages.OpenDerivativeEditorForTaxonNode_COULD_NOT_OPEN;
26

  
27
    @Override
28
    protected GatheringEvent getEntity(UUID uuid) {
29
        ICdmBase load = CdmStore.getService(IEventBaseService.class).load(uuid);
30
        return HibernateProxyHelper.deproxy(load, GatheringEvent.class );
31
    }
32

  
33
    @Override
34
    protected void open(GatheringEvent entity, Shell shell, EPartService partService) {
35
        Collection<UUID> specimenUuids = new ArrayList<UUID>();
36
        List<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnitsForGatheringEvent(entity.getUuid());
37
        fieldUnits.forEach(fieldUnit->specimenUuids.add(fieldUnit.getUuid()));
38
        DerivateViewEditorInput input = new DerivateViewEditorInput(specimenUuids);
39
        EditorUtil.openSpecimenEditor(input, modelService, partService, application);
40
    }
41

  
42
    /**
43
     * {@inheritDoc}
44
     */
45
    @Override
46
    protected boolean canExecute(GatheringEvent entity) {
47
        return true;
48
    }
49

  
50
}

Also available in: Unified diff