Revision 2804f597
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/WorkingSetEditor.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import java.util.Collection; |
12 | 12 |
import java.util.HashSet; |
13 |
import java.util.List; |
|
14 |
import java.util.Map; |
|
13 | 15 |
import java.util.Set; |
14 | 16 |
import java.util.UUID; |
15 | 17 |
|
... | ... | |
37 | 39 |
import org.eclipse.swt.widgets.Shell; |
38 | 40 |
|
39 | 41 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
42 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
40 | 43 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
41 | 44 |
import eu.etaxonomy.cdm.api.service.IWorkingSetService; |
42 | 45 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
... | ... | |
50 | 53 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
51 | 54 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
52 | 55 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
56 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
|
57 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
58 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
53 | 59 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
54 | 60 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog; |
55 | 61 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
... | ... | |
60 | 66 |
* @since Nov 21, 2017 |
61 | 67 |
* |
62 | 68 |
*/ |
63 |
public class WorkingSetEditor implements IE4SavablePart{ |
|
69 |
public class WorkingSetEditor implements IE4SavablePart, IConversationEnabled, ICdmEntitySessionEnabled{
|
|
64 | 70 |
|
65 | 71 |
private WorkingSetComposite composite; |
66 | 72 |
|
67 | 73 |
private ConversationHolder conversation; |
68 | 74 |
|
75 |
private ICdmEntitySession cdmEntitySession; |
|
76 |
|
|
69 | 77 |
private WorkingSet workingSet; |
70 | 78 |
|
71 | 79 |
private final int dndOperations = DND.DROP_MOVE; |
... | ... | |
77 | 85 |
|
78 | 86 |
@PostConstruct |
79 | 87 |
public void create(Composite parent, IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL)Shell shell){ |
80 |
if(CdmStore.isActive() && conversation==null){ |
|
81 |
conversation = CdmStore.createConversation(); |
|
88 |
if (CdmStore.isActive()){ |
|
89 |
if(conversation == null){ |
|
90 |
conversation = CdmStore.createConversation(); |
|
91 |
} |
|
92 |
if(cdmEntitySession == null){ |
|
93 |
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true); |
|
94 |
} |
|
82 | 95 |
} |
83 | 96 |
else{ |
84 | 97 |
return; |
... | ... | |
190 | 203 |
dirty.setDirty(false); |
191 | 204 |
} |
192 | 205 |
|
193 |
@Focus |
|
194 |
public void setFocus(){ |
|
195 |
if(conversation!=null){ |
|
196 |
conversation.bind(); |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
206 |
/** {@inheritDoc} */ |
|
200 | 207 |
@PreDestroy |
201 |
public void dispose(){ |
|
202 |
if(conversation!=null){
|
|
208 |
public void dispose() {
|
|
209 |
if (conversation != null) {
|
|
203 | 210 |
conversation.close(); |
204 | 211 |
conversation = null; |
205 | 212 |
} |
213 |
if(cdmEntitySession != null) { |
|
214 |
cdmEntitySession.dispose(); |
|
215 |
cdmEntitySession = null; |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 |
/** {@inheritDoc} */ |
|
220 |
@Focus |
|
221 |
public void setFocus() { |
|
222 |
if (getConversationHolder() != null) { |
|
223 |
getConversationHolder().bind(); |
|
224 |
} |
|
225 |
if(cdmEntitySession != null) { |
|
226 |
cdmEntitySession.bind(); |
|
227 |
} |
|
206 | 228 |
} |
207 | 229 |
|
208 | 230 |
public Viewer getTaxonTreeViewer() { |
209 | 231 |
return composite.getTaxonNodeTree(); |
210 | 232 |
} |
211 | 233 |
|
234 |
public void setDirty() { |
|
235 |
dirty.setDirty(true); |
|
236 |
} |
|
237 |
|
|
238 |
/** |
|
239 |
* {@inheritDoc} |
|
240 |
*/ |
|
241 |
@Override |
|
242 |
public void update(CdmDataChangeMap arg0) { |
|
243 |
} |
|
244 |
|
|
245 |
/** |
|
246 |
* {@inheritDoc} |
|
247 |
*/ |
|
248 |
@Override |
|
249 |
public ICdmEntitySession getCdmEntitySession() { |
|
250 |
return cdmEntitySession; |
|
251 |
} |
|
252 |
|
|
253 |
/** |
|
254 |
* {@inheritDoc} |
|
255 |
*/ |
|
256 |
@Override |
|
257 |
public Collection<WorkingSet> getRootEntities() { |
|
258 |
return null; |
|
259 |
} |
|
260 |
|
|
261 |
/** |
|
262 |
* {@inheritDoc} |
|
263 |
*/ |
|
264 |
@Override |
|
265 |
public Map<Object, List<String>> getPropertyPathsMap() { |
|
266 |
return null; |
|
267 |
} |
|
268 |
|
|
269 |
/** |
|
270 |
* {@inheritDoc} |
|
271 |
*/ |
|
272 |
@Override |
|
273 |
public ConversationHolder getConversationHolder() { |
|
274 |
return conversation; |
|
275 |
} |
|
276 |
|
|
212 | 277 |
} |
Also available in: Unified diff
ref #7086 Fix session handling for dragged taxon nodes from navigator