*/
package eu.etaxonomy.taxeditor.ui.section.taxon;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.ToolBarManager;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.NameSelectionDialog;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonBaseSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
/**
* @author n.hoffmann
@Override
public String getHeading() {
-
+
return getEntity() != null ? StringUtils.replace( getEntity().getType().getLabel(), "for", ""): "Taxon Relation";
}
public TaxonBase getTaxonBase() {
return taxon;
}
-
+
private void setName(TaxonName name){
this.name = name;
}
-
+
@Override
protected Control createToolbar() {
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
Action chooseTaxonAction = new Action("Choose Taxon", IAction.AS_PUSH_BUTTON){
@Override
public void run() {
- Taxon taxon = TaxonBaseSelectionDialog.selectTaxon(getShell(), getConversationHolder(), getEntity().getFromTaxon());
+ Taxon taxon = TaxonBaseSelectionDialog.selectTaxon(getShell(), //getConversationHolder(),
+ getEntity().getFromTaxon());
if(taxon!=null){
taxon = HibernateProxyHelper.deproxy(taxon);
name = taxon.getName();
TaxonRelationship rel = getEntity();
rel.setFromTaxon(taxon);
+ taxon.addTaxonRelation(rel);
setEntity(rel);
setTaxonBase(taxon);
-
- firePropertyChangeEvent(TaxonRelationshipDetailSection.this);
+// firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
+ detailElement.firePropertyChangeEvent(new CdmPropertyChangeEvent(detailElement, null));
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_DETAILS, true);
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL, true);
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAME_EDITOR, rel.getToTaxon());
+ ((TaxonRelationshipDetailElement)detailElement).getTaxonElement().setSelected(true);;
+
+
}
}
};
return toolBarManager.createControl(this);
}
+
+
}