2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.editor
.group
.authority
;
11 import java
.util
.UUID
;
13 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
14 import org
.eclipse
.ui
.IEditorInput
;
15 import org
.eclipse
.ui
.IPersistableElement
;
17 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
18 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
19 import eu
.etaxonomy
.cdm
.api
.service
.IGroupService
;
20 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
21 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.CdmDataChangeMap
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 * Editor input for the {@link CdmAuthorityEditor}.
28 * @created Mar 28, 2013
32 public class CdmAuthorityEditorInput
implements IEditorInput
, IConversationEnabled
{
33 private ConversationHolder conversation
;
36 protected CdmAuthorityEditorInput(ConversationHolder conversation
, Group group
) {
37 this.conversation
= conversation
;
43 * Creates a new instance of the input for a given group.
49 public static CdmAuthorityEditorInput
NewInstance(UUID groupUuid
) throws Exception
{
50 ConversationHolder conversation
= CdmStore
.createConversation();
51 Group group
= CdmStore
.getService(IGroupService
.class).load(groupUuid
, null);
52 return new CdmAuthorityEditorInput(conversation
, group
);
56 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
59 public Object
getAdapter(Class adapter
) {
60 if (adapter
== Group
.class) {
67 * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
70 public void update(CdmDataChangeMap changeEvents
) {
71 // TODO Auto-generated method stub
75 * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
78 public ConversationHolder
getConversationHolder() {
79 return this.conversation
;
82 * @see org.eclipse.ui.IEditorInput#exists()
85 public boolean exists() {
89 * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
92 public ImageDescriptor
getImageDescriptor() {
93 // TODO Auto-generated method stub
97 * @see org.eclipse.ui.IEditorInput#getName()
100 public String
getName() {
101 return group
.getName();
104 * @see org.eclipse.ui.IEditorInput#getPersistable()
107 public IPersistableElement
getPersistable() {
108 // TODO Auto-generated method stub
112 * @see org.eclipse.ui.IEditorInput#getToolTipText()
115 public String
getToolTipText() {
120 * @see java.lang.Object#equals(java.lang.Object)
123 public boolean equals(Object object
) {
124 if (object
instanceof CdmAuthorityEditorInput
125 && getGroup() != null
126 && getGroup().equals(((CdmAuthorityEditorInput
) object
).getGroup())
130 return super.equals(object
);
134 * Getter method for group member.
138 public Group
getGroup() {