Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Jongman2018-05-11 17:47:45 +0000
committerWim Jongman2018-05-11 17:48:16 +0000
commita55daf01ce26bb8ed81fcba845720d7819f0e150 (patch)
treeed67b20f6bf9b888d881404205dcfbaae97b53c0
parent9dff3286ac3fc7a38e16b160d91e459ce61e6203 (diff)
downloadeclipse.platform.common-a55daf01ce26bb8ed81fcba845720d7819f0e150.tar.gz
eclipse.platform.common-a55daf01ce26bb8ed81fcba845720d7819f0e150.tar.xz
eclipse.platform.common-a55daf01ce26bb8ed81fcba845720d7819f0e150.zip
Bug 534073: [Tips] Create JSon based Tip ProvidersI20180513-0800I20180512-1500I20180512-0830I20180511-2000
* Moved web tip location. Change-Id: I9c7f4f3ed3f68d0b2e1ddd504482d0baf000a6d9 Signed-off-by: Wim Jongman <wim.jongman@remainsoftware.com>
-rw-r--r--bundles/org.eclipse.jdt.tips.user/content/provider.json (renamed from bundles/org.eclipse.jdt.tips.user/content/jdttips.json)2
-rw-r--r--bundles/org.eclipse.jdt.tips.user/src/org/eclipse/jdt/tips/user/internal/JDTTipProvider.java22
2 files changed, 14 insertions, 10 deletions
diff --git a/bundles/org.eclipse.jdt.tips.user/content/jdttips.json b/bundles/org.eclipse.jdt.tips.user/content/provider.json
index 2c3add5f4..1358b48ae 100644
--- a/bundles/org.eclipse.jdt.tips.user/content/jdttips.json
+++ b/bundles/org.eclipse.jdt.tips.user/content/provider.json
@@ -4,7 +4,7 @@
"description": "Java and JDT Tips",
"expression": "<with variable=\"activeWorkbenchWindow.activePerspective\"><equals value=\"org.eclipse.jdt.ui.JavaPerspective\"></equals></with>",
"variables": {
- "baseUrl": "http://www.eclipse.org/downloads/download.php?r=1&file=/e4/tips/org.eclipse.jdt.tips.user"
+ "baseUrl": "http://www.eclipse.org/downloads/download.php?r=1&file=/eclipse/tips/org.eclipse.jdt.tips.user"
},
"tips": [{
"date": "2018-01-05",
diff --git a/bundles/org.eclipse.jdt.tips.user/src/org/eclipse/jdt/tips/user/internal/JDTTipProvider.java b/bundles/org.eclipse.jdt.tips.user/src/org/eclipse/jdt/tips/user/internal/JDTTipProvider.java
index 422a0660b..f65b461f6 100644
--- a/bundles/org.eclipse.jdt.tips.user/src/org/eclipse/jdt/tips/user/internal/JDTTipProvider.java
+++ b/bundles/org.eclipse.jdt.tips.user/src/org/eclipse/jdt/tips/user/internal/JDTTipProvider.java
@@ -25,7 +25,7 @@ import org.eclipse.tips.json.JsonTipProvider;
public class JDTTipProvider extends JsonTipProvider {
private static final String EMPTY = ""; //$NON-NLS-1$
- private static final String FILENAME = "jdttips.json"; //$NON-NLS-1$
+ private static final String FILENAME = "provider.json"; //$NON-NLS-1$
private String fUrl;
private File fStateLocation;
@@ -34,7 +34,7 @@ public class JDTTipProvider extends JsonTipProvider {
if (fUrl != null) {
setJsonUrl(fUrl);
} else {
- fUrl = "http://www.eclipse.org/downloads/download.php?r=1&file=/eclipse/tips/" + FILENAME; //$NON-NLS-1$
+ fUrl = "http://www.eclipse.org/downloads/download.php?r=1&file=/eclipse/tips/org.eclipse.jdt.tips.user/" + FILENAME; //$NON-NLS-1$
setJsonUrl(fUrl);
}
}
@@ -108,9 +108,11 @@ public class JDTTipProvider extends JsonTipProvider {
}
/**
- * Returns the state location of the IDE tips. First the property
- * "org.eclipse.tips.statelocation" is read. If it does not exist then the state
- * location will be <b>${user.home}/.eclipse/org.eclipse.tips.state</b>
+ * Returns the state location of this provider. First the property
+ * <code>getID() + ".statelocation"</code> is read. If it does not exist then
+ * the state location "org.eclipse.tips.statelocation" property is read. If it
+ * does not exist then the state location will be
+ * <b>${user.home}/.eclipse/org.eclipse.tips.state</b>
*
* @return the state location file
* @throws IOException if something went wrong
@@ -123,8 +125,11 @@ public class JDTTipProvider extends JsonTipProvider {
String stateLocation = System.getProperty(getID() + ".statelocation"); //$NON-NLS-1$
if (stateLocation == null) {
- stateLocation = System.getProperty("user.home") + File.separator + ".eclipse" + File.separator //$NON-NLS-1$ //$NON-NLS-2$
- + getID() + ".state"; //$NON-NLS-1$
+ stateLocation = System.getProperty("org.eclipse.tips.statelocation"); //$NON-NLS-1$
+ if (stateLocation == null) {
+ stateLocation = System.getProperty("user.home") + File.separator + ".eclipse" + File.separator //$NON-NLS-1$ //$NON-NLS-2$
+ + getID() + ".state"; //$NON-NLS-1$
+ }
}
fStateLocation = new File(stateLocation);
if (!fStateLocation.exists()) {
@@ -132,8 +137,7 @@ public class JDTTipProvider extends JsonTipProvider {
}
if (!fStateLocation.canRead() || !fStateLocation.canWrite()) {
- throw new IOException(
- MessageFormat.format(Messages.JDTTipProvider_5, fStateLocation.getAbsolutePath()));
+ throw new IOException(MessageFormat.format(Messages.JDTTipProvider_5, fStateLocation.getAbsolutePath()));
}
return fStateLocation;
}

Back to the top