From e28d0ce18f4fca911f3d6e0cb250d306b1fc80d0 Mon Sep 17 00:00:00 2001 From: Cherian Mathew Date: Tue, 23 Sep 2014 11:14:59 +0000 Subject: [PATCH] eu.etaxonomy.taxeditor.product, eu.etaxonomy.taxeditor.feature/feature.xml, eu.etaxonomy.taxeditor.feature.platform/feature.xml : commented out license text to prevent extra popup on update plugin(_de,_en).properties : added license info to productBlurb used in the About popup ApplicationWorkbenchWindowAdvisor, IPreferenceKeys, TaxonomicEditorGeneralPreferences : removed preference for allowing update checks on startup as this is already provided by rcp ApplicationWorkbenchWindowAdvisor, ApplicationUtil, P2Util, UpdateHandler : changed setting of default repositories to make sure that they are set on startup --- .../OSGI-INF/l10n/plugin.properties | 12 ++++- .../OSGI-INF/l10n/plugin_de.properties | 12 ++++- .../OSGI-INF/l10n/plugin_en.properties | 12 ++++- .../etaxonomy/taxeditor/ApplicationUtil.java | 2 +- .../ApplicationWorkbenchWindowAdvisor.java | 10 +--- .../eu/etaxonomy/taxeditor/update/P2Util.java | 53 +++++++++++++------ .../taxeditor/update/UpdateHandler.java | 23 ++------ .../feature.xml | 4 +- eu.etaxonomy.taxeditor.feature/feature.xml | 4 +- .../taxeditor/preference/IPreferenceKeys.java | 2 - .../TaxonomicEditorGeneralPreferences.java | 4 -- .../eu.etaxonomy.taxeditor.product | 4 +- 12 files changed, 80 insertions(+), 62 deletions(-) diff --git a/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin.properties b/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin.properties index 31330aa53..8db829129 100644 --- a/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin.properties +++ b/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin.properties @@ -1,6 +1,14 @@ productName=EDIT Taxonomic Editor -productBlurb=EDIT Taxonomic Editor\n\Version: {0}\nBuild Date: {1} CET\n\n\Copyright (C) 2009 EDIT\n\European Distributed Institute of Taxonomy\n\http://www.e-taxonomy.eu - +productBlurb=EDIT Taxonomic 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 = Taxonomic Editor perspective.name = Taxonomic perspective.name.0 = Polytomous Key diff --git a/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_de.properties b/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_de.properties index baa8b89f8..125f69ee8 100644 --- a/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_de.properties +++ b/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_de.properties @@ -1,6 +1,14 @@ productName=EDIT Taxonomischer Editor -productBlurb=EDIT Taxonomischer Editor\n\Version: {0}\nBuild Date: {1} CET\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 diff --git a/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_en.properties b/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_en.properties index 31330aa53..47bd90cc3 100644 --- a/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_en.properties +++ b/eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_en.properties @@ -1,6 +1,14 @@ productName=EDIT Taxonomic Editor -productBlurb=EDIT Taxonomic Editor\n\Version: {0}\nBuild Date: {1} CET\n\n\Copyright (C) 2009 EDIT\n\European Distributed Institute of Taxonomy\n\http://www.e-taxonomy.eu - +productBlurb=EDIT Taxonomic 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 = Taxonomic Editor perspective.name = Taxonomic perspective.name.0 = Polytomous Key diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationUtil.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationUtil.java index 62194cb5a..105be8f47 100644 --- a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationUtil.java +++ b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationUtil.java @@ -54,7 +54,7 @@ public class ApplicationUtil extends AbstractUtility { * @return */ public static boolean isStable() { - return !getVersion().startsWith(BETA_PREFIX); + return !getVersion().startsWith("["); } /** *

getPluginId

diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java index a15b83e5f..99f3432ff 100644 --- a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java +++ b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java @@ -7,8 +7,6 @@ import org.eclipse.ui.application.IActionBarConfigurer; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchWindowAdvisor; -import eu.etaxonomy.taxeditor.model.MessagingUtils; -import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog; @@ -63,14 +61,8 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { CdmStore.connect(); } + P2Util.setDefaultUpdateRepositories(); - try { - if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_AUTO_UPDATE_AT_STARTUP)) { - P2Util.checkForUpdates(); - } - } catch (Exception e) { - MessagingUtils.error(this.getClass(), e); - } } private int authenticate(){ 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 index f73213854..e666929ac 100644 --- 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 @@ -10,11 +10,14 @@ 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; @@ -46,17 +49,37 @@ 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"; - public static void setUpdateRepositories(UpdateOperation operation) throws URISyntaxException { + @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; } - operation.getProvisioningContext().setMetadataRepositories(new URI[]{new URI(updateSite)}); - operation.getProvisioningContext().setArtifactRepositories(new URI[]{new URI(updateSite)}); - } + 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); + } + } + /** * * @@ -110,17 +133,17 @@ public class P2Util { // 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; - } +// 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); 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 index 27db567c5..bca8c9923 100644 --- 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 @@ -10,17 +10,12 @@ *******************************************************************************/ package eu.etaxonomy.taxeditor.update; -import java.net.URISyntaxException; - 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; -import eu.etaxonomy.taxeditor.TaxonomicEditorPlugin; -import eu.etaxonomy.taxeditor.model.MessagingUtils; - /** * UpdateHandler invokes the check for updates UI * @@ -32,21 +27,11 @@ public class UpdateHandler extends PreloadingRepositoryHandler { @Override protected void doExecute(LoadMetadataRepositoryJob job) { -// if (hasNoRepos) { -// return; -// } + if (hasNoRepos) { + return; + } UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null); - try { - P2Util.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; - } + // check for updates operation.resolveModal(null); diff --git a/eu.etaxonomy.taxeditor.feature.platform/feature.xml b/eu.etaxonomy.taxeditor.feature.platform/feature.xml index c9e4f2148..21e0de374 100644 --- a/eu.etaxonomy.taxeditor.feature.platform/feature.xml +++ b/eu.etaxonomy.taxeditor.feature.platform/feature.xml @@ -7,12 +7,12 @@ ws="cocoa,gtk,win32" arch="x86,x86_64"> - + diff --git a/eu.etaxonomy.taxeditor.feature/feature.xml b/eu.etaxonomy.taxeditor.feature/feature.xml index 431e360ed..e16cb1367 100644 --- a/eu.etaxonomy.taxeditor.feature/feature.xml +++ b/eu.etaxonomy.taxeditor.feature/feature.xml @@ -17,12 +17,12 @@ [Enter Copyright Description here.] - + diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java index 49d3e7abf..213624293 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java @@ -50,8 +50,6 @@ public interface IPreferenceKeys { */ public static final String SHOW_DEBUG_INFORMATION = "eu.etaxonomy.taxeditor.showDebugInformation"; - public static final String ALLOW_AUTO_UPDATE_AT_STARTUP = "eu.etaxonomy.taxeditor.allowAutoUpdateAtStartup"; - /** * */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java index 034ab540e..08a1a3673 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java @@ -57,10 +57,6 @@ public class TaxonomicEditorGeneralPreferences extends addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS, "Open search results in separate windows", getFieldEditorParent())); - addField(new BooleanFieldEditor(IPreferenceKeys.ALLOW_AUTO_UPDATE_AT_STARTUP, - "Check for updates when the Editor starts up", - getFieldEditorParent())); - } /* diff --git a/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product b/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product index fde6b85b6..cf45cfff6 100644 --- a/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product +++ b/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product @@ -36,7 +36,7 @@ - + -- 2.34.1