Project

General

Profile

« Previous | Next » 

Revision 871e0d37

Added by Patrick Plitzner over 7 years ago

Do not show taxon-specific deletion options when deleting
classifications

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingDeleteTaxonNodeHandler.java
23 23
import org.eclipse.ui.handlers.HandlerUtil;
24 24

  
25 25
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
26
import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
26 27
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
27 28
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
28
import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
29
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
30 29
import eu.etaxonomy.cdm.model.taxon.Classification;
31 30
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
32 31
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
......
47 46
    private TaxonDeletionConfigurator config;
48 47
    private Set<ITaxonTreeNode> treeNodes;
49 48

  
50
    /**
51
     * @param label
52
     */
53 49
    public RemotingDeleteTaxonNodeHandler() {
54 50
        super(TaxonNavigatorLabels.DELETE_TAXON_NODE_LABEL);
55 51
    }
56 52

  
57
    /* (non-Javadoc)
58
     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
59
     */
60 53
    @Override
61 54
    public IStatus allowOperations(ExecutionEvent event) {
62 55
        TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
63 56

  
64
        Iterator selectionIterator = selection.iterator();
57
        Iterator<?> selectionIterator = selection.iterator();
65 58
        treeNodes = new HashSet<ITaxonTreeNode>();
66 59

  
67 60
        while (selectionIterator.hasNext()){
......
99 92

  
100 93
            }
101 94
            TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
102
            if (taxonNode instanceof Classification && taxonNode.hasChildNodes()){
103
                if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification? The tree has children, they will be deleted, too.")){
104
                    return Status.CANCEL_STATUS;
105
                }
106
            } else if (taxonNode instanceof Classification && !taxonNode.hasChildNodes()){
107
                if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification?")){
108
                    return Status.CANCEL_STATUS;
109
                }
110
            } else {
95
			if (taxonNode instanceof Classification) {
96
				String message;
97
				if (taxonNode.hasChildNodes()) {
98
					message = "Do you really want to delete the classification? The tree has children, they will be deleted, too.";
99
				} else {
100
					message = "Do you really want to delete the classification?";
101
				}
102
				if (!DeleteConfiguratorDialog.openConfirm(
103
						HandlerUtil.getActiveShell(event), "Confirm Deletion",
104
						message)) {
105
					return Status.CANCEL_STATUS;
106
				}
107
			}
108
            else {
111 109

  
112 110
                if (taxonNode.hasChildNodes()){
113 111
                    DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(
......
142 140
        return Status.OK_STATUS;
143 141
    }
144 142

  
145
    /* (non-Javadoc)
146
     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
147
     */
148 143
    @Override
149 144
    public AbstractOperation prepareOperation(ExecutionEvent event) {
150 145
        return new RemotingDeleteTaxonNodeOperation(event.getTrigger(),
......
153 148
                config);
154 149
    }
155 150

  
156
    /* (non-Javadoc)
157
     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
158
     */
159 151
    @Override
160 152
    public void onComplete() {
161
        // TODO Auto-generated method stub
162

  
163 153
    }
164 154

  
165 155
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorDialog.java
41 41
        this.configurator = configurator;
42 42
    }
43 43

  
44
    /* (non-Javadoc)
45
     * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
46
     */
47 44
    @Override
48 45
    protected Control createCustomArea(Composite parent) {
49 46
        DeleteConfiguratorComposite composite = new DeleteConfiguratorComposite(parent, NONE);
......
67 64
        return dialog.open() == 0;
68 65
    }
69 66

  
70
    /* (non-Javadoc)
71
     * @see org.eclipse.jface.dialogs.Dialog#isResizable()
72
     */
73 67
    @Override
74 68
    protected boolean isResizable() {
75 69
        return true;
76 70
    }
77 71

  
78 72

  
79
    /**
80
     * @param kind
81
     * @return
82
     */
83 73
    protected static String[] getButtonLabels(int kind) {
84 74
        String[] dialogButtonLabels;
85 75
        switch (kind) {

Also available in: Unified diff