eu.etaxonomy.taxeditor.editor/icons/edit_16x16.gif -text
eu.etaxonomy.taxeditor.editor/icons/emblem-photos.png -text
eu.etaxonomy.taxeditor.editor/icons/leaf_detail.png -text
+eu.etaxonomy.taxeditor.editor/icons/link_obj.gif -text
eu.etaxonomy.taxeditor.editor/icons/xper64.png -text
eu.etaxonomy.taxeditor.editor/p2.inf -text
eu.etaxonomy.taxeditor.editor/plugin.xml -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenParentHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenTaxonEditorHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveAllHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveTaxonHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewNameHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewPersonHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewReferenceHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/DerivateViewContextMenu.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/SingleReadSequenceContextMenu.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivateEditorForTaxonHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDragListener.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/ToggleShowOnlyIndividualAssociationsHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/AddDerivedUnitFacadeMediaOperation.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateDescriptionElementOperation.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateSpecimenDescriptionOperation.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewClassificationHandler.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewTaxonNodeHandler.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RefreshTreeHandler.java -text
+eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/TaxonParameterConverter.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/ChangeAcceptedTaxonToSynonymOperation.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/CopyOperation.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractExcelImportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractExportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvExportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/DarwinCoreArchiveExportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/EndnoteImportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ICdmEditorHandle.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IContextListener.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDataChangeBehavior.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDerivedUnitFacadePart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDirtyMarkable.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IElementHasDetails.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartChangeListener.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationCloningWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationGelPhotoWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationGeneralWizardPage.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationPrimerWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ExternalReferenceServiceWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewAmplificationWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewClassificationWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SourceCollectionDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenCollectionDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenCollectionDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenAbstractDeterminationEventDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenCurrentDeterminationDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SingleReadPherogramCollectionDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java -text
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineDocumentProvider;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @created 07.07.2009
* @version 1.0
*/
-public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails, IPartContentHasMedia,
- IDirtyMarkable {
+public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails,
+ IDirtyMarkable, IDerivedUnitFacadePart {
/** Constant <code>ID="bulkeditor.editor"</code> */
public static final String ID = "bulkeditor.editor";
}
}
- public void forceDirty(){
+ @Override
+ public void forceDirty(){
isDirty = true;
firePropertyChange(PROP_DIRTY);
}
@Override
public void doSave(IProgressMonitor progressMonitor) {
isDirty = false;
+ IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .findView("eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects");
+ if (part != null){
+ ((ReferencingObjectsView)part).dispose();
+ }
super.doSave(progressMonitor);
+
+ selectFirstItem();
+ if (part != null){
+ ((ReferencingObjectsView)part).refresh();
+
+ }
+ getSourceViewer().getTextWidget().setFocus();
+
}
/** {@inheritDoc} */
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.IWorkbenchPage;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
+import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView;
+
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
} catch (Exception e){
MessagingUtils.messageDialog("Exception occured. Could not delete", getClass(), e.getMessage(), null);
}
- if (result.isError()){
+ if (result.isError() || !result.getExceptions().isEmpty()){
if (!result.getExceptions().isEmpty()) {
MessagingUtils.messageDialog("Could not delete", getClass(), result.getExceptions().get(0).getMessage(), null);
}else{
}
}
- if (result.isOk()){
+ if (result.isOk() && result.getExceptions().isEmpty()){
((BulkEditor) editor).removeAnnotatedLine(annotation);
-
- System.out.println("Test");
+
}
}
}
import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.api.service.IIdentifiableEntityService;
import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
final Display display = Display.getCurrent();
- // Job job = new Job("Update Referencing Objects") {
+ //Job job = new Job("Update Referencing Objects") {
//
// @Override
// protected IStatus run(IProgressMonitor monitor) {
try {
if(entity instanceof CdmBase){
referencedObject = (CdmBase) entity;
- if (referencedObject instanceof AgentBase){
+ if (referencedObject instanceof TeamOrPersonBase){
referencedObject = CdmStore.getService(IAgentService.class).load(referencedObject.getUuid());
}
//referencedObject =(CdmBase) CdmStore.getService(IIdentifiableEntityService.class).load(referencedObject.getUuid());
Set<CdmBase> setOfReferencingObjects = CdmStore.getService(ICommonService.class).getReferencingObjects(referencedObject);
-
- List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);
-
- Collections.sort(referencingObjects, new ReferencingClassComparator());
-
- return referencingObjects;
+ if (setOfReferencingObjects != null){
+ List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);
+
+ Collections.sort(referencingObjects, new ReferencingClassComparator());
+
+ return referencingObjects;
+ }
}
} catch (Exception e) {
logger.error("Error retrieving referencing objects", e);
selectionService.removePostSelectionListener(this);
selectionService.removeSelectionListener(this);
super.dispose();
+
}
/* (non-Javadoc)
public boolean onComplete() {
return false;
}
+
+ public void refresh(){
+ selectionService.removePostSelectionListener(this);
+ selectionService.removeSelectionListener(this);
+ selectionService.addPostSelectionListener(this);
+ selectionService.addSelectionListener(this);
+
+ }
}
eu.etaxonomy.cdm.io.common.events,
eu.etaxonomy.cdm.io.common.mapping,
eu.etaxonomy.cdm.io.common.mapping.out,
+ eu.etaxonomy.cdm.io.csv.redlist.demo,
eu.etaxonomy.cdm.io.csv.redlist.out,
eu.etaxonomy.cdm.io.dwca,
eu.etaxonomy.cdm.io.dwca.in,
/**
* Class which uses CDM services to cache cdm entities
- *
- * FIXME: Currently only handles terms entities. It would be
+ *
+ * FIXME: Currently only handles terms entities. It would be
* interesting to have a generic method which finds the
* correct service to load / cache the entity.
- *
+ *
* @author cmathew
*
* @param <T>
@Autowired
ITermService termService;
-
+
@Override
protected T findByUuid(UUID uuid) {
return (T)termService.findWithoutFlush(uuid);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.cache.CdmCacher#setup()
+ */
+ @Override
+ protected void setup() {
+ // TODO Auto-generated method stub
+
+ }
+
}
\r
<import resource="classpath:/eu/etaxonomy/cdm/remoting_services_security.xml"/> \r
\r
- <bean id="cdmServiceCacher" class="eu.etaxonomy.cdm.api.cache.CdmServiceCacher"/>\r
+ <bean id="cdmTermCacher" class="eu.etaxonomy.cdm.api.cache.CdmTermCacher"/>\r
\r
\r
<!-- EditGeoService was moved to ext. Therefore it will not be found by the default component scan.
</visibleWhen>
</command>
</menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="toolbar:eu.etaxonomy.taxeditor.editor.view.descriptive">
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations"
+ icon="icons/link_obj.gif"
+ style="toggle"
+ tooltip="Show Only Individuals Associations">
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:eu.etaxonomy.taxeditor.navigation.navigatorpopup?after=taxeditor-navigation.separator2">
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
+ label="Open Associated Derivates"
+ style="push">
+ </command>
+ <separator
+ name="eu.etaxonomy.taxeditor.editor.separator1"
+ visible="true">
+ </separator>
+ </menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
</with>
</activeWhen>
</handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivateEditorForTaxonHandler"
+ commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="eu.etaxonomy.taxeditor.navigation.navigator">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.ToggleShowOnlyIndividualAssociationsHandler"
+ commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations">
+ </handler>
</extension>
<extension
name="%extension.name"
id="eu.etaxonomy.taxeditor.editor.command.new.datasource"
name="%command.name.39">
</command>
+ <command
+ id="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations"
+ name="Show Only Individual Associations">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenTaxonEditorHandler"
+ id="eu.etaxonomy.taxeditor.editor.openTaxonEditor"
+ name="Open Taxon Editor">
+ <commandParameter
+ id="eu.etaxonomy.taxeditor.editor.taxonParameter"
+ name="taxonUUID"
+ optional="false"
+ typeId="eu.etaxonomy.taxeditor.editor.taxonParameterType">
+ </commandParameter>
+ </command>
+ <commandParameterType
+ converter="eu.etaxonomy.taxeditor.editor.handler.TaxonParameterConverter"
+ id="eu.etaxonomy.taxeditor.editor.taxonParameterType"
+ type="eu.etaxonomy.cdm.model.taxon.TaxonBase">
+ </commandParameterType>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
+import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
import eu.etaxonomy.taxeditor.editor.view.dataimport.BioCaseEditorInput;
import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditor;
import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorInput;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* Utility for the editor package
*/
public static void openTaxonBase(UUID taxonBaseUuid)
throws PartInitException {
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
+ if (taxonBase != null && taxonBase.isOrphaned()) {
+ MessagingUtils.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxon is currently not supported.");
+ return;
+ }
TaxonEditorInput input = TaxonEditorInput
.NewInstanceFromTaxonBase(taxonBaseUuid);
open(input);
}
return null;
}
+
+ /**
+ * Opens a taxon editor for the given object if the given object is a valid input.
+ * @param object the object for which the editor will be opened
+ * @throws PartInitException
+ */
+ public static void openTaxonEditor(Object object) throws PartInitException {
+ if(object instanceof TaxonBase<?>){
+ openTaxonBase(((TaxonBase<?>) object).getUuid());
+ }
+ }
}
*/
public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPersistableElement {
- private ConversationHolder conversation;
+ private final ConversationHolder conversation;
- private TaxonNode taxonNode;
+ private final TaxonNode taxonNode;
private TaxonEditorInputDataChangeBehaviour dataChangeBehavior;
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
if (taxonBase != null){
- if(taxonBase.isOrphaned()) {
- MessagingUtils.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxon is currently not supported.");
- }
- else if(taxonBase.isInstanceOf(Taxon.class)){
+ if(taxonBase.isInstanceOf(Taxon.class)){
Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
-
+
if (taxon.getTaxonNodes().size() == 0 && taxon.isMisapplication()){
// TODO get accepted taxon
MessagingUtils.info("trying to open Mispplied Name ");
-
+
Set<Taxon> acceptedTaxa = new HashSet<Taxon>();
Set<TaxonRelationship> relations = taxon.getRelationsFromThisTaxon();
for(TaxonRelationship relation : relations){
}
}
input = getInputForMultipleTaxa(conversation, acceptedTaxa);
-
+
}else{
input = getInputForMultipleNodes(conversation, taxon.getTaxonNodes());
}
}else if(taxonBase instanceof Synonym){
Synonym synonym = (Synonym) taxonBase;
-
+
Set<Taxon> taxa = synonym.getAcceptedTaxa();
input = getInputForMultipleTaxa(conversation, taxa);
}
input.setInitiallySelectedTaxonBase(taxonBase);
}
}
-
+
return input;
}
package eu.etaxonomy.taxeditor.editor.handler;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.UUID;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
if(currentSelection instanceof IStructuredSelection){
- Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
- if(selectedElement instanceof SpecimenOrObservationBase<?>){
-
- DerivateViewEditorInput input = new DerivateViewEditorInput(((SpecimenOrObservationBase<?>) selectedElement).getUuid());
- try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open DerivateView", e);
- } catch (NullPointerException npe){
- MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open DerivateView. The derivate hierarchy is corrupted!", npe);
+ Iterator<?> selectionIterator = ((IStructuredSelection) currentSelection).iterator();
+ Set<UUID> selectedElementUUIDs = new HashSet<UUID>();
+ while(selectionIterator.hasNext()){
+ Object object = selectionIterator.next();
+ if(object instanceof SpecimenOrObservationBase<?>){
+ selectedElementUUIDs.add(((SpecimenOrObservationBase<?>) object).getUuid());
}
}
+ DerivateViewEditorInput input = new DerivateViewEditorInput(selectedElementUUIDs);
+ try {
+ EditorUtil.open(input);
+ } catch (PartInitException e) {
+ MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open Derivate Editor", e);
+ } catch (NullPointerException npe){
+ MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open Derivate Editor. The derivate hierarchy is corrupted!", npe);
+ }
}
return null;
}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.handler;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.ParameterType;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+
+public class OpenTaxonEditorHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Object object = event.getObjectParameterForExecution("eu.etaxonomy.taxeditor.editor.taxonParameter");
+
+ try {
+ ParameterType parameterType = event.getCommand().getParameterType("eu.etaxonomy.taxeditor.editor.taxonParameter");
+ if(parameterType.isCompatible(object)){
+ EditorUtil.openTaxonEditor(object);
+ }
+ } catch (NotDefinedException e) {
+ MessagingUtils.error(this.getClass(), "Parameter type not defined", e);
+ } catch (PartInitException e) {
+ MessagingUtils.error(OpenTaxonEditorHandler.class, "Error opening the editor", e);
+ }
+ return null;
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.handler;
+
+import java.util.UUID;
+
+import org.eclipse.core.commands.AbstractParameterValueConverter;
+import org.eclipse.core.commands.ParameterValueConversionException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class TaxonParameterConverter extends AbstractParameterValueConverter {
+
+ public TaxonParameterConverter() {
+ }
+
+ @Override
+ public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
+ return CdmStore.getService(ITaxonService.class).load(UUID.fromString(parameterValue));
+ }
+
+ @Override
+ public String convertToString(Object parameterValue) throws ParameterValueConversionException {
+ if(parameterValue instanceof TaxonBase<?>){
+ return ((TaxonBase<?>) parameterValue).getUuid().toString();
+ }
+ return null;
+ }
+
+}
if (text.length() < start + length) {
length = text.length() - start;
}
-
+ if (length<0){
+ return null;
+ }
return new Position(start, length);
}
return null;
}
@Override
- public List<String> isDeletable(AgentBase object,
+ public DeleteResult isDeletable(AgentBase object,
DeleteConfiguratorBase config) {
// TODO Auto-generated method stub
return null;
}
@Override
- public List<String> isDeletable(Classification object,
+ public DeleteResult isDeletable(Classification object,
DeleteConfiguratorBase config) {
// TODO Auto-generated method stub
return null;
* @see eu.etaxonomy.cdm.api.service.IVersionableService#isDeletable(eu.etaxonomy.cdm.model.common.VersionableEntity, eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase)
*/
@Override
- public List<String> isDeletable(Collection object, DeleteConfiguratorBase config) {
+ public DeleteResult isDeletable(Collection object, DeleteConfiguratorBase config) {
return defaultService.isDeletable(object, config);
}
}
@Override
- public List<String> isDeletable(DescriptionBase object,
+ public DeleteResult isDeletable(DescriptionBase object,
DeleteConfiguratorBase config) {
// TODO Auto-generated method stub
return null;
}
@Override
- public List<String> isDeletable(TaxonNameBase object,
+ public DeleteResult isDeletable(TaxonNameBase object,
DeleteConfiguratorBase config) {
// TODO Auto-generated method stub
return null;
}
@Override
- public List<String> isDeletable(SpecimenOrObservationBase object,
+ public DeleteResult isDeletable(SpecimenOrObservationBase object,
DeleteConfiguratorBase config) {
return defaultService.isDeletable(object, config);
}
return defaultService.delete(specimen, config);
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listAssociatedTaxa(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
+ */
+ @Override
+ public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit,
+ Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
+ return defaultService.listAssociatedTaxa(specimen, limit, start, orderHints, propertyPaths);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listTypedTaxa(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
+ */
+ @Override
+ public Collection<TaxonBase<?>> listTypedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start,
+ List<OrderHint> orderHints, List<String> propertyPaths) {
+ return defaultService.listTypedTaxa(specimen, limit, start, orderHints, propertyPaths);
+ }
+
}
}
@Override
- public List<String> isDeletable(Reference object,
+ public DeleteResult isDeletable(Reference object,
DeleteConfiguratorBase config) {
// TODO Auto-generated method stub
return null;
}
@Override
- public List<String> isDeletable(TaxonBase object,
+ public DeleteResult isDeletable(TaxonBase object,
DeleteConfiguratorBase config) {
// TODO Auto-generated method stub
return null;
}
@Override
- public List<String> isDeletable(DefinedTermBase object,
+ public DeleteResult isDeletable(DefinedTermBase object,
DeleteConfiguratorBase config) {
return defaultTermService.isDeletable(object, config);
}
package eu.etaxonomy.taxeditor.editor.view.derivate;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
+import java.util.UUID;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreeNode;
@Override
public Object[] getElements(Object inputElement) {
- SpecimenOrObservationBase<?> rootElement = null;
+ List<TreeNode> rootElements = new ArrayList<TreeNode>();
if(inputElement instanceof DerivateViewEditorInput){
- rootElement = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) inputElement).getRootElementUUID());
- }
-
- if(rootElement!=null){
- //show topmost element in the derivate hierarchy if no field unit was found
- TreeNode node = new TreeNode(rootElement);
- return Collections.singleton(node).toArray();
+ Set<UUID> rootUUIDs = ((DerivateViewEditorInput) inputElement).getRootUUIDs();
+ for (UUID uuid : rootUUIDs) {
+ SpecimenOrObservationBase<?> rootElement = CdmStore.getService(IOccurrenceService.class).load(uuid);
+ if(rootElement!=null){
+ rootElements.add(new TreeNode(rootElement));
+ }
+ }
}
- return null;
+ return rootElements.toArray();
}
@Override
*/
package eu.etaxonomy.taxeditor.editor.view.derivate;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.TransferData;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
-import eu.etaxonomy.cdm.model.molecular.DnaSample;
-import eu.etaxonomy.cdm.model.molecular.Sequence;
-import eu.etaxonomy.cdm.model.molecular.SingleRead;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.derivate.operation.MoveDerivateOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
/**
* @author pplitzner
private final DerivateView derivateView;
- /**
- * @param derivateView
- */
protected DerivateDropListener(DerivateView derivateView) {
super(derivateView.getViewer());
this.derivateView = derivateView;
if(target instanceof TreeNode && data instanceof DerivateViewSelection){
DerivateViewSelection derivateViewSelection = (DerivateViewSelection)data;
TreeNode targetNode = (TreeNode) target;
- TreeNode draggednode = EditorUtil.getTreeNodeOfSelection(derivateViewSelection.getSelection());
- if(draggednode!=null){
- if(moveTreeNode(draggednode, targetNode)){
- //update DerivateView
- derivateView.getConversationHolder().commit();
- derivateView.refreshTree();
-
- // update source DerivateView if dragging between different views occurred
- DerivateView sourceDerivateView = derivateViewSelection.getDerivateView();
- if(sourceDerivateView!=derivateView){
- sourceDerivateView.getConversationHolder().commit();
- sourceDerivateView.refreshTree();
- }
-
- //FIXME: way too much overhead for just refreshing the other DerivateView
-// CdmStore.getContextManager().notifyContextRefresh();
- LocalSelectionTransfer.getTransfer().setSelection(null);
- return true;
- }
- else{
- DerivateLabelProvider derivateLabelProvider = new DerivateLabelProvider();
- derivateLabelProvider.setConversation(derivateView.getConversationHolder());
- MessagingUtils.warningDialog("Moving derivate not possible!", derivateView, "Moving \""+derivateLabelProvider.getDerivateText(draggednode)+"\" to \""+derivateLabelProvider.getDerivateText(targetNode)+"\" is not possible!");
- }
+ TreeNode draggedNode = EditorUtil.getTreeNodeOfSelection(derivateViewSelection.getSelection());
+ if(draggedNode!=null){
+ MoveDerivateOperation moveDerivateOperation = new MoveDerivateOperation("Moving \""+derivateView.getLabelProvider().getDerivateText(draggedNode)+"\" to \""+derivateView.getLabelProvider().getDerivateText(targetNode)+"\"", EditorUtil.getUndoContext(), derivateView, draggedNode, targetNode);
+ return AbstractUtility.executeOperation(moveDerivateOperation).equals(Status.OK_STATUS)?true:false;
}
}
return false;
return LocalSelectionTransfer.getTransfer().isSupportedType(transferType) && target instanceof TreeNode;
}
- /**
- * @param value
- * @return
- */
- private boolean moveTreeNode(TreeNode draggedNode, TreeNode targetNode) {
- Object draggedNodeValue = draggedNode.getValue();
- Object targetNodeValue = targetNode.getValue();
- TreeNode fromParentNode = draggedNode.getParent();
- Object fromParentSpecimen = null;
- if(fromParentNode!=null){
- fromParentSpecimen = fromParentNode.getValue();
- }
-
- // drag'n'drop for SpecimenOrObservationBase
- IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
- if(draggedNodeValue instanceof DerivedUnit && targetNodeValue instanceof SpecimenOrObservationBase<?>){
- DerivedUnit draggedSpecimen = (DerivedUnit) draggedNodeValue;
- SpecimenOrObservationBase<?> targetSpecimen = (SpecimenOrObservationBase<?>) targetNodeValue;
- //check if type is a sub derivate type
- if(fromParentSpecimen instanceof SpecimenOrObservationBase<?>
- && fromParentNode!=null
- && !fromParentNode.equals(targetNode)){//don't drag on direct parent node)
- return occurrenceService.moveDerivate((SpecimenOrObservationBase<?>)fromParentSpecimen, targetSpecimen, draggedSpecimen);
- }
- }
-
- // drag'n'drop for SingleRead
- else if(draggedNodeValue instanceof SingleRead && targetNodeValue instanceof Sequence){
- SingleRead singleRead = (SingleRead) draggedNodeValue;
- if(fromParentSpecimen instanceof Sequence){
- return CdmStore.getService(ISequenceService.class).moveSingleRead((Sequence)fromParentSpecimen, (Sequence)targetNodeValue, singleRead);
- }
- }
-
- // drag'n'drop for Sequence
- else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
- Sequence sequence = (Sequence)draggedNodeValue;
- if(fromParentSpecimen instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
- return occurrenceService.moveSequence((DnaSample)fromParentSpecimen, (DnaSample)targetNodeValue, sequence);
- }
- }
- return false;
- }
-
}
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.UUID;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.MenuManager;
*
*/
public class DerivateView extends EditorPart implements IPartContentHasFactualData, IDirtyMarkable,
- IConversationEnabled, IPartContentHasDetails, IPartContentHasMedia, IPartContentHasSupplementalData,
+ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IPartContentHasMedia,
ISelectionChangedListener, IPostOperationEnabled {
public static final String ID = "eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView";
labelProvider.setMultiLinkSingleReads(multiLinkSingleReads);
IEditorInput editorInput = getEditorInput();
viewer.setInput(editorInput);
+ //set selection to selected derivate if only one was selected
if(editorInput instanceof DerivateViewEditorInput){
- SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) editorInput).getDerivateUUID());
- SpecimenOrObservationBase<?> rootElement = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) editorInput).getRootElementUUID());
- setPartName(labelProvider.getDerivateText(rootElement));
- viewer.setSelection(new StructuredSelection(new TreeNode(specimen)));
+ Set<UUID> derivateUUIDs = ((DerivateViewEditorInput) editorInput).getDerivateUUIDs();
+ if(derivateUUIDs.size()==1){
+ SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(derivateUUIDs.iterator().next());
+ if(specimen!=null){
+ viewer.setSelection(new StructuredSelection(new TreeNode(specimen)));
+ }
+ }
}
//add drag'n'drop support
*/
@Override
public void doSave(IProgressMonitor monitor) {
- monitor.beginTask("Saving Derivates", 3);
+ String taskName = "Saving hierarchy";
+ if(getEditorInput() instanceof DerivateViewEditorInput){
+ DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
+ taskName += " "+derivateViewEditorInput.getName();
+ }
+ monitor.beginTask(taskName, 3);
if (!conversation.isBound()) {
conversation.bind();
}
*/
@Override
public String getTitleToolTip() {
+ if(getEditorInput() instanceof DerivateViewEditorInput){
+ DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
+ return derivateViewEditorInput.getName();
+ }
return "Derivate View";
}
setSite(site);
setInput(input);
if(input instanceof DerivateViewEditorInput){
- conversation = ((DerivateViewEditorInput) input).getConversationHolder();
+ DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) input;
+ conversation = derivateViewEditorInput.getConversationHolder();
+ setPartName(derivateViewEditorInput.getName());
}
}
this.selection = event.getSelection();
}
- /**
- * @return the selection
- */
public ISelection getSelection() {
return selection;
}
+ public DerivateLabelProvider getLabelProvider() {
+ return labelProvider;
+ }
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.operation.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
*/
public boolean postOperation(CdmBase objectAffectedByOperation) {
refreshTree();
if(objectAffectedByOperation!=null){
- DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
- if(objectAffectedByOperation.getUuid().equals(derivateViewEditorInput.getRootElementUUID())){
- // TODO close derivate view if root element is deleted
-// this.getViewer().setEditorSite().getPage().close();
- return true;
- }
- else if(objectAffectedByOperation.getUuid().equals(derivateViewEditorInput.getDerivateUUID())){
- derivateViewEditorInput.setRootAsDerivate();
- }
changed(objectAffectedByOperation);
- return true;
}
- return false;
+ return true;
}
/* (non-Javadoc)
*/
package eu.etaxonomy.taxeditor.editor.view.derivate;
+import java.util.HashSet;
+import java.util.Set;
import java.util.UUID;
import org.eclipse.jface.resource.ImageDescriptor;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
/**
* Editor input for the {@link DerivateView} which holds the currently selected derivate for which
public class DerivateViewEditorInput implements IEditorInput{
/**
- * The selected derivate {@link UUID}
+ * The selected derivate {@link UUID}s
*/
- private UUID derivateUUID;
+ private Set<UUID> derivateUUIDs;
/**
- * The {@link UUID} of the root of the hierarchy (may be the same object as the derivate)
+ * List of the {@link UUID}s of the root elements of the hierarchy (may be the same objects as the derivates)
*/
- private UUID rootUUID;
+ private Set<UUID> rootUUIDs;
private final ConversationHolder conversationHolder;
/**
- * Creates an editor input for the {@link DerivateView} with the currently selected derivate and the
- * corresponding {@link FieldUnit} (both may be the same object).
- * @param derivateUuid the {@link UUID} of the derivate for which the derivate hierarchy should be shown
- * @param rootUUID the root of the hierarchy
+ * Creates an editor input for the {@link DerivateView} with the currently selected derivates and the
+ * corresponding {@link FieldUnit}s (both may be the same object).
+ * @param derivateUuids the {@link UUID}s of the derivates for which the derivate hierarchy should be shown
+ * @param rootUUIDs the root of the hierarchy
*/
- public DerivateViewEditorInput(UUID derivateUuid) {
+ public DerivateViewEditorInput(Set<UUID> derivateUuids) {
super();
this.conversationHolder = CdmStore.createConversation();
- this.derivateUUID = derivateUuid;
- SpecimenOrObservationBase<?> derivate = CdmStore.getService(IOccurrenceService.class).load(derivateUuid);
- if(derivate instanceof FieldUnit){
- this.rootUUID = derivateUUID;
- }
- else if(derivate instanceof DerivedUnit){
- SpecimenOrObservationBase<?> topMostDerivate = EditorUtil.getTopMostDerivate(derivate);
- rootUUID = topMostDerivate==null?null:topMostDerivate.getUuid();
- if(rootUUID==null){
- rootUUID = derivateUUID;
+ this.derivateUUIDs = derivateUuids;
+ this.rootUUIDs = new HashSet<UUID>();
+ for (UUID uuid : derivateUuids) {
+ SpecimenOrObservationBase<?> derivate = CdmStore.getService(IOccurrenceService.class).load(uuid);
+ if(derivate instanceof FieldUnit){
+ rootUUIDs.add(uuid);
+ }
+ else if(derivate instanceof DerivedUnit){
+ SpecimenOrObservationBase<?> topMostDerivate = EditorUtil.getTopMostDerivate(derivate);
+ if(topMostDerivate!=null){
+ rootUUIDs.add(topMostDerivate.getUuid());
+ }
}
}
- if(rootUUID==null){
+ if(rootUUIDs.isEmpty()){
+ rootUUIDs = derivateUUIDs;
+ }
+ if(rootUUIDs.isEmpty()){
MessagingUtils.messageDialog("Failed initializing editor", DerivateViewEditorInput.class, "No root element found!");
}
}
*/
@Override
public String getName() {
- return derivateUUID.toString();
+ return getEditorName();
}
/* (non-Javadoc)
*/
@Override
public String getToolTipText() {
- return derivateUUID.toString();
+ return getEditorName();
+ }
+
+ private String getEditorName() {
+ String name = null;
+ for(UUID uuid:rootUUIDs){
+ SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(uuid);
+ if(specimen!=null){
+ if(name==null){
+ name = DerivateLabelProvider.getDerivateText(specimen, conversationHolder);
+ }
+ else{
+ name += " + "+DerivateLabelProvider.getDerivateText(specimen, conversationHolder);
+ }
+ }
+ }
+ return name;
}
- public UUID getDerivateUUID() {
- return derivateUUID;
+ public Set<UUID> getRootUUIDs() {
+ return rootUUIDs;
}
- public UUID getRootElementUUID() {
- return rootUUID;
+ public Set<UUID> getDerivateUUIDs() {
+ return derivateUUIDs;
}
public void setRootAsDerivate(){
- this.derivateUUID = this.rootUUID;
+ this.derivateUUIDs = this.rootUUIDs;
}
public ConversationHolder getConversationHolder() {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((rootUUID == null) ? 0 : rootUUID.hashCode());
+ result = prime * result + ((rootUUIDs == null) ? 0 : rootUUIDs.hashCode());
return result;
}
return false;
}
DerivateViewEditorInput other = (DerivateViewEditorInput) obj;
- if (rootUUID == null) {
- if (other.rootUUID != null) {
+ if (rootUUIDs == null) {
+ if (other.rootUUIDs != null) {
return false;
}
- } else if (!rootUUID.equals(other.rootUUID)) {
+ } else if (!rootUUIDs.equals(other.rootUUIDs)) {
return false;
}
return true;
}
+
}
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.handlers.HandlerUtil;
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
/**
*
Object object = selection.iterator().next();
if(object instanceof TreeNode){
- TreeNode treeNode = (TreeNode)object;
Object value = ((TreeNode) object).getValue();
if(value instanceof SpecimenOrObservationBase<?> || value instanceof Sequence || value instanceof SingleRead){
+ if(postOperationEnabled instanceof IConversationEnabled){
+ ConversationHolder conversationHolder = ((IConversationEnabled) postOperationEnabled).getConversationHolder();
+ label += " "+DerivateLabelProvider.getDerivateText(value, conversationHolder);
+ }
SpecimenDeleteConfigurator config = new SpecimenDeleteConfigurator();
config.setDeleteChildren(false);
- config.setShiftHierarchyUp(false);
DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, postOperationEnabled, config);
AbstractUtility.executeOperation(deleteDerivateOperation);
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @date Nov 25, 2014
+ *
+ */
+public class OpenDerivateEditorForTaxonHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+ if(currentSelection instanceof IStructuredSelection){
+ Iterator<?> selectionIterator = ((IStructuredSelection) currentSelection).iterator();
+ Set<UUID> derivateUuids = new HashSet<UUID>();
+ while(selectionIterator.hasNext()){
+ Object object = selectionIterator.next();
+ if(object instanceof TaxonNode){
+ TaxonNode node = (TaxonNode)object;
+ Taxon taxon = node.getTaxon();
+ List<SpecimenOrObservationBase> listByAssociatedTaxon = CdmStore.getService(IOccurrenceService.class).listByAssociatedTaxon(null, null, taxon, null, null, null, null, null);
+ for (SpecimenOrObservationBase specimenOrObservationBase : listByAssociatedTaxon) {
+ derivateUuids.add(specimenOrObservationBase.getUuid());
+ }
+ }
+ }
+ if(derivateUuids.isEmpty()){
+ MessagingUtils.warningDialog("Could not open Derivate Editor", this, "No Derivates found");
+ return null;
+ }
+ DerivateViewEditorInput input = new DerivateViewEditorInput(derivateUuids);
+ try {
+ EditorUtil.open(input);
+ } catch (PartInitException e) {
+ MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open Derivate Editor", e);
+ } catch (NullPointerException npe){
+ MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open Derivate Editor. The derivate hierarchy is corrupted!", npe);
+ }
+ }
+ return null;
+ }
+
+}
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.ISaveablePart;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
/** {@inheritDoc} */
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if(getPostOperationEnabled() instanceof ISaveablePart){
+ if(!MessagingUtils.confirmDialog("Confirm deletion", "Do you really want to delete the selected element?")){
+ return Status.CANCEL_STATUS;
+ }
+ if(((ISaveablePart) getPostOperationEnabled()).isDirty()){
+ MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+ return Status.CANCEL_STATUS;
+ }
+ }
DeleteResult deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
- if(!deleteResult.isOk()){
+ if(deleteResult.isOk()){
+ if(getPostOperationEnabled() instanceof DerivateView){
+ DerivateView derivateView = (DerivateView) getPostOperationEnabled();
+ //update DerivateView
+ derivateView.getConversationHolder().commit();
+ return postExecute(null);
+ }
+ }
+ else{
String exceptionMessage = "";
for(Exception exception:deleteResult.getExceptions()){
exceptionMessage += exception.getLocalizedMessage();
}
//TODO: add method to DeleteResult to sum up exceptions
MessagingUtils.warningDialog("Deletion failed", this, exceptionMessage);
- return postExecute(null);
+ return Status.CANCEL_STATUS;
}
- return postExecute(element);
+ return Status.OK_STATUS;
}
/*
/** {@inheritDoc} */
@Override
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return execute(monitor, info);
+ //no redo possible
+ return Status.CANCEL_STATUS ;
}
/*
/** {@inheritDoc} */
@Override
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return postExecute(element);
+ //no undo possible
+ return Status.CANCEL_STATUS;
}
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.view.derivate.operation;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.TreeNode;
+
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @date Nov 18, 2014
+ *
+ */
+public class MoveDerivateOperation extends AbstractPostOperation<CdmBase> {
+
+ private final TreeNode draggedNode;
+ private TreeNode fromNode;
+ private TreeNode targetNode;
+
+ public MoveDerivateOperation(String label, IUndoContext undoContext,
+ IPostOperationEnabled postOperationEnabled, TreeNode draggedNode, TreeNode targetNode) {
+ super(label, undoContext, null, postOperationEnabled);
+ this.draggedNode = draggedNode;
+ this.targetNode = targetNode;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ DerivateView derivateView = null;
+ if(getPostOperationEnabled() instanceof DerivateView){
+ derivateView = (DerivateView) getPostOperationEnabled();
+ }
+ if(derivateView==null){
+ MessagingUtils.operationDialog(this, new NullPointerException("DerivateView was null"), TaxeditorEditorPlugin.PLUGIN_ID, this.getLabel(), getLabel());
+ return Status.CANCEL_STATUS;
+ }
+ if(derivateView.isDirty()){
+ MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+ return Status.CANCEL_STATUS;
+ }
+
+ fromNode = draggedNode.getParent();
+ if(moveTreeNode(draggedNode, fromNode, targetNode)){
+ //update DerivateView
+ derivateView.getConversationHolder().commit();
+ LocalSelectionTransfer.getTransfer().setSelection(null);
+ return postExecute(null);
+ }
+ else{
+ MessagingUtils.warningDialog("Moving derivate not possible!", derivateView, "Moving \""+derivateView.getLabelProvider().getDerivateText(draggedNode)+"\" to \""+derivateView.getLabelProvider().getDerivateText(targetNode)+"\" is not possible!");
+ }
+ return Status.CANCEL_STATUS;
+ }
+
+ private boolean moveTreeNode(TreeNode draggedNode, TreeNode fromNode, TreeNode targetNode) {
+ Object draggedNodeValue = draggedNode.getValue();
+ Object targetNodeValue = targetNode.getValue();
+ Object fromParentSpecimen = null;
+ if(fromNode!=null){
+ fromParentSpecimen = fromNode.getValue();
+ }
+
+ // drag'n'drop for SpecimenOrObservationBase
+ IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
+ if(draggedNodeValue instanceof DerivedUnit && targetNodeValue instanceof SpecimenOrObservationBase<?>){
+ DerivedUnit draggedSpecimen = (DerivedUnit) draggedNodeValue;
+ SpecimenOrObservationBase<?> targetSpecimen = (SpecimenOrObservationBase<?>) targetNodeValue;
+ //check if type is a sub derivate type
+ if(fromParentSpecimen instanceof SpecimenOrObservationBase<?>
+ && fromNode!=null
+ && !fromNode.equals(targetNode)){//don't drag on direct parent node)
+ return occurrenceService.moveDerivate((SpecimenOrObservationBase<?>)fromParentSpecimen, targetSpecimen, draggedSpecimen);
+ }
+ }
+
+ // drag'n'drop for SingleRead
+ else if(draggedNodeValue instanceof SingleRead && targetNodeValue instanceof Sequence){
+ SingleRead singleRead = (SingleRead) draggedNodeValue;
+ if(fromParentSpecimen instanceof Sequence){
+ return CdmStore.getService(ISequenceService.class).moveSingleRead((Sequence)fromParentSpecimen, (Sequence)targetNodeValue, singleRead);
+ }
+ }
+
+ // drag'n'drop for Sequence
+ else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+ Sequence sequence = (Sequence)draggedNodeValue;
+ if(fromParentSpecimen instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+ return occurrenceService.moveSequence((DnaSample)fromParentSpecimen, (DnaSample)targetNodeValue, sequence);
+ }
+ }
+ return false;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ //swap fromNode and targetNode
+ this.targetNode = this.fromNode;
+ return execute(new NullProgressMonitor(), null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ //swap fromNode and targetNode
+ this.targetNode = this.fromNode;
+ return execute(new NullProgressMonitor(), null);
+ }
+
+}
import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.model.description.IDescribable;
+import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
protected static final Object[] NO_CHILDREN = new Object[0];
protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache;
+ private boolean showOnlyIndividualAssociations;
+ public DescriptiveContentProvider(Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache) {
+ this(featureNodeContainerCache, false);
+ }
/**
* <p>Constructor for DescriptiveContentProvider.</p>
*
* @param featureNodeContainerCache a {@link java.util.Map} object.
*/
- public DescriptiveContentProvider(Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache) {
+ public DescriptiveContentProvider(Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache, boolean showOnlyIndividualAssociations) {
this.featureNodeContainerCache = featureNodeContainerCache;
+ this.showOnlyIndividualAssociations = showOnlyIndividualAssociations;
}
/* (non-Javadoc)
DescriptionBase<?> description = (DescriptionBase<?>) parentElement;
FeatureNodeContainerTree containerTree = getContainerTreeForDesription(description);
-
- return containerTree.getRoot().getChildren().toArray();
+ List<FeatureNodeContainer> children = containerTree.getRoot().getChildren();
+ //filter out containers with no children
+ List<FeatureNodeContainer> childrenWithChildren = new ArrayList<FeatureNodeContainer>();
+ for (FeatureNodeContainer featureNodeContainer : children) {
+ if(getChildren(featureNodeContainer).length>0){
+ childrenWithChildren.add(featureNodeContainer);
+ }
+ }
+ return childrenWithChildren.toArray();
}
}
else if (parentElement instanceof FeatureNodeContainer){
FeatureNodeContainer container = (FeatureNodeContainer) parentElement;
if(container.isLeaf()){
- return container.getDescriptionElements().toArray();
+ List<DescriptionElementBase> descriptionElements = container.getDescriptionElements();
+ if(showOnlyIndividualAssociations){
+ List<DescriptionElementBase> filteredDescriptionElements = new ArrayList<DescriptionElementBase>();
+ for (DescriptionElementBase descriptionElement : descriptionElements) {
+ if(descriptionElement instanceof IndividualsAssociation){
+ filteredDescriptionElements.add(descriptionElement);
+ }
+ }
+ descriptionElements = filteredDescriptionElements;
+ }
+ return descriptionElements.toArray();
}else{
return container.getChildren().toArray();
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ public void toggleShowOnlyIndividualAssociations() {
+ showOnlyIndividualAssociations = !showOnlyIndividualAssociations;
+ }
+
}
protected int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
+ private DescriptiveContentProvider provider;
+
/** {@inheritDoc} */
@Override
public void createViewer(Composite parent) {
viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION));
- viewer.setContentProvider(new DescriptiveContentProvider(featureNodeContainerCache));
+ provider = new DescriptiveContentProvider(featureNodeContainerCache);
+ viewer.setContentProvider(provider);
viewer.setLabelProvider(new DescriptiveLabelProvider());
viewer.setSorter(new DescriptiveViewerSorter());
viewer.setAutoExpandLevel(2);
public boolean onComplete() {
return false;
}
+
+ public void toggleShowOnlyIndividualAssociations(){
+ provider.toggleShowOnlyIndividualAssociations();
+ viewer.refresh();
+ }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.view.descriptive.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
+
+/**
+ * @author pplitzner
+ * @date Nov 25, 2014
+ *
+ */
+public class ToggleShowOnlyIndividualAssociationsHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
+ if(activePart instanceof DescriptiveViewPart){
+ DescriptiveViewPart descriptiveViewPart = (DescriptiveViewPart)activePart;
+ descriptiveViewPart.toggleShowOnlyIndividualAssociations();
+ }
+ return null;
+ }
+
+}
</menuContribution>
</extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.NewTaxonNodeHandler"
- id="eu.etaxonomy.taxeditor.navigation.command.create.taxonNode"
- name="%command.name">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.NewClassificationHandler"
- id="eu.etaxonomy.taxeditor.navigation.create.classification"
- name="%command.name.0">
- </command>
- </extension>
<extension
point="org.eclipse.ui.commands">
<command
id="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym"
name="%command.name.5">
</command>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.NewClassificationHandler"
+ id="eu.etaxonomy.taxeditor.navigation.create.classification"
+ name="%command.name.0">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.NewTaxonNodeHandler"
+ id="eu.etaxonomy.taxeditor.navigation.command.create.taxonNode"
+ name="%command.name">
+ </command>
<command
defaultHandler="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.NewPolytomousKeyHandler"
id="eu.etaxonomy.taxeditor.navigation.key.polytomous.newKey"
--- /dev/null
+package eu.etaxonomy.taxeditor.navigation.navigator.handler;
+
+import java.util.UUID;
+
+import org.eclipse.core.commands.AbstractParameterValueConverter;
+import org.eclipse.core.commands.ParameterValueConversionException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class TaxonParameterConverter extends AbstractParameterValueConverter {
+
+ public TaxonParameterConverter() {
+ }
+
+ @Override
+ public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
+ return CdmStore.getService(ITaxonService.class).load(UUID.fromString(parameterValue));
+ }
+
+ @Override
+ public String convertToString(Object parameterValue) throws ParameterValueConversionException {
+ if(parameterValue instanceof TaxonBase<?>){
+ return ((TaxonBase) parameterValue).getUuid().toString();
+ }
+ return null;
+ }
+
+}
</visibleWhen>
</command>
</menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView">
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
+ label="Open in Derivate Editor"
+ style="push">
+ </command>
+ </menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
</activeWhen>
</handler>
</extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
- id="eu.etaxonomy.taxeditor.datasource.connect"
- name="Connect">
- </command>
- </extension>
<extension
name="Popup Menu Commands"
point="org.eclipse.ui.commands">
id="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler"
name="Open Distribution Editor Wizard">
</command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
+ id="eu.etaxonomy.taxeditor.datasource.connect"
+ name="Connect">
+ </command>
</extension>
<extension
point="org.eclipse.ui.importWizards">
id="eu.etaxonomy.taxeditor.io.export.dwca"
name="%wizard.name.9">
</wizard>
+ <wizard
+ category="eu.etaxonomy.taxeditor.export.category.cdm"
+ class="eu.etaxonomy.taxeditor.io.wizard.CsvExportWizard"
+ id="eu.etaxonomy.taxeditor.io.export.csv"
+ name="CSV">
+ </wizard>
</extension>
<extension
point="org.eclipse.ui.newWizards">
// $Id$
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
- *
+ *
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.io.common.CdmDefaultExport;
* <p>
* ExportHandler class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Sep 11, 2009
* @version 1.0
public class ExportManager extends AbstractIOManager<IExportConfigurator> {
/**
- *
+ *
* @param applicationConfiguration
*/
private ExportManager(ICdmApplicationConfiguration applicationConfiguration) {
* <p>
* NewInstance
* </p>
- *
+ *
* @param applicationConfiguration
* a
* {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
* <p>
* createIOJob
* </p>
- *
+ *
* @param configurator
* a {@link eu.etaxonomy.cdm.io.common.IExportConfigurator}
* object.
"Exporting database. This will take some time.", 100);
monitor.worked(10);
- display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- // terminate any open transactions
- IConversationEnabled activePart = (IConversationEnabled) StoreUtil
- .getActivePage().getActivePart();
- activePart.getConversationHolder().commit(false);
- }
- });
-
- monitor.worked(10);
+ /** see ticket # 4456 and */
+// display.asyncExec(new Runnable() {
+//
+// @Override
+// public void run() {
+//
+// // terminate any open transactions
+// IConversationEnabled activePart = (IConversationEnabled) StoreUtil
+// .getActivePage().getActivePart();
+// activePart.getConversationHolder().commit(false);
+// }
+// });
+
+// monitor.worked(10);
CdmDefaultExport<IExportConfigurator> exporter = new CdmDefaultExport<IExportConfigurator>();
configurator.setProgressMonitor(CdmProgressMonitorAdapter
.CreateSubMonitor(monitor, 80));
- exporter.setCdmAppController((ICdmApplicationConfiguration) applicationConfiguration);
+ exporter.setCdmAppController(applicationConfiguration);
monitor.worked(10);
try {
// trigger
// change listener
// TODO verify correct behaviour
-
+
try{
conversationEnabled.getConversationHolder()
.startTransaction();
-
+
conversationEnabled.getConversationHolder()
.commit();
}catch(RuntimeException e){
* <p>
* JaxbConfigurator
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator} object.
*/
public final JaxbExportConfigurator JaxbConfigurator() {
* <p>
* SddConfigurator
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator}
* object.
*/
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.io.wizard;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.ui.IWorkbench;
+
+import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author a.oppermann
+ * @created Nov. 11, 2014
+ * @version 1.0
+ */
+public class CsvExportWizard extends AbstractExportWizard<CsvDemoExportConfigurator> {
+
+ private CsvDemoExportConfigurator configurator;
+ private ExportToFileDestinationWizardPage page;
+
+ private final String description = "Export the contents of the currently selected database into Comma Separated Value format.";
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+ * org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ configurator = CsvDemoExportConfigurator.NewInstance(null, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#getConfigurator()
+ */
+ @Override
+ public CsvDemoExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ String urlString = page.getFolderText() + File.separator
+ + page.getExportFileName();
+
+ final Combo combo = page.getCombo();
+ final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
+ if(combo != null){
+ int selectionIndex = combo.getSelectionIndex();
+ HashSet<UUID> set = new HashSet<UUID>();
+ if(selectionIndex == -1){
+ for(Classification c:listClassifications){
+ set.add(c.getUuid());
+ }
+ }else{
+ for(Classification c:listClassifications){
+ if(c.getTitleCache().equalsIgnoreCase(combo.getItem(selectionIndex))){
+ set.add(c.getUuid());
+ }
+ }
+ configurator.setClassificationUuids(set);
+ configurator.setDoTaxa(true);
+ configurator.setHasHeaderLines(true);
+ configurator.setClassification(true);
+ configurator.setTaxonName(true);
+ configurator.setAuthor(true);
+ configurator.setRank(true);
+ configurator.setLastChange(true);
+ }
+ }
+ configurator.setDestination(new File(urlString));
+
+ CdmStore.getExportManager().run(configurator);
+
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ //TODO create page with drop down menu for export for single classification.
+// super.addPages();
+
+
+ //standard page
+ page = ExportToFileDestinationWizardPage.Csv();
+
+ addPage(page);
+ }
+}
// $Id$
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
- *
+ *
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import java.text.SimpleDateFormat;
import java.util.Calendar;
+import java.util.List;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.remote.CdmRemoteSourceException;
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* <p>
* ExportToFileDestinationWizardPage class.
* </p>
- *
+ *
* @author n.hoffmann
* @created 15.06.2009
* @version 1.0
public static final String DWCA_EXPORT = "DWCA_EXPORT";
+ public static final String CSV_EXPORT = "CSV_EXPORT";
+
public static final String XML = "xml";
+ public static final String CSV = "csv";
+
public static final String ZIP = "zip";
+ private static boolean csvExport = false;
+
private DirectoryDialog folderDialog;
private Text text_exportFileName;
private final String extension;
+ private Combo comboBox;
+
/**
* @param pageName
* @param selection
*/
- private ExportToFileDestinationWizardPage(String pageName, String type,
+ protected ExportToFileDestinationWizardPage(String pageName, String type,
String title, String description, String extension) {
super(pageName);
* <p>
* Jaxb
* </p>
- *
+ *
* @return a
* {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
* object.
* <p>
* Tcs
* </p>
- *
+ *
* @return a
* {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
* object.
* <p>
* Sdd
* </p>
- *
+ *
* @return a
* {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
* object.
ZIP);
}
+
+
+ /**
+ * @return
+ */
+ public static ExportToFileDestinationWizardPage Csv() {
+ csvExport = true;
+ return new ExportToFileDestinationWizardPage(
+ CSV_EXPORT,
+ "csv",
+ "CSV Export",
+ "Export the contents of the currently selected database into Comma Separated Value format.",
+ CSV);
+ }
+
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
* .Composite)
*/
/** {@inheritDoc} */
- public void createControl(Composite parent) {
+ @Override
+ public void createControl(Composite parent) {
setPageComplete(false);
gridLayout.numColumns = 3;
composite.setLayout(gridLayout);
+
+ if(csvExport){
+ Label comboBoxLabel = new Label(composite, SWT.NONE);
+ comboBoxLabel.setText("Classification");
+ Combo comboBox = addComboBox(composite);
+ comboBox.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
+ true, false, 2, 1));
+ }
+
Label fileLabel = new Label(composite, SWT.NONE);
fileLabel.setText("File");
button.addSelectionListener(new SelectionAdapter() {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
* .swt.events.SelectionEvent)
setControl(composite);
}
- private String generateFilename() {
+ protected String generateFilename() {
StringBuffer buffer = new StringBuffer();
Calendar cal = Calendar.getInstance();
* <p>
* getExportFileName
* </p>
- *
+ *
* @return the exportFileName
*/
public String getExportFileName() {
* <p>
* getFolderText
* </p>
- *
+ *
* @return the folderText
*/
public String getFolderText() {
return text_folder.getText();
}
+ private Combo addComboBox(Composite composite){
+
+ comboBox = new Combo(composite, SWT.DROP_DOWN);
+ comboBox.setText("Choose Classification");
+
+ final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
+
+ for(Classification c : listClassifications){
+ comboBox.add(c.getTitleCache());
+ }
+
+ return comboBox;
+ }
+
+ public Combo getCombo(){
+ return comboBox;
+ }
+
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.model;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+
+/**
+ * Clients implementing this interface indicate, that they use {@link DerivedUnitFacade}s
+ * for specimen data instead of {@link DerivedUnit}s and {@link FieldUnit}s themselves.
+ *
+ * @author pplitzner
+ * @date Dec 3, 2014
+ *
+ */
+public interface IDerivedUnitFacadePart {
+
+}
public class MessagingUtils {
public final static String UNEXPECTED_ERROR_MESSAGE = "This is an unexpected error.";
public final static String CONTACT_MESSAGE = System.getProperty("line.separator") + "Please contact EDIT Support (EditSupport@bgbm.org) with the error trace below (click on the 'Details' button).";
+ public final static String DEFAULT_MESSAGE = "Error thrown but no associated message";
/**
* Gets the Log4J logger for a given class
public static String getStackTraceAndContextInfo(Throwable t, List<String> contextInfo) {
StringBuffer stackTraceAndContextInfo = new StringBuffer();
+ Throwable throwable = t;
for(String infoItem : contextInfo) {
stackTraceAndContextInfo.append(infoItem + System.getProperty("line.separator"));
}
StringWriter sw = new StringWriter();
- t.printStackTrace(new PrintWriter(sw));
+
+ if(throwable == null) {
+ throwable = getDefaultThrowable();
+ }
+ throwable.printStackTrace(new PrintWriter(sw));
stackTraceAndContextInfo.append(sw.toString());
return stackTraceAndContextInfo.toString();
}
+ private static Throwable getDefaultThrowable() {
+ return new Throwable("Error thrown but no associated exception");
+ }
+
+
+
/**
* Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
*
final Throwable t,
boolean addContactMesg) {
-
+ Throwable throwable = t;
StringBuffer sbStackTrace = new StringBuffer();
// We need to build a MultiStatus object since the simple
childStatuses.add(new Status(IStatus.ERROR, pluginId, infoItem));
}
+ if(throwable == null) {
+ throwable = getDefaultThrowable();
+ }
+
// add main execption
- for (StackTraceElement ste : t.getStackTrace()) {
+ for (StackTraceElement ste : throwable.getStackTrace()) {
childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
}
// add cause
- if(t.getCause() != null) {
+ if(throwable.getCause() != null) {
childStatuses.add(new Status(IStatus.ERROR, pluginId, ""));
- childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + t.getCause().toString()));
- for (StackTraceElement ste : t.getCause().getStackTrace()) {
+ childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + throwable.getCause().toString()));
+ for (StackTraceElement ste : throwable.getCause().getStackTrace()) {
// build & add status
childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
}
String finalMessage = message;
if(finalMessage == null || finalMessage.isEmpty()) {
- finalMessage = "";
+ finalMessage = DEFAULT_MESSAGE;
}
if(addContactMesg) {
MultiStatus ms = new MultiStatus(pluginId,
IStatus.ERROR,
childStatuses.toArray(new Status[] {}),
- t.toString(),
- t);
+ throwable.toString(),
+ throwable);
- errorDialog(title, source, t, contextInfo, finalMessage, ms);
- }
-
- /**
- * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
- *
- * @param title
- * a {@link java.lang.String} object.
- * @param source
- * a {@link java.lang.Object} object.
- * @param status
- * a {@link org.eclipse.core.runtime.IStatus} object.
- */
- private static void errorDialog(final String title,
- final Object source,
- final String message,
- final IStatus status) {
-
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status);
- ced.open();
- Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
- error(clazz, status);
- }
- });
+ errorDialog(title, source, throwable, contextInfo, finalMessage, ms);
}
/**
+++ /dev/null
-// $Id$
-/**
- * Copyright (C) 2014 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-package eu.etaxonomy.taxeditor.newWizard;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.molecular.Amplification;
-import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailElement;
-
-/**
- * @author pplitzner
- * @date 11.03.2014
- *
- */
-public class AmplificationPrimerWizardPage extends AbstractCdmEntityWizardPage<Amplification> {
-
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
- public AmplificationPrimerWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Amplification entity) {
- super(formFactory, conversation, entity);
- setTitle("Amplification Primer Data");
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
- */
- @Override
- protected void checkComplete() {
- setPageComplete(true);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
- */
- @Override
- public AbstractCdmDetailElement<Amplification> createElement(ICdmFormElement rootElement) {
- AmplificationPrimerDetailElement detailElement = formFactory.createAmplificationPrimerDetailElement(rootElement);
- detailElement.setEntity(getEntity());
- checkComplete();
- return detailElement;
- }
-
-}
public class NewAmplificationWizard extends AbstractNewEntityWizard<Amplification> {
private AmplificationGeneralWizardPage amplificationGeneralPage;
- private AmplificationPrimerWizardPage amplificationPrimerPage;
private AmplificationCloningWizardPage amplificationCloningPage;
private AmplificationGelPhotoWizardPage amplificationGelPhotoWizardPage;
public void addPages() {
amplificationGeneralPage = new AmplificationGeneralWizardPage(formFactory, getConversationHolder(), getEntity());
addPage(amplificationGeneralPage);
- amplificationPrimerPage = new AmplificationPrimerWizardPage(formFactory, getConversationHolder(), getEntity());
- addPage(amplificationPrimerPage);
amplificationCloningPage = new AmplificationCloningWizardPage(formFactory, getConversationHolder(), getEntity());
addPage(amplificationCloningPage);
amplificationGelPhotoWizardPage = new AmplificationGelPhotoWizardPage(formFactory, getConversationHolder(), getEntity());
public void setEntity(Amplification entity) {
super.setEntity(entity);
amplificationGeneralPage.getDetailElement().setEntity(entity);
- amplificationPrimerPage.getDetailElement().setEntity(entity);
amplificationCloningPage.getDetailElement().setEntity(entity);
amplificationGelPhotoWizardPage.getDetailElement().setEntity(entity);
}
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseWizardPage;
* @created Jun 16, 2010
* @version 1.0
*/
-public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOrObservationBase> {
+public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOrObservationBase> implements IDerivedUnitFacadePart{
private SpecimenOrObservationType specOrObsType = null;
public NewDerivedUnitBaseWizard() {
public static final String DETERMINATION_ONLY_FOR_FIELD_UNITS = "eu.etaxonomy.taxeditor.specimen.determinationOnlyOnFieldUnitLevel";
+ public static final String SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION = "eu.etaxonomy.taxeditor.specimen.showCollectingAreasInGeneralSection";
+
+ public static final String SHOW_TAXON_ASSOCIATIONS = "eu.etaxonomy.taxeditor.specimen.showTaxonAssociations";
public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
"Taxon determination only on FieldUnit level",
getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION,
+ "Show \"Collecting Areas\" in \"General\" section of details view",
+ getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS,
+ "Show taxon associations of a specimen in the details view",
+ getFieldEditorParent()));
}
import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenCurrentDeterminationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
return element;
}
- /**
- * <p>
- * createLanguageStringWithLabelElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param languageString
- * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
- * object.
- */
public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement,
String labelString, LanguageString languageString, int style) {
- LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString,
- languageString, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
+ return createLanguageStringWithLabelElement(parentElement, labelString, languageString, null, false, style);
}
- /**
- * <p>
- * createLanguageStringWithLabelElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param languageString
- * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
- * @param height
- * a int.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
- * object.
- */
public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement,
- String labelString, LanguageString languageString, int height, int style) {
+ String labelString, LanguageString languageString, Integer height, boolean isMultiLine, int style) {
LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString,
- languageString, height, style);
+ languageString, height, isMultiLine, style);
adapt(element);
parentElement.addElement(element);
return element;
}
-
/**
* <p>
* createKeyValueViewerElement
return section;
}
+ public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
public OriginalLabelDataSection createOriginalLabelDataSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
OriginalLabelDataSection section = new OriginalLabelDataSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SpecimenScanGeneralDetailSection createSpecimenScanGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- SpecimenScanGeneralDetailSection section = new SpecimenScanGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
- addAndAdaptSection(parentElement, section);
- return section;
- }
-
- public LivingPlantPhotoGeneralDetailSection createLivingPlantPhotoGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- LivingPlantPhotoGeneralDetailSection section = new LivingPlantPhotoGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
- addAndAdaptSection(parentElement, section);
- return section;
- }
-
public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return element;
}
+ public TaxonAssociationDetailElement createTaxonAssociationDetailElement(ICdmFormElement parentElement){
+ TaxonAssociationDetailElement element = new TaxonAssociationDetailElement(this, parentElement);
+ addAndAdaptElement(parentElement, element);
+ return element;
+ }
+
public PreservedSpecimenGeneralDetailElement createPreservedSpecimenGeneralDetailElement(ICdmFormElement parentElement){
PreservedSpecimenGeneralDetailElement element = new PreservedSpecimenGeneralDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
return element;
}
- public SpecimenScanGeneralDetailElement createSpecimenScanGeneralDetailElement(ICdmFormElement parentElement){
- SpecimenScanGeneralDetailElement element = new SpecimenScanGeneralDetailElement(this, parentElement);
- addAndAdaptElement(parentElement, element);
- return element;
- }
-
- public LivingPlantPhotoGeneralDetailElement createLivingPlantPhotoGeneralDetailElement(ICdmFormElement parentElement){
- LivingPlantPhotoGeneralDetailElement element = new LivingPlantPhotoGeneralDetailElement(this, parentElement);
- addAndAdaptElement(parentElement, element);
- return element;
- }
-
public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
public class LanguageStringWithLabelElement extends TextWithLabelElement {
private LanguageString languageString;
-
+
/**
* <p>Constructor for LanguageStringWithLabelElement.</p>
*
LanguageString languageString, int style) {
this(formFactory, parentElement, labelString, languageString, null, style);
}
-
+
/**
* <p>Constructor for LanguageStringWithLabelElement.</p>
*
protected LanguageStringWithLabelElement(CdmFormFactory formFactory,
ICdmFormElement parentElement, String labelString,
LanguageString languageString, Integer height, int style) {
- super(formFactory, parentElement, labelString, null, height, style);
-
- setLanguageString(languageString);
+ this(formFactory, parentElement, labelString, languageString, height, true, style);
}
-
+
+ protected LanguageStringWithLabelElement(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, String labelString,
+ LanguageString languageString, Integer height, boolean isMultiLine, int style) {
+ super(formFactory, parentElement, labelString, null, height, isMultiLine, style);
+
+ setLanguageString(languageString);
+
+ }
+
/**
* <p>Getter for the field <code>languageString</code>.</p>
*
public LanguageString getLanguageString() {
return languageString;
}
-
+
/** {@inheritDoc} */
@Override
public void modifyText(ModifyEvent e) {
if(languageString == null){
languageString = LanguageString.NewInstance("", CdmStore.getDefaultLanguage());
}
-
+
languageString.setText(text.getText());
super.modifyText(e);
}
-
+
/** {@inheritDoc} */
@Override
public void setText(String text) {
element_languageString = this.formFactory
.createLanguageStringWithLabelElement(formElement, labelString,
- null, textHeight, style);
+ null, textHeight, true, style);
if (PreferencesUtil.isMultilanguageTextEditingCapability()) {
createMultilanguageTextEditingElements(formElement,
public void setEntity(Media entity) {
super.setEntity(entity);
if(singleMediaRepresentationPart==null){
- singleMediaRepresentationPart = MediaUtils.initFirstMediaRepresentationPart(entity);
+ singleMediaRepresentationPart = MediaUtils.initFirstMediaRepresentationPart(entity, true);
}
initIsAdvancedMediaView();
showAdvancedView();
-
}
/* (non-Javadoc)
public void createControls(ICdmFormElement element, int style) {
text_title = formFactory.createLanguageStringWithLabelElement(element, "Title", null, style);
selection_artist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), element, "Artist", null, EntitySelectionElement.ALL, style);
- text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, style);
+ text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, true, style);
mediaDetailElement = formFactory.createMediaDetailElement(element);
}
public class DerivedUnitBaseDetailElement extends
AbstractCdmDetailElement<DerivedUnitFacade> {
- private TextWithLabelElement textOriginalLabelData;
-
private TextWithLabelElement text_derivedUnitDefinitions;
private TextWithLabelElement text_barcode;
// "Specimen Definition",
// facade.getDerivedUnitDefinition(CdmStore.getDefaultLanguage()),
// style);
- //FIXME map original label data to corresponding model field
- //commented because we do not use this yet in the trunk
-// textOriginalLabelData = formFactory.createTextWithLabelElement(formElement, "Original Label Data", null, style);
text_barcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
text_catalogNumber = formFactory.createTextWithLabelElement(formElement, "Catalog Number", entity.getCatalogNumber(), style);
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.occurrence.Collection;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
toggleableText_titleCache = formFactory.createToggleableTextField(
formElement, "Title Cache", entity.getTitleCache(),
entity.isProtectedTitleCache(), style);
+ if((AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
+ combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
+ combo_specorobstype.setSelection(entity.getType());
+ selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
+ formElement, "Country",
+ entity.getCountry(), EntitySelectionElement.NOTHING, style);
+ languageText_locality = formFactory
+ .createLanguageStringWithLabelElement(formElement, "Locality",
+ entity.getLocality(), style);
+ element_point = formFactory.createPointElement(formElement,
+ entity.getExactLocation(), style);
+ element_elevation = formFactory.createGatheringEventUnitElement(
+ formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION, style);
- combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
- combo_specorobstype.setSelection(entity.getType());
- selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
- formElement, "Country",
- entity.getCountry(), EntitySelectionElement.NOTHING, style);
- languageText_locality = formFactory
- .createLanguageStringWithLabelElement(formElement, "Locality",
- entity.getLocality(), style);
- element_point = formFactory.createPointElement(formElement,
- entity.getExactLocation(), style);
- element_elevation = formFactory.createGatheringEventUnitElement(
- formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION, style);
-
- element_date = formFactory.createTimePeriodElement(formElement, "Date",
- entity.getGatheringPeriod(), style);
- selection_collector = formFactory
- .createSelectionElement(AgentBase.class,
- getConversationHolder(), formElement, "Collector",
- entity.getCollector(), EntitySelectionElement.ALL,
- style);
- text_collectingNumber = formFactory.createTextWithLabelElement(formElement,
- "Collecting number", entity.getFieldNumber(), style);
+ element_date = formFactory.createTimePeriodElement(formElement, "Date",
+ entity.getGatheringPeriod(), style);
+ selection_collector = formFactory
+ .createSelectionElement(AgentBase.class,
+ getConversationHolder(), formElement, "Collector",
+ entity.getCollector(), EntitySelectionElement.ALL,
+ style);
+ text_collectingNumber = formFactory.createTextWithLabelElement(formElement,
+ "Collecting number", entity.getFieldNumber(), style);
+ }
+ else{
+ toggleableText_titleCache.setEnabled(false);
+ }
selection_collection = formFactory
.createSelectionElement(Collection.class,
getConversationHolder(), formElement, "Collection",
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.PointElement;
private ToggleableTextElement toggleableText_titleCache;
private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
private EntitySelectionElement<NamedArea> selection_country;
+ private CollectingAreasDetailSection section_collectingAreas;
private LanguageStringWithLabelElement languageText_locality;
private PointElement element_point;
private NumberWithLabelElement number_elevation;
combo_specorobstype.setSelection(entity.getType());
selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement,
"Country", entity.getCountry(), EntitySelectionElement.NOTHING, style);
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+ section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+ section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ section_collectingAreas.setEntity(entity);
+ }
+
languageText_locality = formFactory.createLanguageStringWithLabelElement(formElement, "Locality",
entity.getLocality(), style);
element_point = formFactory.createPointElement(formElement, entity.getExactLocation(), style);
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
private GatheringEventUnitElement element_elevation;
private GatheringEventUnitElement element_distToGround;
-
+
private GatheringEventUnitElement element_distToWater;
-
+
private TextWithLabelElement text_collectingMethod;
private TextWithLabelElement text_gatheringEventDescription;
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-
-
- // collectingArea
-
-
- text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
+ text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
- // exactLocation
text_gatheringEventDescription = formFactory.createTextWithLabelElement(
formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style);
-// element_elevation = formFactory.createGatheringEventUnitElement(
-// formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION, style);
-
-
+
element_distToGround = formFactory.createGatheringEventUnitElement(
formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND, style);
-
+
element_distToWater = formFactory.createGatheringEventUnitElement(
formElement, "Dist. To Watersurface : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER, style);
-
- section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
- section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- section_collectingAreas.setEntity(entity);
+
+
+ if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+ section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+ section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ section_collectingAreas.setEntity(entity);
+ }
}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.ui.section.occurrence.association;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IParameter;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.Parameterization;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author pplitzner
+ * @date Dec 1, 2014
+ *
+ */
+public class TaxonAssociationDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> implements IDoubleClickListener{
+
+
+ private TableViewer associationsViewer;
+ private TableViewer typeDesignationViewer;
+
+ public TaxonAssociationDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+
+ //TODO add context menu for deleting associations
+
+ Label associationsLabel = formFactory.createLabel(getLayoutComposite(), "Individuals Associations");
+ associationsLabel.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+
+ associationsViewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
+ associationsViewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ associationsViewer.setContentProvider(new ArrayContentProvider());
+ Collection<TaxonBase<?>> associatedTaxa = CdmStore.getService(IOccurrenceService.class).listAssociatedTaxa(entity.innerDerivedUnit(), null, null, null, null);
+ associationsViewer.setInput(associatedTaxa);
+ associationsViewer.addDoubleClickListener(this);
+
+ Label typeLabel = formFactory.createLabel(getLayoutComposite(), "Type Designations");
+ typeLabel.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+
+ typeDesignationViewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
+ typeDesignationViewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ typeDesignationViewer.setContentProvider(new ArrayContentProvider());
+ Collection<TaxonBase<?>> typedTaxa = CdmStore.getService(IOccurrenceService.class).listTypedTaxa(entity.innerDerivedUnit(), null, null, null, null);
+ typeDesignationViewer.setInput(typedTaxa);
+ typeDesignationViewer.addDoubleClickListener(this);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void handleEvent(Object eventSource) {
+ //empty
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ */
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ if(associationsViewer.getSelection() instanceof IStructuredSelection){
+ Object firstElement = ((IStructuredSelection) associationsViewer.getSelection()).getFirstElement();
+ if(firstElement instanceof TaxonBase<?>){
+ TaxonBase<?> taxonBase = (TaxonBase<?>)firstElement;
+ String commandId = "eu.etaxonomy.taxeditor.editor.openTaxonEditor";
+
+
+ ArrayList parameters = new ArrayList();
+ IParameter iparam = null;
+
+ //get the command from plugin.xml
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ ICommandService cmdService = (ICommandService)window.getService(ICommandService.class);
+ Command cmd = cmdService.getCommand(commandId);
+
+ //get the parameter
+ try {
+ iparam = cmd.getParameter("eu.etaxonomy.taxeditor.editor.taxonParameter");
+ } catch (NotDefinedException e1) {
+ MessagingUtils.error(this.getClass(), "Command not defined", e1);
+ }
+ Parameterization params = new Parameterization(iparam, (taxonBase).getUuid().toString());
+ parameters.add(params);
+
+ //build the parameterized command
+ ParameterizedCommand pc = new ParameterizedCommand(cmd, (Parameterization[]) parameters.toArray(new Parameterization[parameters.size()]));
+
+ //execute the command
+ IHandlerService handlerService = (IHandlerService)window.getService(IHandlerService.class);
+ try {
+ handlerService.executeCommand(pc, null);
+ } catch (ExecutionException e) {
+ MessagingUtils.error(TaxonAssociationDetailElement.class, e);
+ } catch (NotDefinedException e) {
+ MessagingUtils.error(TaxonAssociationDetailElement.class, e);
+ } catch (NotEnabledException e) {
+ MessagingUtils.error(TaxonAssociationDetailElement.class, e);
+ } catch (NotHandledException e) {
+ MessagingUtils.error(TaxonAssociationDetailElement.class, e);
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.occurrence.association;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+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.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ *
+ * @author pplitzner
+ * @date Dec 1, 2014
+ *
+ */
+public class TaxonAssociationDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+ public TaxonAssociationDetailSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public String getHeading() {
+ return "Taxon Associations";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+ */
+ @Override
+ protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+ return formFactory.createTaxonAssociationDetailElement(parentElement);
+ }
+}
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.common.TimePeriod;
import eu.etaxonomy.cdm.model.molecular.Amplification;
-import eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent;
+import eu.etaxonomy.cdm.model.molecular.Primer;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
*/
public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<Amplification> {
- private TextWithLabelElement textDescription;
+ private TextWithLabelElement textDesignation;
+ private TextWithLabelElement textNotes;
private TermComboElement<DefinedTerm> comboMarker;
private TimePeriodElement dateAmplification;
+ private EntitySelectionElement<Institution> selectionInstitution;
private EntitySelectionElement<AgentBase> selectionAmplificationStaff;
- private CheckboxElement checkBoxAmplificationSuccess;
- private TextWithLabelElement textAmplificationSuccessDetails;
- private TermComboElement<DefinedTerm> comboAmplificationMaterialOrMethod;
-
- private NumberWithLabelElement numberGelVoltage;
- private NumberWithLabelElement numberGelConcentration;
- private NumberWithLabelElement numberGelRunningTime;
- private TextWithLabelElement textLadderUsed;
-
- private TermComboElement<DefinedTerm> comboPurificationMaterialOrMethod;
-
+ private EntitySelectionElement<Primer> selectionPrimerFW;
+ private EntitySelectionElement<Primer> selectionPrimerRW;
/**
* @param formFactory
*/
@Override
protected void createControls(ICdmFormElement formElement, Amplification entity, int style) {
- textDescription = formFactory.createTextWithLabelElement(formElement, "Description", entity.getDescription(), style);
+ textDesignation = formFactory.createTextWithLabelElement(formElement, "Designation", entity.getDescription(), style);
+ textDesignation.setEnabled(false);
+ //TODO institution
+// selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", entity.getInstitution(), EntitySelectionElement.ALL, style);
+ selectionAmplificationStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Amplification staff", entity.getActor(), EntitySelectionElement.ALL, style);
+ dateAmplification = formFactory.createTimePeriodElement(formElement, "Date", entity.getTimeperiod(), style);
comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
-// dateAmplification = formFactory.createTimePeriodElement(formElement, "Amplification Date", entity.getTimeperiod(), style);
-// selectionAmplificationStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Amplification staff", entity.getActor(), EntitySelectionElement.ALL, style);
-// checkBoxAmplificationSuccess = formFactory.createCheckbox(formElement, "Amplification Success", entity.getSuccessful(), style);
-// textAmplificationSuccessDetails = formFactory.createTextWithLabelElement(formElement, "Ampl. Success Details", entity.getSuccessText(), style);
-// comboAmplificationMaterialOrMethod = formFactory.createTermComboElement(DefinedTerm.class, formElement, "Ampl. Mat. & Meth.", entity.get, style)
-// numberGelVoltage = formFactory.createNumberTextWithLabelElement(formElement, "Gel Voltage (V)", entity.getElectrophoresisVoltage(), style);
-// numberGelConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Gel Concentration", entity.getGelConcentration(), style);
-// numberGelRunningTime = formFactory.createNumberTextWithLabelElement(formElement, "Gel Ruinning Time (Min)", entity.getGelRunningTime(), style);
-// textLadderUsed = formFactory.createTextWithLabelElement(formElement, "Ladder Used", entity.getLadderUsed(), style);
- comboPurificationMaterialOrMethod = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Purification Mat. & Meth.",
- entity.getPurification()==null?null:entity.getPurification().getDefinedMaterialOrMethod(), style);
+ selectionPrimerFW = formFactory.createSelectionElement(Primer.class, getConversationHolder(), formElement, "Primer FW", entity.getForwardPrimer(), EntitySelectionElement.ALL, style);
+ selectionPrimerRW = formFactory.createSelectionElement(Primer.class, getConversationHolder(), formElement, "Primer RW", entity.getReversePrimer(), EntitySelectionElement.ALL, style);
+
+ AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, style);
+ annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ annotationSection.setEntity(entity);
+
+ updateDesignationText();
+ }
+
+ private void updateDesignationText(){
+ String institutionName = "";
+ String staffName = "";
+ String dnaMarkerString = "";
+ String dateString = "";
+
+ //retrieve data
+ //TODO institution
+// Institution selection = selectionInstitution.getSelection();
+// if(selection!=null){
+// institutionName = selection.getName();
+// }
+ AgentBase staff = selectionAmplificationStaff.getSelection();
+ if(staff!=null){
+ staffName = staff.getTitleCache();
+ }
+ DefinedTerm dnaMarker = comboMarker.getSelection();
+ if(dnaMarker!=null){
+ dnaMarkerString = dnaMarker.generateTitle();
+ }
+ TimePeriod timePeriod = dateAmplification.getTimePeriod();
+ if(timePeriod!=null){
+ dateString = timePeriod.toString()!=null?timePeriod.toString():"";
+ }
+
+ //assemble string
+ String designation = "";
+ if(!institutionName.equals("")){
+ designation += institutionName;
+ }
+ if(!staffName.equals("")){
+ if(!designation.equals("")){
+ designation += "_";
+ }
+ designation += staffName;
+ }
+ if(!dnaMarkerString.equals("")){
+ if(!designation.equals("")){
+ designation += "_";
+ }
+ designation += dnaMarkerString;
+ }
+ if(!dateString.equals("")){
+ if(!designation.equals("")){
+ designation += "_";
+ }
+ designation += dateString;
+ }
+ textDesignation.setText(designation);
+ getEntity().setDescription(designation);
}
/*
*/
@Override
public void handleEvent(Object eventSource) {
- if(eventSource==textDescription){
- getEntity().setDescription(textDescription.getText());
+ if(eventSource==textNotes){
+ getEntity().setDescription(textNotes.getText());
}
else if(eventSource==comboMarker){
getEntity().setDnaMarker(comboMarker.getSelection());
+ updateDesignationText();
}
else if(eventSource==dateAmplification){
getEntity().setTimeperiod(dateAmplification.getTimePeriod());
+ updateDesignationText();
}
else if(eventSource==selectionAmplificationStaff){
getEntity().setActor(selectionAmplificationStaff.getEntity());
+ updateDesignationText();
}
- else if(eventSource==checkBoxAmplificationSuccess){
- getEntity().setSuccessful(checkBoxAmplificationSuccess.getSelection());
+ else if(eventSource==selectionInstitution){
+ //TODO institution
+// getEntity().setInstitution(selectionInstitution.getSelection());
+ updateDesignationText();
}
- else if(eventSource==textAmplificationSuccessDetails){
- getEntity().setSuccessText(textAmplificationSuccessDetails.getText());
+ else if(eventSource==selectionPrimerFW){
+ getEntity().setForwardPrimer(selectionPrimerFW.getSelection());
}
- else if(eventSource==comboAmplificationMaterialOrMethod){
-
- }
- else if(eventSource==numberGelVoltage){
- getEntity().setElectrophoresisVoltage(numberGelVoltage.getDouble());
- }
- else if(eventSource==numberGelConcentration){
- getEntity().setGelConcentration(numberGelConcentration.getDouble());
- }
- else if(eventSource==numberGelRunningTime){
- getEntity().setGelRunningTime(numberGelRunningTime.getDouble());
- }
- else if(eventSource==textLadderUsed){
- getEntity().setLadderUsed(textLadderUsed.getText());
- }
- else if(eventSource==comboPurificationMaterialOrMethod){
- MaterialOrMethodEvent purification = getEntity().getPurification();
- if(purification==null){
- purification = MaterialOrMethodEvent.NewInstance();
- getEntity().setPurification(purification);
- }
- purification.setDefinedMaterialOrMethod(comboPurificationMaterialOrMethod.getSelection());
+ else if(eventSource==selectionPrimerRW){
+ getEntity().setReversePrimer(selectionPrimerRW.getSelection());
}
}
}
\ No newline at end of file
import org.joda.time.DateTime;
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.common.OrderedTerm;
+import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.molecular.DnaQuality;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
*/
public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample> {
- //TODO: add vocabulary
-// private final TermType qualityTermVocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.DnaQualityTerm.getUuid());
-
private TextWithLabelElement textPurificationMethod;
private NumberWithLabelElement numberRatioOfAbsorbance260_280;
private NumberWithLabelElement numberRatioOfAbsorbance260_230;
private NumberWithLabelElement numberConcentration;
- private TermComboElement<DefinedTerm> comboQualityTerm;
+ private TermComboElement<OrderedTerm> comboQualityTerm;
private DateElement dateQualityCheck;
/**
Double ratioOfAbsorbance260_230 = dnaQuality.getRatioOfAbsorbance260_230();
Double ratioOfAbsorbance260_280 = dnaQuality.getRatioOfAbsorbance260_280();
Double concentration = dnaQuality.getConcentration();
- DefinedTerm qualityTerm = dnaQuality.getQualityTerm();
+ OrderedTerm qualityTerm = dnaQuality.getQualityTerm();
-// textPurificationMethod = formFactory.createTextWithLabelElement(formElement, "Purification Method", dnaQuality.getPurificationMethod(), style);
+ textPurificationMethod = formFactory.createTextWithLabelElement(formElement, "DNA Purification Details", dnaQuality.getPurificationMethod(), style);
numberRatioOfAbsorbance260_280 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-280", ratioOfAbsorbance260_280, style);
numberRatioOfAbsorbance260_230 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-230", ratioOfAbsorbance260_230, style);
numberConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Concentration", concentration, style);
-// comboQualityTerm = formFactory.createDefinedTermComboElement(qualityTermVocabulary, formElement, "Quality Term", qualityTerm, style);
+ comboQualityTerm = formFactory.createDefinedTermComboElement(TermType.DnaQualityType, formElement, "Quality Term", qualityTerm, style);
dateQualityCheck = formFactory.createDateElement(formElement, "Quality Check", dnaQuality.getQualityCheckDate(), style);
}
public void handleEvent(Object eventSource) {
DnaQuality dnaQuality = getEntity().getDnaQuality();
if(eventSource==textPurificationMethod){
- //TODO
-// dnaQuality.setPurificationMethod(textPurificationMethod.getText());
+ dnaQuality.setPurificationMethod(textPurificationMethod.getText());
}
else if(eventSource==numberRatioOfAbsorbance260_230){
dnaQuality.setRatioOfAbsorbance260_230(numberRatioOfAbsorbance260_230.getDouble());
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TimePeriod;
*/
public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaSample> {
+ private EntitySelectionElement<Institution> selectionInstitution;
+ private EntitySelectionElement<AgentBase> selectionStaff;
private TimePeriodElement datePreservationDate;
- private EntitySelectionElement<AgentBase> selectionPreparedBy;
private NumberWithLabelElement numberPreservationTemperature;
private TermComboElement<DefinedTerm> comboMaterialOrMethods;
private TextWithLabelElement textBarcode;
*/
@Override
protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
- TimePeriod timePeriod = null;
- AgentBase<?> actor = null;
+ Institution institution = null;
+ AgentBase<?> staff = null;
+ TimePeriod preparationDate = null;
+ if(entity.getDerivedFrom()!=null){
+// institution = entity.getDerivedFrom().getInstitution();
+ staff = entity.getDerivedFrom().getActor();
+ preparationDate = entity.getDerivedFrom().getTimeperiod();
+ }
+
Double temperature = null;
DefinedTerm definedMaterialOrMethod = null;
if(entity.getPreservation()!=null){
- timePeriod= entity.getPreservation().getTimeperiod();
- actor = entity.getPreservation().getActor();
temperature = entity.getPreservation().getTemperature();
definedMaterialOrMethod = entity.getPreservation().getDefinedMaterialOrMethod();
}
- datePreservationDate = formFactory.createTimePeriodElement(formElement, "Preservation date", timePeriod, style);
- selectionPreparedBy = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared by", actor, EntitySelectionElement.ALL, style);
+ //TODO institution
+// selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", staff, EntitySelectionElement.ALL, style);
+ selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL, style);
+ datePreservationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
comboMaterialOrMethods = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Materials & Methods", definedMaterialOrMethod, style);
- //TODO preparation date
- //TODO sample type
textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
}
if(eventSource==datePreservationDate){
addPreservationMethod().setTimeperiod(datePreservationDate.getTimePeriod());
}
- else if(eventSource==selectionPreparedBy){
- addPreservationMethod().setActor(selectionPreparedBy.getSelection());
+ else if(eventSource==selectionStaff){
+ addPreservationMethod().setActor(selectionStaff.getSelection());
}
else if(eventSource==numberPreservationTemperature){
addPreservationMethod().setTemperature(numberPreservationTemperature.getDouble());
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
+import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.molecular.Primer;
import eu.etaxonomy.cdm.model.molecular.SequenceString;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
private TextWithLabelElement textPrimerName;
- //TODO we are using a basic text field which is backed up by a Sequence object modelwise.
+ // we are using a basic text field which is backed up by a Sequence object modelwise.
// This is a bit of a overhead as we may just need the sequence string. This may change in future in both directions:
// either extending this view to support the remaining fields of Sequence or by switching to the more basic SequenceString model element
private TextWithLabelElement textPrimerSequence;
+ private TermComboElement<DefinedTerm> comboMarker;
private EntitySelectionElement<Reference> selectionReference;
/**
}
textPrimerSequence = formFactory.createTextWithLabelElement(formElement, "Primer seq. 5'->3'", sequenceString, style);
+ //TODO dnaMarker
+// comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
+
selectionReference = formFactory
.createSelectionElement(Reference.class,
getConversationHolder(), formElement, "Reference",
entity.getPublishedIn(),
EntitySelectionElement.ALL, style);
+
+ AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, style);
+ annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ annotationSection.setEntity(entity);
}
/*
if(eventSource==textPrimerName){
getEntity().setLabel(textPrimerName.getText());
}
+ else if(eventSource==comboMarker){
+ //TODO dnaMarker
+// getEntity().setDnaMarker(comboMarker.getSelection());
+ }
else if(eventSource==textPrimerSequence){
SequenceString sequenceString = getEntity().getSequence();
if(sequenceString==null){
private TermComboElement<DefinedTerm> comboMarker;
private TextWithLabelElement textConsensusSequence;
private NumberWithLabelElement textConsensusSequenceLength;
- private TextWithLabelElement textBarcodeSequence;
private TextWithLabelElement textGeneticAccessNo;
private UriWithLabelElement textNCBIUri;
private UriWithLabelElement textENAUri;
@Override
protected void createControls(ICdmFormElement formElement, Sequence entity, int style) {
comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
-// textConsensusSequence = formFactory.createTextWithLabelElement(formElement, "Consensus Sequence 5'->3'", entity.getConsensusSequence().getString(), style);
-// textConsensusSequenceLength = formFactory.createNumberTextWithLabelElement(formElement, "Consensus Seq. Length", entity.getConsensusSequence().getLength(), style);
-// ((Text) textConsensusSequenceLength.getMainControl()).setEditable(false);
- textBarcodeSequence = formFactory.createTextWithLabelElement(formElement, "Barcode Sequence 5'->3'", entity.getBarcodeSequencePart()==null?"":entity.getBarcodeSequencePart().getString(), style);
+ textConsensusSequence = formFactory.createTextWithLabelElement(formElement, "Consensus Sequence 5'->3'", entity.getConsensusSequence().getString(), style);
URI genBankUri = null;
URI emblUri = null;
getEntity().setConsensusSequence(consensusSequence);
textConsensusSequenceLength.setNumber(consensusSequence.getLength());
}
- else if(eventSource==textBarcodeSequence){
- SequenceString barcodeSequencePart = getEntity().getBarcodeSequencePart();
- if(barcodeSequencePart==null){
- barcodeSequencePart = SequenceString.NewInstance();
- }
- barcodeSequencePart.setString(textBarcodeSequence.getText());
- getEntity().setBarcodeSequencePart(barcodeSequencePart);
- }
else if(eventSource==textGeneticAccessNo){
textGeneticAccessNo.setBackground(getPersistentBackground());
getEntity().setGeneticAccessionNumber(textGeneticAccessNo.getText());
import eu.etaxonomy.cdm.model.molecular.SingleRead;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
protected void createControls(ICdmFormElement formElement, SingleRead entity, int style) {
selectionPrimer = formFactory.createSelectionElement(Primer.class, getConversationHolder(), formElement, "Primer", entity.getPrimer(), EntitySelectionElement.ALL, style);
selectionAmplification = formFactory.createSelectionElement(Amplification.class, getConversationHolder(), formElement, "Amplification", entity.getAmplification(), EntitySelectionElement.ALL, style);
+
+ AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, style);
+ annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ annotationSection.setEntity(entity);
}
/*
static private final Logger logger = Logger.getLogger(TissueSampleGeneralDetailElement.class);
private TermComboElement<DefinedTerm> comboKindOfTissue;
+ private EntitySelectionElement<AgentBase> selectionInstitution;
+ private EntitySelectionElement<AgentBase> selectionStaff;
private TimePeriodElement datePreparation;
- private EntitySelectionElement<AgentBase> selectionPreparedBy;
private TermComboElement<DefinedTerm> comboPreservationMedium;
- private TimePeriodElement datePreservation;
private EntitySelectionElement<Collection> selectionCollection;
private TextWithLabelElement textAccessionNumber;
private TextWithLabelElement textBarcode;
protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
//TODO handle all parameters here and in handleEvent()
comboKindOfTissue = formFactory.createDefinedTermComboElement(TermType.KindOfUnit, formElement, "Kind Of Tissue", entity.getKindOfUnit(), style);
-
- TimePeriod preservationDate = null;
+ //TODO: institute
+ TimePeriod preparationDate = null;
DefinedTerm preservationMedium = null;
-// TimePeriod preparationDate = null;
-// AgentBase preparedBy = null;
+ AgentBase<?> staff = null;
+ if(entity.getDerivedFrom()!=null){
+ staff = entity.getDerivedFrom().getActor();
+ preparationDate = entity.getDerivedFrom().getTimeperiod();
+ }
if(entity.getPreservation()!=null){
- preservationDate = entity.getPreservation().getTimeperiod();
preservationMedium = entity.getPreservation().getMedium();
}
-// datePreparation = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
-// selectionPreparedBy = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared By", preparedBy, EntitySelectionElement.ALL, style);
+ selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL,style);
+ datePreparation = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
comboPreservationMedium = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Preservation medium", preservationMedium, style);
- datePreservation = formFactory.createTimePeriodElement(formElement, "Preservation date", preservationDate, style);
selectionCollection = formFactory.createSelectionElement(Collection.class, getConversationHolder(), formElement, "Collection", entity.getCollection(), EntitySelectionElement.ALL, style);
textAccessionNumber = formFactory.createTextWithLabelElement(formElement, "Accession Number", entity.getAccessionNumber(), style);
textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
*/
@Override
public void handleEvent(Object eventSource) {
+ //TODO: institute
if(eventSource==comboKindOfTissue) {
getEntity().setKindOfUnit(comboKindOfTissue.getSelection());
}
- else if(eventSource==selectionPreparedBy) {
- addPreservationMethod().setActor(selectionPreparedBy.getSelection());
- }
else if(eventSource==comboPreservationMedium) {
addPreservationMethod().setMedium(comboPreservationMedium.getSelection());
}
- else if (eventSource==datePreservation) {
- addPreservationMethod().setTimeperiod(datePreservation.getTimePeriod());
- }
else if(eventSource==selectionCollection){
getEntity().setCollection(selectionCollection.getSelection());
}
else if(eventSource==textBarcode){
getEntity().setBarcode(textBarcode.getText());
}
+ else if(eventSource==datePreparation){
+ if(getEntity().getDerivedFrom()!=null){
+ getEntity().getDerivedFrom().setTimeperiod(datePreparation.getTimePeriod());
+ }
+ }
+ else if(eventSource==selectionStaff){
+ if(getEntity().getDerivedFrom()!=null){
+ getEntity().getDerivedFrom().setActor(selectionStaff.getSelection());
+ }
+ }
}
private PreservationMethod addPreservationMethod(){
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-
-/**
- * @author pplitzner
- * @date 16.12.2013
- *
- */
-public class LivingPlantPhotoGeneralDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
-
- /**
- * @param formFactory
- * @param formElement
- */
- public LivingPlantPhotoGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
- super(formFactory, formElement);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */
- @Override
- protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
- @Override
- public void handleEvent(Object eventSource) {
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-
-/**
- * @author pplitzner
- * @date 12.12.2013
- *
- */
-public class LivingPlantPhotoGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> {
-
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
- public LivingPlantPhotoGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
- ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- @Override
- public String getHeading() {
- return "General";
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
- @Override
- protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
- return formFactory.createLivingPlantPhotoGeneralDetailElement(parentElement);
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-
-/**
- * @author pplitzner
- * @date 16.12.2013
- *
- */
-public class SpecimenScanGeneralDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
-
- /**
- * @param formFactory
- * @param formElement
- */
- public SpecimenScanGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
- super(formFactory, formElement);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */
- @Override
- protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
- @Override
- public void handleEvent(Object eventSource) {
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-
-/**
- * @author pplitzner
- * @date 12.12.2013
- *
- */
-public class SpecimenScanGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> {
-
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
- public SpecimenScanGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
- ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- @Override
- public String getHeading() {
- return "General";
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
- @Override
- protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
- return formFactory.createSpecimenScanGeneralDetailElement(parentElement);
- }
-}
import eu.etaxonomy.taxeditor.newWizard.AmplificationCloningWizardPage;
import eu.etaxonomy.taxeditor.newWizard.AmplificationGelPhotoWizardPage;
import eu.etaxonomy.taxeditor.newWizard.AmplificationGeneralWizardPage;
-import eu.etaxonomy.taxeditor.newWizard.AmplificationPrimerWizardPage;
import eu.etaxonomy.taxeditor.newWizard.PrimerWizardPage;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
addPage(new AmplificationGeneralWizardPage(formFactory,
selectionElement.getConversationHolder(),
(Amplification) entity));
- addPage(new AmplificationPrimerWizardPage(formFactory,
- selectionElement.getConversationHolder(),
- (Amplification) entity));
addPage(new AmplificationCloningWizardPage(formFactory,
selectionElement.getConversationHolder(),
(Amplification) entity));
LanguageString preferredLanguageString = MultilanguageTextHelper.getPreferredLanguageString(multilanguageText, getLanguages());
- text_source = formFactory.createLanguageStringWithLabelElement(element, null, preferredLanguageString, TEXT_HEIGHT, SWT.NULL);
+ text_source = formFactory.createLanguageStringWithLabelElement(element, null, preferredLanguageString, TEXT_HEIGHT, true, SWT.NULL);
// text_source.setEnabled(false);
}
});
- text_target = formFactory.createLanguageStringWithLabelElement(element, null, null, TEXT_HEIGHT, SWT.NULL);
+ text_target = formFactory.createLanguageStringWithLabelElement(element, null, null, TEXT_HEIGHT, true, SWT.NULL);
//
// The automated translation did rely on the Google Translate API. Unfortunately this service is not free anymore.
private static DefinedTerm detailImageTerm = null;
private static DefinedTerm sampleDesignationTerm = null;
+ //FIXME: move static term getters to new singleton utility class
private static void initializeTerms() {
List<DefinedTerm> preferredTerms = CdmStore.getTermManager().getPreferredTerms(DefinedTerm.class);
for (DefinedTerm definedTerm : preferredTerms) {
this.conversation = conversation;
}
- /**
- *
- * @param derivate
- * @return
- */
public String getDerivateText(Object element){
+ return getDerivateText(element, conversation);
+ }
+
+ public static String getDerivateText(Object element, ConversationHolder conversation){
//TODO: use list of strings to assemble labels to avoid adding the separator every time and to allow null values
TreeNode parentNode = null;
TreeNode node = null;
label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
}
label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+separator:emptyString;
+ label += mediaSpecimen.getBarcode()!=null?mediaSpecimen.getBarcode()+separator:emptyString;
}
//TissueSample + DnaSample
else if(derivate instanceof DnaSample){
label += NO_SAMPLE_DESIGNATION+separator;
}
label += singleRead.getPrimer()!=null?singleRead.getPrimer().getLabel()+separator:emptyString;
- if(sequence!=null){
- label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():emptyString;
+ if(sequence!=null && sequence.getDnaMarker()!=null){
+ label += sequence.getDnaMarker()+separator;
+ }
+ if(singleRead.getAmplification()!=null && singleRead.getAmplification().getDescription()!=null){
+ label += singleRead.getAmplification().getDescription()+separator;
}
}
}
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.wb.swt.ResourceManager;
/**
* The widgets of the {@link DerivateSearchView}<br>
private final Combo comboDerivateType;
private final Button buttonSearch;
private final Button btnFilterUndeterminedSpecimen;
+ private final Text textTaxonName;
+ private final Button btnBrowseTaxa;
+ private final Label lblTaxon;
+ private final Label lblDerivateType;
+ private final Button btnClearTaxon;
/**
* Create the composite.
*/
public DerivateSearchComposite(Composite parent, int style) {
super(parent, style);
- setLayout(new GridLayout(6, false));
+ setLayout(new GridLayout(4, false));
- Label lblDerivateType = new Label(this, SWT.NULL);
- lblDerivateType.setText("Derivate Filter");
+ lblTaxon = new Label(this, SWT.NONE);
+ lblTaxon.setText("Taxon");
+
+ textTaxonName = formToolkit.createText(this, "New Text", SWT.NONE);
+ textTaxonName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ textTaxonName.setEnabled(false);
+ textTaxonName.setText("");
+
+ btnBrowseTaxa = formToolkit.createButton(this, "", SWT.NONE);
+ btnBrowseTaxa.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
+
+ btnClearTaxon = formToolkit.createButton(this, "", SWT.NONE);
+ btnClearTaxon.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+ btnClearTaxon.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+
+ lblDerivateType = new Label(this, SWT.NULL);
+ lblDerivateType.setText("Derivate Type");
comboDerivateType = new Combo(this, SWT.READ_ONLY);
- comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
formToolkit.paintBordersFor(comboDerivateType);
btnFilterUndeterminedSpecimen = new Button(this, SWT.CHECK);
- btnFilterUndeterminedSpecimen.setText("Only undetermined specimen");
- btnFilterUndeterminedSpecimen.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- new Label(this, SWT.NONE);
- new Label(this, SWT.NONE);
- new Label(this, SWT.NONE);
-
- searchField = formToolkit.createText(this, "New Text", SWT.NONE);
- searchField.setText("");
- searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
-
- buttonSearch = new Button(this, SWT.NONE);
- buttonSearch.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
- formToolkit.adapt(buttonSearch, true, true);
- buttonSearch.setText("Search");
- new Label(this, SWT.NONE);
- new Label(this, SWT.NONE);
- new Label(this, SWT.NONE);
-
- resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
- table = resultViewer.getTable();
- table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 6, 4));
+ btnFilterUndeterminedSpecimen.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+ btnFilterUndeterminedSpecimen.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ }
+ });
+ btnFilterUndeterminedSpecimen.setText("Determined");
+
+ buttonSearch = new Button(this, SWT.NONE);
+ formToolkit.adapt(buttonSearch, true, true);
+ buttonSearch.setText("Search");
+
+ searchField = formToolkit.createText(this, "New Text", SWT.NONE);
+ searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ searchField.setText("");
+ new Label(this, SWT.NONE);
+ new Label(this, SWT.NONE);
+
+ resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
+ table = resultViewer.getTable();
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
}
comboDerivateType.setEnabled(enabled);
buttonSearch.setEnabled(enabled);
btnFilterUndeterminedSpecimen.setEnabled(enabled);
+ btnBrowseTaxa.setEnabled(enabled);
+ lblTaxon.setEnabled(enabled);
+ lblDerivateType.setEnabled(enabled);
}
public Button getBtnFilterUndeterminedSpecimen() {
return btnFilterUndeterminedSpecimen;
}
+ public Button getBtnBrowseTaxa() {
+ return btnBrowseTaxa;
+ }
+ public Text getTextTaxonName() {
+ return textTaxonName;
+ }
+ public Button getBtnClearTaxon() {
+ return btnClearTaxon;
+ }
}
package eu.etaxonomy.taxeditor.view.derivateSearch;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import eu.etaxonomy.cdm.api.service.config.IdentifiableServiceConfiguratorImpl;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
import eu.etaxonomy.taxeditor.ui.mvc.combo.EnumTermComboController;
/**
private EnumTermComboController<SpecimenOrObservationType> enumTermComboController;
private final DerivateSearchView derivateSearchView;
private DerivateLabelProvider labelProvider;
+ private Taxon selectedTaxon;
+
/**
* @param parent
* @param derivateSearchView
}
private void init(){
- LinkedHashMap<SpecimenOrObservationType, String> orderedTerms = AbstractUtility.orderTerms(Arrays.asList(SpecimenOrObservationType.values()));
- String[] comboItems = new String[orderedTerms.size()];
- int count = 0;
- for(String termMessage:orderedTerms.values()){
- comboItems[count] = termMessage;
- count++;
- }
-
+ //derivate type combo
enumTermComboController = new EnumTermComboController<SpecimenOrObservationType>(derivateSearchComposite.getComboDerivateType(), null, null, SpecimenOrObservationType.class, 0);
enumTermComboController.setSelection(SpecimenOrObservationType.Unknown);
+ //add listeners
derivateSearchComposite.getSearchField().addListener(SWT.KeyDown, this);
derivateSearchComposite.getButtonSearch().addListener(SWT.Selection, this);
+ derivateSearchComposite.getBtnBrowseTaxa().addListener(SWT.Selection, this);
+ derivateSearchComposite.getBtnClearTaxon().addListener(SWT.Selection, this);
+
+ //result table
TableViewer resultViewer = derivateSearchComposite.getResultViewer();
resultViewer.setContentProvider(new ArrayContentProvider());
labelProvider = new DerivateLabelProvider();
derivateSearchView.setFocus(); //rebind the conversation
}
+
+ List<SpecimenOrObservationBase<?>> filteredByAssociatedTaxon = null;
+ //filter by taxon
+ if(selectedTaxon!=null){
+ filteredByAssociatedTaxon = CdmStore.getService(IOccurrenceService.class).listByAssociatedTaxon(null, null, selectedTaxon, null, null, null, null, null);
+ }
+
+ //filter by specimen type
configurator.setTitleSearchString(derivateSearchComposite.getSearchField().getText());
SpecimenOrObservationType type = enumTermComboController.getSelection();
- //filter by specimen type
- List<SpecimenOrObservationBase> results = CdmStore.getSearchManager().findOccurrencesByType(configurator, type);
+ List<SpecimenOrObservationBase> filteredByType = new ArrayList<SpecimenOrObservationBase>();
+ if(filteredByAssociatedTaxon!=null){
+ for (SpecimenOrObservationBase specimenOrObservationBase : filteredByAssociatedTaxon) {
+ if(type.equals(SpecimenOrObservationType.Unknown) || specimenOrObservationBase.getRecordBasis().equals(type)){
+ filteredByType.add(specimenOrObservationBase);
+ }
+ }
+ }
+ else{
+ filteredByType = CdmStore.getSearchManager().findOccurrencesByType(configurator, type);
+ }
+
//filter out assigned specimens
if(derivateSearchComposite.getBtnFilterUndeterminedSpecimen().getSelection()){
List<SpecimenOrObservationBase> specimensWithNoDetermination = new ArrayList<SpecimenOrObservationBase>();
- for(SpecimenOrObservationBase<?> result:results){
+ for(SpecimenOrObservationBase<?> result:filteredByType){
if(CdmStore.getService(IOccurrenceService.class).countDeterminations(result, null)==0){
specimensWithNoDetermination.add(result);
}
}
- results = specimensWithNoDetermination;
+ filteredByType = specimensWithNoDetermination;
}
- derivateSearchComposite.getResultViewer().setInput(results);
+ derivateSearchComposite.getResultViewer().setInput(filteredByType);
}
/* (non-Javadoc)
|| (eventSource == derivateSearchComposite.getSearchField() && event.keyCode == SWT.CR)){
searchDerivates();
}
+ else if(eventSource==derivateSearchComposite.getBtnBrowseTaxa()){
+ selectedTaxon = SelectionDialogFactory.getSelectionFromDialog(Taxon.class, derivateSearchView.getSite().getShell(), derivateSearchView.getConversationHolder(), null);
+ if(selectedTaxon!=null){
+ derivateSearchComposite.getTextTaxonName().setText(selectedTaxon.getTitleCache());
+ }
+ }
+ else if(eventSource==derivateSearchComposite.getBtnClearTaxon()){
+ selectedTaxon = null;
+ derivateSearchComposite.getTextTaxonName().setText("");
+ }
}
/**
derivateSearchComposite.getSearchField().setText("");
enumTermComboController.setSelection(SpecimenOrObservationType.Unknown);
derivateSearchComposite.getComboDerivateType().deselectAll();
+ selectedTaxon = null;
}
public TableViewer getResultViewer() {
package eu.etaxonomy.taxeditor.view.derivateSearch;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.part.ViewPart;
derivateSearchCompositeController = new DerivateSearchCompositeController(parent, this);
getSite().setSelectionProvider(derivateSearchCompositeController.getResultViewer());
derivateSearchCompositeController.setEnabled(CdmStore.isActive());
+
+ //create context menu
+ MenuManager menuManager = new MenuManager();
+ getSite().registerContextMenu(menuManager, derivateSearchCompositeController.getResultViewer());
+ Control control = derivateSearchCompositeController.getResultViewer().getControl();
+ Menu menu = menuManager.createContextMenu(control);
+ control.setMenu(menu);
}
/* (non-Javadoc)
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoCollectionDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
//in future using only one class with different SpecimenOrObservationTypes is desired
// createTissueSampleSection(rootElement);
}
- else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
- createSpecimenScanSection(rootElement);
- }
- else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
- createLivingPlantPhotoSection(rootElement);
- }
- else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
- createMediaSpecimenSection(rootElement);
- }
else{
createDerivedUnitBaseElementSection(rootElement);
}
private void createDerivedUnitBaseElementSection(RootElement parent) {
destroySections();
- //different order of sections (Specimen Details as second section and expanded)
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
- DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(derivedUnitGeneralDetailSection);
+ DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(derivedUnitGeneralDetailSection);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- addPart(originalLabelDataSection);
+ DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(derivedUnitBaseDetailSection);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(derivedUnitBaseDetailSection);
+ OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(originalLabelDataSection);
+ //for editors working with facades
+ if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(gatheringEventDetailSection);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(fieldUnitDetailSection);
}
- else{
- DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(derivedUnitGeneralDetailSection);
+ if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- addPart(gatheringEventDetailSection);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- addPart(fieldUnitDetailSection);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- addPart(derivedUnitBaseDetailSection);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(determinationDetailSection);
}
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(taxonAssociationDetailSection);
+ }
}
}
}
- private void createPreservedSpecimenSpecimenSection(RootElement parent) {
- destroySections();
-
- PreservedSpecimenGeneralDetailSection section = formFactory.createPreservedSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- PreservedSpecimenDetailSection derivedUnitBaseDetailSection = formFactory.createPreservedSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- PreservedSpecimenDeterminationDetailSection determinationDetailSection = formFactory.createPreservedSpecimenDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-
- addPart(section);
- addPart(derivedUnitBaseDetailSection);
- addPart(determinationDetailSection);
- }
-
private void createTissueSampleSection(RootElement parent) {
destroySections();
addPart(pherogramSection);
}
- private void createSpecimenScanSection(RootElement parent) {
+ private void createMediaSpecimenSection(RootElement parent) {
destroySections();
- SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(section);
- }
-
- private void createLivingPlantPhotoSection(RootElement parent) {
- destroySections();
- LivingPlantPhotoGeneralDetailSection section = formFactory.createLivingPlantPhotoGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(generalSection);
- addPart(section);
- }
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- private void createMediaSpecimenSection(RootElement parent) {
- destroySections();
- MediaSpecimenGeneralDetailSection section = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ addPart(rightsSection);
- addPart(section);
}
*******************************************************************************/\r
package org.eclipse.wb.swt;
-import java.io.File;\r
-import java.io.InputStream;\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.Method;\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.runtime.Platform;\r
-import org.eclipse.jface.resource.CompositeImageDescriptor;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.osgi.framework.Bundle;\r
+import java.io.File;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.osgi.framework.Bundle;
/**
* Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
*******************************************************************************/\r
package org.eclipse.wb.swt;
-import java.io.FileInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.graphics.Cursor;\r
-import org.eclipse.swt.graphics.Font;\r
-import org.eclipse.swt.graphics.FontData;\r
-import org.eclipse.swt.graphics.GC;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.graphics.ImageData;\r
-import org.eclipse.swt.graphics.RGB;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.eclipse.swt.widgets.Display;\r
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
/**
* Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.