Project

General

Profile

« Previous | Next » 

Revision c69c2dcd

Added by Cherian Mathew over 8 years ago

Add entity type to CdmChangeEvent and fixes #5139

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmChangeEvent.java
30 30
    private final Action action;
31 31
    private final Set<CdmBase> changedObjects;
32 32
    private final Class sourceType;
33
    private Class entityType;
33 34
    private Object source;
34 35

  
35 36
    public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Class sourceType) {
......
45 46
        this.sourceType = sourceType;
46 47
    }
47 48

  
49
    public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Class sourceType, Class entityType) {
50
        this(action, changedObjects, sourceType);
51
        this.entityType = entityType;
52
    }
53

  
48 54
    public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Object source) {
49 55
        this(action, changedObjects, source.getClass());
50 56
        this.source = source;
......
79 85
        return source;
80 86
    }
81 87

  
88
    public Class getEntityType() {
89
        return entityType;
90
    }
91

  
82 92
    public boolean hasChanges() {
83 93
        return changedObjects != null && !changedObjects.isEmpty();
84 94
    }
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java
33 33

  
34 34
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
35 35
import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
36
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
36 37
import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
37 38
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
38 39
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
......
524 525
     */
525 526
    @Override
526 527
    public void onChange(CdmChangeEvent event) {
528
        if(event.getAction() == Action.Delete && Classification.class.equals(event.getEntityType())) {
529
            refresh();
530
            return;
531
        }
527 532
        for(CdmBase cb : event.getChangedObjects()) {
528 533
            if(cb instanceof TaxonNode) {
529 534
                TaxonNode tn = (TaxonNode)cb;
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingDeleteTaxonNodeOperation.java
63 63
            if(node instanceof TaxonNode) {
64 64
                return CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().deleteTaxonNode(((TaxonNode)node).getUuid(), config);
65 65
            } else if(node instanceof Classification) {
66
                entityType = Classification.class;
66 67
                return CdmApplicationState.getCurrentAppConfig().getClassificationService().delete(((Classification)node).getUuid());
67 68
            }
68 69
        } else {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/RemotingCdmOperation.java
33 33
    private final Object source;
34 34
    private final Action action;
35 35
    private final boolean async;
36
    protected Class entityType;
36 37

  
37 38
    public RemotingCdmOperation(String label, Action action, Object source, boolean async) {
38 39
        super(label);
......
66 67

  
67 68
    protected void fireDataChangeEvent(UpdateResult updateResult) {
68 69
        Set<CdmBase> updatedObjects = updateResult.getUpdatedObjects();
69
        if(updatedObjects != null && !updatedObjects.isEmpty()) {
70
            CdmApplicationState.getCurrentDataChangeService().fireChangeEvent(new CdmChangeEvent(action, updatedObjects, source.getClass()), async);
71
        }
70
        CdmApplicationState.getCurrentDataChangeService()
71
            .fireChangeEvent(new CdmChangeEvent(action, updatedObjects, source.getClass(), entityType), async);
72 72
    }
73 73

  
74 74
    protected void fireDataChangeEvent(CdmBase cdmBase) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java
689 689
        String username, password;
690 690
        IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
691 691
        Preferences credentialsPrefs = preferences.node(LOGIN_NODE);
692
        username = credentialsPrefs.get(getUsernamePrefKey(), "");
692
        username = credentialsPrefs.get(getUsernamePrefKey(), txtLogin.getText());
693 693
        txtLogin.setText(username);
694
        password = credentialsPrefs.get(getPasswordPrefKey(), "");
694
        password = credentialsPrefs.get(getPasswordPrefKey(),txtPassword.getText());
695 695
        txtPassword.setText(password);
696 696
        if(username.isEmpty() || password.isEmpty()) {
697 697
            autoConnect = false;

Also available in: Unified diff