Removed OccurrenceView
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 26 Oct 2015 17:21:08 +0000 (18:21 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 26 Oct 2015 17:21:08 +0000 (18:21 +0100)
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/DerivatePerspective.java
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivative/OccurrenceView.java [deleted file]

index bbd88abc2f644d42f408ebdea0ed9ffbe379461e..1033f0c7ca10070bf6fd67d578840c3a90be257b 100644 (file)
@@ -13,10 +13,10 @@ import org.eclipse.ui.IPageLayout;
 import org.eclipse.ui.IPlaceholderFolderLayout;
 import org.eclipse.ui.progress.IProgressConstants;
 
 import org.eclipse.ui.IPlaceholderFolderLayout;
 import org.eclipse.ui.progress.IProgressConstants;
 
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
 import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
 import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
 import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
 import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
-import eu.etaxonomy.taxeditor.view.derivative.OccurrenceView;
 import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
 
 /**
 import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
 
 /**
@@ -36,7 +36,7 @@ public class DerivatePerspective extends Default {
 
         layout.addView(DetailsViewPart.ID, IPageLayout.RIGHT, 0.6f, layout.getEditorArea());
 
 
         layout.addView(DetailsViewPart.ID, IPageLayout.RIGHT, 0.6f, layout.getEditorArea());
 
-        layout.addView(OccurrenceView.ID, IPageLayout.BOTTOM, 0.5f, layout.getEditorArea());
+        layout.addView(DerivateView.ID, IPageLayout.BOTTOM, 0.5f, layout.getEditorArea());
 
         layout.addView(DescriptiveViewPart.ID, IPageLayout.BOTTOM, 0.6f, TaxonNavigator.ID);
 
 
         layout.addView(DescriptiveViewPart.ID, IPageLayout.BOTTOM, 0.6f, TaxonNavigator.ID);
 
index 666680ec6119fe0d78b969e1a4697ea34ff29def..b41d0021e3f04873cc1ca802991898713ff7ae6d 100644 (file)
@@ -15,6 +15,7 @@ Export-Package: eu.etaxonomy.taxeditor.editor,
  eu.etaxonomy.taxeditor.editor.name.operation,
  eu.etaxonomy.taxeditor.editor.view.concept,
  eu.etaxonomy.taxeditor.editor.view.dataimport,
  eu.etaxonomy.taxeditor.editor.name.operation,
  eu.etaxonomy.taxeditor.editor.view.concept,
  eu.etaxonomy.taxeditor.editor.view.dataimport,
+ eu.etaxonomy.taxeditor.editor.view.derivate,
  eu.etaxonomy.taxeditor.editor.view.descriptive,
  eu.etaxonomy.taxeditor.editor.view.media,
  eu.etaxonomy.taxeditor.editor.view.uses
  eu.etaxonomy.taxeditor.editor.view.descriptive,
  eu.etaxonomy.taxeditor.editor.view.media,
  eu.etaxonomy.taxeditor.editor.view.uses
index 18537cde89e5ac3a515ffb0ab9d3835095d875ed..90e7ec540d578bad5b05888b338baf7901c25e88 100644 (file)
             </visibleWhen>
          </command>
          <separator
             </visibleWhen>
          </command>
          <separator
-               name="eu.etaxonomy.taxeditor.editor.separator1">
+               name="eu.etaxonomy.taxeditor.editor.separator1"
+               visible="true">
          </separator>
       </menuContribution>
       <menuContribution
          </separator>
       </menuContribution>
       <menuContribution
index c51b739fb55ffd379769b863e069ab855c53afcc..06ed980ec4ec942ae9b88f965c63a5b93730ac35 100644 (file)
@@ -53,7 +53,6 @@ Export-Package: eu.etaxonomy.cdm,
  eu.etaxonomy.taxeditor.view.datasource,
  eu.etaxonomy.taxeditor.view.datasource.handler,
  eu.etaxonomy.taxeditor.view.derivateSearch,
  eu.etaxonomy.taxeditor.view.datasource,
  eu.etaxonomy.taxeditor.view.datasource.handler,
  eu.etaxonomy.taxeditor.view.derivateSearch,
- eu.etaxonomy.taxeditor.view.derivative,
  eu.etaxonomy.taxeditor.view.detail,
  eu.etaxonomy.taxeditor.view.specimenSearch,
  eu.etaxonomy.taxeditor.view.supplementaldata,
  eu.etaxonomy.taxeditor.view.detail,
  eu.etaxonomy.taxeditor.view.specimenSearch,
  eu.etaxonomy.taxeditor.view.supplementaldata,
index 97507fd39517b534a2b1dd589f4982e86a9ad8e1..8e7a4532b909d73a51bc3ac89db09839fa27f5b1 100644 (file)
         id="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"
         name="Sessions"
         restorable="false">
         id="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"
         name="Sessions"
         restorable="false">
-  </view>
-  <view
-        class="eu.etaxonomy.taxeditor.view.derivative.OccurrenceView"
-        id="eu.etaxonomy.taxeditor.view.derivative.OccurrenceView"
-        name="Derivative Editor (taxon-based)"
-        restorable="true">
   </view>
    </extension>
    <extension
   </view>
    </extension>
    <extension
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivative/OccurrenceView.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivative/OccurrenceView.java
deleted file mode 100644 (file)
index 5ac2313..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2015 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.view.derivative;
-
-import java.util.Collection;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.ISaveablePart2;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbenchPart;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateContentProvider;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
-
-/**
- * @author pplitzner
- * @date Oct 7, 2015
- *
- */
-public class OccurrenceView extends AbstractCdmViewPart implements IPartContentHasDetails, ISaveablePart2{
-
-    public static String ID = "eu.etaxonomy.taxeditor.view.derivative.OccurrenceView";
-
-    private TreeViewer viewer;
-    private DerivateContentProvider contentProvider;
-    private DerivateLabelProvider labelProvider;
-
-    private ISelectionService selectionService;
-
-    private ConversationHolder conversation;
-
-    private boolean dirty;
-
-
-    public OccurrenceView() {
-        if(conversation==null && CdmStore.isActive()){
-            conversation = CdmStore.createConversation();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void createPartControl(Composite parent) {
-
-        //listen to selection changes
-        selectionService = getSite().getWorkbenchWindow().getSelectionService();
-        selectionService.addSelectionListener(this);
-
-      //---tree viewer---
-        viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
-        GridData gridDataTree = new GridData();
-        gridDataTree.horizontalAlignment = GridData.FILL;
-        gridDataTree.verticalAlignment = GridData.FILL;
-        gridDataTree.grabExcessVerticalSpace = true;
-        gridDataTree.grabExcessHorizontalSpace = true;
-        viewer.getTree().setLayoutData(gridDataTree);
-        contentProvider = new DerivateContentProvider();
-        viewer.setContentProvider(contentProvider);
-        labelProvider = new DerivateLabelProvider();
-        viewer.setLabelProvider(labelProvider);
-        viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
-        // Propagate selection from viewer
-        getSite().setSelectionProvider(viewer);
-
-        //create context menu
-        MenuManager menuManager = new MenuManager();
-        getSite().registerContextMenu(menuManager, viewer);
-        Control control = viewer.getControl();
-        Menu menu = menuManager.createContextMenu(control);
-        control.setMenu(menu);
-
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setFocus() {
-        if(!conversation.isBound()){
-            conversation.bind();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void dispose() {
-        selectionService.removeSelectionListener(this);
-        if(conversation!=null){
-            conversation.close();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-        if(selection instanceof IStructuredSelection){
-            Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
-            if(selectedElement instanceof Taxon){
-                Collection<SpecimenOrObservationBase> fieldUnits = CdmStore.getService(IOccurrenceService.class).listFieldUnitsByAssociatedTaxon((Taxon) selectedElement, null, null);
-                viewer.setInput(fieldUnits);
-            }
-        }
-    }
-
-    @Override
-    public boolean onComplete() {
-        return false;
-    }
-
-    @Override
-    public Viewer getViewer() {
-        return viewer;
-    }
-
-    @Override
-    public void createViewer(Composite parent) {
-    }
-
-    @Override
-    public void changed(Object object) {
-        this.dirty = true;
-        firePropertyChange(PROP_DIRTY);
-    }
-
-    @Override
-    public void doSave(IProgressMonitor monitor) {
-        if(conversation.isBound()){
-//            input.merge(); TODO remote merging
-            conversation.commit(true);
-        }
-        this.dirty = false;
-        firePropertyChange(PROP_DIRTY);
-    }
-
-    @Override
-    public void doSaveAs() {
-        doSave(new NullProgressMonitor());
-    }
-
-    @Override
-    public boolean isDirty() {
-        return this.dirty;
-    }
-
-    @Override
-    public boolean isSaveAsAllowed() {
-        return false;
-    }
-
-    @Override
-    public boolean isSaveOnCloseNeeded() {
-        return isDirty();
-    }
-
-    @Override
-    public int promptToSaveOnClose() {
-        return ISaveablePart2.DEFAULT;
-    }
-}