Project

General

Profile

Revision 8fb03377

ID8fb03377c4f3379f249969ed38e1c69180e3e127
Parent 8136f2a8
Child 81bfa200

Added by Patrick Plitzner almost 3 years ago

ref #6595 Do not open name editor twice for same taxon

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
78 78
	 */
79 79
	public static void openTaxonNodeE4(UUID taxonNodeUuid) throws Exception {
80 80
	    //FIXME E4 this can probably be removed when fully migrated
81
	    String editorId = "eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4";
81 82
        TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid);
82 83
        EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
83
        MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
84
        Collection<MPart> parts = partService.getParts();
85
        MPart part = null;
86
        //check if part is already opened
87
        for (MPart mPart : parts) {
88
            if(mPart.getObject() instanceof TaxonNameEditorE4
89
                    && ((TaxonNameEditorE4) mPart.getObject()).getTaxon().equals(input.getTaxon())){
90
                part = mPart;
91
                break;
92
            }
93
        }
94
        if(part==null){
95
            part = partService.createPart(editorId);
96
            part = partService.showPart(part, PartState.ACTIVATE);
97
            TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
98
            editor.init(input);
99
        }
84 100
        part = partService.showPart(part, PartState.ACTIVATE);
85
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
86
        editor.init(input);
87 101
	}
88 102

  
89 103
	public static void openTaxonBaseE4(UUID taxonBaseUuid) {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)