Project

General

Profile

Revision 81783422

ID81783422841a30cafa9e79bb93593cba32b1c963
Parent 4f857230
Child a07e7327

Added by Katja Luther over 2 years ago

some smaller changes for drag & drop of factual data

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java
14 14
import org.eclipse.core.runtime.IAdaptable;
15 15
import org.eclipse.core.runtime.IProgressMonitor;
16 16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.core.runtime.Status;
17 18

  
18 19
import eu.etaxonomy.cdm.api.application.ICdmRepository;
19 20
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
20 21
import eu.etaxonomy.cdm.api.service.DeleteResult;
21 22
import eu.etaxonomy.cdm.api.service.ITaxonService;
22
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
23 23
import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
24 24
import eu.etaxonomy.cdm.model.taxon.Synonym;
25 25
import eu.etaxonomy.cdm.model.taxon.SynonymType;
......
73 73
		ITaxonService service = controller.getTaxonService();
74 74

  
75 75

  
76
		result = service.deleteSynonym(synonym.getUuid(), (SynonymDeletionConfigurator)configurator);
76
		result = service.isDeletable(synonym.getUuid(), configurator);
77 77

  
78 78

  
79 79

  
80 80
		monitor.worked(40);
81 81

  
82 82
		// Redraw editor if exists
83

  
84
		return postExecute(element);
83
		return Status.OK_STATUS;
84
//		return postExecute(element);
85 85
	}
86 86

  
87 87
	/** {@inheritDoc} */
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
208 208
        derivateSearchCompositeController.setEnabled(CdmStore.isActive());
209 209

  
210 210
        //---tree viewer---
211
        viewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
211
        viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
212 212
        GridData gridDataTree = new GridData();
213 213
        gridDataTree.horizontalAlignment = GridData.FILL;
214 214
        gridDataTree.verticalAlignment = GridData.FILL;
......
335 335
        monitor.beginTask(taskName, 3);
336 336
        if (!conversation.isBound()) {
337 337
            conversation.bind();
338
            if (!cdmEntitySession.isActive()){
339
                cdmEntitySession.bind();
340
            }
338 341
        }
339 342
        monitor.worked(1);
340 343

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java
12 12
import java.util.ArrayList;
13 13
import java.util.Collection;
14 14

  
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
15 16
import org.eclipse.jface.viewers.Viewer;
16 17
import org.eclipse.swt.dnd.DND;
17 18
import org.eclipse.swt.dnd.TransferData;
18 19

  
20
import eu.etaxonomy.cdm.model.description.DescriptionBase;
19 21
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
20 22
import eu.etaxonomy.cdm.model.description.TaxonDescription;
21 23
import eu.etaxonomy.taxeditor.editor.EditorUtil;
22 24
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
25
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
26
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
23 27
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation;
24 28
import eu.etaxonomy.taxeditor.model.MessagingUtils;
25
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
29
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
26 30
import eu.etaxonomy.taxeditor.ui.EditViewerDropAdapter;
27 31

  
28 32
/**
......
34 38

  
35 39
    private static final String OPERATION_NOT_SUPPORTED_YET = Messages.DescriptionElementDropAdapter_NOT_SUPPORTED;
36 40

  
41

  
42

  
37 43
    /**
38 44
	 * @param viewer
39 45
	 */
......
68 74
					if (descriptionElement.getInDescription().equals(target)) {
69 75
						return false;
70 76
					}
77
					DescriptionBase<?> description = descriptionElement.getInDescription();
78
					description.removeElement(descriptionElement);
79
					target.addElement(descriptionElement);
71 80

  
81
					if (description.getElements().isEmpty()){
82
					    ((TaxonDescription)description).getTaxon().removeDescription((TaxonDescription)description, false);
83
					}
72 84
					descriptionElements.add(descriptionElement);
73 85
				}
74 86
			}
87
			TaxonNameEditorE4 editor = null;
88
			Object activePart = EditorUtil.getActivePart();
89
			if (activePart instanceof FactualDataPartE4){
90
			    MPart selectionProvidingPart =(MPart) ((FactualDataPartE4)activePart).getSelectionProvidingPart();
91
			    Object obj = selectionProvidingPart.getObject();
92
			    if (obj instanceof TaxonNameEditorE4){
93
			        editor = (TaxonNameEditorE4) obj;
94
			    }
95
			}
96
			AbstractPostTaxonOperation operation = new MoveDescriptionElementsOperation(Messages.DescriptionElementDropAdapter_MOVE_DESC, EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null, sync);
75 97

  
76
			AbstractPostOperation operation = new MoveDescriptionElementsOperation(Messages.DescriptionElementDropAdapter_MOVE_DESC, EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null);
77

  
78
			EditorUtil.executeOperation(operation, sync);
98
			editor.getEditorInput().addOperation(operation);
99
			editor.setDirty();
100
//			EditorUtil.executeOperation(operation, sync);
79 101
			return true;
80 102
		}
81 103
		MessagingUtils.warningDialog(OPERATION_NOT_SUPPORTED_YET, this, Messages.DescriptionElementDropAdapter_NOT_SUPPORTED_EMPTY_ELEMENT);
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java
139 139

  
140 140
            AbstractPostOperation operation = new MoveDescriptionElementsOperation(
141 141
                    menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(),
142
                    targetTaxon.getUuid(), moveMessage, elements, false, this);
142
                    targetTaxon.getUuid(), moveMessage, elements, false, this, null);
143 143

  
144 144
            AbstractUtility.executeOperation(operation, sync);
145 145
        }
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/DeleteTaxonDescriptionOperation.java
63 63

  
64 64
		monitor.worked(20);
65 65
		if (description != null){
66
		    element.removeDescription(description);
66
//		    element.removeDescription(description);
67 67
		    CdmStore.getService(IDescriptionService.class).deleteDescription(description.getUuid());
68
			return postExecute(description);
68
			return postExecute(element);
69 69
		}
70 70
		return null;
71 71

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionElementsOperation.java
19 19
import org.eclipse.core.runtime.IAdaptable;
20 20
import org.eclipse.core.runtime.IProgressMonitor;
21 21
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.e4.ui.di.UISynchronize;
22 23

  
23 24
import eu.etaxonomy.cdm.api.service.IDescriptionService;
24 25
import eu.etaxonomy.cdm.api.service.UpdateResult;
......
41 42
	private UUID targetTaxonUuid;
42 43
	private String moveMessage;
43 44
	private boolean isCopy;
45
	private UISynchronize sync;
44 46

  
45 47
	/**
46 48
	 *
......
54 56
	public MoveDescriptionElementsOperation(String label,
55 57
			IUndoContext undoContext, DescriptionBase targetDescription,
56 58
			Collection<DescriptionElementBase> descriptionElements, boolean isCopy,
57
			IPostOperationEnabled postOperationEnabled) {
59
			IPostOperationEnabled postOperationEnabled, UISynchronize sync) {
58 60
		super(label, undoContext, postOperationEnabled);
59 61
		this.targetDescription = targetDescription;
60 62
		this.descriptionElements = descriptionElements;
61 63
		this.isCopy = isCopy;
62

  
64
		this.sync = sync;
63 65
		service = CdmStore.getService(IDescriptionService.class);
64 66
	}
65 67

  
66 68
	public MoveDescriptionElementsOperation(String label,
67 69
	        IUndoContext undoContext, UUID targetTaxonUuid,String moveMessage,
68 70
	        Collection<DescriptionElementBase> descriptionElements, boolean isCopy,
69
	        IPostOperationEnabled postOperationEnabled) {
71
	        IPostOperationEnabled postOperationEnabled, UISynchronize sync) {
70 72
	    super(label, undoContext, postOperationEnabled);
71 73
	    this.targetTaxonUuid = targetTaxonUuid;
72 74
	    this.descriptionElements = descriptionElements;
73 75
	    this.moveMessage = moveMessage;
74 76
	    this.isCopy = isCopy;
75

  
77
	    this.sync = sync;
76 78
	    service = CdmStore.getService(IDescriptionService.class);
77 79
	}
78 80

  
......
87 89
		for(DescriptionElementBase deBase : descriptionElements) {
88 90
		    descriptionElementsUuid.add(deBase.getUuid());
89 91
		}
90
		UpdateResult result; 
92
		UpdateResult result;
91 93
		if(targetDescription == null){
92 94
			result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetTaxonUuid, moveMessage, isCopy);
93 95

  
94 96
		} else {
95 97
		    UUID targetDescriptionUuid = targetDescription.getUuid();
96 98
		    result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetDescriptionUuid, isCopy);
97
		    
99

  
98 100
		}
99 101
		return postExecute(targetDescription);
100 102
	}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)