diff options
Diffstat (limited to 'org.eclipse.help.webapp/src')
38 files changed, 678 insertions, 678 deletions
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java index 15065a4ba..9c63cb3b0 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java @@ -107,11 +107,11 @@ public class StatusProducer implements IHelpContentProducer { // check to see if a predefined error page exists // in the preferences if (href.equalsIgnoreCase(MissingContentManager.MISSING_TOPIC_HREF)){ - String errorPage = Platform.getPreferencesService().getString( - HelpBasePlugin.PLUGIN_ID, - "page_not_found", //$NON-NLS-1$ - null, - null); + String errorPage = Platform.getPreferencesService().getString( + HelpBasePlugin.PLUGIN_ID, + "page_not_found", //$NON-NLS-1$ + null, + null); if (errorPage != null && errorPage.length() > 0) { URL helpURL; @@ -302,7 +302,7 @@ public class StatusProducer implements IHelpContentProducer { } pageBuffer.append(tab(3)+ "</ul>\n"); //$NON-NLS-1$ if (isHelpView) { - pageBuffer.append(tab(3)+"<br/><p>\n"); //$NON-NLS-1$ + pageBuffer.append(tab(3)+"<br/><p>\n"); //$NON-NLS-1$ pageBuffer.append(tab(4)+ "<a href=helpview:ignoreMissingBooks>"+ //$NON-NLS-1$ WebappResources.getString("ignoreMissingBooks", locale) + "</a>\n"); //$NON-NLS-1$ //$NON-NLS-2$ pageBuffer.append(tab(3)+ "</p>\n"); //$NON-NLS-1$ @@ -310,8 +310,8 @@ public class StatusProducer implements IHelpContentProducer { pageBuffer.append(tab(3)+"<br/><p>\n"); //$NON-NLS-1$ //pageBuffer.append("<img src=\"PLUGINS_ROOT/org.eclipse.help/command_link.png\"/>"); //$NON-NLS-1$ pageBuffer.append("<a class=\"command-link\"" //$NON-NLS-1$ - + " href='javascript:executeCommand(\"org.eclipse.help.ui.ignoreMissingPlaceholders\")'>" //$NON-NLS-1$ - + WebappResources.getString("ignoreMissingBooks", locale)+"</a>"); //$NON-NLS-1$ //$NON-NLS-2$ + + " href='javascript:executeCommand(\"org.eclipse.help.ui.ignoreMissingPlaceholders\")'>" //$NON-NLS-1$ + + WebappResources.getString("ignoreMissingBooks", locale)+"</a>"); //$NON-NLS-1$ //$NON-NLS-2$ pageBuffer.append(tab(3)+ "</p>\n"); //$NON-NLS-1$ } pageBuffer.append(END_BODY_HTML); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java index 9a3a10def..f6e85b443 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java @@ -36,16 +36,16 @@ public class CookiesData extends RequestData { public boolean isSynchToc() { Cookie[] cookies = request.getCookies(); if (cookies != null) { - for (Cookie cookie : cookies) { - if ("synchToc".equals(cookie.getName())) { //$NON-NLS-1$ - return String.valueOf(true).equals(cookie.getValue()); - } - } + for (Cookie cookie : cookies) { + if ("synchToc".equals(cookie.getName())) { //$NON-NLS-1$ + return String.valueOf(true).equals(cookie.getValue()); + } + } } boolean isSynchToc = Platform.getPreferencesService().getBoolean - (HelpBasePlugin.PLUGIN_ID, "advanced.syncDefault", false, null); //$NON-NLS-1$ + (HelpBasePlugin.PLUGIN_ID, "advanced.syncDefault", false, null); //$NON-NLS-1$ CookieUtil.setCookieValue("synchToc", Boolean.toString(isSynchToc), request, response); //$NON-NLS-1$ return isSynchToc; - } + } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java index 9554f24b7..616c8dbad 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java @@ -64,7 +64,7 @@ public class EnabledTopicUtils { */ public static boolean isEnabled(IToc toc) { if (!HelpBasePlugin.getActivitySupport().isEnabled(toc.getHref()) || - UAContentFilter.isFiltered(toc, HelpEvaluationContext.getContext())) { + UAContentFilter.isFiltered(toc, HelpEvaluationContext.getContext())) { return false; } // A toc is enabled only if at least one subtopic is enabled diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java index a0b9330ac..2983782ea 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java @@ -84,10 +84,10 @@ public class IconFinder { String suffix; switch(type){ - case 0:suffix = OPEN;break; - case 1:suffix = CLOSED;break; - case 2:suffix = LEAF;break; - default: suffix = OPEN; break; + case 0:suffix = OPEN;break; + case 1:suffix = CLOSED;break; + case 2:suffix = LEAF;break; + default: suffix = OPEN; break; } String result = lookupImagePath(iconId + suffix); if (result != null) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java index a10db3e44..e66c37eae 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java @@ -221,7 +221,7 @@ public class LayoutData extends RequestData { BundleContext bundleContext = HelpWebappPlugin.getContext(); ServiceReference<?> ref = bundleContext.getServiceReference(BundleLocalization.class.getName()); BundleLocalization localization = (BundleLocalization) bundleContext.getService(ref); - return localization.getLocalization(bundle, locale).getString(resource); + return localization.getLocalization(bundle, locale).getString(resource); } catch (Exception e) { // Fall through } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java index 0bfecd227..5e5eedf6f 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java @@ -164,10 +164,10 @@ public class PrintData extends RequestData { public void generateResources(Writer out) throws IOException, ServletException { // check resource allocation if (!getConnection()) { - RequestDispatcher rd = context.getRequestDispatcher("/advanced/printError.jsp"); //$NON-NLS-1$ - request.setAttribute("msg", "noConnection"); //$NON-NLS-1$ //$NON-NLS-2$ - rd.forward(request, response); - return; + RequestDispatcher rd = context.getRequestDispatcher("/advanced/printError.jsp"); //$NON-NLS-1$ + request.setAttribute("msg", "noConnection"); //$NON-NLS-1$ //$NON-NLS-2$ + rd.forward(request, response); + return; } @@ -196,17 +196,17 @@ public class PrintData extends RequestData { } } - private static synchronized boolean getConnection() { - if (allowedConnections > 0) { - allowedConnections--; - return true; - } - return false; - } - - private static synchronized void releaseConnection() { - allowedConnections++; - } + private static synchronized boolean getConnection() { + if (allowedConnections > 0) { + allowedConnections--; + return true; + } + return false; + } + + private static synchronized void releaseConnection() { + allowedConnections++; + } /* * Calculate the amount of topics to print in one request diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java index d841f57e3..539fea155 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java @@ -144,7 +144,7 @@ public class RequestScope { } } else { IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID); - pref.put(IHelpBaseConstants.P_KEY_HELP_SCOPE, scope); + pref.put(IHelpBaseConstants.P_KEY_HELP_SCOPE, scope); try { pref.flush(); } catch (BackingStoreException e) { @@ -171,12 +171,12 @@ public class RequestScope { private static String getScopeFromPreferences() { String scope = Platform.getPreferencesService().getString - (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_HELP_SCOPE, null, null); + (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_HELP_SCOPE, null, null); return scope; } public static boolean filterBySearchScope(HttpServletRequest request) { - return true; + return true; } public static boolean getFlag(HttpServletRequest request, String flagName ) { @@ -185,26 +185,26 @@ public class RequestScope { value = getValueFromCookies(request, flagName); } else { value = Platform.getPreferencesService().getString - (HelpBasePlugin.PLUGIN_ID, flagName + "Webapp", null, null); //$NON-NLS-1$ + (HelpBasePlugin.PLUGIN_ID, flagName + "Webapp", null, null); //$NON-NLS-1$ } if (value == null) { return Platform.getPreferencesService().getBoolean - (HelpBasePlugin.PLUGIN_ID, flagName, false, null); + (HelpBasePlugin.PLUGIN_ID, flagName, false, null); } return "true".equalsIgnoreCase(value); //$NON-NLS-1$ } public static void setFlag(HttpServletRequest request, - HttpServletResponse response, - String flagName, - boolean value) + HttpServletResponse response, + String flagName, + boolean value) { if (HelpSystem.isShared()) { - CookieUtil.setCookieValueWithoutPath(flagName, Boolean.toString(value), request, response); + CookieUtil.setCookieValueWithoutPath(flagName, Boolean.toString(value), request, response); } else { IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID); - pref.putBoolean(flagName + "Webapp", value ); //$NON-NLS-1$ - try { + pref.putBoolean(flagName + "Webapp", value ); //$NON-NLS-1$ + try { pref.flush(); } catch (BackingStoreException e) { } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java index 33b7e2bad..fd8a667d3 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java @@ -27,7 +27,7 @@ public class ScopeSavingSearchData extends SearchData { @Override protected boolean canSaveScope() { - return true; + return true; } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java index a4bdbb86c..b41de42b9 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java @@ -113,7 +113,7 @@ public class SearchData extends ActivitiesData { if (isScopeRequest()) { workingSetName = request.getParameter("workingSet"); //$NON-NLS-1$ if ( canSaveScope() ) { - saveWorkingSet(workingSetName); + saveWorkingSet(workingSetName); } } @@ -122,7 +122,7 @@ public class SearchData extends ActivitiesData { } protected boolean canSaveScope() { - // Scope is only saved from scopeState.jsp + // Scope is only saved from scopeState.jsp // This prevents cookies from being saved with a /advanced path return false; } @@ -329,15 +329,15 @@ public class SearchData extends ActivitiesData { public boolean isShowDescriptions() { Cookie[] cookies = request.getCookies(); if (cookies != null) { - for (Cookie cookie : cookies) { - if ("showDescriptions".equals(cookie.getName())) { //$NON-NLS-1$ - return String.valueOf(true).equals(cookie.getValue()); - } - } + for (Cookie cookie : cookies) { + if ("showDescriptions".equals(cookie.getName())) { //$NON-NLS-1$ + return String.valueOf(true).equals(cookie.getValue()); + } + } } // get default from preferences return Platform.getPreferencesService().getBoolean - (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, true, null); + (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, true, null); } /** @@ -398,7 +398,7 @@ public class SearchData extends ActivitiesData { if (workingSetName != null && workingSetName.length() != 0) return workingSetName; - if (isSearchRequest()) { + if (isSearchRequest()) { workingSetName = request.getParameter("scope"); //$NON-NLS-1$ // if we have already set the working set, then use it. if (workingSetName == null) { @@ -617,22 +617,22 @@ public class SearchData extends ActivitiesData { } public String getNotFoundMessage() { - String scope = getScope(); - if (scope.equals(ServletResources.getString("All", request))) { //$NON-NLS-1$ - return ServletResources.getString("Nothing_found", request); //$NON-NLS-1$ + String scope = getScope(); + if (scope.equals(ServletResources.getString("All", request))) { //$NON-NLS-1$ + return ServletResources.getString("Nothing_found", request); //$NON-NLS-1$ } else { - return NLS.bind(ServletResources.getString("Nothing_found_in_scope", request), scope); //$NON-NLS-1$ + return NLS.bind(ServletResources.getString("Nothing_found_in_scope", request), scope); //$NON-NLS-1$ } } public String getScopeActiveMessage() { - String scope = getScope(); + String scope = getScope(); return NLS.bind(ServletResources.getString("activeScope", request), scope); //$NON-NLS-1$ } public String getMatchesInScopeMessage() { - String scope = getScope(); - return NLS.bind(ServletResources.getString("matchesInScope", request), "" + getResultsCount(), scope); //$NON-NLS-1$ //$NON-NLS-2$ + String scope = getScope(); + return NLS.bind(ServletResources.getString("matchesInScope", request), "" + getResultsCount(), scope); //$NON-NLS-1$ //$NON-NLS-2$ } public String getPreProcessorResults() diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java index ecda6ba0d..fd6fe284c 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java @@ -27,9 +27,9 @@ public class ServerState { * situation where the Webapp is run without being launched on the built in server * in which case we set the mode to infocenter. */ - public static void webappStarted(ServletContext context, HttpServletRequest request, + public static void webappStarted(ServletContext context, HttpServletRequest request, HttpServletResponse response) { - BaseHelpSystem.checkMode(); - } + BaseHelpSystem.checkMode(); + } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java index 6fd6b3887..7166ff0c0 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java @@ -138,8 +138,8 @@ public class ServletResources { } int amp = property.indexOf('&'); if (amp <0 || amp >= property.length() - 1) { - return null; - } + return null; + } return ("" + property.charAt(amp +1)).toLowerCase(Locale.ENGLISH); //$NON-NLS-1$ } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java index 7230c0d89..46d140341 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java @@ -233,7 +233,7 @@ public class TocData extends ActivitiesData { TopicFinder finder = new TopicFinder("/nav/" + completePath, tocs, scope); //$NON-NLS-1$ topicPath = finder.getTopicPath(); selectedToc = finder.getSelectedToc(); - numericPath = finder.getNumericPath(); + numericPath = finder.getNumericPath(); } else { // toc not specified as parameter // try obtaining the TOC from the topic @@ -258,7 +258,7 @@ public class TocData extends ActivitiesData { } } if (selectedToc != -1) { - topicPath = decodePath(path, tocs[selectedToc], scope); + topicPath = decodePath(path, tocs[selectedToc], scope); } } else { selectedToc = -1; @@ -336,49 +336,49 @@ public class TocData extends ActivitiesData { return childTopics; } private void generateTopicLinks(ITopic topic, Writer w, int indent) { - String topicHref = topic.getHref(); - try { - if (indent == 0) - w.write("<b>"); //$NON-NLS-1$ - for (int tab = 0; tab < indent; tab++) { - w.write(" "); //$NON-NLS-1$ - } - if (topicHref != null && topicHref.length() > 0) { - w.write("<a href=\""); //$NON-NLS-1$ - if ('/' == topicHref.charAt(0)) { - w.write("topic"); //$NON-NLS-1$ - } - w.write(topicHref); - w.write("\">"); //$NON-NLS-1$ - w.write(UrlUtil.htmlEncode(topic.getLabel())); - w.write("</a>"); //$NON-NLS-1$ - } else { - w.write(UrlUtil.htmlEncode(topic.getLabel())); - } - w.write("<br>\n"); //$NON-NLS-1$ - if (indent == 0) - w.write("</b>"); //$NON-NLS-1$ - } catch (IOException ioe) { - } - ITopic[] topics = topic.getSubtopics(); - for (ITopic topic2 : topics) { - generateTopicLinks(topic2, w, indent + 1); - } - } - - public void generateLinks(Writer out) { - for (IToc toc : tocs) { - ITopic tocTopic = toc.getTopic(null); - generateTopicLinks(tocTopic, out, 0); - ITopic[] topics = toc.getTopics(); - for (ITopic topic : topics) { - generateTopicLinks(topic, out, 1); - } - } - - } - - public ITopic[] getTopicPathFromRootPath(IToc toc) { + String topicHref = topic.getHref(); + try { + if (indent == 0) + w.write("<b>"); //$NON-NLS-1$ + for (int tab = 0; tab < indent; tab++) { + w.write(" "); //$NON-NLS-1$ + } + if (topicHref != null && topicHref.length() > 0) { + w.write("<a href=\""); //$NON-NLS-1$ + if ('/' == topicHref.charAt(0)) { + w.write("topic"); //$NON-NLS-1$ + } + w.write(topicHref); + w.write("\">"); //$NON-NLS-1$ + w.write(UrlUtil.htmlEncode(topic.getLabel())); + w.write("</a>"); //$NON-NLS-1$ + } else { + w.write(UrlUtil.htmlEncode(topic.getLabel())); + } + w.write("<br>\n"); //$NON-NLS-1$ + if (indent == 0) + w.write("</b>"); //$NON-NLS-1$ + } catch (IOException ioe) { + } + ITopic[] topics = topic.getSubtopics(); + for (ITopic topic2 : topics) { + generateTopicLinks(topic2, w, indent + 1); + } + } + + public void generateLinks(Writer out) { + for (IToc toc : tocs) { + ITopic tocTopic = toc.getTopic(null); + generateTopicLinks(tocTopic, out, 0); + ITopic[] topics = toc.getTopics(); + for (ITopic topic : topics) { + generateTopicLinks(topic, out, 1); + } + } + + } + + public ITopic[] getTopicPathFromRootPath(IToc toc) { ITopic[] topicPath; // Determine the topicPath from the path passed in as a parameter int[] rootPath = getRootPath(); @@ -400,23 +400,23 @@ public class TocData extends ActivitiesData { return topicPath; } - public ITopic[] getTopicPath() { - return topicPath; - } + public ITopic[] getTopicPath() { + return topicPath; + } - public int[] getRootPath() { - return rootPath; - } + public int[] getRootPath() { + return rootPath; + } - public String getTopicHref() { - return topicHref; - } + public String getTopicHref() { + return topicHref; + } - public String getNumericPath() { - return numericPath; - } + public String getNumericPath() { + return numericPath; + } - public boolean isExpandPath() { - return expandPathParam != null; - } + public boolean isExpandPath() { + return expandPathParam != null; + } } 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 abc6b9507..3e0cc15d1 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 @@ -131,7 +131,7 @@ public class ToolbarData extends RequestData { toolbarName = request.getParameter("toolbar"); //$NON-NLS-1$ } if (button.isAddedToToolbar(toolbarName)) { - extensionButtons.add(button); + extensionButtons.add(button); } } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java index 476a0e151..cc01fa593 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java @@ -62,10 +62,10 @@ public class TopicFinder { } // if there was an anchor, search again without it } while (foundTopicPath == null && index != -1); - } else { - selectedToc = -1; + } else { + selectedToc = -1; foundTopicPath = null; - } + } } public ITopic[] getTopicPathFromNav(String nav) { @@ -90,22 +90,22 @@ public class TopicFinder { } } - public ITopic[] getTopicPath() { + public ITopic[] getTopicPath() { return foundTopicPath; } - public int getSelectedToc() { - return selectedToc; - } + public int getSelectedToc() { + return selectedToc; + } - public String getNumericPath() { - return numericPath; - } + public String getNumericPath() { + return numericPath; + } /* - * Finds a path of ITopics in the given IToc to the given topic. If the - * toc doesn't contain the topic, returns null. - */ + * Finds a path of ITopics in the given IToc to the given topic. If the + * toc doesn't contain the topic, returns null. + */ private ITopic[] getTopicPathInToc(ITopic topicToFind, IToc toc) { if (topicToFind.getLabel().equals(toc.getLabel())) { return new ITopic[0]; diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java index 727b94c39..b24570c43 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java @@ -205,9 +205,9 @@ public class UrlUtil { } if (new WebappPreferences().isRestrictTopicParameter()) { - if (path.contains(":/")) { //$NON-NLS-1$ - return false; - } + if (path.contains(":/")) { //$NON-NLS-1$ + return false; + } } return true; } @@ -261,14 +261,14 @@ public class UrlUtil { } public static boolean isBot(HttpServletRequest request) { - String agent = request.getHeader("User-Agent"); //$NON-NLS-1$ - if (agent==null) - return false; - agent=agent.toLowerCase(Locale.ENGLISH); + String agent = request.getHeader("User-Agent"); //$NON-NLS-1$ + if (agent==null) + return false; + agent=agent.toLowerCase(Locale.ENGLISH); // sample substring Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) return agent.contains("bot") || agent.contains("crawl")//$NON-NLS-1$ //$NON-NLS-2$ - || request.getParameter("bot") != null;//$NON-NLS-1$ - } + || request.getParameter("bot") != null;//$NON-NLS-1$ + } public static boolean isGecko(HttpServletRequest request) { String agent = request.getHeader("User-Agent"); //$NON-NLS-1$ @@ -277,7 +277,7 @@ public class UrlUtil { public static boolean isGecko(String agent) { if (agent==null) - return false; + return false; agent=agent.toLowerCase(Locale.ENGLISH); // sample substring Gecko/20020508 if (agent.contains("like gecko")) { //$NON-NLS-1$ @@ -293,7 +293,7 @@ public class UrlUtil { public static boolean isIE(String agent) { if (agent==null) - return false; + return false; agent=agent.toLowerCase(Locale.ENGLISH); // When accessing with Bobby identified Bobby return 5.5 to allow @@ -313,7 +313,7 @@ public class UrlUtil { public static String getIEVersion(String agent) { if (agent==null) - return "0"; //$NON-NLS-1$ + return "0"; //$NON-NLS-1$ agent=agent.toLowerCase(Locale.ENGLISH); // When accessing with Bobby identified Bobby return 5.5 to allow @@ -339,7 +339,7 @@ public class UrlUtil { public static boolean isKonqueror(String agent) { if (agent==null) - return false; + return false; agent=agent.toLowerCase(Locale.ENGLISH); return agent.contains("konqueror"); //$NON-NLS-1$ } @@ -357,7 +357,7 @@ public class UrlUtil { public static boolean isMozilla(String agent) { if (agent==null) - return false; + return false; agent=agent.toLowerCase(Locale.ENGLISH); return agent.contains("mozilla/5"); //$NON-NLS-1$ } @@ -369,7 +369,7 @@ public class UrlUtil { public static String getMozillaVersion(String agent) { if (agent==null) - return "0"; //$NON-NLS-1$ + return "0"; //$NON-NLS-1$ agent=agent.toLowerCase(Locale.ENGLISH); if (!agent.contains("mozilla/5")) //$NON-NLS-1$ return "0"; //$NON-NLS-1$ @@ -389,14 +389,14 @@ public class UrlUtil { public static boolean isOpera(String agent) { if (agent==null) - return false; + return false; agent=agent.toLowerCase(Locale.ENGLISH); return agent.contains("opera"); //$NON-NLS-1$ } public static String getOperaVersion(String agent) { if (agent==null) - return "0"; //$NON-NLS-1$ + return "0"; //$NON-NLS-1$ agent=agent.toLowerCase(Locale.ENGLISH); final String OperaPrefix = "opera/"; //$NON-NLS-1$ int start = agent.indexOf(OperaPrefix) + OperaPrefix.length(); @@ -415,7 +415,7 @@ public class UrlUtil { public static boolean isSafari(String agent) { if (agent==null) - return false; + return false; agent=agent.toLowerCase(Locale.ENGLISH); return agent.contains("safari/"); //$NON-NLS-1$ } @@ -428,7 +428,7 @@ public class UrlUtil { public static String getSafariVersion(String agent) { String version = "0"; //$NON-NLS-1$ if (agent==null) - return version; + return version; agent=agent.toLowerCase(Locale.ENGLISH); Matcher m = safariPattern.matcher(agent); boolean matched = m.find(); @@ -580,12 +580,12 @@ public class UrlUtil { // check if locale was passed earlier in this session Cookie[] cookies = request.getCookies(); if (cookies != null) { - for (Cookie cookie : cookies) { - if ("lang".equals(cookie.getName())) { //$NON-NLS-1$ - forcedLocale = cookie.getValue(); - break; - } - } + for (Cookie cookie : cookies) { + if ("lang".equals(cookie.getName())) { //$NON-NLS-1$ + forcedLocale = cookie.getValue(); + break; + } + } } } @@ -651,7 +651,7 @@ public class UrlUtil { // if no locales from command line, get them from preferences if (infocenterLocales.isEmpty()) { String preferredLocales = Platform.getPreferencesService().getString - (HelpBasePlugin.PLUGIN_ID, ("locales"), "", null); //$NON-NLS-1$ //$NON-NLS-2$ + (HelpBasePlugin.PLUGIN_ID, ("locales"), "", null); //$NON-NLS-1$ //$NON-NLS-2$ StringTokenizer tokenizer = new StringTokenizer(preferredLocales, " ,\t"); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java index 014540b55..4966ec1a8 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java @@ -19,7 +19,7 @@ import org.eclipse.help.internal.webapp.WebappResources; import org.eclipse.help.webapp.AbstractView ; public class View extends AbstractView { - public static char NO_SHORTCUT = (char)0; + public static char NO_SHORTCUT = (char)0; private String name; private String url; private String imageURL; diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java index 5aa3c3d81..8b5e6731a 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java @@ -195,7 +195,7 @@ public class WorkingSetData extends RequestData { return name; } } - return ""; //$NON-NLS-1$ + return ""; //$NON-NLS-1$ } public boolean isCriteriaScopeEnabled(){ diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java index 2e72397fc..3bb7be752 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java @@ -187,17 +187,17 @@ public class AboutService extends AboutServlet { Bundle[] bundles = HelpWebappPlugin.getContext().getBundles(); for (Bundle bundle : bundles) { - plugins.add(pluginDetails(bundle)); - } + plugins.add(pluginDetails(bundle)); + } - Comparator<PluginDetails> pluginComparator = new PluginComparator(sortColumn); + Comparator<PluginDetails> pluginComparator = new PluginComparator(sortColumn); Collections.sort(plugins, pluginComparator ); String[] headerColumns = new String[]{ - "provider", //$NON-NLS-1$ - "pluginName", //$NON-NLS-1$ - "version", //$NON-NLS-1$ - "pluginId" //$NON-NLS-1$ + "provider", //$NON-NLS-1$ + "pluginName", //$NON-NLS-1$ + "version", //$NON-NLS-1$ + "pluginId" //$NON-NLS-1$ }; for (String headerColumn : headerColumns) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java index 5e264fc32..2c167c56b 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java @@ -127,7 +127,7 @@ public class AdvancedSearchService extends HttpServlet { } } - // Call after the catch. + // Call after the catch. // An empty JSON is created if any Exception is thrown // Else returns the complete JSON return searchParser.toJSON(); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java index e6690b960..532e8c654 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java @@ -73,7 +73,7 @@ public class BreadcrumbsFilter implements IFilter { if (pathParam != null && pathParam.length() > 0) { breadcrumbPath = "/nav/" + pathParam; //$NON-NLS-1$ } else { - breadcrumbPath= servletPath + pathInfo; + breadcrumbPath= servletPath + pathInfo; } int[] path = UrlUtil.getTopicPath(breadcrumbPath, locale ); if (path != null && path.length > 1) { @@ -83,7 +83,7 @@ public class BreadcrumbsFilter implements IFilter { String bodyContent = getBodyContent(path, backpath, isNarrow, locale); String headContent = HEAD_CONTENT1 + backpath + HEAD_CONTENT2 + backpath + - HEAD_CONTENT3; + HEAD_CONTENT3; return new FilterHTMLHeadAndBodyOutputStream(out, headContent .getBytes(StandardCharsets.US_ASCII), bodyContent); } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java index eb73ee878..c3231ac00 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java @@ -47,11 +47,11 @@ public class ChildLinkInserter { public void addContents(String encoding) throws IOException { String path = req.getParameter(TocData.COMPLETE_PATH_PARAM); - ITopic[] subtopics = getSubtopics(); - if (subtopics.length == 0) { - return; - } - StringBuilder links = new StringBuilder("\n<ul class=\"childlinks\">\n"); //$NON-NLS-1$ + ITopic[] subtopics = getSubtopics(); + if (subtopics.length == 0) { + return; + } + StringBuilder links = new StringBuilder("\n<ul class=\"childlinks\">\n"); //$NON-NLS-1$ for (int i=0;i<subtopics.length;++i) { if (ScopeUtils.showInTree(subtopics[i], scope)) { links.append("\n<li><a href=\""); //$NON-NLS-1$ @@ -66,7 +66,7 @@ public class ChildLinkInserter { else { href = XMLGenerator.xmlEscape(href); if (path != null && path.length() > 0) { - href = TocFragmentServlet.fixupHref(href, path + '_' + i); + href = TocFragmentServlet.fixupHref(href, path + '_' + i); } } links.append(getBackpath(req.getPathInfo())); @@ -78,9 +78,9 @@ public class ChildLinkInserter { String linkString = links.toString(); try { if (encoding != null) { - out.write(linkString.getBytes(encoding)); + out.write(linkString.getBytes(encoding)); } else { - out.write(linkString.getBytes(StandardCharsets.UTF_8)); + out.write(linkString.getBytes(StandardCharsets.UTF_8)); } } catch (UnsupportedEncodingException e) { out.write(linkString.getBytes()); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java index d04ec18fe..f208dcf2a 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java @@ -103,8 +103,8 @@ public class CookieUtil { Cookie cookie = new Cookie(name, ""); //$NON-NLS-1$ String requestURI = request.getRequestURI(); if (!(requestURI.startsWith(cookiePath) && requestURI.indexOf('/', cookiePath.length() + 1) == -1)) { - cookie.setPath(cookiePath); - } + cookie.setPath(cookiePath); + } cookie.setMaxAge(0); response.addCookie(cookie); } @@ -115,11 +115,11 @@ public class CookieUtil { HashSet<String> cookiesToDelete = new HashSet<>(); if (cookies != null) { for (Cookie cookie : cookies) { - String name = cookie.getName(); - if (isObsoleteCookie(name) || cookiesToKeep.contains(name)) { - cookiesToDelete.add(name); - } - cookiesToKeep.add(name); + String name = cookie.getName(); + if (isObsoleteCookie(name) || cookiesToKeep.contains(name)) { + cookiesToDelete.add(name); + } + cookiesToKeep.add(name); } for (String name : cookiesToDelete) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java index e7aaf9bb1..dc44545ce 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java @@ -67,9 +67,9 @@ public class EclipseConnector { private ServletContext context; private static INotFoundCallout notFoundCallout = null; // For JUnit Testing - public EclipseConnector(ServletContext context) { + public EclipseConnector(ServletContext context) { this.context= context; - } + } public void transfer(HttpServletRequest req, HttpServletResponse resp) @@ -86,7 +86,7 @@ public class EclipseConnector { try { - //System.out.println("Transfer " + url); //$NON-NLS-1$ + //System.out.println("Transfer " + url); //$NON-NLS-1$ // Redirect if the request includes PLUGINS_ROOT and is not a content request int index = url.lastIndexOf(HelpURLConnection.PLUGINS_ROOT); if (index!= -1 && !url.contains("content/" + HelpURLConnection.PLUGINS_ROOT)) { //$NON-NLS-1$ @@ -125,39 +125,39 @@ public class EclipseConnector { try { is = con.getInputStream(); } catch (IOException ioe) { - pageNotFound = true; - if (notFoundCallout != null) { - notFoundCallout.notFound(url); - } - - boolean isRTopicPath = isRTopicPath(req.getServletPath()); - - if (requiresErrorPage(lowerCaseuRL) && !isRTopicPath) { - - String errorPage = null; - if (RemoteStatusData.isAnyRemoteHelpUnavailable()) { - errorPage = '/'+HelpWebappPlugin.PLUGIN_ID+'/'+ MissingContentManager.MISSING_TOPIC_HREF; - } else { - errorPage = MissingContentManager.getInstance().getPageNotFoundPage(url, false); - } - if (errorPage != null && errorPage.length() > 0) { + pageNotFound = true; + if (notFoundCallout != null) { + notFoundCallout.notFound(url); + } + + boolean isRTopicPath = isRTopicPath(req.getServletPath()); + + if (requiresErrorPage(lowerCaseuRL) && !isRTopicPath) { + + String errorPage = null; + if (RemoteStatusData.isAnyRemoteHelpUnavailable()) { + errorPage = '/'+HelpWebappPlugin.PLUGIN_ID+'/'+ MissingContentManager.MISSING_TOPIC_HREF; + } else { + errorPage = MissingContentManager.getInstance().getPageNotFoundPage(url, false); + } + if (errorPage != null && errorPage.length() > 0) { con = createConnection(req, resp, "help:" + errorPage); //$NON-NLS-1$ resp.setContentType("text/html"); //$NON-NLS-1$ try { - is = con.getInputStream(); + is = con.getInputStream(); } catch (IOException ioe2) { // Cannot open error page - resp.setStatus(HttpServletResponse.SC_NOT_FOUND); + resp.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } } else { // Error page not defined - resp.setStatus(HttpServletResponse.SC_NOT_FOUND); + resp.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } } else { // Non HTML file - resp.setStatus(HttpServletResponse.SC_NOT_FOUND); + resp.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } } @@ -202,7 +202,7 @@ public class EclipseConnector { transferContent(is, out); try { - out.close(); + out.close(); } catch (IOException ioe) { // Bug 314324 - do not report an error } @@ -229,7 +229,7 @@ public class EclipseConnector { } if (!contentType.startsWith("text")) { //$NON-NLS-1$ return false; - } + } if (contentType.equals("text/css")) { //$NON-NLS-1$ return false; } @@ -273,12 +273,12 @@ public class EclipseConnector { private boolean useMimeType(HttpServletRequest req, String mimeType) { if ( mimeType == null ) { - return false; - } - if (mimeType.equals("application/xhtml+xml") && !UrlUtil.isMozilla(req)) { //$NON-NLS-1$ - return false; - } - return true; + return false; + } + if (mimeType.equals("application/xhtml+xml") && !UrlUtil.isMozilla(req)) { //$NON-NLS-1$ + return false; + } + return true; } /** diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java index ce150b5c3..d27623afe 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java @@ -36,7 +36,7 @@ public class ExtraFilters implements IFilter { public ExtraFilters() { if (filters == null) { - readFilters(); + readFilters(); } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java index 8a765ab39..a183499e8 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java @@ -199,8 +199,8 @@ public class FilterHTMLHeadAndBodyOutputStream extends FilterOutputStream { String bodyRecoded = new String(bodyBytes, encoding); if (bodyRecoded.equals(bodyContent)) { out.write('\n'); - out.write(bodyBytes); - out.write('\n'); + out.write(bodyBytes); + out.write('\n'); } else { // Some characters could not be encoded // Write one character at a time using an entity if necessary @@ -213,11 +213,11 @@ public class FilterHTMLHeadAndBodyOutputStream extends FilterOutputStream { out.write(codedChar); } else { int value = bodyContent.charAt(i); - String code = "&#" + value + ';'; //$NON-NLS-1$ - out.write(code.getBytes()); + String code = "&#" + value + ';'; //$NON-NLS-1$ + out.write(code.getBytes()); } } - out.write('\n'); + out.write('\n'); } } areaState = STATE_DONE; diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java index 66672330b..4024abfea 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java @@ -29,8 +29,8 @@ import org.eclipse.help.webapp.IFilter; */ public class FramesetFilter implements IFilter { private static final String scriptPart1 = "<script type=\"text/javascript\">\nif( self == top ){" //$NON-NLS-1$ - + "\n var anchorParam = location.hash.length > 0 ? '" //$NON-NLS-1$ - + UrlUtil.JavaScriptEncode("&") + "anchor=' + location.hash.substr(1) : '';" //$NON-NLS-1$ //$NON-NLS-2$ + + "\n var anchorParam = location.hash.length > 0 ? '" //$NON-NLS-1$ + + UrlUtil.JavaScriptEncode("&") + "anchor=' + location.hash.substr(1) : '';" //$NON-NLS-1$ //$NON-NLS-2$ + "\n window.location.replace( \""; //$NON-NLS-1$ private static final String scriptPart3 = "\" + anchorParam);\n}\n</script>"; //$NON-NLS-1$ diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java index 6b974628d..4655447f2 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java @@ -89,7 +89,7 @@ public class IndexFragmentServlet extends HttpServlet { sizeParameter = req.getParameter(SIZE); if (sizeParameter != null) { try { - size = Integer.parseInt(sizeParameter); + size = Integer.parseInt(sizeParameter); } catch (NumberFormatException n) { } } @@ -98,7 +98,7 @@ public class IndexFragmentServlet extends HttpServlet { entryParameter = req.getParameter(ENTRY); if (entryParameter != null) { try { - entry = Integer.parseInt(entryParameter); + entry = Integer.parseInt(entryParameter); } catch (NumberFormatException n) { } } @@ -226,10 +226,10 @@ public class IndexFragmentServlet extends HttpServlet { } int nextEntry = 0; while (nextEntry < entries.length) { - String keyword = entries[nextEntry].getKeyword().toLowerCase(); + String keyword = entries[nextEntry].getKeyword().toLowerCase(); if (keyword != null) { if (compare(startParameter, keyword) <= 0) { - break; + break; } } nextEntry++; @@ -241,9 +241,9 @@ public class IndexFragmentServlet extends HttpServlet { while (nextEntry < entries.length) { int entrySize = enabledEntryCount(entries[nextEntry]); if (remaining == size || remaining > entrySize) { - entryList.add(Integer.valueOf(nextEntry)); - setFlags(nextEntry); - remaining -= entrySize; + entryList.add(Integer.valueOf(nextEntry)); + setFlags(nextEntry); + remaining -= entrySize; } else { break; } @@ -257,10 +257,10 @@ public class IndexFragmentServlet extends HttpServlet { while (nextEntry >= 0) { int entrySize = enabledEntryCount(entries[nextEntry]); if (remaining == size || remaining > entrySize) { - entryList.add(0, Integer.valueOf(nextEntry)); + entryList.add(0, Integer.valueOf(nextEntry)); - setFlags(nextEntry); - remaining -= entrySize; + setFlags(nextEntry); + remaining -= entrySize; } else { break; } @@ -284,10 +284,10 @@ public class IndexFragmentServlet extends HttpServlet { return 0; } int count = 1; - int topicCount = enabledTopicCount(entry); + int topicCount = enabledTopicCount(entry); IIndexEntry[] subentries = entry.getSubentries(); - int subentryCount = 0; + int subentryCount = 0; for (IIndexEntry subentrie : subentries) { count += enabledEntryCount(subentrie); } @@ -305,17 +305,17 @@ public class IndexFragmentServlet extends HttpServlet { } count += subentryCount; count += seeCount; - return count; + return count; } private int enabledTopicCount(IIndexEntry entry) { int topicCount = 0; - ITopic[] topics = entry.getTopics(); - for (ITopic topic : topics) { - if (scope.inScope(topic)) { - topicCount++; - } - } + ITopic[] topics = entry.getTopics(); + for (ITopic topic : topics) { + if (scope.inScope(topic)) { + topicCount++; + } + } return topicCount; } @@ -353,8 +353,8 @@ public class IndexFragmentServlet extends HttpServlet { String href; if (singleTopic) { href = UrlUtil.getHelpURL((topics[0]).getHref()); - buf.append('\n' + " href=\"" + //$NON-NLS-1$ - XMLGenerator.xmlEscape(href) + "\""); //$NON-NLS-1$ + buf.append('\n' + " href=\"" + //$NON-NLS-1$ + XMLGenerator.xmlEscape(href) + "\""); //$NON-NLS-1$ } buf.append(">\n"); //$NON-NLS-1$ @@ -403,8 +403,8 @@ public class IndexFragmentServlet extends HttpServlet { } private void generateSees(IIndexSee[] sees) { - for (IIndexSee see : sees) { - if (ScopeUtils.showInTree(see, scope)) { + for (IIndexSee see : sees) { + if (ScopeUtils.showInTree(see, scope)) { // String key = see.isSeeAlso() ? "SeeAlso" : "See"; //$NON-NLS-1$ //$NON-NLS-2$ String seePrefix = WebappResources.getString(key, UrlUtil @@ -428,8 +428,8 @@ public class IndexFragmentServlet extends HttpServlet { + XMLGenerator.xmlEscape(href) + "\""); //$NON-NLS-1$ buf.append(">\n"); //$NON-NLS-1$ buf.append("</node>\n"); //$NON-NLS-1$ - } - } + } + } } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java index 857148aaf..d220d6d8a 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java @@ -180,7 +180,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager { if (suffixStart > 0) { previousToc = decodedName.substring(0, suffixStart); } else if (suffixStart == 0) { - decodedName = previousToc + decodedName; + decodedName = previousToc + decodedName; } elements[e] = getAdaptableTopic(decodedName); } @@ -211,14 +211,14 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager { continue; } String name = URLCoder.decode(nameAndCriteria[0]); - List<CriterionResource> criteriaResource = new ArrayList<>(); + List<CriterionResource> criteriaResource = new ArrayList<>(); for (int j = 1; j < nameAndCriteria.length; ++j) { String criterion = nameAndCriteria[j]; String[] keyAndValue = criterion.split("#", -1); //$NON-NLS-1$ if(keyAndValue.length != 2) continue; String key = URLCoder.decode(keyAndValue[0]); - String value = URLCoder.decode(keyAndValue[1]); + String value = URLCoder.decode(keyAndValue[1]); String[] criterionValues = value.split(",", -1); //$NON-NLS-1$ if(criterionValues.length < 1) continue; diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java index 2bff3b92d..e9f4e53fd 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java @@ -80,8 +80,8 @@ public class InjectionFilter implements IFilter { } boolean enabled = isUnfiltered || isNav - || HelpBasePlugin.getActivitySupport().isRoleEnabled(pathInfo) - || isRemote; + || HelpBasePlugin.getActivitySupport().isRoleEnabled(pathInfo) + || isRemote; if ("/ntopic".equals(req.getServletPath())) { //$NON-NLS-1$ addNarrow = true; CssUtil.addCssFiles(NARROW_CSS, cssIncludes); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java index b2a913226..ba611fa1b 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java @@ -84,25 +84,25 @@ public class NavServlet extends HttpServlet { private void showPageNotFoundPage(HttpServletRequest req, HttpServletResponse resp) { String errorPage = MissingContentManager.getInstance().getPageNotFoundPage(req.getServletPath(), false); - if (errorPage != null && errorPage.length() > 0) { - String href = req.getRequestURL().toString(); - int navIndex = href.indexOf("/nav"); //$NON-NLS-1$ - if (navIndex >= 0 ) { - href = href.substring(0, navIndex); - href += "/nftopic"; //$NON-NLS-1$ - if (errorPage.charAt(0) != '/') { - href += '/'; - } - href += errorPage; - try { + if (errorPage != null && errorPage.length() > 0) { + String href = req.getRequestURL().toString(); + int navIndex = href.indexOf("/nav"); //$NON-NLS-1$ + if (navIndex >= 0 ) { + href = href.substring(0, navIndex); + href += "/nftopic"; //$NON-NLS-1$ + if (errorPage.charAt(0) != '/') { + href += '/'; + } + href += errorPage; + try { resp.sendRedirect(href); return; } catch (IOException e) { // Fall through } - } - } - resp.setStatus(HttpServletResponse.SC_NOT_FOUND); + } + } + resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } protected Locale getLocale (HttpServletRequest req, HttpServletResponse resp) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java index 12cebd93c..299d4cadd 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java @@ -27,11 +27,11 @@ import org.eclipse.help.webapp.IFilter; */ public class PluginsRootFilter implements IFilter { - @Override + @Override public OutputStream filter(HttpServletRequest req, OutputStream out) { String pathPrefix = FilterUtils.getRelativePathPrefix(req); if (pathPrefix.length() >= 3) { - return new PluginsRootResolvingStream(out, req, pathPrefix.substring(0, pathPrefix.length() - 3)); + return new PluginsRootResolvingStream(out, req, pathPrefix.substring(0, pathPrefix.length() - 3)); } return out; } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java index b977ed1d7..4385c83d7 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java @@ -48,7 +48,7 @@ public class PluginsRootResolvingStream extends OutputStream { private String pathPrefix; private StringBuilder tag; private ByteArrayOutputStream metaTagBuffer; - private boolean tagRead; + private boolean tagRead; private HttpServletRequest req; private String charset; @@ -61,17 +61,17 @@ public class PluginsRootResolvingStream extends OutputStream { @Override public void write(int b) throws IOException { switch(state) { - case INITIAL_STATE: - if (b == '<') { - state = IN_TAG; - charsMatched = 0; - tag = new StringBuilder(); - tagRead = false; - } else { - out.write(b); - } - break; - case IN_TAG: + case INITIAL_STATE: + if (b == '<') { + state = IN_TAG; + charsMatched = 0; + tag = new StringBuilder(); + tagRead = false; + } else { + out.write(b); + } + break; + case IN_TAG: if (charsMatched == 0) { if (b == '!') { state = MAY_BE_INCLUDE; @@ -86,96 +86,96 @@ public class PluginsRootResolvingStream extends OutputStream { out.write('<'); } } - if (b == '>') { - state = INITIAL_STATE; - } else if (b == '"') { - state = IN_QUOTE; - charsMatched = 0; - } else { - charsMatched++; - if (!tagRead) { - if (b >= 0 && b < 128 && tag.length() < 20) { - // ASCII - char c = (char)b; - if (Character.isLetter(c)) { - tag.append(c); - } else if (Character.isWhitespace(c)) { - tagRead = true; - if (tag.toString().equalsIgnoreCase("meta")) { //$NON-NLS-1$ - state = IN_METATAG; - metaTagBuffer = new ByteArrayOutputStream(7); - metaTagBuffer.write("<meta ".getBytes()); //$NON-NLS-1$ - } - } else { - tag.append(c); - } - } - } - } - out.write(b); - break; - case IN_QUOTE_NOT_PLUGINS_ROOT: - if (b == '>') { - state = INITIAL_STATE; - } else if (b == '"') { - state = IN_TAG; - charsMatched = 1; - } - out.write(b); - break; - case IN_QUOTE: - // In a quote which may start with PLUGINS_ROOT - if (b == PLUGINS_ROOT.charAt(charsMatched)) { - charsMatched++; - if (charsMatched == PLUGINS_ROOT.length()) { - out.write(pathPrefix.getBytes()); - state = IN_QUOTE_NOT_PLUGINS_ROOT; - } - } else { - // We just discovered that this is not "PLUGINS_ROOT/ - // flush out the characters - state = IN_QUOTE_NOT_PLUGINS_ROOT; - flushPluginsRootCharacters(); - out.write(b); - } - break; - case MAY_BE_INCLUDE: - // Compare against all possible keywords - boolean canStillMatch = false; - int perfectMatch = -1; - for (int i = 0; i < keywords.length; i++) { - if (possibleKeywordMatches[i]) { - if (keywords[i].charAt(charsMatched) == b) { - canStillMatch = true; - lastKeywordMatch = i; - if (keywords[i].length() == charsMatched + 1) { - perfectMatch = i; - } - } else { - possibleKeywordMatches[i] = false; - } - } - } - if (perfectMatch != -1) { - insertBasedOnKeyword(perfectMatch); - state=INITIAL_STATE; - } else if (canStillMatch) { - charsMatched++; - } else { - state = INITIAL_STATE; - flushKeywordCharacters(); - out.write(b); - } - break; - case IN_METATAG: - out.write(b); - metaTagBuffer.write(b); + if (b == '>') { + state = INITIAL_STATE; + } else if (b == '"') { + state = IN_QUOTE; + charsMatched = 0; + } else { + charsMatched++; + if (!tagRead) { + if (b >= 0 && b < 128 && tag.length() < 20) { + // ASCII + char c = (char)b; + if (Character.isLetter(c)) { + tag.append(c); + } else if (Character.isWhitespace(c)) { + tagRead = true; + if (tag.toString().equalsIgnoreCase("meta")) { //$NON-NLS-1$ + state = IN_METATAG; + metaTagBuffer = new ByteArrayOutputStream(7); + metaTagBuffer.write("<meta ".getBytes()); //$NON-NLS-1$ + } + } else { + tag.append(c); + } + } + } + } + out.write(b); + break; + case IN_QUOTE_NOT_PLUGINS_ROOT: + if (b == '>') { + state = INITIAL_STATE; + } else if (b == '"') { + state = IN_TAG; + charsMatched = 1; + } + out.write(b); + break; + case IN_QUOTE: + // In a quote which may start with PLUGINS_ROOT + if (b == PLUGINS_ROOT.charAt(charsMatched)) { + charsMatched++; + if (charsMatched == PLUGINS_ROOT.length()) { + out.write(pathPrefix.getBytes()); + state = IN_QUOTE_NOT_PLUGINS_ROOT; + } + } else { + // We just discovered that this is not "PLUGINS_ROOT/ + // flush out the characters + state = IN_QUOTE_NOT_PLUGINS_ROOT; + flushPluginsRootCharacters(); + out.write(b); + } + break; + case MAY_BE_INCLUDE: + // Compare against all possible keywords + boolean canStillMatch = false; + int perfectMatch = -1; + for (int i = 0; i < keywords.length; i++) { + if (possibleKeywordMatches[i]) { + if (keywords[i].charAt(charsMatched) == b) { + canStillMatch = true; + lastKeywordMatch = i; + if (keywords[i].length() == charsMatched + 1) { + perfectMatch = i; + } + } else { + possibleKeywordMatches[i] = false; + } + } + } + if (perfectMatch != -1) { + insertBasedOnKeyword(perfectMatch); + state=INITIAL_STATE; + } else if (canStillMatch) { + charsMatched++; + } else { + state = INITIAL_STATE; + flushKeywordCharacters(); + out.write(b); + } + break; + case IN_METATAG: + out.write(b); + metaTagBuffer.write(b); if (b=='>') { parseMetaTag(metaTagBuffer); metaTagBuffer = null; state = INITIAL_STATE; } - break; + break; default: out.write(b); } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java index 584902b5a..c41ddbd25 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java @@ -53,49 +53,49 @@ public class PreferenceWriter { private void writePreference(String plugin) { try { - IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(plugin); + IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(plugin); Set<String> keySet = new HashSet<>(); - prefs = DefaultScope.INSTANCE.getNode(plugin); + prefs = DefaultScope.INSTANCE.getNode(plugin); keySet.addAll(Arrays.asList(prefs.keys())); String[] allKeys = keySet.toArray(new String[keySet.size()]); if (allKeys.length > 0) { - Arrays.sort(allKeys); + Arrays.sort(allKeys); - if (!isXML) { - buf.append("\n<h3>"); //$NON-NLS-1$ - buf.append(plugin); - buf.append("</h3>\n"); //$NON-NLS-1$ - buf.append("<table>"); //$NON-NLS-1$ - } else { + if (!isXML) { + buf.append("\n<h3>"); //$NON-NLS-1$ + buf.append(plugin); + buf.append("</h3>\n"); //$NON-NLS-1$ + buf.append("<table>"); //$NON-NLS-1$ + } else { buf.append("\n <plugin\n title=\""); //$NON-NLS-1$ buf.append(XMLGenerator.xmlEscape(plugin)); buf.append("\">"); //$NON-NLS-1$ - } - for (String key : allKeys) { - String value = Platform.getPreferencesService().getString - (plugin, key, "", null); //$NON-NLS-1$ - if (!isXML) { - buf.append("\n <tr>\n"); //$NON-NLS-1$ - buf.append(" <td>"); //$NON-NLS-1$ - buf.append(UrlUtil.htmlEncode(key)); - buf.append("</td>\n <td>"); //$NON-NLS-1$ + } + for (String key : allKeys) { + String value = Platform.getPreferencesService().getString + (plugin, key, "", null); //$NON-NLS-1$ + if (!isXML) { + buf.append("\n <tr>\n"); //$NON-NLS-1$ + buf.append(" <td>"); //$NON-NLS-1$ + buf.append(UrlUtil.htmlEncode(key)); + buf.append("</td>\n <td>"); //$NON-NLS-1$ buf.append(UrlUtil.htmlEncode(value)); buf.append("</td>\n </tr>"); //$NON-NLS-1$ - } else { - buf.append("\n <"); //$NON-NLS-1$ - buf.append(key); - buf.append(">"); //$NON-NLS-1$ + } else { + buf.append("\n <"); //$NON-NLS-1$ + buf.append(key); + buf.append(">"); //$NON-NLS-1$ buf.append(value); - buf.append("</"); //$NON-NLS-1$ - buf.append(key); - buf.append(">"); //$NON-NLS-1$ - } - } - if (!isXML) { - buf.append("\n</table>"); //$NON-NLS-1$ - } else { - buf.append("\n </plugin>"); //$NON-NLS-1$ - } + buf.append("</"); //$NON-NLS-1$ + buf.append(key); + buf.append(">"); //$NON-NLS-1$ + } + } + if (!isXML) { + buf.append("\n</table>"); //$NON-NLS-1$ + } else { + buf.append("\n </plugin>"); //$NON-NLS-1$ + } } } catch (BackingStoreException e) { buf.append(WebappResources.getString("badPreferences", locale)); //$NON-NLS-1$ diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java index 92d842d8f..291163cd5 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java @@ -25,66 +25,66 @@ public class ServletPrintWriter extends PrintWriter{ buffer = new StringBuilder(); } - /** - * Writes a single character. - * @param c int specifying a character to be written. - */ - @Override + /** + * Writes a single character. + * @param c int specifying a character to be written. + */ + @Override public void write(int c) { - synchronized (lock) { - buffer.append((char)(c)); - } - } + synchronized (lock) { + buffer.append((char)(c)); + } + } - /** - * Writes A Portion of an array of characters. - * @param buf Array of characters - * @param off Offset from which to start writing characters - * @param len Number of characters to write - */ - @Override + /** + * Writes A Portion of an array of characters. + * @param buf Array of characters + * @param off Offset from which to start writing characters + * @param len Number of characters to write + */ + @Override public void write(char buf[], int off, int len) { - synchronized (lock) { - buffer.append(buf, off, len); - } - } + synchronized (lock) { + buffer.append(buf, off, len); + } + } - /** - * Writes an array of characters. This method cannot be inherited from the - * Writer class because it must suppress I/O exceptions. - * @param buf Array of characters to be written - */ - @Override + /** + * Writes an array of characters. This method cannot be inherited from the + * Writer class because it must suppress I/O exceptions. + * @param buf Array of characters to be written + */ + @Override public void write(char buf[]) { - write(buf, 0, buf.length); - } + write(buf, 0, buf.length); + } - /** - * Writes a portion of a string. - * @param s A String - * @param off Offset from which to start writing characters - * @param len Number of characters to write - */ - @Override + /** + * Writes a portion of a string. + * @param s A String + * @param off Offset from which to start writing characters + * @param len Number of characters to write + */ + @Override public void write(String s, int off, int len) { - synchronized (lock) { - buffer.append(s.toCharArray(), off, off+len); - } - } + synchronized (lock) { + buffer.append(s.toCharArray(), off, off+len); + } + } - /** - * Writes a string. This method cannot be inherited from the Writer class - * because it must suppress I/O exceptions. - * @param s String to be written - */ - @Override + /** + * Writes a string. This method cannot be inherited from the Writer class + * because it must suppress I/O exceptions. + * @param s String to be written + */ + @Override public void write(String s) { write(s, 0, s.length()); - } + } - @Override + @Override public String toString() - { - return buffer.toString(); - } + { + return buffer.toString(); + } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java index c9712eeb5..99f95b800 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java @@ -59,9 +59,9 @@ public class TocFragmentServlet extends HttpServlet { throws ServletException, IOException { String locale = UrlUtil.getLocale(req, resp); req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$ - resp.setHeader("Cache-Control","no-cache"); //$NON-NLS-1$//$NON-NLS-2$ - resp.setHeader("Pragma","no-cache"); //$NON-NLS-1$ //$NON-NLS-2$ - resp.setDateHeader ("Expires", 0); //$NON-NLS-1$ + resp.setHeader("Cache-Control","no-cache"); //$NON-NLS-1$//$NON-NLS-2$ + resp.setHeader("Pragma","no-cache"); //$NON-NLS-1$ //$NON-NLS-2$ + resp.setDateHeader ("Expires", 0); //$NON-NLS-1$ TocData data = new TocData(this.getServletContext(), req, resp); readParameters(req); @@ -120,7 +120,7 @@ public class TocFragmentServlet extends HttpServlet { } else if (requestKind == REQUEST_SHOW_IN_TOC) { generateNumericPath(); } else { - serializeTocs(); + serializeTocs(); } buf.append("</tree_data>\n"); //$NON-NLS-1$ return buf.toString(); @@ -129,9 +129,9 @@ public class TocFragmentServlet extends HttpServlet { private void generateNumericPath() { int selectedToc = tocData.getSelectedToc(); - if (selectedToc < 0) { - addError(WebappResources.getString("CannotSync", locale)); //$NON-NLS-1$ - } else { + if (selectedToc < 0) { + addError(WebappResources.getString("CannotSync", locale)); //$NON-NLS-1$ + } else { // Count the number of enabled tocs int enabled = 0; for (int i = 0; i <= selectedToc; i++) { @@ -139,38 +139,38 @@ public class TocFragmentServlet extends HttpServlet { enabled++; } } - String fullNumericPath = "" + (enabled - 1); //$NON-NLS-1$ - String numericPath = tocData.getNumericPath(); + String fullNumericPath = "" + (enabled - 1); //$NON-NLS-1$ + String numericPath = tocData.getNumericPath(); if (numericPath != null) { - fullNumericPath = fullNumericPath + '_' + numericPath; - } - buf.append("<numeric_path path=\"" + fullNumericPath + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$ - } + fullNumericPath = fullNumericPath + '_' + numericPath; + } + buf.append("<numeric_path path=\"" + fullNumericPath + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } } private void addError(String message) { if (!isErrorSuppress) { - buf.append("<error>"); //$NON-NLS-1$ + buf.append("<error>"); //$NON-NLS-1$ buf.append(XMLGenerator.xmlEscape(message)); buf.append("</error>"); //$NON-NLS-1$ } } private void serializeTocs() { - ITopic[] topicPath = tocData.getTopicPath(); + ITopic[] topicPath = tocData.getTopicPath(); int selectedToc = tocData.getSelectedToc(); // Iterate over all tocs - if there is a selected toc only generate that // toc, otherwise generate the root of every toc. for (int toc=0; toc< tocData.getTocCount(); toc++) { boolean shouldLoad = requestKind == REQUEST_SHOW_TOCS || toc == selectedToc; - if (shouldLoad) { - boolean isSelected = false; // Should this node be selected in the tree - if (requestKind == REQUEST_SHOW_TOCS) { - isSelected = toc == 0; - } else if (requestKind == REQUEST_SHOW_CHILDREN) { - isSelected = tocData.getRootPath() == null; - } + if (shouldLoad) { + boolean isSelected = false; // Should this node be selected in the tree + if (requestKind == REQUEST_SHOW_TOCS) { + isSelected = toc == 0; + } else if (requestKind == REQUEST_SHOW_CHILDREN) { + isSelected = tocData.getRootPath() == null; + } serializeToc(tocData.getTocs()[toc], toc, topicPath, isSelected); } } @@ -217,9 +217,9 @@ public class TocFragmentServlet extends HttpServlet { } private void serializeTopic(ITopic topic, ITopic[] topicPath, boolean isSelected, String parentPath) { - ITopic[] subtopics = topic.getSubtopics(); - boolean isLeaf = !ScopeUtils.hasInScopeDescendent(topic, scope); - buf.append("<node"); //$NON-NLS-1$ + ITopic[] subtopics = topic.getSubtopics(); + boolean isLeaf = !ScopeUtils.hasInScopeDescendent(topic, scope); + buf.append("<node"); //$NON-NLS-1$ if (topic.getLabel() != null) { buf.append('\n' + " title=\"" + XMLGenerator.xmlEscape(topic.getLabel()) + '"'); //$NON-NLS-1$ } @@ -250,11 +250,11 @@ public class TocFragmentServlet extends HttpServlet { String icon = ((Toc) toc).getIcon(); if (IconFinder.isIconDefined(icon)) { - String openIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_OPEN); + String openIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_OPEN); String closedIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_CLOSED); String imageTags = '\n' + " openImage=\"/"+ openIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$ if (!openIcon.equals(closedIcon)) { - imageTags += '\n' + " closedImage=\"/" + closedIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$ + imageTags += '\n' + " closedImage=\"/" + closedIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$ } String altText = IconFinder.getIconAltFromId(icon); if(altText != null) { @@ -269,20 +269,20 @@ public class TocFragmentServlet extends HttpServlet { private String createTopicImageTags(ITopic topic, boolean isLeaf) { if (topic instanceof Topic) { String icon = ((Topic) topic).getIcon(); - String altText = IconFinder.getIconAltFromId(icon); + String altText = IconFinder.getIconAltFromId(icon); if (IconFinder.isIconDefined(icon)) { String imageTags; if (isLeaf) { imageTags = '\n' + " openImage=\"/" +IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_LEAF) + "\""; //$NON-NLS-1$//$NON-NLS-2$ } else { - String openIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_OPEN); + String openIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_OPEN); String closedIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_CLOSED); imageTags = '\n' + " openImage=\"/" + openIcon+ "\""; //$NON-NLS-1$ //$NON-NLS-2$ if (!openIcon.equals(closedIcon)) { - imageTags += '\n' + " closedImage=\"/" + closedIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$ + imageTags += '\n' + " closedImage=\"/" + closedIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$ } - } + } if(altText != null) { imageTags += '\n' + " imageAlt=\""+ altText + "\""; //$NON-NLS-1$ //$NON-NLS-2$ } @@ -305,22 +305,22 @@ public class TocFragmentServlet extends HttpServlet { if (parentIsSelected && requestKind == REQUEST_SHOW_CHILDREN) { // Show the children of this node for (int subtopic = 0; subtopic < childTopics.length; subtopic++) { - ITopic childTopic = childTopics[subtopic]; - if (ScopeUtils.showInTree(childTopic, scope)) { - serializeTopic(childTopic, null, false, addSuffix(parentPath, subtopic)); - } + ITopic childTopic = childTopics[subtopic]; + if (ScopeUtils.showInTree(childTopic, scope)) { + serializeTopic(childTopic, null, false, addSuffix(parentPath, subtopic)); + } } } else if (topicPath != null) { for (int subtopic = 0; subtopic < childTopics.length; subtopic++) { ITopic childTopic = childTopics[subtopic]; - if (ScopeUtils.showInTree(childTopic, scope)) { + if (ScopeUtils.showInTree(childTopic, scope)) { if (topicPath[0].getLabel().equals(childTopic.getLabel())) { ITopic[] newPath = null; if (topicPath.length > 1) { newPath = new ITopic[topicPath.length - 1]; System.arraycopy(topicPath, 1, newPath, 0, topicPath.length - 1); } - serializeTopic(childTopic, newPath, topicPath.length == 1, addSuffix(parentPath, subtopic)); + serializeTopic(childTopic, newPath, topicPath.length == 1, addSuffix(parentPath, subtopic)); } else { serializeTopic(childTopic, null, false, addSuffix(parentPath, subtopic)); } 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 index ce1176231..a83a0e0b6 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java @@ -28,104 +28,104 @@ public abstract class AbstractButton implements Comparable<AbstractButton> { * 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 Name of the toolbar. - * @return true - */ - public boolean isAddedToToolbar(String toolbarName) { - return true; - } - - /** + 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 Name of the toolbar. + * @return true + */ + public boolean isAddedToToolbar(String toolbarName) { + return true; + } + + /** * @since 3.7 */ - @Override + @Override final public int compareTo(AbstractButton o) { - if (o != null) { - String objectName = o.getId(); + if (o != null) { + String objectName = o.getId(); return (getId().compareTo(objectName)); - } - return 0; - } + } + return 0; + } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java index 8496719f7..20dcd4318 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java @@ -38,47 +38,47 @@ public abstract class AbstractFrame implements Comparable<AbstractFrame> { * * @return a non translated name which is the name of this frame */ - public abstract String getName(); + public abstract String getName(); - /** - * @return a URL path, relative to /help which is the - * location of the jsp files in the advanced presentation - */ - public abstract String getURL(); + /** + * @return a URL path, relative to /help which is the + * location of the jsp files in the advanced presentation + */ + public abstract String getURL(); - /** - * @return a string which will be used in the rows or cols attribute of a - * frameset in the html - */ - public String getSize() { - return "*"; //$NON-NLS-1$ - } + /** + * @return a string which will be used in the rows or cols attribute of a + * frameset in the html + */ + public String getSize() { + return "*"; //$NON-NLS-1$ + } - /** - * @return true if the frame should be shown in the advanced presentation - */ - public boolean isVisible() { - return true; - } + /** + * @return true if the frame should be shown in the advanced presentation + */ + public boolean isVisible() { + return true; + } - /** - * allows the attributes of this frame other than name and src to be specified - * @return a list of attributes - */ - public String getFrameAttributes() { - return "\"marginwidth=\"1\" marginheight=\"1\" frameborder=\"1\" scrolling=\"no\""; //$NON-NLS-1$ - } + /** + * allows the attributes of this frame other than name and src to be specified + * @return a list of attributes + */ + public String getFrameAttributes() { + return "\"marginwidth=\"1\" marginheight=\"1\" frameborder=\"1\" scrolling=\"no\""; //$NON-NLS-1$ + } - /** + /** * @since 3.7 */ - @Override + @Override final public int compareTo(AbstractFrame o) { - if (o != null) { - String objectName = o.getName(); + if (o != null) { + String objectName = o.getName(); return (getName().compareTo(objectName)); - } - return 0; - } + } + return 0; + } } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java index 8e867ed65..5a31b50f2 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java @@ -30,67 +30,67 @@ public abstract class AbstractView { * is toc the help system will look for the files tocView.jsp * and tocToolbar.jsp */ - public abstract String getName(); + public abstract String getName(); - /** - * @return a URL path, relative to /help which is the - * location of the jsp files in the advanced presentation - */ - public abstract String getURL(); + /** + * @return a URL path, relative to /help which is the + * location of the jsp files in the advanced presentation + */ + public abstract String getURL(); - /** - * @return a URL path, relative to /help which is the - * location of the jsp files in the basic presentation - * @deprecated Help webapp no longer has basic view. - */ - @Deprecated + /** + * @return a URL path, relative to /help which is the + * location of the jsp files in the basic presentation + * @deprecated Help webapp no longer has basic view. + */ + @Deprecated public String getBasicURL() { - return getURL(); - } + return getURL(); + } - /** - * @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(); + /** + * @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(); - /** - * @return a character which can be used as an accesskey to - * navigate directly to this view, or (char)0 if no - * acceskey is specified - */ - public abstract char getKey(); + /** + * @return a character which can be used as an accesskey to + * navigate directly to this view, or (char)0 if no + * acceskey is specified + */ + public abstract char getKey(); - /** - * Used to allow for views whose loading is deferred until - * their contents are visible - * @return true if this view has deferred loading - */ - public boolean isDeferred() { - return false; - } + /** + * Used to allow for views whose loading is deferred until + * their contents are visible + * @return true if this view has deferred loading + */ + public boolean isDeferred() { + return false; + } - /** - * A user visible title for the view 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 getTitle(Locale locale); + /** + * A user visible title for the view 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 getTitle(Locale locale); - /** - * @return true if the view should be shown in the advanced presentation - */ - public boolean isVisible() { - return true; - } + /** + * @return true if the view should be shown in the advanced presentation + */ + public boolean isVisible() { + return true; + } - /** - * @return true if the view should be shown in the basic presentation - * @deprecated Help webapp no longer has basic view. - */ - @Deprecated + /** + * @return true if the view should be shown in the basic presentation + * @deprecated Help webapp no longer has basic view. + */ + @Deprecated public boolean isVisibleBasic() { - return true; - } + return true; + } } |