From 18fa1c4fc2912b1ba641fe9daa2c739e17d2199d Mon Sep 17 00:00:00 2001 From: Oleg Krasilnikov Date: Wed, 24 Oct 2007 09:47:41 +0000 Subject: [PATCH] Bug #205030 : additional patch --- .../cdt/internal/ui/help/CHelpBook.java | 22 ++++++++++++++++--- .../cdt/internal/ui/help/CHelpEntry.java | 3 +++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpBook.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpBook.java index 15db59f3289..b7c22218fa8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpBook.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpBook.java @@ -20,6 +20,10 @@ public class CHelpBook implements ICHelpBook { private static final String ATTR_TITLE = "title"; //$NON-NLS-1$ private static final String ATTR_BTYPE = "type"; //$NON-NLS-1$ private static final String NODE_ENTRY = "entry"; //$NON-NLS-1$ + private static final String TYPE_C = "HELP_TYPE_C"; //$NON-NLS-1$ + private static final String TYPE_CPP = "HELP_TYPE_CPP"; //$NON-NLS-1$ + private static final String TYPE_ASM = "HELP_TYPE_ASM"; //$NON-NLS-1$ + private static final int DEFAULT_VAL = ICHelpBook.HELP_TYPE_C; private int type; private String title; @@ -31,9 +35,22 @@ public class CHelpBook implements ICHelpBook { if (e.hasAttribute(ATTR_TITLE)) title = e.getAttribute(ATTR_TITLE).trim(); if (e.hasAttribute(ATTR_BTYPE)) { + String s = e.getAttribute(ATTR_BTYPE); try { - type = Integer.parseInt(e.getAttribute(ATTR_TITLE)); - } catch (NumberFormatException ee) {} + type = Integer.parseInt(s); + if (type < DEFAULT_VAL || + type > ICHelpBook.HELP_TYPE_ASM) + type = DEFAULT_VAL; + } catch (NumberFormatException ee) { + if (TYPE_C.equalsIgnoreCase(s)) + type = ICHelpBook.HELP_TYPE_C; + else if (TYPE_CPP.equalsIgnoreCase(s)) + type = ICHelpBook.HELP_TYPE_CPP; + else if (TYPE_ASM.equalsIgnoreCase(s)) + type = ICHelpBook.HELP_TYPE_ASM; + else + type = DEFAULT_VAL; + } } NodeList list = e.getChildNodes(); for(int i = 0; i < list.getLength(); i++){ @@ -68,7 +85,6 @@ public class CHelpBook implements ICHelpBook { IFunctionSummary[] fs = he.getFunctionSummary(); if (fs != null && fs.length > 0) return fs[0]; - // TODO: function summary selection } return null; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpEntry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpEntry.java index 5bb8e08a6f2..bd0df39e2ac 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpEntry.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpEntry.java @@ -36,6 +36,9 @@ public class CHelpEntry { } fss = (CFunctionSummary[])obs1.toArray(new CFunctionSummary[obs1.size()]); hts = (CHelpTopic[])obs2.toArray(new CHelpTopic[obs2.size()]); + + if (fss.length == 0 && hts.length == 0) + isValid = false; // nothing to display } /**