import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.editor.view.concept.ConceptContentProvider;
import eu.etaxonomy.taxeditor.editor.view.concept.ConceptLabelProvider;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
+import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
Object partObject = createPartObject(activePart);
- if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4) {
+ if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4
+ || partObject instanceof FactualDataPartE4|| partObject instanceof MediaViewPartE4) {
// do not show empty page as these views are also used to edit the
// description selected in this view
return;
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
+import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragListener;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;
Object partObject = createPartObject(activePart);
if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4
- || partObject instanceof MediaViewPartE4) {
+ || partObject instanceof MediaViewPartE4 || partObject instanceof ConceptViewPartE4) {
// do not show empty page as these views are also used to edit the
// description selected in this view
return;
import eu.etaxonomy.cdm.model.description.IDescribable;
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.media.MediaContentProvider;
import eu.etaxonomy.taxeditor.editor.view.media.MediaLabelProvider;
Object partObject = createPartObject(activePart);
if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4
- || partObject instanceof FactualDataPartE4) {
+ || partObject instanceof FactualDataPartE4 || partObject instanceof ConceptViewPartE4) {
// do not show empty page as these views are also used to edit the
// description selected in this view
return;
protected abstract void showParts();
- protected void destroySections() {
+ public void destroySections() {
for (IFormPart formPart : managedForm.getParts()){
removePart((CdmSectionPart<?>) formPart);
}
@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MPart thisPart){
+ Object savablePart = WorkbenchUtility.findSavablePart(this);
+ if(savablePart==null){
+ showEmptyPage();
+ }
if(delaySelection==null){
delaySelection = new DelaySelection(selection, activePart, thisPart);
}
showViewer(structuredSelection, activePart, viewer);
return;
}
- else if(selectionProvidingPart!=null && selectionProvidingPart.isVisible()){
- return;
- }
else{
showEmptyPage();
return;
}
}
-// protected void showEmptyPage() {
-// super.showEmptyPage();
-// if(viewer!=null){
-// viewer.showEmptyPage();
-// }
-// selectionProvidingPart = null;
-// }
+ @Override
+ protected void showEmptyPage() {
+ super.showEmptyPage();
+ if(viewer!=null && !viewer.getControl().isDisposed()){
+ ((DetailsViewerE4)viewer).destroySections();
+ }
+ }
@Override
protected String getViewName(){
showViewer(structuredSelection, activePart, viewer);
return;
}
- else if(selectionProvidingPart!=null && selectionProvidingPart.isVisible()){
- return;
- }
else{
showEmptyPage();
return;
}
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void showEmptyPage() {
+ super.showEmptyPage();
+ if(viewer!=null && !viewer.getControl().isDisposed()){
+ ((SupplementalDataViewerE4)viewer).destroySections();
+ }
+ }
+
@Override
protected String getViewName() {
return Messages.SupplementalDataViewPart_VIEWER_NAME;
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(activePart.getObject());
if(e4WrappedPart instanceof ISelectionElementEditingPart){
ISelectionElementEditingPart editingPart = (ISelectionElementEditingPart)e4WrappedPart;
- Object savablePart = findSavablePart(editingPart);
+ Object savablePart = WorkbenchUtility.findSavablePart(editingPart);
if(savablePart instanceof ISaveablePart){
((ISaveablePart) savablePart).doSave(new NullProgressMonitor());
}
}
}
- private Object findSavablePart(ISelectionElementEditingPart part){
- Object selectionProvidingPart = WorkbenchUtility.getE4WrappedPart(part.getSelectionProvidingPart());
- if(selectionProvidingPart instanceof ISelectionElementEditingPart){
- return findSavablePart((ISelectionElementEditingPart) selectionProvidingPart);
- }
- else if(selectionProvidingPart instanceof ISaveablePart || selectionProvidingPart instanceof IE4SavablePart || selectionProvidingPart instanceof MPart){
- return selectionProvidingPart;
- }
- return null;
- }
-
-
- private void savePart(EPartService partService, ECommandService commandService, EHandlerService handlerService,
+ private void savePart(EPartService partService, ECommandService commandService, EHandlerService handlerService,
MPart mPart) {
if(mPart.getObject() instanceof CompatibilityPart){
//FIXME E4 remove when fully migrated
import java.lang.reflect.Field;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.ui.ISaveablePart;
import org.eclipse.ui.internal.E4PartWrapper;
import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor;
import org.eclipse.ui.internal.e4.compatibility.CompatibilityView;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
+import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
+
/**
* Utility class for e4 workbench related operations
* @author pplitzner
}
return object;
}
+
+ public static Object findSavablePart(ISelectionElementEditingPart part){
+ Object selectionProvidingPart = getE4WrappedPart(part.getSelectionProvidingPart());
+ if(selectionProvidingPart instanceof ISelectionElementEditingPart){
+ return findSavablePart((ISelectionElementEditingPart) selectionProvidingPart);
+ }
+ else if(selectionProvidingPart instanceof ISaveablePart || selectionProvidingPart instanceof IE4SavablePart || selectionProvidingPart instanceof MPart){
+ return selectionProvidingPart;
+ }
+ return null;
+ }
}