import java.io.FileOutputStream;
import java.io.IOException;
+ import java.util.List;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.common.CdmBase;
+ import eu.etaxonomy.cdm.model.common.Group;
+ import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+ import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
+ import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
+ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
@Optional
@Inject
private void updateAfterSearch(@UIEventTopic(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED)IStructuredSelection selection){
+
+
if(selection!=null){
setSelection(selection);
}
getEditorInput().addSaveCandidate(changedTaxon);
input.replaceInModel(changedTaxon);
}
+ }else if(element instanceof Group){
+ Group oldGroup = ((GroupEditorInput)input).getEntityFromModel((Group)element);
+ ((GroupEditorInput)input).getSaveUserCandidates().addAll(oldGroup.getMembers());
+ getEditorInput().addSaveCandidate((Group)element);
+ input.replaceInModel((CdmBase) element);
}else{
getEditorInput().addSaveCandidate((CdmBase)element);
input.replaceInModel((CdmBase) element);
return null;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void update() {
+ input.performSearch(lastQuery, getSelection());
+ }
+
+ @Override
+ public void addOperation(AbstractPostOperation operation) {
+ // operations not yet used for bulk editor
+ }
+
+ @Inject
+ @Optional
+ private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_NAME_EDITOR) List<CdmBase> cdmBases) {
+ if (getEditorInput() instanceof TaxonEditorInput){
+ for (CdmBase cdmBase: cdmBases){
+ if (getEditorInput().getModel().contains(cdmBase)){
+ input.performSearch(lastQuery, getSelection());
+ break;
+ }
+ }
+ }
+ }
+
+ @Inject
+ @Optional
+ private void updatefromDelete(@UIEventTopic(WorkbenchEventConstants.REMOVE_USER) User user) {
+ if (input instanceof GroupEditorInput){
+ ((GroupEditorInput)input).getSaveUserCandidates().add(user);
+ }
+ }
+
}
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
- import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+ import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
+ import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsViewerE4;
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
* If it is <code>true</code> then it is currently delaying a selection.
*/
private boolean isInDelay;
+ private boolean isEnabled;
private static final Logger logger = Logger.getLogger(AbstractCdmEditorPartE4.class);
/**
protected Object previousSelection;
- public Object getPreviousSelection() {
- return previousSelection;
- }
-
- public void setPreviousSelection(Object previousSelection) {
- this.previousSelection = previousSelection;
- }
-
protected ISelectionChangedListener selectionChangedListener;
public ISelectionChangedListener getSelectionChangedListener() {
showEmptyPage();
return;
}
+ // no active editor found
if(activePart==thisPart && WorkbenchUtility.getActiveEditorPart(partService)==null){
showEmptyPage();
return;
}
- if(previousSelection!=null){
- if(previousSelection==selection || previousSelection.equals(selection)){
- return;
- }
- else if(previousSelection instanceof ISelection &&
- previousSelection.equals(selection)){//skip redundant rendering of details view
- return;
- }
+ if((previousSelection!=null && selection!=null) && (activePart != null && selectionProvidingPart != null && activePart.equals(selectionProvidingPart)) &&
+ (previousSelection==selection
+ || previousSelection.equals(selection)
+ || new StructuredSelection(selection).equals(previousSelection))
+ ) {
+ return;
}
if(delaySelection==null){
delaySelection = new DelaySelection(selection, activePart, thisPart);
else if(element instanceof TermVocabularyDto){
element = CdmStore.getService(IVocabularyService.class).load(((TermVocabularyDto) element).getUuid());
}
+
+ selectionProvidingPart = activePart;
if (viewer instanceof DetailsViewerE4){
((DetailsViewerE4)viewer).setInput(element, part);
((DetailsViewerE4)viewer).setDetailsEnabled(true);
+
}
+
else{
+ if (activePart.getObject() instanceof DetailsPartE4 && element instanceof TaxonName){
+ selectionProvidingPart = ((DetailsPartE4)activePart.getObject()).getSelectionProvidingPart();
+ }
viewer.setInput(element);
}
- selectionProvidingPart = activePart;
}
}
}