import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.Persist;
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.EMenuService;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
-import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermTree;
+import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.IDescriptiveDataSetEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
*
*/
public class DescriptiveDataSetEditor implements IE4SavablePart, IConversationEnabled, ICdmEntitySessionEnabled,
-IPartContentHasDetails, IPartContentHasSupplementalData, IDirtyMarkable {
+IPartContentHasDetails, IPartContentHasSupplementalData, IDirtyMarkable, IDescriptiveDataSetEditor {
private DescriptiveDataSetComposite composite;
@Inject
private MDirtyable dirty;
+ @Inject
+ private MPart thisPart;
+
@Inject
private ESelectionService selectionService;
@Override
public void modifyText(ModifyEvent e) {
descriptiveDataSet.setLabel(composite.getTxt_label().getText());
+ EventUtility.postSyncEvent(WorkbenchEventConstants.REFRESH_DATASET_NAVIGATOR, descriptiveDataSet);
dirty.setDirty(true);
}
};
composite.getRankMin().addSelectionChangedListener(event->dirty.setDirty(true));
composite.getRankMin().setText("Select min rank...");
composite.getRankMax().addSelectionChangedListener(event->dirty.setDirty(true));
- composite.getRankMin().setText("Select max rank...");
+ composite.getRankMax().setText("Select max rank...");
composite.getBtnRemoveRankMin().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
- composite.getFeatureTreeEditorComposite().init("Character Tree", null, null, e->selectionService.setSelection(e.getSelection()), this, null);
+ composite.getFeatureTreeEditorComposite().init("Character Tree",
+ TermType.Character,
+ null,
+ null,
+ e->selectionService.setSelection(e.getSelection()),
+ this,
+ null);
//add drag'n'drop support
Transfer[] transfers = new Transfer[] {LocalSelectionTransfer.getTransfer()};
}
});
selectionService.setSelection(new StructuredSelection(descriptiveDataSet));
+ thisPart.setLabel(descriptiveDataSet.getLabel());
}
public void addTaxonNode(TaxonNodeDto taxonNodeDto){
}
}
}
- FeatureTree characters = composite.getCharacters();
+ TermTree<Feature> characters = composite.getCharacters();
if(characters!=null){
//save characters because they can be modified in this editor
- characters.getDistinctFeatures().forEach(character->CdmStore.getService(ITermService.class).merge(character,true));
+ characters.getDistinctTerms().forEach(character->CdmStore.getService(ITermService.class).merge(character,true));
}
conversation.commit();
CdmStore.getService(IDescriptiveDataSetService.class).merge(descriptiveDataSet, true);
-
+ //event for updatin matrix
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_DESCRIPTIVE_DATASET, descriptiveDataSet.getUuid());
dirty.setDirty(false);
}
cdmEntitySession = null;
}
dirty.setDirty(false);
+ selectionService.setSelection(null);
}
@Focus