Project

General

Profile

« Previous | Next » 

Revision 0858c777

Added by Katja Luther almost 3 years ago

ref #8471: disable computed descriptions

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DeleteHandlerE4.java
205 205
            MHandledMenuItem menuItem){
206 206
        FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
207 207
        ISelection selection = factualDataPart.getViewer().getSelection();
208
        boolean canExecute = selection instanceof IStructuredSelection && !selection.isEmpty() && !(((IStructuredSelection)selection).getFirstElement() instanceof FeatureNodeContainer);
208
        boolean canExecute = true;
209
        if (selection instanceof IStructuredSelection && !selection.isEmpty()){
210
            IStructuredSelection sel = (IStructuredSelection) selection;
211
            if (sel.getFirstElement() instanceof FeatureNodeContainer){
212
                canExecute = false;
213
            }else if (sel.getFirstElement() instanceof DescriptionBase){
214
                if (((DescriptionBase)sel.getFirstElement()).isComputed()){
215
                    canExecute = false;
216
                }
217
            }else if (sel.getFirstElement() instanceof DescriptionElementBase){
218
                if (((DescriptionElementBase)sel.getFirstElement()).getInDescription().isComputed()){
219
                    canExecute = false;
220
                }
221
            }
222

  
223
        }
224
        canExecute &= selection instanceof IStructuredSelection && !selection.isEmpty() && !(((IStructuredSelection)selection).getFirstElement() instanceof FeatureNodeContainer);
209 225

  
210 226
        menuItem.setVisible(canExecute);
211 227
        return canExecute;

Also available in: Unified diff