From: Cherian Mathew Date: Mon, 7 Sep 2015 13:29:56 +0000 (+0200) Subject: #5052 Integrate remoting in granted authorites editor X-Git-Tag: remoting-3.9.0~29 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/4a34b657dae80e32f11420cffd379679eee91ee4 #5052 Integrate remoting in granted authorites editor --- diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java index a5bf4e6be..5c697e7f3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java @@ -66,6 +66,7 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl @Override public void setFocus() { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus(); + ((CdmAuthorityEditorInput) getEditorInput()).bind(); } /* (non-Javadoc) @@ -76,6 +77,7 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl try { monitor.beginTask("Saving CDM Authority Editor", 1); getConversationHolder().commit(true); + ((CdmAuthorityEditorInput) getEditorInput()).merge(); dirty = false; firePropertyChange(PROP_DIRTY); monitor.worked(1); @@ -172,6 +174,7 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl public void dispose() { conversation.unregisterForDataStoreChanges(this); conversation.close(); + ((CdmAuthorityEditorInput) getEditorInput()).getCdmEntitySession().dispose(); super.dispose(); } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditorInput.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditorInput.java index 0e2553a51..92b9ec996 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditorInput.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditorInput.java @@ -1,13 +1,15 @@ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ package eu.etaxonomy.taxeditor.editor.group.authority; +import java.util.Arrays; +import java.util.Collection; import java.util.UUID; import org.eclipse.jface.resource.ImageDescriptor; @@ -19,39 +21,40 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; import eu.etaxonomy.cdm.api.service.IGroupService; import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; +import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput; import eu.etaxonomy.taxeditor.store.CdmStore; /** * Editor input for the {@link CdmAuthorityEditor}. - * + * * @author cmathew * @created Mar 28, 2013 * */ -public class CdmAuthorityEditorInput implements IEditorInput, IConversationEnabled { +public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled { private ConversationHolder conversation; private Group group; - + protected CdmAuthorityEditorInput(ConversationHolder conversation, Group group) { this.conversation = conversation; this.group = group; - + } - + /** * Creates a new instance of the input for a given group. - * + * * @param groupUuid * @return * @throws Exception */ public static CdmAuthorityEditorInput NewInstance(UUID groupUuid) throws Exception{ ConversationHolder conversation = CdmStore.createConversation(); - Group group = CdmStore.getService(IGroupService.class).load(groupUuid, null); + Group group = CdmStore.getService(IGroupService.class).load(groupUuid, null); return new CdmAuthorityEditorInput(conversation, group); } - + /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ @@ -59,8 +62,8 @@ public class CdmAuthorityEditorInput implements IEditorInput, IConversationEnabl public Object getAdapter(Class adapter) { if (adapter == Group.class) { return this.group; - } - + } + return null; } /* (non-Javadoc) @@ -69,7 +72,7 @@ public class CdmAuthorityEditorInput implements IEditorInput, IConversationEnabl @Override public void update(CdmDataChangeMap changeEvents) { // TODO Auto-generated method stub - + } /* (non-Javadoc) * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder() @@ -114,8 +117,8 @@ public class CdmAuthorityEditorInput implements IEditorInput, IConversationEnabl @Override public String getToolTipText() { return getName(); - } - + } + /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @@ -129,13 +132,29 @@ public class CdmAuthorityEditorInput implements IEditorInput, IConversationEnabl } return super.equals(object); } - + /** * Getter method for group member. - * + * * @return */ public Group getGroup() { return this.group; } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() + */ + @Override + public Collection getRootEntities() { + return Arrays.asList(group); + } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() + */ + @Override + public void merge() { + CdmStore.getService(IGroupService.class).merge(group); + } }