From 775d037dcdcf55f77934a4277cd1b859058cb174 Mon Sep 17 00:00:00 2001 From: "a.theys" Date: Tue, 20 Mar 2012 06:39:24 +0000 Subject: [PATCH] AT: Committing code review changes --- .gitattributes | 5 - eu.etaxonomy.taxeditor.application/plugin.xml | 2 +- .../taxeditor/perspective/PalmUses.java | 5 +- eu.etaxonomy.taxeditor.editor/plugin.xml | 2 +- .../uses/handler/CreateUseRecordHandler.java | 4 +- .../view/uses/handler/DeleteUseHandler.java | 97 ------ .../operation/DeleteTaxonUseOperation.java | 78 ----- .../operation/DeleteUseRecordOperation.java | 72 ---- .../META-INF/MANIFEST.MF | 3 +- .../taxeditor/model/AbstractUtility.java | 26 -- .../taxeditor/view/detail/DetailsViewer.java | 39 ++- .../view/userecords/UseRecordsViewPart.java | 102 ------ .../view/userecords/UseRecordsViewer.java | 311 ------------------ 13 files changed, 46 insertions(+), 700 deletions(-) delete mode 100644 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/handler/DeleteUseHandler.java delete mode 100644 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteTaxonUseOperation.java delete mode 100644 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteUseRecordOperation.java delete mode 100644 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewPart.java delete mode 100644 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewer.java diff --git a/.gitattributes b/.gitattributes index b59fca82f..a8ccce62e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -481,11 +481,8 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/u eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java -text eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/handler/CreateUseHandler.java -text eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/handler/CreateUseRecordHandler.java -text -eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/handler/DeleteUseHandler.java -text eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java -text eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseRecordOperation.java -text -eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteTaxonUseOperation.java -text -eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteUseRecordOperation.java -text eu.etaxonomy.taxeditor.editor/src/main/resources/TaonDescriptionEditor.screen -text eu.etaxonomy.taxeditor.editor/src/main/resources/log4j.properties -text eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/Application.java -text @@ -1499,8 +1496,6 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/De eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/reporting/ReportingViewPart.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java -text -eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewPart.java -text -eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewer.java -text eu.etaxonomy.taxeditor.store/src/main/resources/eu/etaxonomy/cdm/editorApplicationContext.xml -text eu.etaxonomy.taxeditor.store/src/main/resources/log4j.properties -text eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/NameProtectTitleCacheTest.java -text diff --git a/eu.etaxonomy.taxeditor.application/plugin.xml b/eu.etaxonomy.taxeditor.application/plugin.xml index 1f370efc8..bd5674e38 100644 --- a/eu.etaxonomy.taxeditor.application/plugin.xml +++ b/eu.etaxonomy.taxeditor.application/plugin.xml @@ -34,7 +34,7 @@ + name="Uses"> diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/PalmUses.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/PalmUses.java index 9d77f7f40..489db3f24 100644 --- a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/PalmUses.java +++ b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/PalmUses.java @@ -9,7 +9,7 @@ import org.eclipse.ui.IPageLayout; import eu.etaxonomy.taxeditor.editor.view.uses.UsesViewPart; import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; -import eu.etaxonomy.taxeditor.view.userecords.UseRecordsViewPart; +import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart; /** * The context manager mediates context start/stop and workbench shutdowns to all registered listeners. @@ -26,7 +26,8 @@ public class PalmUses extends Default { @Override public void createInitialLayout(IPageLayout layout) { layout.addView(TaxonNavigator.ID, IPageLayout.LEFT, 0.25f, layout.getEditorArea()); - layout.addView(UseRecordsViewPart.ID, IPageLayout.RIGHT, 0.25f, layout.getEditorArea()); + //layout.addView(UseRecordsViewPart.ID, IPageLayout.RIGHT, 0.25f, layout.getEditorArea()); + layout.addView(DetailsViewPart.ID, IPageLayout.RIGHT, 0.25f, layout.getEditorArea()); layout.addView(UsesViewPart.ID, IPageLayout.BOTTOM, 0.25f, layout.getEditorArea()); createAdditionalFolder(layout, layout.getEditorArea()); diff --git a/eu.etaxonomy.taxeditor.editor/plugin.xml b/eu.etaxonomy.taxeditor.editor/plugin.xml index 49bb8bda7..7c86c5ef4 100644 --- a/eu.etaxonomy.taxeditor.editor/plugin.xml +++ b/eu.etaxonomy.taxeditor.editor/plugin.xml @@ -695,7 +695,7 @@ operations = new ArrayList(); - - for (Object object : selection.toArray()) { - - // TaxonDescription - if (object instanceof TaxonDescription) { - operations.add(new DeleteTaxonUseOperation(label, - undoContext, (TaxonDescription) object, - postOperationEnabled)); - } - // DescriptionElementBase - else if (object instanceof DescriptionElementBase) { - operations.add(new DeleteUseRecordOperation(label, - undoContext, (DescriptionElementBase) object, - postOperationEnabled)); - } else if (object instanceof FeatureNodeContainer) { - List descriptions = ((FeatureNodeContainer) object) - .getDescriptionElementsForEntireBranch(); - - for (DescriptionElementBase description : descriptions) { - operations.add(new DeleteUseRecordOperation( - label, undoContext, description, - postOperationEnabled)); - } - } - else { - EditorUtil.error(getClass(), - "Selection is not valid for this delete handler", - null); - } - } - - // execute all cumulated operations - for (AbstractPostOperation operation : operations) { - EditorUtil.executeOperation(operation); - } - - } catch (NotDefinedException e) { - EditorUtil.warn(getClass(), "Command name not set."); - } - - return null; - } -} diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteTaxonUseOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteTaxonUseOperation.java deleted file mode 100644 index a98b9347a..000000000 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteTaxonUseOperation.java +++ /dev/null @@ -1,78 +0,0 @@ -package eu.etaxonomy.taxeditor.editor.view.uses.operation; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; - -import eu.etaxonomy.cdm.model.description.TaxonDescription; -import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; -import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; - - -/** - * The context manager mediates context start/stop and workbench shutdowns to all registered listeners. - * - * @author a.theys - * @created mar 13, 2012 - * @version 1.0 - */ -public class DeleteTaxonUseOperation extends AbstractPostOperation { - - private TaxonDescription description; - - /** - *

Constructor for DeleteTaxonDescriptionOperation.

- * - * @param label a {@link java.lang.String} object. - * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. - * @param description a {@link eu.etaxonomy.cdm.model.description.TaxonDescription} object. - * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. - */ - public DeleteTaxonUseOperation(String label, IUndoContext undoContext, - TaxonDescription description, IPostOperationEnabled postOperationEnabled) { - super(label, undoContext, postOperationEnabled); - - this.description = description; - taxon = description.getTaxon(); - } - - /* (non-Javadoc) - * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ - /** {@inheritDoc} */ - @Override - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - - monitor.worked(20); - taxon.removeDescription(description); - monitor.worked(40); - - return postExecute(description); - } - - /* (non-Javadoc) - * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ - /** {@inheritDoc} */ - @Override - public IStatus redo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - return execute(monitor, info); - } - - /* (non-Javadoc) - * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ - /** {@inheritDoc} */ - @Override - public IStatus undo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - - taxon.addDescription(description); - - return postExecute(null); - } -} diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteUseRecordOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteUseRecordOperation.java deleted file mode 100644 index 8b27e6bd9..000000000 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/DeleteUseRecordOperation.java +++ /dev/null @@ -1,72 +0,0 @@ -package eu.etaxonomy.taxeditor.editor.view.uses.operation; - - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; - -import eu.etaxonomy.cdm.model.description.DescriptionBase; -import eu.etaxonomy.cdm.model.description.DescriptionElementBase; -import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; -import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; -import eu.etaxonomy.taxeditor.store.StoreUtil; - -/** - * The context manager mediates context start/stop and workbench shutdowns to all registered listeners. - * - * @author a.theys - * @created mar 13, 2012 - * @version 1.0 - */ -public class DeleteUseRecordOperation extends AbstractPostOperation { - private DescriptionElementBase element; - private DescriptionBase description = null; - - - public DeleteUseRecordOperation(String label, IUndoContext undoContext, - DescriptionElementBase element, IPostOperationEnabled postOperationEnabled) { - super(label, undoContext, postOperationEnabled); - - this.element = element; - } - - - @Override - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - description = element.getInDescription(); - - monitor.worked(20); - - // Remove element from description - if (description == null) { - StoreUtil.error(this.getClass(), "Couldn't find element's description!", null); - } else { - description.removeElement(element); - } - monitor.worked(40); - - // Redraw editor if exists - return postExecute(null); - } - - - @Override - public IStatus redo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - return execute(monitor, info); - } - - - @Override - public IStatus undo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - - description.addElement(element); - - return postExecute(element); - } - -} diff --git a/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF index 0e44bb954..0ef127116 100644 --- a/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF +++ b/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF @@ -46,8 +46,7 @@ Export-Package: eu.etaxonomy.cdm, eu.etaxonomy.taxeditor.view.datasource, eu.etaxonomy.taxeditor.view.datasource.handler, eu.etaxonomy.taxeditor.view.detail, - eu.etaxonomy.taxeditor.view.supplementaldata, - eu.etaxonomy.taxeditor.view.userecords + eu.etaxonomy.taxeditor.view.supplementaldata Require-Bundle: org.eclipse.osgi, org.eclipse.ui, org.eclipse.jface.text, diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java index 7b53cb836..3072f460e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java @@ -56,7 +56,6 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer; import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart; import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart; -import eu.etaxonomy.taxeditor.view.userecords.UseRecordsViewPart; /** *

@@ -911,29 +910,4 @@ public abstract class AbstractUtility { } } - public static UseRecordsViewPart getUseRecordsView() { - return (UseRecordsViewPart) getView(UseRecordsViewPart.ID, false); } - - /** - *

- * refreshUseRecordsViewer - *

- */ - public static void refreshUseRecordsViewer() { - if (getUseRecordsView() != null) { - ((AbstractCdmDataViewer) getUseRecordsView().getViewer()).refresh(); - } - } - - /** - *

- * reflowUseRecordsViewer - *

- */ - public static void reflowUseRecordsViewer() { - if (getUseRecordsView() != null) { - ((AbstractCdmDataViewer) getUseRecordsView().getViewer()).reflow(); - } - } -} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java index 8580ee0af..b65fdbe09 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java @@ -10,6 +10,9 @@ package eu.etaxonomy.taxeditor.view.detail; +import java.util.Set; +import java.util.UUID; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.swt.SWT; @@ -18,11 +21,14 @@ import org.eclipse.ui.forms.widgets.Section; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; +import eu.etaxonomy.cdm.api.service.ITermService; import eu.etaxonomy.cdm.model.agent.Person; import eu.etaxonomy.cdm.model.agent.Team; import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; import eu.etaxonomy.cdm.model.common.DefinedTermBase; import eu.etaxonomy.cdm.model.common.Group; +import eu.etaxonomy.cdm.model.common.Marker; +import eu.etaxonomy.cdm.model.common.MarkerType; import eu.etaxonomy.cdm.model.common.TermVocabulary; import eu.etaxonomy.cdm.model.common.User; import eu.etaxonomy.cdm.model.description.DescriptionBase; @@ -38,6 +44,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; +import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; @@ -82,6 +89,7 @@ import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection; import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection; import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection; import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection; +import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection; import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection; import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer; import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; @@ -186,7 +194,21 @@ public class DetailsViewer extends AbstractCdmDataViewer { } } else if (getInput() instanceof DescriptionElementBase) { - createDescriptionElementSection(rootElement); + Set descriptionMarkers = ((DescriptionElementBase) getInput()).getInDescription().getMarkers(); + MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039")); + Boolean isUseDescription = false; + for (Marker marker : descriptionMarkers) { + if (marker.getMarkerType().equals(useMarkertype)) { + isUseDescription = true; + } + } + + if (isUseDescription == true) { + createUseRecordSection(rootElement); + } + else { + createDescriptionElementSection(rootElement); + } } else if (getInput() instanceof Media) { createMediaElementSection(rootElement); @@ -613,6 +635,21 @@ public class DetailsViewer extends AbstractCdmDataViewer { addPart(polytomousKeyNodeDetailSection); } + + private void createUseRecordSection(RootElement parent) { + destroySections(); + + UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory + .createCdmDetailSection(DetailType.USE_RECORD, + getConversationHolder(), parent, this, Section.TWISTIE + | Section.EXPANDED); + + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + + addPart(descriptionUseRecordSection); + + + } private void createUserSection(RootElement parent) { destroySections(); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewPart.java deleted file mode 100644 index d8f3ca946..000000000 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewPart.java +++ /dev/null @@ -1,102 +0,0 @@ -package eu.etaxonomy.taxeditor.view.userecords; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; - -import eu.etaxonomy.cdm.model.description.Feature; -import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; -import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; -import eu.etaxonomy.taxeditor.store.StoreUtil; -import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart; -import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; - -/** - * The context manager mediates context start/stop and workbench shutdowns to all registered listeners. - * - * @author a.theys - * @created mar 13, 2012 - * @version 1.0 - */ -public class UseRecordsViewPart extends AbstractCdmEditorViewPart implements IPartContentHasSupplementalData{ - - public static String ID = "eu.etaxonomy.taxeditor.view.userecords"; - private UseRecordsViewer viewer; - - @Override - public void createViewer(Composite parent) { - viewer = new UseRecordsViewer(parent, this); - getSite().setSelectionProvider(viewer); - - } - - @Override - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if(StoreUtil.getActiveEditor() == null){ - showEmptyPage(); - return; - } - - if(part == this){ - return; - } - - if(!(selection instanceof IStructuredSelection)){ - return; - } - - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - - if((part instanceof IEditorPart) || (part instanceof AbstractCdmViewPart)) { - if(structuredSelection.size() != 1){ - showEmptyPage(); - return; - } - - // do not show details for feature nodes TODO really? - if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){ - // do show the map for distributions - Feature feature = ((FeatureNodeContainer) ((IStructuredSelection) selection).getFirstElement()).getFeature(); - if(!feature.equals(Feature.DISTRIBUTION())){ - showEmptyPage(); - return; - } - } - - showViewer(part, structuredSelection); - }else{ - showEmptyPage(); - } - - } - - @Override - public Viewer getViewer() { - return viewer; - } - - /** {@inheritDoc} */ - @Override - public void dispose() { - super.dispose(); - selectionService.removePostSelectionListener(this); - } - - /** - *

onComplete

- * - * @return a boolean. - */ - public boolean onComplete() { - return true; - } - - - - - - -} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewer.java deleted file mode 100644 index 632cd5757..000000000 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewer.java +++ /dev/null @@ -1,311 +0,0 @@ -package eu.etaxonomy.taxeditor.view.userecords; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.Section; - -import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; -import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; -import eu.etaxonomy.cdm.model.common.TermVocabulary; -import eu.etaxonomy.cdm.model.description.DescriptionBase; -import eu.etaxonomy.cdm.model.description.DescriptionElementBase; -import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase; -import eu.etaxonomy.cdm.model.taxon.TaxonBase; -import eu.etaxonomy.taxeditor.preference.PreferencesUtil; -import eu.etaxonomy.taxeditor.store.StoreUtil; -import eu.etaxonomy.taxeditor.ui.element.RootElement; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType; -import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; -import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection; -import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection; -import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection; -import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection; -import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection; -import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection; -import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection; -import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection; -import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection; -import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection; -import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection; -import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection; -import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection; -import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer; -import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; -import eu.etaxonomy.cdm.model.description.DescriptionElementBase; - - - - -/** - * The context manager mediates context start/stop and workbench shutdowns to all registered listeners. - * - * @author a.theys - * @created mar 13, 2012 - * @version 1.0 - */ -public class UseRecordsViewer extends AbstractCdmDataViewer { - - private ISelection selection; - - public UseRecordsViewer(Composite parent, AbstractCdmViewPart viewPart) { - super(parent, viewPart); - } - - // START HACK TO MAKE THE DERIVED UNIT FACADE WORK - // since we are getting implementations of DerivedUnitBase from the bulk - // editor - // and not derived unit facade objects, - - /* - * (non-Javadoc) - * - * @see - * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java - * .lang.Object) - */ - @Override - public void setInput(Object input) { - if (input instanceof DerivedUnitBase) { - try { - input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input, - PreferencesUtil.getDerivedUnitConfigurator()); - } catch (DerivedUnitFacadeNotSupportedException e) { - StoreUtil.error(getClass(), e); - } - } - super.setInput(input); - } - - @Override - protected void markViewPartDirty() { - if (getInput() instanceof DerivedUnitFacade) { - getViewPart().changed( - ((DerivedUnitFacade) getInput()).innerDerivedUnit()); - } - - super.markViewPartDirty(); - } - - // END HACK TO MAKE THE DERIVED UNIT FACADE WORK - - - @Override - protected void showParts() { - if (getInput() instanceof TaxonBase) { - createTaxonSections(rootElement); - - } else if (getInput() instanceof DescriptionBase) { - if (((DescriptionBase) getInput()).isImageGallery()) { - createImageGallerySection(rootElement); - - } else { - createUseSection(rootElement); - - } - } else if (getInput() instanceof DescriptionElementBase) { - createUseRecordSection(rootElement); - //TODO Use the code below to move the useRecords view and UseRecordDetailElement into the details view. - DescriptionElementBase desc = ((DescriptionElementBase) getInput()). - - } else if (getInput() instanceof TermVocabulary) { - createTermVocabularySection(rootElement); - - } - - /*if (getInput() instanceof TaxonBase) { - if (currentViewPart != VIEW_PART.TAXON) { - createTaxonSections(rootElement); - currentViewPart = VIEW_PART.TAXON; - } - } else if (getInput() instanceof Reference) { - if (currentViewPart != VIEW_PART.REFEERENCE) { - createReferenceSections(rootElement); - currentViewPart = VIEW_PART.REFEERENCE; - } - } else if (getInput() instanceof DescriptionBase) { - if (((DescriptionBase) getInput()).isImageGallery()) { - if (currentViewPart != VIEW_PART.IMAGE_GALLERY) { - createImageGallerySection(rootElement); - currentViewPart = VIEW_PART.IMAGE_GALLERY; - } - } else { - if (currentViewPart != VIEW_PART.DESCRIPTION) { - createDescriptionSection(rootElement); - currentViewPart = VIEW_PART.DESCRIPTION; - } - } - } else if (getInput() instanceof DescriptionElementBase) { - if (currentViewPart != VIEW_PART.DESCRIPTION_ELEMENT) { - createDescriptionElementSection(rootElement); - currentViewPart = VIEW_PART.DESCRIPTION_ELEMENT; - } - } else { - destroySections(); - currentViewPart = VIEW_PART.EMPTY; - } - layout(); - */ - } - private void createTaxonSections(RootElement parent) { - destroySections(); - - TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory - .createCdmDetailSection(DetailType.TAXONBASE, - getConversationHolder(), parent, this, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory - .createCdmDetailSection(DetailType.NONVIRALNAME, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory - .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, - getConversationHolder(), parent, this, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory - .createEntityDetailSection( - EntityDetailType.NOMENCLATURALSTATUS, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ProtologueSection protologSection = (ProtologueSection) formFactory - .createEntityDetailSection(EntityDetailType.PROTOLOG, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory - .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory - .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory - .createCdmDetailSection(DetailType.PARSINGMESSAGE, - getConversationHolder(), parent, this, Section.EXPANDED); - - addPart(taxonBaseDetailSection); - addPart(nonViralNameSection); - addPart(nomenclaturalStatusSection); - addPart(protologSection); - addPart(referenceDetailSection); - addPart(typeDesignationSection); - addPart(nameRelationshipSection); - addPart(parsingMessagesSection); - } - - private void createTermVocabularySection(RootElement parent) { - destroySections(); - - TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory - .createCdmDetailSection(DetailType.TERM_VOCABULARY, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - addPart(termVocabularyDetailSection); - } - - private void createUseRecordSection(RootElement parent) { - destroySections(); - - UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory - .createCdmDetailSection(DetailType.USE_RECORD, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - addPart(descriptionUseRecordSection); - - - } - - private void createUseSection(RootElement parent) { - destroySections(); - DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory - .createCdmDetailSection(DetailType.DESCRIPTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - /*NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory - .createCdmDetailSection(DetailType.NATURAL_LANGUAGE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory - .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER);*/ - - DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory - .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE, - getConversationHolder(), parent, Section.TWISTIE); - - /*formFactory.createHorizontalSeparator(parent, SWT.BORDER); - - ScopeSection scopeSection = (ScopeSection) formFactory - .createEntityDetailSection(EntityDetailType.SCOPE, - getConversationHolder(), parent, Section.TWISTIE); - - formFactory.createHorizontalSeparator(parent, SWT.BORDER);*/ - - addPart(descriptionDetailSection); - addPart(descriptionSourceSection); - - } - - - - private void createImageGallerySection(RootElement parent) { - destroySections(); - DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory - .createCdmDetailSection(DetailType.DESCRIPTION, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - - addPart(descriptionDetailSection); - } - - private void createReferenceSections(RootElement parent) { - destroySections(); - - ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory - .createCdmDetailSection(DetailType.REFERENCEBASE, - getConversationHolder(), parent, this, Section.TWISTIE - | Section.EXPANDED); - - addPart(referenceDetailSection); - - } - @Override - public ISelection getSelection() { - return selection; - } - @Override - public void setSelection(ISelection selection, boolean reveal) { - this.selection = selection; - SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent( - this, selection); - fireSelectionChanged(selectionChangedEvent); - } - -} -- 2.34.1