Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2009-09-17 17:47:01 +0000
committerChris Goldthorpe2009-09-17 17:47:01 +0000
commit0906262aca635cce66ad5c69ac4b3b49ae49aa9f (patch)
treeec0ccbff5461bbc9cc8570504920a869699466d0
parentd6523b15009c1f29306fc7cf6a5523b28628cb91 (diff)
downloadeclipse.platform.ua-0906262aca635cce66ad5c69ac4b3b49ae49aa9f.tar.gz
eclipse.platform.ua-0906262aca635cce66ad5c69ac4b3b49ae49aa9f.tar.xz
eclipse.platform.ua-0906262aca635cce66ad5c69ac4b3b49ae49aa9f.zip
Bug 287712 – [Webapp] Allow additional buttons to be added to the help webapp
-rw-r--r--org.eclipse.help.webapp/advanced/contentToolbar.jsp3
-rw-r--r--org.eclipse.help.webapp/advanced/toolbar.jsp14
-rw-r--r--org.eclipse.help.webapp/plugin.xml1
-rw-r--r--org.eclipse.help.webapp/schema/toolbarButton.exsd89
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java76
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java18
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java67
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java124
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java47
-rw-r--r--org.eclipse.ua.tests/jsp/advanced/titlesearchView.jsp10
-rw-r--r--org.eclipse.ua.tests/plugin.xml11
-rw-r--r--org.eclipse.ua.tests/script/titlesearch.js37
12 files changed, 473 insertions, 24 deletions
diff --git a/org.eclipse.help.webapp/advanced/contentToolbar.jsp b/org.eclipse.help.webapp/advanced/contentToolbar.jsp
index 3aa4cdae5..b4f5c78be 100644
--- a/org.eclipse.help.webapp/advanced/contentToolbar.jsp
+++ b/org.eclipse.help.webapp/advanced/contentToolbar.jsp
@@ -1,5 +1,5 @@
<%--
- Copyright (c) 2000, 2008 IBM Corporation and others.
+ Copyright (c) 2000, 2009 IBM Corporation and others.
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
@@ -31,6 +31,7 @@
<jsp:include page="toolbar.jsp">
<jsp:param name="script" value="contentActions.js"/>
<jsp:param name="toolbar" value="content"/>
+ <jsp:param name="view" value="content"/>
<jsp:param name="name" value="toggle_highlight"/>
<jsp:param name="tooltip" value='highlight_tip'/>
diff --git a/org.eclipse.help.webapp/advanced/toolbar.jsp b/org.eclipse.help.webapp/advanced/toolbar.jsp
index 9fb6dd205..4cd21381a 100644
--- a/org.eclipse.help.webapp/advanced/toolbar.jsp
+++ b/org.eclipse.help.webapp/advanced/toolbar.jsp
@@ -153,6 +153,16 @@ HTML {
</style>
+<%
+ String[] scripts = data.getScriptFiles();
+ for (int s = 0; s < scripts.length; s++) {
+ String path = scripts[s];
+%>
+ <script language="JavaScript" src = "<%=path%>" ></script>
+<%
+ }
+%>
+
<script language="JavaScript">
var bRestore = false;
@@ -163,7 +173,7 @@ for (int i=0; i<buttons.length; i++) {
if (!buttons[i].isSeparator()) {
%>
var <%=buttons[i].getName()%> = new Image();
- <%=UrlUtil.JavaScriptEncode(buttons[i].getName())%>.src = "<%=UrlUtil.JavaScriptEncode(buttons[i].getOnImage())%>";
+ <%=UrlUtil.JavaScriptEncode(buttons[i].getName())%>.src = "<%=UrlUtil.JavaScriptEncode(buttons[i].getImage())%>";
<%
}
}
@@ -452,7 +462,7 @@ if(buttons.length > 0){
onmouseover="javascript:setWindowStatus('<%=UrlUtil.htmlEncode(buttons[i].getName())%>');return true;"
onmouseout="window.status='';"
id="b<%=i%>">
- <img src="<%=UrlUtil.htmlEncode(buttons[i].getOnImage())%>"
+ <img src="<%=UrlUtil.htmlEncode(buttons[i].getImage())%>"
alt='<%=UrlUtil.htmlEncode(buttons[i].getTooltip())%>'
title='<%=UrlUtil.htmlEncode(buttons[i].getTooltip())%>'
border="0"
diff --git a/org.eclipse.help.webapp/plugin.xml b/org.eclipse.help.webapp/plugin.xml
index 3f30a3ccd..efcf65f5e 100644
--- a/org.eclipse.help.webapp/plugin.xml
+++ b/org.eclipse.help.webapp/plugin.xml
@@ -13,6 +13,7 @@
<plugin>
<extension-point id="contentFilter" name="Content Filter" schema="schema/contentFilter.exsd"/>
<extension-point id="view" name="View" schema="schema/view.exsd"/>
+ <extension-point id="toolbarButton" name="Toolbar Button" schema="schema/toolbarButton.exsd"/>
<extension
point="org.eclipse.equinox.http.registry.httpcontexts">
<httpcontext
diff --git a/org.eclipse.help.webapp/schema/toolbarButton.exsd b/org.eclipse.help.webapp/schema/toolbarButton.exsd
new file mode 100644
index 000000000..03f97895b
--- /dev/null
+++ b/org.eclipse.help.webapp/schema/toolbarButton.exsd
@@ -0,0 +1,89 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.help.webapp" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.help.webapp" id="toolbarButton" name="Toolbar Button"/>
+ </appInfo>
+ <documentation>
+ Allows additional buttons to be added to the toolbars of the help web application.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="button"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="button">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class which extends AbstractButton and which contains methods which return the image URL, action to be performed and othe attributes of the button.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.help.webapp.AbstractButton:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.5
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2009 IBM Corporation and others.&lt;br&gt;
+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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java
new file mode 100644
index 000000000..14a05a10a
--- /dev/null
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.help.internal.webapp.data;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.help.internal.webapp.HelpWebappPlugin;
+import org.eclipse.help.webapp.AbstractButton;
+
+public class ButtonData extends RequestData {
+
+ private static final String BUTTON_EXTENSION_POINT = "org.eclipse.help.webapp.toolbarButton"; //$NON-NLS-1$
+ private List allButtons;
+
+ public ButtonData(ServletContext context, HttpServletRequest request,
+ HttpServletResponse response) {
+ super(context, request, response);
+ }
+
+ public AbstractButton[] getButtons() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry
+ .getConfigurationElementsFor(BUTTON_EXTENSION_POINT);
+ if (allButtons == null) {
+ allButtons = new ArrayList();
+ for (int i = 0; i < elements.length; i++) {
+ Object obj = null;
+ try {
+ obj = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
+ } catch (CoreException e) {
+ HelpWebappPlugin.logError("Create extension failed:[" //$NON-NLS-1$
+ + BUTTON_EXTENSION_POINT + "].", e); //$NON-NLS-1$
+ }
+ if (obj instanceof AbstractButton) {
+ allButtons.add(obj);
+ }
+ }
+ Collections.sort(allButtons);
+ }
+
+ List buttonList = new ArrayList();
+ for (Iterator iter = allButtons.iterator(); iter.hasNext();) {
+ AbstractButton button = (AbstractButton) iter.next();
+ //if (button.isVisible() && button.getLocation() == location) {
+ buttonList.add(button);
+ //}
+ }
+ AbstractButton[] buttons = (AbstractButton[]) buttonList.toArray(new AbstractButton[buttonList.size()]);
+ return buttons;
+ }
+
+ public String getImageUrl(AbstractButton button) {
+ return request.getContextPath() + button.getImageURL();
+ }
+
+}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java
index c089a15c8..b10805d86 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* 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
@@ -77,22 +77,12 @@ public class ToolbarButton {
}
/**
- * Returns the enabled gray image
+ * Returns the image
*
* @return String
*/
public String getImage() {
- int i = image.lastIndexOf('/');
- return image.substring(0, i) + "/e_" + image.substring(i + 1); //$NON-NLS-1$
- }
-
- /**
- * Returns the image when selected
- *
- * @return String
- */
- public String getOnImage() {
- return getImage();
+ return image;
}
public String getAction() {
@@ -109,5 +99,5 @@ public class ToolbarButton {
public String getStyleClass() {
return styleClass;
- }
+ }
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java
index 0d251ab7c..29c7771a0 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* 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
@@ -15,12 +15,22 @@ import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.help.internal.webapp.HelpWebappPlugin;
+import org.eclipse.help.webapp.AbstractButton;
+
/**
* Control for a toolbar.
*/
public class ToolbarData extends RequestData {
- ToolbarButton[] buttons;
+ private static final String BUTTON_EXTENSION_POINT = "org.eclipse.help.webapp.toolbarButton"; //$NON-NLS-1$
+ private ToolbarButton[] buttons;
+ private String[] scriptFiles;
+
public ToolbarData(ServletContext context, HttpServletRequest request,
HttpServletResponse response) {
@@ -57,6 +67,7 @@ public class ToolbarData extends RequestData {
|| names.length != params.length
|| names.length != states.length) {
buttons = new ToolbarButton[0];
+ scriptFiles = new String[0];
return;
}
@@ -68,9 +79,12 @@ public class ToolbarData extends RequestData {
buttonList.add(new ToolbarButton(names[i], ServletResources
.getString(tooltips[i], request), preferences
.getImagesDirectory()
- + "/" + images[i], //$NON-NLS-1$
+ + "/e_" + images[i], //$NON-NLS-1$
actions[i], params[i], states[i]));
}
+
+ addExtensionButtons(buttonList);
+
// add implicit maximize/restore button on all toolbars
if (isIE() || isMozilla()
&& "1.2.1".compareTo(getMozillaVersion()) <= 0 //$NON-NLS-1$
@@ -84,6 +98,49 @@ public class ToolbarData extends RequestData {
.toArray(new ToolbarButton[buttonList.size()]);
}
+ private void addExtensionButtons(List buttonList) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry
+ .getConfigurationElementsFor(BUTTON_EXTENSION_POINT);
+
+ List extensionButtons = new ArrayList();
+ List scripts = new ArrayList();
+ for (int i = 0; i < elements.length; i++) {
+ Object obj = null;
+ try {
+ obj = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
+ } catch (CoreException e) {
+ HelpWebappPlugin.logError("Create extension failed:[" //$NON-NLS-1$
+ + BUTTON_EXTENSION_POINT + "].", e); //$NON-NLS-1$
+ }
+ if (obj instanceof AbstractButton) {
+ AbstractButton button = (AbstractButton) obj;
+ String toolbarName = request.getParameter("view"); //$NON-NLS-1$
+ if (button.isAddedToToolbar(toolbarName)) {
+ extensionButtons.add(button);
+ }
+ }
+ }
+
+ Collections.sort(extensionButtons);
+
+ for (Iterator iter = extensionButtons.iterator(); iter.hasNext();) {
+ AbstractButton button = (AbstractButton) iter.next();
+ String scriptFile = button.getJavaScriptURL();
+ if (scriptFile != null) {
+ scripts.add(UrlUtil.getRelativePath(request, scriptFile));
+ }
+ ToolbarButton toolButton = new ToolbarButton(button.getId(),
+ button.getTooltip(UrlUtil.getLocaleObj(request, response)),
+ request.getContextPath() + button.getImageURL(),
+ button.getAction(),
+ "", //$NON-NLS-1$
+ button.getState());
+ buttonList.add(toolButton);
+ }
+ scriptFiles = (String[]) scripts.toArray(new String[scripts.size()]);
+ }
+
public ToolbarButton[] getButtons() {
return buttons;
}
@@ -116,4 +173,8 @@ public class ToolbarData extends RequestData {
public String getRestoreTooltip() {
return ServletResources.getString("restore", request); //$NON-NLS-1$
}
+
+ public String[] getScriptFiles() {
+ return scriptFiles;
+ }
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java
new file mode 100644
index 000000000..94f3682a6
--- /dev/null
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.help.webapp;
+
+import java.util.Locale;
+
+/**
+ * A class which contributes a button to the help webapp
+ * @since 3.5
+ */
+
+public abstract class AbstractButton implements Comparable {
+
+ /**
+ * Gets the id which will be assigned to the image of the button in the
+ * generated HTML
+ * @return a string that consists of alphanumeric characters only with no spaces
+ */
+ public abstract String getId();
+
+ /**
+ * @return a URL relative to /help which is the location
+ * of the 16x16 image icon which will appear in the tab
+ */
+ public abstract String getImageURL();
+
+ /**
+ * A user visible description of the button which will appear in the tooltip
+ * @param locale the locale of the client
+ * @return the tooltip text to be used in this locale
+ */
+ public abstract String getTooltip(Locale locale);
+
+ /**
+ * a JavaScript function which will be called when the button is pressed
+ * @return the name of a JavaScript function
+ */
+ public abstract String getAction();
+
+ /**
+ * The state of a button which is visible but not depressed
+ */
+ public final static String BUTTON_OUT = "off"; //$NON-NLS-1$
+
+ /**
+ * The state of a button which is visible and depressed
+ */
+ public final static String BUTTON_IN = "on"; //$NON-NLS-1$
+
+ /**
+ * The state of a button which is hidden
+ */
+ public final static String BUTTON_HIDDEN = "hidden"; //$NON-NLS-1$
+
+ /**
+ * Get the state of a button
+ * @return one of <code>BUTTON_OUT</code>, <code>BUTTON_IN</code>, or
+ * <code>BUTTON_HIDDEN</code>.
+ */
+ public String getState() {
+ return BUTTON_OUT;
+ }
+
+ /**
+ * Get the location of the a javascript file to be included in any
+ * jsp file which uses this button
+ * @return a URL path, relative to /help or <code>null</code> if there.
+ */
+ public String getJavaScriptURL() {
+ return null;
+ }
+
+ /**
+ * Toolbar name for the content pane, which shows help pages
+ */
+ public static final String CONTENT_TOOLBAR = "content"; //$NON-NLS-1$
+
+ /**
+ * Toolbar name for the table of contents
+ */
+ public static final String TOC_TOOLBAR = "toc"; //$NON-NLS-1$
+
+ /**
+ * Toolbar name for the keyword index
+ */
+ public static final String INDEX_TOOLBAR = "index"; //$NON-NLS-1$
+
+ /**
+ * Toolbar name for search results
+ */
+ public static final String SEARCH_TOOLBAR = "search"; //$NON-NLS-1$
+
+ /**
+ * Toolbar name for bookmarks
+ */
+ public static final String BOOKMARKS_TOOLBAR = "bookmarks"; //$NON-NLS-1$
+
+ /**
+ * Determines whether this button should be true if the button should be added
+ * to particular toolbar
+ * @param toolbarName
+ * @return true
+ */
+ public boolean isAddedToToolbar(String toolbarName) {
+ return true;
+ }
+
+ final public int compareTo(Object o) {
+ if (o instanceof AbstractButton) {
+ String objectName = ((AbstractButton)o).getId();
+ return (getId().compareTo(objectName));
+ }
+ return 0;
+ }
+}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java
new file mode 100644
index 000000000..feabcc0c5
--- /dev/null
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.ua.tests.help.webextension;
+
+import java.util.Locale;
+
+import org.eclipse.help.webapp.AbstractButton;
+
+public class TitleSearchButton extends AbstractButton {
+
+ public String getAction() {
+ return "toggleTitleView";
+ }
+
+ public String getId() {
+ return "tsearch";
+ }
+
+ public String getImageURL() {
+ return "/titlesearch/icons/sample3.gif";
+ }
+
+ public String getTooltip(Locale locale) {
+ if ("es".equals(locale.getLanguage())) {
+ return "Muestre busque en titulos";
+ }
+ return "Show Search Topic Title";
+ }
+
+ public String getJavaScriptURL() {
+ return "/titlesearch/script/titlesearch.js";
+ }
+
+ public boolean isAddedToToolbar(String toolbarName) {
+ return (toolbarName.equals(AbstractButton.CONTENT_TOOLBAR));
+ }
+
+}
diff --git a/org.eclipse.ua.tests/jsp/advanced/titlesearchView.jsp b/org.eclipse.ua.tests/jsp/advanced/titlesearchView.jsp
index 0cd7e168c..43fb4657e 100644
--- a/org.eclipse.ua.tests/jsp/advanced/titlesearchView.jsp
+++ b/org.eclipse.ua.tests/jsp/advanced/titlesearchView.jsp
@@ -12,6 +12,11 @@
<%@ page import="org.eclipse.ua.tests.help.webextension.*" %>
<%
TitleSearchData data = new TitleSearchData(application, request, response);
+ String searchWord = request.getParameter("searchWord");
+ if (searchWord == null) {
+ searchWord = "";
+ }
+
%>
<html>
@@ -38,15 +43,14 @@ function doSearch(query)
</tr>
<tr>
- <td width="100%"><input type="text" id="typein"></td>
+ <td width="100%"><input type="text" id="typein" value = "<%=searchWord%>"></td>
<td><input type="button" id="button" value="Go" onclick="this.blur();doSearch()"></td>
</tr>
</table>
<%
- String searchWord = request.getParameter("searchWord");
- if (searchWord != null) {
+ if (searchWord != "") {
TitleSearchData.SearchResult[] results = data.getSearchResults();
if (results.length > 0) {
for (int r = 0; r < results.length; r++) {
diff --git a/org.eclipse.ua.tests/plugin.xml b/org.eclipse.ua.tests/plugin.xml
index 1baa99486..10a8e79f7 100644
--- a/org.eclipse.ua.tests/plugin.xml
+++ b/org.eclipse.ua.tests/plugin.xml
@@ -530,6 +530,10 @@
alias="/titlesearch/icons"
base-name="/icons">
</resource>
+ <resource
+ alias="/titlesearch/script"
+ base-name="/script">
+ </resource>
<serviceSelector
filter="(other.info=org.eclipse.help)">
</serviceSelector>
@@ -540,6 +544,11 @@
class="org.eclipse.ua.tests.help.webextension.TitleSearchView">
</view>
</extension>
-
+ <extension
+ point="org.eclipse.help.webapp.toolbarButton">
+ <button
+ class="org.eclipse.ua.tests.help.webextension.TitleSearchButton">
+ </button>
+ </extension>
</plugin>
diff --git a/org.eclipse.ua.tests/script/titlesearch.js b/org.eclipse.ua.tests/script/titlesearch.js
new file mode 100644
index 000000000..e8cca7108
--- /dev/null
+++ b/org.eclipse.ua.tests/script/titlesearch.js
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+ var lastView = 'toc';
+
+function toggleTitleView(button){
+ //window.parent.parent.toggleShowAll();
+ if (button && document.getElementById(button)){
+ document.getElementById(button).blur();
+ }
+ var navFrame = parent.parent.NavFrame;
+
+ if (isOn()) {
+ setButtonState("tsearch", false);
+ navFrame.showView("toc");
+ } else {
+ setButtonState("tsearch", true);
+ navFrame.showView("titlesearch");
+ }
+}
+
+function isOn() {
+ var control = document.getElementById("tdb_tsearch");
+ if(!control) {
+ alert('No Control found' + buttonName);
+ return false;
+ }
+ return control.className == "buttonOn";
+}

Back to the top