4 package eu
.etaxonomy
.taxeditor
.editor
.key
.polytomous
;
8 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
9 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyService
;
10 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
11 import eu
.etaxonomy
.taxeditor
.editor
.key
.AbstractIdentificationEditorInput
;
12 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySession
;
13 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
14 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
20 public class PolytomousKeyEditorInput
extends AbstractIdentificationEditorInput
<PolytomousKey
> implements ICdmEntitySessionEnabled
{
22 private final PolytomousKey key
;
23 private final ICdmEntitySession cdmEntitySession
;
25 protected PolytomousKeyEditorInput(ConversationHolder conversation
,
28 cdmEntitySession
= CdmStore
.getCurrentSessionManager().newSession(this, true);
35 public static PolytomousKeyEditorInput
NewInstance(UUID polytomousKeyUuid
) throws Exception
{
37 ConversationHolder conversation
= CdmStore
.createConversation();
39 return NewInstance(polytomousKeyUuid
, conversation
);
45 public static PolytomousKeyEditorInput
NewInstance(UUID polytomousKeyUuid
, ConversationHolder conversation
) throws Exception
{
46 PolytomousKey polytomousKey
= CdmStore
.getService(IPolytomousKeyService
.class).load(polytomousKeyUuid
, null);
48 return new PolytomousKeyEditorInput(conversation
, polytomousKey
);
52 * @see org.eclipse.ui.IEditorInput#getName()
55 public String
getName() {
56 return key
.getTitleCache();
60 public PolytomousKey
getKey() {
65 * @see java.lang.Object#equals(java.lang.Object)
68 public boolean equals(Object object
) {
69 if (object
instanceof PolytomousKeyEditorInput
71 && getKey().equals(((PolytomousKeyEditorInput
) object
).getKey())
75 return super.equals(object
);
78 public void dispose() {
79 CdmStore
.getCurrentSessionManager().dispose(this);
85 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
88 public ICdmEntitySession
getCdmEntitySession() {
89 return cdmEntitySession
;