import java.util.Vector;\r
\r
import org.apache.log4j.Logger;\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;\r
import org.eclipse.ui.views.properties.IPropertyDescriptor;\r
import org.eclipse.ui.views.properties.IPropertySource;\r
import eu.etaxonomy.taxeditor.propertysheet.AnnotationPropertySource;\r
import eu.etaxonomy.taxeditor.propertysheet.AnnotationsPropertyDescriptor;\r
import eu.etaxonomy.taxeditor.propertysheet.MarkersPropertySource;\r
+import eu.etaxonomy.taxeditor.propertysheet.reference.NomRefSearchDescriptor;\r
import eu.etaxonomy.taxeditor.propertysheet.reference.NomenclaturalReferencePropertySource;\r
import eu.etaxonomy.taxeditor.propertysheet.reference.ReferencePropertySource;\r
\r
}\r
if (id.equals(P_ID_NOMENCLATURAL_REF)) {\r
descriptors.addElement(\r
-// new TextPropertyDescriptor(P_ID_NOMENCLATURAL_REF, P_NOMENCLATURAL_REF));\r
- new PropertyDescriptor(P_ID_NOMENCLATURAL_REF, P_NOMENCLATURAL_REF));\r
+ new NomRefSearchDescriptor(P_ID_NOMENCLATURAL_REF, P_NOMENCLATURAL_REF) {\r
+ protected void saveReference(ReferenceBase reference) {\r
+ if (reference instanceof INomenclaturalReference) {\r
+ setPropertyValue(P_ID_NOMENCLATURAL_REF, reference);\r
+ } else {\r
+ MessageDialog.openError(UiUtil.getShell(), "Reference type error", "The selected reference cannot be used as a nomenclatural reference.");\r
+ }\r
+ }\r
+ });\r
}\r
if (id.equals(P_ID_NOMENCLATURAL_MICROREF)) {\r
descriptors.addElement(\r
if (id.equals(P_ID_NOMREF_TYPE)) {\r
descriptors.addElement(\r
new PropertyDescriptor(P_ID_NOMREF_TYPE, P_NOMREF_TYPE));\r
-// new ComboBoxPropertyDescriptor(P_ID_NOMREF_TYPE, P_NOMREF_TYPE, P_NOMREF_TYPE_MENU));\r
}\r
if (id.equals(P_ID_NOMREF_YEAR)) {\r
descriptors.addElement(\r
return "none (nonviral name)";\r
}\r
if (id.equals(P_ID_NOMENCLATURAL_REF)) {\r
- \r
-// INomenclaturalReference nomenclaturalReference = (INomenclaturalReference) name.getNomenclaturalReference();\r
-// if (name.getNomenclaturalReference() == null) {\r
-// return "";\r
-// } else {\r
-// return new NonViralNamePropertySource(name, P_ID_NOMENCLATURAL_REF, getReferenceFields());\r
-// }\r
\r
ReferenceBase nomRef = (ReferenceBase) name.getNomenclaturalReference();\r
\r
// TODO set markers\r
}\r
if (id.equals(P_ID_NOMENCLATURAL_REF)) {\r
- // TODO ask Andreas M. how best to set nom. ref\r
+ if (value instanceof INomenclaturalReference) {\r
+ name.setNomenclaturalReference((INomenclaturalReference) value);\r
+ }\r
}\r
if (id.equals(P_ID_NOMENCLATURAL_MICROREF)) {\r
name.setNomenclaturalMicroReference((String) value);\r