Project

General

Profile

« Previous | Next » 

Revision a022f6f0

Added by Patrick Plitzner over 8 years ago

  • derivate view shows derivate hierarchy of FieldUnits and DerivedUnits

View differences:

.gitattributes
117 117
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java -text
118 118
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportEditor.java -text
119 119
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportEditorLineDisplayStrategy.java -text
120
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportSpecimenEditorInput.java -text
120
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DerivedUnitEditorInput.java -text
121 121
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/transientServices/TransientAgentService.java -text
122 122
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/transientServices/TransientCdmRepository.java -text
123 123
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/transientServices/TransientClassificationService.java -text
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/AnnotatedLineDocumentProvider.java
26 26
import org.eclipse.ui.texteditor.AbstractDocumentProvider;
27 27

  
28 28
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
29
import eu.etaxonomy.taxeditor.dataimport.DataImportSpecimenEditorInput;
29
import eu.etaxonomy.taxeditor.dataimport.DerivedUnitEditorInput;
30 30
import eu.etaxonomy.taxeditor.model.AbstractUtility;
31 31

  
32 32

  
......
219 219
		if (element instanceof AbstractBulkEditorInput) {
220 220
			return ((AbstractBulkEditorInput)element).getModel();
221 221
		}
222
		else if(element instanceof DataImportSpecimenEditorInput){
223
		    return ((DataImportSpecimenEditorInput) element).getResults();
222
		else if(element instanceof DerivedUnitEditorInput){
223
		    return ((DerivedUnitEditorInput) element).getResults();
224 224
		}
225 225
		return null;
226 226
	}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DataImportSpecimenEditorInput.java
1
// $Id$
2
/**
3
* Copyright (C) 2013 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.dataimport;
11

  
12
import java.io.IOException;
13
import java.io.InputStream;
14
import java.net.URISyntaxException;
15
import java.util.List;
16

  
17
import org.apache.http.client.ClientProtocolException;
18
import org.apache.log4j.Logger;
19
import org.eclipse.jface.resource.ImageDescriptor;
20
import org.eclipse.ui.IEditorInput;
21
import org.eclipse.ui.IPersistableElement;
22

  
23
import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
24
import eu.etaxonomy.cdm.ext.biocase.BioCaseQueryServiceWrapper;
25
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
26
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
27
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
28
import eu.etaxonomy.taxeditor.dataimport.transientServices.TransientCdmRepository;
29
import eu.etaxonomy.taxeditor.store.CdmStore;
30

  
31
/**
32
 * @author pplitzner
33
 * @date 20.09.2013
34
 *
35
 */
36
public class DataImportSpecimenEditorInput implements IEditorInput {
37

  
38
    private static Logger logger = Logger.getLogger(DataImportSpecimenEditorInput.class);
39

  
40
    private BioCaseQuery query;
41

  
42
    /**
43
     * @param results
44
     */
45
    public DataImportSpecimenEditorInput(BioCaseQuery query) {
46
        this.query = query;
47
    }
48

  
49
    /* (non-Javadoc)
50
     * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
51
     */
52
    @Override
53
    public Object getAdapter(Class adapter) {
54
        // TODO Auto-generated method stub
55
        return null;
56
    }
57

  
58
    /* (non-Javadoc)
59
     * @see org.eclipse.ui.IEditorInput#exists()
60
     */
61
    @Override
62
    public boolean exists() {
63
        return false;
64
    }
65

  
66
    /* (non-Javadoc)
67
     * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
68
     */
69
    @Override
70
    public ImageDescriptor getImageDescriptor() {
71
        // TODO Auto-generated method stub
72
        return null;
73
    }
74

  
75
    /* (non-Javadoc)
76
     * @see org.eclipse.ui.IEditorInput#getName()
77
     */
78
    @Override
79
    public String getName() {
80
        return query.toString();
81
    }
82

  
83
    /* (non-Javadoc)
84
     * @see org.eclipse.ui.IEditorInput#getPersistable()
85
     */
86
    @Override
87
    public IPersistableElement getPersistable() {
88
        return null;
89
    }
90

  
91
    /* (non-Javadoc)
92
     * @see org.eclipse.ui.IEditorInput#getToolTipText()
93
     */
94
    @Override
95
    public String getToolTipText() {
96
        return query.toString();
97
    }
98

  
99
    /**
100
     * @return the results
101
     */
102
    public List<SpecimenOrObservationBase> getResults() {
103
        List<SpecimenOrObservationBase> results = null;
104
        String errorMessage = "Could not execute query " + query;
105
        try {
106
            InputStream resultStream = new BioCaseQueryServiceWrapper().query(query);
107
            Abcd206ImportConfigurator configurator = Abcd206ImportConfigurator.NewInstance(resultStream, null, false);
108
            TransientCdmRepository repo = new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration());
109
            configurator.setCdmAppController(repo);
110

  
111
            CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>();
112
            importer.invoke(configurator);
113
            results = repo.getUnits();
114
//            Abcd206Import abcd206Import = new Abcd206Import();
115
//            Abcd206ImportState state = new Abcd206ImportState(configurator);
116
//            abcd206Import.invoke(state);
117
//            state.countTrees();
118
        } catch (ClientProtocolException e) {
119
            logger.error(errorMessage, e);
120
        } catch (IOException e) {
121
            logger.error(errorMessage, e);
122
        } catch (URISyntaxException e) {
123
            logger.error(errorMessage, e);
124
        }
125
//        return new BioCaseQueryServiceWrapper().dummyData();
126
        return results;
127
    }
128

  
129
    /* (non-Javadoc)
130
     * @see java.lang.Object#hashCode()
131
     */
132
    @Override
133
    public int hashCode() {
134
        final int prime = 31;
135
        int result = 1;
136
        result = prime * result + ((query == null) ? 0 : query.hashCode());
137
        return result;
138
    }
139

  
140
    /* (non-Javadoc)
141
     * @see java.lang.Object#equals(java.lang.Object)
142
     */
143
    @Override
144
    public boolean equals(Object obj) {
145
        if (this == obj) {
146
            return true;
147
        }
148
        if (obj == null) {
149
            return false;
150
        }
151
        if (getClass() != obj.getClass()) {
152
            return false;
153
        }
154
        DataImportSpecimenEditorInput other = (DataImportSpecimenEditorInput) obj;
155
        if (query == null) {
156
            if (other.query != null) {
157
                return false;
158
            }
159
        } else if (!query.equals(other.query)) {
160
            return false;
161
        }
162
        return true;
163
    }
164

  
165
}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DerivedUnitEditorInput.java
1
// $Id$
2
/**
3
* Copyright (C) 2013 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.dataimport;
11

  
12
import java.io.IOException;
13
import java.io.InputStream;
14
import java.net.URISyntaxException;
15
import java.util.ArrayList;
16
import java.util.List;
17

  
18
import org.apache.http.client.ClientProtocolException;
19
import org.apache.log4j.Logger;
20
import org.eclipse.jface.resource.ImageDescriptor;
21
import org.eclipse.ui.IEditorInput;
22
import org.eclipse.ui.IPersistableElement;
23

  
24
import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
25
import eu.etaxonomy.cdm.ext.biocase.BioCaseQueryServiceWrapper;
26
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
27
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
28
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
29
import eu.etaxonomy.taxeditor.dataimport.transientServices.TransientCdmRepository;
30
import eu.etaxonomy.taxeditor.store.CdmStore;
31

  
32
/**
33
 * @author pplitzner
34
 * @date 20.09.2013
35
 *
36
 */
37
public class DerivedUnitEditorInput implements IEditorInput {
38

  
39
    private static Logger logger = Logger.getLogger(DerivedUnitEditorInput.class);
40

  
41
    private final BioCaseQuery query;
42

  
43
    private List<SpecimenOrObservationBase> results;
44

  
45
    /**
46
     * @param results
47
     */
48
    public DerivedUnitEditorInput(BioCaseQuery query) {
49
        this.query = query;
50
        results = new ArrayList<SpecimenOrObservationBase>();
51
    }
52

  
53
    /* (non-Javadoc)
54
     * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
55
     */
56
    @Override
57
    public Object getAdapter(Class adapter) {
58
        // TODO Auto-generated method stub
59
        return null;
60
    }
61

  
62
    /* (non-Javadoc)
63
     * @see org.eclipse.ui.IEditorInput#exists()
64
     */
65
    @Override
66
    public boolean exists() {
67
        return false;
68
    }
69

  
70
    /* (non-Javadoc)
71
     * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
72
     */
73
    @Override
74
    public ImageDescriptor getImageDescriptor() {
75
        // TODO Auto-generated method stub
76
        return null;
77
    }
78

  
79
    /* (non-Javadoc)
80
     * @see org.eclipse.ui.IEditorInput#getName()
81
     */
82
    @Override
83
    public String getName() {
84
        return query.toString();
85
    }
86

  
87
    /* (non-Javadoc)
88
     * @see org.eclipse.ui.IEditorInput#getPersistable()
89
     */
90
    @Override
91
    public IPersistableElement getPersistable() {
92
        return null;
93
    }
94

  
95
    /* (non-Javadoc)
96
     * @see org.eclipse.ui.IEditorInput#getToolTipText()
97
     */
98
    @Override
99
    public String getToolTipText() {
100
        return query.toString();
101
    }
102

  
103
    /**
104
     * @return the results
105
     */
106
    public List<SpecimenOrObservationBase> getResults() {
107
        if(results!=null && !results.isEmpty()){
108
            return results;
109
        }
110
        String errorMessage = "Could not execute query " + query;
111
        try {
112
            InputStream resultStream = new BioCaseQueryServiceWrapper().query(query);
113
            Abcd206ImportConfigurator configurator = Abcd206ImportConfigurator.NewInstance(resultStream, null, false);
114
            TransientCdmRepository repo = new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration());
115
            configurator.setCdmAppController(repo);
116

  
117
            CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>();
118
            importer.invoke(configurator);
119
            results = repo.getUnits();
120
//            Abcd206Import abcd206Import = new Abcd206Import();
121
//            Abcd206ImportState state = new Abcd206ImportState(configurator);
122
//            abcd206Import.invoke(state);
123
//            state.countTrees();
124
        } catch (ClientProtocolException e) {
125
            logger.error(errorMessage, e);
126
        } catch (IOException e) {
127
            logger.error(errorMessage, e);
128
        } catch (URISyntaxException e) {
129
            logger.error(errorMessage, e);
130
        }
131
//        return new BioCaseQueryServiceWrapper().dummyData();
132
        return results;
133
    }
134

  
135
    /* (non-Javadoc)
136
     * @see java.lang.Object#hashCode()
137
     */
138
    @Override
139
    public int hashCode() {
140
        final int prime = 31;
141
        int result = 1;
142
        result = prime * result + ((query == null) ? 0 : query.hashCode());
143
        return result;
144
    }
145

  
146
    /* (non-Javadoc)
147
     * @see java.lang.Object#equals(java.lang.Object)
148
     */
149
    @Override
150
    public boolean equals(Object obj) {
151
        if (this == obj) {
152
            return true;
153
        }
154
        if (obj == null) {
155
            return false;
156
        }
157
        if (getClass() != obj.getClass()) {
158
            return false;
159
        }
160
        DerivedUnitEditorInput other = (DerivedUnitEditorInput) obj;
161
        if (query == null) {
162
            if (other.query != null) {
163
                return false;
164
            }
165
        } else if (!query.equals(other.query)) {
166
            return false;
167
        }
168
        return true;
169
    }
170

  
171
}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/transientServices/TransientTaxonService.java
29 29
import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
30 30
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
31 31
import eu.etaxonomy.cdm.api.service.config.MatchingTaxonConfigurator;
32
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
32 33
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
34
import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
33 35
import eu.etaxonomy.cdm.api.service.exception.HomotypicalGroupChangeException;
34
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
35 36
import eu.etaxonomy.cdm.api.service.pager.Pager;
36 37
import eu.etaxonomy.cdm.api.service.search.LuceneMultiSearchException;
37 38
import eu.etaxonomy.cdm.api.service.search.SearchResult;
......
86 87
 */
87 88
public class TransientTaxonService implements ITaxonService {
88 89

  
89
    private ITaxonService defaultTaxonService;
90
    private final ITaxonService defaultTaxonService;
90 91

  
91 92
    /**
92 93
     * @param defaultTaxonService
......
735 736
    }
736 737

  
737 738
    /**
738
     * @param taxon
739
     * @param config
740
     * @throws ReferencedObjectUndeletableException
741
     * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator)
742
     */
743
    @Override
744
    public void deleteTaxon(Taxon taxon, TaxonDeletionConfigurator config) throws ReferencedObjectUndeletableException {
745
        defaultTaxonService.deleteTaxon(taxon, config);
746
    }
747

  
748
    /**
749 739
     * @param transientObject
750 740
     * @return
751 741
     * @see eu.etaxonomy.cdm.api.service.IService#saveOrUpdate(eu.etaxonomy.cdm.model.common.ICdmBase)
......
1272 1262
    }
1273 1263

  
1274 1264
    /**
1275
     * @param synonym
1276
     * @param taxon
1277
     * @param removeNameIfPossible
1278
     * @param newHomotypicGroupIfNeeded
1279
     * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon, boolean, boolean)
1280
     */
1281
    @Override
1282
    public void deleteSynonym(Synonym synonym, Taxon taxon, boolean removeNameIfPossible, boolean newHomotypicGroupIfNeeded) {
1283
        defaultTaxonService.deleteSynonym(synonym, taxon, removeNameIfPossible, newHomotypicGroupIfNeeded);
1284
    }
1285

  
1286
    /**
1287 1265
     * @param taxonBase
1288 1266
     * @param type
1289 1267
     * @param pageSize
......
1382 1360
        return defaultTaxonService.createAllInferredSynonyms(taxon, tree, doWithMisappliedNames);
1383 1361
    }
1384 1362

  
1363
    /* (non-Javadoc)
1364
     * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator)
1365
     */
1366
    @Override
1367
    public void deleteSynonym(Synonym arg0, SynonymDeletionConfigurator arg1) {
1368
        defaultTaxonService.deleteSynonym(arg0, arg1);
1369
    }
1370

  
1371
    /* (non-Javadoc)
1372
     * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator)
1373
     */
1374
    @Override
1375
    public void deleteSynonym(Synonym arg0, Taxon arg1, SynonymDeletionConfigurator arg2) {
1376
        defaultTaxonService.deleteSynonym(arg0, arg1, arg2);
1377
    }
1378

  
1379
    /* (non-Javadoc)
1380
     * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator, eu.etaxonomy.cdm.model.taxon.Classification)
1381
     */
1382
    @Override
1383
    public void deleteTaxon(Taxon arg0, TaxonDeletionConfigurator arg1, Classification arg2)
1384
            throws DataChangeNoRollbackException {
1385
        defaultTaxonService.deleteTaxon(arg0, arg1, arg2);
1386
    }
1387

  
1385 1388

  
1386 1389

  
1387 1390
}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/wizard/SpecimenSearchWizard.java
20 20

  
21 21
import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
22 22
import eu.etaxonomy.taxeditor.dataimport.DataImportEditor;
23
import eu.etaxonomy.taxeditor.dataimport.DataImportSpecimenEditorInput;
23
import eu.etaxonomy.taxeditor.dataimport.DerivedUnitEditorInput;
24 24
import eu.etaxonomy.taxeditor.store.CdmStore;
25 25

  
26 26
/**
......
56 56

  
57 57
        try {
58 58
            query = searchPage.getQuery();
59
            DataImportSpecimenEditorInput input = new DataImportSpecimenEditorInput(query);
59
            DerivedUnitEditorInput input = new DerivedUnitEditorInput(query);
60 60
            page.openEditor(input, DataImportEditor.ID, true);
61 61
        } catch ( PartInitException e ) {
62 62
            //Put your exception handler here if you wish to
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateContentProvider.java
1 1
package eu.etaxonomy.taxeditor.editor.view.derivate;
2 2

  
3
import java.util.ArrayList;
3 4
import java.util.Collections;
5
import java.util.List;
6
import java.util.Set;
4 7

  
5 8
import org.eclipse.jface.viewers.ITreeContentProvider;
6 9
import org.eclipse.jface.viewers.Viewer;
7 10

  
11
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
12
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
13
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
14
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
15

  
8 16
public class DerivateContentProvider implements ITreeContentProvider {
9 17

  
10 18
	@Override
......
19 27

  
20 28
	@Override
21 29
	public Object[] getElements(Object inputElement) {
22
		return Collections.singleton(inputElement).toArray();
30
	    // return the parent FieldUnit if element is a DerivedUnit
31
	    if(inputElement instanceof DerivedUnit){
32
	        DerivedUnit derivedUnit = (DerivedUnit)inputElement;
33
	        for(SpecimenOrObservationBase original:derivedUnit.getOriginals()){
34
	          if(original instanceof FieldUnit){
35
	              return Collections.singletonList(original).toArray();
36
	          }
37
	          else{
38
	              return getElements(original);
39
	          }
40
	        }
41
	    }
42
	    // return the FieldUnit itself if element is a FieldUnit (used clone() due to recursion issues -> see javadoc of this method)
43
	    else if(inputElement instanceof FieldUnit){
44
	        FieldUnit fieldUnit = ((FieldUnit) inputElement).clone();
45
	        fieldUnit.getTitleCache();
46
	        return Collections.singleton(fieldUnit).toArray();
47
	    }
48
		return Collections.EMPTY_LIST.toArray();
23 49
	}
24 50

  
25 51
	@Override
26 52
	public Object[] getChildren(Object parentElement) {
27
		return null;
53
	    if(parentElement instanceof SpecimenOrObservationBase){
54
	        return getDerivates((SpecimenOrObservationBase) parentElement).toArray();
55
	    }
56
	    return null;
28 57
	}
29 58

  
30 59
	@Override
31 60
	public Object getParent(Object element) {
32
		// TODO Auto-generated method stub
61
	    if(element instanceof DerivedUnit){
62
	        DerivedUnit derivedUnit = (DerivedUnit)element;
63
	        return derivedUnit.getOriginalUnit();
64
	    }
33 65
		return null;
34 66
	}
35 67

  
36 68
	@Override
37 69
	public boolean hasChildren(Object element) {
38
		// TODO Auto-generated method stub
70
	    if(element instanceof SpecimenOrObservationBase){
71
	        SpecimenOrObservationBase specimenOrObservation = (SpecimenOrObservationBase)element;
72
	        for(DerivationEvent event:(Set<DerivationEvent>)specimenOrObservation.getDerivationEvents()){
73
	            if(!event.getDerivatives().isEmpty()){
74
	                return true;
75
	            }
76
	        }
77
	    }
39 78
		return false;
40 79
	}
41 80

  
81
	private List<DerivedUnit> getDerivates(SpecimenOrObservationBase specimenOrObservation){
82
	    List<DerivedUnit> derivates = new ArrayList<DerivedUnit>();
83
	    for(DerivationEvent derivationEvent:(Set<DerivationEvent>)specimenOrObservation.getDerivationEvents()){
84
	        derivates.addAll(derivationEvent.getDerivatives());
85
	    }
86
	    return derivates;
87
	}
88

  
42 89
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
11 11

  
12 12
import eu.etaxonomy.cdm.model.common.CdmBase;
13 13
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
14
import eu.etaxonomy.taxeditor.model.AbstractUtility;
14 15
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
15 16
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
16 17
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
......
38 39

  
39 40
	@Override
40 41
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
41
	    if(part instanceof BulkEditor && selection instanceof IStructuredSelection){
42
	        showViewer(part, (IStructuredSelection)selection);
42
	    if(AbstractUtility.getActiveEditor()==null || !(AbstractUtility.getActiveEditor() instanceof BulkEditor)){
43
	        showEmptyPage();
43 44
	        return;
44 45
	    }
45
	    else {
46
	        showEmptyPage();
46
	    else if(part instanceof BulkEditor && selection instanceof IStructuredSelection){
47
	        showViewer(part, (IStructuredSelection)selection);
47 48
	        return;
48 49
	    }
49 50
	}

Also available in: Unified diff