Revision 8c8ead8a
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF | ||
---|---|---|
21 | 21 |
eu.etaxonomy.taxeditor.cdmlib |
22 | 22 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
23 | 23 |
Bundle-ActivationPolicy: lazy |
24 |
Import-Package: org.eclipse.core.runtime, |
|
24 |
Import-Package: eu.etaxonomy.taxeditor.editor, |
|
25 |
org.eclipse.core.runtime, |
|
25 | 26 |
org.eclipse.equinox.app, |
26 | 27 |
org.eclipse.jface.text, |
27 | 28 |
org.eclipse.jface.text.presentation, |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/AnnotatedLineEditor.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.annotatedlineeditor; |
11 | 11 |
|
12 | 12 |
import java.util.Iterator; |
13 |
import java.util.List; |
|
14 | 13 |
|
15 | 14 |
import org.eclipse.core.runtime.CoreException; |
16 | 15 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
24 | 23 |
import org.eclipse.ui.editors.text.TextEditor; |
25 | 24 |
import org.eclipse.ui.texteditor.IDocumentProvider; |
26 | 25 |
|
27 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
28 | 26 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
29 | 27 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
30 | 28 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
... | ... | |
33 | 31 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
34 | 32 |
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput; |
35 | 33 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
36 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
37 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
38 | 34 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
39 | 35 |
|
40 | 36 |
/** |
... | ... | |
50 | 46 |
* @created 25.06.2009 |
51 | 47 |
* @version 1.0 |
52 | 48 |
*/ |
53 |
public class AnnotatedLineEditor extends TextEditor implements IConversationEnabled, IPostOperationEnabled, ICdmEntitySessionEnabled {
|
|
49 |
public class AnnotatedLineEditor extends TextEditor implements IConversationEnabled, IPostOperationEnabled { |
|
54 | 50 |
|
55 | 51 |
protected ConversationHolder conversation; |
56 | 52 |
|
57 | 53 |
private IEntityPersistenceService persistenceService; |
58 | 54 |
protected ILineDisplayStrategy lineDisplayStrategy; |
59 |
private final ICdmEntitySession cdmEntitySession; |
|
55 |
|
|
60 | 56 |
|
61 | 57 |
/** |
62 | 58 |
* <p>Constructor for AnnotatedLineEditor.</p> |
... | ... | |
65 | 61 |
*/ |
66 | 62 |
public AnnotatedLineEditor(ConversationHolder conversation) { |
67 | 63 |
this.conversation = conversation; |
68 |
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true); |
|
69 | 64 |
} |
70 | 65 |
|
71 | 66 |
/* (non-Javadoc) |
... | ... | |
265 | 260 |
if (getConversationHolder() != null) { |
266 | 261 |
getConversationHolder().bind(); |
267 | 262 |
} |
268 |
cdmEntitySession.bind();
|
|
263 |
((AbstractBulkEditorInput)getEditorInput()).bind();
|
|
269 | 264 |
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus(); |
270 | 265 |
// TODO pass focus to underlying widgets |
271 | 266 |
} |
... | ... | |
327 | 322 |
public void dispose() { |
328 | 323 |
super.dispose(); |
329 | 324 |
conversation.close(); |
330 |
cdmEntitySession.dispose();
|
|
325 |
((AbstractBulkEditorInput)getEditorInput()).dispose();
|
|
331 | 326 |
} |
332 | 327 |
|
333 | 328 |
/** |
... | ... | |
341 | 336 |
return false; |
342 | 337 |
} |
343 | 338 |
|
344 |
/* (non-Javadoc) |
|
345 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
346 |
*/ |
|
347 |
@Override |
|
348 |
public void onChange(CdmChangeEvent event) { |
|
349 |
// TODO Auto-generated method stub |
|
350 |
|
|
351 |
} |
|
352 |
|
|
353 |
/* (non-Javadoc) |
|
354 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() |
|
355 |
*/ |
|
356 |
@Override |
|
357 |
public ICdmEntitySession getCdmEntitySession() { |
|
358 |
return cdmEntitySession; |
|
359 |
} |
|
360 |
|
|
361 |
/* (non-Javadoc) |
|
362 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() |
|
363 |
*/ |
|
364 |
@Override |
|
365 |
public <T extends CdmBase> List<T> getRootEntities() { |
|
366 |
AbstractBulkEditorInput input = (AbstractBulkEditorInput)getEditorInput(); |
|
367 |
return input.getModel(); |
|
368 |
} |
|
369 | 339 |
|
370 | 340 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java | ||
---|---|---|
190 | 190 |
@Override |
191 | 191 |
public void setFocus() { |
192 | 192 |
conversation.bind(); |
193 |
getCdmEntitySession().bind(); |
|
194 | 193 |
searchBar.setFocus(); |
195 | 194 |
|
196 | 195 |
// TODO find a better place to put this - this dialog should be shown after initial contents of |
... | ... | |
199 | 198 |
displayWarningDialog(); |
200 | 199 |
isInitialFocus = false; |
201 | 200 |
} |
201 |
super.setFocus(); |
|
202 | 202 |
} |
203 | 203 |
|
204 | 204 |
/** |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java | ||
---|---|---|
34 | 34 |
import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.CdmBaseSortProvider; |
35 | 35 |
import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.TitleCacheComparator; |
36 | 36 |
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin; |
37 |
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput; |
|
37 | 38 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
38 | 39 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
39 | 40 |
|
... | ... | |
45 | 46 |
* @version 1.0 |
46 | 47 |
* @param <T> |
47 | 48 |
*/ |
48 |
public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEditorInput , IEntityPersistenceService<T> { |
|
49 |
public abstract class AbstractBulkEditorInput<T extends ICdmBase> extends CdmEntitySessionInput implements IEditorInput , |
|
50 |
IEntityPersistenceService<T> { |
|
49 | 51 |
|
50 | 52 |
private UUID entityUuid; |
51 | 53 |
|
... | ... | |
55 | 57 |
|
56 | 58 |
private static Class serviceClass; |
57 | 59 |
|
60 |
public AbstractBulkEditorInput() { |
|
61 |
|
|
62 |
} |
|
63 |
|
|
58 | 64 |
/** |
59 | 65 |
* <p>NewInstance</p> |
60 | 66 |
* |
... | ... | |
304 | 310 |
/** |
305 | 311 |
* @return |
306 | 312 |
*/ |
307 |
public List<?> getModel() {
|
|
313 |
public List<T> getModel() {
|
|
308 | 314 |
return model; |
309 | 315 |
} |
310 | 316 |
|
311 | 317 |
|
318 |
|
|
319 |
/* (non-Javadoc) |
|
320 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() |
|
321 |
*/ |
|
322 |
@Override |
|
323 |
public List<T> getRootEntities() { |
|
324 |
return getModel(); |
|
325 |
} |
|
312 | 326 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java | ||
---|---|---|
197 | 197 |
return false; |
198 | 198 |
} |
199 | 199 |
|
200 |
/* (non-Javadoc) |
|
201 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
202 |
*/ |
|
203 |
@Override |
|
204 |
public void merge() { |
|
205 |
|
|
206 |
} |
|
207 |
|
|
200 | 208 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java | ||
---|---|---|
111 | 111 |
return entity.getName(); |
112 | 112 |
} |
113 | 113 |
|
114 |
/* (non-Javadoc) |
|
115 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
116 |
*/ |
|
117 |
@Override |
|
118 |
public void merge() { |
|
119 |
|
|
120 |
} |
|
121 |
|
|
114 | 122 |
|
115 | 123 |
|
116 | 124 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameEditorInput.java | ||
---|---|---|
164 | 164 |
return (entity).getFullTitleCache(); |
165 | 165 |
} |
166 | 166 |
|
167 |
/* (non-Javadoc) |
|
168 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
169 |
*/ |
|
170 |
@Override |
|
171 |
public void merge() { |
|
172 |
|
|
173 |
} |
|
174 |
|
|
167 | 175 |
|
168 | 176 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameRelationshipEditorInput.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
30 | 30 |
public class NameRelationshipEditorInput extends AbstractBulkEditorInput<NameRelationship> { |
31 | 31 |
|
32 | 32 |
/** |
33 |
*
|
|
33 |
* |
|
34 | 34 |
*/ |
35 | 35 |
private static final long serialVersionUID = -7453923697752787687L; |
36 | 36 |
|
... | ... | |
50 | 50 |
} |
51 | 51 |
return instance; |
52 | 52 |
} |
53 |
|
|
53 |
|
|
54 | 54 |
/* (non-Javadoc) |
55 | 55 |
* @see org.eclipse.ui.IEditorInput#getName() |
56 | 56 |
*/ |
... | ... | |
105 | 105 |
/** {@inheritDoc} */ |
106 | 106 |
@Override |
107 | 107 |
protected NameRelationship loadEntity(UUID entityUuid) { |
108 |
List<String> propertyPaths = Arrays.asList(new String[]{});
|
|
108 |
List<String> propertyPaths = Arrays.asList(new String[]{}); |
|
109 | 109 |
return null; // CdmStore.getNameService().load(entityUuid, propertyPaths); |
110 | 110 |
} |
111 | 111 |
|
... | ... | |
117 | 117 |
MessagingUtils.notImplementedMessage(getClass()); |
118 | 118 |
return null; |
119 | 119 |
} |
120 |
|
|
120 |
|
|
121 | 121 |
/* (non-Javadoc) |
122 | 122 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object) |
123 | 123 |
*/ |
... | ... | |
126 | 126 |
if(entity instanceof NameRelationship){ |
127 | 127 |
return ((NameRelationship) entity).getType().getTitleCache(); |
128 | 128 |
} |
129 |
|
|
129 |
|
|
130 | 130 |
return super.getTypeText(entity); |
131 | 131 |
} |
132 | 132 |
|
133 |
/* (non-Javadoc) |
|
134 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
135 |
*/ |
|
136 |
@Override |
|
137 |
public void merge() { |
|
138 |
|
|
139 |
} |
|
140 |
|
|
133 | 141 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java | ||
---|---|---|
163 | 163 |
|
164 | 164 |
return sortProviders; |
165 | 165 |
} |
166 |
|
|
167 |
/* (non-Javadoc) |
|
168 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
169 |
*/ |
|
170 |
@Override |
|
171 |
public void merge() { |
|
172 |
|
|
173 |
} |
|
166 | 174 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java | ||
---|---|---|
178 | 178 |
return super.getTypeText(entity); |
179 | 179 |
} |
180 | 180 |
|
181 |
/* (non-Javadoc) |
|
182 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
183 |
*/ |
|
184 |
@Override |
|
185 |
public void merge() { |
|
186 |
|
|
187 |
} |
|
188 |
|
|
181 | 189 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/TaxonEditorInput.java | ||
---|---|---|
5 | 5 |
import java.util.List; |
6 | 6 |
import java.util.UUID; |
7 | 7 |
|
8 |
import eu.etaxonomy.cdm.api.service.INameService; |
|
9 | 8 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
10 | 9 |
import eu.etaxonomy.cdm.api.service.config.FindTaxaAndNamesConfiguratorImpl; |
11 | 10 |
import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator; |
12 | 11 |
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator; |
13 | 12 |
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException; |
14 | 13 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
15 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
16 | 14 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
17 | 15 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
18 | 16 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
19 | 17 |
import eu.etaxonomy.cdm.persistence.query.MatchMode; |
20 | 18 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; |
21 |
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.NameCreator; |
|
22 | 19 |
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.TaxonCreator; |
23 | 20 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
24 | 21 |
|
... | ... | |
122 | 119 |
return new TaxonCreator(); |
123 | 120 |
} |
124 | 121 |
|
122 |
|
|
123 |
/* (non-Javadoc) |
|
124 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
125 |
*/ |
|
126 |
@Override |
|
127 |
public void merge() { |
|
128 |
|
|
129 |
} |
|
130 |
|
|
125 | 131 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java | ||
---|---|---|
113 | 113 |
return String.format("%s, %s", entity.getUsername(), entity.getPerson()); |
114 | 114 |
} |
115 | 115 |
|
116 |
/* (non-Javadoc) |
|
117 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
118 |
*/ |
|
119 |
@Override |
|
120 |
public void merge() { |
|
121 |
|
|
122 |
} |
|
123 |
|
|
116 | 124 |
|
117 | 125 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java | ||
---|---|---|
33 | 33 |
import org.eclipse.swt.widgets.Table; |
34 | 34 |
import org.eclipse.ui.IWorkbenchPart; |
35 | 35 |
|
36 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
37 | 36 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
38 | 37 |
import eu.etaxonomy.cdm.api.service.IAgentService; |
39 | 38 |
import eu.etaxonomy.cdm.api.service.IGroupService; |
... | ... | |
314 | 313 |
selectionService.addSelectionListener(this); |
315 | 314 |
|
316 | 315 |
} |
317 |
|
|
318 |
/* (non-Javadoc) |
|
319 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
320 |
*/ |
|
321 |
@Override |
|
322 |
public void onChange(CdmChangeEvent event) { |
|
323 |
// TODO Auto-generated method stub |
|
324 |
|
|
325 |
} |
|
326 |
|
|
327 |
|
|
328 | 316 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java | ||
---|---|---|
44 | 44 |
logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl()); |
45 | 45 |
rir = super.doExecuteRequest(config, baos); |
46 | 46 |
if(rir.getValue() != null && !rir.hasException()) { |
47 |
if(currentRemoteInvocation.getMethodName().equals("merge")) { |
|
48 |
rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true)); |
|
49 |
} else if(rir.getValue() instanceof UpdateResult){ |
|
47 |
if(rir.getValue() instanceof UpdateResult){ |
|
50 | 48 |
UpdateResult result = (UpdateResult)rir.getValue(); |
51 | 49 |
if(result.isOk()){ |
52 |
cdmEntitySessionManager.load(result, true);
|
|
50 |
rir = new RemoteInvocationResult(cdmEntitySessionManager.load(result, true));
|
|
53 | 51 |
} |
54 | 52 |
} else { |
55 |
rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), false));
|
|
53 |
rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
|
|
56 | 54 |
} |
57 | 55 |
} |
58 | 56 |
cache(currentRemoteInvocation, rir); |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySession.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import org.apache.log4j.Logger; |
23 | 23 |
|
24 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
25 | 24 |
import eu.etaxonomy.cdm.api.service.IService; |
26 | 25 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
27 | 26 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
... | ... | |
62 | 61 |
this.changeObservers = new ArrayList<ICdmEntitySessionEnabled>(); |
63 | 62 |
this.newCdmEntities = new HashSet<CdmBase>(); |
64 | 63 |
cdmEntitySessionManager.addToOwnerSessionMap(sessionOwner, this); |
65 |
CdmApplicationState.getCurrentDataChangeService().register(sessionOwner); |
|
66 | 64 |
} |
67 | 65 |
|
68 | 66 |
|
... | ... | |
193 | 191 |
public void dispose() { |
194 | 192 |
|
195 | 193 |
cdmTransientEntityCacher.dispose(); |
196 |
// for(ICdmEntitySessionEnabled observer : changeObservers) { |
|
197 |
// CdmPostDataChangeObservableListener.getDefault().unregister(observer); |
|
198 |
// } |
|
199 | 194 |
changeObservers.clear(); |
200 | 195 |
cdmEntitySessionManager.remove(sessionOwner); |
201 |
CdmApplicationState.getCurrentDataChangeService().unregister(sessionOwner); |
|
196 |
|
|
202 | 197 |
} |
203 | 198 |
|
204 | 199 |
|
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionManager.java | ||
---|---|---|
89 | 89 |
} |
90 | 90 |
ICdmEntitySession session = ownerSessionMap.get(sessionOwner); |
91 | 91 |
if(session == null) { |
92 |
session = newSession(sessionOwner,true);
|
|
92 |
throw new CdmClientSessionException("Trying to bind session which does not exist");
|
|
93 | 93 |
} |
94 | 94 |
|
95 | 95 |
setActiveSession(session); |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionEnabled.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.Collection; |
4 | 4 |
|
5 |
import eu.etaxonomy.cdm.api.application.ICdmChangeListener; |
|
6 | 5 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
7 | 6 |
|
8 |
public interface ICdmEntitySessionEnabled extends ICdmChangeListener {
|
|
7 |
public interface ICdmEntitySessionEnabled { |
|
9 | 8 |
|
10 | 9 |
public ICdmEntitySession getCdmEntitySession(); |
11 | 10 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmEntitySessionInput.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.editor; |
|
11 |
|
|
12 |
import eu.etaxonomy.cdm.api.service.IService; |
|
13 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
14 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
15 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
16 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
17 |
|
|
18 |
/** |
|
19 |
* @author cmathew |
|
20 |
* @date 5 Feb 2015 |
|
21 |
* |
|
22 |
*/ |
|
23 |
public abstract class CdmEntitySessionInput implements ICdmEntitySessionEnabled { |
|
24 |
|
|
25 |
private final ICdmEntitySession cdmEntitySession; |
|
26 |
|
|
27 |
public CdmEntitySessionInput() { |
|
28 |
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true); |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 |
/* (non-Javadoc) |
|
33 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() |
|
34 |
*/ |
|
35 |
@Override |
|
36 |
public ICdmEntitySession getCdmEntitySession() { |
|
37 |
return cdmEntitySession; |
|
38 |
} |
|
39 |
|
|
40 |
public <T extends CdmBase> void update(IService<T> service, T cdmBase) { |
|
41 |
cdmEntitySession.remoteUpdate(service, cdmBase); |
|
42 |
} |
|
43 |
|
|
44 |
public abstract <T extends CdmBase> IService<T> getService(); |
|
45 |
|
|
46 |
public <T extends CdmBase> void update(T cdmBase) { |
|
47 |
cdmEntitySession.remoteUpdate(getService(), cdmBase); |
|
48 |
} |
|
49 |
|
|
50 |
|
|
51 |
public abstract <T extends CdmBase> void update(); |
|
52 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java | ||
---|---|---|
23 | 23 |
import org.eclipse.ui.PartInitException; |
24 | 24 |
import org.eclipse.ui.forms.editor.FormEditor; |
25 | 25 |
|
26 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
27 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
28 | 26 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
29 | 27 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
30 | 28 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
31 | 29 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
32 | 30 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
33 | 31 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
34 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
35 | 32 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
36 | 33 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; |
37 | 34 |
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; |
... | ... | |
45 | 42 |
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia; |
46 | 43 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
47 | 44 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
48 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
49 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
50 | 45 |
|
51 | 46 |
/** |
52 | 47 |
* |
... | ... | |
59 | 54 |
* @version 1.0 |
60 | 55 |
*/ |
61 | 56 |
public class MultiPageTaxonEditor extends FormEditor implements |
62 |
IPartContentHasFactualData, IConversationEnabled, ICdmEntitySessionEnabled, IPostOperationEnabled,
|
|
57 |
IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled, |
|
63 | 58 |
IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { |
64 | 59 |
|
65 | 60 |
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked}</code> */ |
... | ... | |
67 | 62 |
|
68 | 63 |
private boolean dirty; |
69 | 64 |
|
70 |
private ICdmEntitySession cdmEntitySession; |
|
71 | 65 |
private ConversationHolder conversation; |
72 | 66 |
private IDataChangeBehavior dataChangeBehavior; |
73 | 67 |
private IUndoContext undoContext; |
... | ... | |
88 | 82 |
/** {@inheritDoc} */ |
89 | 83 |
@Override |
90 | 84 |
public void dispose() { |
91 |
if(cdmEntitySession != null) { |
|
92 |
cdmEntitySession.dispose(); |
|
93 |
} |
|
85 |
input.dispose(); |
|
94 | 86 |
conversation.unregisterForDataStoreChanges(this); |
95 | 87 |
conversation.close(); |
96 | 88 |
super.dispose(); |
... | ... | |
107 | 99 |
input = (TaxonEditorInput) getEditorInput(); |
108 | 100 |
conversation = input.getConversationHolder(); |
109 | 101 |
conversation.registerForDataStoreChanges(this); |
110 |
CdmApplicationState.getCurrentDataChangeService().register(this); |
|
102 |
|
|
111 | 103 |
try { |
112 | 104 |
addPage(Page.NAME.getIndex(), new TaxonNameEditor(this), |
113 | 105 |
getEditorInput()); |
... | ... | |
152 | 144 |
|
153 | 145 |
// commit the conversation and start a new transaction immediately |
154 | 146 |
|
155 |
input.update();
|
|
147 |
input.merge();
|
|
156 | 148 |
conversation.commit(true); |
157 | 149 |
monitor.worked(1); |
158 | 150 |
|
... | ... | |
175 | 167 |
editorPage.setDisabled(); |
176 | 168 |
} |
177 | 169 |
} |
178 |
CdmApplicationState.getCurrentDataChangeService().unregister(this); |
|
170 |
|
|
179 | 171 |
conversation.unregisterForDataStoreChanges(this); |
180 | 172 |
conversation.close(); |
181 | 173 |
setDirty(false); |
... | ... | |
258 | 250 |
} |
259 | 251 |
|
260 | 252 |
this.input = (TaxonEditorInput) input; |
261 |
cdmEntitySession = this.input.getCdmEntitySession(); |
|
253 |
|
|
262 | 254 |
|
263 | 255 |
// try { |
264 | 256 |
// // Listen for name changes, |
... | ... | |
407 | 399 |
// logger.warn("Setting focus to editor"); |
408 | 400 |
// bind the conversation |
409 | 401 |
getConversationHolder().bind(); |
410 |
if(cdmEntitySession != null) { |
|
411 |
cdmEntitySession.bind(); |
|
412 |
} |
|
402 |
input.bind(); |
|
413 | 403 |
// pass focus to the active editor page |
414 | 404 |
getActiveEditor().setFocus(); |
415 | 405 |
} |
... | ... | |
567 | 557 |
return true; |
568 | 558 |
} |
569 | 559 |
|
570 |
/* (non-Javadoc) |
|
571 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() |
|
572 |
*/ |
|
573 |
@Override |
|
574 |
public ICdmEntitySession getCdmEntitySession() { |
|
575 |
return cdmEntitySession; |
|
576 |
} |
|
577 |
|
|
578 |
/* (non-Javadoc) |
|
579 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() |
|
580 |
*/ |
|
581 |
@Override |
|
582 |
public List<TaxonNode> getRootEntities() { |
|
583 |
return input.getRootEntities(); |
|
584 |
} |
|
585 |
|
|
586 |
/* (non-Javadoc) |
|
587 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
588 |
*/ |
|
589 |
@Override |
|
590 |
public void onChange(CdmChangeEvent event) { |
|
591 |
// TODO Auto-generated method stub |
|
592 |
|
|
593 |
} |
|
594 | 560 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java | ||
---|---|---|
20 | 20 |
import org.eclipse.ui.IMemento; |
21 | 21 |
import org.eclipse.ui.IPersistableElement; |
22 | 22 |
|
23 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
24 | 23 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
25 | 24 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
26 | 25 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
... | ... | |
49 | 48 |
* @created 19.03.2009 |
50 | 49 |
* @version 1.0 |
51 | 50 |
*/ |
52 |
public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled, IPersistableElement { |
|
51 |
public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled, IPersistableElement {
|
|
53 | 52 |
|
54 | 53 |
private final ConversationHolder conversation; |
55 | 54 |
|
... | ... | |
59 | 58 |
|
60 | 59 |
private TaxonBase initiallySelectedTaxonBase; |
61 | 60 |
|
62 |
private final ITaxonNodeService service; |
|
63 |
|
|
64 | 61 |
private enum CdmType { |
65 | 62 |
TAXON_NODE, |
66 | 63 |
TAXON_BASE, |
... | ... | |
69 | 66 |
|
70 | 67 |
private TaxonEditorInput(UUID uuid, CdmType type) { |
71 | 68 |
this.conversation = CdmStore.createConversation(); |
72 |
service = CdmStore.getService(ITaxonNodeService.class); |
|
73 | 69 |
switch(type) { |
74 | 70 |
case PARENT_TAXON_NODE: |
75 | 71 |
initForParentTaxonNode(uuid); |
... | ... | |
98 | 94 |
private void initForTaxonNode(UUID taxonNodeUuid) { |
99 | 95 |
|
100 | 96 |
|
101 |
TaxonNode taxonNode = getCdmEntitySession().remoteLoad(service,taxonNodeUuid, null);
|
|
97 |
TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid);
|
|
102 | 98 |
|
103 | 99 |
if(taxonNode == null){ |
104 | 100 |
MessagingUtils.warningDialog("Not yet implemented", TaxonEditorInput.class, "Selected element is not type TaxonBase."); |
... | ... | |
109 | 105 |
|
110 | 106 |
private void initForTaxonBase(UUID taxonBaseUuid) { |
111 | 107 |
|
112 |
TaxonBase taxonBase = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonService.class),taxonBaseUuid);
|
|
108 |
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid);
|
|
113 | 109 |
if (taxonBase != null){ |
114 | 110 |
if(taxonBase.isInstanceOf(Taxon.class)){ |
115 | 111 |
Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class); |
... | ... | |
156 | 152 |
TaxonNode newTaxonNode = parentNode.addChildTaxon(newTaxon, parentNode.getReference(), parentNode.getMicroReference()); |
157 | 153 |
|
158 | 154 |
// add the new taxon to the editors persistence context |
159 |
UUID newTaxonNodeUuid = getCdmEntitySession().remoteSave(CdmStore.getService(ITaxonNodeService.class),newTaxonNode);
|
|
155 |
UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode).getUuid();
|
|
160 | 156 |
|
161 | 157 |
initForTaxonNode(newTaxonNodeUuid); |
162 | 158 |
} |
... | ... | |
435 | 431 |
return initiallySelectedTaxonBase; |
436 | 432 |
} |
437 | 433 |
|
438 |
@Override |
|
439 |
public String toString() { |
|
440 |
return String.format("%s[%s]", this.getClass().getSimpleName(), getTaxon()); |
|
441 |
} |
|
442 |
|
|
443 |
/* (non-Javadoc) |
|
444 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#getService() |
|
445 |
*/ |
|
446 |
@Override |
|
447 |
public ITaxonNodeService getService() { |
|
448 |
return service; |
|
449 |
} |
|
434 |
// @Override |
|
435 |
// public String toString() { |
|
436 |
// return String.format("%s[%s]", this.getClass().getSimpleName(), getTaxon()); |
|
437 |
// } |
|
450 | 438 |
|
451 | 439 |
|
452 | 440 |
/* (non-Javadoc) |
453 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#getRootEntities()
|
|
441 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
|
|
454 | 442 |
*/ |
455 | 443 |
@Override |
456 |
public List<TaxonNode> getRootEntities() {
|
|
444 |
public List<TaxonNode> getRootEntities() { |
|
457 | 445 |
return Arrays.asList(taxonNode); |
458 | 446 |
} |
459 | 447 |
|
460 |
|
|
461 | 448 |
/* (non-Javadoc) |
462 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#update()
|
|
449 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
|
|
463 | 450 |
*/ |
464 | 451 |
@Override |
465 |
public <T extends CdmBase> void update() { |
|
466 |
taxonNode = getCdmEntitySession().remoteUpdate(service, taxonNode); |
|
467 |
} |
|
468 |
|
|
469 |
/* (non-Javadoc) |
|
470 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
471 |
*/ |
|
472 |
@Override |
|
473 |
public void onChange(CdmChangeEvent event) { |
|
474 |
// TODO Auto-generated method stub |
|
475 |
|
|
452 |
public void merge() { |
|
453 |
CdmStore.getService(ITaxonNodeService.class).merge(taxonNode); |
|
476 | 454 |
} |
477 | 455 |
|
478 | 456 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractIdentificationEditorInput.java | ||
---|---|---|
1 | 1 |
/** |
2 |
*
|
|
2 |
* |
|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.editor.key; |
5 | 5 |
|
... | ... | |
11 | 11 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
12 | 12 |
import eu.etaxonomy.cdm.model.description.IIdentificationKey; |
13 | 13 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
14 |
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput; |
|
14 | 15 |
|
15 | 16 |
/** |
16 | 17 |
* @author n.hoffmann |
17 |
*
|
|
18 |
* |
|
18 | 19 |
*/ |
19 | 20 |
public abstract class AbstractIdentificationEditorInput<T extends IIdentificationKey> |
20 |
implements IEditorInput, IConversationEnabled { |
|
21 |
extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled {
|
|
21 | 22 |
|
22 | 23 |
private final ConversationHolder conversation; |
23 | 24 |
|
... | ... | |
27 | 28 |
|
28 | 29 |
/* |
29 | 30 |
* (non-Javadoc) |
30 |
*
|
|
31 |
* |
|
31 | 32 |
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) |
32 | 33 |
*/ |
33 | 34 |
@Override |
... | ... | |
38 | 39 |
|
39 | 40 |
/* |
40 | 41 |
* (non-Javadoc) |
41 |
*
|
|
42 |
* |
|
42 | 43 |
* @see org.eclipse.ui.IEditorInput#exists() |
43 | 44 |
*/ |
44 | 45 |
@Override |
... | ... | |
48 | 49 |
|
49 | 50 |
/* |
50 | 51 |
* (non-Javadoc) |
51 |
*
|
|
52 |
* |
|
52 | 53 |
* @see org.eclipse.ui.IEditorInput#getImageDescriptor() |
53 | 54 |
*/ |
54 | 55 |
@Override |
... | ... | |
59 | 60 |
|
60 | 61 |
/* |
61 | 62 |
* (non-Javadoc) |
62 |
*
|
|
63 |
* |
|
63 | 64 |
* @see org.eclipse.ui.IEditorInput#getPersistable() |
64 | 65 |
*/ |
65 | 66 |
@Override |
... | ... | |
70 | 71 |
|
71 | 72 |
/* |
72 | 73 |
* (non-Javadoc) |
73 |
*
|
|
74 |
* |
|
74 | 75 |
* @see org.eclipse.ui.IEditorInput#getToolTipText() |
75 | 76 |
*/ |
76 | 77 |
@Override |
... | ... | |
80 | 81 |
|
81 | 82 |
/* |
82 | 83 |
* (non-Javadoc) |
83 |
*
|
|
84 |
* |
|
84 | 85 |
* @see org.eclipse.ui.IEditorInput#getName() |
85 | 86 |
*/ |
86 | 87 |
@Override |
... | ... | |
98 | 99 |
@Override |
99 | 100 |
public void update(CdmDataChangeMap changeEvents) { |
100 | 101 |
} |
101 |
|
|
102 |
|
|
102 | 103 |
/* (non-Javadoc) |
103 | 104 |
* @see java.lang.Object#equals(java.lang.Object) |
104 | 105 |
*/ |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.taxeditor.editor.key; |
12 | 12 |
|
13 |
import java.util.Arrays; |
|
14 |
import java.util.List; |
|
15 |
|
|
16 | 13 |
import org.eclipse.core.runtime.IProgressMonitor; |
17 | 14 |
import org.eclipse.ui.IEditorInput; |
18 | 15 |
import org.eclipse.ui.IEditorPart; |
... | ... | |
20 | 17 |
import org.eclipse.ui.PartInitException; |
21 | 18 |
import org.eclipse.ui.forms.editor.FormEditor; |
22 | 19 |
|
23 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
24 | 20 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
25 | 21 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
26 |
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService; |
|
27 | 22 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
28 | 23 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
29 | 24 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput; |
... | ... | |
33 | 28 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
34 | 29 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
35 | 30 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
36 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
37 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
38 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
39 | 31 |
|
40 | 32 |
/** |
41 | 33 |
* @author n.hoffmann |
... | ... | |
43 | 35 |
* @version 1.0 |
44 | 36 |
*/ |
45 | 37 |
public class KeyEditor extends FormEditor implements IConversationEnabled, |
46 |
IDirtyMarkable, IPartContentHasDetails, ICdmEntitySessionEnabled {
|
|
38 |
IDirtyMarkable, IPartContentHasDetails { |
|
47 | 39 |
|
48 | 40 |
public static final String ID = "eu.etaxonomy.taxeditor.editor.key"; |
49 | 41 |
|
... | ... | |
52 | 44 |
private boolean dirty; |
53 | 45 |
|
54 | 46 |
private KeyEditorDataChangeBehaviour dataChangeBehavior; |
55 |
private ICdmEntitySession cdmEntitySession; |
|
47 |
|
|
56 | 48 |
private PolytomousKeyEditorInput polytomousKeyEditorInput; |
57 | 49 |
|
58 | 50 |
/* |
... | ... | |
64 | 56 |
@Override |
65 | 57 |
public void init(IEditorSite site, IEditorInput input) |
66 | 58 |
throws PartInitException { |
67 |
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true); |
|
68 | 59 |
polytomousKeyEditorInput = (PolytomousKeyEditorInput)input; |
69 |
if(CdmStore.getCurrentSessionManager().isRemoting()) { |
|
70 |
polytomousKeyEditorInput.init(); |
|
71 |
} |
|
72 | 60 |
super.init(site, input); |
73 | 61 |
} |
74 | 62 |
|
... | ... | |
84 | 72 |
monitor.beginTask("Saving Editor", 1); |
85 | 73 |
getConversationHolder().bind(); |
86 | 74 |
getConversationHolder().commit(true); |
87 |
CdmStore.getService(IPolytomousKeyService.class).merge(((PolytomousKeyEditorInput)getEditorInput()).getKey());
|
|
75 |
polytomousKeyEditorInput.merge();
|
|
88 | 76 |
setDirty(false); |
89 | 77 |
monitor.worked(1); |
90 | 78 |
} finally { |
... | ... | |
115 | 103 |
@Override |
116 | 104 |
public void setFocus() { |
117 | 105 |
getConversationHolder().bind(); |
118 |
cdmEntitySession.bind();
|
|
106 |
polytomousKeyEditorInput.bind();
|
|
119 | 107 |
super.setFocus(); |
120 | 108 |
} |
121 | 109 |
/* |
... | ... | |
212 | 200 |
public void dispose() { |
213 | 201 |
conversation.unregisterForDataStoreChanges(this); |
214 | 202 |
conversation.close(); |
215 |
cdmEntitySession.dispose();
|
|
203 |
polytomousKeyEditorInput.dispose();
|
|
216 | 204 |
super.dispose(); |
217 | 205 |
} |
218 | 206 |
|
... | ... | |
248 | 236 |
PolytomousKey key = polytomousKeyEditorInput.getKey(); |
249 | 237 |
setPartName(key.getTitleCache()); |
250 | 238 |
} |
251 |
|
|
252 |
/* (non-Javadoc) |
|
253 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
254 |
*/ |
|
255 |
@Override |
|
256 |
public void onChange(CdmChangeEvent event) { |
|
257 |
// TODO Auto-generated method stub |
|
258 |
|
|
259 |
} |
|
260 |
|
|
261 |
/* (non-Javadoc) |
|
262 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() |
|
263 |
*/ |
|
264 |
@Override |
|
265 |
public ICdmEntitySession getCdmEntitySession() { |
|
266 |
return cdmEntitySession; |
|
267 |
} |
|
268 |
|
|
269 |
/* (non-Javadoc) |
|
270 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() |
|
271 |
*/ |
|
272 |
@Override |
|
273 |
public List<PolytomousKey> getRootEntities() { |
|
274 |
return Arrays.asList(polytomousKeyEditorInput.getKey()); |
|
275 |
} |
|
276 |
|
|
277 |
|
|
278 |
|
|
279 | 239 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.editor.key.polytomous; |
5 | 5 |
|
6 |
import java.util.Arrays; |
|
7 |
import java.util.List; |
|
6 | 8 |
import java.util.UUID; |
7 | 9 |
|
8 | 10 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
... | ... | |
36 | 38 |
this.name = name; |
37 | 39 |
} |
38 | 40 |
|
39 |
public void init() { |
|
40 |
this.key = CdmStore.getService(IPolytomousKeyService.class).load(keyUuid, null); |
|
41 |
} |
|
42 | 41 |
|
43 | 42 |
public static PolytomousKeyEditorInput NewInstance(UUID polytomousKeyUuid) throws Exception{ |
44 | 43 |
try{ |
... | ... | |
77 | 76 |
return super.equals(object); |
78 | 77 |
} |
79 | 78 |
|
79 |
/* (non-Javadoc) |
|
80 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() |
|
81 |
*/ |
|
82 |
@Override |
|
83 |
public List<PolytomousKey> getRootEntities() { |
|
84 |
return Arrays.asList(key); |
|
85 |
} |
|
86 |
|
|
87 |
/* (non-Javadoc) |
|
88 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
89 |
*/ |
|
90 |
@Override |
|
91 |
public void merge() { |
|
92 |
CdmStore.getService(IPolytomousKeyService.class).merge(key); |
|
93 |
} |
|
94 |
|
|
80 | 95 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java | ||
---|---|---|
42 | 42 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
43 | 43 |
import org.eclipse.ui.part.EditorPart; |
44 | 44 |
|
45 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
46 | 45 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
47 | 46 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
48 | 47 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
... | ... | |
74 | 73 |
import eu.etaxonomy.taxeditor.preference.Resources; |
75 | 74 |
import eu.etaxonomy.taxeditor.security.RequiredPermissions; |
76 | 75 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
77 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
78 | 76 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
79 | 77 |
|
80 | 78 |
/** |
... | ... | |
88 | 86 |
* @version 1.0 |
89 | 87 |
*/ |
90 | 88 |
public class TaxonNameEditor extends EditorPart implements |
91 |
IMultiPageTaxonEditorPage, IConversationEnabled, ICdmEntitySessionEnabled,
|
|
89 |
IMultiPageTaxonEditorPage, IConversationEnabled, |
|
92 | 90 |
IPartContentHasDetails, IPartChangeListener, |
93 | 91 |
ISelectionListener, IDropTargetable, ISecuredEditor { |
94 | 92 |
|
... | ... | |
950 | 948 |
setEnabled(enabled, background); |
951 | 949 |
} |
952 | 950 |
|
953 |
/* (non-Javadoc) |
|
954 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() |
|
955 |
*/ |
|
956 |
@Override |
|
957 |
public ICdmEntitySession getCdmEntitySession() { |
|
958 |
return editor.getCdmEntitySession(); |
|
959 |
} |
|
960 |
|
|
961 |
/* (non-Javadoc) |
|
962 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() |
|
963 |
*/ |
|
964 |
@Override |
|
965 |
public <T extends CdmBase> List<T> getRootEntities() { |
|
966 |
// TODO Auto-generated method stub |
|
967 |
return null; |
|
968 |
} |
|
969 |
|
|
970 |
/* (non-Javadoc) |
|
971 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
972 |
*/ |
|
973 |
@Override |
|
974 |
public void onChange(CdmChangeEvent event) { |
|
975 |
// TODO Auto-generated method stub |
|
976 |
|
|
977 |
} |
|
951 |
|
|
978 | 952 |
|
979 | 953 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java | ||
---|---|---|
25 | 25 |
import org.eclipse.ui.IWorkbenchActionConstants; |
26 | 26 |
import org.eclipse.ui.IWorkbenchPart; |
27 | 27 |
|
28 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
29 | 28 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; |
30 | 29 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
31 | 30 |
import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor; |
... | ... | |
139 | 138 |
super.changed(object); |
140 | 139 |
} |
141 | 140 |
|
142 |
/* (non-Javadoc) |
|
143 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
144 |
*/ |
|
145 |
@Override |
|
146 |
public void onChange(CdmChangeEvent event) { |
|
147 |
// TODO Auto-generated method stub |
|
148 |
|
|
149 |
} |
|
150 | 141 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java | ||
---|---|---|
17 | 17 |
import org.eclipse.zest.layouts.LayoutStyles; |
18 | 18 |
import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm; |
19 | 19 |
|
20 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
21 | 20 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; |
22 | 21 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
23 | 22 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
... | ... | |
124 | 123 |
return layoutAlgoritm; |
125 | 124 |
} |
126 | 125 |
|
127 |
/* (non-Javadoc) |
|
128 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
129 |
*/ |
|
130 |
@Override |
|
131 |
public void onChange(CdmChangeEvent event) { |
|
132 |
// TODO Auto-generated method stub |
|
133 |
|
|
134 |
} |
|
135 | 126 |
|
136 | 127 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java | ||
---|---|---|
31 | 31 |
import org.eclipse.ui.PartInitException; |
32 | 32 |
import org.eclipse.ui.part.EditorPart; |
33 | 33 |
|
34 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
35 | 34 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
36 | 35 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
37 | 36 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
... | ... | |
353 | 352 |
super.dispose(); |
354 | 353 |
} |
355 | 354 |
|
356 |
/* (non-Javadoc) |
|
357 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
358 |
*/ |
|
359 |
@Override |
|
360 |
public void onChange(CdmChangeEvent event) { |
|
361 |
// TODO Auto-generated method stub |
|
362 |
|
|
363 |
} |
|
364 |
|
|
365 | 355 |
/* (non-Javadoc) |
366 | 356 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() |
367 | 357 |
*/ |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java | ||
---|---|---|
45 | 45 |
import org.eclipse.ui.IWorkbenchPart; |
46 | 46 |
import org.eclipse.ui.PartInitException; |
47 | 47 |
|
48 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
49 | 48 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
50 | 49 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
51 | 50 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
... | ... | |
362 | 361 |
provider.toggleShowOnlyIndividualAssociations(); |
363 | 362 |
viewer.refresh(); |
364 | 363 |
} |
365 |
|
|
366 |
/* (non-Javadoc) |
|
367 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
368 |
*/ |
|
369 |
@Override |
|
370 |
public void onChange(CdmChangeEvent event) { |
|
371 |
// TODO Auto-generated method stub |
|
372 |
|
|
373 |
} |
|
374 | 364 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java | ||
---|---|---|
28 | 28 |
import org.eclipse.ui.IWorkbenchActionConstants; |
29 | 29 |
import org.eclipse.ui.IWorkbenchPart; |
30 | 30 |
|
31 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
32 | 31 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
33 | 32 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; |
34 | 33 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
... | ... | |
168 | 167 |
public boolean onComplete() { |
169 | 168 |
return true; |
170 | 169 |
} |
171 |
|
|
172 |
/* (non-Javadoc) |
|
173 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
174 |
*/ |
|
175 |
@Override |
|
176 |
public void onChange(CdmChangeEvent event) { |
|
177 |
// TODO Auto-generated method stub |
|
178 |
|
|
179 |
} |
|
180 | 170 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java | ||
---|---|---|
33 | 33 |
import org.eclipse.ui.handlers.IHandlerService; |
34 | 34 |
import org.eclipse.ui.part.ViewPart; |
35 | 35 |
|
36 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
36 | 37 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
37 | 38 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; |
39 |
import eu.etaxonomy.cdm.api.application.ICdmChangeListener; |
|
38 | 40 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
39 | 41 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
40 | 42 |
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService; |
... | ... | |
56 | 58 |
* |
57 | 59 |
*/ |
58 | 60 |
public class PolytomousKeyViewPart extends ViewPart implements |
59 |
IConversationEnabled, ICdmEntitySessionEnabled, IPostOperationEnabled { |
|
61 |
IConversationEnabled, ICdmEntitySessionEnabled, IPostOperationEnabled, |
|
62 |
ICdmChangeListener { |
|
60 | 63 |
|
61 | 64 |
private class FilterModifyListener implements ModifyListener{ |
62 | 65 |
@Override |
... | ... | |
201 | 204 |
conversation = CdmStore.createConversation(); |
202 | 205 |
conversation.registerForDataStoreChanges(this); |
203 | 206 |
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true); |
207 |
CdmApplicationState.getCurrentDataChangeService().register(this); |
|
204 | 208 |
|
205 | 209 |
List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null); |
206 | 210 |
if(!viewer.getControl().isDisposed()){ |
... | ... | |
252 | 256 |
if(cdmEntitySession != null) { |
253 | 257 |
cdmEntitySession.dispose(); |
254 | 258 |
} |
259 |
CdmApplicationState.getCurrentDataChangeService().unregister(this); |
|
255 | 260 |
super.dispose(); |
256 | 261 |
} |
257 | 262 |
|
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
32 | 32 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
33 |
import eu.etaxonomy.cdm.api.application.ICdmChangeListener; |
|
33 | 34 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
34 | 35 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
35 | 36 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
... | ... | |
59 | 60 |
* @version 1.0 |
60 | 61 |
*/ |
61 | 62 |
public class TaxonNavigator extends CommonNavigator implements |
62 |
IPostOperationEnabled, IConversationEnabled, Observer, ICdmEntitySessionEnabled { |
|
63 |
IPostOperationEnabled, IConversationEnabled, Observer, |
|
64 |
ICdmEntitySessionEnabled, ICdmChangeListener { |
|
63 | 65 |
|
64 | 66 |
/** |
65 | 67 |
* Constant |
... | ... | |
386 | 388 |
if(cdmEntitySession != null) { |
387 | 389 |
cdmEntitySession.dispose(); |
388 | 390 |
} |
391 |
CdmApplicationState.getCurrentDataChangeService().unregister(this); |
|
389 | 392 |
} |
390 | 393 |
|
391 | 394 |
/* |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveTaxonNodeHandler.java | ||
---|---|---|
19 | 19 |
import org.eclipse.core.runtime.Status; |
20 | 20 |
import org.eclipse.jface.dialogs.MessageDialog; |
21 | 21 |
import org.eclipse.jface.viewers.TreeSelection; |
22 |
import org.eclipse.swt.widgets.Shell; |
|
22 | 23 |
import org.eclipse.ui.handlers.HandlerUtil; |
23 | 24 |
|
24 | 25 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock; |
... | ... | |
80 | 81 |
*/ |
81 | 82 |
@Override |
82 | 83 |
public AbstractOperation prepareOperation(ExecutionEvent event) { |
84 |
Shell activeShell = HandlerUtil.getActiveShell(event); |
|
83 | 85 |
TaxonNode parentTaxonNode; |
84 | 86 |
|
85 | 87 |
List<UUID> excludeTaxa = new ArrayList<UUID>(); |
... | ... | |
88 | 90 |
boolean moveToNewParent = true; |
89 | 91 |
|
90 | 92 |
if (PreferencesUtil.getSortNodesNaturally()){ |
91 |
if(!MessageDialog.openQuestion(null, "Target node", "The choosen target node should be the parent?")){
|
|
93 |
if(!MessageDialog.openQuestion(activeShell, "Target node", "The choosen target node should be the parent?")){
|
|
92 | 94 |
moveToNewParent = false; |
93 | 95 |
} |
94 |
parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
|
|
96 |
parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell,
|
|
95 | 97 |
new ConversationHolderMock(), |
96 | 98 |
"Choose the taxon above the moved taxon.", |
97 | 99 |
excludeTaxa, |
98 | 100 |
null, |
99 | 101 |
null); |
100 | 102 |
} else { |
101 |
parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
|
|
103 |
parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell,
|
|
102 | 104 |
new ConversationHolderMock(), |
103 | 105 |
"Choose new parent", |
104 | 106 |
excludeTaxa, |
105 | 107 |
null, |
106 | 108 |
null); |
107 | 109 |
} |
110 |
|
|
111 |
|
|
108 | 112 |
if(parentTaxonNode != null){ |
109 | 113 |
if(NavigationUtil.isDirty(parentTaxonNode)){ |
110 |
MessageDialog.openWarning(HandlerUtil.getActiveShell(event),
|
|
114 |
MessageDialog.openWarning(activeShell,
|
|
111 | 115 |
"Unsaved Parent Taxon", |
112 | 116 |
"There are unsaved changes in the parent taxon. Please save first."); |
113 | 117 |
return null; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/CdmEntitySessionInput.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.editor; |
|
11 |
|
|
12 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
13 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
14 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
15 |
|
|
16 |
/** |
|
17 |
* @author cmathew |
|
18 |
* @date 5 Feb 2015 |
|
19 |
* |
|
20 |
*/ |
|
21 |
public abstract class CdmEntitySessionInput implements ICdmEntitySessionEnabled { |
|
22 |
|
|
23 |
private final ICdmEntitySession cdmEntitySession; |
|
24 |
|
|
25 |
public CdmEntitySessionInput() { |
|
26 |
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true); |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
public ICdmEntitySession getCdmEntitySession() { |
|
31 |
return cdmEntitySession; |
|
32 |
} |
|
33 |
|
|
34 |
public void bind() { |
|
35 |
cdmEntitySession.bind(); |
|
36 |
} |
|
37 |
|
|
38 |
public void dispose() { |
|
39 |
cdmEntitySession.dispose(); |
|
40 |
} |
|
41 |
|
|
42 |
public abstract void merge(); |
|
43 |
|
|
44 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermEditor.java | ||
---|---|---|
36 | 36 |
import org.eclipse.ui.PartInitException; |
37 | 37 |
import org.eclipse.ui.part.EditorPart; |
38 | 38 |
|
39 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
40 | 39 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
41 | 40 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
42 | 41 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
... | ... | |
276 | 275 |
super.dispose(); |
277 | 276 |
} |
278 | 277 |
|
279 |
/* (non-Javadoc) |
|
280 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
281 |
*/ |
|
282 |
@Override |
|
283 |
public void onChange(CdmChangeEvent event) { |
|
284 |
// TODO Auto-generated method stub |
|
285 |
|
|
286 |
} |
|
287 |
|
|
288 | 278 |
/* (non-Javadoc) |
289 | 279 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() |
290 | 280 |
*/ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/RemotingCdmHandler.java | ||
---|---|---|
55 | 55 |
|
56 | 56 |
switch(status.getSeverity()) { |
57 | 57 |
case IStatus.WARNING: |
58 |
MessagingUtils.warningDialog("Operation successful but with warnings", null, status);
|
|
58 |
ErrorDialog.openError(null, "Operation successful but with warnings", null, status);
|
|
59 | 59 |
break; |
60 | 60 |
case IStatus.ERROR: |
61 | 61 |
ErrorDialog.openError(null, "Error executing operation", null, status); |
Also available in: Unified diff
Update ICdmEntitySessionEnabled to no longer extend ICdmChangeListener