merge-update from trunk
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 23 Sep 2014 13:31:07 +0000 (13:31 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 23 Sep 2014 13:31:07 +0000 (13:31 +0000)
67 files changed:
.gitattributes
eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin.properties
eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_de.properties
eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_en.properties
eu.etaxonomy.taxeditor.application/about.mappings [new file with mode: 0644]
eu.etaxonomy.taxeditor.application/build.properties
eu.etaxonomy.taxeditor.application/p2.inf [deleted file]
eu.etaxonomy.taxeditor.application/plugin.xml
eu.etaxonomy.taxeditor.application/pom.xml
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationUtil.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/P2Util.java [deleted file]
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/TaxonomicEditorPlugin.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/InstallNewSoftwareHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/P2Util.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/PreloadingRepositoryHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle.properties [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_de.properties [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_en.properties [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/build.properties
eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AbstractAddDerivedUnitFacadeMediaHandler.java [deleted file]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddDerivedUnitMediaHandler.java [deleted file]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddFieldObjectMediaHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/.project
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_en.properties
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/DataImportView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/SaveImportedSpecimenAction.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/AddDerivedUnitFacadeMediaOperation.java [moved from eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/operation/AddDerivedUnitFacadeMediaOperation.java with 57% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddImageGalleryHandler.java
eu.etaxonomy.taxeditor.feature.platform/feature.xml
eu.etaxonomy.taxeditor.feature/feature.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/DeleteOperation.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_en.properties
eu.etaxonomy.taxeditor.store/build.properties
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermEditorHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/CdmErrorDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartContentHasMedia.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/MessagingUtils.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchCompositeController.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchView.java
eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product
eu.etaxonomy.taxeditor/pom.xml
pom.xml

index bf6b83942b3ef27231924ff3f6da1ab684502b0d..43ef931a80db3d214b5cc227f24f768924689b54 100644 (file)
@@ -7,6 +7,7 @@ eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF -text
 eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin.properties -text
 eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_de.properties -text
 eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_en.properties -text
+eu.etaxonomy.taxeditor.application/about.mappings -text
 eu.etaxonomy.taxeditor.application/build.properties -text
 eu.etaxonomy.taxeditor.application/icons/256color_16x16.gif -text
 eu.etaxonomy.taxeditor.application/icons/256color_32x32.gif -text
@@ -14,7 +15,6 @@ eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif -text
 eu.etaxonomy.taxeditor.application/icons/256color_48x48.ico -text
 eu.etaxonomy.taxeditor.application/icons/edit_16x16.gif -text
 eu.etaxonomy.taxeditor.application/icons/specimen_derivate-16x16-32.png -text
-eu.etaxonomy.taxeditor.application/p2.inf -text
 eu.etaxonomy.taxeditor.application/plugin.xml -text
 eu.etaxonomy.taxeditor.application/plugin_customization.ini -text
 eu.etaxonomy.taxeditor.application/pom.xml -text
@@ -27,7 +27,6 @@ eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/Applicat
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/OpenExternalAboutPlatformHandler.java -text
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/OpenExternalHelpHandler.java -text
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/OpenExternalParserHelpHandler.java -text
-eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/P2Util.java -text
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/SaveAllHandler.java -text
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/SaveHandler.java -text
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/TaxonomicEditorPlugin.java -text
@@ -37,10 +36,17 @@ eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspect
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/PolytomousKey.java -text
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/Taxonomic.java -text
 eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/Uses.java -text
+eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/InstallNewSoftwareHandler.java -text
+eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/P2Util.java -text
+eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/PreloadingRepositoryHandler.java -text
+eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java -text
 eu.etaxonomy.taxeditor.application/src/main/resources/log4j.properties -text
 eu.etaxonomy.taxeditor.bulkeditor/.classpath -text
 eu.etaxonomy.taxeditor.bulkeditor/.project -text
 eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF -text
+eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle.properties -text
+eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_de.properties -text
+eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_en.properties -text
 eu.etaxonomy.taxeditor.bulkeditor/build.properties -text
 eu.etaxonomy.taxeditor.bulkeditor/icons/merge_candidate.gif -text
 eu.etaxonomy.taxeditor.bulkeditor/icons/merge_target.gif -text
@@ -80,10 +86,6 @@ eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkedito
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicMarkerTypeEditingMenu.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicNewObjectMenu.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/OpenBulkEditorContributionItem.java -text
-eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AbstractAddDerivedUnitFacadeMediaHandler.java -text
-eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddDerivedUnitMediaHandler.java -text
-eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddFieldObjectMediaHandler.java -text
-eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/operation/AddDerivedUnitFacadeMediaOperation.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/MergeGroupHandler.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/OpenBulkEditorHandler.java -text
@@ -563,6 +565,7 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/d
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/AddDerivedUnitFacadeMediaOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateDescriptionElementOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateSpecimenDescriptionOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateTaxonDescriptionOperation.java -text
@@ -1276,6 +1279,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IElement
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartChangeListener.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartContentHasDetails.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartContentHasFactualData.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartContentHasMedia.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartContentHasSupplementalData.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/LineSelection.java -text
index 4406e8226cbc5ba4ef8a8ccf54d2b29e3ce9c27a..0c9d0d78da97a9c19824ddc10638ba79041c826a 100644 (file)
@@ -28,4 +28,6 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.equinox.p2.ui.sdk,
  org.eclipse.equinox.p2.updatechecker,
  org.eclipse.equinox.p2.operations,
- org.eclipse.help.ui
+ org.eclipse.help.ui,
+ org.eclipse.equinox.p2.metadata;bundle-version="2.1.0",
+ org.eclipse.equinox.p2.engine;bundle-version="2.1.1"
index 9e64cfd64c4c5e259ed4fa5b749bf2bb8b173458..8db829129667b94fe710bd503643e4d25bcbc03a 100644 (file)
@@ -1,6 +1,14 @@
 productName=EDIT Taxonomic Editor\r
-productBlurb=EDIT Taxonomic Editor\n\Version: 3.3\n\n\Copyright (C) 2009 EDIT\n\European Distributed Institute of Taxonomy\n\http://www.e-taxonomy.eu\r
-\r
+productBlurb=EDIT Taxonomic Editor\n\Version: {0}\nBuild Date: {1} CET\n\n\\r
+Copyright (C) 2009-2014 EDIT\n\European Distributed Institute of Taxonomy \n\\r
+http://cybertaxonomy.eu/ \n\n\\r
+The contents of this product are subject to the Mozilla Public License Version 1.1,  \n\\r
+you may not use this product except in compliance with the License. \n\\r
+You may obtain a copy of the License at http://www.mozilla.org/MPL/ \n\\r
+Software distributed under the License is distributed on an 'AS IS' basis, \n\\r
+WITHOUT WARRANTY OF ANY KIND, either express or implied. \n\\r
+See the License for the specific language governing rights and limitations under \n\\r
+the License.\r
 extension.name = Taxonomic Editor\r
 perspective.name = Taxonomic\r
 perspective.name.0 = Polytomous Key\r
index 2283ab3b7b40a27faf4840663033b8ee9abbb59d..125f69ee8adc1f27f9e7892ce0de754465b0d7e7 100644 (file)
@@ -1,6 +1,14 @@
 productName=EDIT Taxonomischer Editor
-productBlurb=EDIT Taxonomischer Editor\n\Version: 3.3\n\n\Copyright (C) 2009 EDIT\n\European Distributed Institute of Taxonomy\n\http://www.e-taxonomy.eu
-
+productBlurb=EDIT Taxonomischer Editor\n\Version: {0}\nBuild Date: {1} CET\n\n\
+Copyright (C) 2009-2014 EDIT\n\European Distributed Institute of Taxonomy \n\
+http://cybertaxonomy.eu/ \n\n\
+The contents of this product are subject to the Mozilla Public License Version 1.1  \n\
+you may not use this product except in compliance with the License. \n\
+You may obtain a copy of the License at http://www.mozilla.org/MPL/ \n\
+Software distributed under the License is distributed on an 'AS IS' basis, \n\
+WITHOUT WARRANTY OF ANY KIND, either express or implied. \n\
+See the License for the specific language governing rights and limitations under \n\
+the License.
 extension.name = Taxonomischer Editor
 perspective.name = Taxonomisch
 perspective.name.0 = Polytomer Key
index 9e64cfd64c4c5e259ed4fa5b749bf2bb8b173458..47bd90cc36259313ee6134623caba9206de7c2c5 100644 (file)
@@ -1,6 +1,14 @@
 productName=EDIT Taxonomic Editor\r
-productBlurb=EDIT Taxonomic Editor\n\Version: 3.3\n\n\Copyright (C) 2009 EDIT\n\European Distributed Institute of Taxonomy\n\http://www.e-taxonomy.eu\r
-\r
+productBlurb=EDIT Taxonomic Editor\n\Version: {0}\nBuild Date: {1} CET\n\n\\r
+Copyright (C) 2009-2014 EDIT\n\European Distributed Institute of Taxonomy \n\\r
+http://cybertaxonomy.eu/ \n\n\\r
+The contents of this product are subject to the Mozilla Public License Version 1.1  \n\\r
+you may not use this product except in compliance with the License. \n\\r
+You may obtain a copy of the License at http://www.mozilla.org/MPL/ \n\\r
+Software distributed under the License is distributed on an 'AS IS' basis, \n\\r
+WITHOUT WARRANTY OF ANY KIND, either express or implied. \n\\r
+See the License for the specific language governing rights and limitations under \n\\r
+the License.\r
 extension.name = Taxonomic Editor\r
 perspective.name = Taxonomic\r
 perspective.name.0 = Polytomous Key\r
diff --git a/eu.etaxonomy.taxeditor.application/about.mappings b/eu.etaxonomy.taxeditor.application/about.mappings
new file mode 100644 (file)
index 0000000..7f964fb
--- /dev/null
@@ -0,0 +1,2 @@
+0=${version}
+1=${timestamp}
\ No newline at end of file
index af4a4e99ecc9ad8a94528b68e253041a4df3e18f..cccbe07e1e94c4fa7d2929f279a462e51ebf34a3 100644 (file)
@@ -7,7 +7,6 @@ bin.includes = META-INF/,\
                plugin_customization.ini,\
                icons/,\
                OSGI-INF/l10n/plugin.properties,\
-               splash.bmp,\
-               p2.inf,\
+               splash.bmp,\              
                OSGI-INF/l10n/plugin_de.properties,\
                OSGI-INF/l10n/plugin_en.properties
diff --git a/eu.etaxonomy.taxeditor.application/p2.inf b/eu.etaxonomy.taxeditor.application/p2.inf
deleted file mode 100644 (file)
index cdeccf8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-instructions.configure=\
-       addRepository(type:0,location:http${#58}//wp5.e-taxonomy.eu/taxeditor/update);\
-       addRepository(type:1,location:http${#58}//wp5.e-taxonomy.eu/taxeditor/update);
\ No newline at end of file
index 4921f4a52f82295fa979d04fea4ff0ac6e47f23a..1e27e9f4731338fb7e5778ef1bc9b501eb254c58 100644 (file)
                name="eu.etaxonomy.taxeditor.ui.help.separator1"\r
                visible="true">\r
          </separator>\r
+         <!--command\r
+               commandId="eu.etaxonomy.taxeditor.install"\r
+               label="%command.label.18"\r
+               style="push"/-->\r
          <command\r
-               commandId="org.eclipse.equinox.p2.ui.sdk.update"\r
+               commandId="eu.etaxonomy.taxeditor.update"\r
                label="%command.label.17"\r
-               style="push">\r
-         </command>\r
-         <command\r
-               commandId="org.eclipse.equinox.p2.ui.sdk.install"\r
-               label="%command.label.18"\r
-               style="push">\r
-         </command>\r
+               style="push"/>    \r
          <separator\r
                name="eu.etaxonomy.taxeditor.ui.help.separator2"\r
                visible="true">\r
             id="eu.etaxonomy.taxeditor.application.help.aboutPlatform"\r
             name="%command.name.0">\r
       </command>\r
+      <command\r
+            defaultHandler="eu.etaxonomy.taxeditor.update.UpdateHandler"\r
+            id="eu.etaxonomy.taxeditor.update"\r
+            name="%command.label.17">\r
+      </command>\r
+      <command\r
+            defaultHandler="eu.etaxonomy.taxeditor.update.InstallNewSoftwareHandler"\r
+            id="eu.etaxonomy.taxeditor.install"\r
+            name="%command.label.18">\r
+      </command>\r
    </extension>\r
-\r
+   \r
+   \r
        <extension\r
                point="org.eclipse.ui.activities">\r
                <activity\r
        point="org.eclipse.core.runtime.products">\r
     <product\r
           application="eu.etaxonomy.taxeditor.application.application"\r
-          name="%product.name.0">\r
+          name="EDIT Taxonomic Editor">\r
        <property\r
              name="appName"\r
              value="EDIT Taxonomic Editor">\r
index b40d53fbe04fbfa1f2b980c964b9483cb276d2ef..20e1dfcca44cd067df817318071270dc06a4858d 100644 (file)
@@ -1,18 +1,34 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-       <parent>
-               <groupId>eu.etaxonomy</groupId>
-               <artifactId>taxeditor-parent</artifactId>
-               <version>3.3.8-SNAPSHOT</version>
-       </parent>
+  <parent>
+    <groupId>eu.etaxonomy</groupId>
+    <artifactId>taxeditor-parent</artifactId>
+    <version>3.3.8-SNAPSHOT</version>
+  </parent>
 
-       <modelVersion>4.0.0</modelVersion>
-       <artifactId>eu.etaxonomy.taxeditor.application</artifactId>
-       <packaging>eclipse-plugin</packaging>
-       
-       <name>Application</name>
-       <description>All plugins are combined into this application.</description>
-       <url>http://dev.e-taxonomy.eu/trac/wiki/TaxonomicEditor</url>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>eu.etaxonomy.taxeditor.application</artifactId>
+  <packaging>eclipse-plugin</packaging>
 
+  <name>Application</name>
+  <description>All plugins are combined into this application.</description>
+  <url>http://dev.e-taxonomy.eu/trac/wiki/TaxonomicEditor</url>
+
+  <properties>
+   <timestamp>${maven.build.timestamp}</timestamp>
+   <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
+</properties>
+  
+  <build>
+    <resources>
+      <resource>
+        <directory>.</directory>
+        <includes>
+            <include>about.mappings</include>            
+        </includes>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+   </build>
 </project>
index 105f62e2de1d786e91b4c4cded4ba473b8da8790..105be8f47d934e6c023f96f3ed106ca83e6a5912 100644 (file)
@@ -1,15 +1,18 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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;
 
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
+
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 
 /**
@@ -21,6 +24,38 @@ import eu.etaxonomy.taxeditor.model.AbstractUtility;
  */
 public class ApplicationUtil extends AbstractUtility {
 
+
+    /**
+     * Prefix to declare the version as beta
+     */
+    private static final String BETA_PREFIX = "[BETA]";
+
+    /**
+     * @return
+     */
+    public static String getVersion() {
+        Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.application");
+        String version = bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
+        // Checking if this is a beta (snapshot) version
+        if(version ==null || version.isEmpty()) {
+            return "";
+        }
+        String[] parts = version.split("\\.");
+        if(parts.length <= 3) {
+            // this is a stable version
+            return version;
+        } else {
+            return BETA_PREFIX + version;
+        }
+
+    }
+
+    /**
+     * @return
+     */
+    public static boolean isStable() {
+        return !getVersion().startsWith("[");
+    }
        /**
         * <p>getPluginId</p>
         *
@@ -29,5 +64,7 @@ public class ApplicationUtil extends AbstractUtility {
        public static String getPluginId(){
                return TaxonomicEditorPlugin.PLUGIN_ID;
        }
-       
+
+
+
 }
index 18ac99ecf3935013e0d38fe0baebc4a78d044b35..fc694b221e245fe16e40f73088487d655260e098 100644 (file)
@@ -1,21 +1,13 @@
 package eu.etaxonomy.taxeditor;
 
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.rmi.activation.Activator;
-
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.application.IWorkbenchConfigurer;
 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
 import org.eclipse.ui.application.WorkbenchAdvisor;
 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
 import org.eclipse.ui.statushandlers.AbstractStatusHandler;
 import org.eclipse.ui.statushandlers.StatusAdapter;
-import org.eclipse.ui.statushandlers.StatusManager;
 
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
@@ -35,12 +27,13 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
         * @see org.eclipse.ui.application.WorkbenchAdvisor#createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer)
         */
        /** {@inheritDoc} */
-       public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
+       @Override
+    public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
                        IWorkbenchWindowConfigurer configurer) {
                return new ApplicationWorkbenchWindowAdvisor(configurer);
        }
 
-       
+
        /*
         * (non-Javadoc)
         * @see org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId()
@@ -50,75 +43,26 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
         *
         * @return a {@link java.lang.String} object.
         */
-       public String getInitialWindowPerspectiveId() {
+       @Override
+    public String getInitialWindowPerspectiveId() {
                return "eu.etaxonomy.taxeditor.application.perspective.taxonomic";
        }
-       
+
        /*
         * (non-Javadoc)
         * @see org.eclipse.ui.application.WorkbenchAdvisor#initialize(org.eclipse.ui.application.IWorkbenchConfigurer)
         */
        /** {@inheritDoc} */
-       public void initialize(IWorkbenchConfigurer configurer) {
+       @Override
+    public void initialize(IWorkbenchConfigurer configurer) {
                super.initialize(configurer);
-                               
+
                // Remembers the user's view layout, window size, window location etc.
                //  for the next time application is started
                configurer.setSaveAndRestore(true);
-       }       
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.ui.application.WorkbenchAdvisor#preStartup()
-        */
-       /** {@inheritDoc} */
-       @Override
-       public void preStartup() {
-               // TODO Auto-generated method stub
-               super.preStartup();
-               // XXX check for updates before starting up.
-       // If an update is performed, restart.
-//     if (P2Util.checkForUpdates())
-//             PlatformUI.getWorkbench().restart();
        }
-       
-/**
- * see:        https://bugs.eclipse.org/bugs/show_bug.cgi?id=234252
- */
-//     public void initialize(IWorkbenchConfigurer configurer) {
-//
-//             WorkbenchAdapterBuilder.registerAdapters();
-//
-//             final String ICONS_PATH = "icons/full/";
-//             final String PATH_OBJECT = ICONS_PATH + "obj16/";
-//             Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);
-//             declareWorkbenchImage(configurer, ideBundle,
-//                             IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif",
-//                             true);
-//             declareWorkbenchImage(configurer, ideBundle,
-//                             IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
-//                                             + "cprj_obj.gif", true);
-//
-//     }
-//
-//     private void declareWorkbenchImage(IWorkbenchConfigurer configurer_p,
-//                     Bundle ideBundle, String symbolicName, String path, boolean shared) {
-//             URL url = ideBundle.getEntry(path);
-//             ImageDescriptor desc = ImageDescriptor.createFromURL(url);
-//             configurer_p.declareImage(symbolicName, desc, shared);
-//     }
-//
-//     public IAdaptable getDefaultPageInput() {
-//             IWorkspace workspace = ResourcesPlugin.getWorkspace();
-//             return workspace.getRoot();
-//     }
-
-//     @Override
-//     public void eventLoopException(Throwable exception) {
-//             super.eventLoopException(exception);
-//             StoreUtil.messageDialog("Unexpected error", null, exception.getMessage(), exception);
-//     }
-       
-       
+
+
        /* (non-Javadoc)
         * @see org.eclipse.ui.application.WorkbenchAdvisor#getWorkbenchErrorHandler()
         */
@@ -129,21 +73,21 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
            }
            return cdmStatusHandler;
        }
-       
+
 
        /**
-        * Custom status handler for handling scenarios which are 
+        * Custom status handler for handling scenarios which are
         * not handled by the editor (e.g. runtime exceptions).
-        * 
+        *
         * The default {@link org.eclipse.ui.statushandlers.WorkbenchErrorHandler}
         * is not used or extended because we need a handler for specific scenarios
         * which displays a custom built error dialog.
-        * 
+        *
         * @author cmathew
         *
         */
        class CdmStatusHandler extends AbstractStatusHandler {
-               
+
                /* (non-Javadoc)
                 * @see org.eclipse.ui.statushandlers.AbstractStatusHandler#handle(org.eclipse.ui.statushandlers.StatusAdapter, int)
                 */
@@ -151,27 +95,27 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
                public void handle(StatusAdapter statusAdapter, int style)
                {
                    if(statusAdapter.getStatus().matches(IStatus.ERROR)) {
-                       
-                       IStatus status = statusAdapter.getStatus();                                     
-                       Throwable t = statusAdapter.getStatus().getException();         
+
+                       IStatus status = statusAdapter.getStatus();
+                       Throwable t = statusAdapter.getStatus().getException();
                        // NOTE : Currently we only allow RuntimeExceptions since
-                       //        allowing all kinds of exceptions would also include 
-                       //        those in generated status objects coming from from logging triggers 
+                       //        allowing all kinds of exceptions would also include
+                       //        those in generated status objects coming from from logging triggers
                        //        leading to a recursive infinite loop of :
-                       //        initial exception thrown -> status handling -> dialog opening + logging of status -> 
+                       //        initial exception thrown -> status handling -> dialog opening + logging of status ->
                        //        status handling -> dialog opening + logging of status ... and so on
-                       if(t != null && t instanceof RuntimeException) {                                                        
-                               MessagingUtils.errorDialog("Unexpected error", 
-                                               null, 
-                                               MessagingUtils.UNEXPECTED_ERROR_MESSAGE, 
-                                               statusAdapter.getStatus().getPlugin(), 
+                       if(t != null && t instanceof RuntimeException) {
+                               MessagingUtils.errorDialog("Unexpected error",
+                                               null,
+                                               MessagingUtils.UNEXPECTED_ERROR_MESSAGE,
+                                               statusAdapter.getStatus().getPlugin(),
                                                t,
-                                               true);                                          
-                       }                           
+                                               true);
+                       }
                    }
                }
        }
-       
 
-       
+
+
 }
index b6ed686bfa68f1d4ff2777ef00b420ca4163dec0..99f3432ff90fc4e51aa825534f61651b68c2b10e 100644 (file)
@@ -1,22 +1,16 @@
 package eu.etaxonomy.taxeditor;
 
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.p2.core.Activator;
-import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
-import org.eclipse.equinox.p2.core.ProvisionException;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.application.ActionBarAdvisor;
 import org.eclipse.ui.application.IActionBarConfigurer;
 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
-import org.osgi.framework.ServiceReference;
 
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
+import eu.etaxonomy.taxeditor.update.P2Util;
 
 /**
  * <p>ApplicationWorkbenchWindowAdvisor class.</p>
@@ -52,7 +46,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
                configurer.setShowCoolBar(true);
                configurer.setShowStatusLine(true);
                configurer.setShowPerspectiveBar(true);
-               configurer.setTitle("EDIT Taxonomic Editor");
+               configurer.setTitle("EDIT Taxonomic Editor " + ApplicationUtil.getVersion());
                configurer.setShowProgressIndicator(true);
        }
 
@@ -67,7 +61,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
             CdmStore.connect();
         }
 
-               PreferencesUtil.checkDefaultLanguage();
+               P2Util.setDefaultUpdateRepositories();
 
        }
 
@@ -77,33 +71,5 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
                LoginDialog loginDialog = new LoginDialog(shell);
                return loginDialog.open();
        }
-
-       private void automaticUpdate(){
-
-               ServiceReference sr = Activator.context.getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
-               IProvisioningAgentProvider agentProvider = null;
-               if (sr == null) {
-            return;
-        }
-               agentProvider = (IProvisioningAgentProvider) Activator.context.getService(sr);
-               IProvisioningAgent agent = null;
-               try {
-                       agent = agentProvider.createAgent(null);//new URI("file:/Applications/eclipse36/p2"));
-                       if (agent == null) {
-                               MessagingUtils.error(this.getClass(), "No provisioning agent found. This application is not set up for updates.", null);
-                               return;
-                       }
-
-                       IStatus status = P2Util.checkForUpdates(agent, null);
-
-                       MessagingUtils.info(status);
-               } catch (ProvisionException e) {
-                       MessagingUtils.error(getClass(), e);
-               } finally {
-                       if(agent != null) {
-                agent.stop();
-            }
-               }
-       }
 }
 
diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/P2Util.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/P2Util.java
deleted file mode 100644 (file)
index 90191fe..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package eu.etaxonomy.taxeditor;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.internal.runtime.Log;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.operations.ProvisioningJob;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
-import org.eclipse.equinox.p2.operations.UpdateOperation;
-
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-
-/**
- * This class shows an example for checking for updates and performing the
- * update synchronously.  It is up to the caller to run this in a job if
- * a background update check is desired.  This is a reasonable way to run an
- * operation when user intervention is not required.   Another approach is
- * to separately perform the resolution and provisioning steps, deciding
- * whether to perform these synchronously or in a job.
- *
- * Any p2 operation can be run modally (synchronously), or the job
- * can be requested and scheduled by the caller.
- *
- * @see UpdateOperation#resolveModal(IProgressMonitor)
- * @see UpdateOperation#getResolveJob(IProgressMonitor)
- * @see UpdateOperation#getProvisioningJob(IProgressMonitor)
- * @see UpdateOperation#resolveModal(IProgressMonitor)
- * @see UpdateOperation#getResolveJob(IProgressMonitor)
- * @see UpdateOperation#getProvisioningJob(IProgressMonitor)
- * @see UpdateOperation#resolveModal(IProgressMonitor)
- * @see UpdateOperation#getResolveJob(IProgressMonitor)
- * @see UpdateOperation#getProvisioningJob(IProgressMonitor)
- * @author n.hoffmann
- * @version $Id: $
- */
-public class P2Util {
-       
-       private static final Logger logger = Logger.getLogger(P2Util.class);
-       
-       // XXX Check for updates to this application and return a status.
-       static IStatus checkForUpdates(IProvisioningAgent agent, IProgressMonitor monitor) throws OperationCanceledException {
-               ProvisioningSession session = new ProvisioningSession(agent);
-               
-               // the default update operation looks for updates to the currently
-               // running profile, using the default profile root marker. To change
-               // which installable units are being updated, use the more detailed
-               // constructors.
-               UpdateOperation operation = new UpdateOperation(session);
-               SubMonitor sub = SubMonitor.convert(monitor,
-                               "Checking for application updates...", 200);
-               IStatus status = operation.resolveModal(sub.newChild(100));
-               
-               if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
-                       return status;
-               }
-               if (status.getSeverity() == IStatus.CANCEL)
-                       throw new OperationCanceledException();
-               
-               if (status.getSeverity() != IStatus.ERROR) {
-                       // More complex status handling might include showing the user what updates
-                       // are available if there are multiples, differentiating patches vs. updates, etc.
-                       // In this example, we simply update as suggested by the operation.
-                       ProvisioningJob job = operation.getProvisioningJob(null);
-                       if(job == null){
-                               return status;
-                       }
-                       
-                       status = job.runModal(sub.newChild(100));
-                       if (status.getSeverity() == IStatus.CANCEL)
-                               throw new OperationCanceledException();
-               }
-               return status;
-       }
-}
index 50d279ef76dfb9d019320672cfb7e5760879f0a0..3d2a3330d82d3d416643d716e1bde9c1dbd5ff97 100644 (file)
@@ -1,6 +1,11 @@
 package eu.etaxonomy.taxeditor;
 
 import org.apache.log4j.Logger;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -37,8 +42,11 @@ public class TaxonomicEditorPlugin extends AbstractUIPlugin {
 
        private ServiceRegistration policyRegistration;
 
+       private ProvisioningSession session;
+       private ProvisioningUI ui;
+
 //     private CloudPolicy policy;
-       
+
        /**
         * The constructor
         */
@@ -50,24 +58,27 @@ public class TaxonomicEditorPlugin extends AbstractUIPlugin {
         * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
         */
        /** {@inheritDoc} */
-       public void start(BundleContext context) throws Exception {
+       @Override
+    public void start(BundleContext context) throws Exception {
                super.start(context);
-               
+
                plugin = this;
                bundleContext = context;
-               
+
                packageAdminRef = bundleContext.getServiceReference(PackageAdmin.class.getName());
                packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminRef);
-               
+
                logger.debug("Taxonomic Editor started.");
        }
 
        private Bundle getBundle(String symbolicName) {
-               if (packageAdmin == null)
-                       return null;
+               if (packageAdmin == null) {
+            return null;
+        }
                Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
-               if (bundles == null)
-                       return null;
+               if (bundles == null) {
+            return null;
+        }
                // Return the first bundle that is not installed or uninstalled
                for (int i = 0; i < bundles.length; i++) {
                        if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
@@ -76,16 +87,17 @@ public class TaxonomicEditorPlugin extends AbstractUIPlugin {
                }
                return null;
        }
-       
+
        /*
         * (non-Javadoc)
         * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
         */
        /** {@inheritDoc} */
+       @Override
        public void stop(BundleContext context) throws Exception {
-               plugin = null;
-               super.stop(context);
-               MessagingUtils.info("Taxonomic Editor stopped.");
+           plugin = null;
+           super.stop(context);
+           MessagingUtils.info("Taxonomic Editor stopped.");
        }
 
        /**
@@ -94,9 +106,27 @@ public class TaxonomicEditorPlugin extends AbstractUIPlugin {
         * @return the shared instance
         */
        public static TaxonomicEditorPlugin getDefault() {
-               return plugin;
+           return plugin;
        }
-       
-       
-       
+
+       public static BundleContext getContext() {
+           return bundleContext;
+       }
+
+       public ProvisioningUI getProvisioningUI() {
+
+           if (ui == null) {
+               ServiceReference reference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME);
+               IProvisioningAgent agent = (IProvisioningAgent) bundleContext.getService(reference);
+               session = new ProvisioningSession(agent);
+               Policy policy = null;// = (Policy) ServiceHelper.getService(ProvUIActivator.getContext(), Policy.class.getName());
+               if (policy == null) {
+                   policy = new Policy();
+               }
+               ui = new ProvisioningUI(session, IProfileRegistry.SELF, policy);
+           }
+           return ui;
+       }
+
+
 }
diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/InstallNewSoftwareHandler.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/InstallNewSoftwareHandler.java
new file mode 100644 (file)
index 0000000..f4e8d8a
--- /dev/null
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ *  Copyright (c) 2008, 2009 IBM Corporation and others.
+ *  All rights reserved. This program and the accompanying materials
+ *  are made available under the terms of the Eclipse Public License v1.0
+ *  which accompanies this distribution, and is available at
+ *  http://www.eclipse.org/legal/epl-v10.html
+ * 
+ *  Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package eu.etaxonomy.taxeditor.update;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+
+/**
+ * InstallNewSoftwareHandler invokes the install wizard
+ * 
+ * @since 3.5
+ */
+public class InstallNewSoftwareHandler extends PreloadingRepositoryHandler {
+
+       /**
+        * The constructor.
+        */
+       public InstallNewSoftwareHandler() {
+               super();
+       }
+
+       protected void doExecute(LoadMetadataRepositoryJob job) {
+               getProvisioningUI().openInstallWizard(null, null, job);
+       }
+
+       protected boolean waitForPreload() {
+               // If the user cannot see repositories, then we may as well wait
+               // for existing repos to load so that content is available.  
+               // If the user can manipulate the repositories, then we don't wait, 
+               // because we don't know which ones they want to work with.
+               return !getProvisioningUI().getPolicy().getRepositoriesVisible();
+       }
+
+       protected void setLoadJobProperties(Job loadJob) {
+               super.setLoadJobProperties(loadJob);
+               // If we are doing a background load, we do not wish to authenticate, as the
+               // user is unaware that loading was needed
+               if (!waitForPreload()) {
+                       loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_AUTHENTICATION_JOB_MARKER, Boolean.toString(true));
+                       loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_REPOSITORY_EVENTS, Boolean.toString(true));
+               }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/P2Util.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/P2Util.java
new file mode 100644 (file)
index 0000000..e666929
--- /dev/null
@@ -0,0 +1,219 @@
+package eu.etaxonomy.taxeditor.update;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
+import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.operations.ProvisioningJob;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.operations.Update;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import eu.etaxonomy.taxeditor.ApplicationUtil;
+import eu.etaxonomy.taxeditor.TaxonomicEditorPlugin;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+/**
+ * This class is a utility class for updating the editor from a p2 update site,
+ * greatly inspired by the links given below.
+ *
+ *
+ * To Do :
+ * - Allow configurable update sites
+ *
+ * Notes :
+ * - tried to get rid of the popup dialog which warns about unsigned jars using
+ *   -Declipse.p2.unsignedPolicy=allow but this does not work due to
+ *   https://bugs.eclipse.org/bugs/show_bug.cgi?id=391399, so the only solution
+ *   is to sign the jars with an official certificate.
+ *
+ * @see http://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_RCP_Application
+ * @see http://bugs.eclipse.org/281226
+ * @see http://www.vogella.com/tutorials/EclipseP2Update/article.html
+ */
+public class P2Util {
+
+    //private static String LOCAL_UPDATE_SITE = "file:///path/.../to/Development/EDIT/taxeditor/eu.etaxonomy.taxeditor/target/repository/";
+    private static String EDIT_NIGHTLY_UPDATE_SITE = "http://cybertaxonomy.eu/download/taxeditor/update/nightly/";
+    private static String EDIT_NIGHTLY_UPDATE_SITE_NAME = "Taxonomic Editor Nightly";
+
+    private static String EDIT_SNAPSHOT_UPDATE_SITE = "http://cybertaxonomy.eu/download/taxeditor/update/snapshot/";
+    private static String EDIT_SNAPSHOT_UPDATE_SITE_NAME = "Taxonomic Editor Snapshot";
+
+    private static String EDIT_STABLE_UPDATE_SITE = "http://cybertaxonomy.eu/download/taxeditor/update/stable/";
+    private static String EDIT_STABLE_UPDATE_SITE_NAME = "Taxonomic Editor Stable";
+
+    @SuppressWarnings("restriction")
+    public static void setDefaultUpdateRepositories() {
+        String updateSite = EDIT_NIGHTLY_UPDATE_SITE;
+        String updateSiteName = EDIT_NIGHTLY_UPDATE_SITE_NAME;
+
+        if(ApplicationUtil.isStable()) {
+            updateSite = EDIT_STABLE_UPDATE_SITE;
+            updateSiteName = EDIT_STABLE_UPDATE_SITE_NAME;
+        }
+        try {
+          final MetadataRepositoryElement element = new MetadataRepositoryElement(null, new URI(updateSite), true);
+          element.setNickname(updateSiteName);
+          ElementUtils.updateRepositoryUsingElements(ProvisioningUI.getDefaultUI(),new MetadataRepositoryElement[] {element}, null);
+        } catch (URISyntaxException e) {
+            MessagingUtils.errorDialog("Invalid update site URI",
+                    P2Util.class,
+                    "The update site URI has an invalid syntax",
+                    TaxonomicEditorPlugin.PLUGIN_ID,
+                    e,
+                    false);
+        }
+      }
+
+    /**
+     *
+     *
+     */
+    public static void checkForUpdates() {
+        // the main job which performs the update
+        Job updateJob = new Job("Update Job") {
+            @Override
+            public IStatus run(IProgressMonitor monitor) {
+                return doCheckForUpdates(monitor);
+            }
+        };
+        updateJob.schedule();
+    }
+
+    /**
+     * @param monitor
+     * @return
+     */
+    private static IStatus doCheckForUpdates(IProgressMonitor monitor) {
+
+        BundleContext bundleContext = TaxonomicEditorPlugin.getContext();
+        ServiceReference reference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME);
+        if (reference == null) {
+            IStatus errorStatus = new Status(IStatus.ERROR, TaxonomicEditorPlugin.PLUGIN_ID,
+                    "No provisioning agent found.  This application is not set up for updates.");
+            return errorStatus;
+        }
+
+        final IProvisioningAgent agent = (IProvisioningAgent) bundleContext.getService(reference);
+        IStatus updateStatus;
+        try {
+            updateStatus = P2Util.checkForUpdates(agent, monitor);
+            MessagingUtils.info(updateStatus);
+        } finally {
+            bundleContext.ungetService(reference);
+        }
+        return updateStatus;
+    }
+
+    /**
+     * @param agent
+     * @param monitor
+     * @return
+     * @throws OperationCanceledException
+     */
+    static IStatus checkForUpdates(IProvisioningAgent agent, final IProgressMonitor monitor) {
+        ProvisioningSession session = new ProvisioningSession(agent);
+        // the default update operation looks for updates to the currently
+        // running profile, using the default profile root marker. To change
+        // which installable units are being updated, use the more detailed
+        // constructors.
+        final UpdateOperation operation = new UpdateOperation(session);
+//        try {
+//            setUpdateRepositories(operation);
+//        } catch (URISyntaxException e) {
+//            MessagingUtils.errorDialog("Invalid update site URI",
+//                    operation,
+//                    "The update site URI has an invalid syntax",
+//                    TaxonomicEditorPlugin.PLUGIN_ID,
+//                    e,
+//                    false);
+//            return null;
+//        }
+
+        final IStatus status = operation.resolveModal(monitor);
+
+        if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
+            return status;
+        }
+
+        if (status.isOK() && status.getSeverity() != IStatus.ERROR) {
+            // We need this block of code to be in async execution
+            // since the confirm dialogs work only on the UI thread
+            Display.getDefault().asyncExec(new Runnable() {
+                @Override
+                public void run() {
+                    String updates = "";
+                    Update[] possibleUpdates = operation
+                            .getPossibleUpdates();
+                    for (Update update : possibleUpdates) {
+                        updates += update + "\n";
+                    }
+
+                    boolean doInstall = MessagingUtils.confirmDialog("Updates available", "Do you want to install the available updates ?");
+                    // We may need to think whether we still run in async mode once
+                    // the user agrees to update. Maybe be reasonable to change to blocking
+                    // from this point until the update is complete.
+
+                    // More complex status handling might include showing the user what
+                    // updates are available if there are multiples, differentiating
+                    // patches vs. updates, etc. In this example, we simply update as
+                    // suggested by the operation.
+                    if(doInstall) {
+                        ProvisioningJob provisioningJob = operation.getProvisioningJob(monitor);
+                        if (provisioningJob == null) {
+                            MessagingUtils.messageDialog("Error in performing update",
+                                    operation,
+                                    "ProvisioningJob could not be created." + System.getProperty("line.separator") +
+                                    "Either this application does not support p2 software installation or this application has been launched from within the Eclipse IDE",
+                                    null,
+                                    false);
+
+                        } else {
+                            // register a job change listener to track
+                            // installation progress and notify user upon success
+                            provisioningJob
+                            .addJobChangeListener(new JobChangeAdapter() {
+                                @Override
+                                public void done(IJobChangeEvent event) {
+                                    if (event.getResult().isOK()) {
+                                        // We need this block of code to be in async execution
+                                        // since the confirm dialogs work only on the UI thread
+                                        Display.getDefault().asyncExec(new Runnable() {
+                                            @Override
+                                            public void run() {
+                                                boolean restart = MessagingUtils.confirmDialog(
+                                                        "Updates installed, restart?",
+                                                        "Updates have been installed successfully, do you want to restart?");
+                                                if (restart) {
+                                                    PlatformUI.getWorkbench().restart();
+                                                }
+                                            }
+                                        });
+                                    }
+                                    super.done(event);
+                                }
+                            });
+                            provisioningJob.schedule();
+                        }
+                    }
+                }
+            });
+        }
+        return status;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/PreloadingRepositoryHandler.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/PreloadingRepositoryHandler.java
new file mode 100644 (file)
index 0000000..716482c
--- /dev/null
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package eu.etaxonomy.taxeditor.update;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * PreloadingRepositoryHandler provides background loading of
+ * repositories before executing the provisioning handler.
+ * 
+ * @since 3.5
+ */
+abstract class PreloadingRepositoryHandler extends AbstractHandler {
+
+       /**
+        * The constructor.
+        */
+       public PreloadingRepositoryHandler() {
+               // constructor
+       }
+
+       /**
+        * Execute the command.
+        */
+       public Object execute(ExecutionEvent event) {
+               doExecuteAndLoad();
+               return null;
+       }
+
+       void doExecuteAndLoad() {
+               if (preloadRepositories()) {
+                       //cancel any load that is already running
+                       Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
+                       final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI());
+                       setLoadJobProperties(loadJob);
+                       if (waitForPreload()) {
+                               loadJob.addJobChangeListener(new JobChangeAdapter() {
+                                       public void done(IJobChangeEvent event) {
+                                               if (PlatformUI.isWorkbenchRunning())
+                                                       if (event.getResult().isOK()) {
+                                                               PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+                                                                       public void run() {
+                                                                               doExecute(loadJob);
+                                                                       }
+                                                               });
+                                                       }
+                                       }
+                               });
+                               loadJob.setUser(true);
+                               loadJob.schedule();
+
+                       } else {
+                               loadJob.setSystem(true);
+                               loadJob.setUser(false);
+                               loadJob.schedule();
+                               doExecute(null);
+                       }
+               } else {
+                       doExecute(null);
+               }
+       }
+
+       protected abstract void doExecute(LoadMetadataRepositoryJob job);
+
+       protected boolean preloadRepositories() {
+               return true;
+       }
+
+       protected boolean waitForPreload() {
+               return true;
+       }
+
+       protected void setLoadJobProperties(Job loadJob) {
+               loadJob.setProperty(LoadMetadataRepositoryJob.ACCUMULATE_LOAD_ERRORS, Boolean.toString(true));
+       }
+
+       protected ProvisioningUI getProvisioningUI() {
+               return ProvisioningUI.getDefaultUI();
+       }
+
+       /**
+        * Return a shell appropriate for parenting dialogs of this handler.
+        * @return a Shell
+        */
+       protected Shell getShell() {
+               return PlatformUI.getWorkbench().getModalDialogShellProvider().getShell();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java
new file mode 100644 (file)
index 0000000..bca8c99
--- /dev/null
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package eu.etaxonomy.taxeditor.update;
+
+import org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.jface.wizard.WizardDialog;
+
+/**
+ * UpdateHandler invokes the check for updates UI
+ *
+ * @since 3.4
+ */
+public class UpdateHandler extends PreloadingRepositoryHandler {
+
+       boolean hasNoRepos = false;
+
+       @Override
+    protected void doExecute(LoadMetadataRepositoryJob job) {
+               if (hasNoRepos) {
+                       return;
+               }
+               UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
+
+
+               // check for updates
+               operation.resolveModal(null);
+               if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
+                       if (UpdateSingleIUWizard.validFor(operation)) {
+                               // Special case for only updating a single root
+                               UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
+                               WizardDialog dialog = new WizardDialog(getShell(), wizard);
+                               dialog.create();
+                               dialog.open();
+                       } else {
+                               // Open the normal version of the update wizard
+                               getProvisioningUI().openUpdateWizard(false, operation, job);
+                       }
+               }
+       }
+
+       @Override
+    protected boolean preloadRepositories() {
+               hasNoRepos = false;
+               RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
+               if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
+                       hasNoRepos = true;
+                       return false;
+               }
+               return super.preloadRepositories();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle.properties b/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle.properties
new file mode 100644 (file)
index 0000000..700df72
--- /dev/null
@@ -0,0 +1,11 @@
+#Properties file for eu.etaxonomy.taxeditor.bulkeditor
+editor.name = Bulk Editor
+editor.name.0 = Name Editor
+editor.name.1 = Data Import Editor
+menu.label = Bulk Editor
+menu.label.0 = Search Specimen
+menu.label.1 = New
+menu.label.2 = Set Marker Type
+view.name = Referencing Objects
+page.name = Marker Types
+page.name.0 = Bulk Editor
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_de.properties b/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_de.properties
new file mode 100644 (file)
index 0000000..04c109f
--- /dev/null
@@ -0,0 +1,11 @@
+#Properties file for eu.etaxonomy.taxeditor.bulkeditor
+editor.name = Bulk Editor
+editor.name.0 = Namen Editor
+editor.name.1 = Daten-Import Editor
+menu.label = Bulk Editor
+menu.label.0 = Suche Specimen
+menu.label.1 = Neu
+menu.label.2 = W\u00e4hle Markertyp
+view.name = Referenzierende Objekte
+page.name = Markertyp
+page.name.0 = Bulk Editor
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_en.properties b/eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_en.properties
new file mode 100644 (file)
index 0000000..700df72
--- /dev/null
@@ -0,0 +1,11 @@
+#Properties file for eu.etaxonomy.taxeditor.bulkeditor
+editor.name = Bulk Editor
+editor.name.0 = Name Editor
+editor.name.1 = Data Import Editor
+menu.label = Bulk Editor
+menu.label.0 = Search Specimen
+menu.label.1 = New
+menu.label.2 = Set Marker Type
+view.name = Referencing Objects
+page.name = Marker Types
+page.name.0 = Bulk Editor
\ No newline at end of file
index a78e9b43982761539c4a02f7e1b75d9981143088..31e123d6baacda0b752e105768618b1d740dbcae 100644 (file)
@@ -4,4 +4,5 @@ bin.includes = META-INF/,\
                .,\\r
                icons/,\\r
                plugin.xml,\\r
-               p2.inf\r
+               p2.inf,\\r
+               OSGI-INF/l10n/bundle.properties\r
index dabd669293c1d44e2312e96b98cf46b2faf24718..7d069767e433d913a04255aa971e2cb8ef3f84ea 100644 (file)
             class="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor"\r
             default="false"\r
             id="bulkeditor.editor"\r
-            name="Bulk Editor">\r
+            name="%editor.name">\r
       </editor>\r
       <editor\r
             class="eu.etaxonomy.taxeditor.nameditor.TaxonNameEditor"\r
             default="false"\r
             id="nameeditor.editor"\r
-            name="Name Editor">\r
+            name="%editor.name.0">\r
       </editor>\r
       <editor\r
             class="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
             default="false"\r
             id="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
-            name="Data Import Editor">\r
+            name="%editor.name.1">\r
       </editor>\r
    </extension>\r
    <extension\r
             locationURI="menu:org.eclipse.ui.main.menu.window?before=eu.etaxonomy.taxeditor.application.windowMenu.last">\r
          <menu\r
                id="bulkeditor.menus.openmenu"\r
-               label="Bulk Editor">\r
+               label="%menu.label">\r
          </menu>\r
          <menu\r
-               label="Search Specimen">\r
+               label="%menu.label.0">\r
          </menu>\r
       </menuContribution>\r
       <menuContribution\r
@@ -65,7 +65,7 @@
       <menuContribution\r
             locationURI="popup:#BulkEditorContext">\r
          <menu\r
-               label="New">\r
+               label="%menu.label.1">\r
             <dynamic\r
                   class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicNewObjectMenu"\r
                   id="eu.etaxonomy.taxeditor.bulkeditor.dynamicNewMenu">\r
                visible="true">\r
          </separator>\r
          <menu\r
-               label="Set Marker Type">\r
+               label="%menu.label.2">\r
             <dynamic\r
                   class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicMarkerTypeEditingMenu"\r
                   id="eu.etaxonomy.taxeditor.bulkeditor.dynamicMarkerTypeEditingMenu">\r
                style="push">\r
          </command>\r
       </menuContribution>\r
-      <menuContribution\r
-            allPopups="false"\r
-            locationURI="popup:eu.etaxonomy.taxeditor.editor.view.media">\r
-         <command\r
-               commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addDerivedUnitMedia"\r
-               label="Add Derived Unit Media"\r
-               style="push">\r
-            <visibleWhen>\r
-               <not>\r
-                  <reference\r
-                        definitionId="isTaxonEditor">\r
-                  </reference>\r
-               </not>\r
-            </visibleWhen>\r
-         </command>\r
-         <command\r
-               commandId="eu.etaxonomy.taxeditor.bulkeditor.command.derivedunit.addFieldObjectMedia"\r
-               label="Add Field Object Media"\r
-               style="push">\r
-            <visibleWhen>\r
-               <not>\r
-                  <reference\r
-                        definitionId="isTaxonEditor">\r
-                  </reference>\r
-               </not>\r
-            </visibleWhen>\r
-         </command>\r
-      </menuContribution>\r
       <menuContribution\r
             allPopups="false"\r
             locationURI="popup:#DataImportEditorContext">\r
       <view\r
             class="eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView"\r
             id="eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"\r
-            name="Referencing Objects"\r
+            name="%view.name"\r
             restorable="false">\r
       </view>\r
    </extension>   \r
             properties="isMergingEnabled"\r
             type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
       </propertyTester>\r
+      <propertyTester\r
+            class="eu.etaxonomy.taxeditor.bulkeditor.PropertyTester"\r
+            id="eu.etaxonomy.taxeditor.bulkeditor.propertyTester"\r
+            namespace="eu.etaxonomy.taxeditor.bulkeditor.propertyTester"\r
+            properties="isDerivedUnitEditor"\r
+            type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
+      </propertyTester>\r
    </extension>\r
    <extension\r
          point="org.eclipse.ui.handlers">\r
             category="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"\r
             class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorMarkerPreferencePage"\r
             id="eu.etaxonomy.taxeditor.preferences.bulkeditor.markerTypes"\r
-            name="Marker Types">\r
+            name="%page.name">\r
       </page>\r
       <page\r
             category="eu.etaxonomy.taxeditor.preferences.general"\r
             class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorGeneralPreferencePage"\r
             id="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"\r
-            name="Bulk Editor">\r
+            name="%page.name.0">\r
       </page>\r
    </extension>\r
-   <extension\r
-         point="org.eclipse.core.expressions.propertyTesters">\r
-      <propertyTester\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.PropertyTester"\r
-            id="eu.etaxonomy.taxeditor.bulkeditor.propertyTester"\r
-            namespace="eu.etaxonomy.taxeditor.bulkeditor.propertyTester"\r
-            properties="isDerivedUnitEditor"\r
-            type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
-      </propertyTester>\r
-   </extension>\r
    <extension\r
          point="org.eclipse.ui.perspectiveExtensions">\r
       <perspectiveExtension\r
index d68d48c1cc80273784a6778da3b02cbc6de3d168..73bf55b4539c60bd16f84dcfbdb85d191291f4a3 100644 (file)
@@ -44,17 +44,21 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
- * <p>BulkEditor class.</p>
+ * <p>
+ * BulkEditor class.
+ * </p>
  *
  * @author p.ciardelli
  * @created 07.07.2009
  * @version 1.0
  */
-public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails, IDirtyMarkableSelectionProvider{
+public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails, IPartContentHasMedia,
+        IDirtyMarkableSelectionProvider {
 
        /** Constant <code>ID="bulkeditor.editor"</code> */
        public static final String ID = "bulkeditor.editor";
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AbstractAddDerivedUnitFacadeMediaHandler.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AbstractAddDerivedUnitFacadeMediaHandler.java
deleted file mode 100644 (file)
index 4402368..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// $Id$
-/**
-* 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.bulkeditor.derivedunit.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
-import eu.etaxonomy.taxeditor.bulkeditor.derivedunit.operation.AddDerivedUnitFacadeMediaOperation;
-import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- * @author n.hoffmann
- * @created Feb 11, 2011
- * @version 1.0
- */
-public abstract class AbstractAddDerivedUnitFacadeMediaHandler extends AbstractHandler {
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-        */
-       @Override
-       public Object execute(ExecutionEvent event) throws ExecutionException {
-               IWorkbenchPart part = HandlerUtil.getActivePart(event);
-               IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
-               
-               
-               IEditorPart editor = HandlerUtil.getActiveEditor(event);
-               IEditorInput input = editor.getEditorInput();
-               
-               
-               if(input instanceof OccurrenceEditorInput){
-                       BulkEditor bulkEditor = (BulkEditor) editor;
-                       ISelection selection = bulkEditor.getSelectionProvider().getSelection();
-                       
-                       if(selection instanceof IStructuredSelection){
-                               Object element = ((IStructuredSelection) selection).getFirstElement();
-                               if(element instanceof DerivedUnit){
-                                       
-                                       try{
-                                               AbstractPostOperation operation = new AddDerivedUnitFacadeMediaOperation(event.getCommand().getName(), BulkEditorUtil.getUndoContext(), (DerivedUnit) element, getMode(), postOperationEnabled);
-                                               BulkEditorUtil.executeOperation(operation);
-                                       } catch (NotDefinedException e) {
-                                               MessagingUtils.warn(getClass(), "Command name not set.");
-                                       }                                       
-                               }
-                       }
-               }
-               return null;
-       }
-
-       /**
-        * @return
-        */
-       protected abstract int getMode();
-
-}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddDerivedUnitMediaHandler.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddDerivedUnitMediaHandler.java
deleted file mode 100644 (file)
index 21fa66c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// $Id$
-/**
-* 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.bulkeditor.derivedunit.handler;
-
-import eu.etaxonomy.taxeditor.bulkeditor.derivedunit.operation.AddDerivedUnitFacadeMediaOperation;
-
-
-/**
- * @author n.hoffmann
- * @created Feb 7, 2011
- * @version 1.0
- */
-public class AddDerivedUnitMediaHandler extends AbstractAddDerivedUnitFacadeMediaHandler {
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AbstractAddDerivedUnitFacadeMediaHandler#getMode()
-        */
-       @Override
-       protected int getMode() {
-               return AddDerivedUnitFacadeMediaOperation.DERIVED_UNIT_MEDIA;
-       }
-
-       
-}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddFieldObjectMediaHandler.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddFieldObjectMediaHandler.java
deleted file mode 100644 (file)
index 2d19d11..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// $Id$
-/**
-* 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.bulkeditor.derivedunit.handler;
-
-import eu.etaxonomy.taxeditor.bulkeditor.derivedunit.operation.AddDerivedUnitFacadeMediaOperation;
-
-/**
- * @author n.hoffmann
- * @created Feb 11, 2011
- * @version 1.0
- */
-public class AddFieldObjectMediaHandler extends
-               AbstractAddDerivedUnitFacadeMediaHandler {
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.bulkeditor.derivedunit.handler.AbstractAddDerivedUnitFacadeMediaHandler#getMode()
-        */
-       @Override
-       protected int getMode() {
-               return AddDerivedUnitFacadeMediaOperation.FIELD_OBJECT_MEDIA;
-       }
-
-}
index ce8935ac2072251cf6f225298b65070a1a8fc91e..718c96cd31413a3c4295a68c263b98f3fcffffcf 100644 (file)
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>eu.etaxonomy.taxeditor.editor</name>\r
-       <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.ManifestBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.SchemaBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-               <nature>org.eclipse.pde.PluginNature</nature>\r
-       </natures>\r
-       <linkedResources>\r
-               <link>\r
-                       <name>lib/LibrAlign</name>\r
-                       <type>2</type>\r
-                       <locationURI>WORKSPACE_LOC/LibrAlign/bin</locationURI>\r
-               </link>\r
-               <link>\r
-                       <name>lib/bioinfweb.commons</name>\r
-                       <type>2</type>\r
-                       <locationURI>WORKSPACE_LOC/_Lib/bin</locationURI>\r
-               </link>\r
-       </linkedResources>\r
-</projectDescription>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>eu.etaxonomy.taxeditor.editor</name>
+       <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.PluginNature</nature>
+       </natures>
+       <linkedResources>
+               <link>
+                       <name>lib/LibrAlign</name>
+                       <type>2</type>
+                       <location>/home/pplitzner/svn/LibrAlign/LibrAlign/main/bin</location>
+               </link>
+               <link>
+                       <name>lib/bioinfweb.commons</name>
+                       <type>2</type>
+                       <location>/home/pplitzner/svn/LibrAlign/commons/main/bin</location>
+               </link>
+       </linkedResources>
+</projectDescription>
index 3f16773277bb5406a6c853e46ee89c64951d63d4..8224ccffde6806160e0f5a86c61e245d315edb53 100644 (file)
@@ -113,4 +113,20 @@ category.name.7 = -- Group
 command.name.34 = Edit CDM Authorities\r
 command.name.35 = Open Derivate View\r
 scheme.description = The default key binding scheme for the Taxonomic Editor\r
-scheme.name = Taxonomic Editor Default Key Bindings
\ No newline at end of file
+scheme.name = Taxonomic Editor Default Key Bindings\r
+editor.name.6 = Specimen Import Editor\r
+editor.name.7 = Gbif Import Editor\r
+editor.name.8 = Checklist Editor\r
+view.name.4 = Specimen Import\r
+view.name.5 = GBIF Specimen Import\r
+command.label.46 = Name\r
+command.label.47 = Reference\r
+command.label.48 = Datasource\r
+command.label.49 = Misapplication\r
+command.label.50 = Use Existing Image\r
+command.name.36 = Create Misapplication\r
+command.name.37 = Use Existing Image\r
+command.name.38 = Open Checklist Editor\r
+command.name.39 = New Datasource\r
+wizard.name = Specimen Search/Import\r
+wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.
\ No newline at end of file
index 09784a89392ea2a80660475b4f2415ada22f9c71..cde90f57ab9ac3d73bd60eca09090805549d1a99 100644 (file)
@@ -114,3 +114,18 @@ command.name.34 = Bearbeite CDM Rechte
 command.name.35 = \u00d6ffne Derivate Ansicht
 scheme.description = Die Standard Tastenbindungsschema f\u00fcr den Taxonomischen Editor
 scheme.name = Taxonomic Editor Standard Tastenbindung
+editor.name.7 = Gbif Import Editor
+editor.name.8 = Checklist Editor
+view.name.4 = Specimen Import
+view.name.5 = GBIF Specimen Import
+command.label.46 = Name
+command.label.47 = Referenz
+command.label.48 = Datenquelle
+command.label.49 = Misapplication
+command.label.50 = Benutze vorhandenes Bild
+command.name.36 = Erstelle Misapplication
+command.name.37 = Benutze vorhandenes Bild
+command.name.38 = \u00d6ffne Checklist Editor
+command.name.39 = Neue Datenquelle
+wizard.name = Specimen Suche/Import
+wizard.description = Sendet eine Anfrage mit den eingegebenen Parametern an den Datenprovider.\nHinweis: Die Anzahl der Anfrageergebnisse sind auf 100 begrenzt.
\ No newline at end of file
index 3f16773277bb5406a6c853e46ee89c64951d63d4..552f93a522181099bd0d2c04f36ee6471a3e4bd3 100644 (file)
@@ -113,4 +113,19 @@ category.name.7 = -- Group
 command.name.34 = Edit CDM Authorities\r
 command.name.35 = Open Derivate View\r
 scheme.description = The default key binding scheme for the Taxonomic Editor\r
-scheme.name = Taxonomic Editor Default Key Bindings
\ No newline at end of file
+scheme.name = Taxonomic Editor Default Key Bindingseditor.name.6 = Specimen Import Editor\r
+editor.name.7 = Gbif Import Editor\r
+editor.name.8 = Checklist Editor\r
+view.name.4 = Specimen Import\r
+view.name.5 = GBIF Specimen Import\r
+command.label.46 = Name\r
+command.label.47 = Reference\r
+command.label.48 = Datasource\r
+command.label.49 = Misapplication\r
+command.label.50 = Use Existing Image\r
+command.name.36 = Create Misapplication\r
+command.name.37 = Use Existing Image\r
+command.name.38 = Open Checklist Editor\r
+command.name.39 = New Datasource\r
+wizard.name = Specimen Search/Import\r
+wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.
\ No newline at end of file
index 3e9c53eb8f35c52b43e02964397d9b3e6f9fd4f0..a31ca6d0b03d99c6aef772c16c7554c66204eb98 100644 (file)
             class="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor"
             default="false"
             id="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor"
-            name="Specimen Import Editor">
+            name="%editor.name.6">
       </editor>
       <editor
             class="eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditor"
             default="false"
             id="eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditor"
-            name="Gbif Import Editor">
+            name="%editor.name.7">
       </editor>
          <editor
             class="eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"
             icon="icons/address-book-new.png"
             id="eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"
-            name="Checklist Editor">
+            name="%editor.name.8">
       </editor>
       <editor
             class="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor"
                allowMultiple="true"
                class="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportView"
                id="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportView"
-               name="Specimen Import">
+               name="%view.name.4">
          </view>
          <view
                allowMultiple="true"
                class="eu.etaxonomy.taxeditor.editor.view.dataimport.GbifResponseImportView"
                id="eu.etaxonomy.taxeditor.editor.view.dataimport.GbifResponseImportView"
-               name="GBIF Specimen Import">
+               name="%view.name.5">
          </view>
       </extension>
    <extension
             locationURI="menu:eu.etaxonomy.navigation.menu.new?after=eu.etaxonomy.navigation.menu.new.separator1">
          <command
                commandId="eu.etaxonomy.taxeditor.editor.command.new.name"
-               label="Name"
+               label="%command.label.46"
                style="push">
          </command>
          <command
                commandId="eu.etaxonomy.taxeditor.editor.command.new.reference"
-               label="Reference"
+               label="%command.label.47"
                style="push">
          </command>
          <command
          </separator>
          <command
                commandId="eu.etaxonomy.taxeditor.editor.command.new.datasource"
-               label="Datasource"
+               label="%command.label.48"
                style="push">
          </command>
       </menuContribution>
             </separator>
            <command
                   commandId="eu.etaxonomy.taxeditor.editor.name.createMisapplication"
-                  label="Misapplication"
+                  label="%command.label.49"
                   style="push">
                <visibleWhen>
                   <or>
                commandId="taxeditor-editor.command.newimagegallery"
                label="%command.label.37"
                style="push">
+            <visibleWhen>
+               <or>
+                  <reference
+                        definitionId="isBulkEditor">
+                  </reference>
+                  <reference
+                        definitionId="isTaxonEditor">
+                  </reference>
+                  <reference
+                        definitionId="isDerivateEditor">
+                  </reference>
+               </or>
+            </visibleWhen>
          </command>
          <separator
                name="taxeditor-editor.separator1"
          </command>
          <command
                commandId="taxeditor-editor.useExistingImage"
-               label="Use Existing Image"
+               label="%command.label.50"
                style="push">
             <visibleWhen
                   checkEnabled="false">
             categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
             defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateMisapplicationHandler"
             id="eu.etaxonomy.taxeditor.editor.name.createMisapplication"
-            name="Create Misapplication">
+            name="%command.name.36">
       </command>
       <!--command
             defaultHandler="eu.etaxonomy.taxeditor.editor.handler.MoveTaxonHandler"
             categoryId="eu.etaxonomy.taxeditor.editor.media.category"
             defaultHandler="eu.etaxonomy.taxeditor.editor.view.media.handler.AddExistingMediaHandler"
             id="taxeditor-editor.useExistingImage"
-            name="Use Existing Image">
+            name="%command.name.37">
       </command>
       <command
             categoryId="eu.etaxonomy.taxeditor.editor.media.category"
        <command
              defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"
              id="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler"
-             name="Open Checklist Editor">
+             name="%command.name.38">
       </command>
       <command
             categoryId="eu.etaxonomy.taxeditor.editor.new.category"
             defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.CreateDataSourceHandler"
             id="eu.etaxonomy.taxeditor.editor.command.new.datasource"
-            name="New Datasource">
+            name="%command.name.39">
       </command>
       <command
             defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenAlignmentEditor"
             </test>
          </with>
       </definition>
+      <definition
+            id="isBulkEditor">
+         <with
+               variable="selection">
+            <test
+                  property="eu.etaxonomy.taxeditor.descriptions.propertyTester.isBulkEditor">
+            </test>
+         </with>
+      </definition>
+      <definition
+            id="isDerivateEditor">
+         <with
+               variable="selection">
+            <test
+                  property="eu.etaxonomy.taxeditor.descriptions.propertyTester.isDerivateEditor">
+            </test>
+         </with>
+      </definition>
       <definition
             id="isDescription">
          <with
             class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.DescriptionsMenuPropertyTester"
             id="eu.etaxonomy.taxeditor.descriptions.PropertyTester"
             namespace="eu.etaxonomy.taxeditor.descriptions.propertyTester"
-            properties="isMedia,isDescription,isDescriptionElement,isDeletable,isFeatureNodeContainer,isImageGallery,isTaxonEditor"
+            properties="isMedia,isDescription,isDescriptionElement,isDeletable,isFeatureNodeContainer,isImageGallery,isTaxonEditor,isBulkEditor,isDerivateEditor"
             type="org.eclipse.jface.viewers.TreeSelection">
       </propertyTester>
       <propertyTester
             category="eu.etaxonomy.taxeditor.import.category.cdm"
             class="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenSearchWizard"
             id="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenSearchWizard"
-            name="Specimen Search/Import">
+            name="%wizard.name">
          <description>
-            Queries data provider for specimens with specified parameters.
-Note: Query results are currently limited to 100.
+            %wizard.description
          </description>
       </wizard>
    </extension>
index a55a03de33824865111ca34a73e4c317c899628a..189827643df3b9ad7a77092bfb540e75e2e8fe80 100644 (file)
@@ -30,6 +30,7 @@ import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
 import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
 import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
@@ -146,7 +147,7 @@ public class MultiPageTaxonEditor extends FormEditor implements
             monitor.worked(1);            
         } catch (Exception e) {
             setFocus();
-            MessagingUtils.operationDialog(this, e, "saving a taxon", " Please close and reopen the taxon again.");
+            MessagingUtils.operationDialog(this, e, TaxeditorEditorPlugin.PLUGIN_ID,"saving a taxon", " Please close and reopen the taxon again.");
             disableEditor(true);
         } finally {
             monitor.done();
index f2cd2af55c59ddbfaa26559dadf8ea67f1bcf827..66e48500c168808b42b830c91fe020f88bc40c8f 100644 (file)
@@ -9,6 +9,7 @@
 */
 package eu.etaxonomy.taxeditor.editor.view.dataimport;
 
+import java.util.ArrayList;
 import java.util.Collection;
 
 import org.apache.log4j.Logger;
@@ -48,7 +49,7 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
 
     protected final Logger logger = Logger.getLogger(DataImportView.class);
 
-    protected Collection<T> results;
+    protected Collection<T> results = new ArrayList<T>();
 
     protected OccurenceQuery query;
 
index 884bdfea99152f4c25fda76c4407f595680ce4d5..79784077cc0d36604f4a752102fb31b30f7ec655 100644 (file)
@@ -8,8 +8,13 @@ import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
@@ -35,9 +40,19 @@ public class SaveImportedSpecimenAction extends Action {
                         data = ((GbifResponse) item.getData()).getDerivedUnitFacade().innerFieldUnit();
                     }
                     if(data instanceof SpecimenOrObservationBase){
-//                        dataImportView.getConversationHolder().bind();
-//                        CdmStore.getService(IReferenceService.class).saveOrUpdate(((SpecimenOrObservationBase) data).getSources());
-                        CdmStore.getService(IOccurrenceService.class).saveOrUpdate((SpecimenOrObservationBase<?>) data);
+                        ConversationHolder conversation = dataImportView.getConversationHolder();
+                        SpecimenOrObservationBase<?> specimen = (SpecimenOrObservationBase<?>) data;
+                        conversation.bind();
+                        IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
+                        for(ICdmBase cdmEntity:occurrenceService.getNonCascadedAssociatedElements(specimen)){
+                            if(cdmEntity instanceof DefinedTermBase){
+                                persistTerm((DefinedTermBase<?>) cdmEntity, CdmStore.getService(ITermService.class), conversation);
+                            }
+                            else if(cdmEntity instanceof TaxonNameBase){
+                                //user interaction
+                            }
+                        }
+                        occurrenceService.saveOrUpdate(specimen);
                         dataImportView.getConversationHolder().commit(true);
                     }
                 }
@@ -45,6 +60,16 @@ public class SaveImportedSpecimenAction extends Action {
         }
     }
 
+    private void persistTerm(DefinedTermBase<?> term, ITermService termService, ConversationHolder conversation){
+        if(term!=null){
+            //if the term does not exist in the DB save it
+            if(termService.find(term.getUuid())==null){
+                termService.saveOrUpdate(term);
+            }
+        }
+    }
+
+
     /* (non-Javadoc)
      * @see org.eclipse.jface.action.Action#getText()
      */
index 0a0fea8517eccce946e4e51449b635ad2c57735b..9d915e29ad188b8063b81a1a381cabe460d9885b 100644 (file)
@@ -36,6 +36,7 @@ import eu.etaxonomy.cdm.api.service.search.SearchResult;
 import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;
 import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
 import eu.etaxonomy.cdm.model.common.Annotation;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.ISourceable;
 import eu.etaxonomy.cdm.model.common.IdentifiableSource;
 import eu.etaxonomy.cdm.model.common.LSID;
@@ -914,4 +915,12 @@ public class TransientOccurenceService implements IOccurrenceService {
                return defaultService.findWithoutFlush(uuid);
        }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getNonCascadedAssociatedElements(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.api.conversation.ConversationHolder)
+     */
+    @Override
+    public Collection<ICdmBase> getNonCascadedAssociatedElements(SpecimenOrObservationBase<?> specimen) {
+        return defaultService.getNonCascadedAssociatedElements(specimen);
+    }
+
 }
index 0188825eb5a25e2b13bc80f7dc92b138e24171af..69f175743e030568b3e904015de829284f4a00b2 100644 (file)
@@ -76,7 +76,9 @@ public class DerivateDropListener extends ViewerDropAdapter {
                     return true;
                 }
                 else{
-                    MessagingUtils.warningDialog("Moving derivate not possible!", derivateView, "Moving \""+DerivateLabelProvider.getDerivateText(draggednode)+"\" to \""+DerivateLabelProvider.getDerivateText(targetNode)+"\" is not possible!");
+                    DerivateLabelProvider derivateLabelProvider = new DerivateLabelProvider();
+                    derivateLabelProvider.setConversation(derivateView.getConversationHolder());
+                    MessagingUtils.warningDialog("Moving derivate not possible!", derivateView, "Moving \""+derivateLabelProvider.getDerivateText(draggednode)+"\" to \""+derivateLabelProvider.getDerivateText(targetNode)+"\" is not possible!");
                 }
             }
         }
@@ -99,7 +101,10 @@ public class DerivateDropListener extends ViewerDropAdapter {
         Object draggedNodeValue = draggedNode.getValue();
         Object targetNodeValue = targetNode.getValue();
         TreeNode fromParentNode = draggedNode.getParent();
-        Object fromParentSpecimen = fromParentNode.getValue();
+        Object fromParentSpecimen = null;
+        if(fromParentNode!=null){
+            fromParentNode.getValue();
+        }
 
         // drag'n'drop for SpecimenOrObservationBase
         IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
index 90fc97eeb9c9f4fdb5297f5594529e3a05556bff..1cc320d3308a529ff502d9bb61b81a868dbe71cc 100644 (file)
@@ -9,6 +9,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.util.LocalSelectionTransfer;
 import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -31,23 +34,24 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
 import eu.etaxonomy.cdm.model.molecular.Sequence;
 import eu.etaxonomy.cdm.model.molecular.SingleRead;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
+import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
 import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
 
 /**
- * Displays the derivate hierarchy of all derivates having one single {@link FieldUnit} as root.
+ * Displays the derivate hierarchy of the specimen specified in the editor input.
  *
  */
 public class DerivateView extends EditorPart implements IPartContentHasFactualData, IDirtyMarkableSelectionProvider,
-        IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener {
+        IConversationEnabled, IPartContentHasDetails, IPartContentHasMedia, IPartContentHasSupplementalData,
+        IContextListener, ISelectionChangedListener {
 
        /**
      * Key used for storing a single DerivateView in a memento
@@ -73,6 +77,8 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
 
     private Set<SingleRead> multiLinkSingleReads;
 
+    private ISelection selection = null;
+
     /**
      * Default constructor
      */
@@ -88,10 +94,13 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
         viewer.setContentProvider(new DerivateContentProvider());
         labelProvider = new DerivateLabelProvider();
+        labelProvider.setConversation(conversation);
         viewer.setLabelProvider(labelProvider);
         viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
         // Propagate selection from viewer
         getSite().setSelectionProvider(viewer);
+        //listen to selection changes
+        viewer.addSelectionChangedListener(this);
 
         //create context menu
         MenuManager menuManager = new MenuManager();
@@ -107,7 +116,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         if(editorInput instanceof DerivateViewEditorInput){
             SpecimenOrObservationBase<?> specimen = ((DerivateViewEditorInput) editorInput).getDerivate();
             SpecimenOrObservationBase<?> rootElement = ((DerivateViewEditorInput) editorInput).getRootElement();
-            setPartName(DerivateLabelProvider.getDerivateText(rootElement));
+            setPartName(labelProvider.getDerivateText(rootElement));
             viewer.setSelection(new StructuredSelection(new TreeNode(specimen)));
         }
 
@@ -318,4 +327,19 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
 //        }
     }
 
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+     */
+    @Override
+    public void selectionChanged(SelectionChangedEvent event) {
+        this.selection  = event.getSelection();
+    }
+
+    /**
+     * @return the selection
+     */
+    public ISelection getSelection() {
+        return selection;
+    }
+
 }
index eca1a544c2622af60a7bb3df6b454d1cb165cb8b..1e0ad222c922106be512f45ab8d5f531177e7a94 100644 (file)
@@ -9,7 +9,9 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 
@@ -29,6 +31,8 @@ public class DescriptionsMenuPropertyTester extends PropertyTester {
        private static final String DELETABLE = "isDeletable";
        private static final String IMAGE_GALLERY = "isImageGallery";
        private static final String TAXON_EDITOR = "isTaxonEditor";
+       private static final String BULK_EDITOR = "isBulkEditor";
+       private static final String DERIVATE_EDITOR = "isDerivateEditor";
 
        /* (non-Javadoc)
         * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
@@ -41,6 +45,12 @@ public class DescriptionsMenuPropertyTester extends PropertyTester {
            if(TAXON_EDITOR.equals(property)){
                return isTaxonEditor();
            }
+           else if(BULK_EDITOR.equals(property)){
+               return isBulkEditor();
+           }
+           else if(DERIVATE_EDITOR.equals(property)){
+               return isDerivateEditor();
+           }
 
            Object[] selectedElements = ((IStructuredSelection) receiver).toArray();
 
@@ -141,4 +151,18 @@ public class DescriptionsMenuPropertyTester extends PropertyTester {
            }
            return false;
        }
+
+       private boolean isBulkEditor() {
+           if(AbstractUtility.getActiveEditor() instanceof BulkEditor){
+               return true;
+           }
+           return false;
+       }
+
+       private boolean isDerivateEditor() {
+           if(AbstractUtility.getActiveEditor() instanceof DerivateView){
+               return true;
+           }
+           return false;
+       }
 }
@@ -1,26 +1,28 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.bulkeditor.derivedunit.operation;
+package eu.etaxonomy.taxeditor.editor.view.descriptive.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 org.eclipse.core.runtime.Status;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.cdm.model.description.SpecimenDescription;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@@ -30,64 +32,57 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @created Feb 11, 2011
  * @version 1.0
  */
-public class AddDerivedUnitFacadeMediaOperation extends
-               AbstractPostTaxonOperation {
+public class AddDerivedUnitFacadeMediaOperation extends AbstractPostTaxonOperation {
+
+       private final SpecimenOrObservationBase<?> specimen;
 
-       public static final int DERIVED_UNIT_MEDIA = 0;
-       public static final int FIELD_OBJECT_MEDIA = 1;
-       
-       private DerivedUnit derivedUnit;
-       private int mode;
-       
        /**
         * @param label
         * @param undoContext
         * @param postOperationEnabled
         */
-       public AddDerivedUnitFacadeMediaOperation(String label, IUndoContext undoContext, DerivedUnit derivedUnit,
-                       int mode, IPostOperationEnabled postOperationEnabled) {
+       public AddDerivedUnitFacadeMediaOperation(String label, IUndoContext undoContext, SpecimenOrObservationBase<?> specimen,
+               IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, postOperationEnabled);
-               
-               this.derivedUnit = derivedUnit;
-               this.mode = mode;
+
+               this.specimen = specimen;
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
         */
        @Override
-       public IStatus execute(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
+       public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
                DerivedUnitFacade facade;
                try {
-                       facade = DerivedUnitFacade.NewInstance(derivedUnit);
-
-                       createImageGallery(facade);
+                   if(specimen instanceof FieldUnit){
+                       facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) specimen);
+                       if(facade.hasFieldObjectImageGallery()){
+                           MessagingUtils.informationDialog("Image gallery creation failed", "Only one image gallery is possible.");
+                           return Status.CANCEL_STATUS;
+                       }
+                       else{
+                           facade.getFieldObjectImageGallery(true);
+                       }
+                   }
+                   else if(specimen instanceof DerivedUnit){
+                       facade = DerivedUnitFacade.NewInstance((DerivedUnit)specimen);
+                       if(facade.hasDerivedUnitImageGallery()){
+                           MessagingUtils.informationDialog("Image gallery creation failed", "Only one image gallery is possible.");
+                           return Status.CANCEL_STATUS;
+                       }
+                       else{
+                           facade.getDerivedUnitImageGallery(true);
+                       }
+                   }
                } catch (DerivedUnitFacadeNotSupportedException e) {
                        MessagingUtils.error(getClass(), e);
                }
-               
-               return postExecute(derivedUnit);
-       }
 
-       
-       
-       /**
-        * @param facade
-        * @return
-        */
-       protected void createImageGallery(DerivedUnitFacade facade){
-               if(mode == DERIVED_UNIT_MEDIA){
-                       facade.getDerivedUnitImageGallery(true);
-               }
-               else if(mode == FIELD_OBJECT_MEDIA){
-                       facade.getFieldObjectImageGallery(true);
-               }
-               else{
-                       throw new IllegalArgumentException("Mode not supported: " + mode);
-               }
+               return postExecute(specimen);
        }
 
+
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
         */
index 751b345455d5e526ec16855d904121b747dab9e1..9fda8be48f5dd208769fe2dece4ee55207c1ec04 100644 (file)
@@ -1,16 +1,16 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.editor.view.media;
 
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -26,6 +26,8 @@ import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
 import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
@@ -40,10 +42,11 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils;
 public class MediaContentProvider implements ITreeContentProvider{
 
        private static final Object[] NO_CHILDREN = new Object[0];
-       
+
        /** {@inheritDoc} */
-       public Object[] getChildren(Object parentElement) {
-                               
+       @Override
+    public Object[] getChildren(Object parentElement) {
+
                if (parentElement instanceof TaxonEditorInput) {
                        Taxon taxon = ((TaxonEditorInput) parentElement).getTaxon();
                        if(taxon == null){
@@ -55,90 +58,92 @@ public class MediaContentProvider implements ITreeContentProvider{
                                if(description.isImageGallery()){
                                        imageGalleries.add(description);
                                }
-                       }                       
-                       return imageGalleries.toArray(); 
+                       }
+                       return imageGalleries.toArray();
                }
                else if (parentElement instanceof DescriptionBase) {
                        if (((DescriptionBase) parentElement).isImageGallery()) {
                                return getImages((DescriptionBase) parentElement).toArray();
-                       } 
+                       }
                }
                else if (parentElement instanceof DerivedUnit){
                        try {
                                DerivedUnitFacade facade = DerivedUnitFacade.NewInstance((DerivedUnit) parentElement);
-               
-                               // TODO at the moment we always create image galleries because the facade is like so.
-                               // this should definitely change and we want to use normal getters and setters here
-                               List<DescriptionBase> derivedUnitFacadeImageGalleries = new ArrayList<DescriptionBase>(2);
-                               
+
                                SpecimenDescription derivedUnitImageGallery = facade.getDerivedUnitImageGallery(false);
-                               SpecimenDescription fieldObjectImageGallery = facade.getFieldObjectImageGallery(false);
-                               
+
                                if(derivedUnitImageGallery != null){
-                                       derivedUnitFacadeImageGalleries.add(derivedUnitImageGallery);
-                               }
-                               
-                               if(fieldObjectImageGallery != null){
-                                       derivedUnitFacadeImageGalleries.add(fieldObjectImageGallery);
+                                       return Collections.singleton(derivedUnitImageGallery).toArray();
                                }
-                               
-                               return derivedUnitFacadeImageGalleries.toArray();
-                               
+
                        } catch (DerivedUnitFacadeNotSupportedException e) {
                                MessagingUtils.error(this.getClass(), "DerivedUnitFacadeNotSupportedException when trying to instantiate DerivedUnitFacade", e);
                        }
                }
-               
+               else if (parentElement instanceof FieldUnit){
+                       DerivedUnitFacade facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) parentElement);
+
+                       SpecimenDescription fieldObjectImageGallery = facade.getFieldObjectImageGallery(false);
+
+                       if(fieldObjectImageGallery != null){
+                           return Collections.singleton(fieldObjectImageGallery).toArray();
+                       }
+               }
                return NO_CHILDREN;
        }
 
        /** {@inheritDoc} */
-       public Object getParent(Object element) {
+       @Override
+    public Object getParent(Object element) {
                // TODO Auto-generated method stub
                return null;
        }
 
        /** {@inheritDoc} */
-       public boolean hasChildren(Object element) {
+       @Override
+    public boolean hasChildren(Object element) {
                return (getChildren(element).length > 0);
        }
 
        /** {@inheritDoc} */
-       public Object[] getElements(Object inputElement) {
+       @Override
+    public Object[] getElements(Object inputElement) {
                return getChildren(inputElement);
        }
 
        /**
         * <p>dispose</p>
         */
-       public void dispose() {}
+       @Override
+    public void dispose() {}
 
        /** {@inheritDoc} */
-       public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
-       
+       @Override
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+
        private List<Media> getImages(DescriptionBase description){
                Assert.isTrue(description.isImageGallery(), "Description should have the imageGallery flag set.");
-               
+
                Set<DescriptionElementBase> elements = description.getElements();
                if (elements != null) {
                        // by definition, image galleries have only one description element
                        if(elements.size() > 1){
                                MessagingUtils.error(this.getClass(), "There should be one and only one description element to hold the images. Found: " + elements.size() + " InDescription ID: " + description.getUuid(), null);
                        }
-                                               
+
                        DescriptionElementBase element = elements.iterator().next();
-                       
+
                        return element.getMedia();
                }
                return null;
        }
-       
+
        private SpecimenDescription createDerivedUnitFacadeImageGallery(DerivedUnitFacade facade){
                SpecimenDescription description = SpecimenDescription.NewInstance();
                description.setImageGallery(true);
-               
-               
-               
+
+
+
                return description;
        }
 }
index 8c6eecf5d0914a2e79890fb617f4fe9864158753..0ae94206a036b3a8a28c83b9f6acaf89d0893623 100644 (file)
@@ -15,6 +15,7 @@ import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
@@ -32,8 +33,11 @@ import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
 import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
 import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
+import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
+import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
 
 /**
  * <p>MediaViewPart class.</p>
@@ -99,13 +103,28 @@ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartCon
                        return;
                }
 
-               if(part instanceof MultiPageTaxonEditor){
-                       IEditorInput input = ((IEditorPart) part).getEditorInput();
-                       showViewer(part, new StructuredSelection(input));
+        if(part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart){
+            // do not show empty page as these views are also used to edit the description selected in this view
+            return;
+        }
+
+               if(part instanceof IPartContentHasMedia){
+                   if(part instanceof MultiPageTaxonEditor){
+                       IEditorInput input = ((IEditorPart) part).getEditorInput();
+                       showViewer(part, new StructuredSelection(input));
+                   }
+                   else if(selection instanceof IStructuredSelection){
+                       Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+                       if(firstElement instanceof TreeNode){
+                           showViewer(part, new StructuredSelection(((TreeNode) firstElement).getValue()));
+                       }
+                       else{
+                           showViewer(part, (IStructuredSelection) selection);
+                       }
+                   }
                }
-
-               if(part instanceof BulkEditor && selection instanceof IStructuredSelection){
-                       showViewer(part, (IStructuredSelection) selection);
+               else{
+                   showEmptyPage();
                }
        }
 
index 67910e1f84423123951cb33aebd2a72ea14c29b5..097849cf05a2f948fb1f11a7521a65abb12303d2 100644 (file)
@@ -25,13 +25,14 @@ public class AddExistingMediaHandler extends CreateMediaHandler {
             DescriptionBase description) {
         AbstractPostOperation operation = null;
         try {
-
             //select media
             Media media = MediaSelectionDialog.select(AbstractUtility.getShell(), null, null);
-            // TODO use undo context specific to editor
-            operation = new AddExistingMediaToImageGalleryOperation(media, event.getCommand().getName(),
-                    EditorUtil.getUndoContext(), description, postOperationEnabled);
-            AbstractUtility.executeOperation(operation);
+            if(media!=null){
+                // TODO use undo context specific to editor
+                operation = new AddExistingMediaToImageGalleryOperation(media, event.getCommand().getName(),
+                        EditorUtil.getUndoContext(), description, postOperationEnabled);
+                AbstractUtility.executeOperation(operation);
+            }
         } catch (NotDefinedException e) {
             MessagingUtils.warn(getClass(), "Command name not set.");
         }
index 2739b337ea410875b7f351fa4ee4b118988dfcf9..00ec54f6e42058c573ec5b5d2495545f3c991209 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.editor.view.media.handler;
 
@@ -7,15 +7,26 @@ import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
+import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.AddDerivedUnitFacadeMediaOperation;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@@ -32,27 +43,61 @@ public class AddImageGalleryHandler extends AbstractHandler {
         * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
         */
        /** {@inheritDoc} */
-       public Object execute(ExecutionEvent event) throws ExecutionException {
+       @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
 
                IWorkbenchPart part = HandlerUtil.getActivePart(event);
                IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
-               
-               
+
+
                IEditorPart editor = HandlerUtil.getActiveEditor(event);
                IEditorInput input = editor.getEditorInput();
+
                if (input instanceof TaxonEditorInput) {
-                       Taxon taxon = ((TaxonEditorInput) input).getTaxon();    
-                       AbstractPostOperation operation;
+                       Taxon taxon = ((TaxonEditorInput) input).getTaxon();
+                       AbstractPostOperation<?> operation;
                        try {
                                // TODO use undo context specific to editor
-                               operation = new CreateTaxonDescriptionOperation(event.getCommand().getName(), 
+                               operation = new CreateTaxonDescriptionOperation(event.getCommand().getName(),
                                                EditorUtil.getUndoContext(), taxon, postOperationEnabled, true);
-                               EditorUtil.executeOperation(operation);
+                               AbstractUtility.executeOperation(operation);
                        } catch (NotDefinedException e) {
                                MessagingUtils.warn(getClass(), "Command name not set.");
                        }
-               } 
+               }
+               else if(input instanceof OccurrenceEditorInput){
+                   BulkEditor bulkEditor = (BulkEditor) editor;
+                   ISelection selection = bulkEditor.getSelectionProvider().getSelection();
+                   invokeOperation(event, postOperationEnabled, selection);
+               }
+               else if(input instanceof DerivateViewEditorInput){
+                   ISelection selection = ((DerivateView)editor).getSelection();
+                   invokeOperation(event, postOperationEnabled, selection);
+               }
                return null;
        }
 
+    /**
+     * @param event
+     * @param postOperationEnabled
+     * @param selection
+     */
+    private void invokeOperation(ExecutionEvent event, IPostOperationEnabled postOperationEnabled, ISelection selection) {
+        if(selection instanceof IStructuredSelection){
+            Object element = ((IStructuredSelection) selection).getFirstElement();
+            if(element instanceof TreeNode){
+                element = ((TreeNode) element).getValue();
+            }
+            if(element instanceof SpecimenOrObservationBase<?>){
+                try {
+                    AbstractPostOperation<?> operation = new AddDerivedUnitFacadeMediaOperation(event.getCommand().getName(),
+                            BulkEditorUtil.getUndoContext(), (SpecimenOrObservationBase<?>)element, postOperationEnabled);
+                    AbstractUtility.executeOperation(operation);
+                } catch (NotDefinedException e) {
+                    MessagingUtils.warn(getClass(), "Command name not set.");
+                }
+            }
+        }
+    }
+
 }
index b155b28f75ed3f053b2e8b6cd2b517114291fd77..21e0de374261e6dca5b2368943d8c95d95e2cccd 100644 (file)
@@ -7,12 +7,12 @@
       ws="cocoa,gtk,win32"
       arch="x86,x86_64">
 
-   <license url="http://www.eclipse.org/legal/epl-v10.html">
+   <!--license url="http://www.eclipse.org/legal/epl-v10.html">
       The contents of this file are subject to the Eclipse Public License Version 1.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
 http://www.eclipse.org/legal/epl-v10.html
 
 Software distributed under the License is distributed on an &quot;AS IS&quot; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
-   </license>
+   </license-->
 
    <url>
       <update label="EDIT Taxonomic Editor" url="http://wp5.e-taxonomy.eu/taxeditor/update"/>
@@ -300,13 +300,6 @@ Software distributed under the License is distributed on an &quot;AS IS&quot; ba
          version="0.0.0"
          unpack="false"/>
 
-   <plugin
-         id="org.eclipse.update.configurator"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
    <plugin
          id="org.eclipse.update.core"
          download-size="0"
@@ -931,4 +924,161 @@ Software distributed under the License is distributed on an &quot;AS IS&quot; ba
          version="0.0.0"
          unpack="false"/>
 
+   <plugin
+         id="org.eclipse.equinox.p2.transport.ecf"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.apache.commons.httpclient"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.apache.httpcomponents.httpclient"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.ecf.provider.filetransfer.httpclient"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.ecf.provider.filetransfer.httpclient.ssl"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         fragment="true"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.touchpoint.eclipse"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.frameworkadmin"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.frameworkadmin.equinox"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.console"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.simpleconfigurator.manipulator"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.ui.sdk.scheduler"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.garbagecollector"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.directorywatcher"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.updatesite"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.extensionlocation"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.director.app"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.publisher"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.repository.tools"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.ecf.provider.filetransfer.ssl"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         fragment="true"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.ecf.ssl"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         fragment="true"
+         unpack="false"/>
+
+   <plugin
+         id="org.apache.commons.codec"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.eclipse.equinox.p2.touchpoint.natives"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
 </feature>
index f6b4d8f8efed6a824c6754ccb731aa49af09e1ed..e16cb13673bd132098479969c5a3aaa917593e30 100644 (file)
       [Enter Copyright Description here.]
    </copyright>
 
-   <license url="http://www.mozilla.org/MPL/">
+   <!--license url="http://www.mozilla.org/MPL/">
       The contents of this file are subject to the Mozilla Public License Version 1.1 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
 http://www.mozilla.org/MPL/
 
 Software distributed under the License is distributed on an &quot;AS IS&quot; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
-   </license>
+   </license-->
 
    <url>
-      <update label="EDIT Taxonomic Editor" url="http://wp5.e-taxonomy.eu/taxeditor/update"/>
+      <update label="EDIT Taxonomic Editor" url="http://cybertaxonomy.eu/download/taxeditor/update/"/>
    </url>
 
    <includes
index 59001c82a44e2a50680d99f55e81b19c31a1f027..7c8b588be75036e4012655907dba6e5ff7cb158b 100644 (file)
@@ -58,8 +58,8 @@ public class DeleteOperation extends AbstractPersistentPostOperation {
                if (result.isError()){
                        MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
                        
-               }else if(!result.getExceptions().isEmpty()){
-                       //TODO:Warning!
+               }else if(result.isAbort()){
+                       MessageDialog.openWarning(null, "Delete abort", "The object could not be deleted, maybe there was no object selected.");
                }
                
                return postExecute(null);
index 16bdd88787c12e5c748f4b49487505fcf949c728..743cb775ea135bb417ec3f06e82937935740295a 100644 (file)
@@ -10,9 +10,7 @@
 
 package eu.etaxonomy.taxeditor.navigation.navigator.operation;
 
-import java.util.List;
 import java.util.Set;
-import java.util.UUID;
 
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.operations.IUndoContext;
@@ -132,8 +130,11 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
                                }*/
                        } else {
                                
-                               List<UUID> result =service.deleteTaxonNodes(treeNodes, config);
-                               
+                               DeleteResult result =service.deleteTaxonNodes(treeNodes, config);
+                               if (result.isError()){
+                                       //TODO:Error message!
+                                       MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
+                               }
                        }
 
                monitor.worked(40);
index 31f6759255de394650d4df78bed806daa2756d61..760c9e30a4d476ba6b3d69afd87ca973c92958a2 100644 (file)
@@ -123,4 +123,9 @@ fontDefinition.label.6 = Other font
 fontDefinition.description.1 = The font used by default in the search result list.\r
 colorDefinition.label.13 = Parse Error\r
 colorDefinition.label.14 = Disabled Name Editor Field\r
-colorDefinition.label.15 = Editor On Error
\ No newline at end of file
+colorDefinition.label.15 = Editor On Error\r
+page.name.26 = Specimens and FieldUnits\r
+page.name.27 = Media\r
+page.name.28 = Checklist Editor\r
+page.name.29 = Editor Profile\r
+page.name.30 = Default Language
\ No newline at end of file
index 94c9770fd533c4b9a840606637e78fd645771403..2923d539fc6d78e2b3b8b050691864492c1a598c 100644 (file)
@@ -124,3 +124,8 @@ fontDefinition.description.1 = Die Schrift die normalerweise in den Suchergebnis
 colorDefinition.label.13 = Fehler beim Parsing
 colorDefinition.label.14 = Gesperrtes Namenseditierfeld
 colorDefinition.label.15 = Editor fehlerhaft
+page.name.26 = Specimens und FieldUnits
+page.name.27 = Media
+page.name.28 = Checklist Editor
+page.name.29 = Editor Profil
+page.name.30 = Standardsprache
\ No newline at end of file
index 31f6759255de394650d4df78bed806daa2756d61..760c9e30a4d476ba6b3d69afd87ca973c92958a2 100644 (file)
@@ -123,4 +123,9 @@ fontDefinition.label.6 = Other font
 fontDefinition.description.1 = The font used by default in the search result list.\r
 colorDefinition.label.13 = Parse Error\r
 colorDefinition.label.14 = Disabled Name Editor Field\r
-colorDefinition.label.15 = Editor On Error
\ No newline at end of file
+colorDefinition.label.15 = Editor On Error\r
+page.name.26 = Specimens and FieldUnits\r
+page.name.27 = Media\r
+page.name.28 = Checklist Editor\r
+page.name.29 = Editor Profile\r
+page.name.30 = Default Language
\ No newline at end of file
index ba626c82943edd651b6f24f357be63cd2c3b7829..b7014aed164c2aa1da47c83c64b01597a776bc08 100644 (file)
@@ -7,5 +7,6 @@ bin.includes = META-INF/,\
                plugin.xml,\
                icons/,\
                p2.inf,\
-               OSGI-INF/
+               OSGI-INF/,\
+               OSGI-INF/l10n/bundle.properties
 
index cfd146f83bd6efd097f519872a49d6192a5e7d5b..18331fd65c4b45520fbb3c083dd4614bb8485acf 100644 (file)
             category="eu.etaxonomy.taxeditor.preferences.general"
             class="eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences"
             id="eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences"
-            name="Specimens and FieldUnits">
+            name="%page.name.26">
       </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.general"
             class="eu.etaxonomy.taxeditor.preference.MediaPreferences"
             id="eu.etaxonomy.taxeditor.preference.MediaPreferences"
-            name="Media">
+            name="%page.name.27">
       </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.general"
             class="eu.etaxonomy.taxeditor.preference.ChecklistEditorGeneralPreference"
             id="eu.etaxonomy.taxeditor.preference.ChecklistEditorGeneralPreferencePage"
-            name="Checklist Editor">
+            name="%page.name.28">
       </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.general"
             class="eu.etaxonomy.taxeditor.preference.TemplatePreferencePage"
             id="eu.etaxonomy.taxeditor.preference.TemplatePreferencePage"
-            name="Editor Profile">
+            name="%page.name.29">
       </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.general"
             class="eu.etaxonomy.taxeditor.preference.DefaultLanguageEditorPreferencePage"
             id="eu.etaxonomy.taxeditor.preference.defaultlanguagepditorpreferencePage"
-            name="Default Language">
+            name="%page.name.30">
       </page>
    </extension>
    <extension
index 64f8597ebf65c678ab4973cb0cd45dd33c5abd27..7fccbc5f317df532f217128f9becf6a55606d0d3 100644 (file)
@@ -20,9 +20,9 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 // $Id$\r
 /**\r
  * Copyright (C) 2009 EDIT\r
- * European Distributed Institute of Taxonomy \r
+ * European Distributed Institute of Taxonomy\r
  * http://www.e-taxonomy.eu\r
- * \r
+ *\r
  * The contents of this file are subject to the Mozilla Public License Version 1.1\r
  * See LICENSE.TXT at the top of this package for the full license terms.\r
  */\r
@@ -45,12 +45,11 @@ public class OpenDefinedTermEditorHandler extends AbstractHandler implements IHa
                try {\r
                        activePage.openEditor(new TermEditorInput(TermType.getByUuid(UUID.fromString(termTypeUuid))), DefinedTermEditor.ID);\r
                } catch (PartInitException e) {\r
-                       \r
+\r
                        String PID = "eu.etaxonomy.taxeditor.application";\r
                        MultiStatus info = new MultiStatus(PID, 1, "You might be missing sufficient permissions to open the Defined Term Editor", null);\r
                        info.add(new Status(IStatus.WARNING, PID, 1, e.getMessage(), null));\r
-                       MessagingUtils.errorDialog("Cannot open Defined Term Editor", getClass(), info);\r
-                       MessagingUtils.error(getClass(), e);\r
+                       MessagingUtils.warningDialog("Cannot open Defined Term Editor", getClass(), info);\r
                }\r
 \r
                return null;\r
index 2b8c4bbe8a527a62679f7837609eeab4f2479c07..2d21f05c071faad720ffdee9321fe36bda723f15 100644 (file)
@@ -10,9 +10,6 @@
 
 package eu.etaxonomy.taxeditor.model;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.Writer;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -25,7 +22,6 @@ import org.eclipse.core.commands.operations.IOperationHistory;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Status;
@@ -56,7 +52,6 @@ import org.eclipse.ui.themes.ITheme;
 import org.eclipse.ui.themes.IThemeManager;
 
 import eu.etaxonomy.cdm.model.common.IEnumTerm;
-import eu.etaxonomy.cdm.persistence.hibernate.permission.SecurityExceptionUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
@@ -75,8 +70,9 @@ import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
  */
 public abstract class AbstractUtility {
 
-       /** Constant <code>statusLineManager</code> */
-       protected static IStatusLineManager statusLineManager;
+    /** Constant <code>statusLineManager</code> */
+    protected static IStatusLineManager statusLineManager;
+
 
        /**
         * <p>
@@ -318,7 +314,7 @@ public abstract class AbstractUtility {
                                                        uiInfoAdapter);
                                } catch (ExecutionException e) {
 
-                                       MessagingUtils.operationDialog(this, e, operationlabel, null);
+                                       MessagingUtils.operationDialog(this, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
 
                                } finally {
                                        monitor.done();
index eb5a8283fef8229f65f140d039323219ebd56338..9d33e2a124d598eae1deb25ccde3a9571b38e96b 100644 (file)
@@ -3,32 +3,76 @@ package eu.etaxonomy.taxeditor.model;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.List;
 import org.eclipse.swt.widgets.Shell;
 
 /**
  * Error dialog class specifically implemented for the editor.
  * The main difference with {@link org.eclipse.jface.dialogs.ErrorDialog} is that
  * this dialog has a fixed max height.
- * 
+ *
  * @author cmathew
  *
  */
 public         class CdmErrorDialog extends ErrorDialog {
 
        private static final int DIALOG_MAX_HEIGHT = 500;
-       
-       public CdmErrorDialog(Shell parentShell, String dialogTitle,
-                       String message, IStatus status) {
-               super(parentShell, 
-                               dialogTitle, 
-                               message, status, 
-                               IStatus.OK| IStatus.INFO | IStatus.WARNING | IStatus.ERROR);            
-       }               
-       
+
+       private Button copyButton;
+       private final String stackTrace;
+
+        /**
+     * The current clipboard. To be disposed when closing the dialog.
+     */
+    private Clipboard clipboard;
+
+    /**
+     * @param parentShell
+     * @param dialogTitle
+     * @param message
+     * @param status
+     * @param stackTrace
+     */
+    public CdmErrorDialog(Shell parentShell,
+            String dialogTitle,
+            String message,
+            IStatus status,
+            String stackTrace) {
+        super(parentShell,
+                dialogTitle,
+                message, status,
+                IStatus.OK| IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
+        this.stackTrace = stackTrace;
+    }
+
+    /**
+     * @param parentShell
+     * @param dialogTitle
+     * @param message
+     * @param status
+     */
+    public CdmErrorDialog(Shell parentShell,
+            String dialogTitle,
+            String message,
+            IStatus status) {
+        this(parentShell, dialogTitle, message, status, "");
+    }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
+        */
        @Override
-       protected void buttonPressed(int id) {                  
+       protected void buttonPressed(int id) {
                super.buttonPressed(id);
                if (id == IDialogConstants.DETAILS_ID) {
                        Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
@@ -39,6 +83,57 @@ public       class CdmErrorDialog extends ErrorDialog {
                                getShell().setSize(getShell().getSize().x, oldSize.y);
                        }
                }
-               
-       }                                       
+
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.dialogs.ErrorDialog#createDropDownList(org.eclipse.swt.widgets.Composite)
+        */
+       @Override
+       protected List createDropDownList(Composite parent) {
+           List list = super.createDropDownList(parent);
+           list.getMenu().getItem(0).setText(JFaceResources.getString("copy all"));
+           return list;
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.dialogs.ErrorDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+        */
+       @Override
+       protected void createButtonsForButtonBar(Composite parent) {
+           copyButton = createButton(parent, 2000,"Copy Error", false);
+           copyButton.addSelectionListener(new SelectionListener() {
+               /*
+                * @see SelectionListener.widgetSelected (SelectionEvent)
+                */
+               @Override
+            public void widgetSelected(SelectionEvent e) {
+                   copyStackTraceToClipboard();
+               }
+               /*
+                * @see SelectionListener.widgetDefaultSelected(SelectionEvent)
+                */
+               @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+                   copyStackTraceToClipboard();
+               }
+           });
+           super.createButtonsForButtonBar(parent);
+       }
+
+
+       /**
+        * Copies the stack trace to the clipboard
+        *
+        */
+       private void copyStackTraceToClipboard() {
+           if(stackTrace != null && !stackTrace.isEmpty()) {
+               if (clipboard != null) {
+                   clipboard.dispose();
+               }
+               clipboard = new Clipboard(copyButton.getDisplay());
+               clipboard.setContents(new Object[] { stackTrace },
+                       new Transfer[] { TextTransfer.getInstance() });
+           }
+       }
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartContentHasMedia.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartContentHasMedia.java
new file mode 100644 (file)
index 0000000..3b6997e
--- /dev/null
@@ -0,0 +1,25 @@
+// $Id$
+/**
+* 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.model;
+
+
+/**
+ *
+ * Clients implementing this interface indicate, that the data they present is suitable for the media view
+ * and that the media view should handle selection from the implementing part.
+ *
+ * @author pplitzner
+ * @date Sep 16, 2014
+ *
+ */
+public interface IPartContentHasMedia {
+
+}
index 0e8e2c456115beb5d056246130d5ae3d4717d0d3..959e49d92df4715109cbf5ca0e329b6139c91b6e 100644 (file)
@@ -2,445 +2,567 @@ package eu.etaxonomy.taxeditor.model;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.log4j.Logger;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Display;
 
 import eu.etaxonomy.cdm.persistence.hibernate.permission.SecurityExceptionUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 
 /**
  * Utility class which handles all the messaging information generated by the
  * Editor.
- * 
+ *
  * This includes logging as well as dialogs.
- * 
+ *
  * @author cmathew
  *
  */
 public class MessagingUtils {
-       public final static String UNEXPECTED_ERROR_MESSAGE = "This is an unexpected error.";
-       public final static String CONTACT_MESSAGE = System.getProperty("line.separator") +  "Please contact EDIT Support (EditSupport@bgbm.org) with the error trace below (click on the 'Details' button).";
-
-       /**
-        * Gets the Log4J logger for a given class
-        *
-        * @param clazz
-        *            a {@link java.lang.Class} object.
-        * @return a {@link org.apache.log4j.Logger} object.
-        */
-       public static Logger getLog4JLogger(Class clazz) {
-               return Logger.getLogger(clazz);
-       }
-       
-       /**
-        * Logs details from a given Status object
-        *
-        * @param status
-        *                              a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       private static void log(IStatus status) {
-               TaxeditorStorePlugin.getDefault().getLog().log(status);
-       }
-
-       /**
-        * Logs a status object as information.  
-        *
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void info(IStatus status) {
-               log(status);
-       }
-
-       /**
-        * Logs a string as information.         
-        *
-        * @param message
-        *            a {@link java.lang.String} object.
-        */
-       public static void info(String message) {
-               IStatus status = new Status(IStatus.INFO, AbstractUtility.getPluginId(), message);
-               info(status);
-       }
-
-       /**
-        * Logs an exception from a given source as a warning.   
-        * 
-        * @param source
-        * @param t
-        */
-       public static void warn(Class source, Throwable t) {
-               IStatus status = new Status(IStatus.WARNING, AbstractUtility.getPluginId(), t.getMessage(), t);
-               MessagingUtils.getLog4JLogger(source).warn(t);
-               log(status);
-       }
-
-       /**
-        * Logs a status object from a given source as a warning.        
-        * 
-        * @param source
-        * @param status
-        */
-       public static void warn(Class source, IStatus status) {
-               MessagingUtils.getLog4JLogger(source).warn(status.getMessage(), status.getException());
-               log(status);
-       }
-
-       /**
-        * Logs a string from a given source as a warning.       
-        * 
-        *
-        * @param source
-        *            a {@link java.lang.Class} object.
-        * @param message
-        *            a {@link java.lang.String} object.
-        */
-       public static void warn(Class source, String message) {
-               IStatus status = new Status(IStatus.WARNING, AbstractUtility.getPluginId(), message);
-               MessagingUtils.getLog4JLogger(source).warn(message);
-               log(status);
-       }
-
-       /**
-        * Logs a status object from a given source as an error.         
-        * 
-        *
-        * @param source
-        *            a {@link java.lang.Class} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void error(Class source, IStatus status) {
-               getLog4JLogger(source)
-                               .error(status.getMessage(), status.getException());
-               log(status);
-       }
-
-       /**
-        * Logs a string and exception from a given source as an error.  
-        * 
-        *
-        * @param source
-        *            a {@link java.lang.Class} object.
-        * @param message
-        *            a {@link java.lang.String} object.
-        * @param t
-        *            a {@link java.lang.Throwable} object.
-        */
-       public static void error(Class source, String message, Throwable t) {
-               IStatus status = new Status(IStatus.ERROR, AbstractUtility.getPluginId(), message, t);
-               error(source, status);
-       }
-
-
-
-       /**
-        * Logs an exception from a given source as an error.    
-        * 
-        *
-        * @param source
-        *            a {@link java.lang.Class} object.
-        * @param t
-        *            a {@link java.lang.Throwable} object.
-        */
-       public static void error(Class source, Throwable t) {
-               error(source.getClass(), t.getMessage(), t);
-       }
-
-       /**
-        * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param source
-        *            a {@link java.lang.Object} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void errorDialog(final String title, 
-                       final Object source, 
-                       final String message, 
-                       final IStatus status) {
-
-               Display.getDefault().asyncExec(new Runnable() {
-
-                       @Override
-                       public void run() {             
-                               CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status);
-                               ced.open();
-                               Class<? extends Object> clazz = source != null ? source
-                                               .getClass() : this.getClass();
-                                               error(clazz, status);
-                       }
-               });
-       }
-       
-       /**
-        * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-        * 
-        * @param title
-        * @param source
-        * @param message
-        * @param pluginId
-        * @param t
-        */
-       public static void errorDialog(final String title, 
-                       final Object source,
-                       final String message,
-                       final String pluginId,                  
-                       final Throwable t,
-                       boolean addContactMesg) {
-               // Usually the status contains only the first line of the stack trace.
-               // For the unexpected messages we need the entire stack trace so we 
-               // create a new status with the entire stacktrace       
-               StringWriter sw = new StringWriter();
-               t.printStackTrace(new PrintWriter(sw));
-               String finalMessage = t.getMessage();
-               if(addContactMesg) {
-                       finalMessage += MessagingUtils.CONTACT_MESSAGE;
-               }
-               IStatus status = new Status(IStatus.ERROR, 
-                               pluginId, 
-                               finalMessage, 
-                               new Exception(sw.toString()));   
-               errorDialog(title, source, message, status);
-       }
-       
-
-       
-       /**
-        * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param source
-        *            a {@link java.lang.Object} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void errorDialog(final String title, 
-                       final Object source, 
-                       final String message, 
-                       final IStatus status,
-                       final boolean showStackTrace) {             
-               if(showStackTrace && status.getException() != null) {                                           
-                       errorDialog(title, source,  status.getPlugin(), message, status.getException(),true);
-               } else {
-                       errorDialog(title, source, message, status);
-               }                       
-       }
-       
-
-       /**
-        * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param source
-        *            a {@link java.lang.Object} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void errorDialog(final String title, final Object source,
-                       final IStatus status) {
-               errorDialog(title, source, null, status);
-       }
-       
-       /**
-        * Displays a dialog for an exception occurring in an operation.
-        * 
-        * This will be either a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog} in case of a 
-        * security runtime exception or a warning {@link org.eclipse.jface.dialogs.MessageDialog} in
-        * case of any other exception.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param source
-        *            a {@link java.lang.Object} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void operationDialog(final Object source,                         
-                       final Exception ex,
-                       final String operationlabel, 
-                       final String hint) {
-
-               Display.getDefault().asyncExec(new Runnable() {
-
-                       @Override
-                       public void run() {             
-                               MultiStatus info = null;
-                       String title = null;
-                       
-                       // FIXME cannot access TaxonomicEditorPlugin.PLUGIN_ID from here
-                       // String PID = TaxonomicEditorPlugin.PLUGIN_ID;
-                       String PID = "eu.etaxonomy.taxeditor.application";
-
-                       // checking security exceptions for every operation
-                       RuntimeException securityRuntimeException = SecurityExceptionUtils.findSecurityRuntimeException(ex);
-
-                       // in case of a security exception it is a warning, else it is an error
-                       if(securityRuntimeException != null){
-                               title = "Your changes could not be saved!";
-                               warningDialog(title, source, String.format("You are missing sufficient permissions for the operation \"%s\". %s", operationlabel, hint));
-                       } else {
-                               title = "Error executing operation";                            
-                               errorDialog(title, source, String.format("An error occured while executing %s. %s", operationlabel, hint), PID, ex, true);
-                               
-                       }
-                       
-                       
-                       }
-               });
-       }
-       
-       
-
-
-       /**
-        * Displays a question {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param message
-        *            a {@link java.lang.String} object.
-        * @return a boolean.
-        */
-       public static boolean confirmDialog(String title, String message) {
-               return MessageDialog.openQuestion(AbstractUtility.getShell(), title, message);
-       }
-
-       /**
-        * Displays a message {@link org.eclipse.jface.dialogs.MessageDialog}.
-        * 
-        * @param title
-        * @param source
-        * @param message
-        */
-       public static void messageDialog(final String title, final Object source, final String message) {
-               MessagingUtils.messageDialog(title, source, message, null);
-       }
-
-       /**
-        * Displays an error {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        *            The dialogs title
-        * @param source
-        *            The object where the warning was generated (used by log4j)
-        * @param message
-        *            An informative String to be presented to the user
-        * @param title
-        *            The dialogs title
-        * @param t
-        *            a Throwable if one exists or null
-        */
-       public static void messageDialog(final String title, final Object source,
-                       final String message, final Throwable t) {
-               Display.getDefault().asyncExec(new Runnable() {
-       
-                       @Override
-               public void run() {
-                               MessageDialog.openError(AbstractUtility.getShell(), title, message + getCauseRecursively(t));
-                               Class<? extends Object> clazz = source != null ? source
-                                               .getClass() : this.getClass();
-                               error(clazz, message, t);
-                       }
-       
-                       private String getCauseRecursively(Throwable t) {
-                               if(t == null){
-                                       return "";
-                               }
-       
-                               if(t.getCause() != null){
-                                       return getCauseRecursively(t.getCause());
-                               }else{
-                                       return String.format("\n\nException: %s\nMessage: %s", t.getClass().getSimpleName(), t.getMessage());
-                               }
-       
-                       }
-               });
-       }
-
-       /**
-        * Displays a warning {@link org.eclipse.jface.dialogs.MessageDialog}.
-        * 
-        * @param title
-        * @param termBase
-        * @param status
-        */
-       public static void warningDialog(String title, Object source,
-                       IStatus status) {
-               MessagingUtils.warningDialog(title, source, status.getMessage());
-       }
-
-       /**
-        * Displays a warning {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        *            The dialogs title
-        * @param source
-        *            The object where the warning was generated (used by log4j)
-        * @param message
-        *            An informative String to be presented to the user
-        */
-       public static void warningDialog(final String title, final Object source, final String message) {
-               Display.getDefault().asyncExec(new Runnable() {
-       
-                       @Override
-               public void run() {
-                               MessageDialog.openWarning(AbstractUtility.getShell(), title, message);
-                               Class<? extends Object> clazz = source != null ? source
-                                               .getClass() : AbstractUtility.class;
-                               warn(clazz, message);
-                       }
-               });
-       }
-
-       /**
-        * Displays an information {@link org.eclipse.jface.dialogs.MessageDialog}.
-        * 
-        * @param title
-        * @param status
-        */
-       public static void informationDialog(final String title, final IStatus status) {
-               MessagingUtils.informationDialog(title, status.getMessage());
-       }
-
-       /**
-        * Displays an information {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param message
-        *            a {@link java.lang.String} object.
-        */
-       public static void informationDialog(final String title,
-                       final String message) {
-               Display.getDefault().asyncExec(new Runnable() {
-       
-                       @Override
-               public void run() {
-                               MessageDialog.openInformation(AbstractUtility.getShell(), title, message);
-                       }
-               });
-       }
-
-       /**
-        * Open a message box that informs the user about unimplemented
-        * functionality. This method is for developer convenience.
-        *
-        * @param source
-        *            a {@link java.lang.Object} object.
-        */
-       public static void notImplementedMessage(Object source) {
-               warningDialog("Not yet implemented", source,
-                               "This functionality is not yet implemented.");
-       }
+    public final static String UNEXPECTED_ERROR_MESSAGE = "This is an unexpected error.";
+    public final static String CONTACT_MESSAGE = System.getProperty("line.separator") +  "Please contact EDIT Support (EditSupport@bgbm.org) with the error trace below (click on the 'Details' button).";
+
+    /**
+     * Gets the Log4J logger for a given class
+     *
+     * @param clazz
+     *            a {@link java.lang.Class} object.
+     * @return a {@link org.apache.log4j.Logger} object.
+     */
+    public static Logger getLog4JLogger(Class clazz) {
+        return Logger.getLogger(clazz);
+    }
+
+    /**
+     * Logs details from a given Status object
+     *
+     * @param status
+     *                                 a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    private static void log(IStatus status) {
+        TaxeditorStorePlugin.getDefault().getLog().log(status);
+    }
+
+    /**
+     * Logs a status object as information.
+     *
+     * @param status
+     *            a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    public static void info(IStatus status) {
+        log(status);
+    }
+
+    /**
+     * Logs a string as information.
+     *
+     * @param message
+     *            a {@link java.lang.String} object.
+     */
+    public static void info(String message) {
+        IStatus status = new Status(IStatus.INFO, AbstractUtility.getPluginId(), message);
+        info(status);
+    }
+
+    /**
+     * Logs an exception from a given source as a warning.
+     *
+     * @param source
+     * @param t
+     */
+    public static void warn(Class source, Throwable t) {
+        IStatus status = new Status(IStatus.WARNING, AbstractUtility.getPluginId(), t.getMessage(), t);
+        MessagingUtils.getLog4JLogger(source).warn(t);
+        log(status);
+    }
+
+    /**
+     * Logs a status object from a given source as a warning.
+     *
+     * @param source
+     * @param status
+     */
+    public static void warn(Class source, IStatus status) {
+        MessagingUtils.getLog4JLogger(source).warn(status.getMessage(), status.getException());
+        log(status);
+    }
+
+    /**
+     * Logs a string from a given source as a warning.
+     *
+     *
+     * @param source
+     *            a {@link java.lang.Class} object.
+     * @param message
+     *            a {@link java.lang.String} object.
+     */
+    public static void warn(Class source, String message) {
+        IStatus status = new Status(IStatus.WARNING, AbstractUtility.getPluginId(), message);
+        MessagingUtils.getLog4JLogger(source).warn(message);
+        log(status);
+    }
+
+    /**
+     * Logs a status object from a given source as an error.
+     *
+     *
+     * @param source
+     *            a {@link java.lang.Class} object.
+     * @param status
+     *            a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    public static void error(Class source, IStatus status) {
+        getLog4JLogger(source)
+        .error(status.getMessage(), status.getException());
+        log(status);
+    }
+
+    /**
+     * Logs a string and exception from a given source as an error.
+     *
+     *
+     * @param source
+     *            a {@link java.lang.Class} object.
+     * @param message
+     *            a {@link java.lang.String} object.
+     * @param t
+     *            a {@link java.lang.Throwable} object.
+     */
+    public static void error(Class source, String message, Throwable t) {
+        IStatus status = new Status(IStatus.ERROR, AbstractUtility.getPluginId(), message, t);
+        error(source, status);
+    }
+
+
+
+    /**
+     * Logs an exception from a given source as an error.
+     *
+     *
+     * @param source
+     *            a {@link java.lang.Class} object.
+     * @param t
+     *            a {@link java.lang.Throwable} object.
+     */
+    public static void error(Class source, Throwable t) {
+        error(source.getClass(), t.getMessage(), t);
+    }
+
+
+
+    /**
+     * Returns a list of strings, providing info on,
+     *  - login
+     *  - editor version
+     *  - server (address + source name)
+     *  - db schema version
+     *
+     * @return
+     */
+    public static List<String> getContextInfo() {
+        List<String> contextInfo = new ArrayList<String>();
+        String name = "";
+        String schemaVersion = "";
+        String server = "";
+        String version = "";
+        String login = "";
+        try {
+            version = Platform.getBundle("eu.etaxonomy.taxeditor.application").getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
+
+            if(CdmStore.getActiveCdmSource() != null ) {
+                login = CdmStore.getLoginManager().getAuthenticatedUser().getUsername();
+                name = CdmStore.getActiveCdmSource().getName();
+                schemaVersion = CdmStore.getActiveCdmSource().getDbSchemaVersion();
+                server = CdmStore.getActiveCdmSource().getServer();
+            }
+
+        } catch (Exception e) {
+            // Nothing to do
+        }
+        contextInfo.add("login : " + login);
+        contextInfo.add("editor version : " + version);
+        contextInfo.add("server : " + server + " / " + name);
+        contextInfo.add("schema version : " + schemaVersion);
+
+        return contextInfo;
+    }
+
+    public static String getStackTraceAndContextInfo(Throwable t, List<String> contextInfo)  {
+        StringBuffer stackTraceAndContextInfo = new StringBuffer();
+
+        for(String infoItem : contextInfo) {
+            stackTraceAndContextInfo.append(infoItem + System.getProperty("line.separator"));
+        }
+
+        StringWriter sw = new StringWriter();
+        t.printStackTrace(new PrintWriter(sw));
+
+        stackTraceAndContextInfo.append(sw.toString());
+
+        return stackTraceAndContextInfo.toString();
+    }
+
+    /**
+     * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
+     *
+     * @param title
+     * @param source
+     * @param t
+     * @param contextInfo
+     * @param message
+     * @param status
+     */
+    private static void errorDialog(final String title,
+            final Object source,
+            final Throwable t,
+            final List<String> contextInfo,
+            final String message,
+            final MultiStatus status) {
+
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                String stackTraceWithContext = getStackTraceAndContextInfo(t, contextInfo);
+                CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status, stackTraceWithContext);
+                ced.open();
+                Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
+
+
+                IStatus singleStatus = new Status(IStatus.ERROR,
+                        status.getPlugin(),
+                        message,
+                        new Exception(stackTraceWithContext));
+
+                error(clazz, singleStatus);
+            }
+        });
+    }
+
+    /**
+     * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
+     *
+     * @param title
+     * @param source
+     * @param message
+     * @param pluginId
+     * @param t
+     */
+    public static void errorDialog(final String title,
+            final Object source,
+            final String message,
+            final String pluginId,
+            final Throwable t,
+            boolean addContactMesg) {
+
+
+        StringBuffer sbStackTrace = new StringBuffer();
+
+        // We need to build a MultiStatus object since the simple
+        // idea of writing out the stack trace as a single string
+        // leads to a single line on windows
+        List<Status> childStatuses = new ArrayList<Status>();
+
+        // add context info
+        List<String> contextInfo = getContextInfo();
+        for(String infoItem : contextInfo) {
+            childStatuses.add(new Status(IStatus.ERROR, pluginId, infoItem));
+        }
+
+        // add main execption
+        for (StackTraceElement ste : t.getStackTrace()) {
+            childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
+        }
+
+        // add cause
+        if(t.getCause() != null) {
+            childStatuses.add(new Status(IStatus.ERROR, pluginId, ""));
+            childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + t.getCause().toString()));
+            for (StackTraceElement ste : t.getCause().getStackTrace()) {
+                // build & add status
+                childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
+            }
+        }
+
+        String finalMessage = message;
+
+        if(finalMessage == null || finalMessage.isEmpty()) {
+            finalMessage = "";
+        }
+
+        if(addContactMesg) {
+            // add edit support contact info to message
+            finalMessage += MessagingUtils.CONTACT_MESSAGE;
+        }
+
+        MultiStatus ms = new MultiStatus(pluginId,
+                IStatus.ERROR,
+                childStatuses.toArray(new Status[] {}),
+                t.toString(),
+                t);
+
+        errorDialog(title, source, t, contextInfo, finalMessage, ms);
+    }
+
+    /**
+     * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
+     *
+     * @param title
+     *            a {@link java.lang.String} object.
+     * @param source
+     *            a {@link java.lang.Object} object.
+     * @param status
+     *            a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    private static void errorDialog(final String title,
+            final Object source,
+            final String message,
+            final IStatus status) {
+
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status);
+                ced.open();
+                Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
+                error(clazz, status);
+            }
+        });
+    }
+
+    /**
+     * Displays a dialog for an exception occurring in an operation.
+     *
+     * This will be either a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog} in case of a
+     * security runtime exception or a warning {@link org.eclipse.jface.dialogs.MessageDialog} in
+     * case of any other exception.
+     *
+     * @param title
+     *            a {@link java.lang.String} object.
+     * @param source
+     *            a {@link java.lang.Object} object.
+     * @param status
+     *            a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    public static void operationDialog(final Object source,
+            final Exception ex,
+            final String pluginId,
+            final String operationlabel,
+            final String hint) {
+
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                MultiStatus info = null;
+                String title = null;
+
+                // FIXME cannot access TaxonomicEditorPlugin.PLUGIN_ID from here
+                // String PID = TaxonomicEditorPlugin.PLUGIN_ID;
+                String PID = "eu.etaxonomy.taxeditor.application";
+
+                // checking security exceptions for every operation
+                RuntimeException securityRuntimeException = SecurityExceptionUtils.findSecurityRuntimeException(ex);
+
+                // in case of a security exception it is a warning, else it is an error
+                if(securityRuntimeException != null){
+                    title = "Your changes could not be saved!";
+                    warningDialog(title, source, String.format("You are missing sufficient permissions for the operation \"%s\". %s", operationlabel, hint));
+                } else {
+                    title = "Error executing operation";
+                    errorDialog(title, source, String.format("An error occured while executing %s. %s", operationlabel, hint), pluginId, ex, true);
+
+                }
+
+
+            }
+        });
+    }
+
+
+
+
+    /**
+     * Displays a question {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            a {@link java.lang.String} object.
+     * @param message
+     *            a {@link java.lang.String} object.
+     * @return a boolean.
+     */
+    public static boolean confirmDialog(String title, String message) {
+        return MessageDialog.openQuestion(AbstractUtility.getShell(), title, message);
+    }
+
+    /**
+     * Displays a message {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     * @param source
+     * @param message
+     */
+    public static void messageDialog(final String title, final Object source, final String message) {
+        MessagingUtils.messageDialog(title, source, message, null, true);
+    }
+
+
+
+    /**
+     * Displays an error {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            The dialogs title
+     * @param source
+     *            The object where the warning was generated (used by log4j)
+     * @param message
+     *            An informative String to be presented to the user
+     * @param title
+     *            The dialogs title
+     * @param t
+     *            a Throwable if one exists or null
+     */
+    public static void messageDialog(final String title,
+            final Object source,
+            final String message,
+            final Throwable t) {
+        MessagingUtils.messageDialog(title, source, message, t, true);
+    }
+
+    /**
+     * Displays an error {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            The dialogs title
+     * @param source
+     *            The object where the warning was generated (used by log4j)
+     * @param message
+     *            An informative String to be presented to the user
+     * @param title
+     *            The dialogs title
+     * @param t
+     *            a Throwable if one exists or null
+     */
+    public static void messageDialog(final String title,
+            final Object source,
+            final String message,
+            final Throwable t,
+            boolean async) {
+        if(async) {
+            Display.getDefault().asyncExec(new Runnable() {
+
+                @Override
+                public void run() {
+                    MessageDialog.openError(AbstractUtility.getShell(), title, message + getCauseRecursively(t));
+                    Class<? extends Object> clazz = source != null ? source
+                            .getClass() : this.getClass();
+                            error(clazz, message, t);
+                }
+
+
+            });
+        } else {
+            MessageDialog.openError(AbstractUtility.getShell(), title, message + getCauseRecursively(t));
+            Class<? extends Object> clazz = source != null ? source.getClass() : TaxeditorStorePlugin.class;
+            error(clazz, message, t);
+        }
+    }
+
+    public static String getCauseRecursively(Throwable t) {
+        if(t == null){
+            return "";
+        }
+
+        if(t.getCause() != null){
+            return getCauseRecursively(t.getCause());
+        }else{
+            return String.format("\n\nException: %s\nMessage: %s", t.getClass().getSimpleName(), t.getMessage());
+        }
+
+    }
+    /**
+     * Displays a warning {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     * @param termBase
+     * @param status
+     */
+    public static void warningDialog(String title, Object source,
+            IStatus status) {
+        MessagingUtils.warningDialog(title, source, status.getMessage());
+    }
+
+    /**
+     * Displays a warning {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            The dialogs title
+     * @param source
+     *            The object where the warning was generated (used by log4j)
+     * @param message
+     *            An informative String to be presented to the user
+     */
+    public static void warningDialog(final String title, final Object source, final String message) {
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                MessageDialog.openWarning(AbstractUtility.getShell(), title, message);
+                Class<? extends Object> clazz = source != null ? source
+                        .getClass() : AbstractUtility.class;
+                        warn(clazz, message);
+            }
+        });
+    }
+
+    /**
+     * Displays an information {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     * @param status
+     */
+    public static void informationDialog(final String title, final IStatus status) {
+        MessagingUtils.informationDialog(title, status.getMessage());
+    }
+
+    /**
+     * Displays an information {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            a {@link java.lang.String} object.
+     * @param message
+     *            a {@link java.lang.String} object.
+     */
+    public static void informationDialog(final String title,
+            final String message) {
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                MessageDialog.openInformation(AbstractUtility.getShell(), title, message);
+            }
+        });
+    }
+
+    /**
+     * Open a message box that informs the user about unimplemented
+     * functionality. This method is for developer convenience.
+     *
+     * @param source
+     *            a {@link java.lang.Object} object.
+     */
+    public static void notImplementedMessage(Object source) {
+        warningDialog("Not yet implemented", source,
+                "This functionality is not yet implemented.");
+    }
 
 }
index 3ac5d747075613aea512642724a5ceb31b65eea1..08a1a367308c19c7c7334415fbdc312c69a4cb93 100644 (file)
@@ -55,9 +55,8 @@ public class TaxonomicEditorGeneralPreferences extends
                                IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES,
                                "Show experimental features", getFieldEditorParent()));
                addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS,
-                               "Open search results in separate windows",
-                               getFieldEditorParent()));
-
+                       "Open search results in separate windows",
+                       getFieldEditorParent()));
        }
 
        /*
index 7d861c220ab4a531f3777a48184ccffc4005ce5d..9d3a362b4b2ef7a9ae6fd25d99e94c9067379c47 100644 (file)
@@ -97,7 +97,7 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
     public void setEntity(T entity) {
         this.entity = entity;
         // the id is always 0 if the entity was not yet saved, so it is new in this case
-        if(StoreUtil.getCdmEntity(getEntity()).getId() == 0) {
+        if(getEntity() == null || StoreUtil.getCdmEntity(getEntity()).getId() == 0) {
             // new entity, not yet saved
             requiredCrud = EnumSet.of(CRUD.CREATE);
         } else {
index d628deaaac6e025d30594b0895c2e23e9fb64beb..29d858118abee0684e953b74abfc1c67a627c269 100644 (file)
@@ -40,12 +40,15 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * <b>Note:</b> If you use this label provider you need to assure that you
  * created a {@link ConversationHolder} resp. have an open session because
  * the labels are generated from various fields of the derivate hierarchy which
- * are lazy loaded and could therefore throw a {@link LazyInitializationException}.
+ * are lazy loaded and could therefore throw a {@link LazyInitializationException}.<br>
+ * Use <b>{@link #setConversation(ConversationHolder)}</b> to assign the session to this provider.
  */
 public class DerivateLabelProvider extends ColumnLabelProvider {
 
     private Set<SingleRead> multiLinkSingleReads;
 
+    private ConversationHolder conversation;
+
     private static DefinedTerm photoTerm = null;
     private static DefinedTerm drawingTerm = null;
     private static DefinedTerm specimenScanTerm = null;
@@ -110,22 +113,35 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
         return getDerivateText(element);
     }
 
+    /**
+     * @param conversation the conversation to set
+     */
+    public void setConversation(ConversationHolder conversation) {
+        this.conversation = conversation;
+    }
+
     /**
      *
      * @param element
      * @return
      */
-    public static String getDerivateText(Object element){
+    public String getDerivateText(Object element){
         if(element instanceof TreeNode){
             //unwrap specimen from TreeNode
             element = ((TreeNode) element).getValue();
         }
 
+        conversation.bind();
+
         String label = "";
         if(element instanceof FieldUnit){
             FieldUnit fieldUnit = (FieldUnit)element;
-            GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
-            if(gatheringEvent!=null){
+            if(fieldUnit.getGatheringEvent()!=null){
+                GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
+                if(!conversation.getSession().contains(gatheringEvent)){
+                    fieldUnit = (FieldUnit) CdmStore.getService(IOccurrenceService.class).load(fieldUnit.getUuid());
+                    gatheringEvent = fieldUnit.getGatheringEvent();
+                }
                 label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+", ":"";
                 label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+", ":"";
                 label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+", ":"";
@@ -135,8 +151,10 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
         }
         else if(element instanceof MediaSpecimen){
             MediaSpecimen mediaSpecimen = (MediaSpecimen)element;
-            label += mediaSpecimen.getMediaSpecimen().getTitle()!=null?mediaSpecimen.getMediaSpecimen().getTitle().getText()+", ":"[no motif]";
-            label += mediaSpecimen.getMediaSpecimen().getArtist()!=null?mediaSpecimen.getMediaSpecimen().getArtist()+", ":"";
+            if(mediaSpecimen.getMediaSpecimen()!=null){
+                label += mediaSpecimen.getMediaSpecimen().getTitle()!=null?mediaSpecimen.getMediaSpecimen().getTitle().getText()+", ":"[no motif]";
+                label += mediaSpecimen.getMediaSpecimen().getArtist()!=null?mediaSpecimen.getMediaSpecimen().getArtist()+", ":"";
+            }
             label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+", ":"";
             Collection collection = mediaSpecimen.getCollection();
             if(collection!=null){
index ff7cb73f53ffdf67d466b997700437b9475bc2c2..536c3b2b78694396052c43ecc3fca9217bf3d5df 100644 (file)
@@ -29,6 +29,7 @@ import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Widget;
 import org.eclipse.ui.handlers.IHandlerService;
 
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
@@ -51,6 +52,7 @@ public class DerivateSearchCompositeController implements Listener{
     private final DerivateSearchComposite derivateSearchComposite;
     private IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase<DerivedUnitFacadeCacheStrategy>> configurator;
     private EnumTermComboController<SpecimenOrObservationType> enumTermComboController;
+    private DerivateLabelProvider labelProvider;
 
     /**
      * @param parent
@@ -77,7 +79,8 @@ public class DerivateSearchCompositeController implements Listener{
 
         TableViewer resultViewer = derivateSearchComposite.getResultViewer();
         resultViewer.setContentProvider(new ArrayContentProvider());
-        resultViewer.setLabelProvider(new DerivateLabelProvider());
+        labelProvider = new DerivateLabelProvider();
+        resultViewer.setLabelProvider(labelProvider);
         resultViewer.addDoubleClickListener(new IDoubleClickListener() {
             @Override
             public void doubleClick(DoubleClickEvent event) {
@@ -159,4 +162,11 @@ public class DerivateSearchCompositeController implements Listener{
         derivateSearchComposite.getResultViewer().getControl().setFocus();
     }
 
+    /**
+     * @param conversationHolder
+     */
+    public void setConversation(ConversationHolder conversationHolder) {
+        labelProvider.setConversation(conversationHolder);
+    }
+
 }
index ddd4b1a20dba1cd3283da47aa4fa965e6d88c98b..382032037ded23055f935150326e2460a0503399 100644 (file)
@@ -93,6 +93,7 @@ public class DerivateSearchView extends ViewPart implements IContextListener {
     private void initConversation(){
         if(conversationHolder==null){
             conversationHolder = CdmStore.createConversation();
+            derivateSearchCompositeController.setConversation(conversationHolder);
         }
     }
 
index ce95a4581bca4a080396000f9f5522729cbf287d..cf45cfff69b70d223a2e9bc504587751ce523394 100644 (file)
@@ -1,40 +1,65 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="3.3.8.SNAPSHOT">
-  <aboutInfo>
-    <image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
-    <text>
+<?pde version="3.5"?>
+
+<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="3.3.8.qualifier" useFeatures="true" includeLaunchers="true">
+
+   <aboutInfo>
+      <image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
+      <text>
          %productBlurb
       </text>
-  </aboutInfo>
-  <configIni use="default"></configIni>
-  <launcherArgs>
-    <programArgs>-data @user.home/.cdmLibrary -Dserver_port=58080</programArgs>
-    <vmArgs>-Xmx512M -XX:MaxPermSize=256M</vmArgs>
-    <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
-  </launcherArgs>
-  <windowImages i16="/eu.etaxonomy.taxeditor.application/icons/256color_16x16.gif" i32="/eu.etaxonomy.taxeditor.application/icons/256color_32x32.gif" i48="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
-  <splash location="eu.etaxonomy.taxeditor.application" startupForegroundColor="000000" startupMessageRect="7,432,360,20" startupProgressRect="5,447,366,15"/>
-  <launcher name="TaxonomicEditor">
-    <solaris/>
-    <win useIco="false">
-      <bmp/>
-    </win>
-  </launcher>
-  <vm></vm>
-  <license>
-    <url>http://www.mozilla.org/MPL/</url>
-    <text>
+   </aboutInfo>
+
+   <configIni use="default">
+   </configIni>
+
+   <launcherArgs>
+      <programArgs>-data @user.home/.cdmLibrary -Dserver_port=58080</programArgs>
+      <vmArgs>-Xmx512M -XX:MaxPermSize=256M -Dorg.eclipse.update.reconcile=false -Declipse.p2.unsignedPolicy=allow</vmArgs>
+      <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
+   </launcherArgs>
+
+   <windowImages i16="/eu.etaxonomy.taxeditor.application/icons/256color_16x16.gif" i32="/eu.etaxonomy.taxeditor.application/icons/256color_32x32.gif" i48="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
+
+   <splash
+      location="eu.etaxonomy.taxeditor.application"
+      startupProgressRect="5,447,366,15"
+      startupMessageRect="7,432,360,20"
+      startupForegroundColor="000000" />
+   <launcher name="TaxonomicEditor">
+      <solaris/>
+      <win useIco="false">
+         <bmp/>
+      </win>
+   </launcher>
+
+   <vm>
+   </vm>
+
+   <!--license>
+        <url>http://www.mozilla.org/MPL/</url>
+        <text>
    The contents of this file are subject to the Mozilla Public License Version 1.1 (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
 http://www.mozilla.org/MPL/
 
 Software distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
          </text>
-  </license>
-  <plugins></plugins>
-  <features>
-    <feature id="eu.etaxonomy.taxeditor.feature"/>
-  </features>
-  <configurations>
-    <plugin autoStart="true" id="eu.etaxonomy.taxeditor.application" startLevel="4"/>
-  </configurations>
+   </license -->
+
+   <plugins>
+   </plugins>
+
+   <features>
+      <feature id="eu.etaxonomy.taxeditor.feature"/>
+   </features>
+
+   <configurations>
+      <plugin id="eu.etaxonomy.taxeditor.application" autoStart="true" startLevel="5" />
+      <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="4" />
+      <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
+      <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
+      <plugin id="org.eclipse.equinox.p2.transport.ecf" autoStart="true" startLevel="4" />
+      <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
+   </configurations>
+
 </product>
index 9f1dcc88e0c518d2e3f5ffd836b6c2a1d4daeff4..18f4117a3923e3a7399badf0a550f5629476128a 100644 (file)
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-       <parent>
-               <groupId>eu.etaxonomy</groupId>
-               <artifactId>taxeditor-parent</artifactId>
-               <version>3.3.8-SNAPSHOT</version>
-       </parent>
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <groupId>eu.etaxonomy</groupId>
+    <artifactId>taxeditor-parent</artifactId>
+    <version>3.3.8-SNAPSHOT</version>
+  </parent>
 
-       <modelVersion>4.0.0</modelVersion>
-       <artifactId>eu.etaxonomy.taxeditor</artifactId>
-       <packaging>eclipse-repository</packaging>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>eu.etaxonomy.taxeditor</artifactId>
+  <packaging>eclipse-repository</packaging>
 
-       <name>EDIT Taxonomic Editor Product</name>
-       <description>The EDIT Taxonomic Desktop Editor</description>
-       <url>http://wp5.e-taxonomy.eu/taxeditor</url>
+  <name>EDIT Taxonomic Editor Product</name>
+  <description>The EDIT Taxonomic Desktop Editor</description>
+  <url>http://wp5.e-taxonomy.eu/taxeditor</url>
 
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.eclipse.tycho</groupId>
-                               <artifactId>tycho-p2-director-plugin</artifactId>
-                               <version>${tycho.version}</version>
-                               <executions>
-                                       <execution>
-                                               <id>materialize-products</id>
-                                               <goals>
-                                                       <goal>materialize-products</goal>
-                                               </goals>
-                                       </execution>
-                                       <execution>
-                                               <id>archive-products</id>
-                                               <goals>
-                                                       <goal>archive-products</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
-                               <configuration>
-                                       <products>
-                                               <product>
-                                                       <id>eu.etaxonomy.taxeditor.product</id>
-                                                       <rootFolder>EDIT Taxonomic Editor</rootFolder>
-                                               </product>
-                                       </products>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-p2-director-plugin</artifactId>
+        <version>${tycho.version}</version>
+        <executions>
+          <execution>
+            <id>materialize-products</id>
+            <goals>
+              <goal>materialize-products</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>archive-products</id>
+            <goals>
+              <goal>archive-products</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <products>
+            <product>
+              <id>eu.etaxonomy.taxeditor.product</id>
+              <rootFolder>EDIT Taxonomic Editor</rootFolder>
+            </product>
+          </products>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <profiles>
+    <profile>
+      <id>signJars</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-jarsigner-plugin</artifactId>
+            <version>1.3.2</version>
+            <configuration>
+              <alias>editor</alias>
+              <removeExistingSignatures>true</removeExistingSignatures>
+              <!-- keystore properties should be set in the ~/.m2/settings.xml -->
+              <keystore>${keystore.path}</keystore>
+              <storepass>${keystore.store.password}</storepass>
+              <keypass>${keystore.key.password}</keypass>
+
+              <archiveDirectory>${project.build.directory}/repository</archiveDirectory>
+              <!-- Following two settings are to ensure that the product 
+                .zip files are not signed -->
+              <processMainArtifact>false</processMainArtifact>
+              <processAttachedArtifacts>false</processAttachedArtifacts>
+              <includes>
+                <include>plugins/eu.etaxonomy.taxeditor*.jar</include>
+                <include>features/eu.etaxonomy.taxeditor*.jar</include>
+              </includes>
+              <arguments>
+                <!-- Due to bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=378155 
+                  we need to force the signature / digest algorithm to SHA1 since this is the 
+                  only one which plays well with Eclipse 3.x -->
+                <argument>-sigalg</argument>
+                <argument>SHA1withDSA</argument>
+                <argument>-digestalg</argument>
+                <argument>SHA1</argument>
+              </arguments>
+            </configuration>
+            <executions>
+              <execution>
+                <id>sign</id>
+                <goals>
+                  <goal>sign</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <!-- Upload the repo to the server -->
+      <id>uploadRepo</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>wagon-maven-plugin</artifactId>
+            <version>1.0-beta-3</version>
+            <!-- Problems with the wagon-maven-plugin have been encounterd 
+              on Windows, it should work properly on linux though. -->
+            <executions>
+              <execution>
+                <phase>package</phase>
+                <goals>
+                  <goal>upload</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <fromDir>${project.build.directory}/repository</fromDir>
+              <url>scpexe://wp5.e-taxonomy.eu/var/www/download/taxeditor/update/${update.dir}</url>
+              <includes>binary/*,content.jar,artifacts.jar,**/eu.etaxonomy.*.jar</includes>
+              <!-- Comment out the above and uncomment the below to upload 
+                all jars -->
+              <!-- <includes>**/*</includes> -->
+              <serverId>wp5.e-taxonomy.eu</serverId>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 
 </project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 9594ac829c75fb73d0a4a38dba0a70ff79a52ddb..6c7798a66459587a4f99b9f848108a4317cd4c41 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <prerequisites>
     <maven>3.0</maven>
@@ -8,7 +9,8 @@
   <artifactId>taxeditor-parent</artifactId>
   <version>3.3.8-SNAPSHOT</version>
   <name>EDIT Taxonomic Editor</name>
-  <description>The Taxonomic Editor for EDIT's platform for cybertaxonomy</description>
+  <description>The Taxonomic Editor for EDIT's platform for
+    cybertaxonomy</description>
   <url>http://cybertaxonomy.eu/taxeditor//taxeditor//taxeditor//taxeditor//taxeditor//taxeditor//taxeditor/</url>
   <inceptionYear>2007</inceptionYear>
   <packaging>pom</packaging>
@@ -19,6 +21,7 @@
     <!-- TODO can we use project.version ????? -->
     <tycho.version>0.14.0</tycho.version>
     <taxeditor.version>3.3.8-SNAPSHOT</taxeditor.version>
+    <update.dir>snapshot</update.dir>
   </properties>
   <modules>
     <module>eu.etaxonomy.taxeditor.cdmlib</module>
     <module>eu.etaxonomy.taxeditor.editor</module>
     <module>eu.etaxonomy.taxeditor.bulkeditor</module>
     <module>eu.etaxonomy.taxeditor.printpublisher</module>
-    <!--module>eu.etaxonomy.taxeditor.annotatedlineeditor</module-->
     <module>eu.etaxonomy.taxeditor.help</module>
     <module>eu.etaxonomy.taxeditor.application</module>
     <module>eu.etaxonomy.taxeditor.feature.platform</module>
     <module>eu.etaxonomy.taxeditor.feature</module>
     <module>eu.etaxonomy.taxeditor</module>
+
   </modules>
   <scm>
     <connection>scm:svn:http://dev.e-taxonomy.eu/svn/trunk/taxeditor/</connection>
     <mailingList>
       <name>EDIT Taxonomic Editor</name>
       <subscribe>
-                               edit-taxonomic-editor+subscribe@googlegroups.com
-                       </subscribe>
+        edit-taxonomic-editor+subscribe@googlegroups.com
+      </subscribe>
       <unsubscribe>
-                               edit-taxonomic-editor+unsubscribe@googlegroups.com
-                       </unsubscribe>
+        edit-taxonomic-editor+unsubscribe@googlegroups.com
+      </unsubscribe>
       <post>edit-taxonomic-editor@googlegroups.com</post>
       <archive>http://groups.google.com/group/edit-taxonomic-editor/topics</archive>
     </mailingList>
       <!-- your SVN account id please! -->
       <id>a.kohlbecker</id>
       <name>
-                       Andreas Kohlbecker
-                       </name>
+        Andreas Kohlbecker
+      </name>
       <email>a.kohlbecker [at] bgbm.org</email>
       <organization>
-                               Botanic Garden Botanical Museum Berlin
-                       </organization>
+        Botanic Garden Botanical Museum Berlin
+      </organization>
       <organizationUrl>http://www.bgbm.org/BioDivInf/</organizationUrl>
       <timezone>+1</timezone>
       <roles>
         <role>Java Developer</role>
         <role>Architect</role>
       </roles>
-      <url/>
+      <url />
     </developer>
     <developer>
       <!-- your SVN account id please! -->
       <id>a.mueller</id>
       <name>
-                               Andreas Müller
-                       </name>
+        Andreas Müller
+      </name>
       <email>a.mueller [at] bgbm.org</email>
       <organization>
-                               Botanic Garden Botanical Museum Berlin
-                       </organization>
+        Botanic Garden Botanical Museum Berlin
+      </organization>
       <organizationUrl>http://www.bgbm.org/BioDivInf/</organizationUrl>
       <timezone>+1</timezone>
       <roles>
         <role>Java Developer</role>
         <role>Architect</role>
       </roles>
-      <url/>
+      <url />
     </developer>
   </developers>
   <issueManagement>
           <strictVersions>true</strictVersions>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-p2-repository-plugin</artifactId>
+        <version>${tycho.version}</version>
+        <configuration>
+          <includeAllDependencies>true</includeAllDependencies>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>org.eclipse.tycho</groupId>
         <artifactId>target-platform-configuration</artifactId>
         <configuration>
           <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
           <autoVersionSubmodules>false</autoVersionSubmodules>
-          <!--preparationGoals>clean verify install</preparationGoals-->
-          <!--goals>deploy</goals-->
+          <!--preparationGoals>clean verify install</preparationGoals -->
+          <!--goals>deploy</goals -->
           <!-- skipping site-deploy by explicitly configuring the goal here -->
           <tagBase>http://dev.e-taxonomy.eu/svn/tags/taxeditor</tagBase>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>wagon-maven-plugin</artifactId>
-        <version>1.0-beta-3</version>
-        <!--
-                               Problems with the wagon-maven-plugin have been encounterd on Windows,
-                                       it should work properly on linux though.
-                                -->
-        <executions>
-          <execution>
-            <phase>deploy</phase>
-            <goals>
-              <goal>upload</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <fromDir>eu.etaxonomy.taxeditor/target/products</fromDir>
-          <includes>*.zip</includes>
-          <url>scpexe://wp5.e-taxonomy.eu/var/www/download/taxeditor/${project.version}</url>
-          <serverId>wp5.e-taxonomy.eu</serverId>
-        </configuration>
-      </plugin>
+
     </plugins>
     <extensions>
       <extension>
         </configuration>
       </plugin>
       <plugin>
-        <!-- this will generate an indexed and cross-referenced HTML version of your source code -->
+        <!-- this will generate an indexed and cross-referenced HTML version 
+          of your source code -->
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jxr-plugin</artifactId>
         <version>2.2</version>
       </plugin>
     </plugins>
   </reporting>
-  <!--  DISTRIBUTION MANAGEMENT -->
+  <!-- DISTRIBUTION MANAGEMENT -->
   <distributionManagement>
     <site>
       <id>wp5.e-taxonomy.eu</id>
       <url>scpexe://wp5.e-taxonomy.eu/var/www/wp5.e-taxonomy.eu/mavenrepo/</url>
     </repository>
   </distributionManagement>
+
 </project>