--- /dev/null
+package eu.etaxonomy.taxeditor.handler;
+
+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.handlers.HandlerUtil;
+
+public class CreateFieldUnitHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+ if(currentSelection instanceof IStructuredSelection){
+ System.out.println(currentSelection);
+ }
+ return null;
+ }
+
+}
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopePolyKeyDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.NamedAreaDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
return section;
}
+ public GeoScopePolyKeyDetailSection createGeoScopePolyKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+ GeoScopePolyKeyDetailSection section = new GeoScopePolyKeyDetailSection(this, conversation, parentElement, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
public IdentifierDetailSection createIdentifierDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
IdentifierDetailSection section = new IdentifierDetailSection(this, conversation, parentElement, style);
addAndAdaptSection(parentElement, section);
*/
package eu.etaxonomy.taxeditor.ui.section.key;
+import org.eclipse.swt.SWT;
+
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopePolyKeyDetailSection;
/**
* @author n.hoffmann
private TextWithLabelElement textLabel;
private NumberWithLabelElement numberStartNumber;
+ private TaxonomicScopeSection sectionTaxonomicScope;
+ private GeoScopePolyKeyDetailSection sectionGeoScopes;
public PolytomousKeyDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
protected void createControls(ICdmFormElement formElement,
PolytomousKey entity, int style) {
textLabel = formFactory.createTextWithLabelElement(formElement, "Title", entity.getTitleCache(), style);
- numberStartNumber = formFactory.createNumberTextWithLabelElement(formElement, "Start Number", entity.getStartNumber(), style);
+
+ numberStartNumber = formFactory.createNumberTextWithLabelElement(formElement, "Start Number", entity.getStartNumber(), style);
+
+ sectionTaxonomicScope = formFactory.createTaxonomicScopeSection(getConversationHolder(), formElement, style);
+ sectionTaxonomicScope.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionTaxonomicScope.setEntity(entity);
+
+ sectionGeoScopes = formFactory.createGeoScopePolyKeyDetailSection(getConversationHolder(), formElement, SWT.NULL);
+ sectionGeoScopes.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionGeoScopes.setEntity(entity);
}
public String getText() {
return textLabel.getText();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if(eventSource==textLabel){
--- /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;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ *
+ * @author pplitzner
+ * @date Sep 21, 2015
+ *
+ */
+public class GeoScopePolyKeyDetailSection extends AbstractEntityCollectionSection<PolytomousKey, NamedArea> {
+
+ public GeoScopePolyKeyDetailSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement, int style) {
+ super(formFactory, conversation, parentElement, "Geo Scopes", style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Collection<NamedArea> getCollection(PolytomousKey entity) {
+ return entity.getGeographicalScope();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public NamedArea createNewElement() {
+ NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
+
+ return selection;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addElement(NamedArea element) {
+ getEntity().addGeographicalScope(element);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void removeElement(NamedArea element) {
+ getEntity().removeGeographicalScope(element);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getEmptyString() {
+ return "No geo scopes yet.";
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected String getTooltipString() {
+ return "Add a geo scope";
+ }
+
+}
PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
-
addPart(polytomousKeyDetailSection);
addPart(polytomousKeyNodeDetailSection);
- addPart(taxonomicScopeSection);
}