Project

General

Profile

Revision 98cda0fe

ID98cda0fe1dae146096f1675c3c935df5ef2e85ee
Parent fa6c7d4c
Child 34d19b7b

Added by Patrick Plitzner almost 4 years ago

ref #6762 Allow editing characters via DetailsView in CharacterEditor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/character/CharacterEditor.java
58 58
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDropAdapter;
59 59
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
60 60
import eu.etaxonomy.taxeditor.model.AbstractUtility;
61
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
61 62
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
62 63
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
63 64
import eu.etaxonomy.taxeditor.model.MessagingUtils;
......
74 75
 *
75 76
 */
76 77
public class CharacterEditor implements ICdmEntitySessionEnabled, IConversationEnabled, ISelectionChangedListener,
77
        ModifyListener, IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart {
78
        ModifyListener, IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart,
79
        IDirtyMarkable {
78 80

  
79 81
    private FeatureTreeEditorComposite characterTreeEditorComposite;
80 82
    private FeatureTreeEditorComposite propertiesTreeEditorComposite;
......
223 225
                    }
224 226
                }
225 227

  
226
                setDirty(true);
228
                setDirty();
227 229
                characterTreeEditorComposite.getViewer().refresh();
228 230
            }
229 231
        });
......
239 241
        // commit the conversation and start a new transaction immediately
240 242
        conversation.commit(true);
241 243

  
242
        CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(characterTreeEditorComposite.getFeatureTree());
244
        FeatureTree featureTree = characterTreeEditorComposite.getFeatureTree();
245
        if(featureTree!=null){
246
            //save characters because they can be modified in this editor
247
            featureTree.getDistinctFeatures().forEach(character->CdmStore.getService(ITermService.class).merge(character,true));
248
        }
249
        CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(featureTree);
250

  
243 251

  
244
        this.setDirty(false);
252
        dirty.setDirty(false);
245 253
    }
246 254

  
247 255
    @PreDestroy
......
306 314
    @Override
307 315
    public void modifyText(ModifyEvent e) {
308 316
        characterTreeEditorComposite.getFeatureTree().setTitleCache(characterTreeEditorComposite.getText_title().getText(), true);
309
        setDirty(true);
317
        setDirty();
310 318
    }
311 319

  
312 320

  
313
    public void setDirty(boolean isDirty) {
314
        dirty.setDirty(isDirty);
321
    private void setDirty() {
322
        dirty.setDirty(true);
315 323
    }
316 324

  
317 325
    /**
......
363 371
        return conversation;
364 372
    }
365 373

  
374
    /**
375
     * {@inheritDoc}
376
     */
377
    @Override
378
    public void changed(Object element) {
379
        setDirty();
380
    }
381

  
382
    /**
383
     * {@inheritDoc}
384
     */
385
    @Override
386
    public void forceDirty() {
387
        setDirty();
388
    }
389

  
366 390
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)