<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="src" path="src/main/resources/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
package eu.etaxonomy.taxeditor.editor.handler.create;
-import java.util.Collections;
-
import org.apache.log4j.Logger;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeFieldUnitCacheStrategy;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
-import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard;
/**
- * <p>NewSpecimenHandler class.</p>
- *
* @author n.hoffmann
* @created Jun 16, 2010
* @version 1.0
private static final Logger logger = Logger
.getLogger(NewSpecimenHandler.class);
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
/** {@inheritDoc} */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ConversationHolder conversation = CdmStore.createConversation();
- conversation.bind();
- FieldUnit fieldUnit = FieldUnit.NewInstance();
- DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
- DerivationEvent.NewSimpleInstance(fieldUnit, derivedUnit, DerivationEventType.GATHERING_IN_SITU());
- CdmStore.getService(IOccurrenceService.class).merge(fieldUnit);
- conversation.commit();
- DerivateViewEditorInput input = new DerivateViewEditorInput(Collections.singleton(fieldUnit.getUuid()));
- fieldUnit.setCacheStrategy(new DerivedUnitFacadeFieldUnitCacheStrategy());
- derivedUnit.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
- try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-// NewDerivedUnitBaseWizard wizard = new NewDerivedUnitBaseWizard();
-// wizard.init(null, null);
-// WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
-// dialog.open();
+
+ //TODO: we need to discuss how specimens should be created and handled #5244
+// ConversationHolder conversation = CdmStore.createConversation();
+// conversation.bind();
+// FieldUnit fieldUnit = FieldUnit.NewInstance();
+// DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
+// DerivationEvent.NewSimpleInstance(fieldUnit, derivedUnit, DerivationEventType.GATHERING_IN_SITU());
+// fieldUnit.setCacheStrategy(new DerivedUnitFacadeFieldUnitCacheStrategy());
+// derivedUnit.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
+// CdmStore.getService(IOccurrenceService.class).save(fieldUnit);
+// CdmStore.getService(IOccurrenceService.class).save(derivedUnit);
+// conversation.commit();
+// DerivateViewEditorInput input = new DerivateViewEditorInput(Collections.singleton(fieldUnit.getUuid()));
+// try {
+// EditorUtil.open(input);
+// } catch (PartInitException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+ NewDerivedUnitBaseWizard wizard = new NewDerivedUnitBaseWizard();
+ wizard.init(null, null);
+ WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+ dialog.open();
return null;
}
}
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
if(part == this){
return;
}
- if(part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart){
- // do not show empty page as these views are also used to edit the description selected in this view
- return;
- }
+ if (part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart
+ || part instanceof MediaViewPart) {
+ // do not show empty page as these views are also used to edit the
+ // description selected in this view
+ return;
+ }
// unpackage TreeNode of DerivateView
else if(part instanceof DerivateView){
TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(selection);
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
return;
}
- if(part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart){
- // do not show empty page as these views are also used to edit the description selected in this view
+ if (part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart
+ || part instanceof DescriptiveViewPart) {
+ // do not show empty page as these views are also used to edit the
+ // description selected in this view
return;
}
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventWizardPage;
/**
- * <p>NewDerivedUnitBaseWizard class.</p>
- *
* @author n.hoffmann
* @created Jun 16, 2010
* @version 1.0
}
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#
- * createNewEntity()
- */
/** {@inheritDoc} */
@Override
protected SpecimenOrObservationBase createNewEntity() {
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
- */
/** {@inheritDoc} */
@Override
protected void saveEntity() {
*/
public class DerivedUnitBaseWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
public DerivedUnitBaseWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setPageComplete(true);
}
- /* (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<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
DerivedUnitBaseDetailElement detailElement = formFactory.createDerivedUnitBaseDetailElement(rootElement);
AbstractCdmDetailElement<DerivedUnitFacade> {
boolean showOnlyDerivedUnitData = false;
+ //TODO: flag to disable specimen type dropdown (#5244)
+ boolean showSpecimenType = true;
private ToggleableTextElement toggleableText_titleCache;
private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
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) {
else{
combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
combo_specorobstype.setSelection(entity.getType());
+ combo_specorobstype.setEnabled(showSpecimenType);
selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
formElement, "Country",
entity.getCountry(), EntitySelectionElement.NOTHING, style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if (eventSource == toggleableText_titleCache) {
this.showOnlyDerivedUnitData = showOnlyDerivedUnitData;
}
+ public void setShowSpecimenType(boolean showSpecimenType) {
+ this.showSpecimenType = showSpecimenType;
+ }
+
}
*/
public class DerivedUnitGeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
public DerivedUnitGeneralWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setTitle("General Specimen 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<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
DerivedUnitGeneralDetailElement detailElement = formFactory.createDerivedUnitGeneralDetailElement(rootElement);
+ detailElement.setShowSpecimenType(false);
detailElement.setEntity(getEntity());
checkComplete();
return detailElement;
*/
public class FieldUnitWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
public FieldUnitWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setPageComplete(true);
}
- /* (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<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
FieldUnitDetailElement detailElement = formFactory.createFieldUnitDetailElement(rootElement);
*/
public class GatheringEventWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
public GatheringEventWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setPageComplete(true);
}
- /* (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<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
GatheringEventDetailElement detailElement = formFactory.createGatheringEventDetailElement(rootElement);