Project

General

Profile

« Previous | Next » 

Revision 9fd1d846

Added by Katja Luther about 4 years ago

ref #9173: missing changes to avoid NPE when moving syn in homotypic group

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/dnd/NameEditorDropTargetListenerE4.java
80 80
		} else {
81 81
			AbstractUtility.executeOperation(operation, target.getContext().get(UISynchronize.class));
82 82
		}
83
		target.getEditor().getConversationHolder().commit();
84
		if (!target.equals(EventUtility.getTaxonEditor())){
85
		    ((TaxonNameEditorE4)EventUtility.getTaxonEditor()).redraw();
86
			((TaxonNameEditorE4)EventUtility.getTaxonEditor()).getConversationHolder().commit();
87

  
88
		}
83
//		target.getEditor().getConversationHolder().commit();
84

  
85
//		if (!target.getEditor().equals(EventUtility.getTaxonEditor())){
86
//		    EditorUtil.updateEditor(target.getEditor().getTaxonNode(), target.getEditor());
87
//		    if (taxonBase instanceof Synonym){
88
//		        Synonym syn = (Synonym)taxonBase;
89
//		        EditorUtil.updateEditor(((Synonym) taxonBase).getAcceptedTaxon());
90
//		    }
91
//		   // ((TaxonNameEditorE4)EventUtility.getTaxonEditor()).redraw();
92
//			((TaxonNameEditorE4)EventUtility.getTaxonEditor()).getConversationHolder().commit();
93
//
94
//		}
89 95
//		target.getEditor().redraw();
90 96

  
91 97
//		target.getEditor().getContainer(taxonBase).setFocus();
......
99 105

  
100 106
			if(target instanceof AbstractHomotypicalGroupContainerE4){
101 107
				HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainerE4) target).getGroup();
108
				if (((AbstractHomotypicalGroupContainerE4) target).getEditor().getTaxon().equals(synonym.getAcceptedTaxon())){
109
				    //the actual accepted taxon is the same as the taxon of the target editor
110
				    try{
111
				        return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(),
112
				    				            ((AbstractHomotypicalGroupContainerE4) target).getEditor().getTaxon(), synonym, homotypicalGroup, target);
113
				    }catch (NullPointerException e){
114
				        return null;
115
				    }
116
				 } else{
117
                    getEditor().getConversationHolder().commit();
118
                    ((TaxonNameEditorE4) target).getConversationHolder().commit();
119

  
120
                    return new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.NameEditorDropTargetListener_CHANGE_ACC_TAXON, getEditor().getUndoContext(), synonym.getUuid(), ((TaxonNameEditorE4) target).getTaxon(), (TaxonNameEditorE4) target, (TaxonNameEditorE4) target);
121

  
122
                }
102 123

  
103
				return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(),
104
						getEditor().getTaxon(), synonym, homotypicalGroup, target);
105 124
			}
106 125
			else if(target instanceof MisappliedGroupE4){
107 126
				return new ChangeSynonymToMisapplicationOperation(Messages.NameEditorDropTargetListener_CHANGE_SYNONYM_TO_MISAPP, getEditor().getUndoContext(),
108 127
						getEditor().getTaxon(), synonym, target);
109 128
			}
110 129
			else if(target instanceof TaxonNameEditorE4){
111
				if (target.equals(getEditor())){
130
				if (((TaxonNameEditorE4) target).getTaxon().equals(synonym.getAcceptedTaxon())){
112 131
					return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(),
113
						getEditor().getTaxon(), synonym, null, target);
132
					        ((TaxonNameEditorE4) target).getTaxon(), synonym, null, target);
114 133
				} else{
115 134
					getEditor().getConversationHolder().commit();
116 135
					((TaxonNameEditorE4) target).getConversationHolder().commit();

Also available in: Unified diff