// Nomenclatural reference\r
if (id.equals(P_ID_NOMENCLATURAL_REF)) {\r
descriptors.addElement(\r
- new ReferenceSearchDescriptor(P_ID_NOMENCLATURAL_REF, P_NOMENCLATURAL_REF, IReferenceSearch.NOMREF) {\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
+ new PropertyDescriptor(P_ID_NOMENCLATURAL_REF,P_NOMENCLATURAL_REF)); \r
+// descriptors.addElement(\r
+// new ReferenceSearchDescriptor(P_ID_NOMENCLATURAL_REF, P_NOMENCLATURAL_REF, IReferenceSearch.NOMREF) {\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
\r
// Microreference\r
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.cdm.model.reference.CdDvd;\r
import eu.etaxonomy.cdm.model.reference.Database;\r
import eu.etaxonomy.cdm.model.reference.Generic;\r
+import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;\r
import eu.etaxonomy.cdm.model.reference.InProceedings;\r
import eu.etaxonomy.cdm.model.reference.Journal;\r
import eu.etaxonomy.cdm.model.reference.Map;\r
import eu.etaxonomy.cdm.model.reference.Thesis;\r
import eu.etaxonomy.cdm.model.reference.WebPage;\r
import eu.etaxonomy.taxeditor.ITaxEditorConstants;\r
+import eu.etaxonomy.taxeditor.UiUtil;\r
import eu.etaxonomy.taxeditor.model.CdmUtil;\r
import eu.etaxonomy.taxeditor.propertysheet.TimePeriodPropertySource;\r
import eu.etaxonomy.taxeditor.propertysheet.YearValidator;\r
ReferenceBase reference;\r
\r
// Property unique keys\r
+ public static final String P_ID_SEARCH = "P_ID_SEARCH";\r
+ public static final String P_ID_EDITABLECACHE = "P_ID_EDITABLECACHE"; \r
public static final String P_ID_REFERENCETYPE = "P_ID_REFERENCETYPE";\r
public static final String P_ID_AUTHORTEAM = "P_ID_AUTHORTEAM";\r
public static final String P_ID_YEAR = "P_ID_YEAR";\r
public static final String P_ID_EPRINT = "P_ID_EPRINT";\r
public static final String P_ID_NOTE = "P_ID_NOTE";\r
public static final String P_ID_CROSSREF = "P_ID_CROSSREF";\r
- \r
+ \r
// Property display keys\r
- public static final String P_REFERENCETYPE = "00:Reference Type";\r
+ public static final String P_SEARCH = "001:Search";\r
+ public static final String P_EDITABLECACHE = "002:Editable Cache";\r
+ public static final String P_REFERENCETYPE = "003:Reference Type";\r
public static final String P_AUTHORTEAM = "01:Author Team (Cache)";\r
public static final String P_YEAR = "02:Year";\r
public static final String P_DATEPUBLISHED = "03:Date Published";\r
}\r
\r
public ReferencePropertySource(ReferenceBase reference) {\r
- super();\r
\r
// Default type of ReferenceBase is Generic\r
if (reference == null) {\r
displayFields.add(P_ID_REFERENCETYPE);\r
\r
// ReferenceBase fields\r
+ displayFields.add(P_ID_SEARCH);\r
+ displayFields.add(P_ID_EDITABLECACHE); \r
displayFields.add(P_ID_AUTHORTEAM);\r
displayFields.add(P_ID_CITATION);\r
displayFields.add(P_ID_URI);\r
\r
protected void addDescriptor(String id) {\r
\r
+ // Reference search\r
+ if (id.equals(P_ID_SEARCH)) {\r
+ descriptors.addElement(\r
+ new ReferenceSearchDescriptor(P_ID_SEARCH, P_SEARCH, getSearchType()) {\r
+ protected void saveReference(ReferenceBase reference) {\r
+ setPropertyValue(P_ID_SEARCH, reference);\r
+ }\r
+ });\r
+ }\r
+ \r
+ // Editable cache\r
+ if (id.equals(P_ID_EDITABLECACHE)) {\r
+ descriptors.addElement(\r
+ new TextPropertyDescriptor(P_ID_EDITABLECACHE, P_EDITABLECACHE));\r
+ }\r
+ \r
// Reference type\r
if (id.equals(P_ID_REFERENCETYPE)) {\r
descriptors.addElement(createReferenceTypeDescriptor());\r
}\r
}\r
\r
+ /**\r
+ * The default implementation of <code>ReferencePropertySource</code> will\r
+ * search all <code>ReferenceBase</code> classes.\r
+ * \r
+ * @return\r
+ */\r
+ protected int getSearchType() {\r
+ return IReferenceSearch.BIBREF;\r
+ }\r
+\r
/**\r
* The default implementation of <code>ReferencePropertySource</code> will show\r
* a drop-down of reference types, but subclasses may want to show a non-editable\r
*/\r
public void setPropertyValue(Object id, Object value) {\r
\r
+ if (id.equals(P_ID_SEARCH)) {\r
+ if (value instanceof ReferenceBase) {\r
+ reference = (ReferenceBase) value;\r
+ }\r
+ }\r
+ \r
// Reference Type\r
if (id.equals(P_ID_REFERENCETYPE)) {\r
\r
package eu.etaxonomy.taxeditor.propertysheet.reference;\r
\r
import org.apache.log4j.Logger;\r
+import org.eclipse.jface.viewers.ILabelProvider;\r
+import org.eclipse.swt.graphics.Color;\r
import org.eclipse.ui.views.properties.PropertyDescriptor;\r
\r
+import eu.etaxonomy.cdm.model.reference.Book;\r
+import eu.etaxonomy.cdm.model.reference.Journal;\r
import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
+import eu.etaxonomy.taxeditor.ITaxEditorConstants;\r
+import eu.etaxonomy.taxeditor.TaxEditorPlugin;\r
+import eu.etaxonomy.taxeditor.UiUtil;\r
\r
/**\r
* This subclass is for cases where only one subclass of <code>ReferenceBase</code>\r
}\r
\r
protected PropertyDescriptor createReferenceTypeDescriptor() {\r
- return new PropertyDescriptor(P_ID_REFERENCETYPE, P_REFERENCETYPE);\r
+ return new PropertyDescriptor(P_ID_REFERENCETYPE, P_REFERENCETYPE) {\r
+ public ILabelProvider getLabelProvider() {\r
+ return super.getLabelProvider();\r
+ }\r
+ };\r
}\r
\r
public Object getPropertyValue(Object id) {\r
\r
// Reference Type: show non-editable reference type in property value\r
- if (id.equals(P_ID_REFERENCETYPE)) {\r
+ if (id.equals(P_ID_REFERENCETYPE)) { \r
return referenceType;\r
}\r
\r