Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Scholz2018-06-13 10:27:54 +0000
committerSimon Scholz2018-06-13 10:27:54 +0000
commitaf31351aa31576108f641d97c45bede269966756 (patch)
treee5a16b7abd711aaebc6a1cc5983c59bf2c5b8e44
parent644696ffe1a907882e61e5464467db33c911ac17 (diff)
downloadeclipse.platform.ua-af31351aa31576108f641d97c45bede269966756.tar.gz
eclipse.platform.ua-af31351aa31576108f641d97c45bede269966756.tar.xz
eclipse.platform.ua-af31351aa31576108f641d97c45bede269966756.zip
Bug 535852 - [Tip of the day] Provide a DefaultHtmlTipI20180615-0655I20180615-0300I20180614-2045I20180614-2000
Change-Id: I7c71e196d2a2cad53adf60ecd805e25c67204ff6 Signed-off-by: Simon Scholz <simon.scholz@vogella.com>
-rw-r--r--org.eclipse.tips.core/src/org/eclipse/tips/core/DefaultHtmlTip.java95
1 files changed, 95 insertions, 0 deletions
diff --git a/org.eclipse.tips.core/src/org/eclipse/tips/core/DefaultHtmlTip.java b/org.eclipse.tips.core/src/org/eclipse/tips/core/DefaultHtmlTip.java
new file mode 100644
index 000000000..76946363c
--- /dev/null
+++ b/org.eclipse.tips.core/src/org/eclipse/tips/core/DefaultHtmlTip.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2018 vogella GmbH
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ * simon.scholz@vogella.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tips.core;
+
+import java.util.Date;
+
+/**
+ * Default implementation of a {@link Tip}, which implements {@link IHtmlTip}.
+ * <p>
+ * All return values of the overridden methods can be passed as constructor
+ * arguments.
+ * </p>
+ *
+ * @see Tip
+ * @see IHtmlTip
+ */
+public class DefaultHtmlTip extends Tip implements IHtmlTip {
+
+ private final Date creationDate;
+ private final String subject;
+ private final String html;
+ private final TipImage tipImage;
+
+ /**
+ * Constructor, which leaves out the {@link TipImage}.
+ *
+ * @param providerId id of the {@link TipProvider}, where this tip is added
+ * @param creationDate creation date of this tip
+ * @param subject subject of this tip
+ * @param html HTML content of this tip
+ */
+ public DefaultHtmlTip(String providerId, Date creationDate, String subject, String html) {
+ this(providerId, creationDate, subject, html, null);
+ }
+
+ /**
+ * Constructor, which leaves out the html content and just shows the
+ * {@link TipImage}.
+ *
+ * @param providerId id of the {@link TipProvider}, where this tip is added
+ * @param creationDate creation date of this tip
+ * @param subject subject of this tip
+ * @param tipImage {@link TipImage} of this tip, which will be shown as
+ * content
+ */
+ public DefaultHtmlTip(String providerId, Date creationDate, String subject, TipImage tipImage) {
+ this(providerId, creationDate, subject, null, tipImage);
+ }
+
+ /**
+ * Constructor, which includes HTML content and tipImage
+ *
+ * @param providerId id of the {@link TipProvider}, where this tip is added
+ * @param creationDate creation date of this tip
+ * @param subject subject of this tip
+ * @param html HTML content of this tip
+ * @param tipImage {@link TipImage} of this tip, which will be shown as
+ * content
+ */
+ public DefaultHtmlTip(String providerId, Date creationDate, String subject, String html, TipImage tipImage) {
+ super(providerId);
+ this.creationDate = creationDate;
+ this.subject = subject;
+ this.html = html;
+ this.tipImage = tipImage;
+ }
+
+ @Override
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ @Override
+ public String getSubject() {
+ return subject;
+ }
+
+ @Override
+ public String getHTML() {
+ return html;
+ }
+
+ @Override
+ public TipImage getImage() {
+ return tipImage;
+ }
+}

Back to the top