Project

General

Profile

« Previous | Next » 

Revision 773b87f5

Added by Patrick Plitzner about 6 years ago

ref #6746 Fix potential ClassCastException

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddChildFeatureHandler.java
45 45
        AvailableFeaturesWizard wizard = new AvailableFeaturesWizard();
46 46
        WizardDialog dialog = new WizardDialog(shell, wizard);
47 47

  
48
        if (dialog.open() == IStatus.OK && selection instanceof FeatureNode) {
49
            FeatureNode parent = (FeatureNode)selection;
48
        Object next = selection.iterator().next();
49
        if (dialog.open() == IStatus.OK && next instanceof FeatureNode) {
50
            FeatureNode parent = (FeatureNode)next;
50 51
            Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
51 52
            for (Feature feature : additionalFeatures) {
52 53
                CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(parent.getUuid(), feature.getUuid());
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddFeatureHandler.java
49 49
            FeatureTree tree = (FeatureTree) selection.iterator().next();
50 50
            Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
51 51
            for (Feature feature : additionalFeatures) {
52
                CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(tree.getUuid(), feature.getUuid());
52
                CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(tree.getRoot().getUuid(), feature.getUuid());
53 53
            }
54 54
            editor.getViewer().refresh();
55 55
            editor.getViewer().expandToLevel(selection, 1);

Also available in: Unified diff