import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingDeletePolytomousKeyOperation;
if(!confirmation) {
return Status.CANCEL_STATUS;
}
+ closeObsoleteEditor(event);
return Status.OK_STATUS;
}
// TODO Auto-generated method stub
}
+ protected boolean closeObsoleteEditor(ExecutionEvent event){
+ boolean result = true;
+ IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
+
+ for (IEditorReference ref : activePage.getEditorReferences()) {
+ try {
+ IEditorInput input = ref.getEditorInput();
+ if (input instanceof PolytomousKeyEditorInput) {
+ UUID uuidForKey = ((PolytomousKeyEditorInput) input).getKey().getUuid();
+ for (UUID keyUuid :keysToDelete) {
+ if( uuidForKey.equals(keyUuid)){
+ result &= activePage.closeEditor(ref.getEditor(false), false);
+ }
+ }
+
+ }
+ } catch (PartInitException e) {
+ continue;
+ }
+ }
+ return result;
+ }
}
// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
"Choose Polytomous Key", false, PolytomousKeySelectionDialog.class.getCanonicalName(), key);
return getSelectionFromDialog(dialog);
}
-
+
/**
* @param shell
* @param conversation
*/
@Override
protected void initModel() {
- model = CdmStore.getService(IPolytomousKeyService.class).getUuidAndTitleCache();
+ model = CdmStore.getService(IPolytomousKeyService.class).getUuidAndTitleCache(null, null);
}
/* (non-Javadoc)