import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.MediaEditorInput;
-import eu.etaxonomy.taxeditor.bulkeditor.input.NameEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.IBulkEditor;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
private BulkEditorQuery lastQuery = null;
private BulkEditorComposite bulkEditorComposite;
-
+
private Set<AbstractPostOperation> operations = new HashSet<>();
@Inject
String operationlabel = entry.getLabel();
try {
entry.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
-
+
status = entry.execute(new NullProgressMonitor(), uiInfoAdapter);
} catch (ExecutionException e) {
MessagingUtils.operationDialog(AbstractUtility.class, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
if (lastQuery != null){
bulkEditorComposite.performSearch(lastQuery, selection);
}
-
+
}
return new StructuredSelection(this.bulkEditorComposite.getLastSelectedObject());
}
- @Focus
+ @Override
+ @Focus
public void setFocus() {
//make sure to bind again if maybe in another view the conversation was unbound
if(conversation!=null && !conversation.isBound()){
return bulkEditorComposite.getCellSelection();
}
+ @Override
public void setSelection(IStructuredSelection selection){
bulkEditorComposite.setSelection(selection);
}
}else if (element instanceof Media && input instanceof MediaEditorInput){
getEditorInput().addSaveCandidate((Media)element);
input.replaceInModel((Media)element);
- }else if (element instanceof Media ) {
+ }else if (element instanceof Media ) {
IStructuredSelection sel = getSelection();
Object firstElement = sel.getFirstElement();
if (firstElement instanceof TaxonBase){
SpecimenOrObservationBase changedSpecimen = (SpecimenOrObservationBase)sel.getFirstElement();
getEditorInput().addSaveCandidate(changedSpecimen);
input.replaceInModel(changedSpecimen);
- }
+ }
}else if(element instanceof Group){
Group oldGroup = ((GroupEditorInput)input).getEntityFromModel((Group)element);
((GroupEditorInput)input).getSaveUserCandidates().addAll(oldGroup.getMembers());
getEditorInput().addSaveCandidate(taxon);
input.replaceInModel(taxon);
}
-
+
}
else{
getEditorInput().addSaveCandidate((CdmBase)element);
+/**
+ * Copyright (C) 2007 EDIT
+ * 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.session;
import java.util.Collection;
partService.activate(part, true);
return;
}
-
}
}
if (alreadyOpenInOtherClassification != null){
public static void showMedia(EModelService modelService, EPartService partService) {
String partIdFactualData = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4;
showPart(partIdFactualData, modelService, partService);
-
}
public static void showFacts(EModelService modelService, EPartService partService) {
String partIdFactualData = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4;
showPart(partIdFactualData, modelService, partService);
-
}
public static Collection<MPart> checkForChanges(UUID taxonUUID, EPartService partService ){
}
init(taxonNode);
setInitiallySelectedTaxonBase(getTaxon());
-
}
private void initForTaxonBase(UUID taxonBaseUuid) {
}
}
-
private void initForParentTaxonNode(UUID parentNodeUuid){
this.getCdmEntitySession().bind();
TaxonName name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);
public static TaxonEditorInputE4 NewInstance(UUID taxonNodeUuid) {
return new TaxonEditorInputE4(taxonNodeUuid, CdmType.TAXON_NODE);
-
}
public static TaxonEditorInputE4 NewInstanceFromTaxonBase(UUID taxonBaseUuid){
* @author pplitzner
* @date Aug 24, 2017
*/
-public class TaxonNameEditorE4 implements IConversationEnabled, IDirtyMarkable, IPartContentHasDetails,
- IPartContentHasSupplementalData, IPartContentHasMedia, IPartContentHasFactualData, IPartChangeListener,
- ISelectionListener, ISecuredEditor, IE4SavablePart, ITaxonEditor, IDropTargetableE4 {
+public class TaxonNameEditorE4
+ implements IConversationEnabled, IDirtyMarkable, IPartContentHasDetails,
+ IPartContentHasSupplementalData, IPartContentHasMedia, IPartContentHasFactualData, IPartChangeListener,
+ ISelectionListener, ISecuredEditor, IE4SavablePart, ITaxonEditor, IDropTargetableE4 {
private Taxon taxon;
@Override
public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
- if(activePart==thisPart){
+ if(activePart == thisPart){
return;
}
Object partObject = createPartObject(activePart);
- if ((partObject instanceof DetailsPartE4 && !(selection instanceof TaxonName))|| partObject instanceof SupplementalDataPartE4
- || partObject instanceof MediaViewPartE4 || partObject instanceof ConceptViewPartE4 || ((partObject instanceof AbstractCdmEditorPartE4) &&(((AbstractCdmEditorPartE4)partObject).getViewer().getInput() instanceof DescriptionElementBase))) {
+ if ( (partObject instanceof DetailsPartE4 && !(selection instanceof TaxonName))
+ || partObject instanceof SupplementalDataPartE4
+ || partObject instanceof MediaViewPartE4
+ || partObject instanceof ConceptViewPartE4
+ || ((partObject instanceof AbstractCdmEditorPartE4) &&(((AbstractCdmEditorPartE4)partObject).getViewer().getInput() instanceof DescriptionElementBase))) {
// do not show empty page as these views are also used to edit the
// description selected in this view
return;
StructuredSelection selection = new StructuredSelection(object);
viewer.setSelection(selection, true);
}
-
+
}
return mockCdmEntitySessionManager;
}
}
- public static ICdmEntitySessionManager getCurrentSessionManager() {
+ public static ICdmEntitySessionManager getCurrentSessionManager() {
return getCurrentSessionManager(false);
}
public static ICdmEntitySessionManager getCurrentSessionManager(boolean connecting) {
- if (getDefault(connecting) != null) {
- return getDefault(connecting).getSessionManager();
+ CdmStore cdmStore = getDefault(connecting);
+ if (cdmStore != null) {
+ return cdmStore.getSessionManager();
}
return null;
}
private static final Logger logger = LogManager.getLogger(AbstractCdmEditorPartE4.class);
private DelaySelection delaySelection = null;
+
/**
* This is the monitor for the DelaySelection runnable.
* If it is <code>true</code> then it is currently delaying a selection.
@Optional@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
@Optional@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MPart thisPart, UISynchronize sync, EPartService partService){
+
//multiple selections are not supported
- if(activePart!=null
- && thisPart!=null
+ if(activePart != null
+ && thisPart != null
&& !activePart.equals(thisPart)
&& selection instanceof IStructuredSelection
&& ((IStructuredSelection) selection).size()>1){
showEmptyPage();
return;
}
+
// no active editor found
- if(activePart==thisPart && WorkbenchUtility.getActiveEditorPart(partService)==null && showEmptyIfNoActiveEditor()){
+ if(activePart == thisPart && WorkbenchUtility.getActiveEditorPart(partService) == null && showEmptyIfNoActiveEditor()){
showEmptyPage();
return;
}
+
if (viewer != null && viewer.getControl()!= null && viewer.getInput() != null && !viewer.getControl().isDisposed()){
try{
viewer.getControl().setEnabled(isEnabled);
}
}
- if((previousSelection!=null && selection!=null)
- && (activePart != null && selectionProvidingPart != null && activePart.equals(selectionProvidingPart))
- && (previousSelection==selection
+ //same as previous selection? => 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){
+ if(delaySelection == null){
delaySelection = new DelaySelection(selection, activePart, thisPart);
}else{
delaySelection.setSelection(selection);
}
}
}
-
}
protected Object createPartObject(MPart activePart) {
/**
* @author cmathew
* @date 15 Jun 2015
- *
*/
public class MockConversationEnabled implements IConversationEnabled {
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
- */
@Override
public void update(CdmDataChangeMap arg0) {
// TODO Auto-generated method stub
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
- */
@Override
public ConversationHolder getConversationHolder() {
return new ConversationHolderMock();
}
-
-}
+}
\ No newline at end of file