import org.eclipse.ui.IMemento;
import org.eclipse.ui.part.ViewPart;
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.store.CdmStore;
public static final String ID = "eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView";
private DerivateSearchCompositeController derivateSearchCompositeController;
+ private ConversationHolder conversationHolder;
/**
* Constructs a new DerivateSearchView and registers it to listen to context changes
@Override
public void setFocus() {
derivateSearchCompositeController.setFocus();
+ //make sure to bind again if maybe in another view the conversation was unbound
+ if(getConversationHolder()!=null && !getConversationHolder().isBound()){
+ getConversationHolder().bind();
+ }
}
/* (non-Javadoc)
*/
@Override
public void contextRefresh(IProgressMonitor monitor) {
+ initConversation();
+ }
+
+ private void initConversation(){
+ if(conversationHolder==null){
+ conversationHolder = CdmStore.createConversation();
+ }
}
/* (non-Javadoc)
*/
@Override
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
+ if(getConversationHolder()!=null){
+ getConversationHolder().close();
+ }
+ }
+
+ /**
+ * @return the conversationHolder
+ */
+ public ConversationHolder getConversationHolder() {
+ if(CdmStore.isActive() && conversationHolder==null){
+ initConversation();
+ }
+ return conversationHolder;
}
}