Re-ordered property source fields.
authorp.ciardelli <p.ciardelli@localhost>
Thu, 20 Nov 2008 12:31:18 +0000 (12:31 +0000)
committerp.ciardelli <p.ciardelli@localhost>
Thu, 20 Nov 2008 12:31:18 +0000 (12:31 +0000)
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/ITaxEditorConstants.java
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/TaxEditorPlugin.java
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/editor/AbstractTaxonEditorView.java
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/propertysheet/name/NonViralNamePropertySource.java
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/propertysheet/reference/NomenclaturalReferencePropertySource.java
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/propertysheet/reference/ReferencePropertySource.java
eclipseprojects/eu.etaxonomy.taxeditor/src/eu/etaxonomy/taxeditor/propertysheet/reference/SingleRefTypePropertySource.java

index 9557056b5708a41c4b414a1bd2481ae3b047254c..eee19a0ee6d46c0ef1c3aefe28ef3c1af34e9811 100644 (file)
@@ -87,6 +87,7 @@ public class ITaxEditorConstants {
                COLORS\r
         ************************************************************************************** */\r
        public static final String GROUP_GRAY_BKG_COLOR = "group_gray_background_color";\r
+       public static final String PROP_SHEET_RED = "property_sheet_red";\r
        \r
        /* ***************************************************************************************\r
                PREFERENCES\r
index 3ed30dce161ce058d99351fe434f9d7f35cb61ca..dc5e46363c5385b94ecaf533bfac6567cdadefb2 100644 (file)
@@ -496,6 +496,8 @@ public class TaxEditorPlugin extends AbstractUIPlugin {
                         \r
                         colorMap.put(ITaxEditorConstants.GROUP_GRAY_BKG_COLOR,\r
                                         new Color(null, 240, 240, 240));\r
+                        colorMap.put(ITaxEditorConstants.PROP_SHEET_RED,\r
+                                        new Color(null, 255, 0, 0));                    \r
                }\r
                return colorMap;\r
        }\r
index 7abea001a45450ac066d3639fcf1b67caa9f335a..3cdb98d4e661ee98c0c79d5df280d1633d6ad80b 100644 (file)
@@ -205,8 +205,6 @@ public abstract class AbstractTaxonEditorView extends EditorPart implements
                        // Remove "Show categories", "Show advanced properties", "Restore default value"\r
                        toolBarManager.removeAll();\r
                        menuManager.removeAll();\r
-                       \r
-                       getControl().setMenu(null);\r
                    }\r
                    \r
                    public Control getControl() {\r
index 54388a1a215a45e75a49b08aec863de675427c3b..4d1691b2884571ec6d809f28d63e0a46d8b55714 100644 (file)
@@ -338,15 +338,17 @@ public class NonViralNamePropertySource implements IPropertySource {
                // 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
index 12b60011eaef1c6f4de7553b106d5f30bb8205d5..312f9f32548ae421ca1f88694d4badf878de2d0b 100644 (file)
@@ -63,4 +63,8 @@ public class NomenclaturalReferencePropertySource extends
        protected Set<Class> getReferenceClassSet() {\r
                return nomReferenceTypeMap.keySet();\r
        }\r
+       \r
+       protected int getSearchType() {\r
+               return IReferenceSearch.NOMREF;\r
+       }\r
 }\r
index 298d07fe451dfbbe999e9a68d5d1372b60d69135..7d24dfccf9a8af0fc5b68215a523d304f10f3f72 100644 (file)
@@ -23,6 +23,7 @@ import java.util.Set;
 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
@@ -40,6 +41,7 @@ import eu.etaxonomy.cdm.model.reference.BookSection;
 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
@@ -56,6 +58,7 @@ import eu.etaxonomy.cdm.model.reference.StrictReferenceBase;
 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
@@ -102,6 +105,8 @@ public class ReferencePropertySource implements IPropertySource {
        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
@@ -140,9 +145,11 @@ public class ReferencePropertySource implements IPropertySource {
        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
@@ -222,7 +229,6 @@ public class ReferencePropertySource implements IPropertySource {
        }\r
                \r
        public ReferencePropertySource(ReferenceBase reference) {\r
-               super();\r
                \r
                // Default type of ReferenceBase is Generic\r
                if (reference == null) {\r
@@ -241,6 +247,8 @@ public class ReferencePropertySource implements IPropertySource {
                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
@@ -383,6 +391,22 @@ public class ReferencePropertySource implements IPropertySource {
        \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
@@ -560,6 +584,16 @@ public class ReferencePropertySource implements IPropertySource {
                }\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
@@ -834,6 +868,12 @@ public class ReferencePropertySource implements IPropertySource {
         */\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
index b27fc69160350c107e43fc85b1a9bee00d7ae7f8..cf64b469b3be946c3698f5f3139e5cc418b2f611 100644 (file)
 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
@@ -44,13 +51,17 @@ public class SingleRefTypePropertySource extends ReferencePropertySource {
        }\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