import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorPart;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
/**
}
}
+ protected Object createPartObject(MPart activePart) {
+ Object partObject = activePart;
+ Object wrappedPart = WorkbenchUtility.getE4WrappedPart(activePart);
+ if(wrappedPart!=null){
+ partObject = wrappedPart;
+ }
+ return partObject;
+ }
+
+ protected IStructuredSelection createSelection(Object selection) {
+ if(selection==null){
+ return null;
+ }
+ IStructuredSelection structuredSelection;
+ if(!(selection instanceof IStructuredSelection)){
+ structuredSelection = new StructuredSelection(selection);
+ }
+ else{
+ structuredSelection = (IStructuredSelection) selection;
+ }
+ return structuredSelection;
+ }
+
public void showEmptyPage() {
if(viewer!=null){
viewer.showEmptyPage();
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Composite;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* @author pplitzner
if(activePart==thisPart){
return;
}
- if(selection==null){
- showEmptyPage();
- return;
- }
- Object partObject = activePart;
- Object wrappedPart = WorkbenchUtility.getE4WrappedPart(activePart);
- if(wrappedPart!=null){
- partObject = wrappedPart;
- }
-
- IStructuredSelection structuredSelection;
- if(!(selection instanceof IStructuredSelection)){
- structuredSelection = new StructuredSelection(selection);
- }
- else{
- structuredSelection = (IStructuredSelection) selection;
- }
+ IStructuredSelection structuredSelection = createSelection(selection);
if(structuredSelection.isEmpty()){
showEmptyPage();
return;
}
+
+ Object partObject = createPartObject(activePart);
+
if(partObject instanceof IPartContentHasDetails){
if(partObject instanceof IConversationEnabled && ((IConversationEnabled) partObject).getConversationHolder()==null) {
//TODO show specific message (refactor EmptyElement to allow specific messages)
// do not show details for feature nodes TODO strange check to avoid having shown the distribution map for every FeatureNodeContainer
if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){
// do show the map for distributions
- Feature feature = ((FeatureNodeContainer) ((IStructuredSelection) selection).getFirstElement()).getFeature();
+ Feature feature = ((FeatureNodeContainer) structuredSelection.getFirstElement()).getFeature();
if(!feature.equals(Feature.DISTRIBUTION())){
showEmptyPage();
return;
}
}
-
@Override
protected String getViewName(){
return Messages.DetailsViewPart_VIEWER_NAME;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.part.EditorPart;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
if(activePart==thisPart){
return;
}
- if(selection==null){
- showEmptyPage();
- return;
- }
-
- Object partObject = activePart;
- Object wrappedPart = WorkbenchUtility.getE4WrappedPart(partObject);
- if(wrappedPart!=null){
- partObject = wrappedPart;
- }
- IStructuredSelection structuredSelection;
- if(!(selection instanceof IStructuredSelection)){
- structuredSelection = new StructuredSelection(selection);
- }
- else{
- structuredSelection = (IStructuredSelection) selection;
- }
+ IStructuredSelection structuredSelection = createSelection(selection);
if(structuredSelection.isEmpty()){
showEmptyPage();
return;
}
- if((partObject instanceof EditorPart || partObject instanceof IPartContentHasSupplementalData)) {
+ Object partObject = createPartObject(activePart);
+
+ if(partObject instanceof IPartContentHasSupplementalData) {
if(structuredSelection.size() != 1){
showEmptyPage();
return;