Project

General

Profile

« Previous | Next » 

Revision c6df1ae1

Added by Katja Luther over 2 years ago

ref #8471: allow delete again and disable description parts

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DeleteHandlerE4.java
210 210
            IStructuredSelection sel = (IStructuredSelection) selection;
211 211
            if (sel.getFirstElement() instanceof FeatureNodeContainer){
212 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 213
            }
222 214

  
223 215
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java
34 34
	public DescriptionDetailElement(CdmFormFactory cdmFormFactory,
35 35
			ICdmFormElement formElement, int style) {
36 36
		super(cdmFormFactory, formElement);
37
		setEnabled(enabled);
37 38
	}
38 39

  
39 40
	@Override
40 41
	protected void createControls(ICdmFormElement formElement, DescriptionBase entity, int style) {
41 42
        toggleable_cache = formFactory.createToggleableTextField(this, "Label",
42 43
                entity.getTitleCache(), entity.isProtectedTitleCache(), style);
44
        toggleable_cache.setEnabled(!entity.isComputed());
43 45
		// TODO I initially thought that we can handle the entity's descriptive system with a feature tree
44 46
		// Since descriptiveSystem is a Set of Features that are present or allowed for the current description,
45 47
		// it is similar to a FeatureTree (you can get this information from a feature tree) but not the same.
......
54 56

  
55 57
	}
56 58

  
57
	@Override
58
    protected void updateControlStates(){
59
//	@Override
60
//    protected void updateControlStates(){
61
//
62
//        if (getEntity().isComputed()){
63
//            enabled = false;
64
//         }else{
65
//            enabled = true;
66
//        }
67
//        setEnabled(enabled);
68
//    }
59 69

  
60
        if (getEntity().isComputed()){
61
            enabled = false;
62
         }else{
63
            enabled = true;
64
        }
65
        setEnabled(enabled);
66
    }
67 70

  
68
    @Override
69
    protected void updateContent() {
70
        super.updateContent();
71
        toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
72
        updateCacheRelevance();
73
    }
74 71

  
75 72
    @Override
76 73
    protected void handleTitleCacheRelevantChange(PropertyChangeEvent event) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java
50 50
	protected AbstractCdmDetailElement<DescriptionBase<?>> createCdmDetailElement(AbstractCdmDetailSection<DescriptionBase<?>> parentElement, int style) {
51 51
	    return formFactory.createDescriptionDetailElement(parentElement, style);
52 52
	}
53

  
54
	@Override
55
    public void setEntity(DescriptionBase<?> entity) {
56
	    super.setEntity(entity);
57

  
58
	    if (entity.isComputed()){
59
	        setEnabled(false);
60
	        this.getDetailElement().setEnabled(false);
61
	    }
62
	}
53 63
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
286 286
                } else if (isUseDescription) {
287 287
                    createUseDescriptionSection(rootElement);
288 288
                } else if (input instanceof TaxonDescription){
289
                    createTaxonDescriptionSection(rootElement);
289
                    createTaxonDescriptionSection(rootElement, !((DescriptionBase) input).isComputed());
290 290

  
291 291
                } else{
292
                    createDescriptionSection(rootElement, false);
292
                    createDescriptionSection(rootElement, false, !((DescriptionBase) input).isComputed());
293 293
                }
294 294
            }
295 295
        } else if (input instanceof DescriptionElementBase){
......
653 653
        addPart(descriptionElementMediaSection);
654 654
    }
655 655

  
656
    private void createDescriptionSection(RootElement parent, boolean isTaxonDescription) {
656
    private void createDescriptionSection(RootElement parent, boolean isTaxonDescription, boolean isEnabled) {
657 657
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName(), true));
658
        descriptionDetailSection.setEnabled(isEnabled);
658 659
        addPart(descriptionDetailSection);
659 660

  
660 661
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
......
663 664
            NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(
664 665
                    getConversationHolder(), parent, this, StoreUtil.getSectionStyle(NaturalLanguageSection.class, getInput().getClass().getCanonicalName(), true));
665 666
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
667
            naturalLanguageSection.setEnabled(isEnabled);
666 668
            addPart(naturalLanguageSection);
667 669
        }
668 670
        DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
669 671
                getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName(), true));
672
        descriptionSourceSection.setEnabled(isEnabled);
670 673
        addPart(descriptionSourceSection);
671 674

  
672 675
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
673 676

  
674 677
        if(isTaxonDescription) {
675 678
            ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ScopeSection.class, getInput().getClass().getCanonicalName()));
679
            scopeSection.setEnabled(isEnabled);
676 680
            addPart(scopeSection);
677 681
        }
678 682
    }
679 683

  
680
    private void createTaxonDescriptionSection(RootElement parent) {
681
        createDescriptionSection(parent, true);
684
    private void createTaxonDescriptionSection(RootElement parent, boolean isEnabled) {
685
        createDescriptionSection(parent, true, isEnabled);
682 686
    }
683 687

  
684 688
    private void createSpecimenDescriptionSection(RootElement parent) {
685
        createDescriptionSection(parent, false);
689
        createDescriptionSection(parent, false, true);
686 690
    }
687 691

  
688 692
    private void createUseDescriptionSection(RootElement parent) {

Also available in: Unified diff