for(UUID uuid : uuids){
try {
- EditorUtil.openTaxonNode(uuid);
+ EditorUtil.openTaxonNodeE4(uuid);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
* @throws java.lang.Exception
* if any.
*/
- public static void openTaxonNode(UUID taxonNodeUuid) throws Exception {
- TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
- open(input);
- }
-
public static void openTaxonNodeE4(UUID taxonNodeUuid) throws Exception {
- //FIXME E4 this can be removed when fully migrated
+ //FIXME E4 this can probably be removed when fully migrated
TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid);
EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
editor.init(input);
}
- public static void openTaxonBase(UUID taxonBaseUuid)
- throws PartInitException {
- TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
- if (taxonBase != null && taxonBase.isOrphaned()) {
- if(taxonBase.isInstanceOf(Synonym.class)){
- MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
- return;
- }
- else{
- MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
- return;
- }
- }
- TaxonEditorInput input = TaxonEditorInput
- .NewInstanceFromTaxonBase(taxonBaseUuid);
- if(input!=null && input.getTaxonNode()!=null){
- open(input);
- }
- }
-
public static void openTaxonBaseE4(UUID taxonBaseUuid) throws PartInitException{
+ //FIXME E4 this can probably be removed when fully migrated
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
if (taxonBase != null && taxonBase.isOrphaned()) {
return;
}
}
+
TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
- if(input!=null && input.getTaxonNode()!=null){
- EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(EPartService.class);
- MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
- partService.showPart(part, PartState.ACTIVATE);
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
- editor.init(input);
- }
+ EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
+ partService.showPart(part, PartState.ACTIVATE);
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+ editor.init(input);
}
/**
* @param parentNodeUuid
* a {@link java.util.UUID} object.
*/
- public static void openEmpty(UUID parentNodeUuid) throws PartInitException {
- TaxonEditorInput input = TaxonEditorInput
+ public static void openEmptyE4(UUID parentNodeUuid) throws PartInitException {
+ TaxonEditorInputE4 input = TaxonEditorInputE4
.NewEmptyInstance(parentNodeUuid);
- open(input, MultiPageTaxonEditor.ID);
-
- getActiveMultiPageTaxonEditor().changed(null);
-
+ EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
+ partService.showPart(part, PartState.ACTIVATE);
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+ editor.init(input);
}
/**
return null;
}
- /**
- * Opens a taxon editor for the given object if the given object is a valid input.
- * @param object the object for which the editor will be opened
- * @throws PartInitException
- */
- public static void openTaxonEditor(Object object) throws PartInitException {
- if(object instanceof TaxonBase<?>){
- openTaxonBase(((TaxonBase<?>) object).getUuid());
- }
- }
-
public static boolean closeObsoleteEditor(TaxonNode taxonNode, IWorkbenchPage activePage){
boolean result = true;
for (IEditorReference ref : activePage.getEditorReferences()) {
logger.debug("Handler called: " + this.getClass().getCanonicalName()); //$NON-NLS-1$
try {
- EditorUtil.openEmpty(null);
+ EditorUtil.openEmptyE4(null);
} catch (PartInitException e) {
e.printStackTrace();
}
@Override
protected void open(ExecutionEvent event, TaxonBase entity) {
try {
- EditorUtil.openTaxonBase(entity.getUuid());
+ EditorUtil.openTaxonBaseE4(entity.getUuid());
} catch (PartInitException e) {
MessagingUtils.error(DefaultOpenTaxonEditorForTaxonBaseHandler.class, Messages.DefaultOpenTaxonEditorForTaxonBaseHandler_COULD_NOT_OPEN+entity, e);
}
Taxon taxon = getItemTaxon(node);
if (taxon != null) {
try {
- EditorUtil.openTaxonBase((taxon).getUuid());
+ EditorUtil.openTaxonBaseE4((taxon).getUuid());
} catch (PartInitException e) {
MessagingUtils.error(getClass(), e);
}
/**
* 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.
*/
// layoutComposite.setBackground(Display.getDefault().getSystemColor(
// SWT.COLOR_CYAN));
- this.entity = (PolytomousKeyNode) HibernateProxyHelper.deproxy(entity);
+ this.entity = HibernateProxyHelper.deproxy(entity);
Label label_nodeNumber = new Label(getLayoutComposite(), SWT.NULL);
label_nodeNumber.setText(getItemNumber());
linkSelectionListener = new SelectionAdapter() {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.swt.events.SelectionAdapter#widgetSelected(org
* .eclipse.swt.events.SelectionEvent)
if (data instanceof Taxon) {
try {
- EditorUtil.openTaxonBase(((Taxon) data).getUuid());
+ EditorUtil.openTaxonBaseE4(((Taxon) data).getUuid());
} catch (PartInitException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm
* )
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#isDirty()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#commit(boolean)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#setFocus()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#isStale()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#refresh()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#dispose()
*/
@Override
public PolytomousKeyNode getEntity() {
return entity;
}
-
+
@Override
public void setSelected(boolean selected) {
setBackground(selected ? SELECTED : getPersistentBackground());
// Get taxon
Taxon taxon = ((TaxonEditorInput) input).getTaxon();
- TaxonNode parentNode = (TaxonNode) HibernateProxyHelper.deproxy(((TaxonEditorInput) input).getTaxonNode().getParent());
+ TaxonNode parentNode = HibernateProxyHelper.deproxy(((TaxonEditorInput) input).getTaxonNode().getParent());
List<UUID> excludeTaxa = new ArrayList<>();
//excludeTaxa.add(taxon.getUuid());//there are some cases where the accepted taxon should be the parent of the new created accepted taxon
* CdmStore.getTaxonService().getTaxonNodeByUuid(taxonNodeUuid);
* doesn't work yet.
*/
- EditorUtil.openTaxonNode(newNode.getUuid());
+ EditorUtil.openTaxonBaseE4(newNode.getUuid());
} catch (PartInitException e) {
// TODO Auto-generated catch block
@Override
public void run() {
try {
- EditorUtil.openTaxonBase(taxon.getUuid());
+ EditorUtil.openTaxonBaseE4(taxon.getUuid());
} catch (Exception e) {
MessagingUtils.warningDialog(Messages.SwapSynonymAndAcceptedHandler_COULD_NOT_OPEN, this, e.getMessage());
*/
protected void openConcept(TaxonBase<?> relatedTaxon) {
try {
- EditorUtil.openTaxonBase(relatedTaxon.getUuid());
+ EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid());
} catch (PartInitException e) {
MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(),
String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), e);
*/
protected void openConcept(TaxonBase<?> relatedTaxon) {
try {
- EditorUtil.openTaxonBase(relatedTaxon.getUuid());
+ EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid());
} catch (PartInitException e) {
MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(),
String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), e);
if(possibleOpenEditor != null){
AbstractUtility.close(possibleOpenEditor);
}
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
+ EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid);
} catch (PartInitException e) {
MessagingUtils.error(this.getClass(), e);
throw new RuntimeException(e);
if(possibleOpenEditor != null){
AbstractUtility.close(possibleOpenEditor);
}
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
+ EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid);
} catch (PartInitException e) {
MessagingUtils.error(this.getClass(), e);
throw new RuntimeException(e);
if(possibleOpenEditor != null){
AbstractUtility.close(possibleOpenEditor);
}
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
+ EditorUtil.openTaxonBaseE4(newAcceptedTaxonNodeUuid);
} catch (PartInitException e) {
MessagingUtils.error(this.getClass(), e);
throw new RuntimeException(e);
if(possibleOpenEditor != null){
AbstractUtility.close(possibleOpenEditor);
}
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
+ EditorUtil.openTaxonBaseE4(newAcceptedTaxonNodeUuid);
} catch (PartInitException e) {
MessagingUtils.error(this.getClass(), e);
throw new RuntimeException(e);
openInBulkEditor(taxonBase);
}
else{
- EditorUtil.openTaxonBase(entityUuid);
+ EditorUtil.openTaxonBaseE4(entityUuid);
}
}else if(selectedObject instanceof TaxonName){
openInBulkEditor(selectedObject);
*/
public static void openEmpty(UUID parentNodeUuid) {
try {
- EditorUtil.openEmpty(parentNodeUuid);
+ EditorUtil.openEmptyE4(parentNodeUuid);
} catch (PartInitException e) {
MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e);
}
if(possibleOpenEditor != null){
EditorUtil.close(possibleOpenEditor);
}
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
+ EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid);
} catch (PartInitException e) {
MessagingUtils.error(this.getClass(), e);
throw new RuntimeException(e);
AbstractUtility.close(sourceEditor);
AbstractUtility.close(targetEditor);
}
- EditorUtil.openTaxonNode(sourceTaxonNode.getUuid());
- EditorUtil.openTaxonNode(targetTaxonNode.getUuid());
+ EditorUtil.openTaxonNodeE4(sourceTaxonNode.getUuid());
+ EditorUtil.openTaxonNodeE4(targetTaxonNode.getUuid());
} catch (PartInitException e) {
MessagingUtils.error(this.getClass(), e);
throw new RuntimeException(e);
AbstractUtility.close(sourceEditor);
AbstractUtility.close(targetEditor);
}
- EditorUtil.openTaxonNode(sourceTaxonNode.getUuid());
- EditorUtil.openTaxonNode(targetTaxonNode.getUuid());
+ EditorUtil.openTaxonNodeE4(sourceTaxonNode.getUuid());
+ EditorUtil.openTaxonNodeE4(targetTaxonNode.getUuid());
} catch (PartInitException e) {
MessagingUtils.error(this.getClass(), e);
throw new RuntimeException(e);