1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug #205030 : additional patch

This commit is contained in:
Oleg Krasilnikov 2007-10-24 09:47:41 +00:00
parent 475c93f89d
commit 18fa1c4fc2
2 changed files with 22 additions and 3 deletions

View file

@ -20,6 +20,10 @@ public class CHelpBook implements ICHelpBook {
private static final String ATTR_TITLE = "title"; //$NON-NLS-1$ private static final String ATTR_TITLE = "title"; //$NON-NLS-1$
private static final String ATTR_BTYPE = "type"; //$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 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 int type;
private String title; private String title;
@ -31,9 +35,22 @@ public class CHelpBook implements ICHelpBook {
if (e.hasAttribute(ATTR_TITLE)) if (e.hasAttribute(ATTR_TITLE))
title = e.getAttribute(ATTR_TITLE).trim(); title = e.getAttribute(ATTR_TITLE).trim();
if (e.hasAttribute(ATTR_BTYPE)) { if (e.hasAttribute(ATTR_BTYPE)) {
String s = e.getAttribute(ATTR_BTYPE);
try { try {
type = Integer.parseInt(e.getAttribute(ATTR_TITLE)); type = Integer.parseInt(s);
} catch (NumberFormatException ee) {} 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(); NodeList list = e.getChildNodes();
for(int i = 0; i < list.getLength(); i++){ for(int i = 0; i < list.getLength(); i++){
@ -68,7 +85,6 @@ public class CHelpBook implements ICHelpBook {
IFunctionSummary[] fs = he.getFunctionSummary(); IFunctionSummary[] fs = he.getFunctionSummary();
if (fs != null && fs.length > 0) if (fs != null && fs.length > 0)
return fs[0]; return fs[0];
// TODO: function summary selection
} }
return null; return null;
} }

View file

@ -36,6 +36,9 @@ public class CHelpEntry {
} }
fss = (CFunctionSummary[])obs1.toArray(new CFunctionSummary[obs1.size()]); fss = (CFunctionSummary[])obs1.toArray(new CFunctionSummary[obs1.size()]);
hts = (CHelpTopic[])obs2.toArray(new CHelpTopic[obs2.size()]); hts = (CHelpTopic[])obs2.toArray(new CHelpTopic[obs2.size()]);
if (fss.length == 0 && hts.length == 0)
isValid = false; // nothing to display
} }
/** /**