Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/Messages.java1
-rw-r--r--org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/TipComposite.java37
-rw-r--r--org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/messages.properties1
3 files changed, 36 insertions, 3 deletions
diff --git a/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/Messages.java b/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/Messages.java
index b03d15f9d..907305636 100644
--- a/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/Messages.java
+++ b/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/Messages.java
@@ -12,6 +12,7 @@ public class Messages extends NLS {
public static String TipComposite_11;
public static String TipComposite_12;
public static String TipComposite_13;
+ public static String TipComposite_14;
public static String TipComposite_2;
public static String TipComposite_3;
public static String TipComposite_4;
diff --git a/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/TipComposite.java b/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/TipComposite.java
index c98bd4d6d..1067e4d5d 100644
--- a/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/TipComposite.java
+++ b/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/TipComposite.java
@@ -138,7 +138,7 @@ public class TipComposite extends Composite implements ProviderSelectionListener
fStartupItem = new ToolItem(ftoolBar, SWT.DROP_DOWN);
fStartupItem.setText(Messages.TipComposite_13);
fStartupItem.addListener(SWT.Selection, event -> {
- showStartupOptions(menu);
+ showStartupOptions(menu);
});
fUnreadOnly = new Button(preferenceBar, SWT.CHECK);
@@ -250,6 +250,8 @@ public class TipComposite extends Composite implements ProviderSelectionListener
fSlider.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
fContentStack.topControl = fBrowserComposite;
fSlider.addTipProviderListener(this);
+
+ loadWaitingScript();
}
private void showStartupOptions(final Menu menu) {
@@ -420,7 +422,7 @@ public class TipComposite extends Composite implements ProviderSelectionListener
}
/**
- * Sets content in the browser that displays a message after 500ms if the Tip
+ * Sets content in the browser that displays a message after 1500ms if the Tip
* could not load fast enough.
*/
private void loadTimeOutScript() {
@@ -432,6 +434,35 @@ public class TipComposite extends Composite implements ProviderSelectionListener
}
}
+ /**
+ * Sets content in the browser that displays a message after 1500ms if tips
+ * could not be loaded.
+ */
+ private void loadWaitingScript() {
+ fBrowser.setText(getWaitingScript(1500));
+ while (!isDisposed()) {
+ if (!getDisplay().readAndDispatch()) {
+ break;
+ }
+ }
+ }
+
+ /**
+ * Get the timeout script in case the tips are not loading.
+ *
+ * @param timeout the timeout in milliseconds
+ * @return the script
+ */
+ private static String getWaitingScript(int timeout) {
+ return "<style>div{height: 90vh;display: flex;justify-content: center;align-items: center;}</style>" //$NON-NLS-1$
+ + "<div id=\"txt\"></div>" //$NON-NLS-1$
+ + "<script>var wss=function(){document.getElementById(\"txt\").innerHTML=\"" //$NON-NLS-1$
+ + Messages.TipComposite_14 //
+ + "\"};window.setTimeout(wss," //$NON-NLS-1$
+ + timeout //
+ + ");</script>"; //$NON-NLS-1$
+ }
+
private void enableActionButtons(Tip tip) {
disposeActionImages();
if (tip.getActions().isEmpty()) {
@@ -509,7 +540,7 @@ public class TipComposite extends Composite implements ProviderSelectionListener
}
/**
- * Get the timeout script in case the tips takes too to load.
+ * Get the timeout script in case a tip takes time to load.
*
* @param timeout the timeout in milliseconds
* @return the script
diff --git a/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/messages.properties b/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/messages.properties
index 93565db12..a646ead63 100644
--- a/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/messages.properties
+++ b/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/messages.properties
@@ -9,6 +9,7 @@ TipComposite_3=More...
TipComposite_4=New Button
TipComposite_1=&Show dialog on new tips
TipComposite_13=&Startup Options
+TipComposite_14=Waiting for a provider with content. Are all tips read?
TipComposite_5=&Indicate new tips in status bar
TipComposite_6=&Disable
TipComposite_7=&Previous Tip

Back to the top