Project

General

Profile

« Previous | Next » 

Revision 4fff2d21

Added by Katja Luther about 5 years ago

fix #7428: ask for saving and update open views for subtree operations

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java
20 20
import java.util.Set;
21 21
import java.util.UUID;
22 22

  
23
import org.eclipse.core.commands.ExecutionException;
24
import org.eclipse.core.commands.operations.IOperationHistory;
25
import org.eclipse.core.runtime.IAdaptable;
26
import org.eclipse.core.runtime.IStatus;
27
import org.eclipse.core.runtime.Status;
23 28
import org.eclipse.e4.ui.di.UISynchronize;
29
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
24 30

  
25 31
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
26 32
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
......
44 50
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
45 51
import eu.etaxonomy.taxeditor.editor.ChooseFromMultipleAcceptedTaxaDialog;
46 52
import eu.etaxonomy.taxeditor.editor.ChooseFromMultipleTaxonNodesDialog;
47
import eu.etaxonomy.taxeditor.editor.EditorUtil;
48 53
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
54
import eu.etaxonomy.taxeditor.model.AbstractUtility;
49 55
import eu.etaxonomy.taxeditor.model.DataChangeBridge;
50 56
import eu.etaxonomy.taxeditor.model.MessagingUtils;
51 57
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
52 58
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
59
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
53 60
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
54 61
import eu.etaxonomy.taxeditor.store.CdmStore;
62
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
55 63

  
56 64

  
57 65
/**
......
369 377
        }
370 378
        toDeletes.clear();
371 379
        for(AbstractPostOperation entry:operations){
372
            EditorUtil.executeOperation(entry,sync);
380
            IStatus status = Status.CANCEL_STATUS;
381
            final IAdaptable uiInfoAdapter = WorkspaceUndoUtil
382
                    .getUIInfoAdapter(AbstractUtility.getShell());
383
            String operationlabel = entry.getLabel();
384
            try {
385
                entry.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
386
                status = entry.execute(null, uiInfoAdapter);
387
            } catch (ExecutionException e) {
388

  
389
                MessagingUtils.operationDialog(AbstractUtility.class, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
390

  
391
            }
392

  
393
            String statusString = status.equals(Status.OK_STATUS) ? "completed"
394
                    : "cancelled";
395

  
396
            IPostOperationEnabled postOperationEnabled = entry
397
                    .getPostOperationEnabled();
398
            if (postOperationEnabled != null) {
399
                postOperationEnabled.onComplete();
400
            }
401

  
402

  
403
            //AbstractUtility.executeOperation(entry,sync);
373 404
        }
374
        operations.clear();
375 405

  
406
        operations.clear();
376 407
        for (Synonym syn: toSaveNewSynonyms){
377 408
            for (HybridRelationship rel : syn.getName().getHybridChildRelations()){
378 409
//                if (!rel.getParentName().isPersited()) {
......
404 435

  
405 436
        CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
406 437

  
438

  
407 439
    }
408 440

  
409 441
    /**

Also available in: Unified diff