Revision 924cc33b
Added by Katja Luther about 4 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/e4/ReferencingObjectsViewE4.java | ||
---|---|---|
63 | 63 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
64 | 64 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
65 | 65 |
import eu.etaxonomy.cdm.model.common.EventBase; |
66 |
import eu.etaxonomy.cdm.model.permission.Group; |
|
67 | 66 |
import eu.etaxonomy.cdm.model.common.IdentifiableEntity; |
68 |
import eu.etaxonomy.cdm.model.permission.User; |
|
69 | 67 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
70 | 68 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
71 | 69 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
... | ... | |
74 | 72 |
import eu.etaxonomy.cdm.model.molecular.Sequence; |
75 | 73 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
76 | 74 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
75 |
import eu.etaxonomy.cdm.model.permission.Group; |
|
76 |
import eu.etaxonomy.cdm.model.permission.User; |
|
77 | 77 |
import eu.etaxonomy.cdm.model.reference.Reference; |
78 | 78 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
79 | 79 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
... | ... | |
82 | 82 |
import eu.etaxonomy.cdm.persistence.dto.TermDto; |
83 | 83 |
import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsContentProvider; |
84 | 84 |
import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsLabelProvider; |
85 |
import eu.etaxonomy.taxeditor.editor.IReferencingObjectsView; |
|
85 | 86 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
86 | 87 |
import eu.etaxonomy.taxeditor.model.DescriptionHelper; |
87 | 88 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
93 | 94 |
* @since Aug 16, 2017 |
94 | 95 |
* |
95 | 96 |
*/ |
96 |
public class ReferencingObjectsViewE4 extends AbstractCdmEditorPartE4 { |
|
97 |
public class ReferencingObjectsViewE4 extends AbstractCdmEditorPartE4 implements IReferencingObjectsView{
|
|
97 | 98 |
|
98 | 99 |
private static final Logger logger = Logger |
99 | 100 |
.getLogger(ReferencingObjectsViewE4.class); |
... | ... | |
191 | 192 |
viewer.setColumnProperties(titles); |
192 | 193 |
} |
193 | 194 |
|
194 |
public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) { |
|
195 |
@Override |
|
196 |
public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) { |
|
195 | 197 |
if (actualUuid == entityUUID){ |
196 | 198 |
return ; |
197 | 199 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsViewHandler.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.handler.defaultHandler; |
2 | 2 |
|
3 |
import java.util.UUID; |
|
4 |
|
|
3 | 5 |
import javax.inject.Named; |
4 | 6 |
|
5 | 7 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
... | ... | |
9 | 11 |
import org.eclipse.e4.ui.services.IServiceConstants; |
10 | 12 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
11 | 13 |
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; |
14 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
12 | 15 |
|
16 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
17 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
|
13 | 18 |
import eu.etaxonomy.taxeditor.bulkeditor.AppModelId; |
19 |
import eu.etaxonomy.taxeditor.editor.IReferencingObjectsView; |
|
14 | 20 |
|
15 | 21 |
public class OpenReferencingObjectsViewHandler { |
16 | 22 |
|
23 |
Object selectedObject; |
|
17 | 24 |
@Execute |
18 | 25 |
public void execute(EPartService partService) { |
19 | 26 |
MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4); |
20 | 27 |
part = partService.showPart(part, PartState.ACTIVATE); |
28 |
IReferencingObjectsView view = (IReferencingObjectsView)part.getObject(); |
|
29 |
UUID uuid = null; |
|
30 |
Class clazz = null; |
|
31 |
|
|
32 |
if (selectedObject instanceof IStructuredSelection){ |
|
33 |
selectedObject = ((IStructuredSelection)selectedObject).getFirstElement(); |
|
34 |
} |
|
35 |
if (selectedObject instanceof CdmBase){ |
|
36 |
uuid = ((CdmBase)selectedObject).getUuid(); |
|
37 |
clazz = selectedObject.getClass(); |
|
38 |
} else if (selectedObject instanceof UuidAndTitleCache){ |
|
39 |
uuid = ((UuidAndTitleCache)selectedObject).getUuid(); |
|
40 |
clazz = ((UuidAndTitleCache)selectedObject).getType(); |
|
41 |
} |
|
42 |
if (uuid != null && clazz != null){ |
|
43 |
view.updateReferencingObjects(uuid, clazz); |
|
44 |
} |
|
45 |
|
|
46 |
|
|
47 |
|
|
21 | 48 |
} |
22 | 49 |
|
23 | 50 |
@CanExecute |
... | ... | |
27 | 54 |
boolean canExecute = false; |
28 | 55 |
MPart part = partService.findPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4); |
29 | 56 |
canExecute = !part.equals(activePart); |
57 |
|
|
58 |
|
|
59 |
if (canExecute){ |
|
60 |
String commandId = menuItem.getCommand().getElementId(); |
|
61 |
selectedObject = menuItem.getTransientData().get(commandId+".uuid"); |
|
62 |
if (selectedObject instanceof IStructuredSelection){ |
|
63 |
canExecute = ((IStructuredSelection)selectedObject).size() == 1; |
|
64 |
} |
|
65 |
} |
|
30 | 66 |
menuItem.setVisible(canExecute); |
31 | 67 |
return canExecute; |
32 | 68 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenTaxonNodeWizardHandlerE4.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
@Override |
50 | 50 |
public boolean canExecute(Object selection) { |
51 |
if (((IStructuredSelection)selection).getFirstElement() instanceof TaxonNodeDto){ |
|
51 |
if (((IStructuredSelection)selection).getFirstElement() instanceof TaxonNodeDto && ((IStructuredSelection)selection).size() == 1){
|
|
52 | 52 |
return ((TaxonNodeDto)((IStructuredSelection)selection).getFirstElement()).getTaxonUuid()!=null && PreferencesUtil.getBooleanValue(PreferencePredicate.ShowTaxonNodeWizard.getKey()); |
53 | 53 |
} |
54 | 54 |
return false; |
Also available in: Unified diff
ref #8890: handle dynamic menu for ref objects view and taxonnode wizard correctly