Project

General

Profile

« Previous | Next » 

Revision 821fe02d

Added by Katja Luther over 3 years ago

create new branch webapp

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
56 56
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
57 57
import eu.etaxonomy.taxeditor.model.AbstractUtility;
58 58
import eu.etaxonomy.taxeditor.model.MessagingUtils;
59
import eu.etaxonomy.taxeditor.security.RequiredPermissions;
60
import eu.etaxonomy.taxeditor.store.CdmStore;
59 61
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
60 62
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
61 63

  
......
217 219
        }
218 220
        boolean hasPermission = false;
219 221
//        if (node != null){
220
//            hasPermission = CdmStore.currentAuthentiationHasPermission(node, RequiredPermissions.TAXON_EDIT);
222
            hasPermission = CdmStore.currentAuthentiationHasPermission(node, RequiredPermissions.TAXON_EDIT);
221 223
//        }
222 224
//        if (!hasPermission){
223 225
//            MessagingUtils.warningDialog(Messages.EditorUtil_MISSING_PERMISSION, TaxonEditorInputE4.class, Messages.EditorUtil_MISSING_PERMISSION_MESSAGE);
......
251 253
        MPart part = showPart(NAME_EDITOR_ID, modelService, partService, application);
252 254

  
253 255
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
256
//        editor.setDisabled();
254 257
        editor.init(input);
255

  
258
//        editor.setEnabled();
259
        editor.setFocus();
256 260
        if (factsVisible){
257 261
            showFacts(modelService, partService);
258 262
            factsVisible = false;
......
263 267
            mediaVisible = false;
264 268
        }
265 269

  
266
        editor.setFocus();
270

  
267 271
    }
268 272

  
269 273
    public static void showMedia(EModelService modelService, EPartService partService) {
......
501 505
        }
502 506
    }
503 507

  
508
    public static void closeObsoleteEditorWithChildren(TaxonNodeDto taxonNode, EPartService partService){
509
        String treeIndex = taxonNode.getTreeIndex();
510
        Collection<MPart> parts = partService.getParts();
511
        for (MPart part : parts) {
512
            Object object = part.getObject();
513
            if(object instanceof TaxonNameEditorE4){
514
                TaxonNameEditorE4 taxonEditor = (TaxonNameEditorE4)object;
515
                TaxonNode node = taxonEditor.getEditorInput().getTaxonNode();
516
                if (node.treeIndex()!= null){
517
                    if(node.treeIndex().startsWith(treeIndex)){
518
                        if (part.isDirty()){
519
                            forceUserSaveE4Editor(taxonEditor, getShell());
520
                        }
521
                        partService.hidePart(part);
522
                    }
523
                }else{
524
                    logger.debug("The taxonnode of taxon " + node.getTaxon().getTitleCache() + " uuid: " + node.getUuid() + " has no treeindex");;
525
                }
526
            }
527
        }
528
    }
529

  
504 530

  
505 531
    public static void closeObsoleteDescriptiveDatasetEditor(UUID datasetUuid, EPartService partService){
506 532

  
......
539 565
        if(node.treeIndex().equals(treeIndex)){
540 566
        	TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(node.getUuid());
541 567
        	editor.init(input);
542

  
543

  
544 568
        }
545 569
    }
546 570

  

Also available in: Unified diff