diff options
author | Wim Jongman | 2018-05-21 19:03:24 +0000 |
---|---|---|
committer | Wim Jongman | 2018-05-21 19:03:24 +0000 |
commit | c81f8a9f764d378df043daa823fd77920cf46765 (patch) | |
tree | 0699d18cc3899adead247b71337719d0166cc306 | |
parent | 27a67c51418f533eaa785e3c83ccc200edb88c4d (diff) | |
download | eclipse.platform.ua-c81f8a9f764d378df043daa823fd77920cf46765.tar.gz eclipse.platform.ua-c81f8a9f764d378df043daa823fd77920cf46765.tar.xz eclipse.platform.ua-c81f8a9f764d378df043daa823fd77920cf46765.zip |
Bug 534921: [Tips] Add Twitter tips to IDE bundleI20180522-2000
[Tips] Add Twitter tips to IDE bundle
Change-Id: I04d92f79732b556c54d83cd7db45c90914bfcf25
Signed-off-by: Wim Jongman <wim.jongman@remainsoftware.com>
4 files changed, 165 insertions, 2 deletions
diff --git a/org.eclipse.tips.ide/plugin.xml b/org.eclipse.tips.ide/plugin.xml index 20849e37c..5e01a6c21 100644 --- a/org.eclipse.tips.ide/plugin.xml +++ b/org.eclipse.tips.ide/plugin.xml @@ -193,5 +193,18 @@ description="Tips about Tips" id="org.eclipse.tips.ide.internal.provider.TipsTipProvider"> </provider> + <provider + class="org.eclipse.tips.ide.internal.provider.TwitterTipProvider" + description="Eclipse IDE Twitter Tip Collection" + id="org.eclipse.tips.ide.internal.provider.TwitterTipProvider"> + <enablement> + <with + variable="activeWorkbenchWindow.activePerspective"> + <equals + value="org.eclipse.jdt.ui.JavaPerspective"> + </equals> + </with> + </enablement> + </provider> </extension> </plugin> diff --git a/org.eclipse.tips.ide/src/org/eclipse/tips/ide/internal/provider/TwitterTipProvider.java b/org.eclipse.tips.ide/src/org/eclipse/tips/ide/internal/provider/TwitterTipProvider.java new file mode 100644 index 000000000..3904b6a8e --- /dev/null +++ b/org.eclipse.tips.ide/src/org/eclipse/tips/ide/internal/provider/TwitterTipProvider.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2018 Remain Software + * 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: + * wim.jongman@remainsoftware.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.tips.ide.internal.provider; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.tips.json.JsonTipProvider; +import org.osgi.framework.Bundle; + +public class TwitterTipProvider extends JsonTipProvider { + + public TwitterTipProvider() throws MalformedURLException { + URL resource = getClass().getResource("twittertips.json"); // $NON-NLS-0$ + if (resource != null) { + setJsonUrl(resource.toString()); + } + } + + @Override + public synchronized IStatus loadNewTips(IProgressMonitor pMonitor) { + Bundle bundle = Platform.getBundle("org.eclipse.jdt.ui"); // $NON-NLS-0$ + if (bundle != null) { + return super.loadNewTips(pMonitor); + } + return Status.OK_STATUS; + } + + @Override + public String getID() { + return getClass().getName(); + } +} diff --git a/org.eclipse.tips.ide/src/org/eclipse/tips/ide/internal/provider/twittertips.json b/org.eclipse.tips.ide/src/org/eclipse/tips/ide/internal/provider/twittertips.json new file mode 100644 index 000000000..89bf85206 --- /dev/null +++ b/org.eclipse.tips.ide/src/org/eclipse/tips/ide/internal/provider/twittertips.json @@ -0,0 +1,105 @@ +{ + "provider": { + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gQdDgUFxygUawAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAJeklEQVRo3u2YW4hdVxnHf2vtvc9lzpnJZC7JJE0mk6Yk6f1erWBFBFsVFUEUq8UiiL6qT7744ItQEMGigiCVQiG+SKmILa2tok1K75c0vaVp2maSJpOZ6Z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anWk/BgLk1tfcCxICL89upji6nUK5SAhK5hTnGdC65vr3inOK84ILuZe8z+c6340DL/37/rMg+dygdJzSWEohhOdnto08ftu3LrUf7odGQDWgEogiYW6pxLzfxdaRMdRYnOTSCX0rLmeYlffd64GspP1U2pOU6V7nslIDzXqGpFmtaPR3n7py9O8fuhfKFxSUgGjgpeObGZmcoVItEVSRkOtUexqnq2PJ2wiVXuFaTpV9Ar2UKStjpic9F5S0njaHjN79tVtmHlJVs1bwvjcGoNthZizUi8w2LmL79BhqDc7LAPjBjKMDetblnL7KQyvPg8Gfk27VUvFZ+KcTd2e1ZI6vBvnKW43qnunqGq2Egun2Pi/NbqE4toOklBCCIGFACqsyzSD4HkBdFcAyENx0wQfJq67zinQyYu+e+f6tu189E8hCbNtnUQcA9ZxaKPDy6Uu56IpxrLF96/e0r6tlsULruddFepLpWpvl676MuvPa9Q7jlbixfUe5duCFmrnx8hFdtbdaMsaka/8PxIZGq8OBV6awI7splIt4CXhPX+P99LiqBViRFlUHND7wrWi/uesFfpYFNHOdd5v+zu/cfMEdZwJ438PHOmcVA1OjYl6bHTYLo1fwiatGUBTnBiSwIt/ryoasH9hmZaCqrpBP/1lQgvd0GqkUJRyZ2lh4+n12toeMMa2zIvCFr16TPfjSlN2+dxu1ekc1iAkD1gqysmXQFelxpXfQ5X8EHfROELzPcJ02LkspGa1XKkO//voXd//5jFsma4B/z/b63x489D3ioV8pVCDfA9IVaYr3brbp6icmJz3wWPr/FgaMURGxSWLrkTU/+tJnZ+56P3BPHVow114yts6bkefH//n46S8fTx7af9x8LMHvu++V5MN+Y/+XCExvH/HnNfhxG/8BVNCkBLE3Vt8AAAAASUVORK5CYII=", + "description": "Eclipse IDE Twitter Tip Collection", + "variables": { + "baseUrl": "http://www.eclipse.org/downloads/download.php?r=1&file=/eclipse/tips/org.eclipse.jdt.tips.user" + }, + "tips": [{ + "date": "2018-01-05", + "subject": "The 'Extract class...' refactoring (from Alt+Shift+T) extracts a group of fields into a separate class and replaces all occurrences to fit the new structure. See example. #EclipseTips https://t.co/tEI7ic7C1g", + "aspect-ratio": "2.0", + "url": "${baseUrl}/content/949238007051235328/949238007051235328.html" + }, { + "date": "2018-01-09", + "subject": "Use the 'new' template for quick object creation. #speed #EclipseTips https://t.co/yI33PEmfkm", + "aspect-ratio": "2.0", + "url": "${baseUrl}/content/950773930775793664/950773930775793664.html" + }, { + "date": "2017-12-15", + "subject": "You don't need to know which module contains a class in #Java9 Ctrl-1 can identify the module and add it for you! #EclipseTips https://t.co/OGjB3V7vJJ", + "aspect-ratio": "2.4", + "url": "${baseUrl}/content/941624342282108929/941624342282108929.html" + }, { + "date": "2017-12-14", + "subject": "Need to check for null? Use the ifnull template and don't slow down! #productivity #EclipseTips https://t.co/FrDemG6rPS", + "aspect-ratio": "2.1", + "url": "${baseUrl}/content/941264226940850177/941264226940850177.html" + }, { + "date": "2017-11-06", + "subject": "You can directly use a CSV file as a parameter source in #JUnit5 parameterized tests. Very handy to feed a large nr of cases! #EclipseTips https://t.co/FDMPAzR2em", + "aspect-ratio": "2.2", + "url": "${baseUrl}/content/927527210772258816/927527210772258816.html" + }, { + "date": "2017-11-16", + "subject": "Enjoy the Edit -> Block Selection (Alt+Shift+A) while working on your #Java9 https://t.co/txMxd39pJ0 #EclipseTips https://t.co/X63mh9uDd7", + "aspect-ratio": "1.7", + "url": "${baseUrl}/content/931124796502536192/931124796502536192.html" + }, { + "date": "2017-10-18", + "subject": "In #JUnit5 parameterized tests also accept CSV literals (and files) as a source of parameters. Quite handy to feed your tests! #EclipseTips https://t.co/T7Lphj5eyl", + "aspect-ratio": "1.9", + "url": "${baseUrl}/content/920608130274381825/920608130274381825.html" + }, { + "date": "2017-09-19", + "subject": "You can use methods returning #Java streams as a source of parameters in #JUnit5 tests. Use @MethodSource as shown below. #EclipseTips https://t.co/Jr1o00YEof", + "aspect-ratio": "1.9", + "url": "${baseUrl}/content/910089046600425472/910089046600425472.html" + }, { + "date": "2017-08-30", + "subject": "Put your cursor on a class name (or method) and press Shift+F2 to jump to the web version of your library's Javadoc! #EclipseTips https://t.co/vpUavzUgk6", + "aspect-ratio": "1.7", + "url": "${baseUrl}/content/902851499503607808/902851499503607808.html" + }, { + "date": "2017-07-24", + "subject": "Use the 'Quick Access' box (Ctrl+3) extensively to be more productive. Just type what you want and you'll probably find it. #EclipseTips https://t.co/KQB2i4BuDU", + "aspect-ratio": "1.6", + "url": "${baseUrl}/content/889435990976323584/889435990976323584.html" + }, { + "date": "2017-07-11", + "subject": "Always safer to 'Invert equals' on literal strings in order to avoid the horrible NullPointerException! Ctrl+1 does it for you. #EclipseTips https://t.co/DmjMWgiySM", + "aspect-ratio": "1.9", + "url": "${baseUrl}/content/884689449917050880/884689449917050880.html" + }, { + "date": "2017-07-21", + "subject": "Private methods in interfaces will be allowed in #Java9. Here's an example use case with a shared 'worker' method. #EclipseTips https://t.co/cdRcETAmMV", + "aspect-ratio": "1.2", + "url": "${baseUrl}/content/888360858119745536/888360858119745536.html" + }, { + "date": "2017-06-13", + "subject": "Whatever element you have selected, code or item, 'Show in...' (Alt+Shift+W) command pops up useful views for various details! #EclipseTips https://t.co/6GVpSPKOdT", + "aspect-ratio": "1.2", + "url": "${baseUrl}/content/874600197195796482/874600197195796482.html" + }, { + "date": "2017-06-01", + "subject": "Often you want to move lines up/down. Press Alt+Up/Dn to move the lines along with the cursor. Indenting is corrected for you. #EclipseTips https://t.co/5tnaajebZf", + "aspect-ratio": "1.3", + "url": "${baseUrl}/content/870170548722184192/870170548722184192.html" + }, { + "date": "2017-05-04", + "subject": "If you want to know where and how a variable was declared just press Shift while hovering and you'll get it in-place! #EclipseTips https://t.co/4Vpz4JKW0w", + "aspect-ratio": "1.8", + "url": "${baseUrl}/content/860125970556223489/860125970556223489.html" + }, { + "date": "2017-05-16", + "subject": "Here's our Edit -> Toggle Block Selection tool (or just hit Shift+Alt+A) in action. Very useful! #productivity #EclipseTips https://t.co/myMI2oaLLG", + "aspect-ratio": "1.5", + "url": "${baseUrl}/content/864423629697822720/864423629697822720.html" + }, { + "date": "2017-04-20", + "subject": "The 'enclosing' selection (Alt+Shift+Up/Dn) is a great shortcut. Selects the enclosing structure, e.g. var->if->method->class #EclipseTips https://t.co/joGBu9IzdB", + "aspect-ratio": "2.0", + "url": "${baseUrl}/content/855062302655209472/855062302655209472.html" + }, { + "date": "2017-04-25", + "subject": "Ever looked at a #Java method thinking 'what does this one do'? Press Shift while hovering it and it will show implementation in-place! #Tip https://t.co/5Qym5CkcJN", + "aspect-ratio": "2.1", + "url": "${baseUrl}/content/856867463409041410/856867463409041410.html" + }, { + "date": "2018-03-22", + "subject": "#Java10 is out. Time to play with 'var'. Try it out with @EclipseJavaIDE and its new quick assists (Ctrl+1). https://t.co/iUJcGjV1Ts #EclipseTips https://t.co/HfJqlymzZb", + "aspect-ratio": "4.2", + "url": "${baseUrl}/content/976836214857740288/976836214857740288.html" + }] + } +}
\ No newline at end of file diff --git a/org.eclipse.tips.json/src/org/eclipse/tips/json/JsonTipProvider.java b/org.eclipse.tips.json/src/org/eclipse/tips/json/JsonTipProvider.java index 566821da7..c48c96e52 100644 --- a/org.eclipse.tips.json/src/org/eclipse/tips/json/JsonTipProvider.java +++ b/org.eclipse.tips.json/src/org/eclipse/tips/json/JsonTipProvider.java @@ -67,8 +67,8 @@ public abstract class JsonTipProvider extends TipProvider { * * <p> * <b>Implementation Details</b><br> - * The implementation of this method in this provider will fetch the json file - * and store it locally. + * The implementation of this method in this provider will parse the json file + * which was set with {@link #setJsonUrl(String)}. * */ @Override |