// $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 boolean performDrop(Object data) {
TaxonDescription target = (TaxonDescription) getCurrentTarget();
Object[] droppedElements = (Object[]) data;
-
+
Collection<DescriptionElementBase> descriptionElements = new ArrayList<DescriptionElementBase>();
-
+
boolean isCopy = getCurrentOperation() == DND.DROP_COPY ? true : false;
-
+
// cannot drop a feature node onto itself
if (droppedElements != null){
- for (Object droppedElement : droppedElements) {
+ for (Object droppedElement : droppedElements) {
if (droppedElement == null){
MessagingUtils.warningDialog("Operation not supported yet", this, "We are currently unable to drag and drop a newly created element. Please save the editor to make this work.");
return false;
return false;
}else{
DescriptionElementBase descriptionElement = (DescriptionElementBase) droppedElement;
-
+
if (descriptionElement.getInDescription().equals(target)) {
return false;
}
-
+
descriptionElements.add(descriptionElement);
- }
+ }
}
-
+
AbstractPostOperation operation = new MoveDescriptionElementsOperation("Move Descriptions", EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null);
-
+
EditorUtil.executeOperation(operation);
return true;
}
MessagingUtils.warningDialog("Operation not supported yet", this, "We are unable to drag and drop empty descriptions");
-
+
return false;
-
+
}
/* (non-Javadoc)
TransferData transferData) {
boolean transferDataIsSupported = DescriptionElementTransfer.getInstance().isSupportedType(
transferData);
- System.out.println(target);
return target instanceof TaxonDescription && transferDataIsSupported;
}
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.location.Country;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
String result = NamedArea.labelWithLevel(namedArea, CdmStore.getDefaultLanguage());
return result;
} catch (Exception e) {
- //TODO still need to learn how errors are handled in the Tax Editor
- System.out.println("Error occurred when trying retrieve title for Named Area: " + namedArea.getUuid());
+ MessagingUtils.error(NamedAreaSelectionDialog.class, "Error occurred when trying retrieve title for Named Area: " + namedArea.getUuid(), e);
return namedArea.getTitleCache();
}
}