Project

General

Profile

Revision 6ac3c9c1

ID6ac3c9c18cc95fd462d8e2ce82dcb0904cce7c6e
Parent f3fb72fd
Child ff9da83e

Added by Katja Luther about 4 years ago

fix #6084: check if areas are selected in preferences before open the distribution editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java
2 2

  
3 3
import java.util.UUID;
4 4

  
5
import org.apache.commons.lang.StringUtils;
5 6
import org.eclipse.core.commands.ExecutionEvent;
6 7
import org.eclipse.ui.PartInitException;
7 8

  
......
32 33
	@Override
33 34
	protected void open(ExecutionEvent event, ITaxonTreeNode entity) {
34 35
		if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE)) {
36
			if (StringUtils.isBlank(PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.DISTRIBUTION_AREA_OCCURENCE_STATUS) )){
37
				MessagingUtils.informationDialog("No Areas to display", "Please choose the areas you want to display. "
38
						+ "Therefore go to the preferences, choose the Checklist Editor and choose the areas in the Distribution Selection Wizard.");
39
				this.dispose();
40
				return;
41
			}
35 42
			if (entity instanceof Classification) {
36 43
				ChecklistEditorInput input = new ChecklistEditorInput(((Classification) entity));
37 44
				try {
38 45
					EditorUtil.open(input);
39 46
				} catch (PartInitException e) {
40
					MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
47
					MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open Distribution Editor", e);
41 48
				} catch (NullPointerException npe) {
42 49
					MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
43
							"Could not open ChecklistView. The hierarchy is corrupted!", npe);
50
							"Could not open Distribution Editor. The hierarchy is corrupted!", npe);
44 51
				}
45 52
			} else if (entity instanceof TaxonNode) {
46 53
				ChecklistEditorInput input = new ChecklistEditorInput((TaxonNode) entity);
47 54
				try {
48 55
					EditorUtil.open(input);
49 56
				} catch (PartInitException e) {
50
					MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
57
					MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open Distribution Editor", e);
51 58
				} catch (NullPointerException npe) {
52 59
					MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
53
							"Could not open ChecklistView. The hierarchy is corrupted!", npe);
60
							"Could not open Distribution Editor. The hierarchy is corrupted!", npe);
54 61
				}
55 62
			}
56 63
		}		
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java
228 228
        selectionService.addSelectionListener(this);
229 229
        viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
230 230
        labelProvider = new ChecklistLabelProvider(this.viewer);
231
        
231 232
        terms = labelProvider.getNamedAreas();
232 233
        if (terms == null){
233 234
			MessagingUtils.informationDialog("No Areas to display", "Please choose the areas you want to display. "
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java
39 39
import eu.etaxonomy.cdm.model.description.TaxonDescription;
40 40
import eu.etaxonomy.cdm.model.name.NonViralName;
41 41
import eu.etaxonomy.cdm.model.taxon.Taxon;
42
import eu.etaxonomy.taxeditor.model.MessagingUtils;
42 43
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
43 44
import eu.etaxonomy.taxeditor.store.CdmStore;
44 45

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)