*/
package eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler;
+import java.util.Collection;
+
import javax.inject.Named;
import org.eclipse.core.runtime.IProgressMonitor;
public void run() {
try {
PolytomousKey key = (PolytomousKey) selectedObject;
-
- MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4");
+ PolytomousKeyEditorInput input = PolytomousKeyEditorInput.NewInstance(key.getUuid());
+
+ //check if editor already open
+ Collection<MPart> parts = partService.getParts();
+ MPart part = null;
+ //check if part is already opened
+ for (MPart mPart : parts) {
+ if(mPart.getObject() instanceof PolytomousKeyListEditorE4
+ && ((PolytomousKeyListEditorE4) mPart.getObject()).getViewerInputKey().equals(input.getKey())){
+ part = mPart;
+ break;
+ }
+ }
+ if(part==null){
+ part = partService.createPart("eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) part.getObject();
+ editor.init(input);
+ }
part = partService.showPart(part, PartState.ACTIVATE);
- PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) part.getObject();
- editor.init(PolytomousKeyEditorInput.NewInstance(key.getUuid()));
} catch(Exception ex) {
MessagingUtils.warningDialog(PolytomousKeyViewLabels.ERROR_OPENING_KEY_EDITOR_MESSAGE,
RemotingEditPolytomousKeyNodesHandlerE4.this,