diff options
author | Wim Jongman | 2018-04-29 19:35:31 +0000 |
---|---|---|
committer | Wim Jongman | 2018-04-29 20:28:12 +0000 |
commit | 0042755f51c37aa19cf5f0cfea5259ef71437683 (patch) | |
tree | 196ec3a8da994187c62f542367da48c17952deac /org.eclipse.tips.core | |
parent | fde39fc97b47e4743249cbd96c62985967700bda (diff) | |
download | eclipse.platform.ua-0042755f51c37aa19cf5f0cfea5259ef71437683.tar.gz eclipse.platform.ua-0042755f51c37aa19cf5f0cfea5259ef71437683.tar.xz eclipse.platform.ua-0042755f51c37aa19cf5f0cfea5259ef71437683.zip |
Bug 534073: [Tips] Create JSon based Tip Provider for PlatformI20180430-0715I20180429-2000
* Added photon new and noteworthy provider
* Changed startup sequence
* Added logging
* Removed warnings from examples
* Fixed Twitter Feed to not use the Twitter URL
* Added TipProvider#hasContent
* Changes IUrlTip#getURL
Change-Id: I100d32c49d27d850697ae1f347282d99d52417e2
Signed-off-by: Wim Jongman <wim.jongman@remainsoftware.com>
Diffstat (limited to 'org.eclipse.tips.core')
4 files changed, 35 insertions, 12 deletions
diff --git a/org.eclipse.tips.core/src/org/eclipse/tips/core/ITipManager.java b/org.eclipse.tips.core/src/org/eclipse/tips/core/ITipManager.java index 52fbe3434..16007f3fc 100644 --- a/org.eclipse.tips.core/src/org/eclipse/tips/core/ITipManager.java +++ b/org.eclipse.tips.core/src/org/eclipse/tips/core/ITipManager.java @@ -61,14 +61,14 @@ public interface ITipManager { * @return this */ public ITipManager register(TipProvider provider); - + /** * Opens the Tip of the Day dialog. * * @param startUp When called from a startup situation, true must be passed for - * <code>startup</code>. If in a manual starting situation, - * false must be passed. This enables the manager to decide to - * skip opening the dialog at startup (e.g., no new tip items). + * <code>startup</code>. If in a manual starting situation, false + * must be passed. This enables the manager to decide to skip + * opening the dialog at startup (e.g., no new tip items). * * @return this * @@ -82,4 +82,14 @@ public interface ITipManager { * @return true if this manager is open, false otherwise. */ public boolean isOpen(); + + /** + * Indicates if this manager has providers with tips (based on the read or + * unread requirement). Be aware that subsequent calls to this method may return + * different results based on the async nature of loading providers. + * + * @return true if this {@link TipManager} has providers with tips. + * @see TipProvider#getTips() + */ + public boolean hasContent(); }
\ No newline at end of file diff --git a/org.eclipse.tips.core/src/org/eclipse/tips/core/IUrlTip.java b/org.eclipse.tips.core/src/org/eclipse/tips/core/IUrlTip.java index 01ec04a59..497d76cca 100644 --- a/org.eclipse.tips.core/src/org/eclipse/tips/core/IUrlTip.java +++ b/org.eclipse.tips.core/src/org/eclipse/tips/core/IUrlTip.java @@ -19,12 +19,13 @@ import java.net.URL; public interface IUrlTip { /** - * Return an URL with the primary goal to be rendered by the tip manager. - * Implementations of Tip may also use the URL to aid the rendering (e.g. by - * providing other data than HTML, e.g. a text file). + * Return the string representation of an {@link URL} with the primary goal to + * be rendered by the tip manager. Implementations of Tip may also use the URL + * to aid the rendering (e.g. by providing other data than HTML, e.g. a text + * file). * - * @return the URL to the (remote) content + * @return the string representation of URL to the (remote) content * */ - public URL getURL(); + public String getURL(); }
\ No newline at end of file diff --git a/org.eclipse.tips.core/src/org/eclipse/tips/core/TipProvider.java b/org.eclipse.tips.core/src/org/eclipse/tips/core/TipProvider.java index e5f364716..caa79cbf1 100644 --- a/org.eclipse.tips.core/src/org/eclipse/tips/core/TipProvider.java +++ b/org.eclipse.tips.core/src/org/eclipse/tips/core/TipProvider.java @@ -21,6 +21,7 @@ import java.util.stream.Collectors; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.tips.core.internal.FinalTip; +import org.eclipse.tips.core.internal.LogUtil; /** * Class to provide tips to the tip framework. It is the job of this provider to @@ -268,9 +269,10 @@ public abstract class TipProvider { * @see #loadNewTips(IProgressMonitor) */ public TipProvider setTips(List<Tip> tips) { - if (!getManager().isOpen()) { - return this; - } +// if (!getManager().isOpen()) { +// return this; +// } + getManager().log(LogUtil.info(String.format("Setting tips"))); doSetTips(tips, true); fReady = true; fChangeSupport.firePropertyChange(PROP_READY, false, true); diff --git a/org.eclipse.tips.core/src/org/eclipse/tips/core/internal/TipManager.java b/org.eclipse.tips.core/src/org/eclipse/tips/core/internal/TipManager.java index 4d2a8ace4..2c1be0d8b 100644 --- a/org.eclipse.tips.core/src/org/eclipse/tips/core/internal/TipManager.java +++ b/org.eclipse.tips.core/src/org/eclipse/tips/core/internal/TipManager.java @@ -249,4 +249,14 @@ public abstract class TipManager implements ITipManager { public boolean isDisposed() { return fIsDiposed; } + + @Override + public boolean hasContent() { + for (TipProvider provider : getProviders()) { + if (provider.isReady() && !provider.getTips().isEmpty()) { + return true; + } + } + return false; + } }
\ No newline at end of file |