From 0e5a231df3cd18b017d93d6014744bd96a596d84 Mon Sep 17 00:00:00 2001 From: khartlage Date: Tue, 28 Jan 2003 22:02:01 +0000 Subject: [PATCH] changed the "description" attribute in phpsyntax.xml into multi-line text between the tags --- .../phpeclipse/phpeditor/PHPSyntaxRdr.java | 49 ++++++++++++-------- .../phpeclipse/phpeditor/PHPTextHover.java | 12 ++-- .../sourceforge/phpeclipse/phpeditor/phpsyntax.xml | 24 +++++----- 3 files changed, 47 insertions(+), 38 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSyntaxRdr.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSyntaxRdr.java index 00e287c..ed67b53 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSyntaxRdr.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSyntaxRdr.java @@ -13,6 +13,13 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import net.sourceforge.phpeclipse.IPreferenceConstants; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import net.sourceforge.phpeclipse.phpeditor.php.PHPConstant; +import net.sourceforge.phpeclipse.phpeditor.php.PHPElement; +import net.sourceforge.phpeclipse.phpeditor.php.PHPFunction; +import net.sourceforge.phpeclipse.phpeditor.php.PHPKeyword; +import net.sourceforge.phpeclipse.phpeditor.php.PHPType; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.Serializer; import org.apache.xml.serialize.SerializerFactory; @@ -24,17 +31,10 @@ import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.w3c.dom.Text; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import net.sourceforge.phpeclipse.IPreferenceConstants; -import net.sourceforge.phpeclipse.PHPeclipsePlugin; -import net.sourceforge.phpeclipse.phpeditor.php.PHPConstant; -import net.sourceforge.phpeclipse.phpeditor.php.PHPElement; -import net.sourceforge.phpeclipse.phpeditor.php.PHPFunction; -import net.sourceforge.phpeclipse.phpeditor.php.PHPKeyword; -import net.sourceforge.phpeclipse.phpeditor.php.PHPType; - /** * PHPSyntaxRdr reads PHP specifics from an XML file (eg. keywords) */ @@ -49,7 +49,6 @@ public class PHPSyntaxRdr { private static final String TYPE_ATTR = "type"; //$NON-NLS-1$ private static final String CONSTANT_ATTR = "constant"; //$NON-NLS-1$ private static final String FN_ATTR = "function"; //$NON-NLS-1$ - private static final String DESCRIPTION = "description"; //$NON-NLS-1$ private static final String USAGE_ATTR = "usage"; //$NON-NLS-1$ private static final String TOKENVAL_ATTR = "tokenval"; //$NON-NLS-1$ private static IPreferenceStore store; @@ -136,21 +135,29 @@ public class PHPSyntaxRdr { String Type = getAttributeValue(attributes, TYPE_ATTR); String Function = getAttributeValue(attributes, FN_ATTR); String Constant = getAttributeValue(attributes, CONSTANT_ATTR); - String Description = getAttributeValue(attributes, DESCRIPTION); - String Usage = getAttributeValue(attributes, USAGE_ATTR); + String usage = getAttributeValue(attributes, USAGE_ATTR); String Tokenval = getAttributeValue(attributes, TOKENVAL_ATTR); + StringBuffer buffer= new StringBuffer(); + NodeList children= node.getChildNodes(); + for (int j= 0; j != children.getLength(); j++) { + String value= children.item(j).getNodeValue(); + if (value != null) + buffer.append(value); + } + String description = buffer.toString().trim(); + if (Keyword == null && Type == null && Function == null && Constant == null) { //ignore as it is not a valid phpsyntax tag } else { if (Keyword != null) { - syntaxdata.addElement(new PHPKeyword(Keyword, Description, Tokenval)); + syntaxdata.addElement(new PHPKeyword(Keyword, usage, Tokenval)); } else if (Type != null) { - syntaxdata.addElement(new PHPType(Type, Description)); + syntaxdata.addElement(new PHPType(Type, usage)); } else if (Function != null) { - syntaxdata.addElement(new PHPFunction(Function, Description, Usage)); + syntaxdata.addElement(new PHPFunction(Function, usage, description)); } else if (Constant != null) { - syntaxdata.addElement(new PHPConstant(Constant, Description)); + syntaxdata.addElement(new PHPConstant(Constant, usage)); } } } @@ -229,8 +236,8 @@ public class PHPSyntaxRdr { name = document.createAttribute(CONSTANT_ATTR); name.setValue(((PHPElement) bufferobj).getName()); attributes.setNamedItem(name); - Attr description = document.createAttribute(DESCRIPTION); - description.setValue(((PHPElement) bufferobj).getDescription()); + Attr description = document.createAttribute(USAGE_ATTR); + description.setValue(((PHPElement) bufferobj).getUsage()); attributes.setNamedItem(description); if (bufferobj instanceof PHPKeyword) { Attr tokenval = document.createAttribute(TOKENVAL_ATTR); @@ -238,9 +245,11 @@ public class PHPSyntaxRdr { attributes.setNamedItem(tokenval); } if (bufferobj instanceof PHPFunction) { - Attr usage = document.createAttribute(USAGE_ATTR); - usage.setValue(((PHPFunction) bufferobj).getUsage()); - attributes.setNamedItem(usage); + // Attr usage = document.createAttribute(USAGE_ATTR); + Text usage = document.createTextNode(((PHPFunction) bufferobj).getDescription()); + node.appendChild(usage); +// usage.setValue(((PHPFunction) bufferobj).getUsage()); +// attributes.setNamedItem(usage); } } OutputFormat format = new OutputFormat(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java index 4851296..878629c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java @@ -14,16 +14,14 @@ package net.sourceforge.phpeclipse.phpeditor; import java.util.HashMap; import java.util.Vector; +import net.sourceforge.phpeclipse.phpeditor.php.PHPElement; import net.sourceforge.phpeclipse.phpeditor.php.PHPWordExtractor; - import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextHover; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.Region; import org.eclipse.swt.graphics.Point; -import net.sourceforge.phpeclipse.phpeditor.php.PHPElement; - /** * Example implementation for an ITextHover * which hovers over PHP code. @@ -32,6 +30,7 @@ public class PHPTextHover implements ITextHover { public static HashMap functionDescriptions = null; private static PHPWordExtractor phpWordDetector = new PHPWordExtractor(); + /* (non-Javadoc) * Method declared on ITextHover */ @@ -50,13 +49,14 @@ public class PHPTextHover implements ITextHover { String strbuffer = null; PHPElement elbuffer = null; while ((syntaxbuffer != null) - && (!syntaxbuffer.isEmpty() && ((elbuffer = (PHPElement) syntaxbuffer.remove(0)) != null))) { - functionDescriptions.put(elbuffer.getName(), elbuffer.getDescription()); + && (!syntaxbuffer.isEmpty() && + ((elbuffer = (PHPElement) syntaxbuffer.remove(0)) != null))) { + functionDescriptions.put(elbuffer.getName(), elbuffer.getHoverText()); } // functionDescriptions = new HashMap(997); // for (int i=0; i - - + Invokes a COM module + Loads a COM module + Return the absolute value of the number - + Return the arc cosine of the number in radians @@ -123,10 +123,10 @@ - + bool class_exists(string classname) - + void closedir([resource dir_handle]) @@ -223,7 +223,7 @@ - + string create_function(string args, string code) @@ -315,13 +315,13 @@ - + bool define(string constant_name, mixed value, case_sensitive=true) - + bool defined(string constant_name) - + class dir(string directory) @@ -1120,7 +1120,7 @@ - + @@ -2052,7 +2052,7 @@ - + string substr(string str, int start [, int length]) -- 1.7.1