Project

General

Profile

« Previous | Next » 

Revision 4a34b657

Added by Cherian Mathew over 8 years ago

#5052 Integrate remoting in granted authorites editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java
66 66
	@Override
67 67
	public void setFocus() {
68 68
	    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
69
	    ((CdmAuthorityEditorInput) getEditorInput()).bind();
69 70
	}
70 71

  
71 72
	/* (non-Javadoc)
......
76 77
		try {
77 78
			monitor.beginTask("Saving CDM Authority Editor", 1);
78 79
			getConversationHolder().commit(true);
80
			((CdmAuthorityEditorInput) getEditorInput()).merge();
79 81
			dirty = false;
80 82
			firePropertyChange(PROP_DIRTY);
81 83
			monitor.worked(1);
......
172 174
	public void dispose() {
173 175
		conversation.unregisterForDataStoreChanges(this);
174 176
		conversation.close();
177
		((CdmAuthorityEditorInput) getEditorInput()).getCdmEntitySession().dispose();
175 178
		super.dispose();
176 179
	}
177 180
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditorInput.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
9 9
package eu.etaxonomy.taxeditor.editor.group.authority;
10 10

  
11
import java.util.Arrays;
12
import java.util.Collection;
11 13
import java.util.UUID;
12 14

  
13 15
import org.eclipse.jface.resource.ImageDescriptor;
......
19 21
import eu.etaxonomy.cdm.api.service.IGroupService;
20 22
import eu.etaxonomy.cdm.model.common.Group;
21 23
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
24
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
22 25
import eu.etaxonomy.taxeditor.store.CdmStore;
23 26

  
24 27
/**
25 28
 * Editor input for the {@link CdmAuthorityEditor}.
26
 * 
29
 *
27 30
 * @author cmathew
28 31
 * @created Mar 28, 2013
29 32
 *
30 33
 */
31 34

  
32
public class CdmAuthorityEditorInput implements IEditorInput, IConversationEnabled {
35
public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled {
33 36
	private ConversationHolder conversation;
34 37
	private Group group;
35
	
38

  
36 39
	protected CdmAuthorityEditorInput(ConversationHolder conversation, Group group) {
37 40
		this.conversation = conversation;
38 41
		this.group = group;
39
		
42

  
40 43
	}
41
	
44

  
42 45
	/**
43 46
	 * Creates a new instance of the input for a given group.
44
	 * 
47
	 *
45 48
	 * @param groupUuid
46 49
	 * @return
47 50
	 * @throws Exception
48 51
	 */
49 52
	public static CdmAuthorityEditorInput NewInstance(UUID groupUuid) throws Exception{
50 53
		ConversationHolder conversation = CdmStore.createConversation();
51
		Group group = CdmStore.getService(IGroupService.class).load(groupUuid, null);			
54
		Group group = CdmStore.getService(IGroupService.class).load(groupUuid, null);
52 55
		return new CdmAuthorityEditorInput(conversation, group);
53 56
	}
54
	
57

  
55 58
	/* (non-Javadoc)
56 59
	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
57 60
	 */
......
59 62
	public Object getAdapter(Class adapter) {
60 63
		if (adapter == Group.class) {
61 64
			return this.group;
62
		}		
63
		
65
		}
66

  
64 67
		return null;
65 68
	}
66 69
	/* (non-Javadoc)
......
69 72
	@Override
70 73
	public void update(CdmDataChangeMap changeEvents) {
71 74
		// TODO Auto-generated method stub
72
		
75

  
73 76
	}
74 77
	/* (non-Javadoc)
75 78
	 * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
......
114 117
	@Override
115 118
	public String getToolTipText() {
116 119
		return getName();
117
	}	
118
	
120
	}
121

  
119 122
	/* (non-Javadoc)
120 123
	 * @see java.lang.Object#equals(java.lang.Object)
121 124
	 */
......
129 132
		}
130 133
		return super.equals(object);
131 134
	}
132
	
135

  
133 136
	/**
134 137
	 * Getter method for group member.
135
	 * 
138
	 *
136 139
	 * @return
137 140
	 */
138 141
	public Group getGroup() {
139 142
		return this.group;
140 143
	}
144

  
145
    /* (non-Javadoc)
146
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
147
     */
148
    @Override
149
    public Collection<Group> getRootEntities() {
150
        return Arrays.asList(group);
151
    }
152

  
153
    /* (non-Javadoc)
154
     * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
155
     */
156
    @Override
157
    public void merge() {
158
        CdmStore.getService(IGroupService.class).merge(group);
159
    }
141 160
}

Also available in: Unified diff