Project

General

Profile

Revision c6c263b6

IDc6c263b6f1343f00c60cb9bcbc9dcd8af11894df
Parent deb3ab1f
Child a9bea304

Added by Patrick Plitzner over 3 years ago

ref #7010 Adapt feature tree handlers for multiple selection

View differences:

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

  
47
        Object next = selection.iterator().next();
47
        Object next = selection.getFirstElement();
48 48
        if (dialog.open() == IStatus.OK && next instanceof FeatureNode) {
49 49
            FeatureNode parent = (FeatureNode)next;
50 50
            Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
......
69 69
        canExecute = thisPart.getObject() instanceof FeatureTreeEditor
70 70
                && selection!=null
71 71
                && selection.size()==1
72
                && selection.iterator().next() instanceof FeatureNode;
72
                && selection.getFirstElement() instanceof FeatureNode;
73 73
        menuItem.setVisible(canExecute);
74 74
        return canExecute;
75 75
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddFeatureHandler.java
46 46
        WizardDialog dialog = new WizardDialog(shell, wizard);
47 47

  
48 48
        if (dialog.open() == IStatus.OK) {
49
            FeatureTree tree = (FeatureTree) selection.iterator().next();
49
            FeatureTree tree = (FeatureTree) selection.getFirstElement();
50 50
            Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
51 51
            for (Feature feature : additionalFeatures) {
52 52
                FeatureNode childNode = FeatureNode.NewInstance(feature);
......
69 69
        canExecute = thisPart.getObject() instanceof FeatureTreeEditor
70 70
                && selection!=null
71 71
                && selection.size()==1
72
                && selection.iterator().next() instanceof FeatureTree;
72
                && selection.getFirstElement() instanceof FeatureTree;
73 73
        menuItem.setVisible(canExecute);
74 74
        return canExecute;
75 75
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/FeatureTreeExportHandler.java
37 37
    @Execute
38 38
    public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
39 39
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection){
40
        FeatureTree selectedFeatureTree = (FeatureTree) selection.iterator().next();
40
        FeatureTree selectedFeatureTree = (FeatureTree) selection.getFirstElement();
41 41
        DirectoryDialog dialog = new DirectoryDialog(shell);
42 42
        String directoryString = dialog.open();
43 43
        if(directoryString!=null){
......
58 58
        boolean canExecute = false;
59 59
        canExecute = selection!=null
60 60
                && selection.size()==1
61
                && selection.iterator().next() instanceof FeatureTree;
61
                && selection.getFirstElement() instanceof FeatureTree;
62 62
        menuItem.setVisible(canExecute);
63 63
        return canExecute;
64 64
    }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)