import eu.etaxonomy.cdm.api.service.INameService;\r
import eu.etaxonomy.cdm.api.service.IReferenceService;\r
import eu.etaxonomy.cdm.api.service.ITaxonService;\r
+import eu.etaxonomy.cdm.api.service.ITermService;\r
import eu.etaxonomy.cdm.database.CdmDataSource;\r
import eu.etaxonomy.cdm.database.DataSourceNotFoundException;\r
import eu.etaxonomy.cdm.database.DbSchemaValidation;\r
public void startTransaction() {\r
if (cdmApp != null) {\r
txStatus = cdmApp.startTransaction();\r
+ \r
+ // Workaround - nom statii were causing a lazy loading error\r
+ List<NomenclaturalStatusType> list = new ArrayList<NomenclaturalStatusType>();\r
+ list.add(NomenclaturalStatusType.SUPERFLUOUS());\r
+ list.add(NomenclaturalStatusType.NUDUM());\r
+ list.add(NomenclaturalStatusType.ILLEGITIMATE());\r
+ list.add(NomenclaturalStatusType.INVALID());\r
+ list.add(NomenclaturalStatusType.CONSERVED());\r
+ list.add(NomenclaturalStatusType.ALTERNATIVE());\r
+ list.add(NomenclaturalStatusType.REJECTED());\r
+ list.add(NomenclaturalStatusType.REJECTED_PROP());\r
+ list.add(NomenclaturalStatusType.PROVISIONAL());\r
+ list.add(NomenclaturalStatusType.SUBNUDUM());\r
+ list.add(NomenclaturalStatusType.OPUS_UTIQUE_OPPR());\r
+ list.add(NomenclaturalStatusType.AMBIGUOUS());\r
+ list.add(NomenclaturalStatusType.DOUBTFUL());\r
+ list.add(NomenclaturalStatusType.CONFUSUM());\r
+ list.add(NomenclaturalStatusType.UTIQUE_REJECTED());\r
+ list.add(NomenclaturalStatusType.CONSERVED_PROP());\r
+ list.add(NomenclaturalStatusType.LEGITIMATE());\r
+ list.add(NomenclaturalStatusType.NOVUM());\r
+ list.add(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED());\r
+ list.add(NomenclaturalStatusType.SANCTIONED());\r
+ list.add(NomenclaturalStatusType.COMBINATION_INVALID());\r
+ list.add(NomenclaturalStatusType.VALID());\r
+ for (NomenclaturalStatusType status : list){\r
+ cdmApp.getTermService().saveTerm(status);\r
+ logger.warn(status.getRepresentations().size());\r
+ }\r
}\r
}\r
\r
}\r
return nomStatusVocabulary;\r
}\r
+ \r
+ public void setNomStatusVocabulary(TermVocabulary<NomenclaturalStatusType> statii) {\r
+ nomStatusVocabulary = statii;\r
+ }\r
\r
/***************************************************************************\r
* NAME RELATIONS\r
if (nameRelationshipTypeVocabulary == null) {\r
nameRelationshipTypeVocabulary = getCdmApp().getNameService()\r
.getNameRelationshipTypeVocabulary();\r
+ \r
+ // Add all terms manually to transaction\r
+ ITermService termService = getCdmApp().getTermService();\r
+ for (NameRelationshipType type : nameRelationshipTypeVocabulary) {\r
+ termService.saveTerm(type);\r
+ }\r
+ \r
}\r
return nameRelationshipTypeVocabulary;\r
}\r
import org.eclipse.swt.graphics.Color;\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Display;\r
import org.eclipse.swt.widgets.Shell;\r
import org.eclipse.swt.widgets.Tree;\r
import org.eclipse.swt.widgets.TreeItem;\r
import org.eclipse.ui.views.properties.PropertySheet;\r
import org.eclipse.ui.views.properties.PropertySheetPage;\r
\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
import eu.etaxonomy.cdm.model.description.Feature;\r
import eu.etaxonomy.cdm.model.name.BotanicalName;\r
+import eu.etaxonomy.cdm.model.name.NameRelationshipType;\r
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;\r
import eu.etaxonomy.cdm.model.name.NonViralName;\r
import eu.etaxonomy.cdm.model.name.Rank;\r
import eu.etaxonomy.taxeditor.editor.CompositeBorderDecorator;\r
import eu.etaxonomy.taxeditor.editor.EditorGroupComposite;\r
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;\r
-import eu.etaxonomy.taxeditor.editor.WarningAnnotation;\r
import eu.etaxonomy.taxeditor.model.CdmUtil;\r
import eu.etaxonomy.taxeditor.model.NameEditorInput;\r
import eu.etaxonomy.taxeditor.navigation.TaxonomicTreeView;\r
public static IViewPart getPropertySheet() {\r
for (IViewReference reference : getActivePage().getViewReferences()) {\r
if (reference.getId().equals(IPageLayout.ID_PROP_SHEET)) {\r
+ logger.warn(reference.getView(false).getSite().getPart().getTitle());\r
return reference.getView(false);\r
}\r
}\r
/**\r
* @param input\r
* @param editorId\r
+ * @return \r
* @throws PartInitException\r
*/\r
- public static void openEditor(IEditorInput input, String editorId)\r
+ public static IEditorPart openEditor(IEditorInput input, String editorId)\r
throws PartInitException {\r
- getActivePage().openEditor(input, editorId);\r
+ return getActivePage().openEditor(input, editorId);\r
}\r
\r
/**\r
\r
paintPropertySheetRow(id, color, true);\r
}\r
+\r
+ /**\r
+ * Get the name out of the session's name relations vocabulary, not directly\r
+ * from the object. \r
+ * \r
+ * @param type\r
+ * @return\r
+ */\r
+ public static String getNameRelationLabelType(NameRelationshipType type) {\r
+ TermVocabulary<NameRelationshipType> vocab = TaxEditorPlugin.getDefault().getNameRelationshipTypeVocabulary();\r
+ for (NameRelationshipType type1 : vocab) {\r
+ if (type1.equals(type)) {\r
+ return type1.getLabel();\r
+ }\r
+ }\r
+ return "joemama";\r
+ }\r
}
\ No newline at end of file
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
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_CITATION = "P_ID_CITATION";\r
public static final String P_ID_URI = "P_ID_URI";\r
public static final String P_ID_DATEPUBLISHED = "P_ID_DATEPUBLISHED";\r
public static final String P_ID_TITLE = "P_ID_TITLE";\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
+ public static final String P_ID_PROTECT_CACHE = "P_ID_PROTECT_CACHE";\r
\r
// Property display keys\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_PROTECT_CACHE = "0020:Protect Cache from overwriting?";\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
- public static final String P_CITATION = "04:Citation";\r
- public static final String P_URI = "05:URI";\r
public static final String P_TITLE = "06:Title";\r
public static final String P_INJOURNAL = "07:In Journal";\r
- public static final String P_PAGES = "09:Pages";\r
- public static final String P_SERIES = "10:Series";\r
- public static final String P_VOLUME = "11:Volume";\r
+ public static final String P_VOLUME = "10:Volume";\r
+ public static final String P_EDITION = "110:Edition";\r
+ public static final String P_SERIES = "11:Series";\r
+ public static final String P_PAGES = "110:Pages";\r
public static final String P_EDITOR = "12:Editor";\r
- public static final String P_PLACEPUBLISHED = "13:Place Published";\r
- public static final String P_PUBLISHER = "14:Publisher";\r
+ public static final String P_PUBLISHER = "13:Publisher";\r
+ public static final String P_PLACEPUBLISHED = "14:Place Published";\r
public static final String P_ISSN = "15:ISSN";\r
public static final String P_INSTITUTION = "16:Institution";\r
public static final String P_SCHOOL = "17:School";\r
public static final String P_INSERIES = "18:In Series";\r
public static final String P_SERIESPART = "19:Series Part";\r
public static final String P_ISBN = "20:ISBN";\r
+ public static final String P_URI = "201:URI";\r
public static final String P_ORGANIZATION = "21:Organization";\r
public static final String P_PRINTEDUNIT = "22:Printed Unit";\r
public static final String P_INBOOK = "23:In Book";\r
public static final String P_JOURNAL = "26:Journal";\r
public static final String P_BOOKTITLE = "27:Book Title";\r
public static final String P_CHAPTER = "28:Chapter";\r
- public static final String P_EDITION = "29:Edition";\r
public static final String P_NUMBER = "30:Number";\r
public static final String P_ANNOTE = "31:Annote";\r
public static final String P_ADDRESS = "32:Address";\r
protected static HashMap<Class, String> referenceTypeMap = null;\r
\r
private static final String[] P_BIBTEX_ENTRYTYPE_MENU = new String[] {"ARTICLE", "BOOK", "BOOKLET", "INBOOK", "INCOLLECTION", "PROCEEDINGS", "INPROCEEDINGS", "CONFERENCE", "MANUAL", "MASTERTHESIS", "PHDTHESIS", "TECHREPORT", "UNPUBLISHED", "MISC"};\r
+\r
+ private static final int CACHE_NOT_PROTECTED = 0;\r
+ private static final int CACHE_PROTECTED = 1; \r
\r
protected void populateReferenceTypes() {\r
\r
\r
// ReferenceBase fields\r
displayFields.add(P_ID_SEARCH);\r
- displayFields.add(P_ID_EDITABLECACHE); \r
+ displayFields.add(P_ID_EDITABLECACHE);\r
+ displayFields.add(P_ID_PROTECT_CACHE);\r
displayFields.add(P_ID_AUTHORTEAM);\r
- displayFields.add(P_ID_CITATION);\r
displayFields.add(P_ID_URI);\r
\r
Class referenceClass = reference.getClass();\r
new TextPropertyDescriptor(P_ID_EDITABLECACHE, P_EDITABLECACHE));\r
}\r
\r
+ // Protect cache?\r
+ if (id.equals(P_ID_PROTECT_CACHE)) {\r
+ descriptors.addElement(\r
+ new ComboBoxPropertyDescriptor(P_ID_PROTECT_CACHE, P_PROTECT_CACHE, \r
+ new String[] {"no", "yes"}));\r
+ }\r
+ \r
// Reference type\r
if (id.equals(P_ID_REFERENCETYPE)) {\r
descriptors.addElement(createReferenceTypeDescriptor());\r
yearDescriptor.setValidator(new YearValidator());\r
descriptors.addElement(yearDescriptor); \r
} \r
- \r
- // Citation\r
- if (id.equals(P_ID_CITATION)) {\r
- descriptors.addElement(\r
- new PropertyDescriptor(P_ID_CITATION, P_CITATION)); \r
- }\r
- \r
+ \r
// URI\r
if (id.equals(P_ID_URI)) {\r
descriptors.addElement(\r
return 0;\r
}\r
\r
+ // Editable cache\r
+ if (id.equals(P_ID_EDITABLECACHE)) {\r
+ return (CdmUtils.Nz(reference.getTitleCache()));\r
+ }\r
+ \r
+ // Protect cache?\r
+ if (id.equals(P_ID_PROTECT_CACHE)) {\r
+ if (reference.isProtectedTitleCache()) {\r
+ return CACHE_PROTECTED;\r
+ } else {\r
+ return CACHE_NOT_PROTECTED;\r
+ }\r
+ }\r
+ \r
// Author Team: for now, just edit the cache\r
// TODO AuthorTeamPropertySource\r
if (id.equals(P_ID_AUTHORTEAM)) {\r
return CdmUtils.Nz(reference.getYear());\r
}\r
\r
- // Citation\r
- if (id.equals(P_ID_CITATION)) {\r
- return CdmUtils.Nz(reference.getCitation());\r
- }\r
- \r
// URI\r
if (id.equals(P_ID_URI)) {\r
return CdmUtils.Nz(reference.getUri());\r
*/\r
public void setPropertyValue(Object id, Object value) {\r
\r
+ // Search result\r
if (id.equals(P_ID_SEARCH)) {\r
if (value instanceof ReferenceBase) {\r
reference = (ReferenceBase) value;\r
}\r
}\r
- \r
+\r
+ // Protect cache? \r
+ if (id.equals(P_ID_PROTECT_CACHE)) {\r
+ if (((Integer) value).intValue() == CACHE_PROTECTED) {\r
+ reference.setProtectedTitleCache(true);\r
+ } else {\r
+ reference.setProtectedTitleCache(false);\r
+ }\r
+ }\r
+ \r
// Reference Type\r
if (id.equals(P_ID_REFERENCETYPE)) {\r
\r
\r
}\r
}\r
+\r
+ // Editable cache\r
+ if (id.equals(P_ID_EDITABLECACHE)) {\r
+ reference.setTitleCache((String) value);\r
+ } else {\r
+ reference.setTitleCache(reference.generateTitle(), reference.isProtectedTitleCache());\r
+ }\r
\r
propertyChangeSupport.firePropertyChange(ITaxEditorConstants.PROPERTY_SHEET_CHANGE, null, reference);\r
}\r