Project

General

Profile

« Previous | Next » 

Revision 8e68b46a

Added by Katja Luther over 6 years ago

ref #6159: disable descriptionElementDetails for distribution editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
63 63
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
64 64
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
65 65
import eu.etaxonomy.taxeditor.editor.EditorUtil;
66
import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
66 67
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
67 68
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
68 69
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistContentProvider;
......
88 89
 *
89 90
 */
90 91
public class ChecklistEditorE4 implements IPartContentHasFactualData, IConversationEnabled,
91
        IContextListener, IDirtyMarkable, IPartContentHasDetails, IE4SavablePart{
92
        IContextListener, IDirtyMarkable, IPartContentHasDetails, IE4SavablePart, IDistributionEditor{
92 93

  
93 94
    private static final String DISTRIBUTION_EDITOR = "Distribution Editor";
94 95
	private static final String LOADING_TAXA = Messages.ChecklistEditor_LOAD_TAXA;
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditorHelper.java
12 12
import java.util.Set;
13 13

  
14 14
import org.eclipse.jface.viewers.SelectionChangedEvent;
15
import org.eclipse.jface.viewers.StructuredSelection;
16 15
import org.eclipse.jface.viewers.TableViewer;
17 16
import org.eclipse.jface.viewers.TableViewerEditor;
18 17
import org.eclipse.jface.viewers.ViewerCell;
......
64 63
                  if (distribution.getArea() != null){
65 64
                      if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
66 65
                          if (column.getText().equalsIgnoreCase(distribution.getArea().getIdInVocabulary())) {
67
                              StructuredSelection selection = new StructuredSelection(distribution);
68
//                              SelectionChangedEvent newEvent = new SelectionChangedEvent(event.getSelectionProvider(), selection);
69 66
                              return distribution;
70 67
                          }
71 68
                      }else{
72 69
                          if (column.getText().equalsIgnoreCase(distribution.getArea().getTitleCache())) {
73
                              StructuredSelection selection = new StructuredSelection(distribution);
74
//                              SelectionChangedEvent newEvent = new SelectionChangedEvent(event.getSelectionProvider(), selection);
75 70
                              return distribution;
76 71
                          }
77 72
                      }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/IDistributionEditor.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.editor;
11

  
12
/**
13
 * @author k.luther
14
 * @date 29.09.2017
15
 *
16
 */
17
public interface IDistributionEditor {
18

  
19
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/DistributionDetailElement.java
15 15
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
16 16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17 17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement;
19
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
18 20
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
19 21

  
20 22
/**
......
29 31

  
30 32
	private EntitySelectionElement<NamedArea> selection_namedArea;
31 33
	private TermComboElement<PresenceAbsenceTerm> combo_presenceAbsence;
34
	private boolean namedAreaEditable = true;
32 35

  
33 36

  
34 37
	/**
......
42 45
	public DistributionDetailElement(CdmFormFactory formFactory,
43 46
			ICdmFormElement formElement, Distribution entity, int style) {
44 47
		super(formFactory, formElement, entity, style);
48

  
45 49
	}
46 50

  
47 51
	/** {@inheritDoc} */
......
51 55
		selection_namedArea = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
52 56
				formElement, "Area",
53 57
				entity.getArea(), EntitySelectionElement.NOTHING, style);
58
		ICdmFormElement parent = this.getParentElement();
59
		if (parent instanceof DescriptionElementDetailElement){
60
		    DescriptionElementDetailElement eParent = (DescriptionElementDetailElement)parent;
61
		    ICdmFormElement parent2 = eParent.getParentElement();
62
		    DescriptionElementDetailSection section = (DescriptionElementDetailSection) parent2;
63
		        namedAreaEditable = false;
64

  
65
		}
66
		selection_namedArea.setEnabled(namedAreaEditable);
67

  
54 68
        combo_presenceAbsence = formFactory.createTermComboElement(PresenceAbsenceTerm.class, this, "Distribution Status", entity.getStatus(), style);
55 69

  
56 70
	}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
14 14

  
15 15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16 16
import org.eclipse.jface.viewers.IStructuredSelection;
17
import org.eclipse.jface.viewers.SelectionChangedEvent;
18 17
import org.eclipse.swt.widgets.Composite;
19 18

  
20 19
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
......
79 78
                    return;
80 79
                }
81 80
            }
82
            if (structuredSelection.getFirstElement() instanceof SelectionChangedEvent){
83
                SelectionChangedEvent event = (SelectionChangedEvent)structuredSelection.getFirstElement();
84
                IStructuredSelection sel = (IStructuredSelection) event.getSelection();
85
//                TableViewer tableViewer = ((TableViewer)event.getSource());
86
//                ISelection sel = tableViewer.getSelection();
87
//                TableViewerEditor editor = (TableViewerEditor)tableViewer.getColumnViewerEditor();
81
//            if (partObject instanceof IDistributionEditor){
88 82
//
89
//                ViewerCell cell = tableViewer.getColumnViewerEditor().getFocusCell();
90
//                Distribution dist = (Distribution)cell.getElement();
91
//                int columnIndex = cell.getColumnIndex();
92
                showViewer(sel, activePart, viewer);
93
                return;
94

  
95
            }
83
//                showViewer(structuredSelection, activePart, viewer);
84
//                return;
85
//
86
//            }
96 87
            showViewer(structuredSelection, activePart, viewer);
97 88
            return;
98 89
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
51 51
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
52 52
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
53 53
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
54
import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
54 55
import eu.etaxonomy.taxeditor.model.AbstractUtility;
55 56
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
56 57
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
......
132 133
public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
133 134

  
134 135
    private ISelection selection;
136
    private boolean detailsEnabled = true;
135 137

  
136 138
    public DetailsViewerE4(Composite parent, IDirtyMarkable part) {
137 139
        super(parent, part);
138
    }
139 140

  
141
    }
142
    public void setInput(Object input, Object activePart) {
143
        if (activePart instanceof IDistributionEditor){
144
            detailsEnabled = false;
145
        }
146
        setInput(input);
147
    }
140 148
    // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
141 149
    // since we are getting implementations of DerivedUnitBase from the bulk
142 150
    // editor
......
494 502
    }
495 503

  
496 504
    private void createDescriptionElementSection(RootElement parent) {
497
        destroySections();
498 505

  
506
        destroySections();
499 507
        DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
508
        descriptionElementDetailSection.setEnabled(this.detailsEnabled);
500 509

  
501 510
        //  IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent,  ExpandableComposite.TWISTIE);
502 511

  

Also available in: Unified diff