Automated merge with http://hg.netbeans.org/main/contrib
authorMartin Fousek <marfous@netbeans.org>
Mon, 07 Jun 2010 10:06:41 +0200
changeset 1631730816fda5c18
parent 16315 8982663d0bef
parent 16316 a295d29ffa7b
child 16318 449c7d16dcfa
child 16324 d7934425e846
Automated merge with http://hg.netbeans.org/main/contrib
     1.1 --- a/php.smarty/manifest.mf	Thu Jun 03 22:28:44 2010 +0800
     1.2 +++ b/php.smarty/manifest.mf	Mon Jun 07 10:06:41 2010 +0200
     1.3 @@ -2,5 +2,5 @@
     1.4  OpenIDE-Module: org.netbeans.modules.php.smarty
     1.5  OpenIDE-Module-Layer: org/netbeans/modules/php/smarty/resources/layer.xml
     1.6  OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/smarty/resources/Bundle.properties
     1.7 -OpenIDE-Module-Specification-Version: 1.26
     1.8 +OpenIDE-Module-Specification-Version: 1.27
     1.9  
     2.1 --- a/php.smarty/nbproject/project.xml	Thu Jun 03 22:28:44 2010 +0800
     2.2 +++ b/php.smarty/nbproject/project.xml	Mon Jun 07 10:06:41 2010 +0200
     2.3 @@ -24,6 +24,24 @@
     2.4                      </run-dependency>
     2.5                  </dependency>
     2.6                  <dependency>
     2.7 +                    <code-name-base>org.netbeans.modules.editor.completion</code-name-base>
     2.8 +                    <build-prerequisite/>
     2.9 +                    <compile-dependency/>
    2.10 +                    <run-dependency>
    2.11 +                        <release-version>1</release-version>
    2.12 +                        <specification-version>1.20</specification-version>
    2.13 +                    </run-dependency>
    2.14 +                </dependency>
    2.15 +                <dependency>
    2.16 +                    <code-name-base>org.netbeans.modules.editor.indent</code-name-base>
    2.17 +                    <build-prerequisite/>
    2.18 +                    <compile-dependency/>
    2.19 +                    <run-dependency>
    2.20 +                        <release-version>2</release-version>
    2.21 +                        <specification-version>1.19</specification-version>
    2.22 +                    </run-dependency>
    2.23 +                </dependency>
    2.24 +                <dependency>
    2.25                      <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
    2.26                      <build-prerequisite/>
    2.27                      <compile-dependency/>
     3.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/SmartyPhpFrameworkProvider.java	Thu Jun 03 22:28:44 2010 +0800
     3.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/SmartyPhpFrameworkProvider.java	Mon Jun 07 10:06:41 2010 +0200
     3.3 @@ -220,7 +220,7 @@
     3.4          }
     3.5      }
     3.6  
     3.7 -    private class FoundSmarty {
     3.8 +    private static class FoundSmarty {
     3.9          private boolean isFound;
    3.10  
    3.11          public FoundSmarty() {
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/Bundle.properties	Mon Jun 07 10:06:41 2010 +0200
     4.3 @@ -0,0 +1,40 @@
     4.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4.5 +#
     4.6 +# Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
     4.7 +#
     4.8 +# The contents of this file are subject to the terms of either the GNU
     4.9 +# General Public License Version 2 only ("GPL") or the Common
    4.10 +# Development and Distribution License("CDDL") (collectively, the
    4.11 +# "License"). You may not use this file except in compliance with the
    4.12 +# License. You can obtain a copy of the License at
    4.13 +# http://www.netbeans.org/cddl-gplv2.html
    4.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    4.15 +# specific language governing permissions and limitations under the
    4.16 +# License.  When distributing the software, include this License Header
    4.17 +# Notice in each file and include the License file at
    4.18 +# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    4.19 +# particular file as subject to the "Classpath" exception as provided
    4.20 +# by Sun in the GPL Version 2 section of the License file that
    4.21 +# accompanied this code. If applicable, add the following below the
    4.22 +# License Header, with the fields enclosed by brackets [] replaced by
    4.23 +# your own identifying information:
    4.24 +# "Portions Copyrighted [year] [name of copyright owner]"
    4.25 +#
    4.26 +# Contributor(s):
    4.27 +#
    4.28 +# The Original Software is NetBeans. The Initial Developer of the Original
    4.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    4.30 +# Microsystems, Inc. All Rights Reserved.
    4.31 +#
    4.32 +# If you wish your version of this file to be governed by only the CDDL
    4.33 +# or only the GPL Version 2, indicate your decision by adding
    4.34 +# "[Contributor] elects to include this software in this distribution
    4.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
    4.36 +# single choice of license, a recipient has the option to distribute
    4.37 +# your version of this file under either the CDDL, the GPL Version 2 or
    4.38 +# to extend the choice of license to its licensees as provided above.
    4.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
    4.40 +# Version 2 license, then the option applies only if the new code is
    4.41 +# made subject to such option by the copyright holder.
    4.42 +
    4.43 +MSG_No_Doc_For_Target=<b>No documentation for the link target available</b>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/TplCompletionItem.java	Mon Jun 07 10:06:41 2010 +0200
     5.3 @@ -0,0 +1,318 @@
     5.4 +/*
     5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     5.6 + *
     5.7 + * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
     5.8 + *
     5.9 + * The contents of this file are subject to the terms of either the GNU
    5.10 + * General Public License Version 2 only ("GPL") or the Common
    5.11 + * Development and Distribution License("CDDL") (collectively, the
    5.12 + * "License"). You may not use this file except in compliance with the
    5.13 + * License. You can obtain a copy of the License at
    5.14 + * http://www.netbeans.org/cddl-gplv2.html
    5.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    5.16 + * specific language governing permissions and limitations under the
    5.17 + * License.  When distributing the software, include this License Header
    5.18 + * Notice in each file and include the License file at
    5.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    5.20 + * particular file as subject to the "Classpath" exception as provided
    5.21 + * by Sun in the GPL Version 2 section of the License file that
    5.22 + * accompanied this code. If applicable, add the following below the
    5.23 + * License Header, with the fields enclosed by brackets [] replaced by
    5.24 + * your own identifying information:
    5.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    5.26 + *
    5.27 + * Contributor(s):
    5.28 + *
    5.29 + * The Original Software is NetBeans. The Initial Developer of the Original
    5.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    5.31 + * Microsystems, Inc. All Rights Reserved.
    5.32 + *
    5.33 + * If you wish your version of this file to be governed by only the CDDL
    5.34 + * or only the GPL Version 2, indicate your decision by adding
    5.35 + * "[Contributor] elects to include this software in this distribution
    5.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    5.37 + * single choice of license, a recipient has the option to distribute
    5.38 + * your version of this file under either the CDDL, the GPL Version 2 or
    5.39 + * to extend the choice of license to its licensees as provided above.
    5.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    5.41 + * Version 2 license, then the option applies only if the new code is
    5.42 + * made subject to such option by the copyright holder.
    5.43 + */
    5.44 +package org.netbeans.modules.php.smarty.editor.completion;
    5.45 +
    5.46 +import java.util.Arrays;
    5.47 +import java.awt.Font;
    5.48 +import java.awt.Graphics;
    5.49 +import java.net.URL;
    5.50 +import javax.swing.ImageIcon;
    5.51 +import javax.swing.text.Caret;
    5.52 +import org.netbeans.api.editor.completion.Completion;
    5.53 +import org.netbeans.editor.BaseDocument;
    5.54 +import org.netbeans.editor.Utilities;
    5.55 +import org.netbeans.modules.editor.indent.api.Indent;
    5.56 +import org.netbeans.spi.editor.completion.*;
    5.57 +import java.awt.Color;
    5.58 +import java.awt.event.KeyEvent;
    5.59 +import javax.swing.text.BadLocationException;
    5.60 +import javax.swing.text.JTextComponent;
    5.61 +import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
    5.62 +import org.netbeans.spi.editor.completion.support.CompletionUtilities;
    5.63 +import org.openide.xml.XMLUtil;
    5.64 +
    5.65 +/**
    5.66 + * Code completion result item base class
    5.67 + *
    5.68 + * @author Martin Fousek
    5.69 + */
    5.70 +public class TplCompletionItem implements CompletionItem {
    5.71 +
    5.72 +    protected static final int DEFAULT_SORT_PRIORITY = 22;
    5.73 +
    5.74 +    //------------------------------------------
    5.75 +    protected int substitutionOffset;
    5.76 +    protected String text, helpId;
    5.77 +    protected boolean shift;
    5.78 +
    5.79 +    protected TplCompletionItem(String text, int substituteOffset) {
    5.80 +        this.substitutionOffset = substituteOffset;
    5.81 +        this.text = text;
    5.82 +    }
    5.83 +
    5.84 +    protected TplCompletionItem(String text, int substituteOffset, String helpId) {
    5.85 +        this(text, substituteOffset);
    5.86 +        this.helpId = helpId;
    5.87 +    }
    5.88 +
    5.89 +    public String getItemText() {
    5.90 +        return text;
    5.91 +    }
    5.92 +
    5.93 +    public int getSortPriority() {
    5.94 +        return DEFAULT_SORT_PRIORITY;
    5.95 +    }
    5.96 +
    5.97 +    public CharSequence getSortText() {
    5.98 +        return getItemText();
    5.99 +    }
   5.100 +
   5.101 +    public CharSequence getInsertPrefix() {
   5.102 +        return getItemText();
   5.103 +    }
   5.104 +
   5.105 +    public void processKeyEvent(KeyEvent e) {
   5.106 +        shift = (e.getKeyCode() == KeyEvent.VK_ENTER && e.getID() == KeyEvent.KEY_PRESSED && e.isShiftDown());
   5.107 +    }
   5.108 +
   5.109 +    public void defaultAction(JTextComponent component) {
   5.110 +        if (component != null) {
   5.111 +            if (!shift) {
   5.112 +                Completion.get().hideDocumentation();
   5.113 +                Completion.get().hideCompletion();
   5.114 +            }
   5.115 +            int caretOffset = component.getSelectionEnd();
   5.116 +            substituteText(component, caretOffset - substitutionOffset);
   5.117 +        }
   5.118 +
   5.119 +    }
   5.120 +
   5.121 +    protected int getMoveBackLength() {
   5.122 +        return 0; //default
   5.123 +    }
   5.124 +
   5.125 +    /** 
   5.126 +     * Subclasses may override to customize the completed text 
   5.127 +     * if they do not want to override the substituteText method. 
   5.128 +     */
   5.129 +    protected String getSubstituteText() {
   5.130 +        return getItemText();
   5.131 +    }
   5.132 +
   5.133 +    protected boolean substituteText(JTextComponent c, int len) {
   5.134 +        return substituteText(c, len, getMoveBackLength());
   5.135 +    }
   5.136 +
   5.137 +    protected boolean substituteText(final JTextComponent c, final int len, int moveBack) {
   5.138 +        return substituteText(c, getSubstituteText(), len, moveBack);
   5.139 +    }
   5.140 +
   5.141 +    protected boolean substituteText(final JTextComponent c, final String substituteText, final int len, int moveBack) {
   5.142 +        final BaseDocument doc = (BaseDocument) c.getDocument();
   5.143 +        final boolean[] result = new boolean[1];
   5.144 +        result[0] = true;
   5.145 +
   5.146 +        doc.runAtomic(new Runnable() {
   5.147 +
   5.148 +            public void run() {
   5.149 +                try {
   5.150 +                    //test whether we are trying to insert sg. what is already present in the text
   5.151 +                    String currentText = doc.getText(substitutionOffset, (doc.getLength() - substitutionOffset) < substituteText.length() ? (doc.getLength() - substitutionOffset) : substituteText.length());
   5.152 +                    if (!substituteText.equals(currentText)) {
   5.153 +                        //remove common part
   5.154 +                        doc.remove(substitutionOffset, len);
   5.155 +                        doc.insertString(substitutionOffset, substituteText, null);
   5.156 +                    } else {
   5.157 +                        c.setCaretPosition(c.getCaret().getDot() + substituteText.length() - len);
   5.158 +                        }
   5.159 +                } catch (BadLocationException ex) {
   5.160 +                    result[0] = false;
   5.161 +                }
   5.162 +
   5.163 +            }
   5.164 +        });
   5.165 +
   5.166 +        //format the inserted text
   5.167 +        reindent(c);
   5.168 +
   5.169 +        if (moveBack != 0) {
   5.170 +            Caret caret = c.getCaret();
   5.171 +            int dot = caret.getDot();
   5.172 +            caret.setDot(dot - moveBack);
   5.173 +        }
   5.174 +
   5.175 +        return result[0];
   5.176 +    }
   5.177 +
   5.178 +    private void reindent(JTextComponent component) {
   5.179 +
   5.180 +        final BaseDocument doc = (BaseDocument) component.getDocument();
   5.181 +        final int dotPos = component.getCaretPosition();
   5.182 +        final Indent indent = Indent.get(doc);
   5.183 +        indent.lock();
   5.184 +        try {
   5.185 +            doc.runAtomic(new Runnable() {
   5.186 +
   5.187 +                public void run() {
   5.188 +                    try {
   5.189 +                        int startOffset = Utilities.getRowStart(doc, dotPos);
   5.190 +                        int endOffset = Utilities.getRowEnd(doc, dotPos);
   5.191 +                        indent.reindent(startOffset, endOffset);
   5.192 +                    } catch (BadLocationException ex) {
   5.193 +                        //ignore
   5.194 +                        }
   5.195 +                }
   5.196 +            });
   5.197 +        } finally {
   5.198 +            indent.unlock();
   5.199 +        }
   5.200 +
   5.201 +    }
   5.202 +
   5.203 +    public boolean instantSubstitution(JTextComponent component) {
   5.204 +        if (component != null) {
   5.205 +            try {
   5.206 +                int caretOffset = component.getSelectionEnd();
   5.207 +                if (caretOffset > substitutionOffset) {
   5.208 +                    String currentText = component.getDocument().getText(substitutionOffset, caretOffset - substitutionOffset);
   5.209 +                    if (!getSubstituteText().toString().startsWith(currentText)) {
   5.210 +                        return false;
   5.211 +                    }
   5.212 +                }
   5.213 +            } catch (BadLocationException ble) {
   5.214 +            }
   5.215 +        }
   5.216 +        defaultAction(component);
   5.217 +        return true;
   5.218 +    }
   5.219 +
   5.220 +    public int getPreferredWidth(Graphics g, Font defaultFont) {
   5.221 +        return CompletionUtilities.getPreferredWidth(getLeftHtmlText(), getRightHtmlText(), g, defaultFont);
   5.222 +    }
   5.223 +
   5.224 +    public void render(Graphics g, Font defaultFont, Color defaultColor, Color backgroundColor, int width, int height, boolean selected) {
   5.225 +        CompletionUtilities.renderHtml(getIcon(), getLeftHtmlText(), getRightHtmlText(), g, defaultFont, Color.BLACK, width, height, selected);
   5.226 +    }
   5.227 +
   5.228 +    protected ImageIcon getIcon() {
   5.229 +        return new ImageIcon(getClass().getResource("/org/netbeans/modules/php/smarty/resources/tpl-cc-icon.png"));
   5.230 +    }
   5.231 +
   5.232 +    protected String getLeftHtmlText() {
   5.233 +        return getItemText();
   5.234 +    }
   5.235 +
   5.236 +    protected String getRightHtmlText() {
   5.237 +        return null;
   5.238 +    }
   5.239 +
   5.240 +    public String getHelpId() {
   5.241 +        return this.helpId;
   5.242 +    }
   5.243 +
   5.244 +    /** Returns a url or null, if the help is not URL or the help is not defined.
   5.245 +     */
   5.246 +    public URL getHelpURL() {
   5.247 +        if (helpId == null || helpId.equals("")) {
   5.248 +            return null;
   5.249 +        }
   5.250 +        try {
   5.251 +            return new URL(helpId);
   5.252 +        } catch (java.io.IOException e) {
   5.253 +        }
   5.254 +        return null;
   5.255 +    }
   5.256 +
   5.257 +    /** Returns help for the item. It can be only url. If the item doesn't have a help
   5.258 +     *  than returns null. The class can overwrite this method and compounds the help realtime.
   5.259 +     */
   5.260 +    public String getHelp() {
   5.261 +        return null;
   5.262 +    }
   5.263 +
   5.264 +    /** Returns whether the item has a help.
   5.265 +     */
   5.266 +    public boolean hasHelp() {
   5.267 +        return (helpId != null && helpId.length() > 0);
   5.268 +    }
   5.269 +
   5.270 +    public CompletionTask createDocumentationTask() {
   5.271 +        return new AsyncCompletionTask(new TplCompletionProvider.DocQuery(this));
   5.272 +    }
   5.273 +
   5.274 +    public CompletionTask createToolTipTask() {
   5.275 +        return null;
   5.276 +    }
   5.277 +
   5.278 +    public static class BuiltInFunction extends TplCompletionItem {
   5.279 +
   5.280 +        protected static final String ATTR_NAME_COLOR = hexColorCode(Color.green.darker());
   5.281 +
   5.282 +        public BuiltInFunction(String value, int offset, String helpId) {
   5.283 +            super(value, offset, helpId);
   5.284 +        }
   5.285 +
   5.286 +        @Override
   5.287 +        protected String getLeftHtmlText() {
   5.288 +            return "<font color=#" + ATTR_NAME_COLOR + ">" + getItemText() + "</font>"; //NOI18N
   5.289 +        }
   5.290 +
   5.291 +        @Override
   5.292 +        public int getSortPriority() {
   5.293 +            return 20;
   5.294 +        }
   5.295 +
   5.296 +    }
   5.297 +
   5.298 +    public static class VariableModifiers extends TplCompletionItem {
   5.299 +
   5.300 +        protected static final String ATTR_NAME_COLOR = hexColorCode(Color.blue.darker());
   5.301 +
   5.302 +        public VariableModifiers(String value, int offset, String helpId) {
   5.303 +            super(value, offset, helpId);
   5.304 +        }
   5.305 +
   5.306 +        @Override
   5.307 +        protected String getLeftHtmlText() {
   5.308 +            return "<font color=#" + ATTR_NAME_COLOR + ">" + getItemText() + "</font>"; //NOI18N
   5.309 +        }
   5.310 +
   5.311 +        @Override
   5.312 +        public int getSortPriority() {
   5.313 +            return 25;
   5.314 +        }
   5.315 +    }
   5.316 +
   5.317 +    public static final String hexColorCode(Color c) {
   5.318 +        return Integer.toHexString(c.getRGB()).substring(2);
   5.319 +    }
   5.320 +
   5.321 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/TplCompletionProvider.java	Mon Jun 07 10:06:41 2010 +0200
     6.3 @@ -0,0 +1,423 @@
     6.4 +/*
     6.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     6.6 + *
     6.7 + * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
     6.8 + *
     6.9 + * The contents of this file are subject to the terms of either the GNU
    6.10 + * General Public License Version 2 only ("GPL") or the Common
    6.11 + * Development and Distribution License("CDDL") (collectively, the
    6.12 + * "License"). You may not use this file except in compliance with the
    6.13 + * License. You can obtain a copy of the License at
    6.14 + * http://www.netbeans.org/cddl-gplv2.html
    6.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    6.16 + * specific language governing permissions and limitations under the
    6.17 + * License.  When distributing the software, include this License Header
    6.18 + * Notice in each file and include the License file at
    6.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    6.20 + * particular file as subject to the "Classpath" exception as provided
    6.21 + * by Sun in the GPL Version 2 section of the License file that
    6.22 + * accompanied this code. If applicable, add the following below the
    6.23 + * License Header, with the fields enclosed by brackets [] replaced by
    6.24 + * your own identifying information:
    6.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    6.26 + *
    6.27 + * Contributor(s):
    6.28 + *
    6.29 + * The Original Software is NetBeans. The Initial Developer of the Original
    6.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    6.31 + * Microsystems, Inc. All Rights Reserved.
    6.32 + *
    6.33 + * If you wish your version of this file to be governed by only the CDDL
    6.34 + * or only the GPL Version 2, indicate your decision by adding
    6.35 + * "[Contributor] elects to include this software in this distribution
    6.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    6.37 + * single choice of license, a recipient has the option to distribute
    6.38 + * your version of this file under either the CDDL, the GPL Version 2 or
    6.39 + * to extend the choice of license to its licensees as provided above.
    6.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    6.41 + * Version 2 license, then the option applies only if the new code is
    6.42 + * made subject to such option by the copyright holder.
    6.43 + */
    6.44 +package org.netbeans.modules.php.smarty.editor.completion;
    6.45 +
    6.46 +import java.util.Collection;
    6.47 +import java.util.Collections;
    6.48 +import java.util.Locale;
    6.49 +import java.net.URL;
    6.50 +import javax.swing.Action;
    6.51 +import javax.swing.text.BadLocationException;
    6.52 +import javax.swing.text.Document;
    6.53 +import javax.swing.text.JTextComponent;
    6.54 +import org.netbeans.api.editor.completion.Completion;
    6.55 +import org.netbeans.api.html.lexer.HTMLTokenId;
    6.56 +import org.netbeans.api.lexer.Token;
    6.57 +import org.netbeans.api.lexer.TokenHierarchy;
    6.58 +import org.netbeans.api.lexer.TokenSequence;
    6.59 +import org.netbeans.editor.BaseDocument;
    6.60 +import org.netbeans.modules.parsing.spi.ParseException;
    6.61 +import org.netbeans.spi.editor.completion.CompletionDocumentation;
    6.62 +import org.netbeans.spi.editor.completion.CompletionItem;
    6.63 +import org.netbeans.spi.editor.completion.CompletionResultSet;
    6.64 +import org.netbeans.spi.editor.completion.CompletionProvider;
    6.65 +import org.netbeans.spi.editor.completion.CompletionTask;
    6.66 +import org.netbeans.spi.editor.completion.support.AsyncCompletionQuery;
    6.67 +import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
    6.68 +import org.openide.util.Exceptions;
    6.69 +import org.openide.util.NbBundle;
    6.70 +
    6.71 +/**
    6.72 + * Implementation of {@link CompletionProvider} for Tpl documents.
    6.73 + *
    6.74 + * @author Martin Fousek
    6.75 + */
    6.76 +public class TplCompletionProvider implements CompletionProvider {
    6.77 +
    6.78 +    @Override
    6.79 +    public int getAutoQueryTypes(JTextComponent component, String typedText) {
    6.80 +//        Document doc = component.getDocument();
    6.81 +//        int dotPos = component.getCaret().getDot();
    6.82 +//        boolean openCC = checkOpenCompletion(doc, dotPos, typedText);
    6.83 +//        return openCC ? COMPLETION_QUERY_TYPE + DOCUMENTATION_QUERY_TYPE : 0;
    6.84 +        return 0;
    6.85 +    }
    6.86 +
    6.87 +    @Override
    6.88 +    public CompletionTask createTask(int queryType, JTextComponent component) {
    6.89 +        AsyncCompletionTask task = null;
    6.90 +        if ((queryType & COMPLETION_QUERY_TYPE & COMPLETION_ALL_QUERY_TYPE) != 0) {
    6.91 +            task = new AsyncCompletionTask(new Query(), component);
    6.92 +        } else if (queryType == DOCUMENTATION_QUERY_TYPE) {
    6.93 +            task = new AsyncCompletionTask(new DocQuery(null), component);
    6.94 +        }
    6.95 +        return task;
    6.96 +    }
    6.97 +
    6.98 +    private static class Query extends AbstractQuery {
    6.99 +
   6.100 +        private int anchor;
   6.101 +        private volatile Collection<? extends CompletionItem> items =  Collections.<CompletionItem>emptyList();
   6.102 +        private JTextComponent component;
   6.103 +
   6.104 +        @Override
   6.105 +        protected void prepareQuery(JTextComponent component) {
   6.106 +            this.component = component;
   6.107 +        }
   6.108 +
   6.109 +        @Override
   6.110 +        protected void doQuery(CompletionResultSet resultSet, Document doc, int caretOffset) {
   6.111 +            try {
   6.112 +                TplCompletionQuery.CompletionResult result = new TplCompletionQuery(doc, caretOffset).query();
   6.113 +                if(result != null) {
   6.114 +                    items = result.getItems();
   6.115 +                } else {
   6.116 +                    items = Collections.emptyList();
   6.117 +                }
   6.118 +                resultSet.addAllItems(items);
   6.119 +
   6.120 +            } catch (ParseException ex) {
   6.121 +                Exceptions.printStackTrace(ex);
   6.122 +            }
   6.123 +        }
   6.124 +
   6.125 +        @Override
   6.126 +        protected boolean canFilter(JTextComponent component) {
   6.127 +            try {
   6.128 +                Document doc = component.getDocument();
   6.129 +                int offset = component.getCaretPosition();
   6.130 +                if(offset < anchor) {
   6.131 +                    return false;
   6.132 +                }
   6.133 +
   6.134 +                String prefix = doc.getText(anchor, offset - anchor);
   6.135 +
   6.136 +                //check the items
   6.137 +                for(CompletionItem item : items) {
   6.138 +                    if(item instanceof TplCompletionItem) {
   6.139 +                        if(startsWithIgnoreCase( ((TplCompletionItem)item).getItemText(), prefix)) {
   6.140 +                            return true; //at least one item will remain
   6.141 +                        }
   6.142 +                    }
   6.143 +                }
   6.144 +
   6.145 +
   6.146 +            } catch (BadLocationException ex) {
   6.147 +                Exceptions.printStackTrace(ex);
   6.148 +            }
   6.149 +
   6.150 +            return false;
   6.151 +
   6.152 +        }
   6.153 +
   6.154 +        @Override
   6.155 +        protected void filter(CompletionResultSet resultSet) {
   6.156 +            try {
   6.157 +                Document doc = component.getDocument();
   6.158 +                int offset = component.getCaretPosition();
   6.159 +                String prefix = doc.getText(anchor, offset - anchor);
   6.160 +
   6.161 +                //check the items
   6.162 +                for(CompletionItem item : items) {
   6.163 +                    if(item instanceof TplCompletionItem) {
   6.164 +                        if(startsWithIgnoreCase(((TplCompletionItem)item).getItemText(), prefix)) {
   6.165 +                            resultSet.addItem(item);
   6.166 +                        }
   6.167 +                    }
   6.168 +                }
   6.169 +
   6.170 +            } catch (BadLocationException ex) {
   6.171 +                Exceptions.printStackTrace(ex);
   6.172 +            } finally {
   6.173 +                resultSet.setAnchorOffset(anchor);
   6.174 +                resultSet.finish();
   6.175 +            }
   6.176 +
   6.177 +        }
   6.178 +
   6.179 +        private static boolean startsWithIgnoreCase(String text, String prefix) {
   6.180 +            return text.toLowerCase(Locale.ENGLISH).startsWith(prefix.toLowerCase(Locale.ENGLISH));
   6.181 +        }
   6.182 +
   6.183 +    }
   6.184 +
   6.185 +    public static class DocQuery extends AbstractQuery {
   6.186 +
   6.187 +        private CompletionItem item;
   6.188 +
   6.189 +        public DocQuery(TplCompletionItem item) {
   6.190 +            this.item = item;
   6.191 +        }
   6.192 +
   6.193 +        @Override
   6.194 +        protected void doQuery(CompletionResultSet resultSet, Document doc, int caretOffset) {
   6.195 +            if (item == null) {
   6.196 +                try {
   6.197 +                    //item == null means that the DocQuery is invoked
   6.198 +                    //based on the explicit documentation opening request
   6.199 +                    //(not ivoked by selecting a completion item in the list)
   6.200 +                    TplCompletionQuery.CompletionResult result = new TplCompletionQuery(doc, caretOffset).query();
   6.201 +                    if (result != null && result.getItems().size() > 0) {
   6.202 +                        item = result.getItems().iterator().next();
   6.203 +                    }
   6.204 +                } catch (ParseException ex) {
   6.205 +                    Exceptions.printStackTrace(ex);
   6.206 +                }
   6.207 +            }
   6.208 +            TplCompletionItem tplItem = (TplCompletionItem) item;
   6.209 +//            if (tplItem != null && tplItem.getHelp() != null) {
   6.210 +//                resultSet.setDocumentation(new DocItem(tplItem));
   6.211 +//            }
   6.212 +        }
   6.213 +    }
   6.214 +
   6.215 +    private static abstract class AbstractQuery extends AsyncCompletionQuery {
   6.216 +
   6.217 +        @Override
   6.218 +        protected void preQueryUpdate(JTextComponent component) {
   6.219 +            checkHideCompletion((BaseDocument) component.getDocument(), component.getCaretPosition());
   6.220 +        }
   6.221 +
   6.222 +        @Override
   6.223 +        protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
   6.224 +            try {
   6.225 +                doQuery(resultSet, doc, caretOffset);
   6.226 +            } finally {
   6.227 +                resultSet.finish();
   6.228 +            }
   6.229 +        }
   6.230 +
   6.231 +        abstract void doQuery(CompletionResultSet resultSet, Document doc, int caretOffset);
   6.232 +    }
   6.233 +
   6.234 +    private static void checkHideCompletion(final BaseDocument doc, final int caretOffset) {
   6.235 +        //test whether we are just in text and eventually close the opened completion
   6.236 +        //this is handy after end tag autocompletion when user doesn't complete the
   6.237 +        //end tag and just types a text
   6.238 +        //test whether the user typed an ending quotation in the attribute value
   6.239 +        doc.render(new Runnable() {
   6.240 +
   6.241 +            @Override
   6.242 +            public void run() {
   6.243 +                TokenHierarchy tokenHierarchy = TokenHierarchy.get(doc);
   6.244 +                TokenSequence tokenSequence = tokenHierarchy.tokenSequence();
   6.245 +
   6.246 +                tokenSequence.move(caretOffset == 0 ? 0 : caretOffset - 1);
   6.247 +                if (!tokenSequence.moveNext()) {
   6.248 +                    return;
   6.249 +                }
   6.250 +
   6.251 +//                Token tokenItem = tokenSequence.token();
   6.252 +//                if (tokenItem.id() == HTMLTokenId.TEXT && !tokenItem.text().toString().startsWith("<") && !tokenItem.text().toString().startsWith("&")) {
   6.253 +//                    hideCompletion();
   6.254 +//                }
   6.255 +            }
   6.256 +        });
   6.257 +    }
   6.258 +
   6.259 +//    static boolean checkOpenCompletion(Document document, final int dotPos, String typedText) {
   6.260 +//        final BaseDocument doc = (BaseDocument) document;
   6.261 +//        switch (typedText.charAt(typedText.length() - 1)) {
   6.262 +//            case '/':
   6.263 +//                if (dotPos >= 2) { // last char before inserted slash
   6.264 +//                    try {
   6.265 +//                        String txtBeforeSpace = doc.getText(dotPos - 2, 2);
   6.266 +//                        if (txtBeforeSpace.equals("</")) // NOI18N
   6.267 +//                        {
   6.268 +//                            return true;
   6.269 +//                        }
   6.270 +//                    } catch (BadLocationException e) {
   6.271 +//                        //no action
   6.272 +//                    }
   6.273 +//                }
   6.274 +//                break;
   6.275 +//            case ' ':
   6.276 +//                doc.readLock();
   6.277 +//                try {
   6.278 +//                    TokenSequence ts = Utils.getJoinedHtmlSequence(doc, dotPos);
   6.279 +//                    if (ts == null) {
   6.280 +//                        //no suitable token sequence found
   6.281 +//                        return false;
   6.282 +//                    }
   6.283 +//
   6.284 +//                    int diff = ts.move(dotPos);
   6.285 +//                    if (ts.moveNext() &&
   6.286 +//                            ts.token().id() == HTMLTokenId.WS && //if current token is whitespace
   6.287 +//                            diff == 1 && //and the caret is just after one char of the token
   6.288 +//                            ts.movePrevious() && //then go back and check if the token before is one of following types
   6.289 +//                            (ts.token().id() == HTMLTokenId.TAG_OPEN ||
   6.290 +//                            ts.token().id() == HTMLTokenId.VALUE ||
   6.291 +//                            ts.token().id() == HTMLTokenId.VALUE_CSS ||
   6.292 +//                            ts.token().id() == HTMLTokenId.VALUE_JAVASCRIPT)) {
   6.293 +//                        return true;
   6.294 +//                    }
   6.295 +//
   6.296 +//                } finally {
   6.297 +//                    doc.readUnlock();
   6.298 +//                }
   6.299 +//                break;
   6.300 +//            case '<':
   6.301 +//            case '&':
   6.302 +//                return true;
   6.303 +//            case '>':
   6.304 +//                //handle tag autocomplete
   6.305 +//                final boolean[] ret = new boolean[1];
   6.306 +//                doc.runAtomic(new Runnable() {
   6.307 +//
   6.308 +//                    @Override
   6.309 +//                    public void run() {
   6.310 +//                        TokenSequence ts = Utils.getJoinedHtmlSequence(doc, dotPos);
   6.311 +//                        if (ts == null) {
   6.312 +//                            //no suitable token sequence found
   6.313 +//                            ret[0] = false;
   6.314 +//                        } else {
   6.315 +//                            ts.move(dotPos - 1);
   6.316 +//                            if (ts.moveNext() || ts.movePrevious()) {
   6.317 +//                                if (ts.token().id() == HTMLTokenId.TAG_CLOSE_SYMBOL && !CharSequenceUtilities.equals("/>", ts.token().text())) {
   6.318 +//                                    ret[0] = true;
   6.319 +//                                }
   6.320 +//                            }
   6.321 +//                        }
   6.322 +//                    }
   6.323 +//                });
   6.324 +//                return ret[0];
   6.325 +//
   6.326 +//        }
   6.327 +//        return false;
   6.328 +//
   6.329 +//    }
   6.330 +//
   6.331 +//    private static void hideCompletion() {
   6.332 +//        Completion.get().hideCompletion();
   6.333 +//        Completion.get().hideDocumentation();
   6.334 +//    }
   6.335 +//
   6.336 +//    private static class LinkDocItem implements CompletionDocumentation {
   6.337 +//
   6.338 +//        private URL url;
   6.339 +//
   6.340 +//        public LinkDocItem(URL url) {
   6.341 +//            this.url = url;
   6.342 +//        }
   6.343 +//
   6.344 +//        @Override
   6.345 +//        public String getText() {
   6.346 +//            return null;
   6.347 +//            /*
   6.348 +//            String anchor = HelpManager.getDefault().getAnchorText(url);
   6.349 +//            if(anchor != null)
   6.350 +//            return HelpManager.getDefault().getHelpText(url, anchor);
   6.351 +//            else
   6.352 +//            return HelpManager.getDefault().getHelpText(url);
   6.353 +//             */
   6.354 +//        }
   6.355 +//
   6.356 +//        @Override
   6.357 +//        public URL getURL() {
   6.358 +//            return url;
   6.359 +//        }
   6.360 +//
   6.361 +//        @Override
   6.362 +//        public CompletionDocumentation resolveLink(String link) {
   6.363 +//            return new LinkDocItem(HelpManager.getDefault().getRelativeURL(url, link));
   6.364 +//        }
   6.365 +//
   6.366 +//        @Override
   6.367 +//        public Action getGotoSourceAction() {
   6.368 +//            return null;
   6.369 +//        }
   6.370 +//    }
   6.371 +//
   6.372 +//    private static class NoDocItem implements CompletionDocumentation {
   6.373 +//
   6.374 +//        @Override
   6.375 +//        public String getText() {
   6.376 +//            return NbBundle.getMessage(TplCompletionProvider.class, "MSG_No_Doc_For_Target"); //NOI18N
   6.377 +//        }
   6.378 +//
   6.379 +//        @Override
   6.380 +//        public URL getURL() {
   6.381 +//            return null;
   6.382 +//        }
   6.383 +//
   6.384 +//        @Override
   6.385 +//        public CompletionDocumentation resolveLink(String link) {
   6.386 +//            return null;
   6.387 +//        }
   6.388 +//
   6.389 +//        @Override
   6.390 +//        public Action getGotoSourceAction() {
   6.391 +//            return null;
   6.392 +//        }
   6.393 +//    }
   6.394 +//
   6.395 +//    private static class DocItem implements CompletionDocumentation {
   6.396 +//
   6.397 +//        TplCompletionItem item;
   6.398 +//
   6.399 +//        public DocItem(TplCompletionItem ri) {
   6.400 +//            this.item = ri;
   6.401 +//        }
   6.402 +//
   6.403 +//        @Override
   6.404 +//        public String getText() {
   6.405 +//            return item.getHelp();
   6.406 +//        }
   6.407 +//
   6.408 +//        @Override
   6.409 +//        public URL getURL() {
   6.410 +//            return item.getHelpURL();
   6.411 +//        }
   6.412 +//
   6.413 +//        @Override
   6.414 +//        public CompletionDocumentation resolveLink(String link) {
   6.415 +//            URL itemUrl = HelpManager.getDefault().getHelpURL(item.getHelpId());
   6.416 +//            return itemUrl != null ?
   6.417 +//                new LinkDocItem(HelpManager.getDefault().getRelativeURL(itemUrl, link)) :
   6.418 +//                new NoDocItem();
   6.419 +//        }
   6.420 +//
   6.421 +//        @Override
   6.422 +//        public Action getGotoSourceAction() {
   6.423 +//            return null;
   6.424 +//        }
   6.425 +//    }
   6.426 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/TplCompletionQuery.java	Mon Jun 07 10:06:41 2010 +0200
     7.3 @@ -0,0 +1,111 @@
     7.4 +/*
     7.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     7.6 + *
     7.7 + * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
     7.8 + *
     7.9 + * The contents of this file are subject to the terms of either the GNU
    7.10 + * General Public License Version 2 only ("GPL") or the Common
    7.11 + * Development and Distribution License("CDDL") (collectively, the
    7.12 + * "License"). You may not use this file except in compliance with the
    7.13 + * License. You can obtain a copy of the License at
    7.14 + * http://www.netbeans.org/cddl-gplv2.html
    7.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    7.16 + * specific language governing permissions and limitations under the
    7.17 + * License.  When distributing the software, include this License Header
    7.18 + * Notice in each file and include the License file at
    7.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    7.20 + * particular file as subject to the "Classpath" exception as provided
    7.21 + * by Sun in the GPL Version 2 section of the License file that
    7.22 + * accompanied this code. If applicable, add the following below the
    7.23 + * License Header, with the fields enclosed by brackets [] replaced by
    7.24 + * your own identifying information:
    7.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    7.26 + *
    7.27 + * Contributor(s):
    7.28 + *
    7.29 + * The Original Software is NetBeans. The Initial Developer of the Original
    7.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    7.31 + * Microsystems, Inc. All Rights Reserved.
    7.32 + *
    7.33 + * If you wish your version of this file to be governed by only the CDDL
    7.34 + * or only the GPL Version 2, indicate your decision by adding
    7.35 + * "[Contributor] elects to include this software in this distribution
    7.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    7.37 + * single choice of license, a recipient has the option to distribute
    7.38 + * your version of this file under either the CDDL, the GPL Version 2 or
    7.39 + * to extend the choice of license to its licensees as provided above.
    7.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    7.41 + * Version 2 license, then the option applies only if the new code is
    7.42 + * made subject to such option by the copyright holder.
    7.43 + */
    7.44 +package org.netbeans.modules.php.smarty.editor.completion;
    7.45 +
    7.46 +import java.util.*;
    7.47 +import java.util.Collections;
    7.48 +import javax.swing.text.Document;
    7.49 +import org.netbeans.modules.csl.api.DataLoadersBridge;
    7.50 +import org.netbeans.modules.parsing.api.ParserManager;
    7.51 +import org.netbeans.modules.parsing.api.ResultIterator;
    7.52 +import org.netbeans.modules.parsing.api.Snapshot;
    7.53 +import org.netbeans.modules.parsing.api.Source;
    7.54 +import org.netbeans.modules.parsing.api.UserTask;
    7.55 +import org.netbeans.modules.parsing.spi.ParseException;
    7.56 +import org.netbeans.modules.php.smarty.editor.completion.entries.EntryMetadata;
    7.57 +import org.netbeans.modules.php.smarty.editor.completion.entries.TplCodeCompletionData;
    7.58 +import org.netbeans.spi.editor.completion.CompletionItem;
    7.59 +import org.openide.filesystems.FileObject;
    7.60 +
    7.61 +/**
    7.62 + *
    7.63 + * Tpl completion results finder
    7.64 + *
    7.65 + * @author Martin Fousek
    7.66 + */
    7.67 +public class TplCompletionQuery extends UserTask {
    7.68 +
    7.69 +    private Document document;
    7.70 +    private FileObject file;
    7.71 +    private int offset;
    7.72 +    private CompletionResult completionResult;
    7.73 +
    7.74 +    public TplCompletionQuery(Document document, int offset) {
    7.75 +        this.document = document;
    7.76 +        this.offset = offset;
    7.77 +        this.file = DataLoadersBridge.getDefault().getFileObject(document);
    7.78 +    }
    7.79 +
    7.80 +    public CompletionResult query() throws ParseException {
    7.81 +        Source source = Source.create(document);
    7.82 +        ParserManager.parse(Collections.singleton(source), this);
    7.83 +
    7.84 +        return this.completionResult;
    7.85 +    }
    7.86 +
    7.87 +    @Override
    7.88 +    public void run(ResultIterator resultIterator) throws Exception {
    7.89 +        Snapshot snapshot = resultIterator.getSnapshot();
    7.90 +        int embeddedOffset = snapshot.getEmbeddedOffset(offset);
    7.91 +        String resultMimeType = resultIterator.getSnapshot().getMimeType();
    7.92 +        if (resultMimeType.equals("text/x-tpl")) {
    7.93 +            this.completionResult = query(resultIterator);
    7.94 +        }
    7.95 +    }
    7.96 +
    7.97 +    private CompletionResult query(ResultIterator resultIterator) {
    7.98 +        return new CompletionResult(TplCodeCompletionData.getCCData());
    7.99 +    }
   7.100 +
   7.101 +    public static class CompletionResult {
   7.102 +
   7.103 +        private Collection<? extends CompletionItem> items;
   7.104 +
   7.105 +        CompletionResult(Collection<? extends CompletionItem> items) {
   7.106 +            this.items = items;
   7.107 +        }
   7.108 +
   7.109 +        public Collection<? extends CompletionItem> getItems() {
   7.110 +            return items;
   7.111 +        }
   7.112 +    }
   7.113 +}
   7.114 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/entries/CCDataBuiltInFunction.java	Mon Jun 07 10:06:41 2010 +0200
     8.3 @@ -0,0 +1,53 @@
     8.4 +/*
     8.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     8.6 + *
     8.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
     8.8 + *
     8.9 + * The contents of this file are subject to the terms of either the GNU
    8.10 + * General Public License Version 2 only ("GPL") or the Common
    8.11 + * Development and Distribution License("CDDL") (collectively, the
    8.12 + * "License"). You may not use this file except in compliance with the
    8.13 + * License. You can obtain a copy of the License at
    8.14 + * http://www.netbeans.org/cddl-gplv2.html
    8.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    8.16 + * specific language governing permissions and limitations under the
    8.17 + * License.  When distributing the software, include this License Header
    8.18 + * Notice in each file and include the License file at
    8.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    8.20 + * particular file as subject to the "Classpath" exception as provided
    8.21 + * by Sun in the GPL Version 2 section of the License file that
    8.22 + * accompanied this code. If applicable, add the following below the
    8.23 + * License Header, with the fields enclosed by brackets [] replaced by
    8.24 + * your own identifying information:
    8.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    8.26 + *
    8.27 + * If you wish your version of this file to be governed by only the CDDL
    8.28 + * or only the GPL Version 2, indicate your decision by adding
    8.29 + * "[Contributor] elects to include this software in this distribution
    8.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    8.31 + * single choice of license, a recipient has the option to distribute
    8.32 + * your version of this file under either the CDDL, the GPL Version 2 or
    8.33 + * to extend the choice of license to its licensees as provided above.
    8.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    8.35 + * Version 2 license, then the option applies only if the new code is
    8.36 + * made subject to such option by the copyright holder.
    8.37 + *
    8.38 + * Contributor(s):
    8.39 + *
    8.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
    8.41 + */
    8.42 +
    8.43 +package org.netbeans.modules.php.smarty.editor.completion.entries;
    8.44 +
    8.45 +/**
    8.46 + *
    8.47 + * @author Martin Fousek
    8.48 + */
    8.49 +public class CCDataBuiltInFunction extends EntryMetadata {
    8.50 +
    8.51 +    public CCDataBuiltInFunction(String keyword, String help) {
    8.52 +       super(keyword, help);
    8.53 +    }
    8.54 +
    8.55 +
    8.56 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/entries/CodeCompletionEntries.java	Mon Jun 07 10:06:41 2010 +0200
     9.3 @@ -0,0 +1,93 @@
     9.4 +/*
     9.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 + *
     9.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
     9.8 + *
     9.9 + * The contents of this file are subject to the terms of either the GNU
    9.10 + * General Public License Version 2 only ("GPL") or the Common
    9.11 + * Development and Distribution License("CDDL") (collectively, the
    9.12 + * "License"). You may not use this file except in compliance with the
    9.13 + * License. You can obtain a copy of the License at
    9.14 + * http://www.netbeans.org/cddl-gplv2.html
    9.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    9.16 + * specific language governing permissions and limitations under the
    9.17 + * License.  When distributing the software, include this License Header
    9.18 + * Notice in each file and include the License file at
    9.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    9.20 + * particular file as subject to the "Classpath" exception as provided
    9.21 + * by Sun in the GPL Version 2 section of the License file that
    9.22 + * accompanied this code. If applicable, add the following below the
    9.23 + * License Header, with the fields enclosed by brackets [] replaced by
    9.24 + * your own identifying information:
    9.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    9.26 + *
    9.27 + * If you wish your version of this file to be governed by only the CDDL
    9.28 + * or only the GPL Version 2, indicate your decision by adding
    9.29 + * "[Contributor] elects to include this software in this distribution
    9.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    9.31 + * single choice of license, a recipient has the option to distribute
    9.32 + * your version of this file under either the CDDL, the GPL Version 2 or
    9.33 + * to extend the choice of license to its licensees as provided above.
    9.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    9.35 + * Version 2 license, then the option applies only if the new code is
    9.36 + * made subject to such option by the copyright holder.
    9.37 + *
    9.38 + * Contributor(s):
    9.39 + *
    9.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
    9.41 + */
    9.42 +
    9.43 +package org.netbeans.modules.php.smarty.editor.completion.entries;
    9.44 +
    9.45 +import java.io.IOException;
    9.46 +import java.io.InputStream;
    9.47 +import java.util.ArrayList;
    9.48 +import java.util.Collection;
    9.49 +import java.util.HashMap;
    9.50 +import java.util.Map;
    9.51 +import java.util.TreeMap;
    9.52 +import javax.xml.parsers.DocumentBuilder;
    9.53 +import javax.xml.parsers.DocumentBuilderFactory;
    9.54 +import javax.xml.parsers.ParserConfigurationException;
    9.55 +import org.w3c.dom.Document;
    9.56 +import org.w3c.dom.Element;
    9.57 +import org.w3c.dom.Node;
    9.58 +import org.w3c.dom.NodeList;
    9.59 +import org.xml.sax.SAXException;
    9.60 +
    9.61 +/**
    9.62 + *
    9.63 + * @author Martin Fousek
    9.64 + */
    9.65 +public class CodeCompletionEntries {
    9.66 +
    9.67 +    public CodeCompletionEntries() {
    9.68 +    }
    9.69 +
    9.70 +    protected static Collection<EntryMetadata> readAllCodeCompletionEntriesFromXML(InputStream inputStream) throws IOException, ParserConfigurationException, SAXException {
    9.71 +        Collection<EntryMetadata> ccEntries = null;
    9.72 +        if (ccEntries == null) {
    9.73 +            ccEntries = new ArrayList<EntryMetadata>();
    9.74 +            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    9.75 +            DocumentBuilder db = dbf.newDocumentBuilder();
    9.76 +            Document doc = db.parse(inputStream);
    9.77 +            doc.getDocumentElement().normalize();
    9.78 +
    9.79 +            NodeList allEntriesList = doc.getElementsByTagName("entry");
    9.80 +            for (int i = 0; i < allEntriesList.getLength(); i++) {
    9.81 +                Node ccNode = allEntriesList.item(i);
    9.82 +
    9.83 +                if (ccNode.getNodeType() == Node.ELEMENT_NODE){
    9.84 +                    Element elem = (Element) ccNode;
    9.85 +                    NodeList desc = elem.getElementsByTagName("description");
    9.86 +                    ccEntries.add(new CCDataBuiltInFunction(elem.getAttribute("name"), desc.item(0).getTextContent()));
    9.87 +                }
    9.88 +            }
    9.89 +        }
    9.90 +
    9.91 +        return ccEntries;
    9.92 +    }
    9.93 +
    9.94 +    
    9.95 +    
    9.96 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/entries/EntryMetadata.java	Mon Jun 07 10:06:41 2010 +0200
    10.3 @@ -0,0 +1,65 @@
    10.4 +/*
    10.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    10.6 + *
    10.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    10.8 + *
    10.9 + * The contents of this file are subject to the terms of either the GNU
   10.10 + * General Public License Version 2 only ("GPL") or the Common
   10.11 + * Development and Distribution License("CDDL") (collectively, the
   10.12 + * "License"). You may not use this file except in compliance with the
   10.13 + * License. You can obtain a copy of the License at
   10.14 + * http://www.netbeans.org/cddl-gplv2.html
   10.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   10.16 + * specific language governing permissions and limitations under the
   10.17 + * License.  When distributing the software, include this License Header
   10.18 + * Notice in each file and include the License file at
   10.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   10.20 + * particular file as subject to the "Classpath" exception as provided
   10.21 + * by Sun in the GPL Version 2 section of the License file that
   10.22 + * accompanied this code. If applicable, add the following below the
   10.23 + * License Header, with the fields enclosed by brackets [] replaced by
   10.24 + * your own identifying information:
   10.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   10.26 + *
   10.27 + * If you wish your version of this file to be governed by only the CDDL
   10.28 + * or only the GPL Version 2, indicate your decision by adding
   10.29 + * "[Contributor] elects to include this software in this distribution
   10.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   10.31 + * single choice of license, a recipient has the option to distribute
   10.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   10.33 + * to extend the choice of license to its licensees as provided above.
   10.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   10.35 + * Version 2 license, then the option applies only if the new code is
   10.36 + * made subject to such option by the copyright holder.
   10.37 + *
   10.38 + * Contributor(s):
   10.39 + *
   10.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
   10.41 + */
   10.42 +
   10.43 +package org.netbeans.modules.php.smarty.editor.completion.entries;
   10.44 +
   10.45 +/**
   10.46 + *
   10.47 + * @author Martin Fousek
   10.48 + */
   10.49 +public abstract class EntryMetadata {
   10.50 +
   10.51 +    private String keyword;
   10.52 +    private String help;
   10.53 +
   10.54 +    public EntryMetadata(String keyword, String help) {
   10.55 +        this.keyword = keyword;
   10.56 +        this.help = help;
   10.57 +    }
   10.58 +
   10.59 +    public String getKeyword() {
   10.60 +        return keyword;
   10.61 +    }
   10.62 +
   10.63 +    public String getHelp() {
   10.64 +        return help;
   10.65 +    }
   10.66 +
   10.67 +    
   10.68 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/entries/TplCodeCompletionData.java	Mon Jun 07 10:06:41 2010 +0200
    11.3 @@ -0,0 +1,100 @@
    11.4 +/*
    11.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    11.6 + *
    11.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    11.8 + *
    11.9 + * The contents of this file are subject to the terms of either the GNU
   11.10 + * General Public License Version 2 only ("GPL") or the Common
   11.11 + * Development and Distribution License("CDDL") (collectively, the
   11.12 + * "License"). You may not use this file except in compliance with the
   11.13 + * License. You can obtain a copy of the License at
   11.14 + * http://www.netbeans.org/cddl-gplv2.html
   11.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   11.16 + * specific language governing permissions and limitations under the
   11.17 + * License.  When distributing the software, include this License Header
   11.18 + * Notice in each file and include the License file at
   11.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   11.20 + * particular file as subject to the "Classpath" exception as provided
   11.21 + * by Sun in the GPL Version 2 section of the License file that
   11.22 + * accompanied this code. If applicable, add the following below the
   11.23 + * License Header, with the fields enclosed by brackets [] replaced by
   11.24 + * your own identifying information:
   11.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   11.26 + *
   11.27 + * If you wish your version of this file to be governed by only the CDDL
   11.28 + * or only the GPL Version 2, indicate your decision by adding
   11.29 + * "[Contributor] elects to include this software in this distribution
   11.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   11.31 + * single choice of license, a recipient has the option to distribute
   11.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   11.33 + * to extend the choice of license to its licensees as provided above.
   11.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   11.35 + * Version 2 license, then the option applies only if the new code is
   11.36 + * made subject to such option by the copyright holder.
   11.37 + *
   11.38 + * Contributor(s):
   11.39 + *
   11.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
   11.41 + */
   11.42 +package org.netbeans.modules.php.smarty.editor.completion.entries;
   11.43 +
   11.44 +import java.io.InputStream;
   11.45 +import java.util.ArrayList;
   11.46 +import java.util.Arrays;
   11.47 +import java.util.Collection;
   11.48 +import java.util.List;
   11.49 +import java.util.Map;
   11.50 +import java.util.TreeMap;
   11.51 +import org.netbeans.modules.php.smarty.editor.completion.TplCompletionItem;
   11.52 +import org.netbeans.modules.php.smarty.editor.completion.TplCompletionItem.BuiltInFunction;
   11.53 +import org.netbeans.modules.php.smarty.editor.completion.TplCompletionItem.VariableModifiers;
   11.54 +import org.netbeans.spi.editor.completion.CompletionItem;
   11.55 +import org.openide.util.Exceptions;
   11.56 +
   11.57 +/**
   11.58 + *
   11.59 + * @author Martin Fousek
   11.60 + */
   11.61 +public class TplCodeCompletionData {
   11.62 +
   11.63 +    private final static Collection<TplCompletionItem> completionItems = new ArrayList<TplCompletionItem>();
   11.64 +    private final static String[] completionTypes = {"built-in-functions", "variable-modifiers"};
   11.65 +
   11.66 +    static {
   11.67 +        loadCCData();
   11.68 +    }
   11.69 +
   11.70 +    public static Collection<TplCompletionItem> getCCData() {
   11.71 +        return completionItems;
   11.72 +    }
   11.73 +
   11.74 +    private static void loadCCData() {
   11.75 +        for (String completionType : completionTypes) {
   11.76 +            Collection<EntryMetadata> ccList = parseCCData(completionType);
   11.77 +            if (completionType.equals("built-in-functions")) {
   11.78 +                for (EntryMetadata entryMetadata : ccList) {
   11.79 +                    completionItems.add(new BuiltInFunction(entryMetadata.getKeyword(), 0, null));
   11.80 +                }
   11.81 +            }
   11.82 +            else if (completionType.equals("variable-modifiers")) {
   11.83 +                for (EntryMetadata entryMetadata : ccList) {
   11.84 +                    completionItems.add(new VariableModifiers(entryMetadata.getKeyword(), 0, null));
   11.85 +                }
   11.86 +            }
   11.87 +        }
   11.88 +    }
   11.89 +
   11.90 +    private static Collection<EntryMetadata> parseCCData(String filePath) {
   11.91 +        Collection<EntryMetadata> ccList = new ArrayList<EntryMetadata>();
   11.92 +        InputStream inputStream = TplCodeCompletionData.class.getResourceAsStream("defs/" + filePath + ".xml"); //NOI18N
   11.93 +
   11.94 +        try {
   11.95 +            Collection<EntryMetadata> ccData = CodeCompletionEntries.readAllCodeCompletionEntriesFromXML(inputStream);
   11.96 +            ccList.addAll(ccData);
   11.97 +
   11.98 +        } catch (Exception ex) {
   11.99 +            Exceptions.printStackTrace(ex);
  11.100 +        }
  11.101 +        return ccList;
  11.102 +    }
  11.103 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/entries/defs/built-in-functions.xml	Mon Jun 07 10:06:41 2010 +0200
    12.3 @@ -0,0 +1,301 @@
    12.4 +<?xml version="1.0" encoding="UTF-8"?>
    12.5 +
    12.6 +<!--
    12.7 +    Document   : built-in-functions.xml
    12.8 +    Created on : May 11, 2010, 10:07 AM
    12.9 +    Author     : Martin Fousek
   12.10 +    Description:
   12.11 +        Purpose of the document is storage for Smarty code completion keywords - built-in functions.
   12.12 +-->
   12.13 +
   12.14 +<entries>
   12.15 +    <entry name="capture">
   12.16 +        <description>{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture}  is collected into the variable specified in the name  attribute. The captured content can be used in the template from the variable $smarty.capture.foo where "foo" is the value passed in the name attribute. If you do not supply the name attribute, then "default" will be used as the name ie $smarty.capture.default. </description>
   12.17 +        <attributes>
   12.18 +            <attribute name="name">
   12.19 +                <type>string</type>
   12.20 +                <required>no</required>
   12.21 +                <default>default</default>
   12.22 +                <description>The name of the captured block</description>
   12.23 +            </attribute>
   12.24 +            <attribute name="assign">
   12.25 +                <type>string</type>
   12.26 +                <required>no</required>
   12.27 +                <default>n/a</default>
   12.28 +                <description>The variable name where to assign the captured output to</description>
   12.29 +            </attribute>
   12.30 +        </attributes>
   12.31 +    </entry>
   12.32 +    
   12.33 +    <entry name="config_load">
   12.34 +        <description>{config_load} is used for loading config #variables#  from a configuration file into the template. </description>
   12.35 +        <attributes>
   12.36 +            <attribute name="file">
   12.37 +                <type>string</type>
   12.38 +                <required>yes</required>
   12.39 +                <default>n/a</default>
   12.40 +                <description>The name of the config file to include</description>
   12.41 +            </attribute>
   12.42 +            <attribute name="section">
   12.43 +                <type>string</type>
   12.44 +                <required>no</required>
   12.45 +                <default>n/a</default>
   12.46 +                <description>The name of the section to load</description>
   12.47 +            </attribute>
   12.48 +            <attribute name="scope">
   12.49 +                <type>string</type>
   12.50 +                <required>no</required>
   12.51 +                <default>local</default>
   12.52 +                <description>How the scope of the loaded variables are treated, which must be one of local, parent or global. local means variables are loaded into the local template context. parent means variables are loaded into both the local context and the parent template that called it. global means variables are available to all templates.</description>
   12.53 +            </attribute>
   12.54 +            <attribute name="global">
   12.55 +                <type>boolean</type>
   12.56 +                <required>yes</required>
   12.57 +                <default>no</default>
   12.58 +                <description>Whether or not variables are visible to the parent template, same as scope=parent. NOTE: This attribute is deprecated by the scope attribute, but still supported. If scope is supplied, this value is ignored. </description>
   12.59 +            </attribute>
   12.60 +        </attributes>
   12.61 +    </entry>
   12.62 +
   12.63 +    <entry name="foreach">
   12.64 +        <description>{config_load} is used for loading config #variables#  from a configuration file into the template. </description>
   12.65 +        <attributes>
   12.66 +            <attribute name="from">
   12.67 +                <type>array</type>
   12.68 +                <required>yes</required>
   12.69 +                <default>n/a</default>
   12.70 +                <description>The array you are looping through</description>
   12.71 +            </attribute>
   12.72 +            <attribute name="item">
   12.73 +                <type>string</type>
   12.74 +                <required>yes</required>
   12.75 +                <default>n/a</default>
   12.76 +                <description>The name of the variable that is the current element</description>
   12.77 +            </attribute>
   12.78 +            <attribute name="key">
   12.79 +                <type>string</type>
   12.80 +                <required>no</required>
   12.81 +                <default>n/a</default>
   12.82 +                <description>The name of the variable that is the current key</description>
   12.83 +            </attribute>
   12.84 +            <attribute name="name">
   12.85 +                <type>string</type>
   12.86 +                <required>no</required>
   12.87 +                <default>n/a</default>
   12.88 +                <description>The name of the foreach loop for accessing foreach properties</description>
   12.89 +            </attribute>
   12.90 +        </attributes>
   12.91 +    </entry>
   12.92 +
   12.93 +    <entry name="foreachelse">
   12.94 +        <description>{config_load} is used for loading config #variables#  from a configuration file into the template. </description>
   12.95 +        <attributes>
   12.96 +            <attribute name="from">
   12.97 +                <type>array</type>
   12.98 +                <required>yes</required>
   12.99 +                <default>n/a</default>
  12.100 +                <description>The array you are looping through</description>
  12.101 +            </attribute>
  12.102 +            <attribute name="item">
  12.103 +                <type>string</type>
  12.104 +                <required>yes</required>
  12.105 +                <default>n/a</default>
  12.106 +                <description>The name of the variable that is the current element</description>
  12.107 +            </attribute>
  12.108 +            <attribute name="key">
  12.109 +                <type>string</type>
  12.110 +                <required>no</required>
  12.111 +                <default>n/a</default>
  12.112 +                <description>The name of the variable that is the current key</description>
  12.113 +            </attribute>
  12.114 +            <attribute name="name">
  12.115 +                <type>string</type>
  12.116 +                <required>no</required>
  12.117 +                <default>n/a</default>
  12.118 +                <description>The name of the foreach loop for accessing foreach properties</description>
  12.119 +            </attribute>
  12.120 +        </attributes>
  12.121 +    </entry>
  12.122 +
  12.123 +    <entry name="if">
  12.124 +        <description>{if} statements in Smarty have much the same flexibility as PHP if statements, with a few added features for the template engine. Every {if} must be paired with a matching {/if}. {else} and {elseif} are also permitted. All PHP conditionals and functions are recognized, such as ||, or, &amp;&amp;, and, is_array(), etc. If $security is enabled, only PHP functions from the IF_FUNCS array from $security_settings are allowed.</description>
  12.125 +    </entry>
  12.126 +
  12.127 +    <entry name="else">
  12.128 +        <description>{if} statements in Smarty have much the same flexibility as PHP if statements, with a few added features for the template engine. Every {if} must be paired with a matching {/if}. {else} and {elseif} are also permitted. All PHP conditionals and functions are recognized, such as ||, or, &amp;&amp;, and, is_array(), etc. If $security is enabled, only PHP functions from the IF_FUNCS array from $security_settings are allowed.</description>
  12.129 +    </entry>
  12.130 +
  12.131 +    <entry name="elseif">
  12.132 +        <description>{if} statements in Smarty have much the same flexibility as PHP if statements, with a few added features for the template engine. Every {if} must be paired with a matching {/if}. {else} and {elseif} are also permitted. All PHP conditionals and functions are recognized, such as ||, or, &amp;&amp;, and, is_array(), etc. If $security is enabled, only PHP functions from the IF_FUNCS array from $security_settings are allowed.</description>
  12.133 +    </entry>
  12.134 +
  12.135 +    <entry name="include">
  12.136 +        <description>{include} tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template. </description>
  12.137 +        <attributes>
  12.138 +            <attribute name="file">
  12.139 +                <type>string</type>
  12.140 +                <required>yes</required>
  12.141 +                <default>n/a</default>
  12.142 +                <description>The name of the template file to include</description>
  12.143 +            </attribute>
  12.144 +            <attribute name="assign">
  12.145 +                <type>string</type>
  12.146 +                <required>no</required>
  12.147 +                <default>n/a</default>
  12.148 +                <description>The name of the variable that the output of include will be assigned to</description>
  12.149 +            </attribute>
  12.150 +        </attributes>
  12.151 +    </entry>
  12.152 +
  12.153 +    <entry name="include_php">
  12.154 +        <description> {include_php} tags are used to include a php script in your template. If $security is enabled, then the php script must be located in the $trusted_dir path. The {include_php} tag must have the attribute file, which contains the path to the included php file, either relative to $trusted_dir, or an absolute path. By default, php files are only included once even if called multiple times in the template. You can specify that it should be included every time with the once attribute. Setting once to FALSE will include the php script each time it is included in the template. You can optionally pass the assign attribute, which will specify a template variable name that the output of {include_php} will be assigned to instead of displayed. The smarty object is available as $this within the PHP script that you include. </description>
  12.155 +        <attributes>
  12.156 +            <attribute name="file">
  12.157 +                <type>string</type>
  12.158 +                <required>yes</required>
  12.159 +                <default>n/a</default>
  12.160 +                <description>The name of the php file to include</description>
  12.161 +            </attribute>
  12.162 +            <attribute name="once">
  12.163 +                <type>boolean</type>
  12.164 +                <required>no</required>
  12.165 +                <default>true</default>
  12.166 +                <description>whether or not to include the php file more than once if included multiple times</description>
  12.167 +            </attribute>
  12.168 +            <attribute name="assign">
  12.169 +                <type>string</type>
  12.170 +                <required>no</required>
  12.171 +                <default>n/a</default>
  12.172 +                <description>The name of the variable that the output of include_php will be assigned to</description>
  12.173 +            </attribute>
  12.174 +        </attributes>
  12.175 +    </entry>
  12.176 +
  12.177 +    <entry name="insert">
  12.178 +        <description>{insert} tags work much like {include} tags, except that {insert} tags are NOT cached when template caching  is enabled. They will be executed on every invocation of the template. </description>
  12.179 +        <attributes>
  12.180 +            <attribute name="name">
  12.181 +                <type>string</type>
  12.182 +                <required>yes</required>
  12.183 +                <default>n/a</default>
  12.184 +                <description>The name of the insert function (insert_name)</description>
  12.185 +            </attribute>
  12.186 +            <attribute name="assign">
  12.187 +                <type>string</type>
  12.188 +                <required>no</required>
  12.189 +                <default>n/a</default>
  12.190 +                <description>The name of the template variable the output will be assigned to</description>
  12.191 +            </attribute>
  12.192 +            <attribute name="script">
  12.193 +                <type>string</type>
  12.194 +                <required>no</required>
  12.195 +                <default>n/a</default>
  12.196 +                <description>The name of the php script that is included before the insert function is called</description>
  12.197 +            </attribute>
  12.198 +        </attributes>
  12.199 +    </entry>
  12.200 +
  12.201 +    <entry name="ldelim">
  12.202 +        <description>{ldelim} and {rdelim} are used for escaping  template delimiters, by default { and }. You can also use {literal}{/literal}  to escape blocks of text eg Javascript or CSS. See also the complimentary {$smarty.ldelim}. </description>
  12.203 +    </entry>
  12.204 +
  12.205 +    <entry name="rdelim">
  12.206 +        <description>{ldelim} and {rdelim} are used for escaping  template delimiters, by default { and }. You can also use {literal}{/literal}  to escape blocks of text eg Javascript or CSS. See also the complimentary {$smarty.ldelim}. </description>
  12.207 +    </entry>
  12.208 +
  12.209 +    <entry name="literal">
  12.210 +        <description>{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter  syntax. Anything within {literal}{/literal} tags is not interpreted, but displayed as-is. If you need template tags embedded in a {literal}  block, consider using {ldelim}{rdelim} to escape the individual delimiters instead. </description>
  12.211 +    </entry>
  12.212 +
  12.213 +    <entry name="php">
  12.214 +        <description>The {php} tags allow PHP code to be embedded directly into the template. They will not be escaped, regardless of the $php_handling setting. This is for advanced users only, not normally needed and not recommended. </description>
  12.215 +    </entry>
  12.216 +
  12.217 +    <entry name="section">
  12.218 +        <description>A {section}  is for looping over arrays of data, unlike {foreach}  which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag. </description>
  12.219 +        <attributes>
  12.220 +            <attribute name="name">
  12.221 +                <type>string</type>
  12.222 +                <required>yes</required>
  12.223 +                <default>n/a</default>
  12.224 +                <description>The name of the section</description>
  12.225 +            </attribute>
  12.226 +            <attribute name="loop">
  12.227 +                <type>mixed</type>
  12.228 +                <required>yes</required>
  12.229 +                <default>n/a</default>
  12.230 +                <description>Value to determine the number of loop iterations</description>
  12.231 +            </attribute>
  12.232 +            <attribute name="start">
  12.233 +                <type>integer</type>
  12.234 +                <required>no</required>
  12.235 +                <default>0</default>
  12.236 +                <description>The index position that the section will begin looping. If the value is negative, the start position is calculated from the end of the array. For example, if there are seven values in the loop array and start is -2, the start index is 5. Invalid values (values outside of the length of the loop array) are automatically truncated to the closest valid value.</description>
  12.237 +            </attribute>
  12.238 +            <attribute name="step">
  12.239 +                <type>integer</type>
  12.240 +                <required>no</required>
  12.241 +                <default>1</default>
  12.242 +                <description>The step value that will be used to traverse the loop array. For example, step=2 will loop on index 0,2,4, etc. If step is negative, it will step through the array backwards.</description>
  12.243 +            </attribute>
  12.244 +            <attribute name="max">
  12.245 +                <type>integer</type>
  12.246 +                <required>no</required>
  12.247 +                <default>n/a</default>
  12.248 +                <description>Sets the maximum number of times the section will loop.</description>
  12.249 +            </attribute>
  12.250 +            <attribute name="show">
  12.251 +                <type>boolean</type>
  12.252 +                <required>no</required>
  12.253 +                <default>true</default>
  12.254 +                <description>Determines whether or not to show this section</description>
  12.255 +            </attribute>
  12.256 +        </attributes>
  12.257 +    </entry>
  12.258 +
  12.259 +    <entry name="sectionelse">
  12.260 +        <description>A {section}  is for looping over arrays of data, unlike {foreach}  which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag. </description>
  12.261 +        <attributes>
  12.262 +            <attribute name="name">
  12.263 +                <type>string</type>
  12.264 +                <required>yes</required>
  12.265 +                <default>n/a</default>
  12.266 +                <description>The name of the section</description>
  12.267 +            </attribute>
  12.268 +            <attribute name="loop">
  12.269 +                <type>mixed</type>
  12.270 +                <required>yes</required>
  12.271 +                <default>n/a</default>
  12.272 +                <description>Value to determine the number of loop iterations</description>
  12.273 +            </attribute>
  12.274 +            <attribute name="start">
  12.275 +                <type>integer</type>
  12.276 +                <required>no</required>
  12.277 +                <default>0</default>
  12.278 +                <description>The index position that the section will begin looping. If the value is negative, the start position is calculated from the end of the array. For example, if there are seven values in the loop array and start is -2, the start index is 5. Invalid values (values outside of the length of the loop array) are automatically truncated to the closest valid value.</description>
  12.279 +            </attribute>
  12.280 +            <attribute name="step">
  12.281 +                <type>integer</type>
  12.282 +                <required>no</required>
  12.283 +                <default>1</default>
  12.284 +                <description>The step value that will be used to traverse the loop array. For example, step=2 will loop on index 0,2,4, etc. If step is negative, it will step through the array backwards.</description>
  12.285 +            </attribute>
  12.286 +            <attribute name="max">
  12.287 +                <type>integer</type>
  12.288 +                <required>no</required>
  12.289 +                <default>n/a</default>
  12.290 +                <description>Sets the maximum number of times the section will loop.</description>
  12.291 +            </attribute>
  12.292 +            <attribute name="show">
  12.293 +                <type>boolean</type>
  12.294 +                <required>no</required>
  12.295 +                <default>true</default>
  12.296 +                <description>Determines whether or not to show this section</description>
  12.297 +            </attribute>
  12.298 +        </attributes>
  12.299 +    </entry>
  12.300 +
  12.301 +    <entry name="strip">
  12.302 +        <description> Many times web designers run into the issue where white space and carriage returns affect the output of the rendered HTML (browser "features"), so you must run all your tags together in the template to get the desired results. This usually ends up in unreadable or unmanageable templates. Anything within {strip}{/strip} tags are stripped of the extra spaces or carriage returns at the beginnings and ends of the lines before they are displayed. This way you can keep your templates readable, and not worry about extra white space causing problems. Note: {strip}{/strip} does not affect the contents of template variables, see the strip modifier instead.  </description>
  12.303 +    </entry>
  12.304 +</entries>
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/completion/entries/defs/variable-modifiers.xml	Mon Jun 07 10:06:41 2010 +0200
    13.3 @@ -0,0 +1,280 @@
    13.4 +<?xml version="1.0" encoding="UTF-8"?>
    13.5 +
    13.6 +<!--
    13.7 +    Document   : variable-modifiers.xml
    13.8 +    Created on : Jun 1, 2010, 14:22 AM
    13.9 +    Author     : Martin Fousek
   13.10 +    Description:
   13.11 +        Purpose of the document is storage for Smarty code completion keywords - variable modifiers.
   13.12 +-->
   13.13 +
   13.14 +<entries>
   13.15 +    <entry name="capitalize">
   13.16 +        <description>This is used to capitalize the first letter of all words in a variable. This is similar to the PHP  ucfirst() function. </description>
   13.17 +        <attributes>
   13.18 +            <attribute position="1">
   13.19 +                <type>boolean</type>
   13.20 +                <required>no</required>
   13.21 +                <default>false</default>
   13.22 +                <description>This determines whether or not words with digits will be uppercased</description>
   13.23 +            </attribute>
   13.24 +        </attributes>
   13.25 +    </entry>
   13.26 +    
   13.27 +    <entry name="cat">
   13.28 +        <description>This value is concatenated to the given variable. </description>
   13.29 +        <attributes>
   13.30 +            <attribute position="1">
   13.31 +                <type>string</type>
   13.32 +                <required>no</required>
   13.33 +                <default>empty</default>
   13.34 +                <description>This value to catenate to the given variable.</description>
   13.35 +            </attribute>
   13.36 +        </attributes>
   13.37 +    </entry>
   13.38 +
   13.39 +    <entry name="count_characters">
   13.40 +        <description> This is used to count the number of characters in a variable.</description>
   13.41 +        <attributes>
   13.42 +            <attribute position="1">
   13.43 +                <type>boolean</type>
   13.44 +                <required>no</required>
   13.45 +                <default>false</default>
   13.46 +                <description>This determines whether or not to include whitespace characters in the count.</description>
   13.47 +            </attribute>
   13.48 +        </attributes>
   13.49 +    </entry>
   13.50 +
   13.51 +    <entry name="count_paragraphs">
   13.52 +        <description>This is used to count the number of paragraphs in a variable. </description>
   13.53 +    </entry>
   13.54 +
   13.55 +    <entry name="count_sentences">
   13.56 +        <description>This is used to count the number of sentences in a variable. </description>
   13.57 +    </entry>
   13.58 +
   13.59 +    <entry name="count_words">
   13.60 +        <description>This is used to count the number of words in a variable. </description>
   13.61 +    </entry>
   13.62 +
   13.63 +    <entry name="date_format">
   13.64 +        <description>This formats a date and time into the given strftime()  format. Dates can be passed to Smarty as unix timestamps, mysql timestamps or any string made up of month day year, parsable by php's strtotime(). Designers can then use date_format to have complete control of the formatting of the date. If the date passed to date_format is empty and a second parameter is passed, that will be used as the date to format. </description>
   13.65 +        <attributes>
   13.66 +            <attribute position="1">
   13.67 +                <type>string</type>
   13.68 +                <required>no</required>
   13.69 +                <default>%b %e, %Y</default>
   13.70 +                <description>This is the format for the outputted date.</description>
   13.71 +            </attribute>
   13.72 +            
   13.73 +            <attribute position="2">
   13.74 +                <type>string</type>
   13.75 +                <required>no</required>
   13.76 +                <default>n/a</default>
   13.77 +                <description>This is the default date if the input is empty.</description>
   13.78 +            </attribute>
   13.79 +        </attributes>
   13.80 +    </entry>
   13.81 +
   13.82 +    <entry name="default">
   13.83 +        <description>  This is used to set a default value for a variable. If the variable is unset or an empty string, the given default value is printed instead. Default takes the one argument. Note: With error_reporting(E_ALL), undeclared variables will always throw an error within the template. This function is useful for replacing null or zero length strings. </description>
   13.84 +        <attributes>
   13.85 +            <attribute position="1">
   13.86 +                <type>string</type>
   13.87 +                <required>no</required>
   13.88 +                <default>empty</default>
   13.89 +                <description>This is the default value to output if the variable is empty..</description>
   13.90 +            </attribute>
   13.91 +        </attributes>
   13.92 +    </entry>
   13.93 +
   13.94 +    <entry name="escape">
   13.95 +        <description>escape is used to encode or escape a variable to for example html, url, single quotes, hex, hexentity, javascript and mail. By default its html. </description>
   13.96 +        <attributes>
   13.97 +            <attribute position="1">
   13.98 +                <type>string</type>
   13.99 +                <required>no</required>
  13.100 +                <possible_values>No	html, htmlall, url, urlpathinfo, quotes, hex, hexentity, javascript, mail</possible_values>
  13.101 +                <default>html</default>
  13.102 +                <description>This is the escape format to use.</description>
  13.103 +            </attribute>
  13.104 +
  13.105 +            <attribute position="2">
  13.106 +                <type>string</type>
  13.107 +                <required>no</required>
  13.108 +                <possible_values>ISO-8859-1, UTF-8, and any character set supported by  htmlentities()  </possible_values>
  13.109 +                <default>ISO-8859-1</default>
  13.110 +                <description>The character set encoding passed to htmlentities() et. al.</description>
  13.111 +            </attribute>
  13.112 +        </attributes>
  13.113 +    </entry>
  13.114 +
  13.115 +    <entry name="indent">
  13.116 +        <description>This indents a string on each line, default is 4. As an optional parameter, you can specify the number of characters to indent. As an optional second parameter, you can specify the character to use to indent with eg use "\t"  for a tab. </description>
  13.117 +        <attributes>
  13.118 +            <attribute position="1">
  13.119 +                <type>integer</type>
  13.120 +                <required>no</required>
  13.121 +                <default>4</default>
  13.122 +                <description>This determines how many characters to indent to.</description>
  13.123 +            </attribute>
  13.124 +
  13.125 +            <attribute position="2">
  13.126 +                <type>string</type>
  13.127 +                <required>no</required>
  13.128 +                <default>(one space)</default>
  13.129 +                <description>This is the character used to indent with.</description>
  13.130 +            </attribute>
  13.131 +        </attributes>
  13.132 +    </entry>
  13.133 +
  13.134 +    <entry name="lower">
  13.135 +        <description>This is used to lowercase a variable. This is equivalent to the PHP  strtolower() function.</description>
  13.136 +    </entry>
  13.137 +
  13.138 +    <entry name="nl2br">
  13.139 +        <description>All "\n" line breaks will be converted to html <br /> tags in the given variable. This is equivalent to the PHP's  nl2br() function. </description>
  13.140 +    </entry>
  13.141 +
  13.142 +    <entry name="regex_replace">
  13.143 +        <description> A regular expression search and replace on a variable. Use the  preg_replace() syntax from the PHP manual. </description>
  13.144 +        <attributes>
  13.145 +            <attribute position="1">
  13.146 +                <type>string</type>
  13.147 +                <required>yes</required>
  13.148 +                <default>n/a</default>
  13.149 +                <description>This is the regular expression to be replaced.</description>
  13.150 +            </attribute>
  13.151 +
  13.152 +            <attribute position="2">
  13.153 +                <type>string</type>
  13.154 +                <required>yes</required>
  13.155 +                <default>n/a</default>
  13.156 +                <description>This is the string of text to replace with.</description>
  13.157 +            </attribute>
  13.158 +        </attributes>
  13.159 +    </entry>
  13.160 +
  13.161 +    <entry name="replace">
  13.162 +        <description> A simple search and replace on a variable. This is equivalent to the PHP's  str_replace() function. </description>
  13.163 +        <attributes>
  13.164 +            <attribute position="1">
  13.165 +                <type>string</type>
  13.166 +                <required>yes</required>
  13.167 +                <default>n/a</default>
  13.168 +                <description>This is the string of text to be replaced.</description>
  13.169 +            </attribute>
  13.170 +
  13.171 +            <attribute position="2">
  13.172 +                <type>string</type>
  13.173 +                <required>yes</required>
  13.174 +                <default>n/a</default>
  13.175 +                <description>This is the string of text to replace with.</description>
  13.176 +            </attribute>
  13.177 +        </attributes>
  13.178 +    </entry>
  13.179 +
  13.180 +    <entry name="spacify">
  13.181 +        <description> spacify is a way to insert a space between every character of a variable. You can optionally pass a different character or string to insert. </description>
  13.182 +        <attributes>
  13.183 +            <attribute position="1">
  13.184 +                <type>string</type>
  13.185 +                <required>no</required>
  13.186 +                <default>one space</default>
  13.187 +                <description>This what gets inserted between each character of the variable.</description>
  13.188 +            </attribute>
  13.189 +        </attributes>
  13.190 +    </entry>
  13.191 +
  13.192 +    <entry name="string_format">
  13.193 +        <description>  This is a way to format strings, such as decimal numbers and such. Use the syntax for sprintf()  for the formatting. </description>
  13.194 +        <attributes>
  13.195 +            <attribute position="1">
  13.196 +                <type>string</type>
  13.197 +                <required>yes</required>
  13.198 +                <default>n/a</default>
  13.199 +                <description>This is what format to use. (sprintf)</description>
  13.200 +            </attribute>
  13.201 +        </attributes>
  13.202 +    </entry>
  13.203 +
  13.204 +    <entry name="strip">
  13.205 +        <description> This replaces all repeated spaces, newlines and tabs with a single space, or with the supplied string. Note: If you want to strip blocks of template text, use the built-in {strip} function. </description>
  13.206 +    </entry>
  13.207 +
  13.208 +    <entry name="strip_tags">
  13.209 +        <description> This strips out markup tags, basically anything between &lt; and &gt;. </description>
  13.210 +        <attributes>
  13.211 +            <attribute position="1">
  13.212 +                <type>boolean</type>
  13.213 +                <required>no</required>
  13.214 +                <default>true</default>
  13.215 +                <description>This determines whether the tags are replaced by ' ' or ''.</description>
  13.216 +            </attribute>
  13.217 +        </attributes>
  13.218 +    </entry>
  13.219 +
  13.220 +    <entry name="truncate">
  13.221 +        <description>  This truncates a variable to a character length, the default is 80. As an optional second parameter, you can specify a string of text to display at the end if the variable was truncated. The characters in the string are included with the original truncation length. By default, truncate will attempt to cut off at a word boundary. If you want to cut off at the exact character length, pass the optional third parameter of TRUE. </description>
  13.222 +        <attributes>
  13.223 +            <attribute position="1">
  13.224 +                <type>integer</type>
  13.225 +                <required>no</required>
  13.226 +                <default>80</default>
  13.227 +                <description>This determines how many characters to truncate to.</description>
  13.228 +            </attribute>
  13.229 +
  13.230 +            <attribute position="2">
  13.231 +                <type>string</type>
  13.232 +                <required>no</required>
  13.233 +                <default>...</default>
  13.234 +                <description>This is a text string that replaces the truncated text. Its length is included in the truncation length setting.</description>
  13.235 +            </attribute>
  13.236 +            
  13.237 +            <attribute position="3">
  13.238 +                <type>boolean</type>
  13.239 +                <required>no</required>
  13.240 +                <default>false</default>
  13.241 +                <description>This determines whether or not to truncate at a word boundary with FALSE, or at the exact character with TRUE.</description>
  13.242 +            </attribute>
  13.243 +
  13.244 +            <attribute position="4">
  13.245 +                <type>boolean</type>
  13.246 +                <required>no</required>
  13.247 +                <default>false</default>
  13.248 +                <description>This determines whether the truncation happens at the end of the string with FALSE, or in the middle of the string with TRUE. Note that if this setting is TRUE, then word boundaries are ignored. </description>
  13.249 +            </attribute>
  13.250 +        </attributes>
  13.251 +    </entry>
  13.252 +
  13.253 +    <entry name="upper">
  13.254 +        <description> This is used to uppercase a variable. This is equivalent to the PHP  strtoupper() function. </description>
  13.255 +    </entry>
  13.256 +
  13.257 +    <entry name="wordwrap">
  13.258 +        <description> Wraps a string to a column width, the default is 80. As an optional second parameter, you can specify a string of text to wrap the text to the next line, the default is a carriage return "\n". By default, wordwrap will attempt to wrap at a word boundary. If you want to cut off at the exact character length, pass the optional third parameter as TRUE. This is equivalent to the PHP wordwrap()  function. </description>
  13.259 +        <attributes>
  13.260 +            <attribute position="1">
  13.261 +                <type>integer</type>
  13.262 +                <required>no</required>
  13.263 +                <default>80</default>
  13.264 +                <description>This determines how many columns to wrap to.</description>
  13.265 +            </attribute>
  13.266 +
  13.267 +            <attribute position="2">
  13.268 +                <type>string</type>
  13.269 +                <required>no</required>
  13.270 +                <default>\n</default>
  13.271 +                <description>This is the string used to wrap words with.</description>
  13.272 +            </attribute>
  13.273 +
  13.274 +            <attribute position="3">
  13.275 +                <type>boolean</type>
  13.276 +                <required>no</required>
  13.277 +                <default>false</default>
  13.278 +                <description>This determines whether or not to wrap at a word boundary (FALSE), or at the exact character (TRUE).</description>
  13.279 +            </attribute>
  13.280 +        </attributes>
  13.281 +    </entry>
  13.282 +
  13.283 +</entries>
    14.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/resources/layer.xml	Thu Jun 03 22:28:44 2010 +0800
    14.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/resources/layer.xml	Mon Jun 07 10:06:41 2010 +0200
    14.3 @@ -30,6 +30,7 @@
    14.4                      <file name="org-netbeans-modules-php-editor-PHPCodeCompletion.instance"/>
    14.5                      <file name="org-netbeans-modules-csl-editor-completion-GsfCompletionProvider.instance"/>
    14.6                      <file name="org-netbeans-modules-html-editor-completion-HtmlPaletteCompletionProvider.instance"/>
    14.7 +                    <file name="org-netbeans-modules-php-smarty-editor-completion-TplCompletionProvider.instance"/>
    14.8                      <file name="org-netbeans-lib-editor-codetemplates-CodeTemplateCompletionProvider.instance"/>
    14.9                  </folder>
   14.10                  <file name="EditorKit.instance">
    15.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/ui/customizer/SmartyCustomizerPanel.form	Thu Jun 03 22:28:44 2010 +0800
    15.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/ui/customizer/SmartyCustomizerPanel.form	Mon Jun 07 10:06:41 2010 +0200
    15.3 @@ -1,4 +1,4 @@
    15.4 -<?xml version="1.0" encoding="UTF-8" ?>
    15.5 +<?xml version="1.1" encoding="UTF-8" ?>
    15.6  
    15.7  <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    15.8    <AuxValues>
    15.9 @@ -22,14 +22,14 @@
   15.10                    <Component id="jSeparator1" alignment="0" pref="504" max="32767" attributes="0"/>
   15.11                    <Group type="102" alignment="0" attributes="0">
   15.12                        <Component id="customDelimitersLabel" min="-2" max="-2" attributes="0"/>
   15.13 -                      <EmptySpace pref="93" max="32767" attributes="0"/>
   15.14 +                      <EmptySpace pref="94" max="32767" attributes="0"/>
   15.15                        <Component id="optionsLabel" min="-2" max="-2" attributes="0"/>
   15.16                    </Group>
   15.17                    <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
   15.18                        <Group type="102" alignment="0" attributes="1">
   15.19                            <Component id="customCloseDelimiterLabel" min="-2" max="-2" attributes="0"/>
   15.20                            <EmptySpace max="-2" attributes="0"/>
   15.21 -                          <Component id="customCloseDelimiterTextField" pref="100" max="32767" attributes="0"/>
   15.22 +                          <Component id="customCloseDelimiterTextField" max="32767" attributes="0"/>
   15.23                        </Group>
   15.24                        <Group type="102" alignment="0" attributes="0">
   15.25                            <Component id="customOpenDelimiterLabel" min="-2" max="-2" attributes="0"/>
    16.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/ui/customizer/SmartyCustomizerPanel.java	Thu Jun 03 22:28:44 2010 +0800
    16.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/ui/customizer/SmartyCustomizerPanel.java	Mon Jun 07 10:06:41 2010 +0200
    16.3 @@ -110,13 +110,13 @@
    16.4                      .addComponent(jSeparator1, GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE)
    16.5                      .addGroup(layout.createSequentialGroup()
    16.6                          .addComponent(customDelimitersLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    16.7 -                        .addPreferredGap(ComponentPlacement.RELATED, 93, Short.MAX_VALUE)
    16.8 +                        .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
    16.9                          .addComponent(optionsLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
   16.10                      .addGroup(layout.createParallelGroup(Alignment.TRAILING, false)
   16.11                          .addGroup(Alignment.LEADING, layout.createSequentialGroup()
   16.12                              .addComponent(customCloseDelimiterLabel)
   16.13                              .addPreferredGap(ComponentPlacement.RELATED)
   16.14 -                            .addComponent(customCloseDelimiterTextField, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
   16.15 +                            .addComponent(customCloseDelimiterTextField))
   16.16                          .addGroup(Alignment.LEADING, layout.createSequentialGroup()
   16.17                              .addComponent(customOpenDelimiterLabel)
   16.18                              .addPreferredGap(ComponentPlacement.RELATED)
    17.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/SmartyOptionsPanel.form	Thu Jun 03 22:28:44 2010 +0800
    17.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/SmartyOptionsPanel.form	Mon Jun 07 10:06:41 2010 +0200
    17.3 @@ -1,4 +1,4 @@
    17.4 -<?xml version="1.0" encoding="UTF-8" ?>
    17.5 +<?xml version="1.1" encoding="UTF-8" ?>
    17.6  
    17.7  <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    17.8    <AccessibilityProperties>
    17.9 @@ -27,12 +27,12 @@
   17.10                    <Component id="jSeparator1" alignment="0" pref="586" max="32767" attributes="0"/>
   17.11                    <Group type="102" alignment="0" attributes="0">
   17.12                        <Component id="openDelimiterLabel" min="-2" max="-2" attributes="0"/>
   17.13 -                      <EmptySpace max="-2" attributes="0"/>
   17.14 +                      <EmptySpace type="separate" max="-2" attributes="0"/>
   17.15                        <Component id="openDelimiterTextField" min="-2" pref="100" max="-2" attributes="0"/>
   17.16                    </Group>
   17.17                    <Group type="102" alignment="0" attributes="0">
   17.18                        <Component id="closeDelimiterLabel" min="-2" max="-2" attributes="0"/>
   17.19 -                      <EmptySpace max="-2" attributes="0"/>
   17.20 +                      <EmptySpace type="separate" max="-2" attributes="0"/>
   17.21                        <Component id="closeDelimiterTextField" min="-2" pref="100" max="-2" attributes="0"/>
   17.22                    </Group>
   17.23                    <Component id="errorLabel" alignment="0" min="-2" max="-2" attributes="0"/>
    18.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/SmartyOptionsPanel.java	Thu Jun 03 22:28:44 2010 +0800
    18.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/SmartyOptionsPanel.java	Mon Jun 07 10:06:41 2010 +0200
    18.3 @@ -211,11 +211,11 @@
    18.4                      .addComponent(jSeparator1, GroupLayout.DEFAULT_SIZE, 586, Short.MAX_VALUE)
    18.5                      .addGroup(layout.createSequentialGroup()
    18.6                          .addComponent(openDelimiterLabel)
    18.7 -                        .addPreferredGap(ComponentPlacement.RELATED)
    18.8 +                        .addGap(18, 18, 18)
    18.9                          .addComponent(openDelimiterTextField, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
   18.10                      .addGroup(layout.createSequentialGroup()
   18.11                          .addComponent(closeDelimiterLabel)
   18.12 -                        .addPreferredGap(ComponentPlacement.RELATED)
   18.13 +                        .addGap(18, 18, 18)
   18.14                          .addComponent(closeDelimiterTextField, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
   18.15                      .addComponent(errorLabel)
   18.16                      .addComponent(learnMoreLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)