1.1 --- a/html.editor.lib/nbproject/project.xml Mon Jun 02 14:22:13 2014 +0200
1.2 +++ b/html.editor.lib/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
1.3 @@ -274,14 +274,15 @@
1.4 </test-type>
1.5 </test-dependencies>
1.6 <friend-packages>
1.7 - <friend>com.ext4yii.editor</friend> <!--gevik@ext4yii.com-->
1.8 - <friend>nl.truesoftware.blendsdk</friend> <!--gevik@ext4yii.com-->
1.9 + <friend>com.ext4yii.editor</friend>
1.10 + <friend>nl.truesoftware.blendsdk</friend>
1.11 <friend>org.netbeans.modules.css.visual</friend>
1.12 <friend>org.netbeans.modules.html</friend>
1.13 <friend>org.netbeans.modules.html.angular</friend>
1.14 <friend>org.netbeans.modules.html.custom</friend>
1.15 + <friend>org.netbeans.modules.html.editor</friend>
1.16 <friend>org.netbeans.modules.html.knockout</friend>
1.17 - <friend>org.netbeans.modules.html.editor</friend>
1.18 + <friend>org.netbeans.modules.html.ojet</friend>
1.19 <friend>org.netbeans.modules.html.parser</friend>
1.20 <friend>org.netbeans.modules.html.validation</friend>
1.21 <friend>org.netbeans.modules.javascript2.editor</friend>
2.1 --- a/html.editor/nbproject/project.xml Mon Jun 02 14:22:13 2014 +0200
2.2 +++ b/html.editor/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
2.3 @@ -515,6 +515,7 @@
2.4 <friend>org.netbeans.modules.html.angular</friend>
2.5 <friend>org.netbeans.modules.html.custom</friend>
2.6 <friend>org.netbeans.modules.html.knockout</friend>
2.7 + <friend>org.netbeans.modules.html.ojet</friend>
2.8 <friend>org.netbeans.modules.javascript.editing</friend>
2.9 <friend>org.netbeans.modules.javascript2.editor</friend>
2.10 <friend>org.netbeans.modules.php.latte</friend>
3.1 --- a/html.knockout/nbproject/project.xml Mon Jun 02 14:22:13 2014 +0200
3.2 +++ b/html.knockout/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
3.3 @@ -248,7 +248,10 @@
3.4 </test-dependency>
3.5 </test-type>
3.6 </test-dependencies>
3.7 - <public-packages/>
3.8 + <friend-packages>
3.9 + <friend>org.netbeans.modules.html.ojet</friend>
3.10 + <package>org.netbeans.modules.html.knockout.api</package>
3.11 + </friend-packages>
3.12 </data>
3.13 </configuration>
3.14 </project>
4.1 --- a/html.knockout/src/org/netbeans/modules/html/knockout/KODataBindLanguageHierarchy.java Mon Jun 02 14:22:13 2014 +0200
4.2 +++ b/html.knockout/src/org/netbeans/modules/html/knockout/KODataBindLanguageHierarchy.java Mon Jun 02 14:23:34 2014 +0200
4.3 @@ -41,6 +41,7 @@
4.4 */
4.5 package org.netbeans.modules.html.knockout;
4.6
4.7 +import org.netbeans.modules.html.knockout.api.KODataBindTokenId;
4.8 import java.util.Collection;
4.9 import java.util.EnumSet;
4.10 import java.util.logging.Level;
5.1 --- a/html.knockout/src/org/netbeans/modules/html/knockout/KODataBindLexer.java Mon Jun 02 14:22:13 2014 +0200
5.2 +++ b/html.knockout/src/org/netbeans/modules/html/knockout/KODataBindLexer.java Mon Jun 02 14:23:34 2014 +0200
5.3 @@ -43,6 +43,7 @@
5.4 */
5.5 package org.netbeans.modules.html.knockout;
5.6
5.7 +import org.netbeans.modules.html.knockout.api.KODataBindTokenId;
5.8 import org.netbeans.api.lexer.Token;
5.9 import org.netbeans.spi.lexer.Lexer;
5.10 import org.netbeans.spi.lexer.LexerInput;
6.1 --- a/html.knockout/src/org/netbeans/modules/html/knockout/KODataBindTokenId.java Mon Jun 02 14:22:13 2014 +0200
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,82 +0,0 @@
6.4 -/*
6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.6 - *
6.7 - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
6.8 - *
6.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6.10 - * Other names may be trademarks of their respective owners.
6.11 - *
6.12 - * The contents of this file are subject to the terms of either the GNU
6.13 - * General Public License Version 2 only ("GPL") or the Common
6.14 - * Development and Distribution License("CDDL") (collectively, the
6.15 - * "License"). You may not use this file except in compliance with the
6.16 - * License. You can obtain a copy of the License at
6.17 - * http://www.netbeans.org/cddl-gplv2.html
6.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.19 - * specific language governing permissions and limitations under the
6.20 - * License. When distributing the software, include this License Header
6.21 - * Notice in each file and include the License file at
6.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
6.23 - * particular file as subject to the "Classpath" exception as provided
6.24 - * by Oracle in the GPL Version 2 section of the License file that
6.25 - * accompanied this code. If applicable, add the following below the
6.26 - * License Header, with the fields enclosed by brackets [] replaced by
6.27 - * your own identifying information:
6.28 - * "Portions Copyrighted [year] [name of copyright owner]"
6.29 - *
6.30 - * Contributor(s):
6.31 - *
6.32 - * The Original Software is NetBeans. The Initial Developer of the Original
6.33 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
6.34 - * Microsystems, Inc. All Rights Reserved.
6.35 - *
6.36 - * If you wish your version of this file to be governed by only the CDDL
6.37 - * or only the GPL Version , indicate your decision by adding
6.38 - * "[Contributor] elects to include this software in this distribution
6.39 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.40 - * single choice of license, a recipient has the option to distribute
6.41 - * your version of this file under either the CDDL, the GPL Version 2 or
6.42 - * to extend the choice of license to its licensees as provided above.
6.43 - * However, if you add GPL Version 2 code and therefore, elected the GPL
6.44 - * Version 2 license, then the option applies only if the new code is
6.45 - * made subject to such option by the copyright holder.
6.46 - */
6.47 -package org.netbeans.modules.html.knockout;
6.48 -
6.49 -import org.netbeans.api.editor.mimelookup.MimeRegistration;
6.50 -import org.netbeans.api.lexer.Language;
6.51 -import org.netbeans.api.lexer.TokenId;
6.52 -
6.53 -/**
6.54 - * key: value, key: value, ...
6.55 - *
6.56 - * @author Marek Fukala
6.57 - */
6.58 -public enum KODataBindTokenId implements TokenId {
6.59 -
6.60 - KEY("key"),
6.61 - VALUE("value"),
6.62 - COLON("operator"),
6.63 - COMMA("operator"),
6.64 - ERROR("error"),
6.65 - WS("whitespace"); //NOI18N
6.66 -
6.67 - private static final Language<KODataBindTokenId> language = new KODataBindLanguageHierarchy().language();
6.68 -
6.69 - @MimeRegistration(mimeType = KOUtils.KO_DATA_BIND_MIMETYPE, service = Language.class)
6.70 - public static Language<KODataBindTokenId> language() {
6.71 - return language;
6.72 - }
6.73 -
6.74 - private String category;
6.75 -
6.76 - private KODataBindTokenId(String category) {
6.77 - this.category = category;
6.78 - }
6.79 -
6.80 - @Override
6.81 - public String primaryCategory() {
6.82 - return category;
6.83 - }
6.84 -
6.85 -}
7.1 --- a/html.knockout/src/org/netbeans/modules/html/knockout/KOHtmlExtension.java Mon Jun 02 14:22:13 2014 +0200
7.2 +++ b/html.knockout/src/org/netbeans/modules/html/knockout/KOHtmlExtension.java Mon Jun 02 14:23:34 2014 +0200
7.3 @@ -41,6 +41,7 @@
7.4 */
7.5 package org.netbeans.modules.html.knockout;
7.6
7.7 +import org.netbeans.modules.html.knockout.api.KODataBindTokenId;
7.8 import org.netbeans.modules.html.knockout.model.KOModel;
7.9 import java.util.ArrayList;
7.10 import java.util.Collection;
8.1 --- a/html.knockout/src/org/netbeans/modules/html/knockout/KOJsEmbeddingProviderPlugin.java Mon Jun 02 14:22:13 2014 +0200
8.2 +++ b/html.knockout/src/org/netbeans/modules/html/knockout/KOJsEmbeddingProviderPlugin.java Mon Jun 02 14:23:34 2014 +0200
8.3 @@ -41,6 +41,7 @@
8.4 */
8.5 package org.netbeans.modules.html.knockout;
8.6
8.7 +import org.netbeans.modules.html.knockout.api.KODataBindTokenId;
8.8 import java.util.ArrayList;
8.9 import java.util.HashMap;
8.10 import java.util.LinkedHashSet;
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/html.knockout/src/org/netbeans/modules/html/knockout/api/KODataBindTokenId.java Mon Jun 02 14:23:34 2014 +0200
9.3 @@ -0,0 +1,84 @@
9.4 +/*
9.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 + *
9.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
9.8 + *
9.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9.10 + * Other names may be trademarks of their respective owners.
9.11 + *
9.12 + * The contents of this file are subject to the terms of either the GNU
9.13 + * General Public License Version 2 only ("GPL") or the Common
9.14 + * Development and Distribution License("CDDL") (collectively, the
9.15 + * "License"). You may not use this file except in compliance with the
9.16 + * License. You can obtain a copy of the License at
9.17 + * http://www.netbeans.org/cddl-gplv2.html
9.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.19 + * specific language governing permissions and limitations under the
9.20 + * License. When distributing the software, include this License Header
9.21 + * Notice in each file and include the License file at
9.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
9.23 + * particular file as subject to the "Classpath" exception as provided
9.24 + * by Oracle in the GPL Version 2 section of the License file that
9.25 + * accompanied this code. If applicable, add the following below the
9.26 + * License Header, with the fields enclosed by brackets [] replaced by
9.27 + * your own identifying information:
9.28 + * "Portions Copyrighted [year] [name of copyright owner]"
9.29 + *
9.30 + * Contributor(s):
9.31 + *
9.32 + * The Original Software is NetBeans. The Initial Developer of the Original
9.33 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
9.34 + * Microsystems, Inc. All Rights Reserved.
9.35 + *
9.36 + * If you wish your version of this file to be governed by only the CDDL
9.37 + * or only the GPL Version , indicate your decision by adding
9.38 + * "[Contributor] elects to include this software in this distribution
9.39 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.40 + * single choice of license, a recipient has the option to distribute
9.41 + * your version of this file under either the CDDL, the GPL Version 2 or
9.42 + * to extend the choice of license to its licensees as provided above.
9.43 + * However, if you add GPL Version 2 code and therefore, elected the GPL
9.44 + * Version 2 license, then the option applies only if the new code is
9.45 + * made subject to such option by the copyright holder.
9.46 + */
9.47 +package org.netbeans.modules.html.knockout.api;
9.48 +
9.49 +import org.netbeans.api.editor.mimelookup.MimeRegistration;
9.50 +import org.netbeans.api.lexer.Language;
9.51 +import org.netbeans.api.lexer.TokenId;
9.52 +import org.netbeans.modules.html.knockout.KODataBindLanguageHierarchy;
9.53 +import org.netbeans.modules.html.knockout.KOUtils;
9.54 +
9.55 +/**
9.56 + * key: value, key: value, ...
9.57 + *
9.58 + * @author Marek Fukala
9.59 + */
9.60 +public enum KODataBindTokenId implements TokenId {
9.61 +
9.62 + KEY("key"),
9.63 + VALUE("value"),
9.64 + COLON("operator"),
9.65 + COMMA("operator"),
9.66 + ERROR("error"),
9.67 + WS("whitespace"); //NOI18N
9.68 +
9.69 + private static final Language<KODataBindTokenId> language = new KODataBindLanguageHierarchy().language();
9.70 +
9.71 + @MimeRegistration(mimeType = KOUtils.KO_DATA_BIND_MIMETYPE, service = Language.class)
9.72 + public static Language<KODataBindTokenId> language() {
9.73 + return language;
9.74 + }
9.75 +
9.76 + private String category;
9.77 +
9.78 + private KODataBindTokenId(String category) {
9.79 + this.category = category;
9.80 + }
9.81 +
9.82 + @Override
9.83 + public String primaryCategory() {
9.84 + return category;
9.85 + }
9.86 +
9.87 +}
10.1 --- a/html.knockout/src/org/netbeans/modules/html/knockout/model/KOModel.java Mon Jun 02 14:22:13 2014 +0200
10.2 +++ b/html.knockout/src/org/netbeans/modules/html/knockout/model/KOModel.java Mon Jun 02 14:23:34 2014 +0200
10.3 @@ -56,7 +56,7 @@
10.4 import org.netbeans.modules.html.editor.lib.api.elements.AttributeFilter;
10.5 import org.netbeans.modules.html.editor.lib.api.elements.Element;
10.6 import org.netbeans.modules.html.editor.lib.api.elements.OpenTag;
10.7 -import org.netbeans.modules.html.knockout.KODataBindTokenId;
10.8 +import org.netbeans.modules.html.knockout.api.KODataBindTokenId;
10.9 import org.netbeans.modules.html.knockout.KOUtils;
10.10 import org.netbeans.modules.parsing.api.Snapshot;
10.11 import org.netbeans.modules.web.common.api.LexerUtils;
11.1 --- a/html.knockout/test/unit/data/completion/foreach/index.html.testForEach.completion Mon Jun 02 14:22:13 2014 +0200
11.2 +++ b/html.knockout/test/unit/data/completion/foreach/index.html.testForEach.completion Mon Jun 02 14:23:34 2014 +0200
11.3 @@ -4,21 +4,21 @@
11.4 ------------------------------------
11.5 CONSTRUCTO Bulici(): Bulici [PUBLIC] index.html
11.6 CONSTRUCTO Clobrda(jmeno): Clobrda [PUBLIC] index.html
11.7 -CLASS $context [PRIVATE] index.html
11.8 -CLASS $parentContext [PRIVATE] index.html
11.9 -CLASS ko [PUBLIC] Knockout
11.10 +CLASS $context [PRIVATE] <font color=#999999>index.html</font>
11.11 +CLASS $parentContext [PRIVATE] <font color=#999999>index.html</font>
11.12 +CLASS ko [PUBLIC] <font color=#999999>Knockout</font>
11.13 METHOD init(): undefined [PUBLIC] index.html
11.14 FIELD age: Number [PUBLIC] index.html
11.15 FIELD jmeno [PUBLIC] index.html
11.16 -VARIABLE $data [PRIVATE] index.html
11.17 -VARIABLE $element [PRIVATE] index.html
11.18 -VARIABLE $index: Number [PRIVATE] index.html
11.19 -VARIABLE $parent: ko.$bindings [PRIVATE] index.html
11.20 -VARIABLE $parents: Array [PRIVATE] index.html
11.21 -VARIABLE $root: ko.$bindings [PRIVATE] index.html
11.22 -VARIABLE arguments: Arguments [PRIVATE] index.html
11.23 -VARIABLE lidickove [PUBLIC] index.html
11.24 -VARIABLE undefined [PUBLIC] index.html
11.25 +VARIABLE $data [PRIVATE] <font color=#999999>index.html</font>
11.26 +VARIABLE $element [PRIVATE] <font color=#999999>index.html</font>
11.27 +VARIABLE $index: Number [PRIVATE] <font color=#999999>index.html</font>
11.28 +VARIABLE $parent: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
11.29 +VARIABLE $parents: Array [PRIVATE] <font color=#999999>index.html</font>
11.30 +VARIABLE $root: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
11.31 +VARIABLE arguments: Arguments [PRIVATE] <font color=#999999>index.html</font>
11.32 +VARIABLE lidickove [PUBLIC] <font color=#999999>index.html</font>
11.33 +VARIABLE undefined [PUBLIC] <font color=#999999>index.html</font>
11.34 KEYWORD break null
11.35 KEYWORD case null
11.36 KEYWORD catch null
12.1 --- a/html.knockout/test/unit/data/completion/foreachAlias/index.html.testForEachAlias.completion Mon Jun 02 14:22:13 2014 +0200
12.2 +++ b/html.knockout/test/unit/data/completion/foreachAlias/index.html.testForEachAlias.completion Mon Jun 02 14:23:34 2014 +0200
12.3 @@ -2,22 +2,22 @@
12.4 <span data-bind="text: |"></span>
12.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
12.6 ------------------------------------
12.7 -CLASS $context [PRIVATE] index.html
12.8 -CLASS $parentContext [PRIVATE] index.html
12.9 -CLASS ko [PUBLIC] Knockout
12.10 +CLASS $context [PRIVATE] <font color=#999999>index.html</font>
12.11 +CLASS $parentContext [PRIVATE] <font color=#999999>index.html</font>
12.12 +CLASS ko [PUBLIC] <font color=#999999>Knockout</font>
12.13 CLASS viewModel [PUBLIC] index.html
12.14 -VARIABLE $data [PRIVATE] index.html
12.15 -VARIABLE $element [PRIVATE] index.html
12.16 -VARIABLE $index: Number [PRIVATE] index.html
12.17 -VARIABLE $parent [PRIVATE] index.html
12.18 -VARIABLE $parents: Array [PRIVATE] index.html
12.19 -VARIABLE $root: ko.$bindings [PRIVATE] index.html
12.20 -VARIABLE arguments: Arguments [PRIVATE] index.html
12.21 -VARIABLE categories [PUBLIC] index.html
12.22 -VARIABLE category [PRIVATE] index.html
12.23 -VARIABLE item [PRIVATE] index.html
12.24 -VARIABLE items [PUBLIC] index.html
12.25 -VARIABLE undefined [PUBLIC] index.html
12.26 +VARIABLE $data [PRIVATE] <font color=#999999>index.html</font>
12.27 +VARIABLE $element [PRIVATE] <font color=#999999>index.html</font>
12.28 +VARIABLE $index: Number [PRIVATE] <font color=#999999>index.html</font>
12.29 +VARIABLE $parent [PRIVATE] <font color=#999999>index.html</font>
12.30 +VARIABLE $parents: Array [PRIVATE] <font color=#999999>index.html</font>
12.31 +VARIABLE $root: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
12.32 +VARIABLE arguments: Arguments [PRIVATE] <font color=#999999>index.html</font>
12.33 +VARIABLE categories [PUBLIC] <font color=#999999>index.html</font>
12.34 +VARIABLE category [PRIVATE] <font color=#999999>index.html</font>
12.35 +VARIABLE item [PRIVATE] <font color=#999999>index.html</font>
12.36 +VARIABLE items [PUBLIC] <font color=#999999>index.html</font>
12.37 +VARIABLE undefined [PUBLIC] <font color=#999999>index.html</font>
12.38 KEYWORD break null
12.39 KEYWORD case null
12.40 KEYWORD catch null
13.1 --- a/html.knockout/test/unit/data/completion/issue231569/index.html.testIssue231569.completion Mon Jun 02 14:22:13 2014 +0200
13.2 +++ b/html.knockout/test/unit/data/completion/issue231569/index.html.testIssue231569.completion Mon Jun 02 14:23:34 2014 +0200
13.3 @@ -3,18 +3,18 @@
13.4 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
13.5 ------------------------------------
13.6 CONSTRUCTO TestModel(lists, selectedList) [PUBLIC] index.html
13.7 -CLASS $context [PRIVATE] index.html
13.8 -CLASS $parentContext [PRIVATE] index.html
13.9 -CLASS ko [PUBLIC] Knockout
13.10 -FIELD savedLists [PUBLIC] index.html
13.11 -FIELD userNameToAddIsValid [PUBLIC] index.html
13.12 -VARIABLE $data: ko.$bindings [PRIVATE] index.html
13.13 -VARIABLE $element [PRIVATE] index.html
13.14 -VARIABLE $parent: undefined [PRIVATE] index.html
13.15 -VARIABLE $parents: Array [PRIVATE] index.html
13.16 -VARIABLE $root: ko.$bindings [PRIVATE] index.html
13.17 -VARIABLE arguments: Arguments [PRIVATE] index.html
13.18 -VARIABLE undefined [PUBLIC] index.html
13.19 +CLASS $context [PRIVATE] <font color=#999999>index.html</font>
13.20 +CLASS $parentContext [PRIVATE] <font color=#999999>index.html</font>
13.21 +CLASS ko [PUBLIC] <font color=#999999>Knockout</font>
13.22 +FIELD savedLists [PUBLIC] <font color=#999999>index.html</font>
13.23 +FIELD userNameToAddIsValid [PUBLIC] <font color=#999999>index.html</font>
13.24 +VARIABLE $data: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
13.25 +VARIABLE $element [PRIVATE] <font color=#999999>index.html</font>
13.26 +VARIABLE $parent: undefined [PRIVATE] <font color=#999999>index.html</font>
13.27 +VARIABLE $parents: Array [PRIVATE] <font color=#999999>index.html</font>
13.28 +VARIABLE $root: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
13.29 +VARIABLE arguments: Arguments [PRIVATE] <font color=#999999>index.html</font>
13.30 +VARIABLE undefined [PUBLIC] <font color=#999999>index.html</font>
13.31 VARIABLE userNameToAdd [PUBLIC] index.html
13.32 KEYWORD break null
13.33 KEYWORD case null
14.1 --- a/html.knockout/test/unit/data/completion/template/index.html.testTemplate.completion Mon Jun 02 14:22:13 2014 +0200
14.2 +++ b/html.knockout/test/unit/data/completion/template/index.html.testTemplate.completion Mon Jun 02 14:23:34 2014 +0200
14.3 @@ -3,18 +3,18 @@
14.4 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
14.5 ------------------------------------
14.6 CONSTRUCTO MyViewModel(): MyViewModel [PUBLIC] index.html
14.7 -CLASS $context [PRIVATE] index.html
14.8 -CLASS $parentContext [PRIVATE] index.html
14.9 -CLASS ko [PUBLIC] Knockout
14.10 +CLASS $context [PRIVATE] <font color=#999999>index.html</font>
14.11 +CLASS $parentContext [PRIVATE] <font color=#999999>index.html</font>
14.12 +CLASS ko [PUBLIC] <font color=#999999>Knockout</font>
14.13 FIELD credits [PUBLIC] index.html
14.14 FIELD name [PUBLIC] index.html
14.15 -VARIABLE $data [PRIVATE] index.html
14.16 -VARIABLE $element [PRIVATE] index.html
14.17 -VARIABLE $parent: ko.$bindings [PRIVATE] index.html
14.18 -VARIABLE $parents: Array [PRIVATE] index.html
14.19 -VARIABLE $root: ko.$bindings [PRIVATE] index.html
14.20 -VARIABLE arguments: Arguments [PRIVATE] index.html
14.21 -VARIABLE undefined [PUBLIC] index.html
14.22 +VARIABLE $data [PRIVATE] <font color=#999999>index.html</font>
14.23 +VARIABLE $element [PRIVATE] <font color=#999999>index.html</font>
14.24 +VARIABLE $parent: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
14.25 +VARIABLE $parents: Array [PRIVATE] <font color=#999999>index.html</font>
14.26 +VARIABLE $root: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
14.27 +VARIABLE arguments: Arguments [PRIVATE] <font color=#999999>index.html</font>
14.28 +VARIABLE undefined [PUBLIC] <font color=#999999>index.html</font>
14.29 KEYWORD break null
14.30 KEYWORD case null
14.31 KEYWORD catch null
15.1 --- a/html.knockout/test/unit/data/completion/templateForEach/index.html.testTemplateForEach.completion Mon Jun 02 14:22:13 2014 +0200
15.2 +++ b/html.knockout/test/unit/data/completion/templateForEach/index.html.testTemplateForEach.completion Mon Jun 02 14:23:34 2014 +0200
15.3 @@ -3,20 +3,20 @@
15.4 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
15.5 ------------------------------------
15.6 CONSTRUCTO MyViewModel(): MyViewModel [PUBLIC] index.html
15.7 -CLASS $context [PRIVATE] index.html
15.8 -CLASS $parentContext [PRIVATE] index.html
15.9 -CLASS ko [PUBLIC] Knockout
15.10 +CLASS $context [PRIVATE] <font color=#999999>index.html</font>
15.11 +CLASS $parentContext [PRIVATE] <font color=#999999>index.html</font>
15.12 +CLASS ko [PUBLIC] <font color=#999999>Knockout</font>
15.13 FIELD credits [PUBLIC] index.html
15.14 FIELD name [PUBLIC] index.html
15.15 -VARIABLE $data [PRIVATE] index.html
15.16 -VARIABLE $element [PRIVATE] index.html
15.17 -VARIABLE $index: Number [PRIVATE] index.html
15.18 -VARIABLE $parent: ko.$bindings [PRIVATE] index.html
15.19 -VARIABLE $parents: Array [PRIVATE] index.html
15.20 -VARIABLE $root: ko.$bindings [PRIVATE] index.html
15.21 -VARIABLE arguments: Arguments [PRIVATE] index.html
15.22 -VARIABLE people [PUBLIC] index.html
15.23 -VARIABLE undefined [PUBLIC] index.html
15.24 +VARIABLE $data [PRIVATE] <font color=#999999>index.html</font>
15.25 +VARIABLE $element [PRIVATE] <font color=#999999>index.html</font>
15.26 +VARIABLE $index: Number [PRIVATE] <font color=#999999>index.html</font>
15.27 +VARIABLE $parent: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
15.28 +VARIABLE $parents: Array [PRIVATE] <font color=#999999>index.html</font>
15.29 +VARIABLE $root: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
15.30 +VARIABLE arguments: Arguments [PRIVATE] <font color=#999999>index.html</font>
15.31 +VARIABLE people [PUBLIC] <font color=#999999>index.html</font>
15.32 +VARIABLE undefined [PUBLIC] <font color=#999999>index.html</font>
15.33 KEYWORD break null
15.34 KEYWORD case null
15.35 KEYWORD catch null
16.1 --- a/html.knockout/test/unit/data/completion/templateInner/index.html.testTemplateInner.completion Mon Jun 02 14:22:13 2014 +0200
16.2 +++ b/html.knockout/test/unit/data/completion/templateInner/index.html.testTemplateInner.completion Mon Jun 02 14:23:34 2014 +0200
16.3 @@ -2,22 +2,22 @@
16.4 <strong data-bind="text: |"></strong>
16.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
16.6 ------------------------------------
16.7 -CLASS $context [PRIVATE] index.html
16.8 -CLASS $parentContext [PRIVATE] index.html
16.9 -CLASS ko [PUBLIC] Knockout
16.10 +CLASS $context [PRIVATE] <font color=#999999>index.html</font>
16.11 +CLASS $parentContext [PRIVATE] <font color=#999999>index.html</font>
16.12 +CLASS ko [PUBLIC] <font color=#999999>Knockout</font>
16.13 CLASS viewModel [PUBLIC] index.html
16.14 FIELD months [PUBLIC] index.html
16.15 FIELD name [PUBLIC] index.html
16.16 -VARIABLE $data [PRIVATE] index.html
16.17 -VARIABLE $element [PRIVATE] index.html
16.18 -VARIABLE $index: Number [PRIVATE] index.html
16.19 -VARIABLE $parent: ko.$bindings [PRIVATE] index.html
16.20 -VARIABLE $parents: Array [PRIVATE] index.html
16.21 -VARIABLE $root: ko.$bindings [PRIVATE] index.html
16.22 -VARIABLE arguments: Arguments [PRIVATE] index.html
16.23 -VARIABLE season [PRIVATE] index.html
16.24 -VARIABLE seasons [PUBLIC] index.html
16.25 -VARIABLE undefined [PUBLIC] index.html
16.26 +VARIABLE $data [PRIVATE] <font color=#999999>index.html</font>
16.27 +VARIABLE $element [PRIVATE] <font color=#999999>index.html</font>
16.28 +VARIABLE $index: Number [PRIVATE] <font color=#999999>index.html</font>
16.29 +VARIABLE $parent: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
16.30 +VARIABLE $parents: Array [PRIVATE] <font color=#999999>index.html</font>
16.31 +VARIABLE $root: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
16.32 +VARIABLE arguments: Arguments [PRIVATE] <font color=#999999>index.html</font>
16.33 +VARIABLE season [PRIVATE] <font color=#999999>index.html</font>
16.34 +VARIABLE seasons [PUBLIC] <font color=#999999>index.html</font>
16.35 +VARIABLE undefined [PUBLIC] <font color=#999999>index.html</font>
16.36 KEYWORD break null
16.37 KEYWORD case null
16.38 KEYWORD catch null
17.1 --- a/html.knockout/test/unit/data/completion/with/index.html.testWith.completion Mon Jun 02 14:22:13 2014 +0200
17.2 +++ b/html.knockout/test/unit/data/completion/with/index.html.testWith.completion Mon Jun 02 14:23:34 2014 +0200
17.3 @@ -4,20 +4,20 @@
17.4 ------------------------------------
17.5 CONSTRUCTO Bulici(): Bulici [PUBLIC] index.html
17.6 CONSTRUCTO Clobrda(jmeno): Clobrda [PUBLIC] index.html
17.7 -CLASS $context [PRIVATE] index.html
17.8 -CLASS $parentContext [PRIVATE] index.html
17.9 -CLASS ko [PUBLIC] Knockout
17.10 +CLASS $context [PRIVATE] <font color=#999999>index.html</font>
17.11 +CLASS $parentContext [PRIVATE] <font color=#999999>index.html</font>
17.12 +CLASS ko [PUBLIC] <font color=#999999>Knockout</font>
17.13 METHOD init(): undefined [PUBLIC] index.html
17.14 FIELD age: Number [PUBLIC] index.html
17.15 FIELD jmeno [PUBLIC] index.html
17.16 -VARIABLE $data [PRIVATE] index.html
17.17 -VARIABLE $element [PRIVATE] index.html
17.18 -VARIABLE $parent: ko.$bindings [PRIVATE] index.html
17.19 -VARIABLE $parents: Array [PRIVATE] index.html
17.20 -VARIABLE $root: ko.$bindings [PRIVATE] index.html
17.21 -VARIABLE arguments: Arguments [PRIVATE] index.html
17.22 -VARIABLE lidickove [PUBLIC] index.html
17.23 -VARIABLE undefined [PUBLIC] index.html
17.24 +VARIABLE $data [PRIVATE] <font color=#999999>index.html</font>
17.25 +VARIABLE $element [PRIVATE] <font color=#999999>index.html</font>
17.26 +VARIABLE $parent: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
17.27 +VARIABLE $parents: Array [PRIVATE] <font color=#999999>index.html</font>
17.28 +VARIABLE $root: ko.$bindings [PRIVATE] <font color=#999999>index.html</font>
17.29 +VARIABLE arguments: Arguments [PRIVATE] <font color=#999999>index.html</font>
17.30 +VARIABLE lidickove [PUBLIC] <font color=#999999>index.html</font>
17.31 +VARIABLE undefined [PUBLIC] <font color=#999999>index.html</font>
17.32 KEYWORD break null
17.33 KEYWORD case null
17.34 KEYWORD catch null
18.1 --- a/html.knockout/test/unit/src/org/netbeans/modules/html/knockout/KODataBindLexerTest.java Mon Jun 02 14:22:13 2014 +0200
18.2 +++ b/html.knockout/test/unit/src/org/netbeans/modules/html/knockout/KODataBindLexerTest.java Mon Jun 02 14:23:34 2014 +0200
18.3 @@ -41,6 +41,7 @@
18.4 */
18.5 package org.netbeans.modules.html.knockout;
18.6
18.7 +import org.netbeans.modules.html.knockout.api.KODataBindTokenId;
18.8 import org.netbeans.api.lexer.Token;
18.9 import org.netbeans.api.lexer.TokenHierarchy;
18.10 import org.netbeans.api.lexer.TokenSequence;
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/html.ojet/build.xml Mon Jun 02 14:23:34 2014 +0200
19.3 @@ -0,0 +1,5 @@
19.4 +<?xml version="1.0" encoding="UTF-8"?>
19.5 +<project basedir="." default="netbeans" name="html.ojet">
19.6 + <description>Builds, tests, and runs the project org.netbeans.modules.html.ojet</description>
19.7 + <import file="../nbbuild/templates/projectized.xml"/>
19.8 +</project>
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/html.ojet/external/binaries-list Mon Jun 02 14:23:34 2014 +0200
20.3 @@ -0,0 +1,1 @@
20.4 +E7E89BC9B8915F2675CEF9E7228D535496BEB3B8 ojetdocs.zip
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/html.ojet/manifest.mf Mon Jun 02 14:23:34 2014 +0200
21.3 @@ -0,0 +1,6 @@
21.4 +Manifest-Version: 1.0
21.5 +OpenIDE-Module: org.netbeans.modules.html.ojet
21.6 +OpenIDE-Module-Layer: org/netbeans/modules/html/ojet/layer.xml
21.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/html/ojet/Bundle.properties
21.8 +OpenIDE-Module-Specification-Version: 0.1
21.9 +
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/html.ojet/nbproject/project.properties Mon Jun 02 14:23:34 2014 +0200
22.3 @@ -0,0 +1,7 @@
22.4 +javac.source=1.7
22.5 +javac.compilerargs=-Xlint -Xlint:-serial
22.6 +
22.7 +extra.module.files=docs/ojetdocs.zip
22.8 +jnlp.indirect.jars=docs/ojetdocs.zip
22.9 +release.external/ojetdocs.zip=docs/ojetdocs.zip
22.10 +
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/html.ojet/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
23.3 @@ -0,0 +1,232 @@
23.4 +<?xml version="1.0" encoding="UTF-8"?>
23.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
23.6 + <type>org.netbeans.modules.apisupport.project</type>
23.7 + <configuration>
23.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
23.9 + <code-name-base>org.netbeans.modules.html.ojet</code-name-base>
23.10 + <module-dependencies>
23.11 + <dependency>
23.12 + <code-name-base>org.netbeans.api.annotations.common</code-name-base>
23.13 + <build-prerequisite/>
23.14 + <compile-dependency/>
23.15 + <run-dependency>
23.16 + <release-version>1</release-version>
23.17 + <specification-version>1.20</specification-version>
23.18 + </run-dependency>
23.19 + </dependency>
23.20 + <dependency>
23.21 + <code-name-base>org.netbeans.api.progress</code-name-base>
23.22 + <build-prerequisite/>
23.23 + <compile-dependency/>
23.24 + <run-dependency>
23.25 + <release-version>1</release-version>
23.26 + <specification-version>1.35</specification-version>
23.27 + </run-dependency>
23.28 + </dependency>
23.29 + <dependency>
23.30 + <code-name-base>org.netbeans.modules.csl.api</code-name-base>
23.31 + <build-prerequisite/>
23.32 + <compile-dependency/>
23.33 + <run-dependency>
23.34 + <release-version>2</release-version>
23.35 + <specification-version>2.38</specification-version>
23.36 + </run-dependency>
23.37 + </dependency>
23.38 + <dependency>
23.39 + <code-name-base>org.netbeans.modules.editor.completion</code-name-base>
23.40 + <build-prerequisite/>
23.41 + <compile-dependency/>
23.42 + <run-dependency>
23.43 + <release-version>1</release-version>
23.44 + <specification-version>1.35</specification-version>
23.45 + </run-dependency>
23.46 + </dependency>
23.47 + <dependency>
23.48 + <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
23.49 + <build-prerequisite/>
23.50 + <compile-dependency/>
23.51 + <run-dependency>
23.52 + <release-version>1</release-version>
23.53 + <specification-version>1.32</specification-version>
23.54 + </run-dependency>
23.55 + </dependency>
23.56 + <dependency>
23.57 + <code-name-base>org.netbeans.modules.html.editor</code-name-base>
23.58 + <build-prerequisite/>
23.59 + <compile-dependency/>
23.60 + <run-dependency>
23.61 + <release-version>2</release-version>
23.62 + <specification-version>2.34</specification-version>
23.63 + </run-dependency>
23.64 + </dependency>
23.65 + <dependency>
23.66 + <code-name-base>org.netbeans.modules.html.editor.lib</code-name-base>
23.67 + <build-prerequisite/>
23.68 + <compile-dependency/>
23.69 + <run-dependency>
23.70 + <release-version>3</release-version>
23.71 + <specification-version>3.14</specification-version>
23.72 + </run-dependency>
23.73 + </dependency>
23.74 + <dependency>
23.75 + <code-name-base>org.netbeans.modules.html.knockout</code-name-base>
23.76 + <build-prerequisite/>
23.77 + <compile-dependency/>
23.78 + <run-dependency>
23.79 + <specification-version>1.6</specification-version>
23.80 + </run-dependency>
23.81 + </dependency>
23.82 + <dependency>
23.83 + <code-name-base>org.netbeans.modules.html.lexer</code-name-base>
23.84 + <build-prerequisite/>
23.85 + <compile-dependency/>
23.86 + <run-dependency>
23.87 + <release-version>1</release-version>
23.88 + <specification-version>1.29</specification-version>
23.89 + </run-dependency>
23.90 + </dependency>
23.91 + <dependency>
23.92 + <code-name-base>org.netbeans.modules.javascript2.editor</code-name-base>
23.93 + <build-prerequisite/>
23.94 + <compile-dependency/>
23.95 + <run-dependency>
23.96 + <release-version>1</release-version>
23.97 + <specification-version>0.25</specification-version>
23.98 + </run-dependency>
23.99 + </dependency>
23.100 + <dependency>
23.101 + <code-name-base>org.netbeans.modules.lexer</code-name-base>
23.102 + <build-prerequisite/>
23.103 + <compile-dependency/>
23.104 + <run-dependency>
23.105 + <release-version>2</release-version>
23.106 + <specification-version>1.51</specification-version>
23.107 + </run-dependency>
23.108 + </dependency>
23.109 + <dependency>
23.110 + <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
23.111 + <build-prerequisite/>
23.112 + <compile-dependency/>
23.113 + <run-dependency>
23.114 + <release-version>1</release-version>
23.115 + <specification-version>1.65</specification-version>
23.116 + </run-dependency>
23.117 + </dependency>
23.118 + <dependency>
23.119 + <code-name-base>org.netbeans.modules.web.common</code-name-base>
23.120 + <build-prerequisite/>
23.121 + <compile-dependency/>
23.122 + <run-dependency>
23.123 + <specification-version>1.55</specification-version>
23.124 + </run-dependency>
23.125 + </dependency>
23.126 + <dependency>
23.127 + <code-name-base>org.openide.filesystems</code-name-base>
23.128 + <build-prerequisite/>
23.129 + <compile-dependency/>
23.130 + <run-dependency>
23.131 + <specification-version>8.7</specification-version>
23.132 + </run-dependency>
23.133 + </dependency>
23.134 + <dependency>
23.135 + <code-name-base>org.openide.modules</code-name-base>
23.136 + <build-prerequisite/>
23.137 + <compile-dependency/>
23.138 + <run-dependency>
23.139 + <specification-version>7.39</specification-version>
23.140 + </run-dependency>
23.141 + </dependency>
23.142 + <dependency>
23.143 + <code-name-base>org.openide.util</code-name-base>
23.144 + <build-prerequisite/>
23.145 + <compile-dependency/>
23.146 + <run-dependency>
23.147 + <specification-version>8.32</specification-version>
23.148 + </run-dependency>
23.149 + </dependency>
23.150 + <dependency>
23.151 + <code-name-base>org.openide.util.lookup</code-name-base>
23.152 + <build-prerequisite/>
23.153 + <compile-dependency/>
23.154 + <run-dependency>
23.155 + <specification-version>8.21</specification-version>
23.156 + </run-dependency>
23.157 + </dependency>
23.158 + </module-dependencies>
23.159 + <test-dependencies>
23.160 + <test-type>
23.161 + <name>unit</name>
23.162 + <test-dependency>
23.163 + <code-name-base>org.netbeans.insane</code-name-base>
23.164 + <compile-dependency/>
23.165 + </test-dependency>
23.166 + <test-dependency>
23.167 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
23.168 + <compile-dependency/>
23.169 + </test-dependency>
23.170 + <test-dependency>
23.171 + <code-name-base>org.netbeans.modules.csl.api</code-name-base>
23.172 + <compile-dependency/>
23.173 + <test/>
23.174 + </test-dependency>
23.175 + <test-dependency>
23.176 + <code-name-base>org.netbeans.modules.editor.mimelookup.impl</code-name-base>
23.177 + <compile-dependency/>
23.178 + </test-dependency>
23.179 + <test-dependency>
23.180 + <code-name-base>org.netbeans.modules.html.editor</code-name-base>
23.181 + <compile-dependency/>
23.182 + <test/>
23.183 + </test-dependency>
23.184 + <test-dependency>
23.185 + <code-name-base>org.netbeans.modules.html.parser</code-name-base>
23.186 + <compile-dependency/>
23.187 + </test-dependency>
23.188 + <test-dependency>
23.189 + <code-name-base>org.netbeans.modules.javascript2.editor</code-name-base>
23.190 + <compile-dependency/>
23.191 + <test/>
23.192 + </test-dependency>
23.193 + <test-dependency>
23.194 + <code-name-base>org.netbeans.modules.lexer</code-name-base>
23.195 + <recursive/>
23.196 + <compile-dependency/>
23.197 + <test/>
23.198 + </test-dependency>
23.199 + <test-dependency>
23.200 + <code-name-base>org.netbeans.modules.lexer.nbbridge</code-name-base>
23.201 + <compile-dependency/>
23.202 + </test-dependency>
23.203 + <test-dependency>
23.204 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
23.205 + <compile-dependency/>
23.206 + <test/>
23.207 + </test-dependency>
23.208 + <test-dependency>
23.209 + <code-name-base>org.openide.awt</code-name-base>
23.210 + <compile-dependency/>
23.211 + </test-dependency>
23.212 + <test-dependency>
23.213 + <code-name-base>org.openide.loaders</code-name-base>
23.214 + <compile-dependency/>
23.215 + </test-dependency>
23.216 + <test-dependency>
23.217 + <code-name-base>org.openide.nodes</code-name-base>
23.218 + <compile-dependency/>
23.219 + </test-dependency>
23.220 + <test-dependency>
23.221 + <code-name-base>org.openide.util</code-name-base>
23.222 + <compile-dependency/>
23.223 + <test/>
23.224 + </test-dependency>
23.225 + <test-dependency>
23.226 + <code-name-base>org.openide.util.lookup</code-name-base>
23.227 + <compile-dependency/>
23.228 + <test/>
23.229 + </test-dependency>
23.230 + </test-type>
23.231 + </test-dependencies>
23.232 + <public-packages/>
23.233 + </data>
23.234 + </configuration>
23.235 +</project>
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/Bundle.properties Mon Jun 02 14:23:34 2014 +0200
24.3 @@ -0,0 +1,6 @@
24.4 +OpenIDE-Module-Display-Category=Editing
24.5 +OpenIDE-Module-Long-Description=\
24.6 + Oracle JET HTML Editor Support
24.7 +OpenIDE-Module-Name=Oracle JET HTML Editor
24.8 +
24.9 +OpenIDE-Module-Short-Description=Oracle JET HTML Editor Support
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/HelpItemImpl.java Mon Jun 02 14:23:34 2014 +0200
25.3 @@ -0,0 +1,75 @@
25.4 +/*
25.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
25.6 + *
25.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
25.8 + *
25.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
25.10 + * Other names may be trademarks of their respective owners.
25.11 + *
25.12 + * The contents of this file are subject to the terms of either the GNU
25.13 + * General Public License Version 2 only ("GPL") or the Common
25.14 + * Development and Distribution License("CDDL") (collectively, the
25.15 + * "License"). You may not use this file except in compliance with the
25.16 + * License. You can obtain a copy of the License at
25.17 + * http://www.netbeans.org/cddl-gplv2.html
25.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
25.19 + * specific language governing permissions and limitations under the
25.20 + * License. When distributing the software, include this License Header
25.21 + * Notice in each file and include the License file at
25.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
25.23 + * particular file as subject to the "Classpath" exception as provided
25.24 + * by Oracle in the GPL Version 2 section of the License file that
25.25 + * accompanied this code. If applicable, add the following below the
25.26 + * License Header, with the fields enclosed by brackets [] replaced by
25.27 + * your own identifying information:
25.28 + * "Portions Copyrighted [year] [name of copyright owner]"
25.29 + *
25.30 + * If you wish your version of this file to be governed by only the CDDL
25.31 + * or only the GPL Version 2, indicate your decision by adding
25.32 + * "[Contributor] elects to include this software in this distribution
25.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
25.34 + * single choice of license, a recipient has the option to distribute
25.35 + * your version of this file under either the CDDL, the GPL Version 2 or
25.36 + * to extend the choice of license to its licensees as provided above.
25.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
25.38 + * Version 2 license, then the option applies only if the new code is
25.39 + * made subject to such option by the copyright holder.
25.40 + *
25.41 + * Contributor(s):
25.42 + *
25.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
25.44 + */
25.45 +
25.46 +package org.netbeans.modules.html.ojet;
25.47 +
25.48 +import java.net.URL;
25.49 +import org.netbeans.modules.html.editor.lib.api.HelpItem;
25.50 +import org.netbeans.modules.html.editor.lib.api.HelpResolver;
25.51 +
25.52 +/**
25.53 + *
25.54 + * @author Pet Pisl
25.55 + */
25.56 +public class HelpItemImpl implements HelpItem{
25.57 +
25.58 + @Override
25.59 + public String getHelpHeader() {
25.60 + return null;
25.61 + }
25.62 +
25.63 + @Override
25.64 + public String getHelpContent() {
25.65 + return "Oracle JET doc - not available yet";
25.66 + }
25.67 +
25.68 + @Override
25.69 + public URL getHelpURL() {
25.70 + return null;
25.71 + }
25.72 +
25.73 + @Override
25.74 + public HelpResolver getHelpResolver() {
25.75 + return null;
25.76 + }
25.77 +
25.78 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/OJETCompletionHtmlItem.java Mon Jun 02 14:23:34 2014 +0200
26.3 @@ -0,0 +1,86 @@
26.4 +/*
26.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
26.6 + *
26.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
26.8 + *
26.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
26.10 + * Other names may be trademarks of their respective owners.
26.11 + *
26.12 + * The contents of this file are subject to the terms of either the GNU
26.13 + * General Public License Version 2 only ("GPL") or the Common
26.14 + * Development and Distribution License("CDDL") (collectively, the
26.15 + * "License"). You may not use this file except in compliance with the
26.16 + * License. You can obtain a copy of the License at
26.17 + * http://www.netbeans.org/cddl-gplv2.html
26.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
26.19 + * specific language governing permissions and limitations under the
26.20 + * License. When distributing the software, include this License Header
26.21 + * Notice in each file and include the License file at
26.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
26.23 + * particular file as subject to the "Classpath" exception as provided
26.24 + * by Oracle in the GPL Version 2 section of the License file that
26.25 + * accompanied this code. If applicable, add the following below the
26.26 + * License Header, with the fields enclosed by brackets [] replaced by
26.27 + * your own identifying information:
26.28 + * "Portions Copyrighted [year] [name of copyright owner]"
26.29 + *
26.30 + * If you wish your version of this file to be governed by only the CDDL
26.31 + * or only the GPL Version 2, indicate your decision by adding
26.32 + * "[Contributor] elects to include this software in this distribution
26.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
26.34 + * single choice of license, a recipient has the option to distribute
26.35 + * your version of this file under either the CDDL, the GPL Version 2 or
26.36 + * to extend the choice of license to its licensees as provided above.
26.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
26.38 + * Version 2 license, then the option applies only if the new code is
26.39 + * made subject to such option by the copyright holder.
26.40 + *
26.41 + * Contributor(s):
26.42 + *
26.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
26.44 + */
26.45 +
26.46 +package org.netbeans.modules.html.ojet;
26.47 +
26.48 +import javax.swing.ImageIcon;
26.49 +import org.netbeans.modules.html.editor.api.completion.HtmlCompletionItem;
26.50 +import org.netbeans.modules.html.ojet.data.DataItem;
26.51 +
26.52 +
26.53 +/**
26.54 + *
26.55 + * @author Petr Pisl
26.56 + */
26.57 +public class OJETCompletionHtmlItem extends HtmlCompletionItem.Attribute {
26.58 +
26.59 + public OJETCompletionHtmlItem(final DataItem data, final int substituteOffset) {
26.60 + super(data.getName(), substituteOffset, true, "");
26.61 + }
26.62 +
26.63 + @Override
26.64 + protected ImageIcon getIcon() {
26.65 + return OJETUtils.OJET_ICON;
26.66 + }
26.67 +
26.68 + @Override
26.69 + protected String getLeftHtmlText() {
26.70 + return new StringBuilder()
26.71 + .append("<font color=#628FB5>") //NOI18N
26.72 + .append(getItemText())
26.73 + .append("</font>").toString(); //NOI18N
26.74 + }
26.75 +
26.76 + @Override
26.77 + public int getAnchorOffset() {
26.78 + return substitutionOffset - 3;
26.79 + }
26.80 +
26.81 +
26.82 +
26.83 + @Override
26.84 + protected String getSubstituteText() {
26.85 + return new StringBuilder().append(OJETUtils.OJ_COMPONENT).append(": {component: }").toString(); //NOI18N
26.86 + }
26.87 +
26.88 +
26.89 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/OJETContext.java Mon Jun 02 14:23:34 2014 +0200
27.3 @@ -0,0 +1,193 @@
27.4 +/*
27.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
27.6 + *
27.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
27.8 + *
27.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
27.10 + * Other names may be trademarks of their respective owners.
27.11 + *
27.12 + * The contents of this file are subject to the terms of either the GNU
27.13 + * General Public License Version 2 only ("GPL") or the Common
27.14 + * Development and Distribution License("CDDL") (collectively, the
27.15 + * "License"). You may not use this file except in compliance with the
27.16 + * License. You can obtain a copy of the License at
27.17 + * http://www.netbeans.org/cddl-gplv2.html
27.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
27.19 + * specific language governing permissions and limitations under the
27.20 + * License. When distributing the software, include this License Header
27.21 + * Notice in each file and include the License file at
27.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
27.23 + * particular file as subject to the "Classpath" exception as provided
27.24 + * by Oracle in the GPL Version 2 section of the License file that
27.25 + * accompanied this code. If applicable, add the following below the
27.26 + * License Header, with the fields enclosed by brackets [] replaced by
27.27 + * your own identifying information:
27.28 + * "Portions Copyrighted [year] [name of copyright owner]"
27.29 + *
27.30 + * If you wish your version of this file to be governed by only the CDDL
27.31 + * or only the GPL Version 2, indicate your decision by adding
27.32 + * "[Contributor] elects to include this software in this distribution
27.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
27.34 + * single choice of license, a recipient has the option to distribute
27.35 + * your version of this file under either the CDDL, the GPL Version 2 or
27.36 + * to extend the choice of license to its licensees as provided above.
27.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
27.38 + * Version 2 license, then the option applies only if the new code is
27.39 + * made subject to such option by the copyright holder.
27.40 + *
27.41 + * Contributor(s):
27.42 + *
27.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
27.44 + */
27.45 +package org.netbeans.modules.html.ojet;
27.46 +
27.47 +import java.util.Arrays;
27.48 +import javax.swing.text.Document;
27.49 +import org.netbeans.api.html.lexer.HTMLTokenId;
27.50 +import org.netbeans.api.lexer.Token;
27.51 +import org.netbeans.api.lexer.TokenHierarchy;
27.52 +import org.netbeans.api.lexer.TokenSequence;
27.53 +import org.netbeans.modules.html.knockout.api.KODataBindTokenId;
27.54 +import org.netbeans.modules.javascript2.editor.api.lexer.JsTokenId;
27.55 +import org.netbeans.modules.web.common.api.LexerUtils;
27.56 +
27.57 +/**
27.58 + *
27.59 + * @author Petr Pisl
27.60 + */
27.61 +public enum OJETContext {
27.62 +
27.63 + DATA_BINDING,
27.64 + /**
27.65 + * Only in empty configuration json object of a component ojComponent: { | }
27.66 + */
27.67 + COMP_CONF,
27.68 + /**
27.69 + * In configuration json object of a component, when names of the properties
27.70 + * should be displayed ojComponent:{component: 'ojProgressbar', | }
27.71 + */
27.72 + COMP_CONF_PROP_NAME,
27.73 + /**
27.74 + * In configuration json object of a component, where list of components
27.75 + * should be displayed. ojComponent:{component: '|' } or
27.76 + * ojComponent:{component: | }
27.77 + */
27.78 + COMP_CONF_COMP_NAME,
27.79 + UNKNOWN;
27.80 +
27.81 + private static String COMPONENT = "component";
27.82 +
27.83 + public static OJETContext findContext(Document document, int offset) {
27.84 + TokenHierarchy th = TokenHierarchy.get(document);
27.85 + TokenSequence<HTMLTokenId> ts = LexerUtils.getTokenSequence(th, offset, HTMLTokenId.language(), false);
27.86 + if (ts != null) {
27.87 + int diff = ts.move(offset);
27.88 + if (diff == 0 && ts.movePrevious() || ts.moveNext()) {
27.89 + if (ts.token().id() == HTMLTokenId.VALUE) {
27.90 + TokenSequence<KODataBindTokenId> dataBindTs = ts.embedded(KODataBindTokenId.language());
27.91 + if (dataBindTs != null) {
27.92 + if (dataBindTs.isEmpty()) {
27.93 + return DATA_BINDING;
27.94 + }
27.95 + }
27.96 + int ediff = dataBindTs.move(offset);
27.97 + if (ediff == 0 && dataBindTs.movePrevious() || dataBindTs.moveNext()) {
27.98 + //we are on a token of ko-data-bind token sequence
27.99 + Token<KODataBindTokenId> etoken = dataBindTs.token();
27.100 + if (etoken.id() == KODataBindTokenId.KEY) {
27.101 + //ke|
27.102 + return DATA_BINDING;
27.103 + }
27.104 + etoken = LexerUtils.followsToken(dataBindTs,
27.105 + Arrays.asList(KODataBindTokenId.COLON, KODataBindTokenId.COMMA, KODataBindTokenId.VALUE),
27.106 + true, false, KODataBindTokenId.WS);
27.107 + if (etoken == null) {
27.108 + // we are at the beginning of the value
27.109 + return DATA_BINDING;
27.110 + }
27.111 + if (etoken.id() == KODataBindTokenId.VALUE) {
27.112 + etoken = LexerUtils.followsToken(dataBindTs, KODataBindTokenId.KEY, true, true, KODataBindTokenId.COLON);
27.113 + if (!(etoken != null && etoken.id() == KODataBindTokenId.KEY
27.114 + && OJETUtils.OJ_COMPONENT.equals(etoken.text().toString()))) {
27.115 + // continue only if we are in the value
27.116 + return UNKNOWN;
27.117 + }
27.118 + }
27.119 + if (etoken.id() == KODataBindTokenId.COMMA) {
27.120 + return DATA_BINDING;
27.121 + }
27.122 + }
27.123 + }
27.124 + }
27.125 + }
27.126 + TokenSequence<JsTokenId> jsTs = LexerUtils.getTokenSequence(th, offset, JsTokenId.javascriptLanguage(), false);
27.127 + if (jsTs != null) {
27.128 + int diff = jsTs.move(offset);
27.129 + if (diff == 0 && jsTs.movePrevious() || jsTs.moveNext()) {
27.130 + Token<JsTokenId> jsToken = jsTs.token();
27.131 + if (jsToken.id() == JsTokenId.UNKNOWN && !jsTs.movePrevious()) {
27.132 + return UNKNOWN;
27.133 + }
27.134 + jsToken = LexerUtils.followsToken(jsTs,
27.135 + Arrays.asList(JsTokenId.BRACKET_LEFT_CURLY, JsTokenId.OPERATOR_COLON, JsTokenId.OPERATOR_COMMA), true, false, true,
27.136 + JsTokenId.WHITESPACE, JsTokenId.EOL, JsTokenId.STRING, JsTokenId.STRING_BEGIN, JsTokenId.IDENTIFIER);
27.137 + if (jsToken == null) {
27.138 + return UNKNOWN;
27.139 + }
27.140 + if (jsToken.id() == JsTokenId.BRACKET_LEFT_CURLY) {
27.141 + return COMP_CONF;
27.142 + } else if (jsToken.id() == JsTokenId.OPERATOR_COLON) {
27.143 + // we are in the valeu
27.144 + // find the name of property
27.145 + jsToken = LexerUtils.followsToken(jsTs, Arrays.asList(JsTokenId.IDENTIFIER), true, false, JsTokenId.WHITESPACE, JsTokenId.EOL);
27.146 + if (jsToken != null && jsToken.id() == JsTokenId.IDENTIFIER) {
27.147 + if (COMPONENT.equals(jsToken.text().toString())) {
27.148 + return COMP_CONF_COMP_NAME;
27.149 + }
27.150 + }
27.151 + }
27.152 + if (jsToken != null && jsToken.id() == JsTokenId.OPERATOR_COMMA) {
27.153 + return COMP_CONF_PROP_NAME;
27.154 + }
27.155 + }
27.156 +
27.157 + }
27.158 +
27.159 + return UNKNOWN;
27.160 + }
27.161 +
27.162 + /**
27.163 + * Can return null, if there is no component property defined
27.164 + *
27.165 + * @param document
27.166 + * @param dOffset
27.167 + */
27.168 + public static String findComponentName(Document document, int offset) {
27.169 + String name = null;
27.170 + TokenHierarchy th = TokenHierarchy.get(document);
27.171 + if (th == null) {
27.172 + return name;
27.173 + }
27.174 + TokenSequence<JsTokenId> ts = LexerUtils.getTokenSequence(th, offset, JsTokenId.javascriptLanguage(), false);
27.175 + if (ts != null) {
27.176 + // try to find from beginning
27.177 + ts.moveStart();
27.178 + if (ts.movePrevious() || ts.moveNext()) {
27.179 + Token<JsTokenId> jsToken = LexerUtils.followsToken(ts, JsTokenId.IDENTIFIER, false, false,
27.180 + JsTokenId.WHITESPACE, JsTokenId.BRACKET_LEFT_CURLY);
27.181 + if (jsToken != null && jsToken.id() == JsTokenId.IDENTIFIER) {
27.182 + if (COMPONENT.equals(jsToken.text().toString())) {
27.183 + // we found the component property, now to find the value
27.184 + jsToken = LexerUtils.followsToken(ts, JsTokenId.STRING, false, false,
27.185 + JsTokenId.WHITESPACE, JsTokenId.BLOCK_COMMENT, JsTokenId.EOL, JsTokenId.OPERATOR_COLON, JsTokenId.STRING_BEGIN);
27.186 + if (jsToken != null && jsToken.id() == JsTokenId.STRING) {
27.187 + return jsToken.text().toString();
27.188 + }
27.189 + }
27.190 + }
27.191 + }
27.192 +
27.193 + }
27.194 + return name;
27.195 + }
27.196 +}
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/OJETHtmlExtension.java Mon Jun 02 14:23:34 2014 +0200
28.3 @@ -0,0 +1,90 @@
28.4 +/*
28.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
28.6 + *
28.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
28.8 + *
28.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
28.10 + * Other names may be trademarks of their respective owners.
28.11 + *
28.12 + * The contents of this file are subject to the terms of either the GNU
28.13 + * General Public License Version 2 only ("GPL") or the Common
28.14 + * Development and Distribution License("CDDL") (collectively, the
28.15 + * "License"). You may not use this file except in compliance with the
28.16 + * License. You can obtain a copy of the License at
28.17 + * http://www.netbeans.org/cddl-gplv2.html
28.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
28.19 + * specific language governing permissions and limitations under the
28.20 + * License. When distributing the software, include this License Header
28.21 + * Notice in each file and include the License file at
28.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
28.23 + * particular file as subject to the "Classpath" exception as provided
28.24 + * by Oracle in the GPL Version 2 section of the License file that
28.25 + * accompanied this code. If applicable, add the following below the
28.26 + * License Header, with the fields enclosed by brackets [] replaced by
28.27 + * your own identifying information:
28.28 + * "Portions Copyrighted [year] [name of copyright owner]"
28.29 + *
28.30 + * If you wish your version of this file to be governed by only the CDDL
28.31 + * or only the GPL Version 2, indicate your decision by adding
28.32 + * "[Contributor] elects to include this software in this distribution
28.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
28.34 + * single choice of license, a recipient has the option to distribute
28.35 + * your version of this file under either the CDDL, the GPL Version 2 or
28.36 + * to extend the choice of license to its licensees as provided above.
28.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
28.38 + * Version 2 license, then the option applies only if the new code is
28.39 + * made subject to such option by the copyright holder.
28.40 + *
28.41 + * Contributor(s):
28.42 + *
28.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
28.44 + */
28.45 +package org.netbeans.modules.html.ojet;
28.46 +
28.47 +import java.util.ArrayList;
28.48 +import java.util.Collection;
28.49 +import java.util.Collections;
28.50 +import java.util.List;
28.51 +import javax.swing.text.Document;
28.52 +import org.netbeans.api.editor.mimelookup.MimeRegistration;
28.53 +import org.netbeans.api.editor.mimelookup.MimeRegistrations;
28.54 +import org.netbeans.modules.html.editor.api.gsf.HtmlExtension;
28.55 +import org.netbeans.modules.html.ojet.data.DataItem;
28.56 +import org.netbeans.modules.html.ojet.data.DataProvider;
28.57 +import org.netbeans.modules.html.ojet.data.DataProviderImpl;
28.58 +import org.netbeans.spi.editor.completion.CompletionItem;
28.59 +
28.60 +/**
28.61 + *
28.62 + * @author Petr Pisl
28.63 + */
28.64 +@MimeRegistrations({
28.65 + @MimeRegistration(mimeType = "text/html", service = HtmlExtension.class),
28.66 + @MimeRegistration(mimeType = "text/xhtml", service = HtmlExtension.class)
28.67 +})
28.68 +public class OJETHtmlExtension extends HtmlExtension {
28.69 +
28.70 + private static String DATA_BINDING = "data-bind";
28.71 +
28.72 + @Override
28.73 + public List<CompletionItem> completeAttributeValue(CompletionContext context) {
28.74 + String attribute = context.getAttributeName();
28.75 + if (DATA_BINDING.equals(attribute)) {
28.76 +
28.77 + Document document = context.getResult().getSnapshot().getSource().getDocument(true);
28.78 + int offset = context.getOriginalOffset();
28.79 + OJETContext ojContext = OJETContext.findContext(document, offset);
28.80 + switch (ojContext) {
28.81 + case DATA_BINDING:
28.82 + String prefix = OJETUtils.getPrefix(ojContext, document, offset);
28.83 + Collection<DataItem> data = DataProvider.filterByPrefix(DataProviderImpl.getInstance().getBindingOptions(), prefix);
28.84 + List<CompletionItem> result = new ArrayList();
28.85 + for (DataItem item : data) {
28.86 + result.add(new OJETCompletionHtmlItem(item, OJETUtils.getPrefixOffset(ojContext, document, offset)));
28.87 + }
28.88 + return result;
28.89 + }
28.90 + }
28.91 + return Collections.emptyList();
28.92 + }
28.93 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/OJETUtils.java Mon Jun 02 14:23:34 2014 +0200
29.3 @@ -0,0 +1,108 @@
29.4 +/*
29.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
29.6 + *
29.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
29.8 + *
29.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
29.10 + * Other names may be trademarks of their respective owners.
29.11 + *
29.12 + * The contents of this file are subject to the terms of either the GNU
29.13 + * General Public License Version 2 only ("GPL") or the Common
29.14 + * Development and Distribution License("CDDL") (collectively, the
29.15 + * "License"). You may not use this file except in compliance with the
29.16 + * License. You can obtain a copy of the License at
29.17 + * http://www.netbeans.org/cddl-gplv2.html
29.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
29.19 + * specific language governing permissions and limitations under the
29.20 + * License. When distributing the software, include this License Header
29.21 + * Notice in each file and include the License file at
29.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
29.23 + * particular file as subject to the "Classpath" exception as provided
29.24 + * by Oracle in the GPL Version 2 section of the License file that
29.25 + * accompanied this code. If applicable, add the following below the
29.26 + * License Header, with the fields enclosed by brackets [] replaced by
29.27 + * your own identifying information:
29.28 + * "Portions Copyrighted [year] [name of copyright owner]"
29.29 + *
29.30 + * If you wish your version of this file to be governed by only the CDDL
29.31 + * or only the GPL Version 2, indicate your decision by adding
29.32 + * "[Contributor] elects to include this software in this distribution
29.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
29.34 + * single choice of license, a recipient has the option to distribute
29.35 + * your version of this file under either the CDDL, the GPL Version 2 or
29.36 + * to extend the choice of license to its licensees as provided above.
29.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
29.38 + * Version 2 license, then the option applies only if the new code is
29.39 + * made subject to such option by the copyright holder.
29.40 + *
29.41 + * Contributor(s):
29.42 + *
29.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
29.44 + */
29.45 +package org.netbeans.modules.html.ojet;
29.46 +
29.47 +import javax.swing.ImageIcon;
29.48 +import javax.swing.text.Document;
29.49 +import org.netbeans.api.lexer.Token;
29.50 +import org.netbeans.api.lexer.TokenHierarchy;
29.51 +import org.netbeans.api.lexer.TokenSequence;
29.52 +import org.netbeans.modules.html.knockout.api.KODataBindTokenId;
29.53 +import org.netbeans.modules.web.common.api.LexerUtils;
29.54 +import org.openide.util.ImageUtilities;
29.55 +
29.56 +/**
29.57 + *
29.58 + * @author Petr Pisl
29.59 + */
29.60 +public class OJETUtils {
29.61 +
29.62 + public static String OJ_COMPONENT = "ojComponent"; //NOI18N
29.63 +
29.64 + public static final ImageIcon OJET_ICON
29.65 + = ImageUtilities.loadImageIcon("org/netbeans/modules/html/ojet/ojet-icon.png", false); // NOI18N
29.66 +
29.67 + public static String getPrefix(OJETContext ojContext, Document document, int offset) {
29.68 + TokenHierarchy th = TokenHierarchy.get(document);
29.69 + String empty = "";
29.70 + switch (ojContext) {
29.71 + case DATA_BINDING:
29.72 + TokenSequence<KODataBindTokenId> ts = LexerUtils.getTokenSequence(th, offset, KODataBindTokenId.language(), false);
29.73 + if (ts != null) {
29.74 + int diff = ts.move(offset);
29.75 + if (diff == 0 && ts.movePrevious() || ts.moveNext()) {
29.76 + //we are on a token of ko-data-bind token sequence
29.77 + Token<KODataBindTokenId> etoken = ts.token();
29.78 + if (etoken.id() == KODataBindTokenId.KEY) {
29.79 + //ke|
29.80 + CharSequence prefix = diff == 0 ? etoken.text() : etoken.text().subSequence(0, diff);
29.81 + return prefix.toString();
29.82 + }
29.83 + }
29.84 + break;
29.85 + }
29.86 + }
29.87 + return empty;
29.88 + }
29.89 +
29.90 + public static int getPrefixOffset(OJETContext ojContext, Document document, int offset) {
29.91 + TokenHierarchy th = TokenHierarchy.get(document);
29.92 + int result = offset;
29.93 + switch (ojContext) {
29.94 + case DATA_BINDING:
29.95 + TokenSequence<KODataBindTokenId> ts = LexerUtils.getTokenSequence(th, offset, KODataBindTokenId.language(), false);
29.96 + if (ts != null) {
29.97 + int diff = ts.move(offset);
29.98 + if (diff == 0 && ts.movePrevious() || ts.moveNext()) {
29.99 + //we are on a token of ko-data-bind token sequence
29.100 + Token<KODataBindTokenId> etoken = ts.token();
29.101 + if (etoken.id() == KODataBindTokenId.KEY) {
29.102 + //ke
29.103 + return ts.offset();
29.104 + }
29.105 + }
29.106 + break;
29.107 + }
29.108 + }
29.109 + return result;
29.110 + }
29.111 +}
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/data/DataItem.java Mon Jun 02 14:23:34 2014 +0200
30.3 @@ -0,0 +1,59 @@
30.4 +/*
30.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
30.6 + *
30.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
30.8 + *
30.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
30.10 + * Other names may be trademarks of their respective owners.
30.11 + *
30.12 + * The contents of this file are subject to the terms of either the GNU
30.13 + * General Public License Version 2 only ("GPL") or the Common
30.14 + * Development and Distribution License("CDDL") (collectively, the
30.15 + * "License"). You may not use this file except in compliance with the
30.16 + * License. You can obtain a copy of the License at
30.17 + * http://www.netbeans.org/cddl-gplv2.html
30.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
30.19 + * specific language governing permissions and limitations under the
30.20 + * License. When distributing the software, include this License Header
30.21 + * Notice in each file and include the License file at
30.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
30.23 + * particular file as subject to the "Classpath" exception as provided
30.24 + * by Oracle in the GPL Version 2 section of the License file that
30.25 + * accompanied this code. If applicable, add the following below the
30.26 + * License Header, with the fields enclosed by brackets [] replaced by
30.27 + * your own identifying information:
30.28 + * "Portions Copyrighted [year] [name of copyright owner]"
30.29 + *
30.30 + * If you wish your version of this file to be governed by only the CDDL
30.31 + * or only the GPL Version 2, indicate your decision by adding
30.32 + * "[Contributor] elects to include this software in this distribution
30.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
30.34 + * single choice of license, a recipient has the option to distribute
30.35 + * your version of this file under either the CDDL, the GPL Version 2 or
30.36 + * to extend the choice of license to its licensees as provided above.
30.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
30.38 + * Version 2 license, then the option applies only if the new code is
30.39 + * made subject to such option by the copyright holder.
30.40 + *
30.41 + * Contributor(s):
30.42 + *
30.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
30.44 + */
30.45 +
30.46 +package org.netbeans.modules.html.ojet.data;
30.47 +
30.48 +/**
30.49 + *
30.50 + * @author Petr Pisl
30.51 + */
30.52 +public interface DataItem {
30.53 +
30.54 + public String getName();
30.55 +
30.56 + public String getDocumentation();
30.57 +
30.58 + public String getDocUrl();
30.59 +
30.60 + public String getTemplate();
30.61 +
30.62 +}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/data/DataItemImpl.java Mon Jun 02 14:23:34 2014 +0200
31.3 @@ -0,0 +1,275 @@
31.4 +/*
31.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
31.6 + *
31.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
31.8 + *
31.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
31.10 + * Other names may be trademarks of their respective owners.
31.11 + *
31.12 + * The contents of this file are subject to the terms of either the GNU
31.13 + * General Public License Version 2 only ("GPL") or the Common
31.14 + * Development and Distribution License("CDDL") (collectively, the
31.15 + * "License"). You may not use this file except in compliance with the
31.16 + * License. You can obtain a copy of the License at
31.17 + * http://www.netbeans.org/cddl-gplv2.html
31.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
31.19 + * specific language governing permissions and limitations under the
31.20 + * License. When distributing the software, include this License Header
31.21 + * Notice in each file and include the License file at
31.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
31.23 + * particular file as subject to the "Classpath" exception as provided
31.24 + * by Oracle in the GPL Version 2 section of the License file that
31.25 + * accompanied this code. If applicable, add the following below the
31.26 + * License Header, with the fields enclosed by brackets [] replaced by
31.27 + * your own identifying information:
31.28 + * "Portions Copyrighted [year] [name of copyright owner]"
31.29 + *
31.30 + * If you wish your version of this file to be governed by only the CDDL
31.31 + * or only the GPL Version 2, indicate your decision by adding
31.32 + * "[Contributor] elects to include this software in this distribution
31.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
31.34 + * single choice of license, a recipient has the option to distribute
31.35 + * your version of this file under either the CDDL, the GPL Version 2 or
31.36 + * to extend the choice of license to its licensees as provided above.
31.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
31.38 + * Version 2 license, then the option applies only if the new code is
31.39 + * made subject to such option by the copyright holder.
31.40 + *
31.41 + * Contributor(s):
31.42 + *
31.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
31.44 + */
31.45 +package org.netbeans.modules.html.ojet.data;
31.46 +
31.47 +import java.io.BufferedReader;
31.48 +import java.io.File;
31.49 +import java.io.FileInputStream;
31.50 +import java.io.FileNotFoundException;
31.51 +import java.io.IOException;
31.52 +import java.io.InputStream;
31.53 +import java.io.InputStreamReader;
31.54 +import java.io.Reader;
31.55 +import java.net.MalformedURLException;
31.56 +import java.net.URL;
31.57 +import java.util.ArrayList;
31.58 +import java.util.Collection;
31.59 +import java.util.Collections;
31.60 +import java.util.List;
31.61 +import org.openide.filesystems.FileObject;
31.62 +import org.openide.filesystems.FileUtil;
31.63 +import org.openide.util.Exceptions;
31.64 +
31.65 +/**
31.66 + *
31.67 + * @author Petr Pisl
31.68 + */
31.69 +public class DataItemImpl implements DataItem {
31.70 +
31.71 + private final String name;
31.72 + private final String docUrl;
31.73 +
31.74 + public DataItemImpl(String name, String docUrl) {
31.75 + this.name = name;
31.76 + this.docUrl = docUrl;
31.77 + }
31.78 +
31.79 + @Override
31.80 + public String getName() {
31.81 + return name;
31.82 + }
31.83 +
31.84 + @Override
31.85 + public String getDocumentation() {
31.86 + return null;
31.87 + }
31.88 +
31.89 + @Override
31.90 + public String getDocUrl() {
31.91 + return docUrl;
31.92 + }
31.93 +
31.94 + @Override
31.95 + public String getTemplate() {
31.96 + return null;
31.97 + }
31.98 +
31.99 + public static class DataItemComponent extends DataItemImpl {
31.100 +
31.101 + private List<DataItem> options = null;
31.102 +
31.103 + public DataItemComponent(String name, String docUrl) {
31.104 + super(name, docUrl);
31.105 + }
31.106 +
31.107 + @Override
31.108 + public String getDocumentation() {
31.109 + InputStream in = null;
31.110 + try {
31.111 + in = getInputStream(new URL(getDocUrl()));
31.112 + BufferedReader br = new BufferedReader(new InputStreamReader(in));
31.113 + String line;
31.114 +
31.115 + StringBuilder content = new StringBuilder();
31.116 + int countHeader = 0;
31.117 +
31.118 + while ((line = br.readLine()) != null) {
31.119 + if (line.contains("<header>")) {
31.120 + countHeader++;
31.121 + }
31.122 + if (countHeader > 1) {
31.123 + content.append(line);
31.124 + if (line.contains("</header")) {
31.125 + countHeader--;
31.126 + if (countHeader == 1) {
31.127 + break;
31.128 + }
31.129 + }
31.130 + }
31.131 +
31.132 + }
31.133 + br.close();
31.134 + return content.toString();
31.135 + } catch (IOException ex) {
31.136 + Exceptions.printStackTrace(ex);
31.137 + } finally {
31.138 + try {
31.139 + in.close();
31.140 + } catch (IOException ex) {
31.141 + Exceptions.printStackTrace(ex);
31.142 + }
31.143 + }
31.144 + return null;
31.145 + }
31.146 +
31.147 + public Collection<DataItem> getOptions() {
31.148 + if (options == null) {
31.149 + options = new ArrayList();
31.150 + InputStream in = null;
31.151 + try {
31.152 + in = getInputStream(new URL(getDocUrl()));
31.153 + BufferedReader br = new BufferedReader(new InputStreamReader(in));
31.154 + String line;
31.155 + boolean inMembers = false;
31.156 +
31.157 + while ((line = br.readLine()) != null) {
31.158 + if (!inMembers && line.contains("<a href=\"#members-section\">")) {
31.159 + inMembers = true;
31.160 + }
31.161 + if (inMembers) {
31.162 + if (line.contains("<li>")) {
31.163 + String name = line.substring(line.indexOf("<li"));
31.164 + name = name.substring(name.indexOf(">") + 1); // end of li tag
31.165 + name = name.substring(name.indexOf(">") + 1); // end of a tag
31.166 + name = name.substring(0, name.indexOf('<'));
31.167 + options.add(new DataItemOption(name, getDocUrl()));
31.168 + }
31.169 + if (line.contains("</ul>")) {
31.170 + break;
31.171 + }
31.172 + }
31.173 +
31.174 + }
31.175 + br.close();
31.176 + } catch (IOException ex) {
31.177 + Exceptions.printStackTrace(ex);
31.178 + } finally {
31.179 + try {
31.180 + in.close();
31.181 + } catch (IOException ex) {
31.182 + Exceptions.printStackTrace(ex);
31.183 + }
31.184 + }
31.185 + }
31.186 + return Collections.unmodifiableCollection(options);
31.187 + }
31.188 + }
31.189 +
31.190 + public static class DataItemOption extends DataItemImpl {
31.191 +
31.192 + public DataItemOption(String name, String docUrl) {
31.193 + super(name, docUrl);
31.194 + }
31.195 +
31.196 + @Override
31.197 + public String getDocumentation() {
31.198 + InputStream in = null;
31.199 + try {
31.200 + in = getInputStream(new URL(getDocUrl()));
31.201 + BufferedReader br = new BufferedReader(new InputStreamReader(in));
31.202 + String line;
31.203 +
31.204 + StringBuilder content = new StringBuilder();
31.205 + String startText = "<h4 id=\"" + getName() + "\" class=\"name\">";
31.206 + boolean inSection = false;
31.207 + content.append("<dt>");
31.208 + int ddCount = 0;
31.209 + while ((line = br.readLine()) != null) {
31.210 + if (!inSection && line.contains(startText)) {
31.211 + inSection = true;
31.212 + }
31.213 + if (inSection) {
31.214 +
31.215 +// if (line.contains("class=\"name\"")) {
31.216 +// line.replace("class=\"name\"", "style=font-family: Consolas, \"Lucida Console\", Monaco, monospace;");
31.217 +// }
31.218 + content.append(line);
31.219 + if (line.contains("<dd")) {
31.220 + ddCount++;
31.221 + }
31.222 + if (line.contains("</dd")) {
31.223 + ddCount--;
31.224 + if (ddCount == 0) {
31.225 + break;
31.226 + }
31.227 + }
31.228 + }
31.229 +
31.230 + }
31.231 + br.close();
31.232 + String result = content.toString();
31.233 +// result = result.replaceAll("class=\"type-signature\"", "style=\"color: #aaa\"");
31.234 +// result = result.replaceAll("class=\"description\"", "style=\"margin-bottom: 1em; margin-left: -16px; margin-top: 1em;\"");
31.235 + return result;
31.236 + } catch (IOException ex) {
31.237 + Exceptions.printStackTrace(ex);
31.238 + } finally {
31.239 + try {
31.240 + in.close();
31.241 + } catch (IOException ex) {
31.242 + Exceptions.printStackTrace(ex);
31.243 + }
31.244 + }
31.245 + return null;
31.246 + }
31.247 +
31.248 + }
31.249 +
31.250 + private static InputStream getInputStream(URL url) {
31.251 + URL rootURL = FileUtil.getArchiveFile(url);
31.252 + FileObject rootFO = FileUtil.toFileObject(FileUtil.archiveOrDirForURL(rootURL));
31.253 + rootFO = FileUtil.getArchiveRoot(rootFO);
31.254 + FileObject docFO = rootFO.getFileObject(url.toString().substring(rootURL.toString().length() + 5));
31.255 + InputStream result = null;
31.256 + try {
31.257 + result = docFO.getInputStream();
31.258 + } catch (FileNotFoundException ex) {
31.259 + Exceptions.printStackTrace(ex);
31.260 + }
31.261 + return result;
31.262 + }
31.263 +
31.264 + private static String getFileContent(InputStream in) throws IOException {
31.265 + Reader r = new InputStreamReader(in, "UTF-8"); // NOI18N
31.266 + StringBuilder sb = new StringBuilder();
31.267 + try {
31.268 + char[] buf = new char[2048];
31.269 + int read;
31.270 + while ((read = r.read(buf)) != -1) {
31.271 + sb.append(buf, 0, read);
31.272 + }
31.273 + } finally {
31.274 + r.close();
31.275 + }
31.276 + return sb.toString();
31.277 + }
31.278 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/data/DataProvider.java Mon Jun 02 14:23:34 2014 +0200
32.3 @@ -0,0 +1,73 @@
32.4 +/*
32.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
32.6 + *
32.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
32.8 + *
32.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
32.10 + * Other names may be trademarks of their respective owners.
32.11 + *
32.12 + * The contents of this file are subject to the terms of either the GNU
32.13 + * General Public License Version 2 only ("GPL") or the Common
32.14 + * Development and Distribution License("CDDL") (collectively, the
32.15 + * "License"). You may not use this file except in compliance with the
32.16 + * License. You can obtain a copy of the License at
32.17 + * http://www.netbeans.org/cddl-gplv2.html
32.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
32.19 + * specific language governing permissions and limitations under the
32.20 + * License. When distributing the software, include this License Header
32.21 + * Notice in each file and include the License file at
32.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
32.23 + * particular file as subject to the "Classpath" exception as provided
32.24 + * by Oracle in the GPL Version 2 section of the License file that
32.25 + * accompanied this code. If applicable, add the following below the
32.26 + * License Header, with the fields enclosed by brackets [] replaced by
32.27 + * your own identifying information:
32.28 + * "Portions Copyrighted [year] [name of copyright owner]"
32.29 + *
32.30 + * If you wish your version of this file to be governed by only the CDDL
32.31 + * or only the GPL Version 2, indicate your decision by adding
32.32 + * "[Contributor] elects to include this software in this distribution
32.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
32.34 + * single choice of license, a recipient has the option to distribute
32.35 + * your version of this file under either the CDDL, the GPL Version 2 or
32.36 + * to extend the choice of license to its licensees as provided above.
32.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
32.38 + * Version 2 license, then the option applies only if the new code is
32.39 + * made subject to such option by the copyright holder.
32.40 + *
32.41 + * Contributor(s):
32.42 + *
32.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
32.44 + */
32.45 +package org.netbeans.modules.html.ojet.data;
32.46 +
32.47 +import java.util.ArrayList;
32.48 +import java.util.Collection;
32.49 +import java.util.List;
32.50 +
32.51 +/**
32.52 + *
32.53 + * @author Petr Pisl
32.54 + */
32.55 +public abstract class DataProvider {
32.56 +
32.57 + public abstract Collection<DataItem> getBindingOptions();
32.58 +
32.59 + public abstract Collection<DataItem> getComponents();
32.60 +
32.61 + public abstract Collection<DataItem> getComponentOptions(String compName);
32.62 +
32.63 + public static Collection<DataItem> filterByPrefix(Collection<? extends DataItem> data, String prefix) {
32.64 + List<DataItem> result = new ArrayList<>();
32.65 + if (prefix == null || prefix.isEmpty()) {
32.66 + result.addAll(data);
32.67 + } else {
32.68 + for (DataItem dataItem : data) {
32.69 + if (dataItem.getName().startsWith(prefix)) {
32.70 + result.add(dataItem);
32.71 + }
32.72 + }
32.73 + }
32.74 + return result;
32.75 + }
32.76 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/data/DataProviderImpl.java Mon Jun 02 14:23:34 2014 +0200
33.3 @@ -0,0 +1,115 @@
33.4 +/*
33.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33.6 + *
33.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
33.8 + *
33.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
33.10 + * Other names may be trademarks of their respective owners.
33.11 + *
33.12 + * The contents of this file are subject to the terms of either the GNU
33.13 + * General Public License Version 2 only ("GPL") or the Common
33.14 + * Development and Distribution License("CDDL") (collectively, the
33.15 + * "License"). You may not use this file except in compliance with the
33.16 + * License. You can obtain a copy of the License at
33.17 + * http://www.netbeans.org/cddl-gplv2.html
33.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
33.19 + * specific language governing permissions and limitations under the
33.20 + * License. When distributing the software, include this License Header
33.21 + * Notice in each file and include the License file at
33.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
33.23 + * particular file as subject to the "Classpath" exception as provided
33.24 + * by Oracle in the GPL Version 2 section of the License file that
33.25 + * accompanied this code. If applicable, add the following below the
33.26 + * License Header, with the fields enclosed by brackets [] replaced by
33.27 + * your own identifying information:
33.28 + * "Portions Copyrighted [year] [name of copyright owner]"
33.29 + *
33.30 + * If you wish your version of this file to be governed by only the CDDL
33.31 + * or only the GPL Version 2, indicate your decision by adding
33.32 + * "[Contributor] elects to include this software in this distribution
33.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
33.34 + * single choice of license, a recipient has the option to distribute
33.35 + * your version of this file under either the CDDL, the GPL Version 2 or
33.36 + * to extend the choice of license to its licensees as provided above.
33.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
33.38 + * Version 2 license, then the option applies only if the new code is
33.39 + * made subject to such option by the copyright holder.
33.40 + *
33.41 + * Contributor(s):
33.42 + *
33.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
33.44 + */
33.45 +package org.netbeans.modules.html.ojet.data;
33.46 +
33.47 +import java.io.File;
33.48 +import java.util.ArrayList;
33.49 +import java.util.Collection;
33.50 +import java.util.Collections;
33.51 +import java.util.HashMap;
33.52 +import java.util.List;
33.53 +import org.netbeans.modules.html.ojet.OJETUtils;
33.54 +import org.openide.filesystems.FileObject;
33.55 +import org.openide.filesystems.FileUtil;
33.56 +import org.openide.modules.InstalledFileLocator;
33.57 +
33.58 +/**
33.59 + *
33.60 + * @author Petr Pisl
33.61 + */
33.62 +public class DataProviderImpl extends DataProvider {
33.63 +
33.64 + private static DataProviderImpl instance = null;
33.65 + private static final String zipURL = "docs/ojetdocs.zip";
33.66 + private static final HashMap<String, DataItemImpl.DataItemComponent> data = new HashMap<>();
33.67 + private static FileObject docRoot = null;
33.68 +
33.69 + synchronized public static DataProvider getInstance() {
33.70 + if (instance == null) {
33.71 + instance = new DataProviderImpl();
33.72 + File zipFile = InstalledFileLocator.getDefault().locate(zipURL, "org.netbeans.modules.html.ojet", false); //NOI18N
33.73 + if (zipFile.exists()) {
33.74 + docRoot = FileUtil.toFileObject(zipFile);
33.75 + docRoot = FileUtil.getArchiveRoot(docRoot);
33.76 + if (docRoot != null) {
33.77 + FileObject folder = docRoot.getFileObject("docs"); // NOI18N
33.78 + if (folder != null && folder.isValid()) {
33.79 + for (FileObject child : folder.getChildren()) {
33.80 + String name = child.getName();
33.81 + if (name.startsWith("oj.oj")) {
33.82 + name = name.substring(3);
33.83 +
33.84 + data.put(name, new DataItemImpl.DataItemComponent(name, child.toURL().toString()));
33.85 + }
33.86 + }
33.87 + }
33.88 + }
33.89 + }
33.90 + }
33.91 + return instance;
33.92 + }
33.93 +
33.94 + @Override
33.95 + public Collection<DataItem> getBindingOptions() {
33.96 + List<DataItem> result = new ArrayList(1);
33.97 + result.add(new DataItemImpl(OJETUtils.OJ_COMPONENT, null));
33.98 + return result;
33.99 + }
33.100 +
33.101 + @Override
33.102 + public Collection<DataItem> getComponents() {
33.103 + List<DataItem> result = new ArrayList<>();
33.104 + for (DataItem component : data.values()) {
33.105 + result.add(component);
33.106 + }
33.107 + return result;
33.108 + }
33.109 +
33.110 + @Override
33.111 + public Collection<DataItem> getComponentOptions(String compName) {
33.112 + DataItemImpl.DataItemComponent component = data.get(compName);
33.113 + if (component != null) {
33.114 + return component.getOptions();
33.115 + }
33.116 + return Collections.emptyList();
33.117 + }
33.118 +}
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/javascript/ModelUtils.java Mon Jun 02 14:23:34 2014 +0200
34.3 @@ -0,0 +1,82 @@
34.4 +/*
34.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
34.6 + *
34.7 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
34.8 + *
34.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
34.10 + * Other names may be trademarks of their respective owners.
34.11 + *
34.12 + * The contents of this file are subject to the terms of either the GNU
34.13 + * General Public License Version 2 only ("GPL") or the Common
34.14 + * Development and Distribution License("CDDL") (collectively, the
34.15 + * "License"). You may not use this file except in compliance with the
34.16 + * License. You can obtain a copy of the License at
34.17 + * http://www.netbeans.org/cddl-gplv2.html
34.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
34.19 + * specific language governing permissions and limitations under the
34.20 + * License. When distributing the software, include this License Header
34.21 + * Notice in each file and include the License file at
34.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
34.23 + * particular file as subject to the "Classpath" exception as provided
34.24 + * by Oracle in the GPL Version 2 section of the License file that
34.25 + * accompanied this code. If applicable, add the following below the
34.26 + * License Header, with the fields enclosed by brackets [] replaced by
34.27 + * your own identifying information:
34.28 + * "Portions Copyrighted [year] [name of copyright owner]"
34.29 + *
34.30 + * If you wish your version of this file to be governed by only the CDDL
34.31 + * or only the GPL Version 2, indicate your decision by adding
34.32 + * "[Contributor] elects to include this software in this distribution
34.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
34.34 + * single choice of license, a recipient has the option to distribute
34.35 + * your version of this file under either the CDDL, the GPL Version 2 or
34.36 + * to extend the choice of license to its licensees as provided above.
34.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
34.38 + * Version 2 license, then the option applies only if the new code is
34.39 + * made subject to such option by the copyright holder.
34.40 + *
34.41 + * Contributor(s):
34.42 + *
34.43 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
34.44 + */
34.45 +package org.netbeans.modules.html.ojet.javascript;
34.46 +
34.47 +import org.netbeans.modules.javascript2.editor.model.JsArray;
34.48 +import org.netbeans.modules.javascript2.editor.model.JsElement;
34.49 +import org.netbeans.modules.javascript2.editor.model.JsObject;
34.50 +
34.51 +/**
34.52 + *
34.53 + * @author Petr Pisl
34.54 + */
34.55 +public class ModelUtils {
34.56 + // TODO this class shouldnot be there. The model utils should be a part
34.57 + // of the editor API. This is copy paste from ModelUtils
34.58 +
34.59 + public static JsObject findJsObject(JsObject object, int offset) {
34.60 + JsObject jsObject = object;
34.61 + JsObject result = null;
34.62 + JsObject tmpObject = null;
34.63 + if (jsObject.getOffsetRange().containsInclusive(offset)) {
34.64 + result = jsObject;
34.65 + for (JsObject property : jsObject.getProperties().values()) {
34.66 + JsElement.Kind kind = property.getJSKind();
34.67 + if (kind == JsElement.Kind.OBJECT || kind == JsElement.Kind.ANONYMOUS_OBJECT || kind == JsElement.Kind.OBJECT_LITERAL
34.68 + || kind == JsElement.Kind.FUNCTION || kind == JsElement.Kind.METHOD || kind == JsElement.Kind.CONSTRUCTOR
34.69 + || kind == JsElement.Kind.WITH_OBJECT) {
34.70 + tmpObject = findJsObject(property, offset);
34.71 + }
34.72 + if (tmpObject != null) {
34.73 + if (tmpObject instanceof JsArray) {
34.74 + tmpObject = null;
34.75 + result = tmpObject;
34.76 + } else {
34.77 + result = tmpObject;
34.78 + break;
34.79 + }
34.80 + }
34.81 + }
34.82 + }
34.83 + return result;
34.84 + }
34.85 +}
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/javascript/OJETCodeCompletionItem.java Mon Jun 02 14:23:34 2014 +0200
35.3 @@ -0,0 +1,270 @@
35.4 +/*
35.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
35.6 + *
35.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
35.8 + *
35.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
35.10 + * Other names may be trademarks of their respective owners.
35.11 + *
35.12 + * The contents of this file are subject to the terms of either the GNU
35.13 + * General Public License Version 2 only ("GPL") or the Common
35.14 + * Development and Distribution License("CDDL") (collectively, the
35.15 + * "License"). You may not use this file except in compliance with the
35.16 + * License. You can obtain a copy of the License at
35.17 + * http://www.netbeans.org/cddl-gplv2.html
35.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
35.19 + * specific language governing permissions and limitations under the
35.20 + * License. When distributing the software, include this License Header
35.21 + * Notice in each file and include the License file at
35.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
35.23 + * particular file as subject to the "Classpath" exception as provided
35.24 + * by Oracle in the GPL Version 2 section of the License file that
35.25 + * accompanied this code. If applicable, add the following below the
35.26 + * License Header, with the fields enclosed by brackets [] replaced by
35.27 + * your own identifying information:
35.28 + * "Portions Copyrighted [year] [name of copyright owner]"
35.29 + *
35.30 + * If you wish your version of this file to be governed by only the CDDL
35.31 + * or only the GPL Version 2, indicate your decision by adding
35.32 + * "[Contributor] elects to include this software in this distribution
35.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
35.34 + * single choice of license, a recipient has the option to distribute
35.35 + * your version of this file under either the CDDL, the GPL Version 2 or
35.36 + * to extend the choice of license to its licensees as provided above.
35.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
35.38 + * Version 2 license, then the option applies only if the new code is
35.39 + * made subject to such option by the copyright holder.
35.40 + *
35.41 + * Contributor(s):
35.42 + *
35.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
35.44 + */
35.45 +package org.netbeans.modules.html.ojet.javascript;
35.46 +
35.47 +import java.util.Collections;
35.48 +import java.util.Set;
35.49 +import javax.swing.ImageIcon;
35.50 +import org.netbeans.api.lexer.Token;
35.51 +import org.netbeans.api.lexer.TokenHierarchy;
35.52 +import org.netbeans.api.lexer.TokenSequence;
35.53 +import org.netbeans.modules.csl.api.CodeCompletionContext;
35.54 +import org.netbeans.modules.csl.api.CompletionProposal;
35.55 +import org.netbeans.modules.csl.api.ElementHandle;
35.56 +import org.netbeans.modules.csl.api.ElementKind;
35.57 +import org.netbeans.modules.csl.api.HtmlFormatter;
35.58 +import org.netbeans.modules.csl.api.Modifier;
35.59 +import org.netbeans.modules.csl.api.OffsetRange;
35.60 +import org.netbeans.modules.csl.spi.ParserResult;
35.61 +import org.netbeans.modules.html.ojet.OJETUtils;
35.62 +import org.netbeans.modules.html.ojet.data.DataItem;
35.63 +import org.netbeans.modules.javascript2.editor.api.lexer.JsTokenId;
35.64 +import org.netbeans.modules.web.common.api.LexerUtils;
35.65 +import org.openide.filesystems.FileObject;
35.66 +
35.67 +/**
35.68 + *
35.69 + * @author Petr Pisl
35.70 + */
35.71 +public class OJETCodeCompletionItem implements CompletionProposal {
35.72 +
35.73 + private final int anchorOffset;
35.74 + private final ElementHandle element;
35.75 +
35.76 + public OJETCodeCompletionItem(final ElementHandle element, final int anchorOffset) {
35.77 + this.anchorOffset = anchorOffset;
35.78 + this.element = element;
35.79 + }
35.80 +
35.81 + @Override
35.82 + public int getAnchorOffset() {
35.83 + return anchorOffset;
35.84 + }
35.85 +
35.86 + @Override
35.87 + public ElementHandle getElement() {
35.88 + return element;
35.89 + }
35.90 +
35.91 + @Override
35.92 + public String getName() {
35.93 + return element.getName();
35.94 + }
35.95 +
35.96 + @Override
35.97 + public String getInsertPrefix() {
35.98 + return element.getName();
35.99 + }
35.100 +
35.101 + @Override
35.102 + public String getSortText() {
35.103 + return getName();
35.104 + }
35.105 +
35.106 + @Override
35.107 + public ElementKind getKind() {
35.108 + return element.getKind();
35.109 + }
35.110 +
35.111 + @Override
35.112 + public ImageIcon getIcon() {
35.113 + return null;
35.114 + }
35.115 +
35.116 + @Override
35.117 + public Set<Modifier> getModifiers() {
35.118 + return element.getModifiers();
35.119 + }
35.120 +
35.121 + @Override
35.122 + public boolean isSmart() {
35.123 + return false;
35.124 + }
35.125 +
35.126 + @Override
35.127 + public int getSortPrioOverride() {
35.128 + return 20;
35.129 + }
35.130 +
35.131 + @Override
35.132 + public String getCustomInsertTemplate() {
35.133 + return null;
35.134 + }
35.135 +
35.136 + @Override
35.137 + public String getLhsHtml(HtmlFormatter formatter) {
35.138 + return element.getName();
35.139 + }
35.140 +
35.141 + @Override
35.142 + public String getRhsHtml(HtmlFormatter formatter) {
35.143 + return "";
35.144 + }
35.145 +
35.146 + public static class SimpleElement implements ElementHandle {
35.147 +
35.148 + private final String name;
35.149 + private final ElementKind kind;
35.150 +
35.151 + public SimpleElement(String name, ElementKind kind) {
35.152 + this.name = name;
35.153 + this.kind = kind;
35.154 + }
35.155 +
35.156 + @Override
35.157 + public FileObject getFileObject() {
35.158 + return null;
35.159 + }
35.160 +
35.161 + @Override
35.162 + public String getMimeType() {
35.163 + return "";
35.164 + }
35.165 +
35.166 + @Override
35.167 + public String getName() {
35.168 + return name;
35.169 + }
35.170 +
35.171 + @Override
35.172 + public String getIn() {
35.173 + return "";
35.174 + }
35.175 +
35.176 + @Override
35.177 + public ElementKind getKind() {
35.178 + return kind;
35.179 + }
35.180 +
35.181 + @Override
35.182 + public Set<Modifier> getModifiers() {
35.183 + return Collections.<Modifier>emptySet();
35.184 + }
35.185 +
35.186 + @Override
35.187 + public boolean signatureEquals(ElementHandle handle) {
35.188 + return false;
35.189 + }
35.190 +
35.191 + @Override
35.192 + public OffsetRange getOffsetRange(ParserResult result) {
35.193 + return OffsetRange.NONE;
35.194 + }
35.195 + }
35.196 +
35.197 + public static class DocSimpleElement extends SimpleElement {
35.198 +
35.199 + private final String documentation;
35.200 +
35.201 + public DocSimpleElement(String name, String documentation, ElementKind kind) {
35.202 + super(name, kind);
35.203 + this.documentation = documentation;
35.204 + }
35.205 +
35.206 + public String getDocumentation() {
35.207 + return documentation;
35.208 + }
35.209 + }
35.210 +
35.211 + public static class OJETComponentItem extends OJETCodeCompletionItem {
35.212 +
35.213 + private final DataItem component;
35.214 + private final CodeCompletionContext context;
35.215 +
35.216 + public OJETComponentItem(DataItem component, CodeCompletionContext ccContext) {
35.217 + super(new DocSimpleElement(component.getName(), component.getDocumentation(), ElementKind.CLASS), ccContext.getCaretOffset());
35.218 + this.component = component;
35.219 + this.context = ccContext;
35.220 + }
35.221 +
35.222 + @Override
35.223 + public ImageIcon getIcon() {
35.224 + return OJETUtils.OJET_ICON;
35.225 + }
35.226 +
35.227 + @Override
35.228 + public int getAnchorOffset() {
35.229 + return context.getCaretOffset() - context.getPrefix().length();
35.230 + }
35.231 +
35.232 + @Override
35.233 + public String getCustomInsertTemplate() {
35.234 + String result = component.getName();
35.235 + TokenHierarchy th = TokenHierarchy.get(context.getParserResult().getSnapshot().getSource().getDocument(true));
35.236 + if (th != null) {
35.237 + TokenSequence<JsTokenId> ts = LexerUtils.getTokenSequence(th, context.getCaretOffset(), JsTokenId.javascriptLanguage(), false);
35.238 + if (ts != null) {
35.239 + int diff = ts.move(context.getCaretOffset());
35.240 + if (diff == 0 && ts.movePrevious() || ts.moveNext()) {
35.241 + Token<JsTokenId> token = ts.token();
35.242 + JsTokenId id = token.id();
35.243 + if (id == JsTokenId.UNKNOWN && ts.movePrevious()) {
35.244 + token = ts.token();
35.245 + id = token.id();
35.246 + }
35.247 +
35.248 + boolean isInString = (id == JsTokenId.STRING_BEGIN || id == JsTokenId.STRING);
35.249 + if (!isInString) {
35.250 + result = '\'' + result + '\'';
35.251 + }
35.252 + }
35.253 + }
35.254 + }
35.255 + return result;
35.256 + }
35.257 +
35.258 + }
35.259 +
35.260 + public static class OJETComponentOptionItem extends OJETComponentItem {
35.261 + private final DataItem option;
35.262 +
35.263 + public OJETComponentOptionItem(DataItem option, CodeCompletionContext ccContext) {
35.264 + super(option, ccContext);
35.265 + this.option = option;
35.266 + }
35.267 +
35.268 + @Override
35.269 + public String getCustomInsertTemplate() {
35.270 + return option.getName() + ": ";
35.271 + }
35.272 + }
35.273 +}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/javascript/OJETJsCodeCompletion.java Mon Jun 02 14:23:34 2014 +0200
36.3 @@ -0,0 +1,112 @@
36.4 +/*
36.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
36.6 + *
36.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
36.8 + *
36.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
36.10 + * Other names may be trademarks of their respective owners.
36.11 + *
36.12 + * The contents of this file are subject to the terms of either the GNU
36.13 + * General Public License Version 2 only ("GPL") or the Common
36.14 + * Development and Distribution License("CDDL") (collectively, the
36.15 + * "License"). You may not use this file except in compliance with the
36.16 + * License. You can obtain a copy of the License at
36.17 + * http://www.netbeans.org/cddl-gplv2.html
36.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
36.19 + * specific language governing permissions and limitations under the
36.20 + * License. When distributing the software, include this License Header
36.21 + * Notice in each file and include the License file at
36.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
36.23 + * particular file as subject to the "Classpath" exception as provided
36.24 + * by Oracle in the GPL Version 2 section of the License file that
36.25 + * accompanied this code. If applicable, add the following below the
36.26 + * License Header, with the fields enclosed by brackets [] replaced by
36.27 + * your own identifying information:
36.28 + * "Portions Copyrighted [year] [name of copyright owner]"
36.29 + *
36.30 + * If you wish your version of this file to be governed by only the CDDL
36.31 + * or only the GPL Version 2, indicate your decision by adding
36.32 + * "[Contributor] elects to include this software in this distribution
36.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
36.34 + * single choice of license, a recipient has the option to distribute
36.35 + * your version of this file under either the CDDL, the GPL Version 2 or
36.36 + * to extend the choice of license to its licensees as provided above.
36.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
36.38 + * Version 2 license, then the option applies only if the new code is
36.39 + * made subject to such option by the copyright holder.
36.40 + *
36.41 + * Contributor(s):
36.42 + *
36.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
36.44 + */
36.45 +package org.netbeans.modules.html.ojet.javascript;
36.46 +
36.47 +import java.util.ArrayList;
36.48 +import java.util.Collection;
36.49 +import java.util.List;
36.50 +import javax.swing.text.AbstractDocument;
36.51 +import javax.swing.text.Document;
36.52 +import org.netbeans.modules.csl.api.CodeCompletionContext;
36.53 +import org.netbeans.modules.csl.api.CompletionProposal;
36.54 +import org.netbeans.modules.csl.api.ElementHandle;
36.55 +import org.netbeans.modules.csl.spi.ParserResult;
36.56 +import org.netbeans.modules.html.ojet.OJETContext;
36.57 +import org.netbeans.modules.html.ojet.data.DataItem;
36.58 +import org.netbeans.modules.html.ojet.data.DataItemImpl;
36.59 +import org.netbeans.modules.html.ojet.data.DataProvider;
36.60 +import org.netbeans.modules.html.ojet.data.DataProviderImpl;
36.61 +import org.netbeans.modules.javascript2.editor.spi.CompletionContext;
36.62 +import org.netbeans.modules.javascript2.editor.spi.CompletionProvider;
36.63 +
36.64 +/**
36.65 + *
36.66 + * @author Petr Pisl
36.67 + */
36.68 +@CompletionProvider.Registration(priority = 6)
36.69 +public class OJETJsCodeCompletion implements CompletionProvider {
36.70 +
36.71 + @Override
36.72 + public List<CompletionProposal> complete(CodeCompletionContext ccContext, CompletionContext jsCompletionContext, String prefix) {
36.73 + Document document = ccContext.getParserResult().getSnapshot().getSource().getDocument(true);
36.74 + int dOffset = ccContext.getCaretOffset(); // document offset
36.75 + ((AbstractDocument) document).readLock();
36.76 + OJETContext ojContext = OJETContext.UNKNOWN;
36.77 + try {
36.78 + ojContext = OJETContext.findContext(document, dOffset);
36.79 + System.out.println("ojContext: " + ojContext);
36.80 + List<CompletionProposal> result = new ArrayList<>();
36.81 + switch (ojContext) {
36.82 + case COMP_CONF_COMP_NAME:
36.83 + Collection<DataItem> components = DataProvider.filterByPrefix(DataProviderImpl.getInstance().getComponents(), ccContext.getPrefix());
36.84 + for (DataItem component : components) {
36.85 + result.add(new OJETCodeCompletionItem.OJETComponentItem(component, ccContext));
36.86 + }
36.87 + break;
36.88 + case COMP_CONF:
36.89 + result.add(new OJETCodeCompletionItem.OJETComponentOptionItem(new DataItemImpl("component", null), ccContext));
36.90 + break;
36.91 + case COMP_CONF_PROP_NAME:
36.92 + String compName = OJETContext.findComponentName(document, dOffset);
36.93 + if (compName != null && !compName.isEmpty()) {
36.94 + Collection<DataItem> options = DataProvider.filterByPrefix(DataProviderImpl.getInstance().getComponentOptions(compName), ccContext.getPrefix());
36.95 + for (DataItem option : options) {
36.96 + result.add(new OJETCodeCompletionItem.OJETComponentOptionItem(option, ccContext));
36.97 + }
36.98 + }
36.99 + break;
36.100 + }
36.101 + return result;
36.102 + } finally {
36.103 + ((AbstractDocument) document).readUnlock();
36.104 + }
36.105 + }
36.106 +
36.107 + @Override
36.108 + public String getHelpDocumentation(ParserResult info, ElementHandle element) {
36.109 + if (element instanceof OJETCodeCompletionItem.DocSimpleElement) {
36.110 + return ((OJETCodeCompletionItem.DocSimpleElement) element).getDocumentation();
36.111 + }
36.112 + return null;
36.113 + }
36.114 +
36.115 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/html.ojet/src/org/netbeans/modules/html/ojet/layer.xml Mon Jun 02 14:23:34 2014 +0200
37.3 @@ -0,0 +1,5 @@
37.4 +<?xml version="1.0" encoding="UTF-8"?>
37.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
37.6 +<filesystem>
37.7 +
37.8 +</filesystem>
38.1 Binary file html.ojet/src/org/netbeans/modules/html/ojet/ojet-icon.png has changed
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/html.ojet/test/unit/data/testfiles/context/example01.html Mon Jun 02 14:23:34 2014 +0200
39.3 @@ -0,0 +1,15 @@
39.4 +<script type="text/html" id="select-header-template">
39.5 + <td class="select-cell">
39.6 + <input type="checkbox" data-bind="click: toggleSelectAll(this)"/>
39.7 + <input type="checkbox" data-bind="ojComponent: {}"/>
39.8 + <input type="button" data-bind=""/>
39.9 + <input type="button" data-bind=" "/><!-- test 03 -->
39.10 + <input type="button" data-bind="ojComponent: {component: 'ojButton', }"/><!-- test 04 -->
39.11 + <input type="button" data-bind="ojComponent: {component: }"/><!-- test 05 -->
39.12 + <input type="button" data-bind="ojComponent: {component: ''}"/><!-- test 06 -->
39.13 + <input type="button" data-bind="ojComponent: {component: 'oj'}"/><!-- test 07 -->
39.14 + <input type="button" data-bind="ojComponent: {component: 'oj}"/><!-- test 08 -->
39.15 + <button id= "cancel-button" data-bind="click: toogleCommitPanel, "><!-- test 09 -->
39.16 + <input type="button" data-bind="ojComponent: {component: 'ojButton', label : ''}"/><!-- test 10 -->
39.17 + </td>
39.18 +</script>
39.19 \ No newline at end of file
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/html.ojet/test/unit/src/org/netbeans/modules/html/ojet/OJETContextTest.java Mon Jun 02 14:23:34 2014 +0200
40.3 @@ -0,0 +1,175 @@
40.4 +/*
40.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
40.6 + *
40.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
40.8 + *
40.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
40.10 + * Other names may be trademarks of their respective owners.
40.11 + *
40.12 + * The contents of this file are subject to the terms of either the GNU
40.13 + * General Public License Version 2 only ("GPL") or the Common
40.14 + * Development and Distribution License("CDDL") (collectively, the
40.15 + * "License"). You may not use this file except in compliance with the
40.16 + * License. You can obtain a copy of the License at
40.17 + * http://www.netbeans.org/cddl-gplv2.html
40.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
40.19 + * specific language governing permissions and limitations under the
40.20 + * License. When distributing the software, include this License Header
40.21 + * Notice in each file and include the License file at
40.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
40.23 + * particular file as subject to the "Classpath" exception as provided
40.24 + * by Oracle in the GPL Version 2 section of the License file that
40.25 + * accompanied this code. If applicable, add the following below the
40.26 + * License Header, with the fields enclosed by brackets [] replaced by
40.27 + * your own identifying information:
40.28 + * "Portions Copyrighted [year] [name of copyright owner]"
40.29 + *
40.30 + * If you wish your version of this file to be governed by only the CDDL
40.31 + * or only the GPL Version 2, indicate your decision by adding
40.32 + * "[Contributor] elects to include this software in this distribution
40.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
40.34 + * single choice of license, a recipient has the option to distribute
40.35 + * your version of this file under either the CDDL, the GPL Version 2 or
40.36 + * to extend the choice of license to its licensees as provided above.
40.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
40.38 + * Version 2 license, then the option applies only if the new code is
40.39 + * made subject to such option by the copyright holder.
40.40 + *
40.41 + * Contributor(s):
40.42 + *
40.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
40.44 + */
40.45 +
40.46 +package org.netbeans.modules.html.ojet;
40.47 +
40.48 +import java.util.Collections;
40.49 +import javax.swing.text.AbstractDocument;
40.50 +import javax.swing.text.Document;
40.51 +import static junit.framework.Assert.assertEquals;
40.52 +import static junit.framework.Assert.assertTrue;
40.53 +import static org.netbeans.modules.csl.api.test.CslTestBase.getCaretOffset;
40.54 +import org.netbeans.modules.csl.spi.ParserResult;
40.55 +import org.netbeans.modules.javascript2.editor.JsTestBase;
40.56 +import org.netbeans.modules.parsing.api.ParserManager;
40.57 +import org.netbeans.modules.parsing.api.ResultIterator;
40.58 +import org.netbeans.modules.parsing.api.Source;
40.59 +import org.netbeans.modules.parsing.api.UserTask;
40.60 +import org.netbeans.modules.parsing.spi.Parser;
40.61 +
40.62 +/**
40.63 + *
40.64 + * @author Petr Pisl
40.65 + */
40.66 +public class OJETContextTest extends JsTestBase{
40.67 +
40.68 + public OJETContextTest(String name) {
40.69 + super(name);
40.70 + }
40.71 +
40.72 + public void testContext01() throws Exception {
40.73 + checkContext("testfiles/context/example01.html", "<input type=\"checkbox\" data-bind=\"ojComponent: {^}\"/> ", OJETContext.COMP_CONF);
40.74 + }
40.75 +
40.76 + public void testContext02() throws Exception {
40.77 + checkContext("testfiles/context/example01.html", "<input type=\"button\" data-bind=\"^\"/>", OJETContext.DATA_BINDING);
40.78 + }
40.79 +
40.80 + public void testContext03() throws Exception {
40.81 + checkContext("testfiles/context/example01.html", "<input type=\"button\" data-bind=\" ^\"/><!-- test 03 -->", OJETContext.DATA_BINDING);
40.82 + }
40.83 +
40.84 + public void testContext04() throws Exception {
40.85 + checkContext("testfiles/context/example01.html", "<input type=\"button\" data-bind=\"ojComponent: {component: 'ojButton', ^}\"/><!-- test 04 -->", OJETContext.COMP_CONF_PROP_NAME);
40.86 + }
40.87 +
40.88 + public void testContext05() throws Exception {
40.89 + checkContext("testfiles/context/example01.html", "<input type=\"button\" data-bind=\"ojComponent: {component: ^}\"/><!-- test 05 -->", OJETContext.COMP_CONF_COMP_NAME);
40.90 + }
40.91 +
40.92 + public void testContext06() throws Exception {
40.93 + checkContext("testfiles/context/example01.html", "<input type=\"button\" data-bind=\"ojComponent: {component: '^'}\"/><!-- test 06 -->", OJETContext.COMP_CONF_COMP_NAME);
40.94 + }
40.95 +
40.96 + public void testContext07() throws Exception {
40.97 + checkContext("testfiles/context/example01.html", "<input type=\"button\" data-bind=\"ojComponent: {component: 'oj^'}\"/><!-- test 07 -->", OJETContext.COMP_CONF_COMP_NAME);
40.98 + }
40.99 +
40.100 + public void testContext08() throws Exception {
40.101 + checkContext("testfiles/context/example01.html", "<input type=\"button\" data-bind=\"ojComponent: {component: 'oj^}\"/><!-- test 08 -->", OJETContext.COMP_CONF_COMP_NAME);
40.102 + }
40.103 +
40.104 + public void testContext09() throws Exception {
40.105 + checkContext("testfiles/context/example01.html", "<button id= \"cancel-button\" data-bind=\"click: toogleCommitPanel, ^\"><!-- test 09 -->", OJETContext.DATA_BINDING);
40.106 + }
40.107 +
40.108 + public void testContext10() throws Exception {
40.109 + checkContext("testfiles/context/example01.html", "<input type=\"button\" data-bind=\"ojComponent: {component: 'ojButton', lab^el : ''}\"/><!-- test 10 -->", OJETContext.COMP_CONF_PROP_NAME);
40.110 + }
40.111 +
40.112 +
40.113 + public void testComponentName01() throws Exception {
40.114 + checkComponentName("testfiles/context/example01.html", "<input type=\"button\" data-bind=\"ojComponent: {component: 'ojButton', ^}\"/><!-- test 04 -->", "ojButton");
40.115 + }
40.116 +
40.117 + private void checkContext(final String file, final String caretLine, final OJETContext expected) throws Exception {
40.118 +
40.119 + Source testSource = getTestSource(getTestFile(file));
40.120 +
40.121 + final int caretOffset;
40.122 + if (caretLine != null) {
40.123 + caretOffset = getCaretOffset(testSource.createSnapshot().getText().toString(), caretLine);
40.124 + enforceCaretOffset(testSource, caretOffset);
40.125 + } else {
40.126 + caretOffset = -1;
40.127 + }
40.128 +
40.129 + ParserManager.parse(Collections.singleton(testSource), new UserTask() {
40.130 + public @Override void run(ResultIterator resultIterator) throws Exception {
40.131 + Parser.Result r = caretOffset == -1 ? resultIterator.getParserResult() : resultIterator.getParserResult(caretOffset);
40.132 + assertTrue(r instanceof ParserResult);
40.133 + ParserResult info = (ParserResult) r;
40.134 + Document document = info.getSnapshot().getSource().getDocument(true);
40.135 + ((AbstractDocument)document).readLock();
40.136 + OJETContext result = OJETContext.UNKNOWN;
40.137 + try {
40.138 + result = OJETContext.findContext(info.getSnapshot().getSource().getDocument(false), caretOffset);
40.139 + } finally {
40.140 + ((AbstractDocument)document).readUnlock();
40.141 + }
40.142 + assertEquals(expected, result);
40.143 + }
40.144 + });
40.145 + }
40.146 +
40.147 + private void checkComponentName(final String file, final String caretLine, final String expectedName) throws Exception {
40.148 +
40.149 + Source testSource = getTestSource(getTestFile(file));
40.150 +
40.151 + final int caretOffset;
40.152 + if (caretLine != null) {
40.153 + caretOffset = getCaretOffset(testSource.createSnapshot().getText().toString(), caretLine);
40.154 + enforceCaretOffset(testSource, caretOffset);
40.155 + } else {
40.156 + caretOffset = -1;
40.157 + }
40.158 +
40.159 + ParserManager.parse(Collections.singleton(testSource), new UserTask() {
40.160 + public @Override void run(ResultIterator resultIterator) throws Exception {
40.161 + Parser.Result r = caretOffset == -1 ? resultIterator.getParserResult() : resultIterator.getParserResult(caretOffset);
40.162 + assertTrue(r instanceof ParserResult);
40.163 + ParserResult info = (ParserResult) r;
40.164 + Document document = info.getSnapshot().getSource().getDocument(true);
40.165 + ((AbstractDocument)document).readLock();
40.166 + String name = null;
40.167 + try {
40.168 + name = OJETContext.findComponentName(info.getSnapshot().getSource().getDocument(false), caretOffset);
40.169 + } finally {
40.170 + ((AbstractDocument)document).readUnlock();
40.171 + }
40.172 + assertEquals(expectedName, name);
40.173 + }
40.174 + });
40.175 + }
40.176 +
40.177 +
40.178 +}
41.1 --- a/javascript2.editor/nbproject/project.xml Mon Jun 02 14:22:13 2014 +0200
41.2 +++ b/javascript2.editor/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
41.3 @@ -410,9 +410,11 @@
41.4 <friend-packages>
41.5 <friend>org.netbeans.modules.html.angular</friend>
41.6 <friend>org.netbeans.modules.html.knockout</friend>
41.7 + <friend>org.netbeans.modules.html.ojet</friend>
41.8 <friend>org.netbeans.modules.javascript2.extjs</friend>
41.9 <friend>org.netbeans.modules.javascript2.jquery</friend>
41.10 <friend>org.netbeans.modules.javascript2.knockout</friend>
41.11 + <friend>org.netbeans.modules.javascript2.requirejs</friend>
41.12 <friend>org.netbeans.modules.nodejscodecompletion</friend>
41.13 <package>org.netbeans.modules.javascript2.editor.api</package>
41.14 <package>org.netbeans.modules.javascript2.editor.api.lexer</package>
42.1 --- a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/Bundle.properties Mon Jun 02 14:22:13 2014 +0200
42.2 +++ b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/Bundle.properties Mon Jun 02 14:23:34 2014 +0200
42.3 @@ -108,3 +108,4 @@
42.4 LBL_JsonEditorTab=&Source
42.5
42.6 MSG_DocNotAvailable=Documentation not found.
42.7 +MSG_ItemFromUsageDoc=This item can be unrelated. It's obtained from full project name usage.
43.1 --- a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsCodeCompletion.java Mon Jun 02 14:22:13 2014 +0200
43.2 +++ b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsCodeCompletion.java Mon Jun 02 14:23:34 2014 +0200
43.3 @@ -310,6 +310,10 @@
43.4 String documentation = ((JsDocumentationElement) element).getDocumentation();
43.5 return documentation != null ? Documentation.create(documentation) : null;
43.6 }
43.7 +
43.8 + if (OffsetRange.NONE.equals(element.getOffsetRange(info))) {
43.9 + return Documentation.create(NbBundle.getMessage(JsCodeCompletion.class, "MSG_ItemFromUsageDoc"));
43.10 + }
43.11
43.12 return Documentation.create(NbBundle.getMessage(JsCodeCompletion.class, "MSG_DocNotAvailable"));
43.13 }
43.14 @@ -500,6 +504,19 @@
43.15 List<String> expChain = ModelUtils.resolveExpressionChain(request.result.getSnapshot(), request.anchor, false);
43.16 if (!expChain.isEmpty()) {
43.17 Map<String, List<JsElement>> toAdd = getCompletionFromExpressionChain(request, expChain);
43.18 +
43.19 + FileObject fo = request.result.getSnapshot().getSource().getFileObject();
43.20 + if (fo != null) {
43.21 + long start = System.currentTimeMillis();
43.22 + Collection<IndexedElement> fromUsages = JsIndex.get(request.result.getSnapshot().getSource().getFileObject()).getUsagesFromExpression(expChain);
43.23 + for (IndexedElement indexedElement : fromUsages) {
43.24 + if (!fo.equals(indexedElement.getFileObject())) { // don't include usage from the edited file. It's covered by the model.
43.25 + addPropertyToMap(request, addedItems, indexedElement);
43.26 + }
43.27 + }
43.28 + long end = System.currentTimeMillis();
43.29 + LOGGER.log(Level.FINE, String.format("Counting cc based on usages took: {0}ms", (end - start)));
43.30 + }
43.31 addedItems.putAll(toAdd);
43.32 }
43.33 }
44.1 --- a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsCompletionItem.java Mon Jun 02 14:22:13 2014 +0200
44.2 +++ b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsCompletionItem.java Mon Jun 02 14:23:34 2014 +0200
44.3 @@ -112,7 +112,11 @@
44.4 if (elementFo != null && sourceFo != null && sourceFo.equals(elementFo)) {
44.5 sb.append("1"); //NOI18N
44.6 } else {
44.7 - sb.append("9"); //NOI18N
44.8 + if (OffsetRange.NONE.equals(element.getOffsetRange(request.result))) {
44.9 + sb.append("8");
44.10 + } else {
44.11 + sb.append("9"); //NOI18N
44.12 + }
44.13 }
44.14 }
44.15 sb.append(getName());
44.16 @@ -159,7 +163,14 @@
44.17 }
44.18
44.19 formatter.reset();
44.20 + boolean isgues = OffsetRange.NONE.equals(element.getOffsetRange(request.result));
44.21 + if (isgues) {
44.22 + formatter.appendHtml("<font color=#999999>");
44.23 + }
44.24 formatter.appendText(location);
44.25 + if (isgues) {
44.26 + formatter.appendHtml("</font>");
44.27 + }
44.28 return formatter.getText();
44.29 }
44.30
44.31 @@ -188,7 +199,16 @@
44.32
44.33 @Override
44.34 public int getSortPrioOverride() {
44.35 - return (element != null && ((JsElement)element).isPlatform()) ? 0 : 100;
44.36 + int order = 100;
44.37 + if (element != null) {
44.38 + if (((JsElement)element).isPlatform()) {
44.39 + order = 0;
44.40 + }
44.41 + if (OffsetRange.NONE.equals(element.getOffsetRange(request.result))) {
44.42 + order = 120;
44.43 + }
44.44 + }
44.45 + return order;
44.46 }
44.47
44.48 @Override
45.1 --- a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/index/JsIndex.java Mon Jun 02 14:22:13 2014 +0200
45.2 +++ b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/index/JsIndex.java Mon Jun 02 14:23:34 2014 +0200
45.3 @@ -50,6 +50,7 @@
45.4 import java.util.HashMap;
45.5 import java.util.HashSet;
45.6 import java.util.LinkedHashMap;
45.7 +import java.util.List;
45.8 import java.util.Map;
45.9 import java.util.Set;
45.10 import java.util.WeakHashMap;
45.11 @@ -60,6 +61,8 @@
45.12 import java.util.logging.Logger;
45.13 import java.util.regex.Pattern;
45.14 import org.netbeans.modules.csl.api.Modifier;
45.15 +import org.netbeans.modules.csl.api.OffsetRange;
45.16 +import org.netbeans.modules.javascript2.editor.model.JsElement;
45.17 import org.netbeans.modules.javascript2.editor.model.TypeUsage;
45.18 import org.netbeans.modules.parsing.spi.indexing.support.IndexResult;
45.19 import org.netbeans.modules.parsing.spi.indexing.support.QuerySupport;
45.20 @@ -84,6 +87,7 @@
45.21 public static final String FIELD_PARAMETERS = "param"; //NOI18N
45.22 public static final String FIELD_FLAG = "flag"; //NOI18N
45.23 public static final String FIELD_ARRAY_TYPES = "array"; //NOI18N
45.24 + public static final String FIELD_USAGE = "usage"; //NOI18N
45.25
45.26 private static final String PROPERTIES_PATTERN = "\\.[^\\.]*[^" + IndexedElement.PARAMETER_POSTFIX + "]";
45.27
45.28 @@ -198,6 +202,8 @@
45.29
45.30 Collection<? extends IndexResult> result = querySupport.query(
45.31 fieldName, fieldValue, kind, fieldsToLoad);
45.32 +
45.33 +
45.34 if (updateCache) {
45.35 WRITE_LOCK.lock();
45.36 try {
45.37 @@ -329,6 +335,38 @@
45.38 public Collection <IndexedElement> getProperties(String fqn) {
45.39 return getProperties(fqn, 0, new ArrayList<String>());
45.40 }
45.41 +
45.42 + public Collection <IndexedElement> getUsagesFromExpression(final List<String> expChain) {
45.43 + if (expChain == null || expChain.isEmpty()) {
45.44 + return Collections.emptyList();
45.45 + }
45.46 + String searchText = expChain.get(0) + ':';
45.47 + Collection<? extends IndexResult> results = query(
45.48 + JsIndex.FIELD_USAGE, searchText, QuerySupport.Kind.PREFIX, JsIndex.FIELD_USAGE); //NOI18N
45.49 + ArrayList<IndexedElement> usages = new ArrayList<IndexedElement>();
45.50 + Set<String> alreadyUsed = new HashSet<String>();
45.51 + for (IndexResult indexResult : results) {
45.52 + String[] fields = indexResult.getValues(JsIndex.FIELD_USAGE);
45.53 + FileObject fo = indexResult.getFile();
45.54 + for (String field : fields) {
45.55 + if (field.startsWith(searchText)) {
45.56 + String[] parts = field.split(":");
45.57 + for (String property : parts) {
45.58 + String[] split = property.split("#");
45.59 + if(split.length == 2 && !alreadyUsed.contains(split[0])) {
45.60 + alreadyUsed.add(split[0]);
45.61 + IndexedElement element = new IndexedElement(fo, split[0], split[0], false, false, split[1].equals("F") ? JsElement.Kind.FUNCTION : JsElement.Kind.OBJECT,
45.62 + OffsetRange.NONE, Collections.singleton(Modifier.PUBLIC), Collections.EMPTY_LIST, false);
45.63 + usages.add(element);
45.64 + }
45.65 + }
45.66 +
45.67 + }
45.68 + }
45.69 + }
45.70 + return usages;
45.71 + }
45.72 +
45.73
45.74 private final int MAX_FIND_PROPERTIES_RECURSION = 15;
45.75
46.1 --- a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/index/JsIndexer.java Mon Jun 02 14:22:13 2014 +0200
46.2 +++ b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/index/JsIndexer.java Mon Jun 02 14:23:34 2014 +0200
46.3 @@ -57,6 +57,7 @@
46.4 import org.netbeans.modules.javascript2.editor.model.TypeUsage;
46.5 import org.netbeans.modules.javascript2.editor.model.impl.JsObjectReference;
46.6 import org.netbeans.modules.javascript2.editor.model.impl.ModelUtils;
46.7 +import org.netbeans.modules.javascript2.editor.model.impl.ParameterObject;
46.8 import org.netbeans.modules.javascript2.editor.parser.JsParserResult;
46.9 import org.netbeans.modules.parsing.api.Snapshot;
46.10 import org.netbeans.modules.parsing.spi.Parser.Result;
46.11 @@ -107,6 +108,14 @@
46.12 storeObject(object, object.getName(), support, indexable);
46.13 }
46.14 }
46.15 +
46.16 + IndexDocument document = support.createDocument(indexable);
46.17 + for (JsObject object : globalObject.getProperties().values()) {
46.18 + if (object.getParent() != null) {
46.19 + storeUsages(object, object.getName(), document);
46.20 + }
46.21 + }
46.22 + support.addDocument(document);
46.23 }
46.24
46.25 private void storeObject(JsObject object, String fqn, IndexingSupport support, Indexable indexable) {
46.26 @@ -150,6 +159,42 @@
46.27 }
46.28 return false;
46.29 }
46.30 +
46.31 + private void storeUsages(JsObject object, String name, IndexDocument document) {
46.32 + StringBuilder sb = new StringBuilder();
46.33 + sb.append(object.getName());
46.34 + for (JsObject property : object.getProperties().values()) {
46.35 + if (storeUsage(property)) {
46.36 + sb.append(':');
46.37 + sb.append(property.getName()).append('#');
46.38 + if (property.getJSKind().isFunction()) {
46.39 + sb.append('F');
46.40 + } else {
46.41 + sb.append('P');
46.42 + }
46.43 + }
46.44 + }
46.45 + document.addPair(JsIndex.FIELD_USAGE, sb.toString(), true, true);
46.46 + if (object instanceof JsFunction) {
46.47 + // store parameters
46.48 + for (JsObject parameter : ((JsFunction) object).getParameters()) {
46.49 + storeUsages(parameter, parameter.getName(), document);
46.50 + }
46.51 + }
46.52 + for (JsObject property : object.getProperties().values()) {
46.53 + if (storeUsage(property) && (!(property instanceof JsObjectReference && !((JsObjectReference)property).getOriginal().isAnonymous()))) {
46.54 + storeUsages(property, property.getName(), document);
46.55 + }
46.56 + }
46.57 + }
46.58 +
46.59 + private boolean storeUsage(JsObject object) {
46.60 + boolean result = true;
46.61 + if ("arguments".equals(object.getName()) || object.getJSKind() == JsElement.Kind.ANONYMOUS_OBJECT) {
46.62 + result = false;
46.63 + }
46.64 + return result;
46.65 + }
46.66
46.67 public static final class Factory extends EmbeddingIndexerFactory {
46.68
47.1 --- a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/model/impl/ModelUtils.java Mon Jun 02 14:22:13 2014 +0200
47.2 +++ b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/model/impl/ModelUtils.java Mon Jun 02 14:23:34 2014 +0200
47.3 @@ -902,7 +902,7 @@
47.4 lastResolvedTypes.addAll(((JsArray) lObject).getTypesInArray());
47.5 } else {
47.6 // just property
47.7 - Collection<? extends Type> lastTypeAssignment = lObject.getAssignmentForOffset(offset);
47.8 + Collection<? extends Type> lastTypeAssignment = lObject.getAssignmentForOffset(offset);
47.9 // we need to process the object later anyway. To get learning cc, see issue #224453
47.10 lastResolvedObjects.add(lObject);
47.11 if (!lastTypeAssignment.isEmpty()) {
48.1 --- a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/navigation/DeclarationFinderImpl.java Mon Jun 02 14:22:13 2014 +0200
48.2 +++ b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/navigation/DeclarationFinderImpl.java Mon Jun 02 14:23:34 2014 +0200
48.3 @@ -115,7 +115,17 @@
48.4 if (fo.equals(snapshot.getSource().getFileObject()) && object.getDeclarationName() != null) {
48.5 int docOffset = LexUtilities.getLexerOffset(jsResult, getDeclarationOffset(object));
48.6 if (docOffset > -1) {
48.7 - return new DeclarationLocation(fo, docOffset);
48.8 + TokenSequence ts = LexUtilities.getTokenSequence(snapshot, caretOffset, language);
48.9 + if (ts != null) {
48.10 + ts.move(offset);
48.11 + if (ts.moveNext()) {
48.12 + int docTsOffset = LexUtilities.getLexerOffset(jsResult, ts.offset());
48.13 + if (!(docTsOffset <= docOffset && docOffset <= (docTsOffset + ts.token().length()))) {
48.14 + // return the declaration only if it's not the same identifier
48.15 + return new DeclarationLocation(fo, docOffset);
48.16 + }
48.17 + }
48.18 + }
48.19 }
48.20 } else {
48.21 // TODO we need to solve to translating model offsets to the doc offset for other files?
49.1 --- a/javascript2.editor/test/unit/data/testfiles/completion/arguments/arguments.js.testFunctionObjectProperties03.completion Mon Jun 02 14:22:13 2014 +0200
49.2 +++ b/javascript2.editor/test/unit/data/testfiles/completion/arguments/arguments.js.testFunctionObjectProperties03.completion Mon Jun 02 14:23:34 2014 +0200
49.3 @@ -2,6 +2,7 @@
49.4 formatter.println("Result of testFunction: " + ArgumentsContext.testFunction(1, 2).|toString());
49.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
49.6 ------------------------------------
49.7 +CLASS name [PUBLIC] <font color=#999999>argumentsTestFile.js</font>
49.8 CLASS prototype [PUBLIC] JS Platform
49.9 METHOD create(O: Object): Object [PUBLIC, JS Platform
49.10 METHOD defineProperties(O: Object, Pr [PUBLIC, JS Platform
50.1 --- a/javascript2.editor/test/unit/data/testfiles/completion/arguments/argumentsTestFile.js.testFunctionObjectProperties01.completion Mon Jun 02 14:22:13 2014 +0200
50.2 +++ b/javascript2.editor/test/unit/data/testfiles/completion/arguments/argumentsTestFile.js.testFunctionObjectProperties01.completion Mon Jun 02 14:23:34 2014 +0200
50.3 @@ -2,6 +2,7 @@
50.4 formatter.print(ArgumentsContext.testFunction.|name);
50.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
50.6 ------------------------------------
50.7 +CLASS i [PUBLIC] <font color=#999999>arguments.js</font>
50.8 CLASS prototype [PUBLIC] JS Platform
50.9 METHOD apply(thisArg: String, argArra [PUBLIC] JS Platform
50.10 METHOD bind(thisArg: Object): String [PUBLIC] JS Platform
51.1 --- a/javascript2.editor/test/unit/data/testfiles/completion/issue233487/index.html.testIssue228634_01.completion Mon Jun 02 14:22:13 2014 +0200
51.2 +++ b/javascript2.editor/test/unit/data/testfiles/completion/issue233487/index.html.testIssue228634_01.completion Mon Jun 02 14:23:34 2014 +0200
51.3 @@ -2,6 +2,7 @@
51.4 <input type="button" onclick="alert(myvar.p|)" value="Click me"/>
51.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
51.6 ------------------------------------
51.7 +CLASS p [PUBLIC] <font color=#999999>test.js</font>
51.8 CLASS prototype [PUBLIC] JS Platform
51.9 METHOD preventExtensions(O: Object): [PUBLIC, JS Platform
51.10 METHOD propertyIsEnumerable(V: String [PUBLIC] JS Platform
52.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/issue217450.js.testIssue217450.completion Mon Jun 02 14:22:13 2014 +0200
52.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/issue217450.js.testIssue217450.completion Mon Jun 02 14:23:34 2014 +0200
52.3 @@ -2,181 +2,181 @@
52.4 $("#text").|
52.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
52.6 ------------------------------------
52.7 -METHOD Callbacks(flags): Callbacks [PUBLIC] jquery-api.xml
52.8 -METHOD Deferred(beforeStart, deferred [PUBLIC] jquery-api.xml
52.9 -METHOD add(html): jQuery [PUBLIC] jquery-api.xml
52.10 -METHOD addBack(selector): jQuery [PUBLIC] jquery-api.xml
52.11 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
52.12 -METHOD after(content): jQuery [PUBLIC] jquery-api.xml
52.13 -METHOD ajax(url, settings): jqXHR [PUBLIC] jquery-api.xml
52.14 -METHOD ajaxComplete(handler(event, XM [PUBLIC] jquery-api.xml
52.15 -METHOD ajaxError(handler(event, jqXHR [PUBLIC] jquery-api.xml
52.16 -METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] jquery-api.xml
52.17 -METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] jquery-api.xml
52.18 -METHOD ajaxSetup(options) [PUBLIC] jquery-api.xml
52.19 -METHOD ajaxStart(handler()): jQuery [PUBLIC] jquery-api.xml
52.20 -METHOD ajaxStop(handler()): jQuery [PUBLIC] jquery-api.xml
52.21 -METHOD ajaxSuccess(handler(event, XML [PUBLIC] jquery-api.xml
52.22 -METHOD ajaxTransport(dataType, handle [PUBLIC] jquery-api.xml
52.23 -METHOD andSelf(): jQuery [PUBLIC] jquery-api.xml
52.24 -METHOD animate(properties, options, n [PUBLIC] jquery-api.xml
52.25 -METHOD append(content): jQuery [PUBLIC] jquery-api.xml
52.26 -METHOD appendTo(target): jQuery [PUBLIC] jquery-api.xml
52.27 -METHOD attr(attributes): jQuery [PUBLIC] jquery-api.xml
52.28 -METHOD before(content): jQuery [PUBLIC] jquery-api.xml
52.29 -METHOD bind(eventType, eventData, han [PUBLIC] jquery-api.xml
52.30 -METHOD blur(): jQuery [PUBLIC] jquery-api.xml
52.31 -METHOD change(): jQuery [PUBLIC] jquery-api.xml
52.32 -METHOD children(selector): jQuery [PUBLIC] jquery-api.xml
52.33 -METHOD clearQueue(queueName): jQuery [PUBLIC] jquery-api.xml
52.34 -METHOD click(): jQuery [PUBLIC] jquery-api.xml
52.35 -METHOD clone(withDataAndEvents): jQue [PUBLIC] jquery-api.xml
52.36 -METHOD closest(selector): jQuery [PUBLIC] jquery-api.xml
52.37 -METHOD contains(container, contained) [PUBLIC] jquery-api.xml
52.38 -METHOD contents(): jQuery [PUBLIC] jquery-api.xml
52.39 -METHOD css(properties): jQuery [PUBLIC] jquery-api.xml
52.40 -METHOD data(element, key): Object [PUBLIC] jquery-api.xml
52.41 -METHOD dblclick(): jQuery [PUBLIC] jquery-api.xml
52.42 -METHOD delay(duration, queueName): jQ [PUBLIC] jquery-api.xml
52.43 -METHOD delegate(selector, eventType, [PUBLIC] jquery-api.xml
52.44 -METHOD dequeue(queueName): jQuery [PUBLIC] jquery-api.xml
52.45 -METHOD detach(selector): jQuery [PUBLIC] jquery-api.xml
52.46 -METHOD die(): jQuery [PUBLIC] jquery-api.xml
52.47 -METHOD each(collection, callback(inde [PUBLIC] jquery-api.xml
52.48 -METHOD empty(): jQuery [PUBLIC] jquery-api.xml
52.49 -METHOD end(): jQuery [PUBLIC] jquery-api.xml
52.50 -METHOD eq(index): jQuery [PUBLIC] jquery-api.xml
52.51 -METHOD error(handler(eventObject)): j [PUBLIC] jquery-api.xml
52.52 -METHOD extend(target, object1, object [PUBLIC] jquery-api.xml
52.53 -METHOD fadeIn(options, now, tween, an [PUBLIC] jquery-api.xml
52.54 -METHOD fadeOut(options, now, tween, a [PUBLIC] jquery-api.xml
52.55 -METHOD fadeTo(duration, opacity, comp [PUBLIC] jquery-api.xml
52.56 -METHOD fadeToggle(options, now, tween [PUBLIC] jquery-api.xml
52.57 -METHOD filter(function(index)): jQuer [PUBLIC] jquery-api.xml
52.58 -METHOD find(selector): jQuery [PUBLIC] jquery-api.xml
52.59 -METHOD finish(queue): jQuery [PUBLIC] jquery-api.xml
52.60 -METHOD first(): jQuery [PUBLIC] jquery-api.xml
52.61 -METHOD focus(): jQuery [PUBLIC] jquery-api.xml
52.62 -METHOD focusin(handler(eventObject)): [PUBLIC] jquery-api.xml
52.63 -METHOD focusout(handler(eventObject)) [PUBLIC] jquery-api.xml
52.64 -METHOD get(url, data, success(data, t [PUBLIC] jquery-api.xml
52.65 -METHOD getJSON(url, data, success(dat [PUBLIC] jquery-api.xml
52.66 -METHOD getScript(url, success(script, [PUBLIC] jquery-api.xml
52.67 -METHOD globalEval(code) [PUBLIC] jquery-api.xml
52.68 -METHOD grep(array, function(elementOf [PUBLIC] jquery-api.xml
52.69 -METHOD has(contained): jQuery [PUBLIC] jquery-api.xml
52.70 -METHOD hasClass(className): Boolean [PUBLIC] jquery-api.xml
52.71 -METHOD hasData(element): Boolean [PUBLIC] jquery-api.xml
52.72 -METHOD height(value): jQuery [PUBLIC] jquery-api.xml
52.73 -METHOD hide(options, now, tween, anim [PUBLIC] jquery-api.xml
52.74 -METHOD holdReady(hold): undefined [PUBLIC] jquery-api.xml
52.75 -METHOD hover(handlerIn(eventObject), [PUBLIC] jquery-api.xml
52.76 -METHOD html(htmlString): jQuery [PUBLIC] jquery-api.xml
52.77 -METHOD inArray(value, array, fromInde [PUBLIC] jquery-api.xml
52.78 -METHOD index(selector): Number [PUBLIC] jquery-api.xml
52.79 -METHOD innerHeight(): Integer [PUBLIC] jquery-api.xml
52.80 -METHOD innerWidth(): Integer [PUBLIC] jquery-api.xml
52.81 -METHOD insertAfter(target): jQuery [PUBLIC] jquery-api.xml
52.82 -METHOD insertBefore(target): jQuery [PUBLIC] jquery-api.xml
52.83 -METHOD is(selector): Boolean [PUBLIC] jquery-api.xml
52.84 -METHOD isArray(obj): boolean [PUBLIC] jquery-api.xml
52.85 -METHOD isEmptyObject(object): Boolean [PUBLIC] jquery-api.xml
52.86 -METHOD isFunction(obj): boolean [PUBLIC] jquery-api.xml
52.87 -METHOD isNumeric(value): Boolean [PUBLIC] jquery-api.xml
52.88 -METHOD isPlainObject(object): Boolean [PUBLIC] jquery-api.xml
52.89 -METHOD isWindow(obj): boolean [PUBLIC] jquery-api.xml
52.90 -METHOD isXMLDoc(node): Boolean [PUBLIC] jquery-api.xml
52.91 -METHOD jQuery(callback): jQuery [PUBLIC] jquery-api.xml
52.92 -METHOD keydown(): jQuery [PUBLIC] jquery-api.xml
52.93 -METHOD keypress(): jQuery [PUBLIC] jquery-api.xml
52.94 -METHOD keyup(): jQuery [PUBLIC] jquery-api.xml
52.95 -METHOD last(): jQuery [PUBLIC] jquery-api.xml
52.96 -METHOD live(events, handler(eventObje [PUBLIC] jquery-api.xml
52.97 -METHOD load(url, data, complete(respo [PUBLIC] jquery-api.xml
52.98 -METHOD makeArray(obj): Array [PUBLIC] jquery-api.xml
52.99 -METHOD map(array, callback(elementOfA [PUBLIC] jquery-api.xml
52.100 -METHOD merge(first, second): Array [PUBLIC] jquery-api.xml
52.101 -METHOD mousedown(): jQuery [PUBLIC] jquery-api.xml
52.102 -METHOD mouseenter(): jQuery [PUBLIC] jquery-api.xml
52.103 -METHOD mouseleave(): jQuery [PUBLIC] jquery-api.xml
52.104 -METHOD mousemove(): jQuery [PUBLIC] jquery-api.xml
52.105 -METHOD mouseout(): jQuery [PUBLIC] jquery-api.xml
52.106 -METHOD mouseover(): jQuery [PUBLIC] jquery-api.xml
52.107 -METHOD mouseup(): jQuery [PUBLIC] jquery-api.xml
52.108 -METHOD next(selector): jQuery [PUBLIC] jquery-api.xml
52.109 -METHOD nextAll(selector): jQuery [PUBLIC] jquery-api.xml
52.110 -METHOD nextUntil(selector, filter): j [PUBLIC] jquery-api.xml
52.111 -METHOD noConflict(removeAll): Object [PUBLIC] jquery-api.xml
52.112 -METHOD noop(): undefined [PUBLIC] jquery-api.xml
52.113 -METHOD not(elements): jQuery [PUBLIC] jquery-api.xml
52.114 -METHOD now(): Number [PUBLIC] jquery-api.xml
52.115 -METHOD off(events, selector): jQuery [PUBLIC] jquery-api.xml
52.116 -METHOD offset(): Object [PUBLIC] jquery-api.xml
52.117 -METHOD offsetParent(): jQuery [PUBLIC] jquery-api.xml
52.118 -METHOD on(events, selector, data): jQ [PUBLIC] jquery-api.xml
52.119 -METHOD one(events, data, handler(even [PUBLIC] jquery-api.xml
52.120 -METHOD outerHeight(includeMargin): In [PUBLIC] jquery-api.xml
52.121 -METHOD outerWidth(includeMargin): Int [PUBLIC] jquery-api.xml
52.122 -METHOD param(obj): String [PUBLIC] jquery-api.xml
52.123 -METHOD parent(selector): jQuery [PUBLIC] jquery-api.xml
52.124 -METHOD parents(selector): jQuery [PUBLIC] jquery-api.xml
52.125 -METHOD parentsUntil(selector, filter) [PUBLIC] jquery-api.xml
52.126 -METHOD parseHTML(data, context, keepS [PUBLIC] jquery-api.xml
52.127 -METHOD parseJSON(json): Object [PUBLIC] jquery-api.xml
52.128 -METHOD parseXML(data): XMLDocument [PUBLIC] jquery-api.xml
52.129 -METHOD position(): Object [PUBLIC] jquery-api.xml
52.130 -METHOD post(url, data, success(data, [PUBLIC] jquery-api.xml
52.131 -METHOD prepend(content): jQuery [PUBLIC] jquery-api.xml
52.132 -METHOD prependTo(target): jQuery [PUBLIC] jquery-api.xml
52.133 -METHOD prev(selector): jQuery [PUBLIC] jquery-api.xml
52.134 -METHOD prevAll(selector): jQuery [PUBLIC] jquery-api.xml
52.135 -METHOD prevUntil(selector, filter): j [PUBLIC] jquery-api.xml
52.136 -METHOD promise(type, target): Promise [PUBLIC] jquery-api.xml
52.137 -METHOD prop(propertyName, function(in [PUBLIC] jquery-api.xml
52.138 -METHOD proxy(context, name): Function [PUBLIC] jquery-api.xml
52.139 -METHOD pushStack(elements): jQuery [PUBLIC] jquery-api.xml
52.140 -METHOD queue(element, queueName, call [PUBLIC] jquery-api.xml
52.141 -METHOD ready(handler): jQuery [PUBLIC] jquery-api.xml
52.142 -METHOD remove(selector): jQuery [PUBLIC] jquery-api.xml
52.143 -METHOD removeAttr(attributeName): jQu [PUBLIC] jquery-api.xml
52.144 -METHOD removeClass(className): jQuery [PUBLIC] jquery-api.xml
52.145 -METHOD removeData(name): jQuery [PUBLIC] jquery-api.xml
52.146 -METHOD removeProp(propertyName): jQue [PUBLIC] jquery-api.xml
52.147 -METHOD replaceAll(target): jQuery [PUBLIC] jquery-api.xml
52.148 -METHOD replaceWith(newContent): jQuer [PUBLIC] jquery-api.xml
52.149 -METHOD resize(): jQuery [PUBLIC] jquery-api.xml
52.150 -METHOD scroll(): jQuery [PUBLIC] jquery-api.xml
52.151 -METHOD scrollLeft(value): jQuery [PUBLIC] jquery-api.xml
52.152 -METHOD scrollTop(value): jQuery [PUBLIC] jquery-api.xml
52.153 -METHOD select(): jQuery [PUBLIC] jquery-api.xml
52.154 -METHOD serialize(): String [PUBLIC] jquery-api.xml
52.155 -METHOD serializeArray(): Array [PUBLIC] jquery-api.xml
52.156 -METHOD show(options, now, tween, anim [PUBLIC] jquery-api.xml
52.157 -METHOD siblings(selector): jQuery [PUBLIC] jquery-api.xml
52.158 -METHOD size(): Integer [PUBLIC] jquery-api.xml
52.159 -METHOD slice(start, end): jQuery [PUBLIC] jquery-api.xml
52.160 -METHOD slideDown(options, now, tween, [PUBLIC] jquery-api.xml
52.161 -METHOD slideToggle(options, now, twee [PUBLIC] jquery-api.xml
52.162 -METHOD slideUp(options, now, tween, a [PUBLIC] jquery-api.xml
52.163 -METHOD stop(clearQueue, jumpToEnd): j [PUBLIC] jquery-api.xml
52.164 -METHOD sub(): jQuery [PUBLIC] jquery-api.xml
52.165 -METHOD submit(): jQuery [PUBLIC] jquery-api.xml
52.166 -METHOD text(textString): jQuery [PUBLIC] jquery-api.xml
52.167 -METHOD toArray(): Array [PUBLIC] jquery-api.xml
52.168 -METHOD toggle(options, now, tween, an [PUBLIC] jquery-api.xml
52.169 -METHOD toggleClass(className): jQuery [PUBLIC] jquery-api.xml
52.170 -METHOD trigger(eventType, extraParame [PUBLIC] jquery-api.xml
52.171 -METHOD triggerHandler(eventType, extr [PUBLIC] jquery-api.xml
52.172 -METHOD trim(str): String [PUBLIC] jquery-api.xml
52.173 -METHOD type(obj): String [PUBLIC] jquery-api.xml
52.174 -METHOD unbind(event): jQuery [PUBLIC] jquery-api.xml
52.175 -METHOD undelegate(selector, eventType [PUBLIC] jquery-api.xml
52.176 -METHOD unique(array): Array [PUBLIC] jquery-api.xml
52.177 -METHOD unload(handler(eventObject)): [PUBLIC] jquery-api.xml
52.178 -METHOD unwrap(): jQuery [PUBLIC] jquery-api.xml
52.179 -METHOD val(value): jQuery [PUBLIC] jquery-api.xml
52.180 -METHOD when(deferreds): Promise [PUBLIC] jquery-api.xml
52.181 -METHOD width(value): jQuery [PUBLIC] jquery-api.xml
52.182 -METHOD wrap(wrappingElement): jQuery [PUBLIC] jquery-api.xml
52.183 -METHOD wrapAll(wrappingElement): jQue [PUBLIC] jquery-api.xml
52.184 -METHOD wrapInner(wrappingElement): jQ [PUBLIC] jquery-api.xml
52.185 +METHOD Callbacks(flags): Callbacks [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.186 +METHOD Deferred(beforeStart, deferred [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.187 +METHOD add(html): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.188 +METHOD addBack(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.189 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.190 +METHOD after(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.191 +METHOD ajax(url, settings): jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.192 +METHOD ajaxComplete(handler(event, XM [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.193 +METHOD ajaxError(handler(event, jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.194 +METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.195 +METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.196 +METHOD ajaxSetup(options) [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.197 +METHOD ajaxStart(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.198 +METHOD ajaxStop(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.199 +METHOD ajaxSuccess(handler(event, XML [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.200 +METHOD ajaxTransport(dataType, handle [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.201 +METHOD andSelf(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.202 +METHOD animate(properties, options, n [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.203 +METHOD append(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.204 +METHOD appendTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.205 +METHOD attr(attributes): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.206 +METHOD before(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.207 +METHOD bind(eventType, eventData, han [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.208 +METHOD blur(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.209 +METHOD change(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.210 +METHOD children(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.211 +METHOD clearQueue(queueName): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.212 +METHOD click(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.213 +METHOD clone(withDataAndEvents): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.214 +METHOD closest(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.215 +METHOD contains(container, contained) [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.216 +METHOD contents(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.217 +METHOD css(properties): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.218 +METHOD data(element, key): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.219 +METHOD dblclick(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.220 +METHOD delay(duration, queueName): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.221 +METHOD delegate(selector, eventType, [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.222 +METHOD dequeue(queueName): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.223 +METHOD detach(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.224 +METHOD die(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.225 +METHOD each(collection, callback(inde [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.226 +METHOD empty(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.227 +METHOD end(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.228 +METHOD eq(index): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.229 +METHOD error(handler(eventObject)): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.230 +METHOD extend(target, object1, object [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.231 +METHOD fadeIn(options, now, tween, an [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.232 +METHOD fadeOut(options, now, tween, a [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.233 +METHOD fadeTo(duration, opacity, comp [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.234 +METHOD fadeToggle(options, now, tween [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.235 +METHOD filter(function(index)): jQuer [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.236 +METHOD find(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.237 +METHOD finish(queue): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.238 +METHOD first(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.239 +METHOD focus(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.240 +METHOD focusin(handler(eventObject)): [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.241 +METHOD focusout(handler(eventObject)) [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.242 +METHOD get(url, data, success(data, t [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.243 +METHOD getJSON(url, data, success(dat [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.244 +METHOD getScript(url, success(script, [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.245 +METHOD globalEval(code) [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.246 +METHOD grep(array, function(elementOf [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.247 +METHOD has(contained): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.248 +METHOD hasClass(className): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.249 +METHOD hasData(element): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.250 +METHOD height(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.251 +METHOD hide(options, now, tween, anim [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.252 +METHOD holdReady(hold): undefined [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.253 +METHOD hover(handlerIn(eventObject), [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.254 +METHOD html(htmlString): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.255 +METHOD inArray(value, array, fromInde [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.256 +METHOD index(selector): Number [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.257 +METHOD innerHeight(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.258 +METHOD innerWidth(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.259 +METHOD insertAfter(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.260 +METHOD insertBefore(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.261 +METHOD is(selector): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.262 +METHOD isArray(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.263 +METHOD isEmptyObject(object): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.264 +METHOD isFunction(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.265 +METHOD isNumeric(value): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.266 +METHOD isPlainObject(object): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.267 +METHOD isWindow(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.268 +METHOD isXMLDoc(node): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.269 +METHOD jQuery(callback): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.270 +METHOD keydown(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.271 +METHOD keypress(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.272 +METHOD keyup(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.273 +METHOD last(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.274 +METHOD live(events, handler(eventObje [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.275 +METHOD load(url, data, complete(respo [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.276 +METHOD makeArray(obj): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.277 +METHOD map(array, callback(elementOfA [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.278 +METHOD merge(first, second): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.279 +METHOD mousedown(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.280 +METHOD mouseenter(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.281 +METHOD mouseleave(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.282 +METHOD mousemove(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.283 +METHOD mouseout(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.284 +METHOD mouseover(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.285 +METHOD mouseup(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.286 +METHOD next(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.287 +METHOD nextAll(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.288 +METHOD nextUntil(selector, filter): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.289 +METHOD noConflict(removeAll): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.290 +METHOD noop(): undefined [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.291 +METHOD not(elements): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.292 +METHOD now(): Number [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.293 +METHOD off(events, selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.294 +METHOD offset(): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.295 +METHOD offsetParent(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.296 +METHOD on(events, selector, data): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.297 +METHOD one(events, data, handler(even [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.298 +METHOD outerHeight(includeMargin): In [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.299 +METHOD outerWidth(includeMargin): Int [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.300 +METHOD param(obj): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.301 +METHOD parent(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.302 +METHOD parents(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.303 +METHOD parentsUntil(selector, filter) [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.304 +METHOD parseHTML(data, context, keepS [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.305 +METHOD parseJSON(json): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.306 +METHOD parseXML(data): XMLDocument [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.307 +METHOD position(): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.308 +METHOD post(url, data, success(data, [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.309 +METHOD prepend(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.310 +METHOD prependTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.311 +METHOD prev(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.312 +METHOD prevAll(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.313 +METHOD prevUntil(selector, filter): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.314 +METHOD promise(type, target): Promise [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.315 +METHOD prop(propertyName, function(in [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.316 +METHOD proxy(context, name): Function [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.317 +METHOD pushStack(elements): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.318 +METHOD queue(element, queueName, call [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.319 +METHOD ready(handler): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.320 +METHOD remove(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.321 +METHOD removeAttr(attributeName): jQu [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.322 +METHOD removeClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.323 +METHOD removeData(name): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.324 +METHOD removeProp(propertyName): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.325 +METHOD replaceAll(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.326 +METHOD replaceWith(newContent): jQuer [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.327 +METHOD resize(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.328 +METHOD scroll(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.329 +METHOD scrollLeft(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.330 +METHOD scrollTop(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.331 +METHOD select(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.332 +METHOD serialize(): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.333 +METHOD serializeArray(): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.334 +METHOD show(options, now, tween, anim [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.335 +METHOD siblings(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.336 +METHOD size(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.337 +METHOD slice(start, end): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.338 +METHOD slideDown(options, now, tween, [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.339 +METHOD slideToggle(options, now, twee [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.340 +METHOD slideUp(options, now, tween, a [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.341 +METHOD stop(clearQueue, jumpToEnd): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.342 +METHOD sub(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.343 +METHOD submit(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.344 +METHOD text(textString): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.345 +METHOD toArray(): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.346 +METHOD toggle(options, now, tween, an [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.347 +METHOD toggleClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.348 +METHOD trigger(eventType, extraParame [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.349 +METHOD triggerHandler(eventType, extr [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.350 +METHOD trim(str): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.351 +METHOD type(obj): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.352 +METHOD unbind(event): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.353 +METHOD undelegate(selector, eventType [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.354 +METHOD unique(array): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.355 +METHOD unload(handler(eventObject)): [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.356 +METHOD unwrap(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.357 +METHOD val(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.358 +METHOD when(deferreds): Promise [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.359 +METHOD width(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.360 +METHOD wrap(wrappingElement): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.361 +METHOD wrapAll(wrappingElement): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
52.362 +METHOD wrapInner(wrappingElement): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
53.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/issue235647.js.testIssue235647.completion Mon Jun 02 14:22:13 2014 +0200
53.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/issue235647.js.testIssue235647.completion Mon Jun 02 14:23:34 2014 +0200
53.3 @@ -2,5 +2,5 @@
53.4 $.po|
53.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
53.6 ------------------------------------
53.7 -METHOD position(): Object [PUBLIC] jquery-api.xml
53.8 -METHOD post(url, data, success(data, [PUBLIC] jquery-api.xml
53.9 +METHOD position(): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
53.10 +METHOD post(url, data, success(data, [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/issue223060.js.testIssue223060.completion Mon Jun 02 14:22:13 2014 +0200
54.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/issue223060.js.testIssue223060.completion Mon Jun 02 14:23:34 2014 +0200
54.3 @@ -2,181 +2,181 @@
54.4 form.|
54.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
54.6 ------------------------------------
54.7 -METHOD Callbacks(flags): Callbacks [PUBLIC] jquery-api.xml
54.8 -METHOD Deferred(beforeStart, deferred [PUBLIC] jquery-api.xml
54.9 -METHOD add(html): jQuery [PUBLIC] jquery-api.xml
54.10 -METHOD addBack(selector): jQuery [PUBLIC] jquery-api.xml
54.11 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
54.12 -METHOD after(content): jQuery [PUBLIC] jquery-api.xml
54.13 -METHOD ajax(url, settings): jqXHR [PUBLIC] jquery-api.xml
54.14 -METHOD ajaxComplete(handler(event, XM [PUBLIC] jquery-api.xml
54.15 -METHOD ajaxError(handler(event, jqXHR [PUBLIC] jquery-api.xml
54.16 -METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] jquery-api.xml
54.17 -METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] jquery-api.xml
54.18 -METHOD ajaxSetup(options) [PUBLIC] jquery-api.xml
54.19 -METHOD ajaxStart(handler()): jQuery [PUBLIC] jquery-api.xml
54.20 -METHOD ajaxStop(handler()): jQuery [PUBLIC] jquery-api.xml
54.21 -METHOD ajaxSuccess(handler(event, XML [PUBLIC] jquery-api.xml
54.22 -METHOD ajaxTransport(dataType, handle [PUBLIC] jquery-api.xml
54.23 -METHOD andSelf(): jQuery [PUBLIC] jquery-api.xml
54.24 -METHOD animate(properties, options, n [PUBLIC] jquery-api.xml
54.25 -METHOD append(content): jQuery [PUBLIC] jquery-api.xml
54.26 -METHOD appendTo(target): jQuery [PUBLIC] jquery-api.xml
54.27 -METHOD attr(attributes): jQuery [PUBLIC] jquery-api.xml
54.28 -METHOD before(content): jQuery [PUBLIC] jquery-api.xml
54.29 -METHOD bind(eventType, eventData, han [PUBLIC] jquery-api.xml
54.30 -METHOD blur(): jQuery [PUBLIC] jquery-api.xml
54.31 -METHOD change(): jQuery [PUBLIC] jquery-api.xml
54.32 -METHOD children(selector): jQuery [PUBLIC] jquery-api.xml
54.33 -METHOD clearQueue(queueName): jQuery [PUBLIC] jquery-api.xml
54.34 -METHOD click(): jQuery [PUBLIC] jquery-api.xml
54.35 -METHOD clone(withDataAndEvents): jQue [PUBLIC] jquery-api.xml
54.36 -METHOD closest(selector): jQuery [PUBLIC] jquery-api.xml
54.37 -METHOD contains(container, contained) [PUBLIC] jquery-api.xml
54.38 -METHOD contents(): jQuery [PUBLIC] jquery-api.xml
54.39 -METHOD css(properties): jQuery [PUBLIC] jquery-api.xml
54.40 -METHOD data(element, key): Object [PUBLIC] jquery-api.xml
54.41 -METHOD dblclick(): jQuery [PUBLIC] jquery-api.xml
54.42 -METHOD delay(duration, queueName): jQ [PUBLIC] jquery-api.xml
54.43 -METHOD delegate(selector, eventType, [PUBLIC] jquery-api.xml
54.44 -METHOD dequeue(queueName): jQuery [PUBLIC] jquery-api.xml
54.45 -METHOD detach(selector): jQuery [PUBLIC] jquery-api.xml
54.46 -METHOD die(): jQuery [PUBLIC] jquery-api.xml
54.47 -METHOD each(collection, callback(inde [PUBLIC] jquery-api.xml
54.48 -METHOD empty(): jQuery [PUBLIC] jquery-api.xml
54.49 -METHOD end(): jQuery [PUBLIC] jquery-api.xml
54.50 -METHOD eq(index): jQuery [PUBLIC] jquery-api.xml
54.51 -METHOD error(handler(eventObject)): j [PUBLIC] jquery-api.xml
54.52 -METHOD extend(target, object1, object [PUBLIC] jquery-api.xml
54.53 -METHOD fadeIn(options, now, tween, an [PUBLIC] jquery-api.xml
54.54 -METHOD fadeOut(options, now, tween, a [PUBLIC] jquery-api.xml
54.55 -METHOD fadeTo(duration, opacity, comp [PUBLIC] jquery-api.xml
54.56 -METHOD fadeToggle(options, now, tween [PUBLIC] jquery-api.xml
54.57 -METHOD filter(function(index)): jQuer [PUBLIC] jquery-api.xml
54.58 -METHOD find(selector): jQuery [PUBLIC] jquery-api.xml
54.59 -METHOD finish(queue): jQuery [PUBLIC] jquery-api.xml
54.60 -METHOD first(): jQuery [PUBLIC] jquery-api.xml
54.61 -METHOD focus(): jQuery [PUBLIC] jquery-api.xml
54.62 -METHOD focusin(handler(eventObject)): [PUBLIC] jquery-api.xml
54.63 -METHOD focusout(handler(eventObject)) [PUBLIC] jquery-api.xml
54.64 -METHOD get(url, data, success(data, t [PUBLIC] jquery-api.xml
54.65 -METHOD getJSON(url, data, success(dat [PUBLIC] jquery-api.xml
54.66 -METHOD getScript(url, success(script, [PUBLIC] jquery-api.xml
54.67 -METHOD globalEval(code) [PUBLIC] jquery-api.xml
54.68 -METHOD grep(array, function(elementOf [PUBLIC] jquery-api.xml
54.69 -METHOD has(contained): jQuery [PUBLIC] jquery-api.xml
54.70 -METHOD hasClass(className): Boolean [PUBLIC] jquery-api.xml
54.71 -METHOD hasData(element): Boolean [PUBLIC] jquery-api.xml
54.72 -METHOD height(value): jQuery [PUBLIC] jquery-api.xml
54.73 -METHOD hide(options, now, tween, anim [PUBLIC] jquery-api.xml
54.74 -METHOD holdReady(hold): undefined [PUBLIC] jquery-api.xml
54.75 -METHOD hover(handlerIn(eventObject), [PUBLIC] jquery-api.xml
54.76 -METHOD html(htmlString): jQuery [PUBLIC] jquery-api.xml
54.77 -METHOD inArray(value, array, fromInde [PUBLIC] jquery-api.xml
54.78 -METHOD index(selector): Number [PUBLIC] jquery-api.xml
54.79 -METHOD innerHeight(): Integer [PUBLIC] jquery-api.xml
54.80 -METHOD innerWidth(): Integer [PUBLIC] jquery-api.xml
54.81 -METHOD insertAfter(target): jQuery [PUBLIC] jquery-api.xml
54.82 -METHOD insertBefore(target): jQuery [PUBLIC] jquery-api.xml
54.83 -METHOD is(selector): Boolean [PUBLIC] jquery-api.xml
54.84 -METHOD isArray(obj): boolean [PUBLIC] jquery-api.xml
54.85 -METHOD isEmptyObject(object): Boolean [PUBLIC] jquery-api.xml
54.86 -METHOD isFunction(obj): boolean [PUBLIC] jquery-api.xml
54.87 -METHOD isNumeric(value): Boolean [PUBLIC] jquery-api.xml
54.88 -METHOD isPlainObject(object): Boolean [PUBLIC] jquery-api.xml
54.89 -METHOD isWindow(obj): boolean [PUBLIC] jquery-api.xml
54.90 -METHOD isXMLDoc(node): Boolean [PUBLIC] jquery-api.xml
54.91 -METHOD jQuery(callback): jQuery [PUBLIC] jquery-api.xml
54.92 -METHOD keydown(): jQuery [PUBLIC] jquery-api.xml
54.93 -METHOD keypress(): jQuery [PUBLIC] jquery-api.xml
54.94 -METHOD keyup(): jQuery [PUBLIC] jquery-api.xml
54.95 -METHOD last(): jQuery [PUBLIC] jquery-api.xml
54.96 -METHOD live(events, handler(eventObje [PUBLIC] jquery-api.xml
54.97 -METHOD load(url, data, complete(respo [PUBLIC] jquery-api.xml
54.98 -METHOD makeArray(obj): Array [PUBLIC] jquery-api.xml
54.99 -METHOD map(array, callback(elementOfA [PUBLIC] jquery-api.xml
54.100 -METHOD merge(first, second): Array [PUBLIC] jquery-api.xml
54.101 -METHOD mousedown(): jQuery [PUBLIC] jquery-api.xml
54.102 -METHOD mouseenter(): jQuery [PUBLIC] jquery-api.xml
54.103 -METHOD mouseleave(): jQuery [PUBLIC] jquery-api.xml
54.104 -METHOD mousemove(): jQuery [PUBLIC] jquery-api.xml
54.105 -METHOD mouseout(): jQuery [PUBLIC] jquery-api.xml
54.106 -METHOD mouseover(): jQuery [PUBLIC] jquery-api.xml
54.107 -METHOD mouseup(): jQuery [PUBLIC] jquery-api.xml
54.108 -METHOD next(selector): jQuery [PUBLIC] jquery-api.xml
54.109 -METHOD nextAll(selector): jQuery [PUBLIC] jquery-api.xml
54.110 -METHOD nextUntil(selector, filter): j [PUBLIC] jquery-api.xml
54.111 -METHOD noConflict(removeAll): Object [PUBLIC] jquery-api.xml
54.112 -METHOD noop(): undefined [PUBLIC] jquery-api.xml
54.113 -METHOD not(elements): jQuery [PUBLIC] jquery-api.xml
54.114 -METHOD now(): Number [PUBLIC] jquery-api.xml
54.115 -METHOD off(events, selector): jQuery [PUBLIC] jquery-api.xml
54.116 -METHOD offset(): Object [PUBLIC] jquery-api.xml
54.117 -METHOD offsetParent(): jQuery [PUBLIC] jquery-api.xml
54.118 -METHOD on(events, selector, data): jQ [PUBLIC] jquery-api.xml
54.119 -METHOD one(events, data, handler(even [PUBLIC] jquery-api.xml
54.120 -METHOD outerHeight(includeMargin): In [PUBLIC] jquery-api.xml
54.121 -METHOD outerWidth(includeMargin): Int [PUBLIC] jquery-api.xml
54.122 -METHOD param(obj): String [PUBLIC] jquery-api.xml
54.123 -METHOD parent(selector): jQuery [PUBLIC] jquery-api.xml
54.124 -METHOD parents(selector): jQuery [PUBLIC] jquery-api.xml
54.125 -METHOD parentsUntil(selector, filter) [PUBLIC] jquery-api.xml
54.126 -METHOD parseHTML(data, context, keepS [PUBLIC] jquery-api.xml
54.127 -METHOD parseJSON(json): Object [PUBLIC] jquery-api.xml
54.128 -METHOD parseXML(data): XMLDocument [PUBLIC] jquery-api.xml
54.129 -METHOD position(): Object [PUBLIC] jquery-api.xml
54.130 -METHOD post(url, data, success(data, [PUBLIC] jquery-api.xml
54.131 -METHOD prepend(content): jQuery [PUBLIC] jquery-api.xml
54.132 -METHOD prependTo(target): jQuery [PUBLIC] jquery-api.xml
54.133 -METHOD prev(selector): jQuery [PUBLIC] jquery-api.xml
54.134 -METHOD prevAll(selector): jQuery [PUBLIC] jquery-api.xml
54.135 -METHOD prevUntil(selector, filter): j [PUBLIC] jquery-api.xml
54.136 -METHOD promise(type, target): Promise [PUBLIC] jquery-api.xml
54.137 -METHOD prop(propertyName, function(in [PUBLIC] jquery-api.xml
54.138 -METHOD proxy(context, name): Function [PUBLIC] jquery-api.xml
54.139 -METHOD pushStack(elements): jQuery [PUBLIC] jquery-api.xml
54.140 -METHOD queue(element, queueName, call [PUBLIC] jquery-api.xml
54.141 -METHOD ready(handler): jQuery [PUBLIC] jquery-api.xml
54.142 -METHOD remove(selector): jQuery [PUBLIC] jquery-api.xml
54.143 -METHOD removeAttr(attributeName): jQu [PUBLIC] jquery-api.xml
54.144 -METHOD removeClass(className): jQuery [PUBLIC] jquery-api.xml
54.145 -METHOD removeData(name): jQuery [PUBLIC] jquery-api.xml
54.146 -METHOD removeProp(propertyName): jQue [PUBLIC] jquery-api.xml
54.147 -METHOD replaceAll(target): jQuery [PUBLIC] jquery-api.xml
54.148 -METHOD replaceWith(newContent): jQuer [PUBLIC] jquery-api.xml
54.149 -METHOD resize(): jQuery [PUBLIC] jquery-api.xml
54.150 -METHOD scroll(): jQuery [PUBLIC] jquery-api.xml
54.151 -METHOD scrollLeft(value): jQuery [PUBLIC] jquery-api.xml
54.152 -METHOD scrollTop(value): jQuery [PUBLIC] jquery-api.xml
54.153 -METHOD select(): jQuery [PUBLIC] jquery-api.xml
54.154 -METHOD serialize(): String [PUBLIC] jquery-api.xml
54.155 -METHOD serializeArray(): Array [PUBLIC] jquery-api.xml
54.156 -METHOD show(options, now, tween, anim [PUBLIC] jquery-api.xml
54.157 -METHOD siblings(selector): jQuery [PUBLIC] jquery-api.xml
54.158 -METHOD size(): Integer [PUBLIC] jquery-api.xml
54.159 -METHOD slice(start, end): jQuery [PUBLIC] jquery-api.xml
54.160 -METHOD slideDown(options, now, tween, [PUBLIC] jquery-api.xml
54.161 -METHOD slideToggle(options, now, twee [PUBLIC] jquery-api.xml
54.162 -METHOD slideUp(options, now, tween, a [PUBLIC] jquery-api.xml
54.163 -METHOD stop(clearQueue, jumpToEnd): j [PUBLIC] jquery-api.xml
54.164 -METHOD sub(): jQuery [PUBLIC] jquery-api.xml
54.165 -METHOD submit(): jQuery [PUBLIC] jquery-api.xml
54.166 -METHOD text(textString): jQuery [PUBLIC] jquery-api.xml
54.167 -METHOD toArray(): Array [PUBLIC] jquery-api.xml
54.168 -METHOD toggle(options, now, tween, an [PUBLIC] jquery-api.xml
54.169 -METHOD toggleClass(className): jQuery [PUBLIC] jquery-api.xml
54.170 -METHOD trigger(eventType, extraParame [PUBLIC] jquery-api.xml
54.171 -METHOD triggerHandler(eventType, extr [PUBLIC] jquery-api.xml
54.172 -METHOD trim(str): String [PUBLIC] jquery-api.xml
54.173 -METHOD type(obj): String [PUBLIC] jquery-api.xml
54.174 -METHOD unbind(event): jQuery [PUBLIC] jquery-api.xml
54.175 -METHOD undelegate(selector, eventType [PUBLIC] jquery-api.xml
54.176 -METHOD unique(array): Array [PUBLIC] jquery-api.xml
54.177 -METHOD unload(handler(eventObject)): [PUBLIC] jquery-api.xml
54.178 -METHOD unwrap(): jQuery [PUBLIC] jquery-api.xml
54.179 -METHOD val(value): jQuery [PUBLIC] jquery-api.xml
54.180 -METHOD when(deferreds): Promise [PUBLIC] jquery-api.xml
54.181 -METHOD width(value): jQuery [PUBLIC] jquery-api.xml
54.182 -METHOD wrap(wrappingElement): jQuery [PUBLIC] jquery-api.xml
54.183 -METHOD wrapAll(wrappingElement): jQue [PUBLIC] jquery-api.xml
54.184 -METHOD wrapInner(wrappingElement): jQ [PUBLIC] jquery-api.xml
54.185 +METHOD Callbacks(flags): Callbacks [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.186 +METHOD Deferred(beforeStart, deferred [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.187 +METHOD add(html): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.188 +METHOD addBack(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.189 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.190 +METHOD after(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.191 +METHOD ajax(url, settings): jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.192 +METHOD ajaxComplete(handler(event, XM [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.193 +METHOD ajaxError(handler(event, jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.194 +METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.195 +METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.196 +METHOD ajaxSetup(options) [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.197 +METHOD ajaxStart(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.198 +METHOD ajaxStop(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.199 +METHOD ajaxSuccess(handler(event, XML [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.200 +METHOD ajaxTransport(dataType, handle [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.201 +METHOD andSelf(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.202 +METHOD animate(properties, options, n [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.203 +METHOD append(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.204 +METHOD appendTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.205 +METHOD attr(attributes): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.206 +METHOD before(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.207 +METHOD bind(eventType, eventData, han [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.208 +METHOD blur(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.209 +METHOD change(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.210 +METHOD children(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.211 +METHOD clearQueue(queueName): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.212 +METHOD click(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.213 +METHOD clone(withDataAndEvents): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.214 +METHOD closest(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.215 +METHOD contains(container, contained) [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.216 +METHOD contents(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.217 +METHOD css(properties): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.218 +METHOD data(element, key): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.219 +METHOD dblclick(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.220 +METHOD delay(duration, queueName): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.221 +METHOD delegate(selector, eventType, [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.222 +METHOD dequeue(queueName): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.223 +METHOD detach(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.224 +METHOD die(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.225 +METHOD each(collection, callback(inde [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.226 +METHOD empty(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.227 +METHOD end(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.228 +METHOD eq(index): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.229 +METHOD error(handler(eventObject)): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.230 +METHOD extend(target, object1, object [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.231 +METHOD fadeIn(options, now, tween, an [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.232 +METHOD fadeOut(options, now, tween, a [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.233 +METHOD fadeTo(duration, opacity, comp [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.234 +METHOD fadeToggle(options, now, tween [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.235 +METHOD filter(function(index)): jQuer [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.236 +METHOD find(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.237 +METHOD finish(queue): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.238 +METHOD first(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.239 +METHOD focus(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.240 +METHOD focusin(handler(eventObject)): [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.241 +METHOD focusout(handler(eventObject)) [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.242 +METHOD get(url, data, success(data, t [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.243 +METHOD getJSON(url, data, success(dat [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.244 +METHOD getScript(url, success(script, [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.245 +METHOD globalEval(code) [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.246 +METHOD grep(array, function(elementOf [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.247 +METHOD has(contained): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.248 +METHOD hasClass(className): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.249 +METHOD hasData(element): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.250 +METHOD height(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.251 +METHOD hide(options, now, tween, anim [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.252 +METHOD holdReady(hold): undefined [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.253 +METHOD hover(handlerIn(eventObject), [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.254 +METHOD html(htmlString): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.255 +METHOD inArray(value, array, fromInde [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.256 +METHOD index(selector): Number [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.257 +METHOD innerHeight(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.258 +METHOD innerWidth(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.259 +METHOD insertAfter(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.260 +METHOD insertBefore(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.261 +METHOD is(selector): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.262 +METHOD isArray(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.263 +METHOD isEmptyObject(object): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.264 +METHOD isFunction(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.265 +METHOD isNumeric(value): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.266 +METHOD isPlainObject(object): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.267 +METHOD isWindow(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.268 +METHOD isXMLDoc(node): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.269 +METHOD jQuery(callback): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.270 +METHOD keydown(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.271 +METHOD keypress(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.272 +METHOD keyup(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.273 +METHOD last(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.274 +METHOD live(events, handler(eventObje [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.275 +METHOD load(url, data, complete(respo [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.276 +METHOD makeArray(obj): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.277 +METHOD map(array, callback(elementOfA [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.278 +METHOD merge(first, second): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.279 +METHOD mousedown(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.280 +METHOD mouseenter(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.281 +METHOD mouseleave(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.282 +METHOD mousemove(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.283 +METHOD mouseout(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.284 +METHOD mouseover(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.285 +METHOD mouseup(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.286 +METHOD next(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.287 +METHOD nextAll(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.288 +METHOD nextUntil(selector, filter): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.289 +METHOD noConflict(removeAll): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.290 +METHOD noop(): undefined [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.291 +METHOD not(elements): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.292 +METHOD now(): Number [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.293 +METHOD off(events, selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.294 +METHOD offset(): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.295 +METHOD offsetParent(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.296 +METHOD on(events, selector, data): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.297 +METHOD one(events, data, handler(even [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.298 +METHOD outerHeight(includeMargin): In [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.299 +METHOD outerWidth(includeMargin): Int [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.300 +METHOD param(obj): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.301 +METHOD parent(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.302 +METHOD parents(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.303 +METHOD parentsUntil(selector, filter) [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.304 +METHOD parseHTML(data, context, keepS [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.305 +METHOD parseJSON(json): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.306 +METHOD parseXML(data): XMLDocument [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.307 +METHOD position(): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.308 +METHOD post(url, data, success(data, [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.309 +METHOD prepend(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.310 +METHOD prependTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.311 +METHOD prev(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.312 +METHOD prevAll(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.313 +METHOD prevUntil(selector, filter): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.314 +METHOD promise(type, target): Promise [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.315 +METHOD prop(propertyName, function(in [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.316 +METHOD proxy(context, name): Function [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.317 +METHOD pushStack(elements): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.318 +METHOD queue(element, queueName, call [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.319 +METHOD ready(handler): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.320 +METHOD remove(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.321 +METHOD removeAttr(attributeName): jQu [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.322 +METHOD removeClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.323 +METHOD removeData(name): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.324 +METHOD removeProp(propertyName): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.325 +METHOD replaceAll(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.326 +METHOD replaceWith(newContent): jQuer [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.327 +METHOD resize(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.328 +METHOD scroll(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.329 +METHOD scrollLeft(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.330 +METHOD scrollTop(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.331 +METHOD select(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.332 +METHOD serialize(): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.333 +METHOD serializeArray(): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.334 +METHOD show(options, now, tween, anim [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.335 +METHOD siblings(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.336 +METHOD size(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.337 +METHOD slice(start, end): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.338 +METHOD slideDown(options, now, tween, [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.339 +METHOD slideToggle(options, now, twee [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.340 +METHOD slideUp(options, now, tween, a [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.341 +METHOD stop(clearQueue, jumpToEnd): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.342 +METHOD sub(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.343 +METHOD submit(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.344 +METHOD text(textString): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.345 +METHOD toArray(): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.346 +METHOD toggle(options, now, tween, an [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.347 +METHOD toggleClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.348 +METHOD trigger(eventType, extraParame [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.349 +METHOD triggerHandler(eventType, extr [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.350 +METHOD trim(str): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.351 +METHOD type(obj): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.352 +METHOD unbind(event): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.353 +METHOD undelegate(selector, eventType [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.354 +METHOD unique(array): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.355 +METHOD unload(handler(eventObject)): [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.356 +METHOD unwrap(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.357 +METHOD val(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.358 +METHOD when(deferreds): Promise [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.359 +METHOD width(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.360 +METHOD wrap(wrappingElement): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.361 +METHOD wrapAll(wrappingElement): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
54.362 +METHOD wrapInner(wrappingElement): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
55.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/issue223963.js.testIssue223963.html Mon Jun 02 14:22:13 2014 +0200
55.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/issue223963.js.testIssue223963.html Mon Jun 02 14:23:34 2014 +0200
55.3 @@ -3,7 +3,7 @@
55.4 $(document).a|
55.5 (QueryType=COMPLETION, prefixSearch=false, caseSensitive=true)
55.6 ------------------------------------
55.7 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
55.8 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
55.9 </pre><h2>Documentation:</h2><html>
55.10 <head>
55.11 </head>
56.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/newFile.js.testNewFile.completion Mon Jun 02 14:22:13 2014 +0200
56.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/newFile.js.testNewFile.completion Mon Jun 02 14:23:34 2014 +0200
56.3 @@ -2,22 +2,22 @@
56.4 jQuery('#f-emblem').a|ddClass('.has-menu');
56.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
56.6 ------------------------------------
56.7 -METHOD add(html): jQuery [PUBLIC] jquery-api.xml
56.8 -METHOD addBack(selector): jQuery [PUBLIC] jquery-api.xml
56.9 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
56.10 -METHOD after(content): jQuery [PUBLIC] jquery-api.xml
56.11 -METHOD ajax(url, settings): jqXHR [PUBLIC] jquery-api.xml
56.12 -METHOD ajaxComplete(handler(event, XM [PUBLIC] jquery-api.xml
56.13 -METHOD ajaxError(handler(event, jqXHR [PUBLIC] jquery-api.xml
56.14 -METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] jquery-api.xml
56.15 -METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] jquery-api.xml
56.16 -METHOD ajaxSetup(options) [PUBLIC] jquery-api.xml
56.17 -METHOD ajaxStart(handler()): jQuery [PUBLIC] jquery-api.xml
56.18 -METHOD ajaxStop(handler()): jQuery [PUBLIC] jquery-api.xml
56.19 -METHOD ajaxSuccess(handler(event, XML [PUBLIC] jquery-api.xml
56.20 -METHOD ajaxTransport(dataType, handle [PUBLIC] jquery-api.xml
56.21 -METHOD andSelf(): jQuery [PUBLIC] jquery-api.xml
56.22 -METHOD animate(properties, options, n [PUBLIC] jquery-api.xml
56.23 -METHOD append(content): jQuery [PUBLIC] jquery-api.xml
56.24 -METHOD appendTo(target): jQuery [PUBLIC] jquery-api.xml
56.25 -METHOD attr(attributes): jQuery [PUBLIC] jquery-api.xml
56.26 +METHOD add(html): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.27 +METHOD addBack(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.28 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.29 +METHOD after(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.30 +METHOD ajax(url, settings): jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.31 +METHOD ajaxComplete(handler(event, XM [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.32 +METHOD ajaxError(handler(event, jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.33 +METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.34 +METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.35 +METHOD ajaxSetup(options) [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.36 +METHOD ajaxStart(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.37 +METHOD ajaxStop(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.38 +METHOD ajaxSuccess(handler(event, XML [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.39 +METHOD ajaxTransport(dataType, handle [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.40 +METHOD andSelf(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.41 +METHOD animate(properties, options, n [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.42 +METHOD append(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.43 +METHOD appendTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
56.44 +METHOD attr(attributes): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/newFile.js.testNewFile02.completion Mon Jun 02 14:22:13 2014 +0200
57.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/newFile.js.testNewFile02.completion Mon Jun 02 14:23:34 2014 +0200
57.3 @@ -2,22 +2,22 @@
57.4 jQuery('#f-emblem').addClass('.has-menu').a|dd(':checked');
57.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
57.6 ------------------------------------
57.7 -METHOD add(html): jQuery [PUBLIC] jquery-api.xml
57.8 -METHOD addBack(selector): jQuery [PUBLIC] jquery-api.xml
57.9 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
57.10 -METHOD after(content): jQuery [PUBLIC] jquery-api.xml
57.11 -METHOD ajax(url, settings): jqXHR [PUBLIC] jquery-api.xml
57.12 -METHOD ajaxComplete(handler(event, XM [PUBLIC] jquery-api.xml
57.13 -METHOD ajaxError(handler(event, jqXHR [PUBLIC] jquery-api.xml
57.14 -METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] jquery-api.xml
57.15 -METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] jquery-api.xml
57.16 -METHOD ajaxSetup(options) [PUBLIC] jquery-api.xml
57.17 -METHOD ajaxStart(handler()): jQuery [PUBLIC] jquery-api.xml
57.18 -METHOD ajaxStop(handler()): jQuery [PUBLIC] jquery-api.xml
57.19 -METHOD ajaxSuccess(handler(event, XML [PUBLIC] jquery-api.xml
57.20 -METHOD ajaxTransport(dataType, handle [PUBLIC] jquery-api.xml
57.21 -METHOD andSelf(): jQuery [PUBLIC] jquery-api.xml
57.22 -METHOD animate(properties, options, n [PUBLIC] jquery-api.xml
57.23 -METHOD append(content): jQuery [PUBLIC] jquery-api.xml
57.24 -METHOD appendTo(target): jQuery [PUBLIC] jquery-api.xml
57.25 -METHOD attr(attributes): jQuery [PUBLIC] jquery-api.xml
57.26 +METHOD add(html): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.27 +METHOD addBack(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.28 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.29 +METHOD after(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.30 +METHOD ajax(url, settings): jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.31 +METHOD ajaxComplete(handler(event, XM [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.32 +METHOD ajaxError(handler(event, jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.33 +METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.34 +METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.35 +METHOD ajaxSetup(options) [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.36 +METHOD ajaxStart(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.37 +METHOD ajaxStop(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.38 +METHOD ajaxSuccess(handler(event, XML [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.39 +METHOD ajaxTransport(dataType, handle [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.40 +METHOD andSelf(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.41 +METHOD animate(properties, options, n [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.42 +METHOD append(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.43 +METHOD appendTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
57.44 +METHOD attr(attributes): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/simple.js.testMethods01.completion Mon Jun 02 14:22:13 2014 +0200
58.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/simple.js.testMethods01.completion Mon Jun 02 14:23:34 2014 +0200
58.3 @@ -2,22 +2,22 @@
58.4 jQuery('#test').a|ddClass('.myClass');
58.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
58.6 ------------------------------------
58.7 -METHOD add(html): jQuery [PUBLIC] jquery-api.xml
58.8 -METHOD addBack(selector): jQuery [PUBLIC] jquery-api.xml
58.9 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
58.10 -METHOD after(content): jQuery [PUBLIC] jquery-api.xml
58.11 -METHOD ajax(url, settings): jqXHR [PUBLIC] jquery-api.xml
58.12 -METHOD ajaxComplete(handler(event, XM [PUBLIC] jquery-api.xml
58.13 -METHOD ajaxError(handler(event, jqXHR [PUBLIC] jquery-api.xml
58.14 -METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] jquery-api.xml
58.15 -METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] jquery-api.xml
58.16 -METHOD ajaxSetup(options) [PUBLIC] jquery-api.xml
58.17 -METHOD ajaxStart(handler()): jQuery [PUBLIC] jquery-api.xml
58.18 -METHOD ajaxStop(handler()): jQuery [PUBLIC] jquery-api.xml
58.19 -METHOD ajaxSuccess(handler(event, XML [PUBLIC] jquery-api.xml
58.20 -METHOD ajaxTransport(dataType, handle [PUBLIC] jquery-api.xml
58.21 -METHOD andSelf(): jQuery [PUBLIC] jquery-api.xml
58.22 -METHOD animate(properties, options, n [PUBLIC] jquery-api.xml
58.23 -METHOD append(content): jQuery [PUBLIC] jquery-api.xml
58.24 -METHOD appendTo(target): jQuery [PUBLIC] jquery-api.xml
58.25 -METHOD attr(attributes): jQuery [PUBLIC] jquery-api.xml
58.26 +METHOD add(html): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.27 +METHOD addBack(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.28 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.29 +METHOD after(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.30 +METHOD ajax(url, settings): jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.31 +METHOD ajaxComplete(handler(event, XM [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.32 +METHOD ajaxError(handler(event, jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.33 +METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.34 +METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.35 +METHOD ajaxSetup(options) [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.36 +METHOD ajaxStart(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.37 +METHOD ajaxStop(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.38 +METHOD ajaxSuccess(handler(event, XML [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.39 +METHOD ajaxTransport(dataType, handle [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.40 +METHOD andSelf(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.41 +METHOD animate(properties, options, n [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.42 +METHOD append(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.43 +METHOD appendTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
58.44 +METHOD attr(attributes): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
59.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/simple.js.testMethods02.completion Mon Jun 02 14:22:13 2014 +0200
59.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQuery/simple.js.testMethods02.completion Mon Jun 02 14:23:34 2014 +0200
59.3 @@ -2,6 +2,6 @@
59.4 $('#test').ad|dClass('.myClass');
59.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
59.6 ------------------------------------
59.7 -METHOD add(html): jQuery [PUBLIC] jquery-api.xml
59.8 -METHOD addBack(selector): jQuery [PUBLIC] jquery-api.xml
59.9 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
59.10 +METHOD add(html): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
59.11 +METHOD addBack(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
59.12 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
60.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQueryFragment01.js.testProperty01.completion Mon Jun 02 14:22:13 2014 +0200
60.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQueryFragment01.js.testProperty01.completion Mon Jun 02 14:23:34 2014 +0200
60.3 @@ -2,8 +2,8 @@
60.4 |jQuery.event.customEvent.test();
60.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
60.6 ------------------------------------
60.7 -CONSTRUCTO $() [PUBLIC] jquery-api.xml
60.8 -CONSTRUCTO jQuery() [PUBLIC] jquery-api.xml
60.9 +CONSTRUCTO $() [PUBLIC] <font color=#999999>jquery-api.xml</font>
60.10 +CONSTRUCTO jQuery() [PUBLIC] <font color=#999999>jquery-api.xml</font>
60.11 CLASS formatter [PUBLIC] jQueryFragment01.js
60.12 CLASS jQuery [PRIVATE] jQueryFragment01.js
60.13 VARIABLE arguments: Arguments [PRIVATE] jQueryFragment01.js
61.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQueryFragment01.js.testProperty02.completion Mon Jun 02 14:22:13 2014 +0200
61.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQueryFragment01.js.testProperty02.completion Mon Jun 02 14:23:34 2014 +0200
61.3 @@ -3,181 +3,181 @@
61.4 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
61.5 ------------------------------------
61.6 CLASS event [PUBLIC] jQueryFragment01.js
61.7 -METHOD Callbacks(flags): Callbacks [PUBLIC] jquery-api.xml
61.8 -METHOD Deferred(beforeStart, deferred [PUBLIC] jquery-api.xml
61.9 -METHOD add(html): jQuery [PUBLIC] jquery-api.xml
61.10 -METHOD addBack(selector): jQuery [PUBLIC] jquery-api.xml
61.11 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
61.12 -METHOD after(content): jQuery [PUBLIC] jquery-api.xml
61.13 -METHOD ajax(url, settings): jqXHR [PUBLIC] jquery-api.xml
61.14 -METHOD ajaxComplete(handler(event, XM [PUBLIC] jquery-api.xml
61.15 -METHOD ajaxError(handler(event, jqXHR [PUBLIC] jquery-api.xml
61.16 -METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] jquery-api.xml
61.17 -METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] jquery-api.xml
61.18 -METHOD ajaxSetup(options) [PUBLIC] jquery-api.xml
61.19 -METHOD ajaxStart(handler()): jQuery [PUBLIC] jquery-api.xml
61.20 -METHOD ajaxStop(handler()): jQuery [PUBLIC] jquery-api.xml
61.21 -METHOD ajaxSuccess(handler(event, XML [PUBLIC] jquery-api.xml
61.22 -METHOD ajaxTransport(dataType, handle [PUBLIC] jquery-api.xml
61.23 -METHOD andSelf(): jQuery [PUBLIC] jquery-api.xml
61.24 -METHOD animate(properties, options, n [PUBLIC] jquery-api.xml
61.25 -METHOD append(content): jQuery [PUBLIC] jquery-api.xml
61.26 -METHOD appendTo(target): jQuery [PUBLIC] jquery-api.xml
61.27 -METHOD attr(attributes): jQuery [PUBLIC] jquery-api.xml
61.28 -METHOD before(content): jQuery [PUBLIC] jquery-api.xml
61.29 -METHOD bind(eventType, eventData, han [PUBLIC] jquery-api.xml
61.30 -METHOD blur(): jQuery [PUBLIC] jquery-api.xml
61.31 -METHOD change(): jQuery [PUBLIC] jquery-api.xml
61.32 -METHOD children(selector): jQuery [PUBLIC] jquery-api.xml
61.33 -METHOD clearQueue(queueName): jQuery [PUBLIC] jquery-api.xml
61.34 -METHOD click(): jQuery [PUBLIC] jquery-api.xml
61.35 -METHOD clone(withDataAndEvents): jQue [PUBLIC] jquery-api.xml
61.36 -METHOD closest(selector): jQuery [PUBLIC] jquery-api.xml
61.37 -METHOD contains(container, contained) [PUBLIC] jquery-api.xml
61.38 -METHOD contents(): jQuery [PUBLIC] jquery-api.xml
61.39 -METHOD css(properties): jQuery [PUBLIC] jquery-api.xml
61.40 -METHOD data(element, key): Object [PUBLIC] jquery-api.xml
61.41 -METHOD dblclick(): jQuery [PUBLIC] jquery-api.xml
61.42 -METHOD delay(duration, queueName): jQ [PUBLIC] jquery-api.xml
61.43 -METHOD delegate(selector, eventType, [PUBLIC] jquery-api.xml
61.44 -METHOD dequeue(queueName): jQuery [PUBLIC] jquery-api.xml
61.45 -METHOD detach(selector): jQuery [PUBLIC] jquery-api.xml
61.46 -METHOD die(): jQuery [PUBLIC] jquery-api.xml
61.47 -METHOD each(collection, callback(inde [PUBLIC] jquery-api.xml
61.48 -METHOD empty(): jQuery [PUBLIC] jquery-api.xml
61.49 -METHOD end(): jQuery [PUBLIC] jquery-api.xml
61.50 -METHOD eq(index): jQuery [PUBLIC] jquery-api.xml
61.51 -METHOD error(handler(eventObject)): j [PUBLIC] jquery-api.xml
61.52 -METHOD extend(target, object1, object [PUBLIC] jquery-api.xml
61.53 -METHOD fadeIn(options, now, tween, an [PUBLIC] jquery-api.xml
61.54 -METHOD fadeOut(options, now, tween, a [PUBLIC] jquery-api.xml
61.55 -METHOD fadeTo(duration, opacity, comp [PUBLIC] jquery-api.xml
61.56 -METHOD fadeToggle(options, now, tween [PUBLIC] jquery-api.xml
61.57 -METHOD filter(function(index)): jQuer [PUBLIC] jquery-api.xml
61.58 -METHOD find(selector): jQuery [PUBLIC] jquery-api.xml
61.59 -METHOD finish(queue): jQuery [PUBLIC] jquery-api.xml
61.60 -METHOD first(): jQuery [PUBLIC] jquery-api.xml
61.61 -METHOD focus(): jQuery [PUBLIC] jquery-api.xml
61.62 -METHOD focusin(handler(eventObject)): [PUBLIC] jquery-api.xml
61.63 -METHOD focusout(handler(eventObject)) [PUBLIC] jquery-api.xml
61.64 -METHOD get(url, data, success(data, t [PUBLIC] jquery-api.xml
61.65 -METHOD getJSON(url, data, success(dat [PUBLIC] jquery-api.xml
61.66 -METHOD getScript(url, success(script, [PUBLIC] jquery-api.xml
61.67 -METHOD globalEval(code) [PUBLIC] jquery-api.xml
61.68 -METHOD grep(array, function(elementOf [PUBLIC] jquery-api.xml
61.69 -METHOD has(contained): jQuery [PUBLIC] jquery-api.xml
61.70 -METHOD hasClass(className): Boolean [PUBLIC] jquery-api.xml
61.71 -METHOD hasData(element): Boolean [PUBLIC] jquery-api.xml
61.72 -METHOD height(value): jQuery [PUBLIC] jquery-api.xml
61.73 -METHOD hide(options, now, tween, anim [PUBLIC] jquery-api.xml
61.74 -METHOD holdReady(hold): undefined [PUBLIC] jquery-api.xml
61.75 -METHOD hover(handlerIn(eventObject), [PUBLIC] jquery-api.xml
61.76 -METHOD html(htmlString): jQuery [PUBLIC] jquery-api.xml
61.77 -METHOD inArray(value, array, fromInde [PUBLIC] jquery-api.xml
61.78 -METHOD index(selector): Number [PUBLIC] jquery-api.xml
61.79 -METHOD innerHeight(): Integer [PUBLIC] jquery-api.xml
61.80 -METHOD innerWidth(): Integer [PUBLIC] jquery-api.xml
61.81 -METHOD insertAfter(target): jQuery [PUBLIC] jquery-api.xml
61.82 -METHOD insertBefore(target): jQuery [PUBLIC] jquery-api.xml
61.83 -METHOD is(selector): Boolean [PUBLIC] jquery-api.xml
61.84 -METHOD isArray(obj): boolean [PUBLIC] jquery-api.xml
61.85 -METHOD isEmptyObject(object): Boolean [PUBLIC] jquery-api.xml
61.86 -METHOD isFunction(obj): boolean [PUBLIC] jquery-api.xml
61.87 -METHOD isNumeric(value): Boolean [PUBLIC] jquery-api.xml
61.88 -METHOD isPlainObject(object): Boolean [PUBLIC] jquery-api.xml
61.89 -METHOD isWindow(obj): boolean [PUBLIC] jquery-api.xml
61.90 -METHOD isXMLDoc(node): Boolean [PUBLIC] jquery-api.xml
61.91 -METHOD jQuery(callback): jQuery [PUBLIC] jquery-api.xml
61.92 -METHOD keydown(): jQuery [PUBLIC] jquery-api.xml
61.93 -METHOD keypress(): jQuery [PUBLIC] jquery-api.xml
61.94 -METHOD keyup(): jQuery [PUBLIC] jquery-api.xml
61.95 -METHOD last(): jQuery [PUBLIC] jquery-api.xml
61.96 -METHOD live(events, handler(eventObje [PUBLIC] jquery-api.xml
61.97 -METHOD load(url, data, complete(respo [PUBLIC] jquery-api.xml
61.98 -METHOD makeArray(obj): Array [PUBLIC] jquery-api.xml
61.99 -METHOD map(array, callback(elementOfA [PUBLIC] jquery-api.xml
61.100 -METHOD merge(first, second): Array [PUBLIC] jquery-api.xml
61.101 -METHOD mousedown(): jQuery [PUBLIC] jquery-api.xml
61.102 -METHOD mouseenter(): jQuery [PUBLIC] jquery-api.xml
61.103 -METHOD mouseleave(): jQuery [PUBLIC] jquery-api.xml
61.104 -METHOD mousemove(): jQuery [PUBLIC] jquery-api.xml
61.105 -METHOD mouseout(): jQuery [PUBLIC] jquery-api.xml
61.106 -METHOD mouseover(): jQuery [PUBLIC] jquery-api.xml
61.107 -METHOD mouseup(): jQuery [PUBLIC] jquery-api.xml
61.108 -METHOD next(selector): jQuery [PUBLIC] jquery-api.xml
61.109 -METHOD nextAll(selector): jQuery [PUBLIC] jquery-api.xml
61.110 -METHOD nextUntil(selector, filter): j [PUBLIC] jquery-api.xml
61.111 -METHOD noConflict(removeAll): Object [PUBLIC] jquery-api.xml
61.112 -METHOD noop(): undefined [PUBLIC] jquery-api.xml
61.113 -METHOD not(elements): jQuery [PUBLIC] jquery-api.xml
61.114 -METHOD now(): Number [PUBLIC] jquery-api.xml
61.115 -METHOD off(events, selector): jQuery [PUBLIC] jquery-api.xml
61.116 -METHOD offset(): Object [PUBLIC] jquery-api.xml
61.117 -METHOD offsetParent(): jQuery [PUBLIC] jquery-api.xml
61.118 -METHOD on(events, selector, data): jQ [PUBLIC] jquery-api.xml
61.119 -METHOD one(events, data, handler(even [PUBLIC] jquery-api.xml
61.120 -METHOD outerHeight(includeMargin): In [PUBLIC] jquery-api.xml
61.121 -METHOD outerWidth(includeMargin): Int [PUBLIC] jquery-api.xml
61.122 -METHOD param(obj): String [PUBLIC] jquery-api.xml
61.123 -METHOD parent(selector): jQuery [PUBLIC] jquery-api.xml
61.124 -METHOD parents(selector): jQuery [PUBLIC] jquery-api.xml
61.125 -METHOD parentsUntil(selector, filter) [PUBLIC] jquery-api.xml
61.126 -METHOD parseHTML(data, context, keepS [PUBLIC] jquery-api.xml
61.127 -METHOD parseJSON(json): Object [PUBLIC] jquery-api.xml
61.128 -METHOD parseXML(data): XMLDocument [PUBLIC] jquery-api.xml
61.129 -METHOD position(): Object [PUBLIC] jquery-api.xml
61.130 -METHOD post(url, data, success(data, [PUBLIC] jquery-api.xml
61.131 -METHOD prepend(content): jQuery [PUBLIC] jquery-api.xml
61.132 -METHOD prependTo(target): jQuery [PUBLIC] jquery-api.xml
61.133 -METHOD prev(selector): jQuery [PUBLIC] jquery-api.xml
61.134 -METHOD prevAll(selector): jQuery [PUBLIC] jquery-api.xml
61.135 -METHOD prevUntil(selector, filter): j [PUBLIC] jquery-api.xml
61.136 -METHOD promise(type, target): Promise [PUBLIC] jquery-api.xml
61.137 -METHOD prop(propertyName, function(in [PUBLIC] jquery-api.xml
61.138 -METHOD proxy(context, name): Function [PUBLIC] jquery-api.xml
61.139 -METHOD pushStack(elements): jQuery [PUBLIC] jquery-api.xml
61.140 -METHOD queue(element, queueName, call [PUBLIC] jquery-api.xml
61.141 -METHOD ready(handler): jQuery [PUBLIC] jquery-api.xml
61.142 -METHOD remove(selector): jQuery [PUBLIC] jquery-api.xml
61.143 -METHOD removeAttr(attributeName): jQu [PUBLIC] jquery-api.xml
61.144 -METHOD removeClass(className): jQuery [PUBLIC] jquery-api.xml
61.145 -METHOD removeData(name): jQuery [PUBLIC] jquery-api.xml
61.146 -METHOD removeProp(propertyName): jQue [PUBLIC] jquery-api.xml
61.147 -METHOD replaceAll(target): jQuery [PUBLIC] jquery-api.xml
61.148 -METHOD replaceWith(newContent): jQuer [PUBLIC] jquery-api.xml
61.149 -METHOD resize(): jQuery [PUBLIC] jquery-api.xml
61.150 -METHOD scroll(): jQuery [PUBLIC] jquery-api.xml
61.151 -METHOD scrollLeft(value): jQuery [PUBLIC] jquery-api.xml
61.152 -METHOD scrollTop(value): jQuery [PUBLIC] jquery-api.xml
61.153 -METHOD select(): jQuery [PUBLIC] jquery-api.xml
61.154 -METHOD serialize(): String [PUBLIC] jquery-api.xml
61.155 -METHOD serializeArray(): Array [PUBLIC] jquery-api.xml
61.156 -METHOD show(options, now, tween, anim [PUBLIC] jquery-api.xml
61.157 -METHOD siblings(selector): jQuery [PUBLIC] jquery-api.xml
61.158 -METHOD size(): Integer [PUBLIC] jquery-api.xml
61.159 -METHOD slice(start, end): jQuery [PUBLIC] jquery-api.xml
61.160 -METHOD slideDown(options, now, tween, [PUBLIC] jquery-api.xml
61.161 -METHOD slideToggle(options, now, twee [PUBLIC] jquery-api.xml
61.162 -METHOD slideUp(options, now, tween, a [PUBLIC] jquery-api.xml
61.163 -METHOD stop(clearQueue, jumpToEnd): j [PUBLIC] jquery-api.xml
61.164 -METHOD sub(): jQuery [PUBLIC] jquery-api.xml
61.165 -METHOD submit(): jQuery [PUBLIC] jquery-api.xml
61.166 -METHOD text(textString): jQuery [PUBLIC] jquery-api.xml
61.167 -METHOD toArray(): Array [PUBLIC] jquery-api.xml
61.168 -METHOD toggle(options, now, tween, an [PUBLIC] jquery-api.xml
61.169 -METHOD toggleClass(className): jQuery [PUBLIC] jquery-api.xml
61.170 -METHOD trigger(eventType, extraParame [PUBLIC] jquery-api.xml
61.171 -METHOD triggerHandler(eventType, extr [PUBLIC] jquery-api.xml
61.172 -METHOD trim(str): String [PUBLIC] jquery-api.xml
61.173 -METHOD type(obj): String [PUBLIC] jquery-api.xml
61.174 -METHOD unbind(event): jQuery [PUBLIC] jquery-api.xml
61.175 -METHOD undelegate(selector, eventType [PUBLIC] jquery-api.xml
61.176 -METHOD unique(array): Array [PUBLIC] jquery-api.xml
61.177 -METHOD unload(handler(eventObject)): [PUBLIC] jquery-api.xml
61.178 -METHOD unwrap(): jQuery [PUBLIC] jquery-api.xml
61.179 -METHOD val(value): jQuery [PUBLIC] jquery-api.xml
61.180 -METHOD when(deferreds): Promise [PUBLIC] jquery-api.xml
61.181 -METHOD width(value): jQuery [PUBLIC] jquery-api.xml
61.182 -METHOD wrap(wrappingElement): jQuery [PUBLIC] jquery-api.xml
61.183 -METHOD wrapAll(wrappingElement): jQue [PUBLIC] jquery-api.xml
61.184 -METHOD wrapInner(wrappingElement): jQ [PUBLIC] jquery-api.xml
61.185 +METHOD Callbacks(flags): Callbacks [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.186 +METHOD Deferred(beforeStart, deferred [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.187 +METHOD add(html): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.188 +METHOD addBack(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.189 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.190 +METHOD after(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.191 +METHOD ajax(url, settings): jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.192 +METHOD ajaxComplete(handler(event, XM [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.193 +METHOD ajaxError(handler(event, jqXHR [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.194 +METHOD ajaxPrefilter(dataTypes, handl [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.195 +METHOD ajaxSend(handler(event, jqXHR, [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.196 +METHOD ajaxSetup(options) [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.197 +METHOD ajaxStart(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.198 +METHOD ajaxStop(handler()): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.199 +METHOD ajaxSuccess(handler(event, XML [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.200 +METHOD ajaxTransport(dataType, handle [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.201 +METHOD andSelf(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.202 +METHOD animate(properties, options, n [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.203 +METHOD append(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.204 +METHOD appendTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.205 +METHOD attr(attributes): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.206 +METHOD before(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.207 +METHOD bind(eventType, eventData, han [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.208 +METHOD blur(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.209 +METHOD change(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.210 +METHOD children(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.211 +METHOD clearQueue(queueName): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.212 +METHOD click(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.213 +METHOD clone(withDataAndEvents): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.214 +METHOD closest(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.215 +METHOD contains(container, contained) [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.216 +METHOD contents(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.217 +METHOD css(properties): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.218 +METHOD data(element, key): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.219 +METHOD dblclick(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.220 +METHOD delay(duration, queueName): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.221 +METHOD delegate(selector, eventType, [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.222 +METHOD dequeue(queueName): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.223 +METHOD detach(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.224 +METHOD die(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.225 +METHOD each(collection, callback(inde [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.226 +METHOD empty(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.227 +METHOD end(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.228 +METHOD eq(index): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.229 +METHOD error(handler(eventObject)): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.230 +METHOD extend(target, object1, object [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.231 +METHOD fadeIn(options, now, tween, an [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.232 +METHOD fadeOut(options, now, tween, a [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.233 +METHOD fadeTo(duration, opacity, comp [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.234 +METHOD fadeToggle(options, now, tween [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.235 +METHOD filter(function(index)): jQuer [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.236 +METHOD find(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.237 +METHOD finish(queue): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.238 +METHOD first(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.239 +METHOD focus(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.240 +METHOD focusin(handler(eventObject)): [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.241 +METHOD focusout(handler(eventObject)) [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.242 +METHOD get(url, data, success(data, t [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.243 +METHOD getJSON(url, data, success(dat [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.244 +METHOD getScript(url, success(script, [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.245 +METHOD globalEval(code) [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.246 +METHOD grep(array, function(elementOf [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.247 +METHOD has(contained): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.248 +METHOD hasClass(className): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.249 +METHOD hasData(element): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.250 +METHOD height(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.251 +METHOD hide(options, now, tween, anim [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.252 +METHOD holdReady(hold): undefined [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.253 +METHOD hover(handlerIn(eventObject), [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.254 +METHOD html(htmlString): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.255 +METHOD inArray(value, array, fromInde [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.256 +METHOD index(selector): Number [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.257 +METHOD innerHeight(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.258 +METHOD innerWidth(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.259 +METHOD insertAfter(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.260 +METHOD insertBefore(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.261 +METHOD is(selector): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.262 +METHOD isArray(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.263 +METHOD isEmptyObject(object): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.264 +METHOD isFunction(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.265 +METHOD isNumeric(value): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.266 +METHOD isPlainObject(object): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.267 +METHOD isWindow(obj): boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.268 +METHOD isXMLDoc(node): Boolean [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.269 +METHOD jQuery(callback): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.270 +METHOD keydown(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.271 +METHOD keypress(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.272 +METHOD keyup(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.273 +METHOD last(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.274 +METHOD live(events, handler(eventObje [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.275 +METHOD load(url, data, complete(respo [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.276 +METHOD makeArray(obj): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.277 +METHOD map(array, callback(elementOfA [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.278 +METHOD merge(first, second): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.279 +METHOD mousedown(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.280 +METHOD mouseenter(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.281 +METHOD mouseleave(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.282 +METHOD mousemove(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.283 +METHOD mouseout(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.284 +METHOD mouseover(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.285 +METHOD mouseup(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.286 +METHOD next(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.287 +METHOD nextAll(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.288 +METHOD nextUntil(selector, filter): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.289 +METHOD noConflict(removeAll): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.290 +METHOD noop(): undefined [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.291 +METHOD not(elements): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.292 +METHOD now(): Number [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.293 +METHOD off(events, selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.294 +METHOD offset(): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.295 +METHOD offsetParent(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.296 +METHOD on(events, selector, data): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.297 +METHOD one(events, data, handler(even [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.298 +METHOD outerHeight(includeMargin): In [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.299 +METHOD outerWidth(includeMargin): Int [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.300 +METHOD param(obj): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.301 +METHOD parent(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.302 +METHOD parents(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.303 +METHOD parentsUntil(selector, filter) [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.304 +METHOD parseHTML(data, context, keepS [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.305 +METHOD parseJSON(json): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.306 +METHOD parseXML(data): XMLDocument [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.307 +METHOD position(): Object [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.308 +METHOD post(url, data, success(data, [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.309 +METHOD prepend(content): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.310 +METHOD prependTo(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.311 +METHOD prev(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.312 +METHOD prevAll(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.313 +METHOD prevUntil(selector, filter): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.314 +METHOD promise(type, target): Promise [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.315 +METHOD prop(propertyName, function(in [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.316 +METHOD proxy(context, name): Function [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.317 +METHOD pushStack(elements): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.318 +METHOD queue(element, queueName, call [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.319 +METHOD ready(handler): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.320 +METHOD remove(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.321 +METHOD removeAttr(attributeName): jQu [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.322 +METHOD removeClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.323 +METHOD removeData(name): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.324 +METHOD removeProp(propertyName): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.325 +METHOD replaceAll(target): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.326 +METHOD replaceWith(newContent): jQuer [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.327 +METHOD resize(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.328 +METHOD scroll(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.329 +METHOD scrollLeft(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.330 +METHOD scrollTop(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.331 +METHOD select(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.332 +METHOD serialize(): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.333 +METHOD serializeArray(): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.334 +METHOD show(options, now, tween, anim [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.335 +METHOD siblings(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.336 +METHOD size(): Integer [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.337 +METHOD slice(start, end): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.338 +METHOD slideDown(options, now, tween, [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.339 +METHOD slideToggle(options, now, twee [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.340 +METHOD slideUp(options, now, tween, a [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.341 +METHOD stop(clearQueue, jumpToEnd): j [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.342 +METHOD sub(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.343 +METHOD submit(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.344 +METHOD text(textString): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.345 +METHOD toArray(): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.346 +METHOD toggle(options, now, tween, an [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.347 +METHOD toggleClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.348 +METHOD trigger(eventType, extraParame [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.349 +METHOD triggerHandler(eventType, extr [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.350 +METHOD trim(str): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.351 +METHOD type(obj): String [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.352 +METHOD unbind(event): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.353 +METHOD undelegate(selector, eventType [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.354 +METHOD unique(array): Array [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.355 +METHOD unload(handler(eventObject)): [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.356 +METHOD unwrap(): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.357 +METHOD val(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.358 +METHOD when(deferreds): Promise [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.359 +METHOD width(value): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.360 +METHOD wrap(wrappingElement): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.361 +METHOD wrapAll(wrappingElement): jQue [PUBLIC] <font color=#999999>jquery-api.xml</font>
61.362 +METHOD wrapInner(wrappingElement): jQ [PUBLIC] <font color=#999999>jquery-api.xml</font>
62.1 --- a/javascript2.jquery/test/unit/data/testfiles/completion/jQueryFragment01.js.testProperty05.completion Mon Jun 02 14:22:13 2014 +0200
62.2 +++ b/javascript2.jquery/test/unit/data/testfiles/completion/jQueryFragment01.js.testProperty05.completion Mon Jun 02 14:23:34 2014 +0200
62.3 @@ -2,6 +2,6 @@
62.4 jQuery.ajaxStart().add|Class();
62.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
62.6 ------------------------------------
62.7 -METHOD add(html): jQuery [PUBLIC] jquery-api.xml
62.8 -METHOD addBack(selector): jQuery [PUBLIC] jquery-api.xml
62.9 -METHOD addClass(className): jQuery [PUBLIC] jquery-api.xml
62.10 +METHOD add(html): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
62.11 +METHOD addBack(selector): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
62.12 +METHOD addClass(className): jQuery [PUBLIC] <font color=#999999>jquery-api.xml</font>
63.1 --- a/javascript2.knockout/test/unit/data/testfiles/completion/full.js.testFull1.completion Mon Jun 02 14:22:13 2014 +0200
63.2 +++ b/javascript2.knockout/test/unit/data/testfiles/completion/full.js.testFull1.completion Mon Jun 02 14:23:34 2014 +0200
63.3 @@ -2,46 +2,46 @@
63.4 ko.|
63.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
63.6 ------------------------------------
63.7 -CLASS bindingCache [PUBLIC] Knockout
63.8 -CLASS bindingHandlers [PUBLIC] Knockout
63.9 -CLASS expressionRewriting [PUBLIC] Knockout
63.10 -CLASS extenders [PUBLIC] Knockout
63.11 -CLASS jsonExpressionRewriting [PUBLIC] Knockout
63.12 -CLASS memoization [PUBLIC] Knockout
63.13 -CLASS selectExtensions [PUBLIC] Knockout
63.14 -CLASS templateSources [PUBLIC] Knockout
63.15 -CLASS utils [PUBLIC] Knockout
63.16 -CLASS virtualElements [PUBLIC] Knockout
63.17 -METHOD applyBindingAccessorsToNode(no [PUBLIC] Knockout
63.18 -METHOD applyBindings(viewModelOrBindi [PUBLIC] Knockout
63.19 -METHOD applyBindingsToDescendants(vie [PUBLIC] Knockout
63.20 -METHOD applyBindingsToNode(node, bind [PUBLIC] Knockout
63.21 -METHOD bindingContext(dataItemOrAcces [PUBLIC] Knockout
63.22 -METHOD bindingProvider(): undefined [PUBLIC] Knockout
63.23 -METHOD cleanNode(param) [PUBLIC] Knockout
63.24 -METHOD computed(evaluatorFunctionOrOp [PUBLIC] Knockout
63.25 -METHOD contextFor(node) [PUBLIC] Knockout
63.26 -METHOD dataFor(node) [PUBLIC] Knockout
63.27 -METHOD dependentObservable(evaluatorF [PUBLIC] Knockout
63.28 -METHOD isComputed(instance): Boolean [PUBLIC] Knockout
63.29 -METHOD isObservable(instance): Boolea [PUBLIC] Knockout
63.30 -METHOD isSubscribable(instance): Bool [PUBLIC] Knockout
63.31 -METHOD isWriteableObservable(instance [PUBLIC] Knockout
63.32 -METHOD jqueryTmplTemplateEngine(): un [PUBLIC] Knockout
63.33 -METHOD nativeTemplateEngine(): undefi [PUBLIC] Knockout
63.34 -METHOD observable(initialValue): ko.o [PUBLIC] Knockout
63.35 -METHOD observableArray(initialValues) [PUBLIC] Knockout
63.36 -METHOD removeNode(param) [PUBLIC] Knockout
63.37 -METHOD renderTemplate(template, dataO [PUBLIC] Knockout
63.38 -METHOD renderTemplateForEach(template [PUBLIC] Knockout
63.39 -METHOD setTemplateEngine(templateEngi [PUBLIC] Knockout
63.40 -METHOD storedBindingContextForNode(no [PUBLIC] Knockout
63.41 -METHOD subscribable(): undefined [PUBLIC] Knockout
63.42 -METHOD templateEngine(): undefined [PUBLIC] Knockout
63.43 -METHOD toJS(rootObject): Array [PUBLIC] Knockout
63.44 -METHOD toJSON(rootObject, replacer, s [PUBLIC] Knockout
63.45 -METHOD unwrap(param) [PUBLIC] Knockout
63.46 -FIELD _subscribable [PUBLIC] Knockout
63.47 -FIELD getBindingHandler [PUBLIC] Knockout
63.48 -FIELD jQueryTmplVersion [PUBLIC] Knockout
63.49 -FIELD version [PUBLIC] Knockout
63.50 +CLASS bindingCache [PUBLIC] <font color=#999999>Knockout</font>
63.51 +CLASS bindingHandlers [PUBLIC] <font color=#999999>Knockout</font>
63.52 +CLASS expressionRewriting [PUBLIC] <font color=#999999>Knockout</font>
63.53 +CLASS extenders [PUBLIC] <font color=#999999>Knockout</font>
63.54 +CLASS jsonExpressionRewriting [PUBLIC] <font color=#999999>Knockout</font>
63.55 +CLASS memoization [PUBLIC] <font color=#999999>Knockout</font>
63.56 +CLASS selectExtensions [PUBLIC] <font color=#999999>Knockout</font>
63.57 +CLASS templateSources [PUBLIC] <font color=#999999>Knockout</font>
63.58 +CLASS utils [PUBLIC] <font color=#999999>Knockout</font>
63.59 +CLASS virtualElements [PUBLIC] <font color=#999999>Knockout</font>
63.60 +METHOD applyBindingAccessorsToNode(no [PUBLIC] <font color=#999999>Knockout</font>
63.61 +METHOD applyBindings(viewModelOrBindi [PUBLIC] <font color=#999999>Knockout</font>
63.62 +METHOD applyBindingsToDescendants(vie [PUBLIC] <font color=#999999>Knockout</font>
63.63 +METHOD applyBindingsToNode(node, bind [PUBLIC] <font color=#999999>Knockout</font>
63.64 +METHOD bindingContext(dataItemOrAcces [PUBLIC] <font color=#999999>Knockout</font>
63.65 +METHOD bindingProvider(): undefined [PUBLIC] <font color=#999999>Knockout</font>
63.66 +METHOD cleanNode(param) [PUBLIC] <font color=#999999>Knockout</font>
63.67 +METHOD computed(evaluatorFunctionOrOp [PUBLIC] <font color=#999999>Knockout</font>
63.68 +METHOD contextFor(node) [PUBLIC] <font color=#999999>Knockout</font>
63.69 +METHOD dataFor(node) [PUBLIC] <font color=#999999>Knockout</font>
63.70 +METHOD dependentObservable(evaluatorF [PUBLIC] <font color=#999999>Knockout</font>
63.71 +METHOD isComputed(instance): Boolean [PUBLIC] <font color=#999999>Knockout</font>
63.72 +METHOD isObservable(instance): Boolea [PUBLIC] <font color=#999999>Knockout</font>
63.73 +METHOD isSubscribable(instance): Bool [PUBLIC] <font color=#999999>Knockout</font>
63.74 +METHOD isWriteableObservable(instance [PUBLIC] <font color=#999999>Knockout</font>
63.75 +METHOD jqueryTmplTemplateEngine(): un [PUBLIC] <font color=#999999>Knockout</font>
63.76 +METHOD nativeTemplateEngine(): undefi [PUBLIC] <font color=#999999>Knockout</font>
63.77 +METHOD observable(initialValue): ko.o [PUBLIC] <font color=#999999>Knockout</font>
63.78 +METHOD observableArray(initialValues) [PUBLIC] <font color=#999999>Knockout</font>
63.79 +METHOD removeNode(param) [PUBLIC] <font color=#999999>Knockout</font>
63.80 +METHOD renderTemplate(template, dataO [PUBLIC] <font color=#999999>Knockout</font>
63.81 +METHOD renderTemplateForEach(template [PUBLIC] <font color=#999999>Knockout</font>
63.82 +METHOD setTemplateEngine(templateEngi [PUBLIC] <font color=#999999>Knockout</font>
63.83 +METHOD storedBindingContextForNode(no [PUBLIC] <font color=#999999>Knockout</font>
63.84 +METHOD subscribable(): undefined [PUBLIC] <font color=#999999>Knockout</font>
63.85 +METHOD templateEngine(): undefined [PUBLIC] <font color=#999999>Knockout</font>
63.86 +METHOD toJS(rootObject): Array [PUBLIC] <font color=#999999>Knockout</font>
63.87 +METHOD toJSON(rootObject, replacer, s [PUBLIC] <font color=#999999>Knockout</font>
63.88 +METHOD unwrap(param) [PUBLIC] <font color=#999999>Knockout</font>
63.89 +FIELD _subscribable [PUBLIC] <font color=#999999>Knockout</font>
63.90 +FIELD getBindingHandler [PUBLIC] <font color=#999999>Knockout</font>
63.91 +FIELD jQueryTmplVersion [PUBLIC] <font color=#999999>Knockout</font>
63.92 +FIELD version [PUBLIC] <font color=#999999>Knockout</font>
64.1 --- a/javascript2.knockout/test/unit/data/testfiles/completion/simple.js.testSimple1.completion Mon Jun 02 14:22:13 2014 +0200
64.2 +++ b/javascript2.knockout/test/unit/data/testfiles/completion/simple.js.testSimple1.completion Mon Jun 02 14:23:34 2014 +0200
64.3 @@ -2,9 +2,9 @@
64.4 ko.observable("Tom").|
64.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
64.6 ------------------------------------
64.7 -METHOD peek() [PUBLIC] Knockout
64.8 -METHOD valueHasMutated(): undefined [PUBLIC] Knockout
64.9 -METHOD valueWillMutate(): undefined [PUBLIC] Knockout
64.10 -FIELD _latestValue [PUBLIC, Knockout
64.11 -FIELD equalityComparer [PUBLIC] Knockout
64.12 -FIELD notifySubscribers [PUBLIC] Knockout
64.13 +METHOD peek() [PUBLIC] <font color=#999999>Knockout</font>
64.14 +METHOD valueHasMutated(): undefined [PUBLIC] <font color=#999999>Knockout</font>
64.15 +METHOD valueWillMutate(): undefined [PUBLIC] <font color=#999999>Knockout</font>
64.16 +FIELD _latestValue [PUBLIC, <font color=#999999>Knockout</font>
64.17 +FIELD equalityComparer [PUBLIC] <font color=#999999>Knockout</font>
64.18 +FIELD notifySubscribers [PUBLIC] <font color=#999999>Knockout</font>
65.1 --- a/javascript2.knockout/test/unit/data/testfiles/completion/simple.js.testSimple2.completion Mon Jun 02 14:22:13 2014 +0200
65.2 +++ b/javascript2.knockout/test/unit/data/testfiles/completion/simple.js.testSimple2.completion Mon Jun 02 14:23:34 2014 +0200
65.3 @@ -2,21 +2,21 @@
65.4 ko.observableArray("Tom").|
65.5 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
65.6 ------------------------------------
65.7 -METHOD destroy(valueOrPredicate): und [PUBLIC] Knockout
65.8 -METHOD destroyAll(arrayOfValues): Arr [PUBLIC] Knockout
65.9 -METHOD extend(param) [PUBLIC] Knockout
65.10 -METHOD indexOf(item): Number [PUBLIC] Knockout
65.11 -METHOD peek() [PUBLIC] Knockout
65.12 -METHOD pop() [PUBLIC] Knockout
65.13 -METHOD push() [PUBLIC] Knockout
65.14 -METHOD remove(valueOrPredicate): Arra [PUBLIC] Knockout
65.15 -METHOD removeAll(arrayOfValues): ko.o [PUBLIC] Knockout
65.16 -METHOD replace(oldItem, newItem): und [PUBLIC] Knockout
65.17 -METHOD reverse() [PUBLIC] Knockout
65.18 -METHOD shift() [PUBLIC] Knockout
65.19 -METHOD slice(start, end) [PUBLIC] Knockout
65.20 -METHOD sort(comparefn) [PUBLIC] Knockout
65.21 -METHOD splice(start, deleteCount) [PUBLIC] Knockout
65.22 -METHOD unshift() [PUBLIC] Knockout
65.23 -METHOD valueHasMutated() [PUBLIC] Knockout
65.24 -METHOD valueWillMutate() [PUBLIC] Knockout
65.25 +METHOD destroy(valueOrPredicate): und [PUBLIC] <font color=#999999>Knockout</font>
65.26 +METHOD destroyAll(arrayOfValues): Arr [PUBLIC] <font color=#999999>Knockout</font>
65.27 +METHOD extend(param) [PUBLIC] <font color=#999999>Knockout</font>
65.28 +METHOD indexOf(item): Number [PUBLIC] <font color=#999999>Knockout</font>
65.29 +METHOD peek() [PUBLIC] <font color=#999999>Knockout</font>
65.30 +METHOD pop() [PUBLIC] <font color=#999999>Knockout</font>
65.31 +METHOD push() [PUBLIC] <font color=#999999>Knockout</font>
65.32 +METHOD remove(valueOrPredicate): Arra [PUBLIC] <font color=#999999>Knockout</font>
65.33 +METHOD removeAll(arrayOfValues): ko.o [PUBLIC] <font color=#999999>Knockout</font>
65.34 +METHOD replace(oldItem, newItem): und [PUBLIC] <font color=#999999>Knockout</font>
65.35 +METHOD reverse() [PUBLIC] <font color=#999999>Knockout</font>
65.36 +METHOD shift() [PUBLIC] <font color=#999999>Knockout</font>
65.37 +METHOD slice(start, end) [PUBLIC] <font color=#999999>Knockout</font>
65.38 +METHOD sort(comparefn) [PUBLIC] <font color=#999999>Knockout</font>
65.39 +METHOD splice(start, deleteCount) [PUBLIC] <font color=#999999>Knockout</font>
65.40 +METHOD unshift() [PUBLIC] <font color=#999999>Knockout</font>
65.41 +METHOD valueHasMutated() [PUBLIC] <font color=#999999>Knockout</font>
65.42 +METHOD valueWillMutate() [PUBLIC] <font color=#999999>Knockout</font>
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
66.2 +++ b/javascript2.requirejs/build.xml Mon Jun 02 14:23:34 2014 +0200
66.3 @@ -0,0 +1,5 @@
66.4 +<?xml version="1.0" encoding="UTF-8"?>
66.5 +<project basedir="." default="netbeans" name="javascript2.requirejs">
66.6 + <description>Builds, tests, and runs the project org.netbeans.modules.javascript2.requirejs</description>
66.7 + <import file="../nbbuild/templates/projectized.xml"/>
66.8 +</project>
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
67.2 +++ b/javascript2.requirejs/manifest.mf Mon Jun 02 14:23:34 2014 +0200
67.3 @@ -0,0 +1,5 @@
67.4 +Manifest-Version: 1.0
67.5 +OpenIDE-Module: org.netbeans.modules.javascript2.requirejs
67.6 +OpenIDE-Module-Layer: org/netbeans/modules/javascript2/requirejs/layer.xml
67.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javascript2/requirejs/Bundle.properties
67.8 +OpenIDE-Module-Specification-Version: 0.1
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
68.2 +++ b/javascript2.requirejs/nbproject/project.properties Mon Jun 02 14:23:34 2014 +0200
68.3 @@ -0,0 +1,3 @@
68.4 +javac.source=1.6
68.5 +javac.compilerargs=-Xlint -Xlint:-serial
68.6 +
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69.2 +++ b/javascript2.requirejs/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
69.3 @@ -0,0 +1,209 @@
69.4 +<?xml version="1.0" encoding="UTF-8"?>
69.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
69.6 + <type>org.netbeans.modules.apisupport.project</type>
69.7 + <configuration>
69.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
69.9 + <code-name-base>org.netbeans.modules.javascript2.requirejs</code-name-base>
69.10 + <module-dependencies>
69.11 + <dependency>
69.12 + <code-name-base>org.netbeans.modules.csl.api</code-name-base>
69.13 + <build-prerequisite/>
69.14 + <compile-dependency/>
69.15 + <run-dependency>
69.16 + <release-version>2</release-version>
69.17 + <specification-version>2.34</specification-version>
69.18 + </run-dependency>
69.19 + </dependency>
69.20 + <dependency>
69.21 + <code-name-base>org.netbeans.modules.editor.completion</code-name-base>
69.22 + <build-prerequisite/>
69.23 + <compile-dependency/>
69.24 + <run-dependency>
69.25 + <release-version>1</release-version>
69.26 + <specification-version>1.40</specification-version>
69.27 + </run-dependency>
69.28 + </dependency>
69.29 + <dependency>
69.30 + <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
69.31 + <build-prerequisite/>
69.32 + <compile-dependency/>
69.33 + <run-dependency>
69.34 + <release-version>3</release-version>
69.35 + <specification-version>3.49</specification-version>
69.36 + </run-dependency>
69.37 + </dependency>
69.38 + <dependency>
69.39 + <code-name-base>org.netbeans.modules.javascript2.editor</code-name-base>
69.40 + <build-prerequisite/>
69.41 + <compile-dependency/>
69.42 + <run-dependency>
69.43 + <release-version>1</release-version>
69.44 + <specification-version>0.7</specification-version>
69.45 + </run-dependency>
69.46 + </dependency>
69.47 + <dependency>
69.48 + <code-name-base>org.netbeans.modules.lexer</code-name-base>
69.49 + <build-prerequisite/>
69.50 + <compile-dependency/>
69.51 + <run-dependency>
69.52 + <release-version>2</release-version>
69.53 + <specification-version>1.51</specification-version>
69.54 + </run-dependency>
69.55 + </dependency>
69.56 + <dependency>
69.57 + <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
69.58 + <build-prerequisite/>
69.59 + <compile-dependency/>
69.60 + <run-dependency>
69.61 + <release-version>1</release-version>
69.62 + <specification-version>1.65</specification-version>
69.63 + </run-dependency>
69.64 + </dependency>
69.65 + <dependency>
69.66 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
69.67 + <build-prerequisite/>
69.68 + <compile-dependency/>
69.69 + <run-dependency>
69.70 + <release-version>1</release-version>
69.71 + <specification-version>1.58</specification-version>
69.72 + </run-dependency>
69.73 + </dependency>
69.74 + <dependency>
69.75 + <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
69.76 + <build-prerequisite/>
69.77 + <compile-dependency/>
69.78 + <run-dependency>
69.79 + <release-version>1</release-version>
69.80 + <specification-version>1.77</specification-version>
69.81 + </run-dependency>
69.82 + </dependency>
69.83 + <dependency>
69.84 + <code-name-base>org.netbeans.modules.queries</code-name-base>
69.85 + <build-prerequisite/>
69.86 + <compile-dependency/>
69.87 + <run-dependency>
69.88 + <release-version>1</release-version>
69.89 + <specification-version>1.39</specification-version>
69.90 + </run-dependency>
69.91 + </dependency>
69.92 + <dependency>
69.93 + <code-name-base>org.openide.awt</code-name-base>
69.94 + <build-prerequisite/>
69.95 + <compile-dependency/>
69.96 + <run-dependency>
69.97 + <specification-version>7.62</specification-version>
69.98 + </run-dependency>
69.99 + </dependency>
69.100 + <dependency>
69.101 + <code-name-base>org.openide.filesystems</code-name-base>
69.102 + <build-prerequisite/>
69.103 + <compile-dependency/>
69.104 + <run-dependency>
69.105 + <specification-version>8.7</specification-version>
69.106 + </run-dependency>
69.107 + </dependency>
69.108 + <dependency>
69.109 + <code-name-base>org.openide.loaders</code-name-base>
69.110 + <build-prerequisite/>
69.111 + <compile-dependency/>
69.112 + <run-dependency>
69.113 + <specification-version>7.57</specification-version>
69.114 + </run-dependency>
69.115 + </dependency>
69.116 + <dependency>
69.117 + <code-name-base>org.openide.modules</code-name-base>
69.118 + <build-prerequisite/>
69.119 + <compile-dependency/>
69.120 + <run-dependency>
69.121 + <specification-version>7.38</specification-version>
69.122 + </run-dependency>
69.123 + </dependency>
69.124 + <dependency>
69.125 + <code-name-base>org.openide.nodes</code-name-base>
69.126 + <build-prerequisite/>
69.127 + <compile-dependency/>
69.128 + <run-dependency>
69.129 + <specification-version>7.39</specification-version>
69.130 + </run-dependency>
69.131 + </dependency>
69.132 + <dependency>
69.133 + <code-name-base>org.openide.util</code-name-base>
69.134 + <build-prerequisite/>
69.135 + <compile-dependency/>
69.136 + <run-dependency>
69.137 + <specification-version>8.31</specification-version>
69.138 + </run-dependency>
69.139 + </dependency>
69.140 + <dependency>
69.141 + <code-name-base>org.openide.util.lookup</code-name-base>
69.142 + <build-prerequisite/>
69.143 + <compile-dependency/>
69.144 + <run-dependency>
69.145 + <specification-version>8.25</specification-version>
69.146 + </run-dependency>
69.147 + </dependency>
69.148 + </module-dependencies>
69.149 + <test-dependencies>
69.150 + <test-type>
69.151 + <name>unit</name>
69.152 + <test-dependency>
69.153 + <code-name-base>org.netbeans.modules.javascript2.requirejs</code-name-base>
69.154 + <recursive/>
69.155 + <compile-dependency/>
69.156 + </test-dependency>
69.157 + <test-dependency>
69.158 + <code-name-base>org.netbeans.modules.javascript2.editor</code-name-base>
69.159 + <recursive/>
69.160 + <compile-dependency/>
69.161 + <test/>
69.162 + </test-dependency>
69.163 + <test-dependency>
69.164 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
69.165 + <compile-dependency/>
69.166 + </test-dependency>
69.167 + <test-dependency>
69.168 + <code-name-base>org.netbeans.modules.csl.api</code-name-base>
69.169 + <recursive/>
69.170 + <compile-dependency/>
69.171 + <test/>
69.172 + </test-dependency>
69.173 + <test-dependency>
69.174 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
69.175 + <recursive/>
69.176 + <compile-dependency/>
69.177 + </test-dependency>
69.178 + <test-dependency>
69.179 + <code-name-base>org.netbeans.modules.lexer</code-name-base>
69.180 + <recursive/>
69.181 + <compile-dependency/>
69.182 + <test/>
69.183 + </test-dependency>
69.184 + <test-dependency>
69.185 + <code-name-base>org.openide.util.lookup</code-name-base>
69.186 + <compile-dependency/>
69.187 + <test/>
69.188 + </test-dependency>
69.189 + <test-dependency>
69.190 + <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
69.191 + <compile-dependency/>
69.192 + </test-dependency>
69.193 + <test-dependency>
69.194 + <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
69.195 + <recursive/>
69.196 + <compile-dependency/>
69.197 + <test/>
69.198 + </test-dependency>
69.199 + <test-dependency>
69.200 + <code-name-base>org.netbeans.modules.editor.mimelookup.impl</code-name-base>
69.201 + <recursive/>
69.202 + </test-dependency>
69.203 + </test-type>
69.204 + </test-dependencies>
69.205 + <public-packages/>
69.206 + </data>
69.207 + <spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
69.208 + <word>netbeans</word>
69.209 + <word>org</word>
69.210 + </spellchecker-wordlist>
69.211 + </configuration>
69.212 +</project>
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
70.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/Bundle.properties Mon Jun 02 14:23:34 2014 +0200
70.3 @@ -0,0 +1,5 @@
70.4 +OpenIDE-Module-Display-Category=JavaScript
70.5 +OpenIDE-Module-Long-Description=\
70.6 + Editor support for RequireJs framework
70.7 +OpenIDE-Module-Name=JavaScript2 RequiereJs
70.8 +OpenIDE-Module-Short-Description=RequireJs support
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/RequireJsPreferences.java Mon Jun 02 14:23:34 2014 +0200
71.3 @@ -0,0 +1,173 @@
71.4 +/*
71.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
71.6 + *
71.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
71.8 + *
71.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
71.10 + * Other names may be trademarks of their respective owners.
71.11 + *
71.12 + * The contents of this file are subject to the terms of either the GNU
71.13 + * General Public License Version 2 only ("GPL") or the Common
71.14 + * Development and Distribution License("CDDL") (collectively, the
71.15 + * "License"). You may not use this file except in compliance with the
71.16 + * License. You can obtain a copy of the License at
71.17 + * http://www.netbeans.org/cddl-gplv2.html
71.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
71.19 + * specific language governing permissions and limitations under the
71.20 + * License. When distributing the software, include this License Header
71.21 + * Notice in each file and include the License file at
71.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
71.23 + * particular file as subject to the "Classpath" exception as provided
71.24 + * by Oracle in the GPL Version 2 section of the License file that
71.25 + * accompanied this code. If applicable, add the following below the
71.26 + * License Header, with the fields enclosed by brackets [] replaced by
71.27 + * your own identifying information:
71.28 + * "Portions Copyrighted [year] [name of copyright owner]"
71.29 + *
71.30 + * If you wish your version of this file to be governed by only the CDDL
71.31 + * or only the GPL Version 2, indicate your decision by adding
71.32 + * "[Contributor] elects to include this software in this distribution
71.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
71.34 + * single choice of license, a recipient has the option to distribute
71.35 + * your version of this file under either the CDDL, the GPL Version 2 or
71.36 + * to extend the choice of license to its licensees as provided above.
71.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
71.38 + * Version 2 license, then the option applies only if the new code is
71.39 + * made subject to such option by the copyright holder.
71.40 + *
71.41 + * Contributor(s):
71.42 + *
71.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
71.44 + */
71.45 +package org.netbeans.modules.javascript2.requirejs;
71.46 +
71.47 +import java.util.Collections;
71.48 +import java.util.TreeMap;
71.49 +import java.util.Map;
71.50 +import java.util.prefs.Preferences;
71.51 +import java.util.regex.Pattern;
71.52 +import org.netbeans.api.project.Project;
71.53 +import org.netbeans.api.project.ProjectUtils;
71.54 +
71.55 +/**
71.56 + *
71.57 + * @author Petr Pisl
71.58 + */
71.59 +public class RequireJsPreferences {
71.60 + private static final String DEFAULT_VALUE = ""; // NOI18N
71.61 + private static final String MAPPINGS_SEPARATOR = "}{"; //NOI18N
71.62 + private static final String MAPPINGS_PATH_SEPARATOR = " , "; //NOI18N
71.63 +
71.64 + public static final Property<Boolean> ENABLED = new Property<Boolean>("enabled") {
71.65 + @Override
71.66 + public Boolean getDefaultValue() {
71.67 + return true;
71.68 + }
71.69 + };
71.70 +
71.71 + private static final Property<String> MAPPINGS = new Property<String>("mappings") { // NOI18N
71.72 + @Override
71.73 + public String getDefaultValue() {
71.74 + return "";
71.75 + }
71.76 + };
71.77 +
71.78 +
71.79 + public static class Property<T> {
71.80 +
71.81 + private final String key;
71.82 +
71.83 + private Property(String key) {
71.84 + assert key != null;
71.85 + this.key = key;
71.86 + }
71.87 +
71.88 + String getKey() {
71.89 + return key;
71.90 + }
71.91 +
71.92 + public T getDefaultValue() {
71.93 + return null;
71.94 + }
71.95 +
71.96 + }
71.97 +
71.98 + public static Boolean getBoolean(Project project, Property<Boolean> property) {
71.99 + return Boolean.parseBoolean(get(project, property));
71.100 + }
71.101 +
71.102 + public static void putBoolean(Project project, Property<Boolean> property, boolean value) {
71.103 + put(project, property, Boolean.toString(value));
71.104 + }
71.105 +
71.106 + public static final Map <String, String> getMappings(Project project) {
71.107 + String storedMappings = get(project, MAPPINGS);
71.108 + if (storedMappings == null || storedMappings.isEmpty()) {
71.109 + return Collections.emptyMap();
71.110 + }
71.111 + String[] mappings = storedMappings.split(Pattern.quote(MAPPINGS_SEPARATOR));
71.112 + Map<String, String> result = new TreeMap<String, String>();
71.113 + String pattern = Pattern.quote(MAPPINGS_PATH_SEPARATOR);
71.114 + for (String mapping : mappings) {
71.115 + String[] parts = mapping.split(pattern);
71.116 + if (parts.length == 2) {
71.117 + if (parts[0].startsWith("{")) {
71.118 + parts[0] = parts[0].substring(1);
71.119 + }
71.120 + parts[0] = parts[0].trim();
71.121 + if (parts[1].endsWith("}")) {
71.122 + parts[1] = parts[1].substring(0, parts[1].length() - 1);
71.123 + }
71.124 + parts[1] = parts[1].trim();
71.125 + result.put(parts[0], parts[1]);
71.126 + }
71.127 + }
71.128 + return result;
71.129 + }
71.130 +
71.131 + public static final void storeMappings(Project project, Map<String, String> mappings) {
71.132 + StringBuilder storedMappings = new StringBuilder();
71.133 + if (mappings.isEmpty()) {
71.134 + storedMappings.append(MAPPINGS.getDefaultValue());
71.135 + } else {
71.136 + storedMappings.append('{');
71.137 + for (Map.Entry<String, String> mapping : mappings.entrySet()) {
71.138 + if (storedMappings.length() > 1) {
71.139 + storedMappings.append(MAPPINGS_SEPARATOR);
71.140 + }
71.141 + storedMappings.append(mapping.getKey().trim()).append(MAPPINGS_PATH_SEPARATOR).append(mapping.getValue().trim());
71.142 + }
71.143 + storedMappings.append('}');
71.144 + }
71.145 + put(project, MAPPINGS, storedMappings.toString());
71.146 + }
71.147 +
71.148 + public static String get(final Project project, Property<? extends Object> property) {
71.149 + Preferences preferences = getPreferences(project);
71.150 + // get default value lazyly since it can do anything...
71.151 + String value = preferences.get(property.getKey(), DEFAULT_VALUE);
71.152 + if (value == DEFAULT_VALUE) {
71.153 + Object defaultValue = property.getDefaultValue();
71.154 + if (defaultValue == null) {
71.155 + return null;
71.156 + }
71.157 + return defaultValue.toString();
71.158 + }
71.159 + if (!StringUtils.hasText(value)) {
71.160 + return null;
71.161 + }
71.162 + return value;
71.163 + }
71.164 +
71.165 + public static void put(Project project, Property<? extends Object> property, String value) {
71.166 + if (StringUtils.hasText(value) && !value.equals(property.getDefaultValue())) {
71.167 + getPreferences(project).put(property.getKey(), value);
71.168 + } else {
71.169 + getPreferences(project).remove(property.getKey());
71.170 + }
71.171 + }
71.172 +
71.173 + private static Preferences getPreferences(Project project) {
71.174 + return ProjectUtils.getPreferences(project, RequireJsPreferences.class, true);
71.175 + }
71.176 +}
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
72.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/StringUtils.java Mon Jun 02 14:23:34 2014 +0200
72.3 @@ -0,0 +1,248 @@
72.4 +/*
72.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
72.6 + *
72.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
72.8 + *
72.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
72.10 + * Other names may be trademarks of their respective owners.
72.11 + *
72.12 + * The contents of this file are subject to the terms of either the GNU
72.13 + * General Public License Version 2 only ("GPL") or the Common
72.14 + * Development and Distribution License("CDDL") (collectively, the
72.15 + * "License"). You may not use this file except in compliance with the
72.16 + * License. You can obtain a copy of the License at
72.17 + * http://www.netbeans.org/cddl-gplv2.html
72.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
72.19 + * specific language governing permissions and limitations under the
72.20 + * License. When distributing the software, include this License Header
72.21 + * Notice in each file and include the License file at
72.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
72.23 + * particular file as subject to the "Classpath" exception as provided
72.24 + * by Oracle in the GPL Version 2 section of the License file that
72.25 + * accompanied this code. If applicable, add the following below the
72.26 + * License Header, with the fields enclosed by brackets [] replaced by
72.27 + * your own identifying information:
72.28 + * "Portions Copyrighted [year] [name of copyright owner]"
72.29 + *
72.30 + * If you wish your version of this file to be governed by only the CDDL
72.31 + * or only the GPL Version 2, indicate your decision by adding
72.32 + * "[Contributor] elects to include this software in this distribution
72.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
72.34 + * single choice of license, a recipient has the option to distribute
72.35 + * your version of this file under either the CDDL, the GPL Version 2 or
72.36 + * to extend the choice of license to its licensees as provided above.
72.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
72.38 + * Version 2 license, then the option applies only if the new code is
72.39 + * made subject to such option by the copyright holder.
72.40 + *
72.41 + * Contributor(s):
72.42 + *
72.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
72.44 + */
72.45 +
72.46 +package org.netbeans.modules.javascript2.requirejs;
72.47 +
72.48 +import java.util.Arrays;
72.49 +import java.util.Collection;
72.50 +import java.util.Collections;
72.51 +import java.util.List;
72.52 +import java.util.regex.Pattern;
72.53 +import org.openide.util.Parameters;
72.54 +
72.55 +/**
72.56 + * Miscellaneous string utilities.
72.57 + * @author Tomas Mysik
72.58 + */
72.59 +public final class StringUtils {
72.60 +
72.61 + private StringUtils() {
72.62 + }
72.63 +
72.64 + /**
72.65 + * Return <code>true</code> if the String is not <code>null</code>
72.66 + * and has any character after trimming.
72.67 + * @param input input <tt>String</tt>, can be <code>null</code>.
72.68 + * @return <code>true</code> if the String is not <code>null</code>
72.69 + * and has any character after trimming.
72.70 + * @see #isEmpty(String)
72.71 + */
72.72 + public static boolean hasText(String input) {
72.73 + return input != null && !input.trim().isEmpty();
72.74 + }
72.75 +
72.76 + /**
72.77 + * Return <code>true</code> if the String is <code>null</code>
72.78 + * or has no characters.
72.79 + * @param input input <tt>String</tt>, can be <code>null</code>
72.80 + * @return <code>true</code> if the String is <code>null</code>
72.81 + * or has no characters
72.82 + * @see #hasText(String)
72.83 + */
72.84 + public static boolean isEmpty(String input) {
72.85 + return input == null || input.isEmpty();
72.86 + }
72.87 +
72.88 + /**
72.89 + * Implode collection of strings to one string using delimiter.
72.90 + * @param items collection of strings to be imploded, can be empty (but not <code>null</code>)
72.91 + * @param delimiter delimiter to be used
72.92 + * @return one string of imploded strings using delimiter, never <code>null</code>
72.93 + * @see #explode(String, String)
72.94 + * @since 2.14
72.95 + */
72.96 + public static String implode(Collection<String> items, String delimiter) {
72.97 + Parameters.notNull("items", items);
72.98 + Parameters.notNull("delimiter", delimiter);
72.99 +
72.100 + if (items.isEmpty()) {
72.101 + return ""; // NOI18N
72.102 + }
72.103 +
72.104 + StringBuilder buffer = new StringBuilder(200);
72.105 + boolean first = true;
72.106 + for (String s : items) {
72.107 + if (!first) {
72.108 + buffer.append(delimiter);
72.109 + }
72.110 + buffer.append(s);
72.111 + first = false;
72.112 + }
72.113 + return buffer.toString();
72.114 + }
72.115 +
72.116 + /**
72.117 + * Explode the string using the delimiter.
72.118 + * @param string string to be exploded, can be <code>null</code>
72.119 + * @param delimiter delimiter to be used, cannot be empty string
72.120 + * @return list of exploded strings using delimiter
72.121 + * @see #implode(List, String)
72.122 + */
72.123 + public static List<String> explode(String string, String delimiter) {
72.124 + Parameters.notEmpty("delimiter", delimiter); // NOI18N
72.125 +
72.126 + if (!hasText(string)) {
72.127 + return Collections.<String>emptyList();
72.128 + }
72.129 + assert string != null;
72.130 + return Arrays.asList(string.split(Pattern.quote(delimiter)));
72.131 + }
72.132 +
72.133 + /**
72.134 + * Get the case-insensitive {@link Pattern pattern} for the given <tt>String</tt>
72.135 + * or <code>null</code> if it does not contain any "?" or "*" characters.
72.136 + * <p>
72.137 + * This pattern is "unbounded", it means that the <tt>text</tt> can be anywhere
72.138 + * in the matching string. See {@link #getExactPattern(String)} for pattern matching the whole string.
72.139 + * @param text the text to get {@link Pattern pattern} for
72.140 + * @return the case-insensitive {@link Pattern pattern} or <code>null</code>
72.141 + * if the <tt>text</tt> does not contain any "?" or "*" characters
72.142 + * @see #getExactPattern(String)
72.143 + */
72.144 + public static Pattern getPattern(String text) {
72.145 + Parameters.notNull("text", text); // NOI18N
72.146 +
72.147 + return getPattern0(text, ".*", ".*"); // NOI18N
72.148 + }
72.149 +
72.150 + /**
72.151 + * Get the case-insensitive {@link Pattern pattern} for the given <tt>String</tt>
72.152 + * or <code>null</code> if it does not contain any "?" or "*" characters.
72.153 + * <p>
72.154 + * This pattern exactly matches the string, it means that the <tt>text</tt> must be fully matched in the
72.155 + * matching string. See {@link #getPattern(String)} for pattern matching any substring in the matching string.
72.156 + * @param text the text to get {@link Pattern pattern} for
72.157 + * @return the case-insensitive {@link Pattern pattern} or <code>null</code>
72.158 + * if the <tt>text</tt> does not contain any "?" or "*" characters
72.159 + * @see #getPattern(String)
72.160 + */
72.161 + public static Pattern getExactPattern(String text) {
72.162 + Parameters.notNull("text", text); // NOI18N
72.163 +
72.164 + return getPattern0(text, "^", "$"); // NOI18N
72.165 + }
72.166 +
72.167 + /**
72.168 + * Keep all digits and letters only; other characters are replaced with dash ("-"). All upper-cased letters
72.169 + * are replaced with dash ("-") and its lower-cased variants. No more than one dash ("-") is added at once.
72.170 + * <p>
72.171 + * Example: "My Super_Company1" is converted to "my-super-company1".
72.172 + * @param input text to be converted
72.173 + * @return lower-cased input string
72.174 + * @since 2.1
72.175 + */
72.176 + public static String webalize(String input) {
72.177 + StringBuilder sb = new StringBuilder(input.length() * 2);
72.178 + final char dash = '-'; // NOI18N
72.179 + char lastChar = 0;
72.180 + for (int i = 0; i < input.length(); ++i) {
72.181 + boolean addDash = false;
72.182 + char ch = input.charAt(i);
72.183 + if (Character.isLetterOrDigit(ch)) {
72.184 + if (Character.isUpperCase(ch)) {
72.185 + addDash = true;
72.186 + ch = Character.toLowerCase(ch);
72.187 + }
72.188 + } else {
72.189 + ch = dash;
72.190 + }
72.191 + if (ch == dash && (lastChar == dash || sb.length() == 0)) {
72.192 + continue;
72.193 + }
72.194 + if (addDash && lastChar != dash && sb.length() > 0) {
72.195 + sb.append(dash);
72.196 + }
72.197 + sb.append(ch);
72.198 + lastChar = ch;
72.199 + }
72.200 + if (lastChar == dash) {
72.201 + sb.deleteCharAt(sb.length() - 1);
72.202 + }
72.203 + return sb.toString();
72.204 + }
72.205 +
72.206 + /**
72.207 + * Capitalizes first character of the passed input.
72.208 + * <p>
72.209 + * Example: foobarbaz -> Foobarbaz
72.210 + * @param input text to be capitalized, never null or empty
72.211 + * @return capitalized input string, never null
72.212 + * @since 2.21
72.213 + */
72.214 + public static String capitalize(String input) {
72.215 + Parameters.notEmpty("input", input); //NOI18N
72.216 + return input.substring(0, 1).toUpperCase() + input.substring(1);
72.217 + }
72.218 +
72.219 + /**
72.220 + * Decapitalizes first character of the passed input.
72.221 + * <p>
72.222 + * Example: Foobarbaz -> foobarbaz
72.223 + * @param input text to be decapitalized, never null or empty
72.224 + * @return decapitalized input string, never null
72.225 + * @since 2.33
72.226 + */
72.227 + public static String decapitalize(String input) {
72.228 + Parameters.notEmpty("input", input); //NOI18N
72.229 + return input.substring(0, 1).toLowerCase() + input.substring(1);
72.230 + }
72.231 +
72.232 + private static Pattern getPattern0(String text, String prefix, String suffix) {
72.233 + assert text != null;
72.234 + assert prefix != null;
72.235 + assert suffix != null;
72.236 +
72.237 + if (text.contains("?") || text.contains("*")) { // NOI18N
72.238 + String pattern = text.replace("\\", "") // remove regexp escapes first // NOI18N
72.239 + .replace(".", "\\.") // NOI18N
72.240 + .replace("-", "\\-") // NOI18N
72.241 + .replace("(", "\\(") // NOI18N
72.242 + .replace(")", "\\)") // NOI18N
72.243 + .replace("[", "\\[") // NOI18N
72.244 + .replace("]", "\\]") // NOI18N
72.245 + .replace("?", ".") // NOI18N
72.246 + .replace("*", ".*"); // NOI18N
72.247 + return Pattern.compile(prefix + pattern + suffix, Pattern.CASE_INSENSITIVE); // NOI18N
72.248 + }
72.249 + return null;
72.250 + }
72.251 +}
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
73.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/EditorUtils.java Mon Jun 02 14:23:34 2014 +0200
73.3 @@ -0,0 +1,132 @@
73.4 +/*
73.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
73.6 + *
73.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
73.8 + *
73.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
73.10 + * Other names may be trademarks of their respective owners.
73.11 + *
73.12 + * The contents of this file are subject to the terms of either the GNU
73.13 + * General Public License Version 2 only ("GPL") or the Common
73.14 + * Development and Distribution License("CDDL") (collectively, the
73.15 + * "License"). You may not use this file except in compliance with the
73.16 + * License. You can obtain a copy of the License at
73.17 + * http://www.netbeans.org/cddl-gplv2.html
73.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
73.19 + * specific language governing permissions and limitations under the
73.20 + * License. When distributing the software, include this License Header
73.21 + * Notice in each file and include the License file at
73.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
73.23 + * particular file as subject to the "Classpath" exception as provided
73.24 + * by Oracle in the GPL Version 2 section of the License file that
73.25 + * accompanied this code. If applicable, add the following below the
73.26 + * License Header, with the fields enclosed by brackets [] replaced by
73.27 + * your own identifying information:
73.28 + * "Portions Copyrighted [year] [name of copyright owner]"
73.29 + *
73.30 + * If you wish your version of this file to be governed by only the CDDL
73.31 + * or only the GPL Version 2, indicate your decision by adding
73.32 + * "[Contributor] elects to include this software in this distribution
73.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
73.34 + * single choice of license, a recipient has the option to distribute
73.35 + * your version of this file under either the CDDL, the GPL Version 2 or
73.36 + * to extend the choice of license to its licensees as provided above.
73.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
73.38 + * Version 2 license, then the option applies only if the new code is
73.39 + * made subject to such option by the copyright holder.
73.40 + *
73.41 + * Contributor(s):
73.42 + *
73.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
73.44 + */
73.45 +package org.netbeans.modules.javascript2.requirejs.editor;
73.46 +
73.47 +import java.util.ArrayList;
73.48 +import java.util.Arrays;
73.49 +import java.util.Collection;
73.50 +import java.util.Collections;
73.51 +import java.util.List;
73.52 +import org.netbeans.api.lexer.Token;
73.53 +import org.netbeans.api.lexer.TokenSequence;
73.54 +import org.netbeans.modules.javascript2.editor.api.lexer.JsTokenId;
73.55 +import org.netbeans.modules.javascript2.editor.api.lexer.LexUtilities;
73.56 +import org.netbeans.modules.parsing.api.Snapshot;
73.57 +
73.58 +/**
73.59 + *
73.60 + * @author Petr Pisl
73.61 + */
73.62 +public class EditorUtils {
73.63 +
73.64 + public static final String DEFINE = "define"; //NOI18N
73.65 + public static final String REQUIRE = "require"; //NOI18N
73.66 + public static final String REQUIREJS = "requirejs"; // NOI18N
73.67 + public static final String PATHS = "paths"; //NOI18N
73.68 + public static final String BASE_URL = "baseUrl"; //NOI8N
73.69 +
73.70 + /**
73.71 + * Returns true if at the offset there is a string and the string is in a
73.72 + * call of define or require method.
73.73 + *
73.74 + * @param ts
73.75 + * @param offset
73.76 + * @return
73.77 + */
73.78 + public static boolean isFileReference(TokenSequence<? extends JsTokenId> ts, int offset) {
73.79 + ts.move(offset);
73.80 + if (ts.moveNext()) {
73.81 + Token<? extends JsTokenId> token = ts.token();
73.82 + if (token.id() == JsTokenId.STRING || token.id() == JsTokenId.STRING_END) {
73.83 + token = LexUtilities.findPrevious(ts, Arrays.asList(JsTokenId.WHITESPACE, JsTokenId.EOL, JsTokenId.BLOCK_COMMENT, JsTokenId.LINE_COMMENT,
73.84 + JsTokenId.STRING_BEGIN, JsTokenId.STRING, JsTokenId.STRING_END, JsTokenId.OPERATOR_COMMA));
73.85 + if (token.id() == JsTokenId.BRACKET_LEFT_BRACKET) {
73.86 + token = LexUtilities.findPreviousToken(ts, Arrays.asList(JsTokenId.IDENTIFIER));
73.87 + if (token.id() == JsTokenId.IDENTIFIER
73.88 + && (DEFINE.equals(token.text().toString()) || REQUIRE.equals(token.text().toString()) || REQUIREJS.equals(token.text().toString()))) {
73.89 + return true;
73.90 + }
73.91 + }
73.92 + if (token.id() == JsTokenId.OPERATOR_COLON) {
73.93 + token = LexUtilities.findPreviousToken(ts, Arrays.asList(JsTokenId.BRACKET_LEFT_CURLY));
73.94 + if (token.id() == JsTokenId.BRACKET_LEFT_CURLY) {
73.95 + token = LexUtilities.findPreviousToken(ts, Arrays.asList(JsTokenId.IDENTIFIER));
73.96 + if (token.id() == JsTokenId.IDENTIFIER && PATHS.equals(token.text().toString())) {
73.97 + return true;
73.98 + }
73.99 + }
73.100 + }
73.101 + }
73.102 + }
73.103 + return false;
73.104 + }
73.105 +
73.106 + public static Collection<String> getUsedFileInDefine(final Snapshot shanpshot, final int offset) {
73.107 + TokenSequence<? extends JsTokenId> ts = LexUtilities.getJsTokenSequence(shanpshot, offset);
73.108 + if (ts == null) {
73.109 + return Collections.emptyList();
73.110 + }
73.111 + ts.move(0);
73.112 + if (!ts.moveNext()) {
73.113 + return Collections.emptyList();
73.114 + }
73.115 + Token<? extends JsTokenId> token = LexUtilities.findNextToken(ts, Arrays.asList(JsTokenId.IDENTIFIER));
73.116 + while (token.id() == JsTokenId.IDENTIFIER && !DEFINE.equals(token.text().toString()) && ts.moveNext()) {
73.117 + token = LexUtilities.findNextToken(ts, Arrays.asList(JsTokenId.IDENTIFIER));
73.118 + }
73.119 + if (token.id() == JsTokenId.IDENTIFIER && DEFINE.equals(token.text().toString())) {
73.120 + // we are probably found the define method
73.121 + List<String> paths = new ArrayList<String>();
73.122 + token = LexUtilities.findNextToken(ts, Arrays.asList(JsTokenId.BRACKET_LEFT_BRACKET, JsTokenId.KEYWORD_FUNCTION, JsTokenId.BRACKET_LEFT_CURLY, JsTokenId.BRACKET_RIGHT_PAREN));
73.123 + if (token.id() == JsTokenId.BRACKET_LEFT_BRACKET) {
73.124 + do {
73.125 + token = LexUtilities.findNextToken(ts, Arrays.asList(JsTokenId.STRING, JsTokenId.OPERATOR_COMMA, JsTokenId.BRACKET_RIGHT_PAREN));
73.126 + if (token.id() == JsTokenId.STRING) {
73.127 + paths.add(token.text().toString());
73.128 + }
73.129 + } while ((token.id() != JsTokenId.BRACKET_RIGHT_PAREN && token.id() != JsTokenId.OPERATOR_SEMICOLON && !token.id().isKeyword()) && ts.moveNext());
73.130 + return paths;
73.131 + }
73.132 + }
73.133 + return Collections.emptyList();
73.134 + }
73.135 +}
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
74.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/FSCompletionItem.java Mon Jun 02 14:23:34 2014 +0200
74.3 @@ -0,0 +1,227 @@
74.4 +/*
74.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
74.6 + *
74.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
74.8 + *
74.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
74.10 + * Other names may be trademarks of their respective owners.
74.11 + *
74.12 + * The contents of this file are subject to the terms of either the GNU
74.13 + * General Public License Version 2 only ("GPL") or the Common
74.14 + * Development and Distribution License("CDDL") (collectively, the
74.15 + * "License"). You may not use this file except in compliance with the
74.16 + * License. You can obtain a copy of the License at
74.17 + * http://www.netbeans.org/cddl-gplv2.html
74.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
74.19 + * specific language governing permissions and limitations under the
74.20 + * License. When distributing the software, include this License Header
74.21 + * Notice in each file and include the License file at
74.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
74.23 + * particular file as subject to the "Classpath" exception as provided
74.24 + * by Oracle in the GPL Version 2 section of the License file that
74.25 + * accompanied this code. If applicable, add the following below the
74.26 + * License Header, with the fields enclosed by brackets [] replaced by
74.27 + * your own identifying information:
74.28 + * "Portions Copyrighted [year] [name of copyright owner]"
74.29 + *
74.30 + * If you wish your version of this file to be governed by only the CDDL
74.31 + * or only the GPL Version 2, indicate your decision by adding
74.32 + * "[Contributor] elects to include this software in this distribution
74.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
74.34 + * single choice of license, a recipient has the option to distribute
74.35 + * your version of this file under either the CDDL, the GPL Version 2 or
74.36 + * to extend the choice of license to its licensees as provided above.
74.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
74.38 + * Version 2 license, then the option applies only if the new code is
74.39 + * made subject to such option by the copyright holder.
74.40 + *
74.41 + * Contributor(s):
74.42 + *
74.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
74.44 + */
74.45 +package org.netbeans.modules.javascript2.requirejs.editor;
74.46 +
74.47 +import java.beans.BeanInfo;
74.48 +import java.io.IOException;
74.49 +import java.util.Collections;
74.50 +import java.util.Set;
74.51 +import javax.swing.ImageIcon;
74.52 +import javax.swing.text.BadLocationException;
74.53 +import javax.swing.text.JTextComponent;
74.54 +import org.netbeans.editor.BaseDocument;
74.55 +import org.netbeans.modules.csl.api.CompletionProposal;
74.56 +import org.netbeans.modules.csl.api.ElementHandle;
74.57 +import org.netbeans.modules.csl.api.ElementKind;
74.58 +import org.netbeans.modules.csl.api.HtmlFormatter;
74.59 +import org.netbeans.modules.csl.api.Modifier;
74.60 +import org.netbeans.modules.csl.api.OffsetRange;
74.61 +import org.netbeans.modules.csl.spi.ParserResult;
74.62 +import org.openide.filesystems.FileObject;
74.63 +import org.openide.loaders.DataObject;
74.64 +import org.openide.util.Exceptions;
74.65 +
74.66 +/**
74.67 + *
74.68 + * @author Petr Pisl
74.69 + */
74.70 +public class FSCompletionItem implements CompletionProposal {
74.71 +
74.72 + private final FileObject file;
74.73 + private final ImageIcon icon;
74.74 + private final int anchor;
74.75 + private final String prefix;
74.76 + private final FSElementHandle element;
74.77 +
74.78 + public FSCompletionItem(final FileObject file, final String prefix, final int anchor) throws IOException {
74.79 + this.file = file;
74.80 + this.element = new FSElementHandle(file);
74.81 + DataObject od = DataObject.find(file);
74.82 +
74.83 + icon = new ImageIcon(od.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16));
74.84 +
74.85 + this.anchor = anchor;
74.86 +
74.87 + this.prefix = prefix;
74.88 + }
74.89 +
74.90 + protected String getText() {
74.91 + return prefix + file.getNameExt() + (file.isFolder() ? "/" : "");
74.92 + }
74.93 +
74.94 + @Override
74.95 + public int hashCode() {
74.96 + return getText().hashCode();
74.97 + }
74.98 +
74.99 + @Override
74.100 + public boolean equals(Object o) {
74.101 + if (!(o instanceof FSCompletionItem)) {
74.102 + return false;
74.103 + }
74.104 +
74.105 + FSCompletionItem remote = (FSCompletionItem) o;
74.106 +
74.107 + return getFile().equals(remote.getFile());
74.108 + }
74.109 +
74.110 + @Override
74.111 + public ImageIcon getIcon() {
74.112 + return icon;
74.113 + }
74.114 +
74.115 + @Override
74.116 + public int getAnchorOffset() {
74.117 + return this.anchor;
74.118 + }
74.119 +
74.120 + @Override
74.121 + public ElementHandle getElement() {
74.122 + return this.element;
74.123 + }
74.124 +
74.125 + @Override
74.126 + public String getName() {
74.127 + return element.getName();
74.128 + }
74.129 +
74.130 + @Override
74.131 + public String getInsertPrefix() {
74.132 + return getName() + (file.isFolder() ? "/" : "");
74.133 + }
74.134 +
74.135 + @Override
74.136 + public String getSortText() {
74.137 + return getName();
74.138 + }
74.139 +
74.140 + @Override
74.141 + public String getLhsHtml(HtmlFormatter formatter) {
74.142 + return file.getNameExt() + " "; //NOI18N
74.143 + }
74.144 +
74.145 + @Override
74.146 + public String getRhsHtml(HtmlFormatter formatter) {
74.147 + return "";
74.148 + }
74.149 +
74.150 + @Override
74.151 + public ElementKind getKind() {
74.152 + return element.getKind();
74.153 + }
74.154 +
74.155 + @Override
74.156 + public Set<Modifier> getModifiers() {
74.157 + return Collections.emptySet();
74.158 + }
74.159 +
74.160 + @Override
74.161 + public boolean isSmart() {
74.162 + return false;
74.163 + }
74.164 +
74.165 + @Override
74.166 + public int getSortPrioOverride() {
74.167 + return -1000;
74.168 + }
74.169 +
74.170 + @Override
74.171 + public String getCustomInsertTemplate() {
74.172 + return null;
74.173 + }
74.174 +
74.175 + public FileObject getFile() {
74.176 + return file;
74.177 + }
74.178 +
74.179 + public static class FSElementHandle implements ElementHandle {
74.180 +
74.181 + private final FileObject fo;
74.182 +
74.183 + public FSElementHandle(FileObject fo) {
74.184 + this.fo = fo;
74.185 + }
74.186 +
74.187 +
74.188 + @Override
74.189 + public FileObject getFileObject() {
74.190 + return fo;
74.191 + }
74.192 +
74.193 + @Override
74.194 + public String getMimeType() {
74.195 + return fo.getMIMEType();
74.196 + }
74.197 +
74.198 + @Override
74.199 + public String getName() {
74.200 + return fo.isFolder() ? fo.getNameExt() : fo.getName();
74.201 + }
74.202 +
74.203 + @Override
74.204 + public String getIn() {
74.205 + return null;
74.206 + }
74.207 +
74.208 + @Override
74.209 + public ElementKind getKind() {
74.210 + return ElementKind.FILE;
74.211 + }
74.212 +
74.213 + @Override
74.214 + public Set<Modifier> getModifiers() {
74.215 + return Collections.EMPTY_SET;
74.216 + }
74.217 +
74.218 + @Override
74.219 + public boolean signatureEquals(ElementHandle handle) {
74.220 + return fo.equals(handle.getFileObject());
74.221 + }
74.222 +
74.223 + @Override
74.224 + public OffsetRange getOffsetRange(ParserResult result) {
74.225 + return OffsetRange.NONE;
74.226 + }
74.227 +
74.228 + }
74.229 +
74.230 +}
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
75.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/FSCompletionUtils.java Mon Jun 02 14:23:34 2014 +0200
75.3 @@ -0,0 +1,330 @@
75.4 +/*
75.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
75.6 + *
75.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
75.8 + *
75.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
75.10 + * Other names may be trademarks of their respective owners.
75.11 + *
75.12 + * The contents of this file are subject to the terms of either the GNU
75.13 + * General Public License Version 2 only ("GPL") or the Common
75.14 + * Development and Distribution License("CDDL") (collectively, the
75.15 + * "License"). You may not use this file except in compliance with the
75.16 + * License. You can obtain a copy of the License at
75.17 + * http://www.netbeans.org/cddl-gplv2.html
75.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
75.19 + * specific language governing permissions and limitations under the
75.20 + * License. When distributing the software, include this License Header
75.21 + * Notice in each file and include the License file at
75.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
75.23 + * particular file as subject to the "Classpath" exception as provided
75.24 + * by Oracle in the GPL Version 2 section of the License file that
75.25 + * accompanied this code. If applicable, add the following below the
75.26 + * License Header, with the fields enclosed by brackets [] replaced by
75.27 + * your own identifying information:
75.28 + * "Portions Copyrighted [year] [name of copyright owner]"
75.29 + *
75.30 + * If you wish your version of this file to be governed by only the CDDL
75.31 + * or only the GPL Version 2, indicate your decision by adding
75.32 + * "[Contributor] elects to include this software in this distribution
75.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
75.34 + * single choice of license, a recipient has the option to distribute
75.35 + * your version of this file under either the CDDL, the GPL Version 2 or
75.36 + * to extend the choice of license to its licensees as provided above.
75.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
75.38 + * Version 2 license, then the option applies only if the new code is
75.39 + * made subject to such option by the copyright holder.
75.40 + *
75.41 + * Contributor(s):
75.42 + *
75.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
75.44 + */
75.45 +package org.netbeans.modules.javascript2.requirejs.editor;
75.46 +
75.47 +import java.io.File;
75.48 +import java.io.IOException;
75.49 +import java.net.URI;
75.50 +import java.util.ArrayList;
75.51 +import java.util.Collection;
75.52 +import java.util.HashMap;
75.53 +import java.util.HashSet;
75.54 +import java.util.LinkedList;
75.55 +import java.util.List;
75.56 +import java.util.Map;
75.57 +import java.util.Set;
75.58 +import org.netbeans.api.project.FileOwnerQuery;
75.59 +import org.netbeans.api.project.Project;
75.60 +import org.netbeans.api.queries.VisibilityQuery;
75.61 +import org.netbeans.modules.csl.api.CompletionProposal;
75.62 +import org.netbeans.modules.javascript2.requirejs.RequireJsPreferences;
75.63 +import org.netbeans.modules.javascript2.requirejs.editor.index.RequireJsIndex;
75.64 +import org.openide.filesystems.FileObject;
75.65 +import org.openide.filesystems.FileUtil;
75.66 +import org.openide.util.Exceptions;
75.67 +import org.openide.util.Utilities;
75.68 +
75.69 +/**
75.70 + *
75.71 + * @author Petr Pisl
75.72 + */
75.73 +public class FSCompletionUtils {
75.74 +
75.75 + final static String GO_UP = "../"; //NOI18N
75.76 +
75.77 + public static List<CompletionProposal> computeRelativeItems(
75.78 + Collection<? extends FileObject> relativeTo,
75.79 + final String prefix,
75.80 + int anchor,
75.81 + FileObjectFilter filter) throws IOException {
75.82 +
75.83 + assert relativeTo != null;
75.84 +
75.85 + List<CompletionProposal> result = new LinkedList();
75.86 +
75.87 + int lastSlash = prefix.lastIndexOf('/');
75.88 + String pathPrefix;
75.89 + String filePrefix;
75.90 +
75.91 + if (lastSlash != (-1)) {
75.92 + pathPrefix = prefix.substring(0, lastSlash);
75.93 + filePrefix = prefix.substring(lastSlash + 1);
75.94 + } else {
75.95 + pathPrefix = null;
75.96 + filePrefix = prefix;
75.97 + }
75.98 +
75.99 + Set<FileObject> directories = new HashSet();
75.100 + File prefixFile = null;
75.101 + if (pathPrefix != null && !pathPrefix.startsWith(".")) { //NOI18N
75.102 + if (pathPrefix.length() == 0 && prefix.startsWith("/")) {
75.103 + prefixFile = new File("/"); //NOI18N
75.104 + } else {
75.105 + prefixFile = new File(pathPrefix);
75.106 + }
75.107 + }
75.108 + if (prefixFile != null && prefixFile.exists()) {
75.109 + //absolute path
75.110 + File normalizeFile = FileUtil.normalizeFile(prefixFile);
75.111 + FileObject fo = FileUtil.toFileObject(normalizeFile);
75.112 + if (fo != null) {
75.113 + directories.add(fo);
75.114 + }
75.115 + } else {
75.116 + //relative path
75.117 + for (FileObject f : relativeTo) {
75.118 + if (pathPrefix != null) {
75.119 + File toFile = FileUtil.toFile(f);
75.120 + if (toFile != null) {
75.121 + URI resolve = Utilities.toURI(toFile).resolve(pathPrefix).normalize();
75.122 + File normalizedFile = FileUtil.normalizeFile(Utilities.toFile(resolve));
75.123 + f = FileUtil.toFileObject(normalizedFile);
75.124 + } else {
75.125 + f = f.getFileObject(pathPrefix);
75.126 + }
75.127 + }
75.128 +
75.129 + if (f != null) {
75.130 + directories.add(f);
75.131 + }
75.132 + }
75.133 + }
75.134 +
75.135 + for (FileObject dir : directories) {
75.136 + FileObject[] children = dir.getChildren();
75.137 +
75.138 + for (int cntr = 0; cntr < children.length; cntr++) {
75.139 + FileObject current = children[cntr];
75.140 +
75.141 + if (VisibilityQuery.getDefault().isVisible(current) && current.getNameExt().toLowerCase().startsWith(filePrefix.toLowerCase()) && filter.accept(current)) {
75.142 + int newAnchor = pathPrefix == null
75.143 + ? anchor - prefix.length() : anchor - Math.max(0, prefix.length() - pathPrefix.length() - 1);
75.144 + result.add(new FSCompletionItem(current, pathPrefix != null ? pathPrefix + "/" : "./", newAnchor)); //NOI18N
75.145 + }
75.146 + }
75.147 + }
75.148 +// if (GO_UP.startsWith(filePrefix) && directories.size() == 1) {
75.149 +// FileObject parent = directories.iterator().next();
75.150 +// if (parent.getParent() != null && VisibilityQuery.getDefault().isVisible(parent.getParent()) && filter.accept(parent.getParent())) {
75.151 +// if (!parent.isFolder()) {
75.152 +// parent = parent.getParent();
75.153 +// }
75.154 +// result.add(new FSCompletionItem(parent, "", anchor) {
75.155 +//
75.156 +// @Override
75.157 +// protected String getText() {
75.158 +// return (!prefix.equals("..") && !prefix.equals(".") ? prefix : "") + GO_UP; //NOI18N
75.159 +// }
75.160 +// });
75.161 +// }
75.162 +// }
75.163 +
75.164 + return result;
75.165 + }
75.166 +
75.167 + public static class JSIncludesFilter implements FileObjectFilter {
75.168 +
75.169 + private FileObject currentFile;
75.170 +
75.171 + public JSIncludesFilter(FileObject currentFile) {
75.172 + this.currentFile = currentFile;
75.173 + }
75.174 +
75.175 + @Override
75.176 + public boolean accept(FileObject file) {
75.177 + if (file.equals(currentFile) || isNbProjectMetadata(file)) {
75.178 + return false; //do not include self in the cc result
75.179 + }
75.180 +
75.181 + if (file.isFolder()) {
75.182 + return true;
75.183 + }
75.184 +
75.185 + String mimeType = FileUtil.getMIMEType(file);
75.186 +
75.187 + return mimeType != null && mimeType.startsWith("text/");
75.188 + }
75.189 +
75.190 + private static boolean isNbProjectMetadata(FileObject fo) {
75.191 + final String metadataName = "nbproject"; //NOI18N
75.192 + if (fo.getPath().indexOf(metadataName) != -1) {
75.193 + while (fo != null) {
75.194 + if (fo.isFolder()) {
75.195 + if (metadataName.equals(fo.getNameExt())) {
75.196 + return true;
75.197 + }
75.198 + }
75.199 + fo = fo.getParent();
75.200 + }
75.201 + }
75.202 + return false;
75.203 + }
75.204 + }
75.205 +
75.206 + interface FileObjectFilter {
75.207 +
75.208 + boolean accept(FileObject file);
75.209 +
75.210 + }
75.211 +
75.212 + /**
75.213 + * Returns corresponding file, if it's found for the specific path
75.214 + *
75.215 + * @param path
75.216 + * @param info
75.217 + * @return
75.218 + */
75.219 + public static FileObject findMappedFileObject(final String pathToFile, FileObject parent) {
75.220 + String path = pathToFile;
75.221 + String[] pathParts = path.split("/");
75.222 + FileObject result = null;
75.223 + if (parent != null) {
75.224 + if (pathParts[pathParts.length - 1].indexOf('.') > 0) {
75.225 + result = findFileObject(parent, path);
75.226 + if (result != null) {
75.227 + return result;
75.228 + }
75.229 + }
75.230 + Project project = FileOwnerQuery.getOwner(parent);
75.231 + RequireJsIndex rIndex = null;
75.232 + try {
75.233 + rIndex = RequireJsIndex.get(project);
75.234 + } catch (IOException ex) {
75.235 + Exceptions.printStackTrace(ex);
75.236 + }
75.237 + Collection<String> basePaths = new ArrayList();
75.238 + Map<String, String> configPaths = new HashMap();
75.239 +
75.240 + if (rIndex != null) {
75.241 + basePaths = rIndex.getBasePaths();
75.242 + configPaths = rIndex.getPathMappings(basePaths.isEmpty() ? pathParts[0] : "");
75.243 + }
75.244 +
75.245 + String alias = "";
75.246 + for (String possibleAlias : configPaths.keySet()) {
75.247 + if (possibleAlias.equals(pathToFile)) {
75.248 + alias = possibleAlias;
75.249 + break;
75.250 + }
75.251 + if (path.startsWith(possibleAlias) && (alias.length() < possibleAlias.length())) {
75.252 + alias = possibleAlias;
75.253 + }
75.254 + }
75.255 + if (!alias.isEmpty()) {
75.256 + path = configPaths.get(alias) + pathToFile.substring(alias.length());
75.257 + if (basePaths.isEmpty()) {
75.258 + result = findFileObject(parent, composePath(path));
75.259 + if (result != null) {
75.260 + return result;
75.261 + }
75.262 + }
75.263 + }
75.264 + // try directly the base path
75.265 + for (String value : basePaths) {
75.266 + String composedPath = composePath(value, path);
75.267 + result = findFileObject(parent, composedPath);
75.268 + if (result != null) {
75.269 + return result;
75.270 + }
75.271 + }
75.272 +
75.273 + // try mappings from project properties
75.274 + Map<String, String> pathMappings = RequireJsPreferences.getMappings(project);
75.275 + alias = "";
75.276 + for (String possibleAlias : pathMappings.keySet()) {
75.277 + if (possibleAlias.equals(pathToFile)) {
75.278 + alias = possibleAlias;
75.279 + break;
75.280 + }
75.281 + if (pathToFile.startsWith(possibleAlias) && (alias.length() < possibleAlias.length())) {
75.282 + alias = possibleAlias;
75.283 + }
75.284 + }
75.285 + if (!alias.isEmpty()) {
75.286 + path = pathMappings.get(alias) + pathToFile.substring(alias.length());
75.287 + result = findFileObject(parent, composePath(path));
75.288 + if (result != null) {
75.289 + return result;
75.290 + }
75.291 + }
75.292 + result = findFileObject(parent, composePath(pathToFile));
75.293 + }
75.294 +
75.295 + return result;
75.296 + }
75.297 +
75.298 + public static FileObject findFileObject(final FileObject fromFO, final String path) {
75.299 + FileObject parent = fromFO;
75.300 + FileObject targetFO = fromFO;
75.301 + if (parent != null && !path.isEmpty()) {
75.302 + while (parent != null) {
75.303 + targetFO = parent.getFileObject(path);
75.304 + if (targetFO != null) {
75.305 + return targetFO;
75.306 + }
75.307 + targetFO = parent.getFileObject(path + ".js");
75.308 + if (targetFO != null) {
75.309 + return targetFO;
75.310 + }
75.311 + parent = parent.getParent();
75.312 + }
75.313 + }
75.314 + return null;
75.315 + }
75.316 +
75.317 + private static String composePath(String... parts) {
75.318 + StringBuilder result = new StringBuilder();
75.319 + String lastPart = "";
75.320 + for (String part : parts) {
75.321 + if (part.isEmpty()) {
75.322 + // skip empty parts
75.323 + continue;
75.324 + }
75.325 + if (!lastPart.isEmpty() && lastPart.charAt(lastPart.length() - 1) != '/' && part.charAt(0) != '/') {
75.326 + result.append('/');
75.327 + }
75.328 + result.append(part);
75.329 + lastPart = part;
75.330 + }
75.331 + return result.toString();
75.332 + }
75.333 +}
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
76.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/MappingCompletionItem.java Mon Jun 02 14:23:34 2014 +0200
76.3 @@ -0,0 +1,221 @@
76.4 +/*
76.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
76.6 + *
76.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
76.8 + *
76.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
76.10 + * Other names may be trademarks of their respective owners.
76.11 + *
76.12 + * The contents of this file are subject to the terms of either the GNU
76.13 + * General Public License Version 2 only ("GPL") or the Common
76.14 + * Development and Distribution License("CDDL") (collectively, the
76.15 + * "License"). You may not use this file except in compliance with the
76.16 + * License. You can obtain a copy of the License at
76.17 + * http://www.netbeans.org/cddl-gplv2.html
76.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
76.19 + * specific language governing permissions and limitations under the
76.20 + * License. When distributing the software, include this License Header
76.21 + * Notice in each file and include the License file at
76.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
76.23 + * particular file as subject to the "Classpath" exception as provided
76.24 + * by Oracle in the GPL Version 2 section of the License file that
76.25 + * accompanied this code. If applicable, add the following below the
76.26 + * License Header, with the fields enclosed by brackets [] replaced by
76.27 + * your own identifying information:
76.28 + * "Portions Copyrighted [year] [name of copyright owner]"
76.29 + *
76.30 + * If you wish your version of this file to be governed by only the CDDL
76.31 + * or only the GPL Version 2, indicate your decision by adding
76.32 + * "[Contributor] elects to include this software in this distribution
76.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
76.34 + * single choice of license, a recipient has the option to distribute
76.35 + * your version of this file under either the CDDL, the GPL Version 2 or
76.36 + * to extend the choice of license to its licensees as provided above.
76.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
76.38 + * Version 2 license, then the option applies only if the new code is
76.39 + * made subject to such option by the copyright holder.
76.40 + *
76.41 + * Contributor(s):
76.42 + *
76.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
76.44 + */
76.45 +
76.46 +package org.netbeans.modules.javascript2.requirejs.editor;
76.47 +
76.48 +import java.beans.BeanInfo;
76.49 +import java.io.IOException;
76.50 +import java.util.Collections;
76.51 +import java.util.Set;
76.52 +import javax.swing.Icon;
76.53 +import javax.swing.ImageIcon;
76.54 +import org.netbeans.modules.csl.api.CompletionProposal;
76.55 +import org.netbeans.modules.csl.api.ElementHandle;
76.56 +import org.netbeans.modules.csl.api.ElementKind;
76.57 +import org.netbeans.modules.csl.api.HtmlFormatter;
76.58 +import org.netbeans.modules.csl.api.Modifier;
76.59 +import org.netbeans.modules.csl.api.OffsetRange;
76.60 +import org.netbeans.modules.csl.spi.ParserResult;
76.61 +import org.openide.filesystems.FileObject;
76.62 +import org.openide.loaders.DataObject;
76.63 +import org.openide.util.ImageUtilities;
76.64 +
76.65 +/**
76.66 + *
76.67 + * @author Petr Pisl
76.68 + */
76.69 +public class MappingCompletionItem implements CompletionProposal {
76.70 +
76.71 + private static ImageIcon REQUIREJS_ICON = null;
76.72 +
76.73 + private final int anchor;
76.74 + private final MappingHandle element;
76.75 + private String insertedPrefix = null;
76.76 + private final FileObject mapToFile;
76.77 +
76.78 + public MappingCompletionItem(final String mapping, FileObject toFile, final int anchor){
76.79 + this.element = new MappingHandle(mapping);
76.80 + this.anchor = anchor;
76.81 + this.mapToFile = toFile;
76.82 + }
76.83 +
76.84 + protected String getText() {
76.85 + return getName();
76.86 + }
76.87 +
76.88 + @Override
76.89 + public int hashCode() {
76.90 + return getText().hashCode();
76.91 + }
76.92 +
76.93 + @Override
76.94 + public boolean equals(Object o) {
76.95 + if (!(o instanceof MappingCompletionItem)) {
76.96 + return false;
76.97 + }
76.98 +
76.99 + MappingCompletionItem remote = (MappingCompletionItem) o;
76.100 +
76.101 + return getText().equals(remote.getText());
76.102 + }
76.103 +
76.104 + @Override
76.105 + public ImageIcon getIcon() {
76.106 +
76.107 + if (REQUIREJS_ICON == null) {
76.108 + REQUIREJS_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/requirejs/resources/requirejs.png")); //NOI18N
76.109 + }
76.110 + return REQUIREJS_ICON;
76.111 + }
76.112 +
76.113 + @Override
76.114 + public int getAnchorOffset() {
76.115 + return this.anchor;
76.116 + }
76.117 +
76.118 + @Override
76.119 + public ElementHandle getElement() {
76.120 + return this.element;
76.121 + }
76.122 +
76.123 + @Override
76.124 + public String getName() {
76.125 + return element.getName();
76.126 + }
76.127 +
76.128 + @Override
76.129 + public String getInsertPrefix() {
76.130 + return getName() + (mapToFile != null && mapToFile.isFolder() ? "/" : "");
76.131 + }
76.132 +
76.133 + @Override
76.134 + public String getSortText() {
76.135 + return getName();
76.136 + }
76.137 +
76.138 + @Override
76.139 + public String getLhsHtml(HtmlFormatter formatter) {
76.140 + return getText();
76.141 + }
76.142 +
76.143 + @Override
76.144 + public String getRhsHtml(HtmlFormatter formatter) {
76.145 + return "";
76.146 + }
76.147 +
76.148 + @Override
76.149 + public ElementKind getKind() {
76.150 + return element.getKind();
76.151 + }
76.152 +
76.153 + @Override
76.154 + public Set<Modifier> getModifiers() {
76.155 + return element.getModifiers();
76.156 + }
76.157 +
76.158 + @Override
76.159 + public boolean isSmart() {
76.160 + return false;
76.161 + }
76.162 +
76.163 + @Override
76.164 + public int getSortPrioOverride() {
76.165 + return -1000;
76.166 + }
76.167 +
76.168 + @Override
76.169 + public String getCustomInsertTemplate() {
76.170 + return null;
76.171 + }
76.172 +
76.173 +
76.174 + private class MappingHandle implements ElementHandle {
76.175 +
76.176 + private final String name;
76.177 +
76.178 + public MappingHandle(String name) {
76.179 + this.name = name;
76.180 + }
76.181 +
76.182 +
76.183 + @Override
76.184 + public FileObject getFileObject() {
76.185 + return null;
76.186 + }
76.187 +
76.188 + @Override
76.189 + public String getMimeType() {
76.190 + return null;
76.191 + }
76.192 +
76.193 + @Override
76.194 + public String getName() {
76.195 + return name;
76.196 + }
76.197 +
76.198 + @Override
76.199 + public String getIn() {
76.200 + return null;
76.201 + }
76.202 +
76.203 + @Override
76.204 + public ElementKind getKind() {
76.205 + return ElementKind.FILE;
76.206 + }
76.207 +
76.208 + @Override
76.209 + public Set<Modifier> getModifiers() {
76.210 + return Collections.EMPTY_SET;
76.211 + }
76.212 +
76.213 + @Override
76.214 + public boolean signatureEquals(ElementHandle handle) {
76.215 + return name.equals(handle.getName());
76.216 + }
76.217 +
76.218 + @Override
76.219 + public OffsetRange getOffsetRange(ParserResult result) {
76.220 + return OffsetRange.NONE;
76.221 + }
76.222 +
76.223 + }
76.224 +}
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
77.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/RequireJSCodeCompletion.java Mon Jun 02 14:23:34 2014 +0200
77.3 @@ -0,0 +1,228 @@
77.4 +/*
77.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
77.6 + *
77.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
77.8 + *
77.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
77.10 + * Other names may be trademarks of their respective owners.
77.11 + *
77.12 + * The contents of this file are subject to the terms of either the GNU
77.13 + * General Public License Version 2 only ("GPL") or the Common
77.14 + * Development and Distribution License("CDDL") (collectively, the
77.15 + * "License"). You may not use this file except in compliance with the
77.16 + * License. You can obtain a copy of the License at
77.17 + * http://www.netbeans.org/cddl-gplv2.html
77.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
77.19 + * specific language governing permissions and limitations under the
77.20 + * License. When distributing the software, include this License Header
77.21 + * Notice in each file and include the License file at
77.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
77.23 + * particular file as subject to the "Classpath" exception as provided
77.24 + * by Oracle in the GPL Version 2 section of the License file that
77.25 + * accompanied this code. If applicable, add the following below the
77.26 + * License Header, with the fields enclosed by brackets [] replaced by
77.27 + * your own identifying information:
77.28 + * "Portions Copyrighted [year] [name of copyright owner]"
77.29 + *
77.30 + * If you wish your version of this file to be governed by only the CDDL
77.31 + * or only the GPL Version 2, indicate your decision by adding
77.32 + * "[Contributor] elects to include this software in this distribution
77.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
77.34 + * single choice of license, a recipient has the option to distribute
77.35 + * your version of this file under either the CDDL, the GPL Version 2 or
77.36 + * to extend the choice of license to its licensees as provided above.
77.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
77.38 + * Version 2 license, then the option applies only if the new code is
77.39 + * made subject to such option by the copyright holder.
77.40 + *
77.41 + * Contributor(s):
77.42 + *
77.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
77.44 + */
77.45 +package org.netbeans.modules.javascript2.requirejs.editor;
77.46 +
77.47 +import java.io.IOException;
77.48 +import java.util.ArrayList;
77.49 +import java.util.Collection;
77.50 +import java.util.Collections;
77.51 +import java.util.HashMap;
77.52 +import java.util.Iterator;
77.53 +import java.util.List;
77.54 +import java.util.Map;
77.55 +import org.netbeans.api.lexer.TokenSequence;
77.56 +import org.netbeans.api.project.FileOwnerQuery;
77.57 +import org.netbeans.api.project.Project;
77.58 +import org.netbeans.modules.csl.api.CodeCompletionContext;
77.59 +import org.netbeans.modules.csl.api.CompletionProposal;
77.60 +import org.netbeans.modules.csl.api.ElementHandle;
77.61 +import org.netbeans.modules.csl.spi.ParserResult;
77.62 +import org.netbeans.modules.javascript2.editor.api.lexer.JsTokenId;
77.63 +import org.netbeans.modules.javascript2.editor.api.lexer.LexUtilities;
77.64 +import org.netbeans.modules.javascript2.editor.spi.CompletionContext;
77.65 +import org.netbeans.modules.javascript2.editor.spi.CompletionProvider;
77.66 +import org.netbeans.modules.javascript2.requirejs.RequireJsPreferences;
77.67 +import org.netbeans.modules.javascript2.requirejs.editor.index.RequireJsIndex;
77.68 +import org.netbeans.modules.parsing.api.Snapshot;
77.69 +import org.openide.filesystems.FileObject;
77.70 +import org.openide.util.Exceptions;
77.71 +
77.72 +/**
77.73 + *
77.74 + * @author Petr Pisl
77.75 + */
77.76 +@CompletionProvider.Registration(priority = 40)
77.77 +public class RequireJSCodeCompletion implements CompletionProvider {
77.78 +
77.79 + @Override
77.80 + public List<CompletionProposal> complete(CodeCompletionContext ccContext, CompletionContext jsCompletionContext, final String prefix) {
77.81 + int offset = ccContext.getCaretOffset();
77.82 + Snapshot snapshot = ccContext.getParserResult().getSnapshot();
77.83 + TokenSequence<? extends JsTokenId> ts = LexUtilities.getJsTokenSequence(snapshot.getTokenHierarchy(), offset);
77.84 + if (ts == null) {
77.85 + return Collections.emptyList();
77.86 + }
77.87 + ts.move(offset);
77.88 + String writtenPath = prefix;
77.89 + if (ts.moveNext() && (ts.token().id() == JsTokenId.STRING_END || ts.token().id() == JsTokenId.STRING)) {
77.90 + if (ts.token().id() == JsTokenId.STRING_END) {
77.91 + ts.movePrevious();
77.92 + }
77.93 + if (ts.token().id() == JsTokenId.STRING) {
77.94 + String text = ts.token().text().toString();
77.95 + if (!text.startsWith(prefix)) {
77.96 + // this is needed, because from JS the prefix is split with '.'
77.97 + writtenPath = text.substring(0, offset - ts.offset());
77.98 + }
77.99 + }
77.100 +
77.101 + }
77.102 +
77.103 + FileObject fo = ccContext.getParserResult().getSnapshot().getSource().getFileObject();
77.104 + if (fo != null && EditorUtils.isFileReference(ts, offset)) {
77.105 + List<FileObject> relativeTo = new ArrayList<FileObject>();
77.106 + Collection<String> usedFileInDefine = EditorUtils.getUsedFileInDefine(snapshot, offset);
77.107 + for (String path : usedFileInDefine) {
77.108 + if (writtenPath.isEmpty() || path.startsWith(writtenPath)) {
77.109 + FileObject targetFO = FSCompletionUtils.findMappedFileObject(path, fo);
77.110 + if (targetFO != null) {
77.111 + String[] folders = path.split("/");
77.112 + for (int i = 0; i < folders.length; i++) {
77.113 + targetFO = targetFO.getParent();
77.114 + }
77.115 + if (!relativeTo.contains(targetFO)) {
77.116 + relativeTo.add(targetFO);
77.117 + }
77.118 + }
77.119 + }
77.120 + }
77.121 +
77.122 + if (relativeTo.isEmpty()) {
77.123 + Project project = FileOwnerQuery.getOwner(fo);
77.124 + Collection<String> basePaths = new ArrayList();
77.125 + if (project != null) {
77.126 + RequireJsIndex rIndex = null;
77.127 + try {
77.128 + rIndex = RequireJsIndex.get(project);
77.129 + } catch (IOException ex) {
77.130 + Exceptions.printStackTrace(ex);
77.131 + }
77.132 +
77.133 + if (rIndex != null) {
77.134 + basePaths = rIndex.getBasePaths();
77.135 + }
77.136 + }
77.137 + relativeTo.add(fo.getParent());
77.138 + if (!basePaths.isEmpty()) {
77.139 + for (String path : basePaths) {
77.140 + FileObject findFO = FSCompletionUtils.findFileObject(fo, path);
77.141 + if (findFO != null) {
77.142 + relativeTo.add(findFO);
77.143 + }
77.144 + }
77.145 + }
77.146 + }
77.147 +
77.148 + List<CompletionProposal> result = new ArrayList();
77.149 +
77.150 + try {
77.151 + result = FSCompletionUtils.computeRelativeItems(relativeTo, writtenPath, ccContext.getCaretOffset(), new FSCompletionUtils.JSIncludesFilter(fo));
77.152 + } catch (IOException ex) {
77.153 + Exceptions.printStackTrace(ex);
77.154 + }
77.155 +
77.156 + FileObject fromMapping = FSCompletionUtils.findMappedFileObject(writtenPath, fo);
77.157 + String prefixAfterMapping = "";
77.158 + if (fromMapping == null) {
77.159 + // try to find file withouth the last part of part
77.160 + int index = writtenPath.lastIndexOf('/');
77.161 + if (index > -1) {
77.162 + fromMapping = FSCompletionUtils.findMappedFileObject(writtenPath.substring(0, index), fo);
77.163 + prefixAfterMapping = writtenPath.substring(index + 1);
77.164 + }
77.165 + }
77.166 + if (fromMapping != null) {
77.167 + // try the whole prefix
77.168 + relativeTo.clear();
77.169 + relativeTo.add(fromMapping);
77.170 + try {
77.171 + List<CompletionProposal> newItems = FSCompletionUtils.computeRelativeItems(relativeTo, prefixAfterMapping, ccContext.getCaretOffset(), new FSCompletionUtils.JSIncludesFilter(fo));
77.172 + for (Iterator<CompletionProposal> it = newItems.iterator(); it.hasNext();) {
77.173 + CompletionProposal proposel = it.next();
77.174 + if (!result.contains(proposel)) {
77.175 + result.add(proposel);
77.176 + }
77.177 + }
77.178 + } catch (IOException ex) {
77.179 + Exceptions.printStackTrace(ex);
77.180 + }
77.181 + }
77.182 + Project project = FileOwnerQuery.getOwner(fo);
77.183 + Map<String, String> mappings = new HashMap();
77.184 + RequireJsIndex rIndex = null;
77.185 + try {
77.186 + rIndex = RequireJsIndex.get(project);
77.187 + } catch (IOException ex) {
77.188 + Exceptions.printStackTrace(ex);
77.189 + }
77.190 + if (rIndex != null) {
77.191 + mappings.putAll(rIndex.getPathMappings(writtenPath));
77.192 + }
77.193 + mappings.putAll(RequireJsPreferences.getMappings(project));
77.194 + for (String mapping : mappings.keySet()) {
77.195 + if (mapping.startsWith(writtenPath)) {
77.196 + result.add(new MappingCompletionItem(mapping, FSCompletionUtils.findMappedFileObject(mapping, fo), ccContext.getCaretOffset() - writtenPath.length()));
77.197 + }
77.198 + }
77.199 +
77.200 + return result;
77.201 + }
77.202 + return Collections.emptyList();
77.203 + }
77.204 +
77.205 + @Override
77.206 + public String getHelpDocumentation(ParserResult info, ElementHandle element) {
77.207 + if (element != null && element instanceof FSCompletionItem.FSElementHandle) {
77.208 + FileObject fo = element.getFileObject();
77.209 + if (fo != null) {
77.210 + String path = fo.getPath();
77.211 + String[] parts = path.split("/");
77.212 + StringBuilder sb = new StringBuilder();
77.213 + sb.append("<pre>"); // NOI18N
77.214 + int length = 0;
77.215 + for (String part : parts) {
77.216 + if ((length + part.length()) > 50) {
77.217 + sb.append("\n "); // NOI18N
77.218 + length = 4;
77.219 + }
77.220 + sb.append(part).append('/');
77.221 + length += part.length() + 1;
77.222 + }
77.223 + sb.deleteCharAt(sb.length() - 1);
77.224 + sb.append("</pre>"); // NOI18N
77.225 + return sb.toString();
77.226 + }
77.227 + }
77.228 + return null;
77.229 + }
77.230 +
77.231 +}
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
78.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/RequireJsDeclarationFinder.java Mon Jun 02 14:23:34 2014 +0200
78.3 @@ -0,0 +1,145 @@
78.4 +/*
78.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
78.6 + *
78.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
78.8 + *
78.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
78.10 + * Other names may be trademarks of their respective owners.
78.11 + *
78.12 + * The contents of this file are subject to the terms of either the GNU
78.13 + * General Public License Version 2 only ("GPL") or the Common
78.14 + * Development and Distribution License("CDDL") (collectively, the
78.15 + * "License"). You may not use this file except in compliance with the
78.16 + * License. You can obtain a copy of the License at
78.17 + * http://www.netbeans.org/cddl-gplv2.html
78.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
78.19 + * specific language governing permissions and limitations under the
78.20 + * License. When distributing the software, include this License Header
78.21 + * Notice in each file and include the License file at
78.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
78.23 + * particular file as subject to the "Classpath" exception as provided
78.24 + * by Oracle in the GPL Version 2 section of the License file that
78.25 + * accompanied this code. If applicable, add the following below the
78.26 + * License Header, with the fields enclosed by brackets [] replaced by
78.27 + * your own identifying information:
78.28 + * "Portions Copyrighted [year] [name of copyright owner]"
78.29 + *
78.30 + * If you wish your version of this file to be governed by only the CDDL
78.31 + * or only the GPL Version 2, indicate your decision by adding
78.32 + * "[Contributor] elects to include this software in this distribution
78.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
78.34 + * single choice of license, a recipient has the option to distribute
78.35 + * your version of this file under either the CDDL, the GPL Version 2 or
78.36 + * to extend the choice of license to its licensees as provided above.
78.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
78.38 + * Version 2 license, then the option applies only if the new code is
78.39 + * made subject to such option by the copyright holder.
78.40 + *
78.41 + * Contributor(s):
78.42 + *
78.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
78.44 + */
78.45 +package org.netbeans.modules.javascript2.requirejs.editor;
78.46 +
78.47 +import java.util.Arrays;
78.48 +import javax.swing.text.Document;
78.49 +import org.netbeans.api.lexer.Token;
78.50 +import org.netbeans.api.lexer.TokenSequence;
78.51 +import org.netbeans.modules.csl.api.OffsetRange;
78.52 +import org.netbeans.modules.csl.spi.ParserResult;
78.53 +import org.netbeans.modules.javascript2.editor.api.lexer.JsTokenId;
78.54 +import org.netbeans.modules.javascript2.editor.api.lexer.LexUtilities;
78.55 +import org.netbeans.modules.javascript2.editor.spi.DeclarationFinder;
78.56 +import org.openide.filesystems.FileObject;
78.57 +
78.58 +/**
78.59 + *
78.60 + * @author Petr Pisl
78.61 + */
78.62 +@DeclarationFinder.Registration(priority = 12)
78.63 +public class RequireJsDeclarationFinder implements DeclarationFinder {
78.64 +
78.65 + @Override
78.66 + public DeclarationLocation findDeclaration(ParserResult info, int caretOffset) {
78.67 + TokenSequence<? extends JsTokenId> ts = LexUtilities.getJsTokenSequence(info.getSnapshot().getTokenHierarchy(), caretOffset);
78.68 + FileObject fo = info.getSnapshot().getSource().getFileObject();
78.69 + if (ts != null && fo != null) {
78.70 + ts.move(caretOffset);
78.71 + if (ts.moveNext() && ts.token().id() == JsTokenId.STRING && EditorUtils.isFileReference(ts, ts.offset())) {
78.72 + ts.move(caretOffset);
78.73 + ts.moveNext();
78.74 + String path = ts.token().text().toString();
78.75 + FileObject targetFO = FSCompletionUtils.findMappedFileObject(path, fo);
78.76 + if (targetFO != null) {
78.77 + return new DeclarationLocation(targetFO, 0);
78.78 + }
78.79 + } else if (ts.token().id() == JsTokenId.IDENTIFIER) {
78.80 + int commaNumber = 0;
78.81 + Token<? extends JsTokenId> token;
78.82 + do {
78.83 + token = LexUtilities.findPrevious(ts, Arrays.asList(JsTokenId.IDENTIFIER, JsTokenId.WHITESPACE, JsTokenId.EOL, JsTokenId.BLOCK_COMMENT, JsTokenId.LINE_COMMENT));
78.84 + if (token.id() == JsTokenId.OPERATOR_COMMA) {
78.85 + commaNumber++;
78.86 + }
78.87 + } while (ts.movePrevious() && token.id() != JsTokenId.BRACKET_LEFT_BRACKET
78.88 + && token.id() != JsTokenId.BRACKET_LEFT_PAREN);
78.89 + if (token.id() == JsTokenId.BRACKET_LEFT_PAREN) {
78.90 + token = LexUtilities.findPreviousToken(ts, Arrays.asList(JsTokenId.IDENTIFIER));
78.91 + if (token.id() == JsTokenId.IDENTIFIER
78.92 + && (EditorUtils.DEFINE.equals(token.text().toString()) || EditorUtils.REQUIRE.equals(token.text().toString()) || EditorUtils.REQUIREJS.equals(token.text().toString()))) {
78.93 + // we found define method
78.94 + token = LexUtilities.findNextToken(ts, Arrays.asList(JsTokenId.BRACKET_LEFT_BRACKET, JsTokenId.KEYWORD_FUNCTION, JsTokenId.BRACKET_LEFT_CURLY, JsTokenId.BRACKET_RIGHT_PAREN));
78.95 + if (token.id() == JsTokenId.BRACKET_LEFT_BRACKET) {
78.96 + int commaInArray = 0;
78.97 + String path = null;
78.98 + do {
78.99 + token = LexUtilities.findNextToken(ts, Arrays.asList(JsTokenId.STRING, JsTokenId.OPERATOR_COMMA, JsTokenId.BRACKET_RIGHT_PAREN));
78.100 + if (token.id() == JsTokenId.OPERATOR_COMMA) {
78.101 + commaInArray++;
78.102 + } else if (token.id() == JsTokenId.STRING && commaInArray == commaNumber) {
78.103 + path = token.text().toString();
78.104 + }
78.105 + } while (path == null && ts.moveNext() && token.id() != JsTokenId.BRACKET_RIGHT_PAREN);
78.106 + if (path != null) {
78.107 + FileObject targetFO = FSCompletionUtils.findMappedFileObject(path, fo);
78.108 + if (targetFO != null) {
78.109 + return new DeclarationLocation(targetFO, 0);
78.110 + }
78.111 + }
78.112 + }
78.113 + }
78.114 + }
78.115 + }
78.116 + }
78.117 +
78.118 + return DeclarationLocation.NONE;
78.119 + }
78.120 +
78.121 +
78.122 +
78.123 + @Override
78.124 + public OffsetRange getReferenceSpan(final Document doc, final int caretOffset) {
78.125 + final OffsetRange[] value = new OffsetRange[1];
78.126 + value[0] = OffsetRange.NONE;
78.127 +
78.128 + doc.render(new Runnable() {
78.129 +
78.130 + @Override
78.131 + public void run() {
78.132 + TokenSequence<? extends JsTokenId> ts = LexUtilities.getJsTokenSequence(doc, caretOffset);
78.133 + if (ts != null) {
78.134 + ts.move(caretOffset);
78.135 + if (ts.moveNext() && ts.token().id() == JsTokenId.STRING && EditorUtils.isFileReference(ts, ts.offset())) {
78.136 + ts.move(caretOffset);
78.137 + ts.moveNext();
78.138 + value[0] = new OffsetRange(ts.offset(), ts.offset() + ts.token().length());
78.139 + }
78.140 + }
78.141 + }
78.142 + });
78.143 + return value[0];
78.144 + }
78.145 +
78.146 +
78.147 +
78.148 +}
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
79.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/index/IndexElement.java Mon Jun 02 14:23:34 2014 +0200
79.3 @@ -0,0 +1,66 @@
79.4 +/*
79.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
79.6 + *
79.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
79.8 + *
79.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
79.10 + * Other names may be trademarks of their respective owners.
79.11 + *
79.12 + * The contents of this file are subject to the terms of either the GNU
79.13 + * General Public License Version 2 only ("GPL") or the Common
79.14 + * Development and Distribution License("CDDL") (collectively, the
79.15 + * "License"). You may not use this file except in compliance with the
79.16 + * License. You can obtain a copy of the License at
79.17 + * http://www.netbeans.org/cddl-gplv2.html
79.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
79.19 + * specific language governing permissions and limitations under the
79.20 + * License. When distributing the software, include this License Header
79.21 + * Notice in each file and include the License file at
79.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
79.23 + * particular file as subject to the "Classpath" exception as provided
79.24 + * by Oracle in the GPL Version 2 section of the License file that
79.25 + * accompanied this code. If applicable, add the following below the
79.26 + * License Header, with the fields enclosed by brackets [] replaced by
79.27 + * your own identifying information:
79.28 + * "Portions Copyrighted [year] [name of copyright owner]"
79.29 + *
79.30 + * If you wish your version of this file to be governed by only the CDDL
79.31 + * or only the GPL Version 2, indicate your decision by adding
79.32 + * "[Contributor] elects to include this software in this distribution
79.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
79.34 + * single choice of license, a recipient has the option to distribute
79.35 + * your version of this file under either the CDDL, the GPL Version 2 or
79.36 + * to extend the choice of license to its licensees as provided above.
79.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
79.38 + * Version 2 license, then the option applies only if the new code is
79.39 + * made subject to such option by the copyright holder.
79.40 + *
79.41 + * Contributor(s):
79.42 + *
79.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
79.44 + */
79.45 +
79.46 +package org.netbeans.modules.javascript2.requirejs.editor.index;
79.47 +
79.48 +import java.util.Collection;
79.49 +import java.util.Collections;
79.50 +import org.netbeans.modules.javascript2.editor.model.TypeUsage;
79.51 +
79.52 +/**
79.53 + *
79.54 + * @author Petr Pisl
79.55 + */
79.56 +public class IndexElement {
79.57 +
79.58 + private final Collection<? extends TypeUsage> exportedTypes;
79.59 +
79.60 + public IndexElement(Collection<? extends TypeUsage> exportedTypes) {
79.61 + this.exportedTypes = exportedTypes;
79.62 + }
79.63 +
79.64 + public Collection<? extends TypeUsage> getExportedTypes() {
79.65 + return Collections.unmodifiableCollection(exportedTypes);
79.66 + }
79.67 +
79.68 +
79.69 +}
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
80.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/index/RequireJsIndex.java Mon Jun 02 14:23:34 2014 +0200
80.3 @@ -0,0 +1,186 @@
80.4 +/*
80.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
80.6 + *
80.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
80.8 + *
80.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
80.10 + * Other names may be trademarks of their respective owners.
80.11 + *
80.12 + * The contents of this file are subject to the terms of either the GNU
80.13 + * General Public License Version 2 only ("GPL") or the Common
80.14 + * Development and Distribution License("CDDL") (collectively, the
80.15 + * "License"). You may not use this file except in compliance with the
80.16 + * License. You can obtain a copy of the License at
80.17 + * http://www.netbeans.org/cddl-gplv2.html
80.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
80.19 + * specific language governing permissions and limitations under the
80.20 + * License. When distributing the software, include this License Header
80.21 + * Notice in each file and include the License file at
80.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
80.23 + * particular file as subject to the "Classpath" exception as provided
80.24 + * by Oracle in the GPL Version 2 section of the License file that
80.25 + * accompanied this code. If applicable, add the following below the
80.26 + * License Header, with the fields enclosed by brackets [] replaced by
80.27 + * your own identifying information:
80.28 + * "Portions Copyrighted [year] [name of copyright owner]"
80.29 + *
80.30 + * If you wish your version of this file to be governed by only the CDDL
80.31 + * or only the GPL Version 2, indicate your decision by adding
80.32 + * "[Contributor] elects to include this software in this distribution
80.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
80.34 + * single choice of license, a recipient has the option to distribute
80.35 + * your version of this file under either the CDDL, the GPL Version 2 or
80.36 + * to extend the choice of license to its licensees as provided above.
80.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
80.38 + * Version 2 license, then the option applies only if the new code is
80.39 + * made subject to such option by the copyright holder.
80.40 + *
80.41 + * Contributor(s):
80.42 + *
80.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
80.44 + */
80.45 +package org.netbeans.modules.javascript2.requirejs.editor.index;
80.46 +
80.47 +import java.io.IOException;
80.48 +import java.util.ArrayList;
80.49 +import java.util.Arrays;
80.50 +import java.util.Collection;
80.51 +import java.util.Collections;
80.52 +import java.util.HashMap;
80.53 +import java.util.List;
80.54 +import java.util.Map;
80.55 +import java.util.WeakHashMap;
80.56 +import java.util.concurrent.ExecutionException;
80.57 +import java.util.logging.Logger;
80.58 +import org.netbeans.api.project.Project;
80.59 +import org.netbeans.api.project.ui.OpenProjects;
80.60 +import org.netbeans.modules.javascript2.editor.model.TypeUsage;
80.61 +import org.netbeans.modules.javascript2.editor.spi.model.ModelElementFactory;
80.62 +import org.netbeans.modules.parsing.spi.indexing.support.IndexResult;
80.63 +import org.netbeans.modules.parsing.spi.indexing.support.QuerySupport;
80.64 +import org.openide.filesystems.FileObject;
80.65 +import org.openide.util.Exceptions;
80.66 +
80.67 +/**
80.68 + *
80.69 + * @author Petr Pisl
80.70 + */
80.71 +public class RequireJsIndex {
80.72 +
80.73 + private static final Logger LOGGER = Logger.getLogger(RequireJsIndex.class.getSimpleName());
80.74 +
80.75 + private final QuerySupport querySupport;
80.76 + private static final Map<Project, RequireJsIndex> INDEXES = new WeakHashMap();
80.77 + private static boolean areProjectsOpen = false;
80.78 +
80.79 + public static RequireJsIndex get(Project project) throws IOException {
80.80 + if (project == null) {
80.81 + return null;
80.82 + }
80.83 + synchronized (INDEXES) {
80.84 + RequireJsIndex index = INDEXES.get(project);
80.85 + if (index == null) {
80.86 + if (!areProjectsOpen) {
80.87 + try {
80.88 + // just be sure that the projects are open
80.89 + OpenProjects.getDefault().openProjects().get();
80.90 + } catch (InterruptedException ex) {
80.91 + Exceptions.printStackTrace(ex);
80.92 + } catch (ExecutionException ex) {
80.93 + Exceptions.printStackTrace(ex);
80.94 + } finally {
80.95 + areProjectsOpen = true;
80.96 + }
80.97 + }
80.98 + Collection<FileObject> sourceRoots = QuerySupport.findRoots(project,
80.99 + null /* all source roots */,
80.100 + Collections.<String>emptyList(),
80.101 + Collections.<String>emptyList());
80.102 + QuerySupport querySupport = QuerySupport.forRoots(RequireJsIndexer.Factory.NAME, RequireJsIndexer.Factory.VERSION, sourceRoots.toArray(new FileObject[]{}));
80.103 + index = new RequireJsIndex(querySupport);
80.104 + if (sourceRoots.size() > 0) {
80.105 + INDEXES.put(project, index);
80.106 + }
80.107 + }
80.108 + return index;
80.109 + }
80.110 + }
80.111 +
80.112 + private RequireJsIndex(QuerySupport querySupport) throws IOException {
80.113 + this.querySupport = querySupport;
80.114 + }
80.115 +
80.116 +
80.117 + public Collection<? extends TypeUsage> getExposedTypes(String module, ModelElementFactory factory) {
80.118 + Collection<? extends IndexResult> result = null;
80.119 + String moduleName = module;
80.120 + String[] parts = moduleName.split("/");
80.121 + if (parts.length > 0) {
80.122 + moduleName = parts[parts.length - 1];
80.123 + }
80.124 + try {
80.125 + result = querySupport.query(RequireJsIndexer.FIELD_MODULE_NAME, moduleName, QuerySupport.Kind.PREFIX, RequireJsIndexer.FIELD_MODULE_NAME, RequireJsIndexer.FIELD_EXPOSED_TYPES);
80.126 + } catch (IOException ex) {
80.127 + Exceptions.printStackTrace(ex);
80.128 + }
80.129 + if (result != null && !result.isEmpty()) {
80.130 + Collection<TypeUsage> types = new ArrayList<TypeUsage>();
80.131 + for (IndexResult indexResult : result) {
80.132 + String[] values = indexResult.getValues(RequireJsIndexer.FIELD_EXPOSED_TYPES);
80.133 + String mn = indexResult.getValue(RequireJsIndexer.FIELD_MODULE_NAME);
80.134 + if(mn.equals(moduleName)) {
80.135 + for (String stype : values) {
80.136 + String[] typeParts = stype.split(":");
80.137 + String typeName = typeParts[0];
80.138 + int offset = Integer.parseInt(typeParts[1]);
80.139 + boolean resolved = "1".equals(typeParts[2]);
80.140 + types.add(factory.newType(typeName, offset, resolved));
80.141 + }
80.142 + }
80.143 + }
80.144 + return types;
80.145 + }
80.146 + return Collections.emptyList();
80.147 + }
80.148 +
80.149 + public Map<String, String> getPathMappings(final String prefix) {
80.150 + Collection<? extends IndexResult> result = null;
80.151 +
80.152 + try {
80.153 + result = querySupport.query(RequireJsIndexer.FIELD_PATH_MAP, prefix, QuerySupport.Kind.PREFIX, RequireJsIndexer.FIELD_PATH_MAP);
80.154 + } catch (IOException ex) {
80.155 + Exceptions.printStackTrace(ex);
80.156 + }
80.157 + if (result != null && !result.isEmpty()) {
80.158 + Map<String, String> mappings = new HashMap<String, String>();
80.159 + for (IndexResult indexResult : result) {
80.160 + for(String value : indexResult.getValues(RequireJsIndexer.FIELD_PATH_MAP)) {
80.161 + String[] parts = value.split(";");
80.162 + if (parts.length == 2 && parts[0].startsWith(prefix)) {
80.163 + mappings.put(parts[0], parts[1]);
80.164 + }
80.165 + }
80.166 + }
80.167 + return mappings;
80.168 + }
80.169 + return Collections.emptyMap();
80.170 + }
80.171 +
80.172 + public Collection<String> getBasePaths() {
80.173 + Collection<? extends IndexResult> result = null;
80.174 +
80.175 + try {
80.176 + result = querySupport.query(RequireJsIndexer.FIELD_BASE_PATH, "", QuerySupport.Kind.PREFIX, RequireJsIndexer.FIELD_BASE_PATH);
80.177 + } catch (IOException ex) {
80.178 + Exceptions.printStackTrace(ex);
80.179 + }
80.180 + if (result != null && !result.isEmpty()) {
80.181 + List<String> paths = new ArrayList();
80.182 + for (IndexResult indexResult : result) {
80.183 + paths.addAll(Arrays.asList(indexResult.getValues(RequireJsIndexer.FIELD_BASE_PATH)));
80.184 + }
80.185 + return paths;
80.186 + }
80.187 + return Collections.emptyList();
80.188 + }
80.189 +}
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
81.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/index/RequireJsIndexer.java Mon Jun 02 14:23:34 2014 +0200
81.3 @@ -0,0 +1,253 @@
81.4 +/*
81.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
81.6 + *
81.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
81.8 + *
81.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
81.10 + * Other names may be trademarks of their respective owners.
81.11 + *
81.12 + * The contents of this file are subject to the terms of either the GNU
81.13 + * General Public License Version 2 only ("GPL") or the Common
81.14 + * Development and Distribution License("CDDL") (collectively, the
81.15 + * "License"). You may not use this file except in compliance with the
81.16 + * License. You can obtain a copy of the License at
81.17 + * http://www.netbeans.org/cddl-gplv2.html
81.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
81.19 + * specific language governing permissions and limitations under the
81.20 + * License. When distributing the software, include this License Header
81.21 + * Notice in each file and include the License file at
81.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
81.23 + * particular file as subject to the "Classpath" exception as provided
81.24 + * by Oracle in the GPL Version 2 section of the License file that
81.25 + * accompanied this code. If applicable, add the following below the
81.26 + * License Header, with the fields enclosed by brackets [] replaced by
81.27 + * your own identifying information:
81.28 + * "Portions Copyrighted [year] [name of copyright owner]"
81.29 + *
81.30 + * If you wish your version of this file to be governed by only the CDDL
81.31 + * or only the GPL Version 2, indicate your decision by adding
81.32 + * "[Contributor] elects to include this software in this distribution
81.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
81.34 + * single choice of license, a recipient has the option to distribute
81.35 + * your version of this file under either the CDDL, the GPL Version 2 or
81.36 + * to extend the choice of license to its licensees as provided above.
81.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
81.38 + * Version 2 license, then the option applies only if the new code is
81.39 + * made subject to such option by the copyright holder.
81.40 + *
81.41 + * Contributor(s):
81.42 + *
81.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
81.44 + */
81.45 +package org.netbeans.modules.javascript2.requirejs.editor.index;
81.46 +
81.47 +import java.io.IOException;
81.48 +import java.net.URI;
81.49 +import java.util.Collection;
81.50 +import java.util.HashMap;
81.51 +import java.util.LinkedList;
81.52 +import java.util.Map;
81.53 +import java.util.logging.Level;
81.54 +import java.util.logging.Logger;
81.55 +import org.netbeans.modules.javascript2.editor.api.lexer.JsTokenId;
81.56 +import org.netbeans.modules.javascript2.editor.model.TypeUsage;
81.57 +import org.netbeans.modules.parsing.api.Snapshot;
81.58 +import org.netbeans.modules.parsing.spi.Parser;
81.59 +import org.netbeans.modules.parsing.spi.indexing.Context;
81.60 +import org.netbeans.modules.parsing.spi.indexing.EmbeddingIndexer;
81.61 +import org.netbeans.modules.parsing.spi.indexing.EmbeddingIndexerFactory;
81.62 +import org.netbeans.modules.parsing.spi.indexing.Indexable;
81.63 +import org.netbeans.modules.parsing.spi.indexing.support.IndexDocument;
81.64 +import org.netbeans.modules.parsing.spi.indexing.support.IndexingSupport;
81.65 +import org.openide.filesystems.FileObject;
81.66 +import org.openide.util.Parameters;
81.67 +
81.68 +/**
81.69 + *
81.70 + * @author Petr Pisl
81.71 + */
81.72 +public class RequireJsIndexer extends EmbeddingIndexer {
81.73 +
81.74 + private static final Logger LOG = Logger.getLogger(RequireJsIndexer.class.getName());
81.75 +
81.76 + public static final String FIELD_EXPOSED_TYPES = "et"; //NOI18N
81.77 + public static final String FIELD_MODULE_NAME = "mn"; //NOI18N
81.78 + public static final String FIELD_PATH_MAP = "mp"; //NOI18N
81.79 + public static final String FIELD_BASE_PATH = "bp"; //NOI18N
81.80 +
81.81 + private static final ThreadLocal<Map<URI, Collection<? extends TypeUsage>>> exposedTypes = new ThreadLocal();
81.82 + private static final ThreadLocal<Map<URI, Map<String, String>>> pathsMapping = new ThreadLocal();
81.83 + private static final ThreadLocal<Map<URI, String>> basePath = new ThreadLocal();
81.84 +
81.85 + @Override
81.86 + protected void index(Indexable indexable, Parser.Result parserResult, Context context) {
81.87 + FileObject fo = parserResult.getSnapshot().getSource().getFileObject();
81.88 + if (fo == null) {
81.89 + return;
81.90 + }
81.91 +
81.92 + IndexingSupport support;
81.93 + try {
81.94 + support = IndexingSupport.getInstance(context);
81.95 + } catch (IOException ioe) {
81.96 + LOG.log(Level.WARNING, null, ioe);
81.97 + return;
81.98 + }
81.99 + IndexDocument elementDocument = support.createDocument(fo);
81.100 + boolean storeDocument = false;
81.101 + Map<URI, Collection<? extends TypeUsage>> types = exposedTypes.get();
81.102 + if (types != null && !types.isEmpty()) {
81.103 + Collection<? extends TypeUsage> resolvedTypes = types.remove(fo.toURI());
81.104 + if (resolvedTypes != null && !resolvedTypes.isEmpty()) {
81.105 + for (TypeUsage type : resolvedTypes) {
81.106 + StringBuilder sb = new StringBuilder();
81.107 + sb.append(type.getType()).append(":").append(type.getOffset()).append(":").append(type.isResolved() ? "1" : "0"); //NOI18N
81.108 + elementDocument.addPair(FIELD_EXPOSED_TYPES, sb.toString(), false, true);
81.109 + }
81.110 + storeDocument = true;
81.111 + elementDocument.addPair(FIELD_MODULE_NAME, fo.getName(), true, true);
81.112 + }
81.113 + }
81.114 +
81.115 + Map<URI, Map<String, String>> mappings = pathsMapping.get();
81.116 + if (mappings != null && !mappings.isEmpty()) {
81.117 + Map<String, String> pathMappings = mappings.remove(fo.toURI());
81.118 + if (pathMappings != null && !pathMappings.isEmpty()) {
81.119 + for (Map.Entry<String, String> entry : pathMappings.entrySet()) {
81.120 + StringBuilder sb = new StringBuilder();
81.121 + sb.append(entry.getKey()).append(";").append(entry.getValue()); //NOI18N
81.122 + elementDocument.addPair(FIELD_PATH_MAP, sb.toString(), true, true);
81.123 + }
81.124 + storeDocument = true;
81.125 + }
81.126 + }
81.127 +
81.128 + Map<URI, String>baseUrls = basePath.get();
81.129 + if (baseUrls != null && !baseUrls.isEmpty()) {
81.130 + String baseUrl = baseUrls.remove(fo.toURI());
81.131 + if (baseUrl != null && !baseUrl.isEmpty()) {
81.132 + elementDocument.addPair(FIELD_BASE_PATH, baseUrl, true, true);
81.133 + storeDocument = true;
81.134 + }
81.135 + }
81.136 + if (storeDocument) {
81.137 + support.addDocument(elementDocument);
81.138 + }
81.139 + }
81.140 +
81.141 + public static void addTypes(final URI uri, final Collection<? extends TypeUsage> exported) {
81.142 + final Map<URI, Collection<? extends TypeUsage>> map = exposedTypes.get();
81.143 +
81.144 + if (map == null) {
81.145 + throw new IllegalStateException("RequireJsIndexer.addTypes can be called only from scanner thread."); //NOI18N
81.146 + }
81.147 + map.put(uri, exported);
81.148 + }
81.149 +
81.150 + public static void addPathMapping(final URI uri, final Map<String, String> mappings) {
81.151 + final Map<URI, Map<String, String>> map = pathsMapping.get();
81.152 +
81.153 + if (map == null) {
81.154 + throw new IllegalStateException("RequireJsIndexer.addPathMapping can be called only from scanner thread."); //NOI18N
81.155 + }
81.156 + map.put(uri, mappings);
81.157 + }
81.158 +
81.159 + public static void addBasePath(final URI uri, String path) {
81.160 + final Map<URI, String> map = basePath.get();
81.161 +
81.162 + if (map == null) {
81.163 + throw new IllegalStateException("RequireJsIndexer.addBasePath can be called only from scanner thread."); //NOI18N
81.164 + }
81.165 + map.put(uri, path);
81.166 + }
81.167 +
81.168 + public static final class Factory extends EmbeddingIndexerFactory {
81.169 +
81.170 + public static final String NAME = "requirejs"; // NOI18N
81.171 + public static final int VERSION = 1;
81.172 + private static final int PRIORITY = 210;
81.173 +
81.174 + private static final ThreadLocal<Collection<Runnable>> postScanTasks = new ThreadLocal<Collection<Runnable>>();
81.175 +
81.176 + @Override
81.177 + public EmbeddingIndexer createIndexer(Indexable indexable, Snapshot snapshot) {
81.178 + if (isIndexable(indexable, snapshot)) {
81.179 + return new RequireJsIndexer();
81.180 + } else {
81.181 + return null;
81.182 + }
81.183 + }
81.184 +
81.185 + @Override
81.186 + public void filesDeleted(Iterable<? extends Indexable> deleted, Context context) {
81.187 + try {
81.188 + IndexingSupport is = IndexingSupport.getInstance(context);
81.189 + for (Indexable i : deleted) {
81.190 + is.removeDocuments(i);
81.191 + }
81.192 + } catch (IOException ioe) {
81.193 + LOG.log(Level.WARNING, null, ioe);
81.194 + }
81.195 + }
81.196 +
81.197 + @Override
81.198 + public void filesDirty(Iterable<? extends Indexable> dirty, Context context) {
81.199 +
81.200 + }
81.201 +
81.202 + @Override
81.203 + public String getIndexerName() {
81.204 + return NAME;
81.205 + }
81.206 +
81.207 + @Override
81.208 + public int getIndexVersion() {
81.209 + return VERSION;
81.210 + }
81.211 +
81.212 + private boolean isIndexable(Indexable indexable, Snapshot snapshot) {
81.213 + return JsTokenId.JAVASCRIPT_MIME_TYPE.equals(snapshot.getMimeType());
81.214 + }
81.215 +
81.216 + @Override
81.217 + public boolean scanStarted(Context context) {
81.218 + postScanTasks.set(new LinkedList<Runnable>());
81.219 + exposedTypes.set(new HashMap<URI, Collection<? extends TypeUsage>>());
81.220 + pathsMapping.set(new HashMap<URI, Map<String, String>>());
81.221 + basePath.set(new HashMap<URI, String>(1));
81.222 + return super.scanStarted(context);
81.223 + }
81.224 +
81.225 + @Override
81.226 + public void scanFinished(Context context) {
81.227 + try {
81.228 + for (Runnable task : postScanTasks.get()) {
81.229 + task.run();
81.230 + }
81.231 + } finally {
81.232 + postScanTasks.remove();
81.233 + super.scanFinished(context);
81.234 + }
81.235 + }
81.236 +
81.237 + public static boolean isScannerThread() {
81.238 + return postScanTasks.get() != null;
81.239 + }
81.240 +
81.241 + public static void addPostScanTask(final Runnable task) {
81.242 + Parameters.notNull("task", task); //NOI18N
81.243 + final Collection<Runnable> tasks = postScanTasks.get();
81.244 + if (tasks == null) {
81.245 + throw new IllegalStateException("JsIndexer.postScanTask can be called only from scanner thread."); //NOI18N
81.246 + }
81.247 + tasks.add(task);
81.248 + }
81.249 +
81.250 + @Override
81.251 + public int getPriority() {
81.252 + return PRIORITY;
81.253 + }
81.254 +
81.255 + }
81.256 +}
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
82.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/model/ConfigInterceptor.java Mon Jun 02 14:23:34 2014 +0200
82.3 @@ -0,0 +1,160 @@
82.4 +/*
82.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
82.6 + *
82.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
82.8 + *
82.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
82.10 + * Other names may be trademarks of their respective owners.
82.11 + *
82.12 + * The contents of this file are subject to the terms of either the GNU
82.13 + * General Public License Version 2 only ("GPL") or the Common
82.14 + * Development and Distribution License("CDDL") (collectively, the
82.15 + * "License"). You may not use this file except in compliance with the
82.16 + * License. You can obtain a copy of the License at
82.17 + * http://www.netbeans.org/cddl-gplv2.html
82.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
82.19 + * specific language governing permissions and limitations under the
82.20 + * License. When distributing the software, include this License Header
82.21 + * Notice in each file and include the License file at
82.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
82.23 + * particular file as subject to the "Classpath" exception as provided
82.24 + * by Oracle in the GPL Version 2 section of the License file that
82.25 + * accompanied this code. If applicable, add the following below the
82.26 + * License Header, with the fields enclosed by brackets [] replaced by
82.27 + * your own identifying information:
82.28 + * "Portions Copyrighted [year] [name of copyright owner]"
82.29 + *
82.30 + * If you wish your version of this file to be governed by only the CDDL
82.31 + * or only the GPL Version 2, indicate your decision by adding
82.32 + * "[Contributor] elects to include this software in this distribution
82.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
82.34 + * single choice of license, a recipient has the option to distribute
82.35 + * your version of this file under either the CDDL, the GPL Version 2 or
82.36 + * to extend the choice of license to its licensees as provided above.
82.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
82.38 + * Version 2 license, then the option applies only if the new code is
82.39 + * made subject to such option by the copyright holder.
82.40 + *
82.41 + * Contributor(s):
82.42 + *
82.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
82.44 + */
82.45 +package org.netbeans.modules.javascript2.requirejs.editor.model;
82.46 +
82.47 +import java.util.Arrays;
82.48 +import java.util.Collection;
82.49 +import java.util.HashMap;
82.50 +import java.util.Map;
82.51 +import java.util.regex.Pattern;
82.52 +import org.netbeans.api.lexer.Token;
82.53 +import org.netbeans.api.lexer.TokenHierarchy;
82.54 +import org.netbeans.api.lexer.TokenSequence;
82.55 +import org.netbeans.modules.javascript2.editor.api.lexer.JsTokenId;
82.56 +import org.netbeans.modules.javascript2.editor.api.lexer.LexUtilities;
82.57 +import org.netbeans.modules.javascript2.editor.model.DeclarationScope;
82.58 +import org.netbeans.modules.javascript2.editor.model.JsObject;
82.59 +import org.netbeans.modules.javascript2.editor.spi.model.FunctionArgument;
82.60 +import org.netbeans.modules.javascript2.editor.spi.model.FunctionInterceptor;
82.61 +import org.netbeans.modules.javascript2.editor.spi.model.ModelElementFactory;
82.62 +import org.netbeans.modules.javascript2.requirejs.editor.EditorUtils;
82.63 +import org.netbeans.modules.javascript2.requirejs.editor.index.RequireJsIndexer;
82.64 +import org.netbeans.modules.parsing.api.Source;
82.65 +import org.openide.filesystems.FileObject;
82.66 +
82.67 +/**
82.68 + *
82.69 + * @author Petr Pisl
82.70 + */
82.71 +@FunctionInterceptor.Registration(priority = 351)
82.72 +public class ConfigInterceptor implements FunctionInterceptor {
82.73 +
82.74 + private final static Pattern PATTERN = Pattern.compile("requirejs\\.config"); //NOI18N
82.75 +
82.76 + @Override
82.77 + public Pattern getNamePattern() {
82.78 + return PATTERN;
82.79 + }
82.80 +
82.81 + @Override
82.82 + public void intercept(String name, JsObject globalObject, DeclarationScope scope, ModelElementFactory factory, Collection<FunctionArgument> args) {
82.83 + if (!RequireJsIndexer.Factory.isScannerThread()) {
82.84 + return;
82.85 + }
82.86 + FunctionArgument fArg = null;
82.87 + for (FunctionArgument farg : args) {
82.88 + if (farg.getKind() == FunctionArgument.Kind.ANONYMOUS_OBJECT) {
82.89 + fArg = farg;
82.90 + break;
82.91 + }
82.92 + }
82.93 +
82.94 + if (fArg != null && fArg.getValue() instanceof JsObject) {
82.95 + // find paths property
82.96 + JsObject paths = ((JsObject) fArg.getValue()).getProperty(EditorUtils.PATHS);
82.97 + // find baseUrl property
82.98 + JsObject baseUrl = ((JsObject) fArg.getValue()).getProperty(EditorUtils.BASE_URL);
82.99 + if (paths != null || baseUrl != null) {
82.100 + FileObject fo = globalObject.getFileObject();
82.101 + if (fo == null) {
82.102 + return;
82.103 + }
82.104 + Source source = Source.create(fo);
82.105 + TokenHierarchy<?> th = source.createSnapshot().getTokenHierarchy();
82.106 + if (paths != null) {
82.107 + // find defined mappings
82.108 + TokenSequence<? extends JsTokenId> ts = LexUtilities.getJsTokenSequence(th, paths.getOffset());
82.109 + Token<? extends JsTokenId> token;
82.110 + if (ts == null) {
82.111 + return;
82.112 + }
82.113 + Map<String, String> mapping = new HashMap<String, String>();
82.114 + for (JsObject path : paths.getProperties().values()) {
82.115 + String alias = path.getName();
82.116 + String target = null;
82.117 + ts.move(path.getOffset());
82.118 + if (ts.moveNext()) {
82.119 + token = LexUtilities.findNextToken(ts, Arrays.asList(JsTokenId.OPERATOR_COLON));
82.120 + if (token.id() == JsTokenId.OPERATOR_COLON) {
82.121 + token = LexUtilities.findNext(ts, Arrays.asList(JsTokenId.WHITESPACE, JsTokenId.EOL, JsTokenId.BLOCK_COMMENT, JsTokenId.LINE_COMMENT,
82.122 + JsTokenId.STRING_BEGIN, JsTokenId.OPERATOR_COLON));
82.123 + if (token.id() == JsTokenId.STRING) {
82.124 + target = token.text().toString();
82.125 + }
82.126 + }
82.127 + }
82.128 + if (target != null) {
82.129 + mapping.put(alias, target);
82.130 + }
82.131 + }
82.132 + if (!mapping.isEmpty()) {
82.133 + RequireJsIndexer.addPathMapping(fo.toURI(), mapping);
82.134 + }
82.135 +
82.136 + if (baseUrl != null) {
82.137 + // find defined mappings
82.138 + ts = LexUtilities.getJsTokenSequence(th, baseUrl.getOffset());
82.139 + if (ts == null) {
82.140 + return;
82.141 + }
82.142 + ts.move(baseUrl.getOffset());
82.143 + String target = null;
82.144 + if (ts.moveNext()) {
82.145 + token = LexUtilities.findNextToken(ts, Arrays.asList(JsTokenId.OPERATOR_COLON));
82.146 + if (token.id() == JsTokenId.OPERATOR_COLON) {
82.147 + token = LexUtilities.findNext(ts, Arrays.asList(JsTokenId.WHITESPACE, JsTokenId.EOL, JsTokenId.BLOCK_COMMENT, JsTokenId.LINE_COMMENT,
82.148 + JsTokenId.STRING_BEGIN, JsTokenId.OPERATOR_COLON));
82.149 + if (token.id() == JsTokenId.STRING) {
82.150 + target = token.text().toString();
82.151 + }
82.152 + }
82.153 + }
82.154 + if (target != null) {
82.155 + RequireJsIndexer.addBasePath(fo.toURI(), target);
82.156 + }
82.157 + }
82.158 + }
82.159 + }
82.160 + }
82.161 + }
82.162 +
82.163 +}
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
83.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/model/DefineInterceptor.java Mon Jun 02 14:23:34 2014 +0200
83.3 @@ -0,0 +1,215 @@
83.4 +/*
83.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
83.6 + *
83.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
83.8 + *
83.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
83.10 + * Other names may be trademarks of their respective owners.
83.11 + *
83.12 + * The contents of this file are subject to the terms of either the GNU
83.13 + * General Public License Version 2 only ("GPL") or the Common
83.14 + * Development and Distribution License("CDDL") (collectively, the
83.15 + * "License"). You may not use this file except in compliance with the
83.16 + * License. You can obtain a copy of the License at
83.17 + * http://www.netbeans.org/cddl-gplv2.html
83.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
83.19 + * specific language governing permissions and limitations under the
83.20 + * License. When distributing the software, include this License Header
83.21 + * Notice in each file and include the License file at
83.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
83.23 + * particular file as subject to the "Classpath" exception as provided
83.24 + * by Oracle in the GPL Version 2 section of the License file that
83.25 + * accompanied this code. If applicable, add the following below the
83.26 + * License Header, with the fields enclosed by brackets [] replaced by
83.27 + * your own identifying information:
83.28 + * "Portions Copyrighted [year] [name of copyright owner]"
83.29 + *
83.30 + * If you wish your version of this file to be governed by only the CDDL
83.31 + * or only the GPL Version 2, indicate your decision by adding
83.32 + * "[Contributor] elects to include this software in this distribution
83.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
83.34 + * single choice of license, a recipient has the option to distribute
83.35 + * your version of this file under either the CDDL, the GPL Version 2 or
83.36 + * to extend the choice of license to its licensees as provided above.
83.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
83.38 + * Version 2 license, then the option applies only if the new code is
83.39 + * made subject to such option by the copyright holder.
83.40 + *
83.41 + * Contributor(s):
83.42 + *
83.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
83.44 + */
83.45 +package org.netbeans.modules.javascript2.requirejs.editor.model;
83.46 +
83.47 +import java.io.IOException;
83.48 +import java.util.ArrayList;
83.49 +import java.util.Arrays;
83.50 +import java.util.Collection;
83.51 +import java.util.Collections;
83.52 +import java.util.Iterator;
83.53 +import java.util.List;
83.54 +import java.util.regex.Pattern;
83.55 +import org.netbeans.api.lexer.Token;
83.56 +import org.netbeans.api.lexer.TokenSequence;
83.57 +import org.netbeans.api.project.FileOwnerQuery;
83.58 +import org.netbeans.api.project.Project;
83.59 +import org.netbeans.modules.javascript2.editor.api.lexer.JsTokenId;
83.60 +import org.netbeans.modules.javascript2.editor.api.lexer.LexUtilities;
83.61 +import org.netbeans.modules.javascript2.editor.model.DeclarationScope;
83.62 +import org.netbeans.modules.javascript2.editor.model.JsArray;
83.63 +import org.netbeans.modules.javascript2.editor.model.JsFunction;
83.64 +import org.netbeans.modules.javascript2.editor.model.JsObject;
83.65 +import org.netbeans.modules.javascript2.editor.model.TypeUsage;
83.66 +import org.netbeans.modules.javascript2.editor.spi.model.FunctionArgument;
83.67 +import org.netbeans.modules.javascript2.editor.spi.model.FunctionInterceptor;
83.68 +import org.netbeans.modules.javascript2.editor.spi.model.ModelElementFactory;
83.69 +import org.netbeans.modules.javascript2.requirejs.RequireJsPreferences;
83.70 +import org.netbeans.modules.javascript2.requirejs.editor.EditorUtils;
83.71 +import org.netbeans.modules.javascript2.requirejs.editor.FSCompletionUtils;
83.72 +import org.netbeans.modules.javascript2.requirejs.editor.index.RequireJsIndex;
83.73 +import org.netbeans.modules.javascript2.requirejs.editor.index.RequireJsIndexer;
83.74 +import org.netbeans.modules.parsing.api.Source;
83.75 +import org.openide.filesystems.FileObject;
83.76 +import org.openide.util.Exceptions;
83.77 +
83.78 +/**
83.79 + *
83.80 + * @author Petr Pisl
83.81 + */
83.82 +@FunctionInterceptor.Registration(priority = 350)
83.83 +public class DefineInterceptor implements FunctionInterceptor {
83.84 +
83.85 + private static final Pattern PATTERN = Pattern.compile("define|requirejs|require"); //NOI18N
83.86 + private static final String CODE_COMPLETION_THREAD_NAME = "Code Completion";
83.87 +
83.88 + @Override
83.89 + public Pattern getNamePattern() {
83.90 + return PATTERN;
83.91 + }
83.92 +
83.93 + @Override
83.94 + public void intercept(String name, JsObject globalObject, DeclarationScope scope, ModelElementFactory factory, Collection<FunctionArgument> args) {
83.95 + FunctionArgument fArg = null;
83.96 + FunctionArgument modules = null;
83.97 +
83.98 + for (Iterator<FunctionArgument> it = args.iterator(); it.hasNext();) {
83.99 + FunctionArgument arg = it.next();
83.100 + switch (arg.getKind()) {
83.101 + case ANONYMOUS_OBJECT:
83.102 + case REFERENCE:
83.103 + fArg = arg;
83.104 + break;
83.105 + case ARRAY:
83.106 + modules = arg;
83.107 + break;
83.108 + default:
83.109 + }
83.110 + }
83.111 +
83.112 + if (fArg != null) {
83.113 + FileObject fo = globalObject.getFileObject();
83.114 + if (fo == null) {
83.115 + // no action
83.116 + return;
83.117 + }
83.118 + if (fArg.getKind() == FunctionArgument.Kind.ANONYMOUS_OBJECT) {
83.119 + if (RequireJsIndexer.Factory.isScannerThread() && EditorUtils.DEFINE.equals(name)) {
83.120 + JsObject anonym = (JsObject)fArg.getValue();
83.121 + RequireJsIndexer.addTypes(fo.toURI(), Collections.singletonList(factory.newType(anonym.getFullyQualifiedName(), anonym.getOffset(), true)));
83.122 + }
83.123 + } else {
83.124 + List<String> fqn = (List<String>) fArg.getValue();
83.125 + JsObject posibleFunc = findJsObjectByName(globalObject, fqn);
83.126 +
83.127 + if (posibleFunc != null && posibleFunc instanceof JsFunction) {
83.128 + JsFunction defFunc = (JsFunction) posibleFunc;
83.129 + if (saveToIndex()) {
83.130 + if (EditorUtils.DEFINE.equals(name)) {
83.131 + // save to the index the return types
83.132 + Collection<? extends TypeUsage> returnTypes = defFunc.getReturnTypes();
83.133 + RequireJsIndexer.addTypes(fo.toURI(), returnTypes);
83.134 + }
83.135 + } else if (modules != null && modules.getValue() instanceof JsArray) {
83.136 + Project project = FileOwnerQuery.getOwner(fo);
83.137 + if (!RequireJsPreferences.getBoolean(project, RequireJsPreferences.ENABLED)) {
83.138 + return;
83.139 + }
83.140 + // add assignments for the parameters
83.141 + JsArray array = (JsArray) modules.getValue();
83.142 + Source source = Source.create(fo);
83.143 + List<String> paths = new ArrayList<String>();
83.144 + TokenSequence<? extends JsTokenId> ts = LexUtilities.getJsTokenSequence(source.createSnapshot().getTokenHierarchy(), array.getOffset());
83.145 + if (ts == null) {
83.146 + return;
83.147 + }
83.148 + ts.move(array.getOffset());
83.149 + if (ts.moveNext()) {
83.150 + Token<? extends JsTokenId> token = ts.token();
83.151 + int index = 0;
83.152 + while (ts.moveNext() && token.id() != JsTokenId.BRACKET_RIGHT_BRACKET) {
83.153 + token = LexUtilities.findNext(ts, Arrays.asList(JsTokenId.WHITESPACE, JsTokenId.EOL, JsTokenId.BLOCK_COMMENT, JsTokenId.LINE_COMMENT,
83.154 + JsTokenId.STRING_BEGIN, JsTokenId.STRING_END));
83.155 + if (token.id() == JsTokenId.STRING) {
83.156 + while (index > paths.size()) {
83.157 + paths.add("");
83.158 + }
83.159 + paths.add(token.text().toString());
83.160 + } else if (token.id() == JsTokenId.OPERATOR_COMMA) {
83.161 + index++;
83.162 + }
83.163 + }
83.164 + if (!paths.isEmpty()) {
83.165 + RequireJsIndex rIndex = null;
83.166 + try {
83.167 + rIndex = RequireJsIndex.get(project);
83.168 + } catch (IOException ex) {
83.169 + Exceptions.printStackTrace(ex);
83.170 + }
83.171 + if (rIndex != null) {
83.172 + Iterator<? extends JsObject> paramIterator = defFunc.getParameters().iterator();
83.173 + for (String module : paths) {
83.174 + FileObject fileObject = FSCompletionUtils.findMappedFileObject(module, fo);
83.175 + if (fileObject != null) {
83.176 + module = fileObject.getName();
83.177 + }
83.178 + Collection<? extends TypeUsage> exposedTypes = rIndex.getExposedTypes(module, factory);
83.179 + if (paramIterator.hasNext()) {
83.180 + JsObject param = paramIterator.next();
83.181 + for (TypeUsage typeUsage : exposedTypes) {
83.182 + param.addAssignment(typeUsage, -1);
83.183 + }
83.184 + }
83.185 + }
83.186 + }
83.187 + }
83.188 + }
83.189 + }
83.190 + }
83.191 + }
83.192 + }
83.193 + }
83.194 +
83.195 + private boolean saveToIndex() {
83.196 + return RequireJsIndexer.Factory.isScannerThread() && !CODE_COMPLETION_THREAD_NAME.equals(Thread.currentThread().getName());
83.197 + }
83.198 +
83.199 + public static JsObject findJsObjectByName(JsObject global, List<String> fqn) {
83.200 + JsObject result = global;
83.201 + JsObject property = result;
83.202 + for (Iterator<String> it = fqn.iterator(); it.hasNext();) {
83.203 + String token = it.next();
83.204 + property = result.getProperty(token);
83.205 + if (property == null) {
83.206 + result = (result instanceof JsFunction)
83.207 + ? ((JsFunction) result).getParameter(token)
83.208 + : null;
83.209 + if (result == null) {
83.210 + break;
83.211 + }
83.212 + } else {
83.213 + result = property;
83.214 + }
83.215 + }
83.216 + return result;
83.217 + }
83.218 +}
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
84.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/layer.xml Mon Jun 02 14:23:34 2014 +0200
84.3 @@ -0,0 +1,13 @@
84.4 +<?xml version="1.0" encoding="UTF-8"?>
84.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
84.6 +<filesystem>
84.7 + <folder name="Editors">
84.8 + <folder name="text">
84.9 + <folder name="javascript">
84.10 + <file name="org-netbeans-modules-javascript2-requirejs-editor-index-RequireJsIndexer$Factory.instance">
84.11 + <attr name="instanceOf" stringvalue="org.netbeans.modules.parsing.spi.indexing.EmbeddingIndexerFactory"/>
84.12 + </file>
84.13 + </folder>
84.14 + </folder>
84.15 + </folder>
84.16 +</filesystem>
85.1 Binary file javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/resources/requirejs.png has changed
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
86.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/ui/Bundle.properties Mon Jun 02 14:23:34 2014 +0200
86.3 @@ -0,0 +1,61 @@
86.4 +
86.5 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
86.6 +
86.7 +# Copyright 2010 Oracle and/or its affiliates. All rights reserved.
86.8 +
86.9 +# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
86.10 +# Other names may be trademarks of their respective owners.
86.11 +
86.12 +# The contents of this file are subject to the terms of either the GNU
86.13 +# General Public License Version 2 only ("GPL") or the Common
86.14 +# Development and Distribution License("CDDL") (collectively, the
86.15 +# "License"). You may not use this file except in compliance with the
86.16 +# License. You can obtain a copy of the License at
86.17 +# http://www.netbeans.org/cddl-gplv2.html
86.18 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
86.19 +# specific language governing permissions and limitations under the
86.20 +# License. When distributing the software, include this License Header
86.21 +# Notice in each file and include the License file at
86.22 +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
86.23 +# particular file as subject to the "Classpath" exception as provided
86.24 +# by Oracle in the GPL Version 2 section of the License file that
86.25 +# accompanied this code. If applicable, add the following below the
86.26 +# License Header, with the fields enclosed by brackets [] replaced by
86.27 +# your own identifying information:
86.28 +# "Portions Copyrighted [year] [name of copyright owner]"
86.29 +
86.30 +# If you wish your version of this file to be governed by only the CDDL
86.31 +# or only the GPL Version 2, indicate your decision by adding
86.32 +# "[Contributor] elects to include this software in this distribution
86.33 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
86.34 +# single choice of license, a recipient has the option to distribute
86.35 +# your version of this file under either the CDDL, the GPL Version 2 or
86.36 +# to extend the choice of license to its licensees as provided above.
86.37 +# However, if you add GPL Version 2 code and therefore, elected the GPL
86.38 +# Version 2 license, then the option applies only if the new code is
86.39 +# made subject to such option by the copyright holder.
86.40 +
86.41 +# Contributor(s):
86.42 +
86.43 +# Portions Copyrighted 2011 Sun Microsystems, Inc.
86.44 +
86.45 +# customizer panel
86.46 +RequireJsPanel.enabledCheckBox.text=&Enabled
86.47 +RequireJsPanel.enabledInfoLabel.text=Enable support for RequireJS in this project
86.48 +RequireJsPanel.pathMappingInfoLabel.text=Known use cases for Path Mapping and local files and folders
86.49 +RequireJsPanel.removePathMappingButton.text=&Remove
86.50 +RequireJsPanel.newPathMappingButton.text=&New
86.51 +RequireJsPanel.pathMappingLabel.text=Path &Mapping:
86.52 +
86.53 +LBL_Mapping=Mapping
86.54 +LBL_LocalPath=Local Path
86.55 +
86.56 +LocalPathCell.localPathBrowseButton.text=...
86.57 +LocalPathCell.AccessibleContext.accessibleName=Local Path Component
86.58 +LocalPathCell.AccessibleContext.accessibleDescription=Component representing a local path.
86.59 +LocalPathCell.localPathTextField.AccessibleContext.accessibleDescription=File path.
86.60 +LocalPathCell.localPathTextField.AccessibleContext.accessibleName=File Path
86.61 +LocalPathCell.localPathBrowseButton.AccessibleContext.accessibleDescription=Click to browse for local path.
86.62 +LocalPathCell.localPathBrowseButton.AccessibleContext.accessibleName=Browse Button
86.63 +
86.64 +
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
87.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/ui/LocalPathCell.form Mon Jun 02 14:23:34 2014 +0200
87.3 @@ -0,0 +1,89 @@
87.4 +<?xml version="1.0" encoding="UTF-8" ?>
87.5 +
87.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
87.7 + <Properties>
87.8 + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
87.9 + <Dimension value="[100, 0]"/>
87.10 + </Property>
87.11 + </Properties>
87.12 + <AccessibilityProperties>
87.13 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87.14 + <ResourceString bundle="org/netbeans/modules/php/project/ui/customizer/Bundle.properties" key="LocalPathCell.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
87.15 + </Property>
87.16 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87.17 + <ResourceString bundle="org/netbeans/modules/php/project/ui/customizer/Bundle.properties" key="LocalPathCell.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
87.18 + </Property>
87.19 + </AccessibilityProperties>
87.20 + <AuxValues>
87.21 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
87.22 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
87.23 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="false"/>
87.24 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
87.25 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
87.26 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
87.27 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
87.28 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
87.29 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
87.30 + </AuxValues>
87.31 +
87.32 + <Layout>
87.33 + <DimensionLayout dim="0">
87.34 + <Group type="103" groupAlignment="0" attributes="0">
87.35 + <Group type="102" alignment="0" attributes="0">
87.36 + <Component id="localPathTextField" max="32767" attributes="0"/>
87.37 + <EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
87.38 + <Component id="localPathBrowseButton" min="-2" max="-2" attributes="0"/>
87.39 + </Group>
87.40 + </Group>
87.41 + </DimensionLayout>
87.42 + <DimensionLayout dim="1">
87.43 + <Group type="103" groupAlignment="0" attributes="0">
87.44 + <Group type="103" groupAlignment="3" attributes="0">
87.45 + <Component id="localPathTextField" alignment="3" min="-2" max="-2" attributes="0"/>
87.46 + <Component id="localPathBrowseButton" alignment="3" min="-2" max="-2" attributes="0"/>
87.47 + </Group>
87.48 + </Group>
87.49 + </DimensionLayout>
87.50 + </Layout>
87.51 + <SubComponents>
87.52 + <Component class="javax.swing.JTextField" name="localPathTextField">
87.53 + <Properties>
87.54 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
87.55 + <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
87.56 + <EmptyBorder/>
87.57 + </Border>
87.58 + </Property>
87.59 + </Properties>
87.60 + <AccessibilityProperties>
87.61 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87.62 + <ResourceString bundle="org/netbeans/modules/php/project/ui/customizer/Bundle.properties" key="LocalPathCell.localPathTextField.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
87.63 + </Property>
87.64 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87.65 + <ResourceString bundle="org/netbeans/modules/php/project/ui/customizer/Bundle.properties" key="LocalPathCell.localPathTextField.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
87.66 + </Property>
87.67 + </AccessibilityProperties>
87.68 + </Component>
87.69 + <Component class="javax.swing.JButton" name="localPathBrowseButton">
87.70 + <Properties>
87.71 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87.72 + <ResourceString bundle="org/netbeans/modules/php/project/ui/customizer/Bundle.properties" key="LocalPathCell.localPathBrowseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
87.73 + </Property>
87.74 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
87.75 + <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
87.76 + <LineBorder>
87.77 + <Color PropertyName="color" blue="cc" green="b8" id="activeCaptionBorder" palette="3" red="a3" type="palette"/>
87.78 + </LineBorder>
87.79 + </Border>
87.80 + </Property>
87.81 + </Properties>
87.82 + <AccessibilityProperties>
87.83 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87.84 + <ResourceString bundle="org/netbeans/modules/php/project/ui/customizer/Bundle.properties" key="LocalPathCell.localPathBrowseButton.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
87.85 + </Property>
87.86 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87.87 + <ResourceString bundle="org/netbeans/modules/php/project/ui/customizer/Bundle.properties" key="LocalPathCell.localPathBrowseButton.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
87.88 + </Property>
87.89 + </AccessibilityProperties>
87.90 + </Component>
87.91 + </SubComponents>
87.92 +</Form>
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
88.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/ui/LocalPathCell.java Mon Jun 02 14:23:34 2014 +0200
88.3 @@ -0,0 +1,139 @@
88.4 +/*
88.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
88.6 + *
88.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
88.8 + *
88.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
88.10 + * Other names may be trademarks of their respective owners.
88.11 + *
88.12 + * The contents of this file are subject to the terms of either the GNU
88.13 + * General Public License Version 2 only ("GPL") or the Common
88.14 + * Development and Distribution License("CDDL") (collectively, the
88.15 + * "License"). You may not use this file except in compliance with the
88.16 + * License. You can obtain a copy of the License at
88.17 + * http://www.netbeans.org/cddl-gplv2.html
88.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
88.19 + * specific language governing permissions and limitations under the
88.20 + * License. When distributing the software, include this License Header
88.21 + * Notice in each file and include the License file at
88.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
88.23 + * particular file as subject to the "Classpath" exception as provided
88.24 + * by Oracle in the GPL Version 2 section of the License file that
88.25 + * accompanied this code. If applicable, add the following below the
88.26 + * License Header, with the fields enclosed by brackets [] replaced by
88.27 + * your own identifying information:
88.28 + * "Portions Copyrighted [year] [name of copyright owner]"
88.29 + *
88.30 + * If you wish your version of this file to be governed by only the CDDL
88.31 + * or only the GPL Version 2, indicate your decision by adding
88.32 + * "[Contributor] elects to include this software in this distribution
88.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
88.34 + * single choice of license, a recipient has the option to distribute
88.35 + * your version of this file under either the CDDL, the GPL Version 2 or
88.36 + * to extend the choice of license to its licensees as provided above.
88.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
88.38 + * Version 2 license, then the option applies only if the new code is
88.39 + * made subject to such option by the copyright holder.
88.40 + *
88.41 + * Contributor(s):
88.42 + *
88.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
88.44 + */
88.45 +
88.46 +package org.netbeans.modules.javascript2.requirejs.ui;
88.47 +
88.48 +import java.awt.Color;
88.49 +import java.awt.Dimension;
88.50 +import javax.swing.BorderFactory;
88.51 +import javax.swing.GroupLayout;
88.52 +import javax.swing.GroupLayout.Alignment;
88.53 +import javax.swing.JButton;
88.54 +import javax.swing.JPanel;
88.55 +import javax.swing.JTextField;
88.56 +import javax.swing.UIManager;
88.57 +import org.openide.util.NbBundle;
88.58 +
88.59 +public class LocalPathCell extends JPanel {
88.60 + private static final long serialVersionUID = -2414911804161573026L;
88.61 +
88.62 + LocalPathCell(String path) {
88.63 + assert path != null;
88.64 + initComponents();
88.65 + localPathTextField.setText(path);
88.66 + }
88.67 +
88.68 + String getPath() {
88.69 + return localPathTextField.getText();
88.70 + }
88.71 +
88.72 + void setPath(String path) {
88.73 + localPathTextField.setText(path);
88.74 + }
88.75 +
88.76 + JTextField getTextField() {
88.77 + return localPathTextField;
88.78 + }
88.79 +
88.80 + JButton getButton() {
88.81 + return localPathBrowseButton;
88.82 + }
88.83 +
88.84 + void setBgColor(Color color) {
88.85 + localPathTextField.setBackground(color);
88.86 + }
88.87 +
88.88 + void setFgColor(Color color) {
88.89 + localPathTextField.setForeground(color);
88.90 + }
88.91 +
88.92 + /** This method is called from within the constructor to
88.93 + * initialize the form.
88.94 + * WARNING: Do NOT modify this code. The content of this method is
88.95 + * always regenerated by the Form Editor.
88.96 + */
88.97 + @SuppressWarnings("unchecked")
88.98 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
88.99 + private void initComponents() {
88.100 +
88.101 + localPathTextField = new JTextField();
88.102 + localPathBrowseButton = new JButton();
88.103 +
88.104 + setMinimumSize(new Dimension(100, 0));
88.105 +
88.106 + localPathTextField.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
88.107 +
88.108 + localPathBrowseButton.setText(NbBundle.getMessage(LocalPathCell.class, "LocalPathCell.localPathBrowseButton.text")); // NOI18N
88.109 + localPathBrowseButton.setBorder(BorderFactory.createLineBorder(UIManager.getDefaults().getColor("activeCaptionBorder")));
88.110 +
88.111 + GroupLayout layout = new GroupLayout(this);
88.112 + this.setLayout(layout);
88.113 + layout.setHorizontalGroup(
88.114 + layout.createParallelGroup(Alignment.LEADING)
88.115 + .addGroup(layout.createSequentialGroup()
88.116 + .addComponent(localPathTextField)
88.117 + .addGap(0, 0, 0)
88.118 + .addComponent(localPathBrowseButton))
88.119 + );
88.120 + layout.setVerticalGroup(
88.121 + layout.createParallelGroup(Alignment.LEADING)
88.122 + .addGroup(layout.createParallelGroup(Alignment.BASELINE)
88.123 + .addComponent(localPathTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
88.124 + .addComponent(localPathBrowseButton))
88.125 + );
88.126 +
88.127 + localPathTextField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(LocalPathCell.class, "LocalPathCell.localPathTextField.AccessibleContext.accessibleName")); // NOI18N
88.128 + localPathTextField.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(LocalPathCell.class, "LocalPathCell.localPathTextField.AccessibleContext.accessibleDescription")); // NOI18N
88.129 + localPathBrowseButton.getAccessibleContext().setAccessibleName(NbBundle.getMessage(LocalPathCell.class, "LocalPathCell.localPathBrowseButton.AccessibleContext.accessibleName")); // NOI18N
88.130 + localPathBrowseButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(LocalPathCell.class, "LocalPathCell.localPathBrowseButton.AccessibleContext.accessibleDescription")); // NOI18N
88.131 +
88.132 + getAccessibleContext().setAccessibleName(NbBundle.getMessage(LocalPathCell.class, "LocalPathCell.AccessibleContext.accessibleName")); // NOI18N
88.133 + getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(LocalPathCell.class, "LocalPathCell.AccessibleContext.accessibleDescription")); // NOI18N
88.134 + }// </editor-fold>//GEN-END:initComponents
88.135 +
88.136 +
88.137 + // Variables declaration - do not modify//GEN-BEGIN:variables
88.138 + private JButton localPathBrowseButton;
88.139 + private JTextField localPathTextField;
88.140 + // End of variables declaration//GEN-END:variables
88.141 +
88.142 +}
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
89.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/ui/RequireJsCustomizer.java Mon Jun 02 14:23:34 2014 +0200
89.3 @@ -0,0 +1,94 @@
89.4 +/*
89.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
89.6 + *
89.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
89.8 + *
89.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
89.10 + * Other names may be trademarks of their respective owners.
89.11 + *
89.12 + * The contents of this file are subject to the terms of either the GNU
89.13 + * General Public License Version 2 only ("GPL") or the Common
89.14 + * Development and Distribution License("CDDL") (collectively, the
89.15 + * "License"). You may not use this file except in compliance with the
89.16 + * License. You can obtain a copy of the License at
89.17 + * http://www.netbeans.org/cddl-gplv2.html
89.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
89.19 + * specific language governing permissions and limitations under the
89.20 + * License. When distributing the software, include this License Header
89.21 + * Notice in each file and include the License file at
89.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
89.23 + * particular file as subject to the "Classpath" exception as provided
89.24 + * by Oracle in the GPL Version 2 section of the License file that
89.25 + * accompanied this code. If applicable, add the following below the
89.26 + * License Header, with the fields enclosed by brackets [] replaced by
89.27 + * your own identifying information:
89.28 + * "Portions Copyrighted [year] [name of copyright owner]"
89.29 + *
89.30 + * If you wish your version of this file to be governed by only the CDDL
89.31 + * or only the GPL Version 2, indicate your decision by adding
89.32 + * "[Contributor] elects to include this software in this distribution
89.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
89.34 + * single choice of license, a recipient has the option to distribute
89.35 + * your version of this file under either the CDDL, the GPL Version 2 or
89.36 + * to extend the choice of license to its licensees as provided above.
89.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
89.38 + * Version 2 license, then the option applies only if the new code is
89.39 + * made subject to such option by the copyright holder.
89.40 + *
89.41 + * Contributor(s):
89.42 + *
89.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
89.44 + */
89.45 +
89.46 +package org.netbeans.modules.javascript2.requirejs.ui;
89.47 +
89.48 +import javax.swing.JComponent;
89.49 +import org.netbeans.api.project.Project;
89.50 +import org.netbeans.modules.javascript2.editor.api.FrameworksUtils;
89.51 +import org.netbeans.spi.project.ui.support.ProjectCustomizer;
89.52 +import org.openide.util.Lookup;
89.53 +import org.openide.util.NbBundle;
89.54 +
89.55 +/**
89.56 + *
89.57 + * @author Petr Pisl
89.58 + */
89.59 +public class RequireJsCustomizer implements ProjectCustomizer.CompositeCategoryProvider {
89.60 +@ProjectCustomizer.CompositeCategoryProvider.Registrations({
89.61 + @ProjectCustomizer.CompositeCategoryProvider.Registration(
89.62 + projectType = FrameworksUtils.HTML5_CLIENT_PROJECT,
89.63 + category = FrameworksUtils.CATEGORY,
89.64 + position = 260
89.65 + ),
89.66 + @ProjectCustomizer.CompositeCategoryProvider.Registration(
89.67 + projectType = FrameworksUtils.PHP_PROJECT,
89.68 + category = FrameworksUtils.CATEGORY,
89.69 + position = 260
89.70 + ),
89.71 + @ProjectCustomizer.CompositeCategoryProvider.Registration(
89.72 + projectType = FrameworksUtils.MAVEN_PROJET,
89.73 + category = FrameworksUtils.CATEGORY,
89.74 + position = 260
89.75 + )
89.76 +})
89.77 +
89.78 + public static RequireJsCustomizer createCustomizer() {
89.79 + return new RequireJsCustomizer();
89.80 + }
89.81 +
89.82 + @NbBundle.Messages("RequireJsCustomizer.displayName=RequireJs")
89.83 + @Override
89.84 + public ProjectCustomizer.Category createCategory(Lookup context) {
89.85 + return ProjectCustomizer.Category.create(
89.86 + "requirejs", // NOI18N
89.87 + Bundle.RequireJsCustomizer_displayName(),
89.88 + null, (ProjectCustomizer.Category[]) null);
89.89 + }
89.90 +
89.91 + @Override
89.92 + public JComponent createComponent(ProjectCustomizer.Category category, Lookup context) {
89.93 + Project project = context.lookup(Project.class);
89.94 + return new RequireJsPanel(category, project);
89.95 + }
89.96 +
89.97 +}
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
90.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/ui/RequireJsPanel.form Mon Jun 02 14:23:34 2014 +0200
90.3 @@ -0,0 +1,133 @@
90.4 +<?xml version="1.0" encoding="UTF-8" ?>
90.5 +
90.6 +<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
90.7 + <AuxValues>
90.8 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
90.9 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
90.10 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
90.11 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
90.12 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
90.13 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
90.14 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
90.15 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
90.16 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
90.17 + </AuxValues>
90.18 +
90.19 + <Layout>
90.20 + <DimensionLayout dim="0">
90.21 + <Group type="103" groupAlignment="0" attributes="0">
90.22 + <Group type="102" attributes="0">
90.23 + <EmptySpace max="-2" attributes="0"/>
90.24 + <Group type="103" groupAlignment="0" attributes="0">
90.25 + <Component id="enabledCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
90.26 + <Component id="enabledInfoLabel" alignment="0" min="-2" max="-2" attributes="0"/>
90.27 + <Group type="102" alignment="1" attributes="0">
90.28 + <Component id="pathMappingScrollPane" pref="516" max="32767" attributes="0"/>
90.29 + <EmptySpace max="-2" attributes="0"/>
90.30 + <Group type="103" groupAlignment="0" max="-2" attributes="0">
90.31 + <Component id="removePathMappingButton" max="32767" attributes="0"/>
90.32 + <Component id="newPathMappingButton" max="32767" attributes="0"/>
90.33 + </Group>
90.34 + </Group>
90.35 + <Component id="pathMappingLabel" alignment="0" min="-2" max="-2" attributes="0"/>
90.36 + <Component id="pathMappingInfoLabel" alignment="0" min="-2" max="-2" attributes="0"/>
90.37 + </Group>
90.38 + <EmptySpace max="-2" attributes="0"/>
90.39 + </Group>
90.40 + </Group>
90.41 + </DimensionLayout>
90.42 + <DimensionLayout dim="1">
90.43 + <Group type="103" groupAlignment="0" attributes="0">
90.44 + <Group type="102" alignment="0" attributes="0">
90.45 + <EmptySpace max="-2" attributes="0"/>
90.46 + <Component id="enabledCheckBox" min="-2" max="-2" attributes="0"/>
90.47 + <EmptySpace max="-2" attributes="0"/>
90.48 + <Component id="enabledInfoLabel" min="-2" max="-2" attributes="0"/>
90.49 + <EmptySpace type="separate" max="-2" attributes="0"/>
90.50 + <Component id="pathMappingLabel" min="-2" max="-2" attributes="0"/>
90.51 + <EmptySpace min="-2" max="-2" attributes="0"/>
90.52 + <Group type="103" groupAlignment="0" attributes="0">
90.53 + <Group type="102" attributes="0">
90.54 + <Component id="newPathMappingButton" min="-2" max="-2" attributes="0"/>
90.55 + <EmptySpace max="-2" attributes="0"/>
90.56 + <Component id="removePathMappingButton" min="-2" max="-2" attributes="0"/>
90.57 + <EmptySpace min="0" pref="167" max="32767" attributes="0"/>
90.58 + </Group>
90.59 + <Component id="pathMappingScrollPane" pref="0" max="32767" attributes="0"/>
90.60 + </Group>
90.61 + <EmptySpace max="-2" attributes="0"/>
90.62 + <Component id="pathMappingInfoLabel" min="-2" max="-2" attributes="0"/>
90.63 + <EmptySpace min="-2" pref="155" max="-2" attributes="0"/>
90.64 + </Group>
90.65 + </Group>
90.66 + </DimensionLayout>
90.67 + </Layout>
90.68 + <SubComponents>
90.69 + <Component class="javax.swing.JCheckBox" name="enabledCheckBox">
90.70 + <Properties>
90.71 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
90.72 + <ResourceString bundle="org/netbeans/modules/javascript2/requirejs/ui/Bundle.properties" key="RequireJsPanel.enabledCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
90.73 + </Property>
90.74 + </Properties>
90.75 + </Component>
90.76 + <Component class="javax.swing.JLabel" name="enabledInfoLabel">
90.77 + <Properties>
90.78 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
90.79 + <ResourceString bundle="org/netbeans/modules/javascript2/requirejs/ui/Bundle.properties" key="RequireJsPanel.enabledInfoLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
90.80 + </Property>
90.81 + </Properties>
90.82 + </Component>
90.83 + <Component class="javax.swing.JLabel" name="pathMappingLabel">
90.84 + <Properties>
90.85 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
90.86 + <ResourceString bundle="org/netbeans/modules/javascript2/requirejs/ui/Bundle.properties" key="RequireJsPanel.pathMappingLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
90.87 + </Property>
90.88 + </Properties>
90.89 + </Component>
90.90 + <Container class="javax.swing.JScrollPane" name="pathMappingScrollPane">
90.91 + <AuxValues>
90.92 + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
90.93 + </AuxValues>
90.94 +
90.95 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
90.96 + <SubComponents>
90.97 + <Component class="javax.swing.JTable" name="pathMappingTable">
90.98 + <Properties>
90.99 + <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
90.100 + <Table columnCount="0" rowCount="0"/>
90.101 + </Property>
90.102 + </Properties>
90.103 + </Component>
90.104 + </SubComponents>
90.105 + </Container>
90.106 + <Component class="javax.swing.JButton" name="newPathMappingButton">
90.107 + <Properties>
90.108 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
90.109 + <ResourceString bundle="org/netbeans/modules/javascript2/requirejs/ui/Bundle.properties" key="RequireJsPanel.newPathMappingButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
90.110 + </Property>
90.111 + <Property name="enabled" type="boolean" value="false"/>
90.112 + </Properties>
90.113 + <Events>
90.114 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newPathMappingButtonActionPerformed"/>
90.115 + </Events>
90.116 + </Component>
90.117 + <Component class="javax.swing.JButton" name="removePathMappingButton">
90.118 + <Properties>
90.119 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
90.120 + <ResourceString bundle="org/netbeans/modules/javascript2/requirejs/ui/Bundle.properties" key="RequireJsPanel.removePathMappingButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
90.121 + </Property>
90.122 + <Property name="enabled" type="boolean" value="false"/>
90.123 + </Properties>
90.124 + <Events>
90.125 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removePathMappingButtonActionPerformed"/>
90.126 + </Events>
90.127 + </Component>
90.128 + <Component class="javax.swing.JLabel" name="pathMappingInfoLabel">
90.129 + <Properties>
90.130 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
90.131 + <ResourceString bundle="org/netbeans/modules/javascript2/requirejs/ui/Bundle.properties" key="RequireJsPanel.pathMappingInfoLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
90.132 + </Property>
90.133 + </Properties>
90.134 + </Component>
90.135 + </SubComponents>
90.136 +</Form>
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
91.2 +++ b/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/ui/RequireJsPanel.java Mon Jun 02 14:23:34 2014 +0200
91.3 @@ -0,0 +1,421 @@
91.4 +/*
91.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
91.6 + *
91.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
91.8 + *
91.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
91.10 + * Other names may be trademarks of their respective owners.
91.11 + *
91.12 + * The contents of this file are subject to the terms of either the GNU
91.13 + * General Public License Version 2 only ("GPL") or the Common
91.14 + * Development and Distribution License("CDDL") (collectively, the
91.15 + * "License"). You may not use this file except in compliance with the
91.16 + * License. You can obtain a copy of the License at
91.17 + * http://www.netbeans.org/cddl-gplv2.html
91.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
91.19 + * specific language governing permissions and limitations under the
91.20 + * License. When distributing the software, include this License Header
91.21 + * Notice in each file and include the License file at
91.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
91.23 + * particular file as subject to the "Classpath" exception as provided
91.24 + * by Oracle in the GPL Version 2 section of the License file that
91.25 + * accompanied this code. If applicable, add the following below the
91.26 + * License Header, with the fields enclosed by brackets [] replaced by
91.27 + * your own identifying information:
91.28 + * "Portions Copyrighted [year] [name of copyright owner]"
91.29 + *
91.30 + * If you wish your version of this file to be governed by only the CDDL
91.31 + * or only the GPL Version 2, indicate your decision by adding
91.32 + * "[Contributor] elects to include this software in this distribution
91.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
91.34 + * single choice of license, a recipient has the option to distribute
91.35 + * your version of this file under either the CDDL, the GPL Version 2 or
91.36 + * to extend the choice of license to its licensees as provided above.
91.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
91.38 + * Version 2 license, then the option applies only if the new code is
91.39 + * made subject to such option by the copyright holder.
91.40 + *
91.41 + * Contributor(s):
91.42 + *
91.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
91.44 + */
91.45 +package org.netbeans.modules.javascript2.requirejs.ui;
91.46 +
91.47 +import org.netbeans.modules.javascript2.requirejs.StringUtils;
91.48 +import java.awt.Component;
91.49 +import java.awt.Point;
91.50 +import java.awt.Rectangle;
91.51 +import java.awt.event.ActionEvent;
91.52 +import java.awt.event.ActionListener;
91.53 +import java.awt.event.MouseAdapter;
91.54 +import java.awt.event.MouseEvent;
91.55 +import java.io.File;
91.56 +import java.util.TreeMap;
91.57 +import java.util.Map;
91.58 +import javax.swing.JButton;
91.59 +import javax.swing.JPanel;
91.60 +import javax.swing.JTable;
91.61 +import javax.swing.event.ListSelectionEvent;
91.62 +import javax.swing.event.ListSelectionListener;
91.63 +import javax.swing.event.TableModelEvent;
91.64 +import javax.swing.event.TableModelListener;
91.65 +import javax.swing.table.DefaultTableModel;
91.66 +import javax.swing.table.TableCellRenderer;
91.67 +import org.netbeans.api.project.Project;
91.68 +import org.netbeans.modules.javascript2.requirejs.RequireJsPreferences;
91.69 +import org.netbeans.spi.project.ui.support.ProjectCustomizer;
91.70 +import org.openide.filesystems.FileChooserBuilder;
91.71 +import org.openide.filesystems.FileObject;
91.72 +import org.openide.filesystems.FileUtil;
91.73 +import org.openide.util.HelpCtx;
91.74 +import org.openide.util.NbBundle;
91.75 +
91.76 +/**
91.77 + *
91.78 + * @author Petr Pisl
91.79 + */
91.80 +final class RequireJsPanel extends JPanel implements HelpCtx.Provider {
91.81 +
91.82 + static final String DEFAULT_LOCAL_PATH = ""; // NOI18N
91.83 + static final int COLUMN_MAPPING_PATH = 0;
91.84 + static final int COLUMN_LOCAL_PATH = 1;
91.85 +
91.86 + private final Project project;
91.87 + private final ProjectCustomizer.Category category;
91.88 + private final PathMappingTableModel pathMappingTableModel;
91.89 +
91.90 + /**
91.91 + * Creates new form RequireJsPanel
91.92 + */
91.93 + public RequireJsPanel(ProjectCustomizer.Category category, Project project) {
91.94 + this.project = project;
91.95 + this.category = category;
91.96 +
91.97 + this.category.setStoreListener(new ActionListener() {
91.98 + @Override
91.99 + public void actionPerformed(ActionEvent e) {
91.100 + saveData();
91.101 + }
91.102 + });
91.103 +
91.104 + initComponents();
91.105 + String[] columnNames = {
91.106 + NbBundle.getMessage(RequireJsPanel.class, "LBL_Mapping"),
91.107 + NbBundle.getMessage(RequireJsPanel.class, "LBL_LocalPath"),};
91.108 + pathMappingTableModel = new PathMappingTableModel(columnNames, getPathMappingsData());
91.109 + init();
91.110 + }
91.111 +
91.112 + public boolean isSupportEnabled() {
91.113 + return enabledCheckBox.isSelected();
91.114 + }
91.115 +
91.116 + public void setSupportEnabled(boolean enabled) {
91.117 + enabledCheckBox.setSelected(enabled);
91.118 + }
91.119 +
91.120 + private void init() {
91.121 + setSupportEnabled(RequireJsPreferences.getBoolean(project, RequireJsPreferences.ENABLED));
91.122 +
91.123 + pathMappingTable.setModel(pathMappingTableModel);
91.124 + pathMappingTable.setDefaultRenderer(LocalPathCell.class, new LocalPathCellRenderer());
91.125 + pathMappingTable.addMouseListener(new LocalPathCellMouseListener(pathMappingTable));
91.126 + pathMappingTableModel.addTableModelListener(new TableModelListener() {
91.127 + @Override
91.128 + public void tableChanged(TableModelEvent e) {
91.129 + handleButtonStates();
91.130 +// validateFields();
91.131 + }
91.132 + });
91.133 + pathMappingTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
91.134 + @Override
91.135 + public void valueChanged(ListSelectionEvent e) {
91.136 + handleButtonStates();
91.137 + }
91.138 + });
91.139 + }
91.140 +
91.141 + private void saveData() {
91.142 + RequireJsPreferences.putBoolean(project, RequireJsPreferences.ENABLED, isSupportEnabled());
91.143 + RequireJsPreferences.storeMappings(project, getPathMappings());
91.144 + }
91.145 +
91.146 + void handleButtonStates() {
91.147 + removePathMappingButton.setEnabled(isTableRowSelected());
91.148 + newPathMappingButton.setEnabled(pathMappingTableModel.isLastServerPathFilled());
91.149 + }
91.150 +
91.151 + private boolean isTableRowSelected() {
91.152 + return getTableSelectedRow() != -1;
91.153 + }
91.154 +
91.155 + /**
91.156 + * This method is called from within the constructor to initialize the form.
91.157 + * WARNING: Do NOT modify this code. The content of this method is always
91.158 + * regenerated by the Form Editor.
91.159 + */
91.160 + @SuppressWarnings("unchecked")
91.161 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
91.162 + private void initComponents() {
91.163 +
91.164 + enabledCheckBox = new javax.swing.JCheckBox();
91.165 + enabledInfoLabel = new javax.swing.JLabel();
91.166 + pathMappingLabel = new javax.swing.JLabel();
91.167 + pathMappingScrollPane = new javax.swing.JScrollPane();
91.168 + pathMappingTable = new javax.swing.JTable();
91.169 + newPathMappingButton = new javax.swing.JButton();
91.170 + removePathMappingButton = new javax.swing.JButton();
91.171 + pathMappingInfoLabel = new javax.swing.JLabel();
91.172 +
91.173 + org.openide.awt.Mnemonics.setLocalizedText(enabledCheckBox, org.openide.util.NbBundle.getMessage(RequireJsPanel.class, "RequireJsPanel.enabledCheckBox.text")); // NOI18N
91.174 +
91.175 + org.openide.awt.Mnemonics.setLocalizedText(enabledInfoLabel, org.openide.util.NbBundle.getMessage(RequireJsPanel.class, "RequireJsPanel.enabledInfoLabel.text")); // NOI18N
91.176 +
91.177 + org.openide.awt.Mnemonics.setLocalizedText(pathMappingLabel, org.openide.util.NbBundle.getMessage(RequireJsPanel.class, "RequireJsPanel.pathMappingLabel.text")); // NOI18N
91.178 +
91.179 + pathMappingTable.setModel(new javax.swing.table.DefaultTableModel(
91.180 + new Object [][] {
91.181 +
91.182 + },
91.183 + new String [] {
91.184 +
91.185 + }
91.186 + ));
91.187 + pathMappingScrollPane.setViewportView(pathMappingTable);
91.188 +
91.189 + org.openide.awt.Mnemonics.setLocalizedText(newPathMappingButton, org.openide.util.NbBundle.getMessage(RequireJsPanel.class, "RequireJsPanel.newPathMappingButton.text")); // NOI18N
91.190 + newPathMappingButton.setEnabled(false);
91.191 + newPathMappingButton.addActionListener(new java.awt.event.ActionListener() {
91.192 + public void actionPerformed(java.awt.event.ActionEvent evt) {
91.193 + newPathMappingButtonActionPerformed(evt);
91.194 + }
91.195 + });
91.196 +
91.197 + org.openide.awt.Mnemonics.setLocalizedText(removePathMappingButton, org.openide.util.NbBundle.getMessage(RequireJsPanel.class, "RequireJsPanel.removePathMappingButton.text")); // NOI18N
91.198 + removePathMappingButton.setEnabled(false);
91.199 + removePathMappingButton.addActionListener(new java.awt.event.ActionListener() {
91.200 + public void actionPerformed(java.awt.event.ActionEvent evt) {
91.201 + removePathMappingButtonActionPerformed(evt);
91.202 + }
91.203 + });
91.204 +
91.205 + org.openide.awt.Mnemonics.setLocalizedText(pathMappingInfoLabel, org.openide.util.NbBundle.getMessage(RequireJsPanel.class, "RequireJsPanel.pathMappingInfoLabel.text")); // NOI18N
91.206 +
91.207 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
91.208 + this.setLayout(layout);
91.209 + layout.setHorizontalGroup(
91.210 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
91.211 + .addGroup(layout.createSequentialGroup()
91.212 + .addContainerGap()
91.213 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
91.214 + .addComponent(enabledCheckBox)
91.215 + .addComponent(enabledInfoLabel)
91.216 + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
91.217 + .addComponent(pathMappingScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 516, Short.MAX_VALUE)
91.218 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
91.219 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
91.220 + .addComponent(removePathMappingButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
91.221 + .addComponent(newPathMappingButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
91.222 + .addComponent(pathMappingLabel)
91.223 + .addComponent(pathMappingInfoLabel))
91.224 + .addContainerGap())
91.225 + );
91.226 + layout.setVerticalGroup(
91.227 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
91.228 + .addGroup(layout.createSequentialGroup()
91.229 + .addContainerGap()
91.230 + .addComponent(enabledCheckBox)
91.231 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
91.232 + .addComponent(enabledInfoLabel)
91.233 + .addGap(18, 18, 18)
91.234 + .addComponent(pathMappingLabel)
91.235 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
91.236 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
91.237 + .addGroup(layout.createSequentialGroup()
91.238 + .addComponent(newPathMappingButton)
91.239 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
91.240 + .addComponent(removePathMappingButton)
91.241 + .addGap(0, 167, Short.MAX_VALUE))
91.242 + .addComponent(pathMappingScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
91.243 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
91.244 + .addComponent(pathMappingInfoLabel)
91.245 + .addGap(155, 155, 155))
91.246 + );
91.247 + }// </editor-fold>//GEN-END:initComponents
91.248 +
91.249 + private void newPathMappingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newPathMappingButtonActionPerformed
91.250 + pathMappingTableModel.addRow(new Object[]{null, new LocalPathCell(DEFAULT_LOCAL_PATH)});
91.251 + }//GEN-LAST:event_newPathMappingButtonActionPerformed
91.252 +
91.253 + private void removePathMappingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removePathMappingButtonActionPerformed
91.254 + assert getTableSelectedRow() != -1 : "A table row must be selected";
91.255 + while (getTableSelectedRow() != -1) {
91.256 + pathMappingTableModel.removeRow(getTableSelectedRow());
91.257 + }
91.258 + if (pathMappingTableModel.getRowCount() == 0) {
91.259 + newPathMappingButtonActionPerformed(null);
91.260 + }
91.261 + }//GEN-LAST:event_removePathMappingButtonActionPerformed
91.262 +
91.263 + private int getTableSelectedRow() {
91.264 + return pathMappingTable.getSelectedRow();
91.265 + }
91.266 +
91.267 + private Object[][] getPathMappingsData() {
91.268 + Map<String, String> mappings = RequireJsPreferences.getMappings(project);
91.269 + int mappingSize = mappings.size();
91.270 + Object[][] paths = new Object[mappingSize + 1][2];
91.271 + int index = 0;
91.272 + for (Map.Entry<String, String> mapping : mappings.entrySet()) {
91.273 + paths[index][COLUMN_MAPPING_PATH] = mapping.getKey();
91.274 + paths[index][COLUMN_LOCAL_PATH] = new LocalPathCell(mapping.getValue());
91.275 + index++;
91.276 + }
91.277 + paths[mappingSize][COLUMN_MAPPING_PATH] = null;
91.278 + paths[mappingSize][COLUMN_LOCAL_PATH] = new LocalPathCell(DEFAULT_LOCAL_PATH);
91.279 + return paths;
91.280 + }
91.281 +
91.282 + private Map<String, String> getPathMappings() {
91.283 + Map<String, String> mappings = new TreeMap();
91.284 + for (int i = 0; i < pathMappingTableModel.getRowCount(); ++i) {
91.285 + String mapping = (String) pathMappingTableModel.getValueAt(i, COLUMN_MAPPING_PATH);
91.286 + String localPath = ((LocalPathCell) pathMappingTableModel.getValueAt(i, COLUMN_LOCAL_PATH)).getPath();
91.287 + if (mapping != null && !mapping.isEmpty() && localPath != null && !localPath.isEmpty()) {
91.288 + mappings.put(mapping, localPath);
91.289 + }
91.290 + }
91.291 + return mappings;
91.292 + }
91.293 +
91.294 + private static final class PathMappingTableModel extends DefaultTableModel {
91.295 +
91.296 + private static final long serialVersionUID = 169356031075115831L;
91.297 +
91.298 + public PathMappingTableModel(String[] columnNames, Object[][] data) {
91.299 + super(data, columnNames);
91.300 + }
91.301 +
91.302 + public boolean isLastServerPathFilled() {
91.303 + int rowCount = getRowCount();
91.304 + if (rowCount == 0) {
91.305 + return true;
91.306 + }
91.307 + return StringUtils.hasText((String) getValueAt(rowCount - 1, COLUMN_MAPPING_PATH));
91.308 + }
91.309 +
91.310 + @Override
91.311 + public Class<?> getColumnClass(int columnIndex) {
91.312 + if (columnIndex == COLUMN_LOCAL_PATH) {
91.313 + return LocalPathCell.class;
91.314 + } else if (columnIndex == COLUMN_MAPPING_PATH) {
91.315 + return String.class;
91.316 + }
91.317 + throw new IllegalStateException("Unhandled column index: " + columnIndex);
91.318 + }
91.319 + }
91.320 +
91.321 + private static final class LocalPathCellRenderer implements TableCellRenderer {
91.322 +
91.323 + @Override
91.324 + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
91.325 + LocalPathCell localPathCell = (LocalPathCell) value;
91.326 + // #164688 - sorry, no idea how this can happen
91.327 + if (localPathCell == null) {
91.328 + localPathCell = new LocalPathCell(DEFAULT_LOCAL_PATH);
91.329 + }
91.330 + if (isSelected) {
91.331 + localPathCell.setBgColor(table.getSelectionBackground());
91.332 + localPathCell.setFgColor(table.getSelectionForeground());
91.333 + } else {
91.334 + localPathCell.setBgColor(table.getBackground());
91.335 + localPathCell.setFgColor(table.getForeground());
91.336 + }
91.337 +
91.338 + return localPathCell;
91.339 + }
91.340 + }
91.341 +
91.342 + private String findRelativePath(FileObject from, FileObject to) {
91.343 + String path = FileUtil.getRelativePath(from, to);
91.344 + StringBuilder result = new StringBuilder();
91.345 + FileObject parent = from.getParent();
91.346 + while (path == null && parent != null) {
91.347 + result.append("../");
91.348 + path = FileUtil.getRelativePath(parent, to);
91.349 + parent = parent.getParent();
91.350 + }
91.351 + if (path != null) {
91.352 + result.append(path);
91.353 + } else {
91.354 + result.append(to.getPath());
91.355 + }
91.356 + return result.toString();
91.357 + }
91.358 +
91.359 + private final class LocalPathCellMouseListener extends MouseAdapter {
91.360 +
91.361 + private final JTable table;
91.362 +
91.363 + public LocalPathCellMouseListener(JTable table) {
91.364 + this.table = table;
91.365 + }
91.366 +
91.367 + @Override
91.368 + public void mouseClicked(MouseEvent e) {
91.369 + Point p = new Point(e.getX(), e.getY());
91.370 + int row = table.rowAtPoint(p);
91.371 + int col = table.columnAtPoint(p);
91.372 + Object value = table.getValueAt(row, col);
91.373 + if (value instanceof LocalPathCell) {
91.374 + Rectangle cellRect = table.getCellRect(row, col, false);
91.375 + LocalPathCell localPathCell = (LocalPathCell) value;
91.376 + JButton button = localPathCell.getButton();
91.377 + if (e.getX() > (cellRect.x + cellRect.width - button.getWidth())) {
91.378 + //inside changeButton
91.379 + FileObject projectDirectory = project.getProjectDirectory();
91.380 + File newLocation = browseAction(".",
91.381 + "Select somethings", false, FileUtil.toFile(projectDirectory));
91.382 + if (newLocation != null) {
91.383 + localPathCell.setPath(findRelativePath(projectDirectory, FileUtil.toFileObject(newLocation)));
91.384 + }
91.385 +// validateFields();
91.386 + }
91.387 + }
91.388 + }
91.389 +
91.390 + private File browseAction(String dirKey, String title, boolean filesOnly, File workDir) {
91.391 + FileChooserBuilder builder = new FileChooserBuilder(dirKey)
91.392 + .setTitle(title);
91.393 + if (workDir != null) {
91.394 + builder.setDefaultWorkingDirectory(workDir)
91.395 + .forceUseOfDefaultWorkingDirectory(true);
91.396 + }
91.397 + if (filesOnly) {
91.398 + builder.setFilesOnly(true);
91.399 + }
91.400 + File selectedFile = builder.showOpenDialog();
91.401 + if (selectedFile != null) {
91.402 + return FileUtil.normalizeFile(selectedFile);
91.403 + }
91.404 + return null;
91.405 + }
91.406 +
91.407 + }
91.408 +
91.409 + // Variables declaration - do not modify//GEN-BEGIN:variables
91.410 + private javax.swing.JCheckBox enabledCheckBox;
91.411 + private javax.swing.JLabel enabledInfoLabel;
91.412 + private javax.swing.JButton newPathMappingButton;
91.413 + private javax.swing.JLabel pathMappingInfoLabel;
91.414 + private javax.swing.JLabel pathMappingLabel;
91.415 + private javax.swing.JScrollPane pathMappingScrollPane;
91.416 + private javax.swing.JTable pathMappingTable;
91.417 + private javax.swing.JButton removePathMappingButton;
91.418 + // End of variables declaration//GEN-END:variables
91.419 +
91.420 + @Override
91.421 + public HelpCtx getHelpCtx() {
91.422 + return null;
91.423 + }
91.424 +}
92.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
92.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/folder1/module2.js Mon Jun 02 14:23:34 2014 +0200
92.3 @@ -0,0 +1,1 @@
92.4 +// empty file
93.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
93.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/folder1/module3.js Mon Jun 02 14:23:34 2014 +0200
93.3 @@ -0,0 +1,1 @@
93.4 +// empty file
94.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
94.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/folder2/module4.js Mon Jun 02 14:23:34 2014 +0200
94.3 @@ -0,0 +1,1 @@
94.4 +// empty file
94.5 \ No newline at end of file
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
95.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/main3.js Mon Jun 02 14:23:34 2014 +0200
95.3 @@ -0,0 +1,2 @@
95.4 +requirejs(['']);
95.5 +
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
96.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/main3.js.testFSCompletion04.expected.js Mon Jun 02 14:23:34 2014 +0200
96.3 @@ -0,0 +1,2 @@
96.4 +requirejs(['folder1/']);
96.5 +
97.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
97.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/main4.js Mon Jun 02 14:23:34 2014 +0200
97.3 @@ -0,0 +1,1 @@
97.4 +requirejs(['fold']);
98.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
98.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/main4.js.testFSCompletion05.expected.js Mon Jun 02 14:23:34 2014 +0200
98.3 @@ -0,0 +1,1 @@
98.4 +requirejs(['folder1/']);
99.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
99.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/main5.js Mon Jun 02 14:23:34 2014 +0200
99.3 @@ -0,0 +1,1 @@
99.4 +requirejs(['folder1/']);
100.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
100.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/main5.js.testFSCompletion06.expected.js Mon Jun 02 14:23:34 2014 +0200
100.3 @@ -0,0 +1,1 @@
100.4 +requirejs(['folder1/module2']);
101.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
101.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/main6.js Mon Jun 02 14:23:34 2014 +0200
101.3 @@ -0,0 +1,1 @@
101.4 +requirejs(['folder1/mo']);
101.5 \ No newline at end of file
102.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
102.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/fileCC/main6.js.testFSCompletion07.expected.js Mon Jun 02 14:23:34 2014 +0200
102.3 @@ -0,0 +1,1 @@
102.4 +requirejs(['folder1/module2']);
102.5 \ No newline at end of file
103.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
103.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/api/utils.js Mon Jun 02 14:23:34 2014 +0200
103.3 @@ -0,0 +1,9 @@
103.4 +define([
103.5 + '../../folder1/module1'
103.6 +],
103.7 + function (module1) {
103.8 + return {
103.9 + utilMethod1: function() {},
103.10 + utilMethod2: function() {}
103.11 + }
103.12 + });
103.13 \ No newline at end of file
104.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
104.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/api/v0.1/OMessages.js Mon Jun 02 14:23:34 2014 +0200
104.3 @@ -0,0 +1,3 @@
104.4 +define ( function () {
104.5 +
104.6 +});
104.7 \ No newline at end of file
105.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
105.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/api/v0.1/Options.js Mon Jun 02 14:23:34 2014 +0200
105.3 @@ -0,0 +1,6 @@
105.4 +define(function () {
105.5 + return {
105.6 + OPTION1 : 'test',
105.7 + OPTION2 : 10
105.8 + }
105.9 +});
105.10 \ No newline at end of file
106.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
106.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/module1.js Mon Jun 02 14:23:34 2014 +0200
106.3 @@ -0,0 +1,49 @@
106.4 +define([], function() {
106.5 +
106.6 + /**
106.7 + * Transaction state
106.8 + */
106.9 + return {
106.10 + /**
106.11 + * New transaction not yet commited.
106.12 + */
106.13 + UNCOMMITED: "UNCOMMITED",
106.14 +
106.15 + /**
106.16 + * Transaction has been successfully commited.
106.17 + */
106.18 + COMMITED: "COMMITED",
106.19 +
106.20 + /**
106.21 + * Transaction commit failed, but previous successfull operations were rolled back.
106.22 + */
106.23 + COMMIT_FAILED: "COMMIT_FAILED",
106.24 +
106.25 + /**
106.26 + * An error state: Commit failed and also the previously successully applied operation
106.27 + * couldn't be reverted.
106.28 + *
106.29 + * The system become inconsistent.
106.30 + */
106.31 + COMMIT_FAILED_ERROR: "COMMIT_FAILED_ERROR",
106.32 +
106.33 + /**
106.34 + * Transaction has been successfully rolled back after previous successfull commit.
106.35 + */
106.36 + ROLLEDBACK: "ROLLEDBACK",
106.37 +
106.38 + /**
106.39 + * Failed rollback.
106.40 + */
106.41 + ROLLBACK_FAILED: "ROLLBACK_FAILED",
106.42 +
106.43 + /**
106.44 + * Failed rollback, failed to reapply previously successfully reverted operations.
106.45 + *
106.46 + * The system become inconsistent.
106.47 + */
106.48 + ROLLBACK_FAILED_ERROR: "ROLLBACK_FAILED_ERROR",
106.49 +
106.50 + };
106.51 +
106.52 +});
106.53 \ No newline at end of file
107.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
107.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/objectLiteral.js Mon Jun 02 14:23:34 2014 +0200
107.3 @@ -0,0 +1,7 @@
107.4 +define({
107.5 + ol1nickname: "Pepa",
107.6 + ol1name: "ZDepa",
107.7 + ol1yell: function() {
107.8 + window.console.log("I am " + this.nickname);
107.9 + }
107.10 +});
107.11 \ No newline at end of file
108.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
108.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/objectLiteral2.js Mon Jun 02 14:23:34 2014 +0200
108.3 @@ -0,0 +1,6 @@
108.4 +define([], {
108.5 + ol2color: "black",
108.6 + ol2size: "unisize",
108.7 + ol2number: 10,
108.8 + number:20
108.9 +});
108.10 \ No newline at end of file
109.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
109.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/objectLiteral3.js Mon Jun 02 14:23:34 2014 +0200
109.3 @@ -0,0 +1,7 @@
109.4 +define({
109.5 + ol3nickname: "Pepa",
109.6 + ol3name: "ZDepa",
109.7 + ol3yell: function() {
109.8 + window.console.log("I am " + this.nickname);
109.9 + }
109.10 +});
109.11 \ No newline at end of file
110.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
110.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/usingObjectLiteral.js Mon Jun 02 14:23:34 2014 +0200
110.3 @@ -0,0 +1,3 @@
110.4 +define(['objectLiteral'], function (ob){
110.5 + ob.ol1
110.6 +});
110.7 \ No newline at end of file
111.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
111.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/usingObjectLiteral.js.testObjectLiteral01.completion Mon Jun 02 14:23:34 2014 +0200
111.3 @@ -0,0 +1,7 @@
111.4 +Code completion result for source line:
111.5 +ob.ol1|
111.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
111.7 +------------------------------------
111.8 +METHOD ol1yell(): undefined [PUBLIC] objectLiteral.js
111.9 +FIELD ol1name: String [PUBLIC] objectLiteral.js
111.10 +FIELD ol1nickname: String [PUBLIC] objectLiteral.js
112.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
112.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/usingObjectLiteral2.js Mon Jun 02 14:23:34 2014 +0200
112.3 @@ -0,0 +1,3 @@
112.4 +define(['objectLiteral2'], function (ob){
112.5 + ob.ol2color
112.6 +});
112.7 \ No newline at end of file
113.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
113.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/usingObjectLiteral2.js.testObjectLiteral02.completion Mon Jun 02 14:23:34 2014 +0200
113.3 @@ -0,0 +1,7 @@
113.4 +Code completion result for source line:
113.5 +ob.ol2|color
113.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
113.7 +------------------------------------
113.8 +FIELD ol2color: String [PUBLIC] objectLiteral2.js
113.9 +FIELD ol2number: Number [PUBLIC] objectLiteral2.js
113.10 +FIELD ol2size: String [PUBLIC] objectLiteral2.js
114.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
114.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder1/usingObjectLiteral2.js.testObjectLiteral03.completion Mon Jun 02 14:23:34 2014 +0200
114.3 @@ -0,0 +1,6 @@
114.4 +Code completion result for source line:
114.5 +ob.ol|2color
114.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
114.7 +------------------------------------
114.8 +CLASS ol1 [PUBLIC] <font color=#999999>usingObjectLiteral.js</font>
114.9 +FIELD ol2color [PUBLIC] usingObjectLiteral2.js
115.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
115.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder2/fs.js Mon Jun 02 14:23:34 2014 +0200
115.3 @@ -0,0 +1,11 @@
115.4 +define([
115.5 + '',
115.6 + 'lib/a',
115.7 + 'lib/api/',
115.8 + 'lib/api/v0.1/',
115.9 + 'lib/api/v0.1/OM',
115.10 + 'folder1/api/utils'
115.11 +] ,function () {
115.12 +
115.13 +});
115.14 +
116.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
116.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder2/fs.js.testFSCompletion02.completion Mon Jun 02 14:23:34 2014 +0200
116.3 @@ -0,0 +1,14 @@
116.4 +Code completion result for source line:
116.5 +'|',
116.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
116.7 +------------------------------------
116.8 +FILE api
116.9 +FILE config
116.10 +FILE fileCC
116.11 +FILE folder1
116.12 +FILE folder2
116.13 +FILE lib
116.14 +FILE lib/api
116.15 +FILE main.js
116.16 +FILE main2.js
116.17 +FILE utils
117.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
117.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder2/fs.js.testMappingCompletion01.completion Mon Jun 02 14:23:34 2014 +0200
117.3 @@ -0,0 +1,6 @@
117.4 +Code completion result for source line:
117.5 +'lib/a|',
117.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
117.7 +------------------------------------
117.8 +FILE api
117.9 +FILE lib/api
118.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
118.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder2/fs.js.testMappingCompletion02.completion Mon Jun 02 14:23:34 2014 +0200
118.3 @@ -0,0 +1,6 @@
118.4 +Code completion result for source line:
118.5 +'lib/api/|',
118.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
118.7 +------------------------------------
118.8 +FILE utils.js
118.9 +FILE v0.1
119.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
119.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder2/fs.js.testMappingCompletion03.completion Mon Jun 02 14:23:34 2014 +0200
119.3 @@ -0,0 +1,6 @@
119.4 +Code completion result for source line:
119.5 +'lib/api/v0.1/|',
119.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
119.7 +------------------------------------
119.8 +FILE OMessages.js
119.9 +FILE Options.js
120.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
120.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/folder2/fs.js.testMappingCompletion04.completion Mon Jun 02 14:23:34 2014 +0200
120.3 @@ -0,0 +1,5 @@
120.4 +Code completion result for source line:
120.5 +'lib/api/v0.1/OM|',
120.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
120.7 +------------------------------------
120.8 +FILE OMessages.js
121.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
121.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/main.js Mon Jun 02 14:23:34 2014 +0200
121.3 @@ -0,0 +1,28 @@
121.4 +requirejs.config({
121.5 +// baseUrl: 'js/app',
121.6 + paths: {
121.7 + config: "js/fileCC/main3",
121.8 + lib: "folder1"
121.9 + },
121.10 + shim: {
121.11 + 'jquery': {
121.12 + exports: ['jQuery', '$']
121.13 + }
121.14 + ,
121.15 + 'piwik': {
121.16 + exports: 'piwik'
121.17 + }
121.18 + }
121.19 +});
121.20 +
121.21 +define(
121.22 + [
121.23 + 'folder1/module1',
121.24 + './folder1/module1',
121.25 + 'utils',
121.26 + 'api/v0.1/Options',
121.27 + 'lib/api/v0.1/OMessages'
121.28 + ],
121.29 + function (module1, module11, utils) {
121.30 + utils.utilMethod1();
121.31 +});
121.32 \ No newline at end of file
122.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
122.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/main.js.testFSCompletion01.completion Mon Jun 02 14:23:34 2014 +0200
122.3 @@ -0,0 +1,6 @@
122.4 +Code completion result for source line:
122.5 +'fo|lder1/module1',
122.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
122.7 +------------------------------------
122.8 +FILE folder1
122.9 +FILE folder2
123.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
123.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/main.js.testProjectMappings01.completion Mon Jun 02 14:23:34 2014 +0200
123.3 @@ -0,0 +1,6 @@
123.4 +Code completion result for source line:
123.5 +utils.util|Method1();
123.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
123.7 +------------------------------------
123.8 +METHOD utilMethod1(): undefined [PUBLIC] utils.js
123.9 +METHOD utilMethod2(): undefined [PUBLIC] utils.js
124.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
124.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/main2.js Mon Jun 02 14:23:34 2014 +0200
124.3 @@ -0,0 +1,2 @@
124.4 +requirejs(['']);
124.5 +
125.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
125.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/js/main2.js.testFSCompletion03.completion Mon Jun 02 14:23:34 2014 +0200
125.3 @@ -0,0 +1,13 @@
125.4 +Code completion result for source line:
125.5 +requirejs(['|']);
125.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
125.7 +------------------------------------
125.8 +FILE api
125.9 +FILE config
125.10 +FILE fileCC
125.11 +FILE folder1
125.12 +FILE folder2
125.13 +FILE lib
125.14 +FILE lib/api
125.15 +FILE main.js
125.16 +FILE utils
126.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
126.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/nbproject/project.properties Mon Jun 02 14:23:34 2014 +0200
126.3 @@ -0,0 +1,7 @@
126.4 +auxiliary.org-netbeans-modules-javascript2-requirejs.enabled=true
126.5 +auxiliary.org-netbeans-modules-javascript2-requirejs.mappings={lib/api , js/folder1/api}{utils , js/folder1/api/utils.js}{api , js/folder1/api}
126.6 +config.folder=
126.7 +file.reference.data-TestProject1=.
126.8 +files.encoding=UTF-8
126.9 +site.root.folder=${file.reference.data-TestProject1}
126.10 +test.folder=
127.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
127.2 +++ b/javascript2.requirejs/test/unit/data/TestProject1/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
127.3 @@ -0,0 +1,9 @@
127.4 +<?xml version="1.0" encoding="UTF-8"?>
127.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
127.6 + <type>org.netbeans.modules.web.clientproject</type>
127.7 + <configuration>
127.8 + <data xmlns="http://www.netbeans.org/ns/clientside-project/1">
127.9 + <name>TestProject1 In RequireJS</name>
127.10 + </data>
127.11 + </configuration>
127.12 +</project>
128.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
128.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/nbproject/project.properties Mon Jun 02 14:23:34 2014 +0200
128.3 @@ -0,0 +1,7 @@
128.4 +config.folder=${file.reference.TestProject2-config}
128.5 +file.reference.TestProject2-config=config
128.6 +file.reference.TestProject2-public_html=public_html
128.7 +file.reference.TestProject2-test=test
128.8 +files.encoding=UTF-8
128.9 +site.root.folder=${file.reference.TestProject2-public_html}
128.10 +test.folder=${file.reference.TestProject2-test}
129.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
129.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
129.3 @@ -0,0 +1,9 @@
129.4 +<?xml version="1.0" encoding="UTF-8"?>
129.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
129.6 + <type>org.netbeans.modules.web.clientproject</type>
129.7 + <configuration>
129.8 + <data xmlns="http://www.netbeans.org/ns/clientside-project/1">
129.9 + <name>TestProject2</name>
129.10 + </data>
129.11 + </configuration>
129.12 +</project>
130.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
130.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/index.html Mon Jun 02 14:23:34 2014 +0200
130.3 @@ -0,0 +1,17 @@
130.4 +<!DOCTYPE html>
130.5 +<!--
130.6 +To change this license header, choose License Headers in Project Properties.
130.7 +To change this template file, choose Tools | Templates
130.8 +and open the template in the editor.
130.9 +-->
130.10 +<html>
130.11 + <head>
130.12 + <title>TODO supply a title</title>
130.13 + <meta charset="UTF-8">
130.14 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
130.15 + </head>
130.16 + <body>
130.17 + <div>TODO write content</div>
130.18 + <script data-main="js/main.js" src="js/lib/require.js/require.js" > </script>
130.19 + </body>
130.20 +</html>
131.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
131.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/app/moduleApp1.js Mon Jun 02 14:23:34 2014 +0200
131.3 @@ -0,0 +1,8 @@
131.4 +
131.5 +define( function () {
131.6 + return {
131.7 + first: 1,
131.8 + second: 2
131.9 + };
131.10 +});
131.11 +
132.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
132.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/lib/moduleLib1.js Mon Jun 02 14:23:34 2014 +0200
132.3 @@ -0,0 +1,5 @@
132.4 +define ({
132.5 + const1 : "ahoj",
132.6 + const2 : "cau"
132.7 +});
132.8 +
133.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
133.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/lib/moduleLib2.js Mon Jun 02 14:23:34 2014 +0200
133.3 @@ -0,0 +1,7 @@
133.4 +define ({
133.5 + const3 : "Petr",
133.6 + const4 : "Pavel"
133.7 +});
133.8 +
133.9 +
133.10 +
134.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
134.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/lib/proto/localization.js Mon Jun 02 14:23:34 2014 +0200
134.3 @@ -0,0 +1,7 @@
134.4 +define ({
134.5 + message1 : "message 1",
134.6 + message2 : "message 2"
134.7 +});
134.8 +
134.9 +
134.10 +
135.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
135.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/lib/require.js/require.js Mon Jun 02 14:23:34 2014 +0200
135.3 @@ -0,0 +1,2053 @@
135.4 +/** vim: et:ts=4:sw=4:sts=4
135.5 + * @license RequireJS 2.1.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
135.6 + * Available via the MIT or new BSD license.
135.7 + * see: http://github.com/jrburke/requirejs for details
135.8 + */
135.9 +//Not using strict: uneven strict support in browsers, #392, and causes
135.10 +//problems with requirejs.exec()/transpiler plugins that may not be strict.
135.11 +/*jslint regexp: true, nomen: true, sloppy: true */
135.12 +/*global window, navigator, document, importScripts, setTimeout, opera */
135.13 +
135.14 +var requirejs, require, define;
135.15 +(function (global) {
135.16 + var req, s, head, baseElement, dataMain, src,
135.17 + interactiveScript, currentlyAddingScript, mainScript, subPath,
135.18 + version = '2.1.8',
135.19 + commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
135.20 + cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
135.21 + jsSuffixRegExp = /\.js$/,
135.22 + currDirRegExp = /^\.\//,
135.23 + op = Object.prototype,
135.24 + ostring = op.toString,
135.25 + hasOwn = op.hasOwnProperty,
135.26 + ap = Array.prototype,
135.27 + apsp = ap.splice,
135.28 + isBrowser = !!(typeof window !== 'undefined' && navigator && window.document),
135.29 + isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
135.30 + //PS3 indicates loaded and complete, but need to wait for complete
135.31 + //specifically. Sequence is 'loading', 'loaded', execution,
135.32 + // then 'complete'. The UA check is unfortunate, but not sure how
135.33 + //to feature test w/o causing perf issues.
135.34 + readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
135.35 + /^complete$/ : /^(complete|loaded)$/,
135.36 + defContextName = '_',
135.37 + //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
135.38 + isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
135.39 + contexts = {},
135.40 + cfg = {},
135.41 + globalDefQueue = [],
135.42 + useInteractive = false;
135.43 +
135.44 + function isFunction(it) {
135.45 + return ostring.call(it) === '[object Function]';
135.46 + }
135.47 +
135.48 + function isArray(it) {
135.49 + return ostring.call(it) === '[object Array]';
135.50 + }
135.51 +
135.52 + /**
135.53 + * Helper function for iterating over an array. If the func returns
135.54 + * a true value, it will break out of the loop.
135.55 + */
135.56 + function each(ary, func) {
135.57 + if (ary) {
135.58 + var i;
135.59 + for (i = 0; i < ary.length; i += 1) {
135.60 + if (ary[i] && func(ary[i], i, ary)) {
135.61 + break;
135.62 + }
135.63 + }
135.64 + }
135.65 + }
135.66 +
135.67 + /**
135.68 + * Helper function for iterating over an array backwards. If the func
135.69 + * returns a true value, it will break out of the loop.
135.70 + */
135.71 + function eachReverse(ary, func) {
135.72 + if (ary) {
135.73 + var i;
135.74 + for (i = ary.length - 1; i > -1; i -= 1) {
135.75 + if (ary[i] && func(ary[i], i, ary)) {
135.76 + break;
135.77 + }
135.78 + }
135.79 + }
135.80 + }
135.81 +
135.82 + function hasProp(obj, prop) {
135.83 + return hasOwn.call(obj, prop);
135.84 + }
135.85 +
135.86 + function getOwn(obj, prop) {
135.87 + return hasProp(obj, prop) && obj[prop];
135.88 + }
135.89 +
135.90 + /**
135.91 + * Cycles over properties in an object and calls a function for each
135.92 + * property value. If the function returns a truthy value, then the
135.93 + * iteration is stopped.
135.94 + */
135.95 + function eachProp(obj, func) {
135.96 + var prop;
135.97 + for (prop in obj) {
135.98 + if (hasProp(obj, prop)) {
135.99 + if (func(obj[prop], prop)) {
135.100 + break;
135.101 + }
135.102 + }
135.103 + }
135.104 + }
135.105 +
135.106 + /**
135.107 + * Simple function to mix in properties from source into target,
135.108 + * but only if target does not already have a property of the same name.
135.109 + */
135.110 + function mixin(target, source, force, deepStringMixin) {
135.111 + if (source) {
135.112 + eachProp(source, function (value, prop) {
135.113 + if (force || !hasProp(target, prop)) {
135.114 + if (deepStringMixin && typeof value !== 'string') {
135.115 + if (!target[prop]) {
135.116 + target[prop] = {};
135.117 + }
135.118 + mixin(target[prop], value, force, deepStringMixin);
135.119 + } else {
135.120 + target[prop] = value;
135.121 + }
135.122 + }
135.123 + });
135.124 + }
135.125 + return target;
135.126 + }
135.127 +
135.128 + //Similar to Function.prototype.bind, but the 'this' object is specified
135.129 + //first, since it is easier to read/figure out what 'this' will be.
135.130 + function bind(obj, fn) {
135.131 + return function () {
135.132 + return fn.apply(obj, arguments);
135.133 + };
135.134 + }
135.135 +
135.136 + function scripts() {
135.137 + return document.getElementsByTagName('script');
135.138 + }
135.139 +
135.140 + function defaultOnError(err) {
135.141 + throw err;
135.142 + }
135.143 +
135.144 + //Allow getting a global that expressed in
135.145 + //dot notation, like 'a.b.c'.
135.146 + function getGlobal(value) {
135.147 + if (!value) {
135.148 + return value;
135.149 + }
135.150 + var g = global;
135.151 + each(value.split('.'), function (part) {
135.152 + g = g[part];
135.153 + });
135.154 + return g;
135.155 + }
135.156 +
135.157 + /**
135.158 + * Constructs an error with a pointer to an URL with more information.
135.159 + * @param {String} id the error ID that maps to an ID on a web page.
135.160 + * @param {String} message human readable error.
135.161 + * @param {Error} [err] the original error, if there is one.
135.162 + *
135.163 + * @returns {Error}
135.164 + */
135.165 + function makeError(id, msg, err, requireModules) {
135.166 + var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
135.167 + e.requireType = id;
135.168 + e.requireModules = requireModules;
135.169 + if (err) {
135.170 + e.originalError = err;
135.171 + }
135.172 + return e;
135.173 + }
135.174 +
135.175 + if (typeof define !== 'undefined') {
135.176 + //If a define is already in play via another AMD loader,
135.177 + //do not overwrite.
135.178 + return;
135.179 + }
135.180 +
135.181 + if (typeof requirejs !== 'undefined') {
135.182 + if (isFunction(requirejs)) {
135.183 + //Do not overwrite and existing requirejs instance.
135.184 + return;
135.185 + }
135.186 + cfg = requirejs;
135.187 + requirejs = undefined;
135.188 + }
135.189 +
135.190 + //Allow for a require config object
135.191 + if (typeof require !== 'undefined' && !isFunction(require)) {
135.192 + //assume it is a config object.
135.193 + cfg = require;
135.194 + require = undefined;
135.195 + }
135.196 +
135.197 + function newContext(contextName) {
135.198 + var inCheckLoaded, Module, context, handlers,
135.199 + checkLoadedTimeoutId,
135.200 + config = {
135.201 + //Defaults. Do not set a default for map
135.202 + //config to speed up normalize(), which
135.203 + //will run faster if there is no default.
135.204 + waitSeconds: 7,
135.205 + baseUrl: './',
135.206 + paths: {},
135.207 + pkgs: {},
135.208 + shim: {},
135.209 + config: {}
135.210 + },
135.211 + registry = {},
135.212 + //registry of just enabled modules, to speed
135.213 + //cycle breaking code when lots of modules
135.214 + //are registered, but not activated.
135.215 + enabledRegistry = {},
135.216 + undefEvents = {},
135.217 + defQueue = [],
135.218 + defined = {},
135.219 + urlFetched = {},
135.220 + requireCounter = 1,
135.221 + unnormalizedCounter = 1;
135.222 +
135.223 + /**
135.224 + * Trims the . and .. from an array of path segments.
135.225 + * It will keep a leading path segment if a .. will become
135.226 + * the first path segment, to help with module name lookups,
135.227 + * which act like paths, but can be remapped. But the end result,
135.228 + * all paths that use this function should look normalized.
135.229 + * NOTE: this method MODIFIES the input array.
135.230 + * @param {Array} ary the array of path segments.
135.231 + */
135.232 + function trimDots(ary) {
135.233 + var i, part;
135.234 + for (i = 0; ary[i]; i += 1) {
135.235 + part = ary[i];
135.236 + if (part === '.') {
135.237 + ary.splice(i, 1);
135.238 + i -= 1;
135.239 + } else if (part === '..') {
135.240 + if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
135.241 + //End of the line. Keep at least one non-dot
135.242 + //path segment at the front so it can be mapped
135.243 + //correctly to disk. Otherwise, there is likely
135.244 + //no path mapping for a path starting with '..'.
135.245 + //This can still fail, but catches the most reasonable
135.246 + //uses of ..
135.247 + break;
135.248 + } else if (i > 0) {
135.249 + ary.splice(i - 1, 2);
135.250 + i -= 2;
135.251 + }
135.252 + }
135.253 + }
135.254 + }
135.255 +
135.256 + /**
135.257 + * Given a relative module name, like ./something, normalize it to
135.258 + * a real name that can be mapped to a path.
135.259 + * @param {String} name the relative name
135.260 + * @param {String} baseName a real name that the name arg is relative
135.261 + * to.
135.262 + * @param {Boolean} applyMap apply the map config to the value. Should
135.263 + * only be done if this normalization is for a dependency ID.
135.264 + * @returns {String} normalized name
135.265 + */
135.266 + function normalize(name, baseName, applyMap) {
135.267 + var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
135.268 + foundMap, foundI, foundStarMap, starI,
135.269 + baseParts = baseName && baseName.split('/'),
135.270 + normalizedBaseParts = baseParts,
135.271 + map = config.map,
135.272 + starMap = map && map['*'];
135.273 +
135.274 + //Adjust any relative paths.
135.275 + if (name && name.charAt(0) === '.') {
135.276 + //If have a base name, try to normalize against it,
135.277 + //otherwise, assume it is a top-level require that will
135.278 + //be relative to baseUrl in the end.
135.279 + if (baseName) {
135.280 + if (getOwn(config.pkgs, baseName)) {
135.281 + //If the baseName is a package name, then just treat it as one
135.282 + //name to concat the name with.
135.283 + normalizedBaseParts = baseParts = [baseName];
135.284 + } else {
135.285 + //Convert baseName to array, and lop off the last part,
135.286 + //so that . matches that 'directory' and not name of the baseName's
135.287 + //module. For instance, baseName of 'one/two/three', maps to
135.288 + //'one/two/three.js', but we want the directory, 'one/two' for
135.289 + //this normalization.
135.290 + normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
135.291 + }
135.292 +
135.293 + name = normalizedBaseParts.concat(name.split('/'));
135.294 + trimDots(name);
135.295 +
135.296 + //Some use of packages may use a . path to reference the
135.297 + //'main' module name, so normalize for that.
135.298 + pkgConfig = getOwn(config.pkgs, (pkgName = name[0]));
135.299 + name = name.join('/');
135.300 + if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
135.301 + name = pkgName;
135.302 + }
135.303 + } else if (name.indexOf('./') === 0) {
135.304 + // No baseName, so this is ID is resolved relative
135.305 + // to baseUrl, pull off the leading dot.
135.306 + name = name.substring(2);
135.307 + }
135.308 + }
135.309 +
135.310 + //Apply map config if available.
135.311 + if (applyMap && map && (baseParts || starMap)) {
135.312 + nameParts = name.split('/');
135.313 +
135.314 + for (i = nameParts.length; i > 0; i -= 1) {
135.315 + nameSegment = nameParts.slice(0, i).join('/');
135.316 +
135.317 + if (baseParts) {
135.318 + //Find the longest baseName segment match in the config.
135.319 + //So, do joins on the biggest to smallest lengths of baseParts.
135.320 + for (j = baseParts.length; j > 0; j -= 1) {
135.321 + mapValue = getOwn(map, baseParts.slice(0, j).join('/'));
135.322 +
135.323 + //baseName segment has config, find if it has one for
135.324 + //this name.
135.325 + if (mapValue) {
135.326 + mapValue = getOwn(mapValue, nameSegment);
135.327 + if (mapValue) {
135.328 + //Match, update name to the new value.
135.329 + foundMap = mapValue;
135.330 + foundI = i;
135.331 + break;
135.332 + }
135.333 + }
135.334 + }
135.335 + }
135.336 +
135.337 + if (foundMap) {
135.338 + break;
135.339 + }
135.340 +
135.341 + //Check for a star map match, but just hold on to it,
135.342 + //if there is a shorter segment match later in a matching
135.343 + //config, then favor over this star map.
135.344 + if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
135.345 + foundStarMap = getOwn(starMap, nameSegment);
135.346 + starI = i;
135.347 + }
135.348 + }
135.349 +
135.350 + if (!foundMap && foundStarMap) {
135.351 + foundMap = foundStarMap;
135.352 + foundI = starI;
135.353 + }
135.354 +
135.355 + if (foundMap) {
135.356 + nameParts.splice(0, foundI, foundMap);
135.357 + name = nameParts.join('/');
135.358 + }
135.359 + }
135.360 +
135.361 + return name;
135.362 + }
135.363 +
135.364 + function removeScript(name) {
135.365 + if (isBrowser) {
135.366 + each(scripts(), function (scriptNode) {
135.367 + if (scriptNode.getAttribute('data-requiremodule') === name &&
135.368 + scriptNode.getAttribute('data-requirecontext') === context.contextName) {
135.369 + scriptNode.parentNode.removeChild(scriptNode);
135.370 + return true;
135.371 + }
135.372 + });
135.373 + }
135.374 + }
135.375 +
135.376 + function hasPathFallback(id) {
135.377 + var pathConfig = getOwn(config.paths, id);
135.378 + if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
135.379 + removeScript(id);
135.380 + //Pop off the first array value, since it failed, and
135.381 + //retry
135.382 + pathConfig.shift();
135.383 + context.require.undef(id);
135.384 + context.require([id]);
135.385 + return true;
135.386 + }
135.387 + }
135.388 +
135.389 + //Turns a plugin!resource to [plugin, resource]
135.390 + //with the plugin being undefined if the name
135.391 + //did not have a plugin prefix.
135.392 + function splitPrefix(name) {
135.393 + var prefix,
135.394 + index = name ? name.indexOf('!') : -1;
135.395 + if (index > -1) {
135.396 + prefix = name.substring(0, index);
135.397 + name = name.substring(index + 1, name.length);
135.398 + }
135.399 + return [prefix, name];
135.400 + }
135.401 +
135.402 + /**
135.403 + * Creates a module mapping that includes plugin prefix, module
135.404 + * name, and path. If parentModuleMap is provided it will
135.405 + * also normalize the name via require.normalize()
135.406 + *
135.407 + * @param {String} name the module name
135.408 + * @param {String} [parentModuleMap] parent module map
135.409 + * for the module name, used to resolve relative names.
135.410 + * @param {Boolean} isNormalized: is the ID already normalized.
135.411 + * This is true if this call is done for a define() module ID.
135.412 + * @param {Boolean} applyMap: apply the map config to the ID.
135.413 + * Should only be true if this map is for a dependency.
135.414 + *
135.415 + * @returns {Object}
135.416 + */
135.417 + function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
135.418 + var url, pluginModule, suffix, nameParts,
135.419 + prefix = null,
135.420 + parentName = parentModuleMap ? parentModuleMap.name : null,
135.421 + originalName = name,
135.422 + isDefine = true,
135.423 + normalizedName = '';
135.424 +
135.425 + //If no name, then it means it is a require call, generate an
135.426 + //internal name.
135.427 + if (!name) {
135.428 + isDefine = false;
135.429 + name = '_@r' + (requireCounter += 1);
135.430 + }
135.431 +
135.432 + nameParts = splitPrefix(name);
135.433 + prefix = nameParts[0];
135.434 + name = nameParts[1];
135.435 +
135.436 + if (prefix) {
135.437 + prefix = normalize(prefix, parentName, applyMap);
135.438 + pluginModule = getOwn(defined, prefix);
135.439 + }
135.440 +
135.441 + //Account for relative paths if there is a base name.
135.442 + if (name) {
135.443 + if (prefix) {
135.444 + if (pluginModule && pluginModule.normalize) {
135.445 + //Plugin is loaded, use its normalize method.
135.446 + normalizedName = pluginModule.normalize(name, function (name) {
135.447 + return normalize(name, parentName, applyMap);
135.448 + });
135.449 + } else {
135.450 + normalizedName = normalize(name, parentName, applyMap);
135.451 + }
135.452 + } else {
135.453 + //A regular module.
135.454 + normalizedName = normalize(name, parentName, applyMap);
135.455 +
135.456 + //Normalized name may be a plugin ID due to map config
135.457 + //application in normalize. The map config values must
135.458 + //already be normalized, so do not need to redo that part.
135.459 + nameParts = splitPrefix(normalizedName);
135.460 + prefix = nameParts[0];
135.461 + normalizedName = nameParts[1];
135.462 + isNormalized = true;
135.463 +
135.464 + url = context.nameToUrl(normalizedName);
135.465 + }
135.466 + }
135.467 +
135.468 + //If the id is a plugin id that cannot be determined if it needs
135.469 + //normalization, stamp it with a unique ID so two matching relative
135.470 + //ids that may conflict can be separate.
135.471 + suffix = prefix && !pluginModule && !isNormalized ?
135.472 + '_unnormalized' + (unnormalizedCounter += 1) :
135.473 + '';
135.474 +
135.475 + return {
135.476 + prefix: prefix,
135.477 + name: normalizedName,
135.478 + parentMap: parentModuleMap,
135.479 + unnormalized: !!suffix,
135.480 + url: url,
135.481 + originalName: originalName,
135.482 + isDefine: isDefine,
135.483 + id: (prefix ?
135.484 + prefix + '!' + normalizedName :
135.485 + normalizedName) + suffix
135.486 + };
135.487 + }
135.488 +
135.489 + function getModule(depMap) {
135.490 + var id = depMap.id,
135.491 + mod = getOwn(registry, id);
135.492 +
135.493 + if (!mod) {
135.494 + mod = registry[id] = new context.Module(depMap);
135.495 + }
135.496 +
135.497 + return mod;
135.498 + }
135.499 +
135.500 + function on(depMap, name, fn) {
135.501 + var id = depMap.id,
135.502 + mod = getOwn(registry, id);
135.503 +
135.504 + if (hasProp(defined, id) &&
135.505 + (!mod || mod.defineEmitComplete)) {
135.506 + if (name === 'defined') {
135.507 + fn(defined[id]);
135.508 + }
135.509 + } else {
135.510 + mod = getModule(depMap);
135.511 + if (mod.error && name === 'error') {
135.512 + fn(mod.error);
135.513 + } else {
135.514 + mod.on(name, fn);
135.515 + }
135.516 + }
135.517 + }
135.518 +
135.519 + function onError(err, errback) {
135.520 + var ids = err.requireModules,
135.521 + notified = false;
135.522 +
135.523 + if (errback) {
135.524 + errback(err);
135.525 + } else {
135.526 + each(ids, function (id) {
135.527 + var mod = getOwn(registry, id);
135.528 + if (mod) {
135.529 + //Set error on module, so it skips timeout checks.
135.530 + mod.error = err;
135.531 + if (mod.events.error) {
135.532 + notified = true;
135.533 + mod.emit('error', err);
135.534 + }
135.535 + }
135.536 + });
135.537 +
135.538 + if (!notified) {
135.539 + req.onError(err);
135.540 + }
135.541 + }
135.542 + }
135.543 +
135.544 + /**
135.545 + * Internal method to transfer globalQueue items to this context's
135.546 + * defQueue.
135.547 + */
135.548 + function takeGlobalQueue() {
135.549 + //Push all the globalDefQueue items into the context's defQueue
135.550 + if (globalDefQueue.length) {
135.551 + //Array splice in the values since the context code has a
135.552 + //local var ref to defQueue, so cannot just reassign the one
135.553 + //on context.
135.554 + apsp.apply(defQueue,
135.555 + [defQueue.length - 1, 0].concat(globalDefQueue));
135.556 + globalDefQueue = [];
135.557 + }
135.558 + }
135.559 +
135.560 + handlers = {
135.561 + 'require': function (mod) {
135.562 + if (mod.require) {
135.563 + return mod.require;
135.564 + } else {
135.565 + return (mod.require = context.makeRequire(mod.map));
135.566 + }
135.567 + },
135.568 + 'exports': function (mod) {
135.569 + mod.usingExports = true;
135.570 + if (mod.map.isDefine) {
135.571 + if (mod.exports) {
135.572 + return mod.exports;
135.573 + } else {
135.574 + return (mod.exports = defined[mod.map.id] = {});
135.575 + }
135.576 + }
135.577 + },
135.578 + 'module': function (mod) {
135.579 + if (mod.module) {
135.580 + return mod.module;
135.581 + } else {
135.582 + return (mod.module = {
135.583 + id: mod.map.id,
135.584 + uri: mod.map.url,
135.585 + config: function () {
135.586 + var c,
135.587 + pkg = getOwn(config.pkgs, mod.map.id);
135.588 + // For packages, only support config targeted
135.589 + // at the main module.
135.590 + c = pkg ? getOwn(config.config, mod.map.id + '/' + pkg.main) :
135.591 + getOwn(config.config, mod.map.id);
135.592 + return c || {};
135.593 + },
135.594 + exports: defined[mod.map.id]
135.595 + });
135.596 + }
135.597 + }
135.598 + };
135.599 +
135.600 + function cleanRegistry(id) {
135.601 + //Clean up machinery used for waiting modules.
135.602 + delete registry[id];
135.603 + delete enabledRegistry[id];
135.604 + }
135.605 +
135.606 + function breakCycle(mod, traced, processed) {
135.607 + var id = mod.map.id;
135.608 +
135.609 + if (mod.error) {
135.610 + mod.emit('error', mod.error);
135.611 + } else {
135.612 + traced[id] = true;
135.613 + each(mod.depMaps, function (depMap, i) {
135.614 + var depId = depMap.id,
135.615 + dep = getOwn(registry, depId);
135.616 +
135.617 + //Only force things that have not completed
135.618 + //being defined, so still in the registry,
135.619 + //and only if it has not been matched up
135.620 + //in the module already.
135.621 + if (dep && !mod.depMatched[i] && !processed[depId]) {
135.622 + if (getOwn(traced, depId)) {
135.623 + mod.defineDep(i, defined[depId]);
135.624 + mod.check(); //pass false?
135.625 + } else {
135.626 + breakCycle(dep, traced, processed);
135.627 + }
135.628 + }
135.629 + });
135.630 + processed[id] = true;
135.631 + }
135.632 + }
135.633 +
135.634 + function checkLoaded() {
135.635 + var map, modId, err, usingPathFallback,
135.636 + waitInterval = config.waitSeconds * 1000,
135.637 + //It is possible to disable the wait interval by using waitSeconds of 0.
135.638 + expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
135.639 + noLoads = [],
135.640 + reqCalls = [],
135.641 + stillLoading = false,
135.642 + needCycleCheck = true;
135.643 +
135.644 + //Do not bother if this call was a result of a cycle break.
135.645 + if (inCheckLoaded) {
135.646 + return;
135.647 + }
135.648 +
135.649 + inCheckLoaded = true;
135.650 +
135.651 + //Figure out the state of all the modules.
135.652 + eachProp(enabledRegistry, function (mod) {
135.653 + map = mod.map;
135.654 + modId = map.id;
135.655 +
135.656 + //Skip things that are not enabled or in error state.
135.657 + if (!mod.enabled) {
135.658 + return;
135.659 + }
135.660 +
135.661 + if (!map.isDefine) {
135.662 + reqCalls.push(mod);
135.663 + }
135.664 +
135.665 + if (!mod.error) {
135.666 + //If the module should be executed, and it has not
135.667 + //been inited and time is up, remember it.
135.668 + if (!mod.inited && expired) {
135.669 + if (hasPathFallback(modId)) {
135.670 + usingPathFallback = true;
135.671 + stillLoading = true;
135.672 + } else {
135.673 + noLoads.push(modId);
135.674 + removeScript(modId);
135.675 + }
135.676 + } else if (!mod.inited && mod.fetched && map.isDefine) {
135.677 + stillLoading = true;
135.678 + if (!map.prefix) {
135.679 + //No reason to keep looking for unfinished
135.680 + //loading. If the only stillLoading is a
135.681 + //plugin resource though, keep going,
135.682 + //because it may be that a plugin resource
135.683 + //is waiting on a non-plugin cycle.
135.684 + return (needCycleCheck = false);
135.685 + }
135.686 + }
135.687 + }
135.688 + });
135.689 +
135.690 + if (expired && noLoads.length) {
135.691 + //If wait time expired, throw error of unloaded modules.
135.692 + err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
135.693 + err.contextName = context.contextName;
135.694 + return onError(err);
135.695 + }
135.696 +
135.697 + //Not expired, check for a cycle.
135.698 + if (needCycleCheck) {
135.699 + each(reqCalls, function (mod) {
135.700 + breakCycle(mod, {}, {});
135.701 + });
135.702 + }
135.703 +
135.704 + //If still waiting on loads, and the waiting load is something
135.705 + //other than a plugin resource, or there are still outstanding
135.706 + //scripts, then just try back later.
135.707 + if ((!expired || usingPathFallback) && stillLoading) {
135.708 + //Something is still waiting to load. Wait for it, but only
135.709 + //if a timeout is not already in effect.
135.710 + if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
135.711 + checkLoadedTimeoutId = setTimeout(function () {
135.712 + checkLoadedTimeoutId = 0;
135.713 + checkLoaded();
135.714 + }, 50);
135.715 + }
135.716 + }
135.717 +
135.718 + inCheckLoaded = false;
135.719 + }
135.720 +
135.721 + Module = function (map) {
135.722 + this.events = getOwn(undefEvents, map.id) || {};
135.723 + this.map = map;
135.724 + this.shim = getOwn(config.shim, map.id);
135.725 + this.depExports = [];
135.726 + this.depMaps = [];
135.727 + this.depMatched = [];
135.728 + this.pluginMaps = {};
135.729 + this.depCount = 0;
135.730 +
135.731 + /* this.exports this.factory
135.732 + this.depMaps = [],
135.733 + this.enabled, this.fetched
135.734 + */
135.735 + };
135.736 +
135.737 + Module.prototype = {
135.738 + init: function (depMaps, factory, errback, options) {
135.739 + options = options || {};
135.740 +
135.741 + //Do not do more inits if already done. Can happen if there
135.742 + //are multiple define calls for the same module. That is not
135.743 + //a normal, common case, but it is also not unexpected.
135.744 + if (this.inited) {
135.745 + return;
135.746 + }
135.747 +
135.748 + this.factory = factory;
135.749 +
135.750 + if (errback) {
135.751 + //Register for errors on this module.
135.752 + this.on('error', errback);
135.753 + } else if (this.events.error) {
135.754 + //If no errback already, but there are error listeners
135.755 + //on this module, set up an errback to pass to the deps.
135.756 + errback = bind(this, function (err) {
135.757 + this.emit('error', err);
135.758 + });
135.759 + }
135.760 +
135.761 + //Do a copy of the dependency array, so that
135.762 + //source inputs are not modified. For example
135.763 + //"shim" deps are passed in here directly, and
135.764 + //doing a direct modification of the depMaps array
135.765 + //would affect that config.
135.766 + this.depMaps = depMaps && depMaps.slice(0);
135.767 +
135.768 + this.errback = errback;
135.769 +
135.770 + //Indicate this module has be initialized
135.771 + this.inited = true;
135.772 +
135.773 + this.ignore = options.ignore;
135.774 +
135.775 + //Could have option to init this module in enabled mode,
135.776 + //or could have been previously marked as enabled. However,
135.777 + //the dependencies are not known until init is called. So
135.778 + //if enabled previously, now trigger dependencies as enabled.
135.779 + if (options.enabled || this.enabled) {
135.780 + //Enable this module and dependencies.
135.781 + //Will call this.check()
135.782 + this.enable();
135.783 + } else {
135.784 + this.check();
135.785 + }
135.786 + },
135.787 +
135.788 + defineDep: function (i, depExports) {
135.789 + //Because of cycles, defined callback for a given
135.790 + //export can be called more than once.
135.791 + if (!this.depMatched[i]) {
135.792 + this.depMatched[i] = true;
135.793 + this.depCount -= 1;
135.794 + this.depExports[i] = depExports;
135.795 + }
135.796 + },
135.797 +
135.798 + fetch: function () {
135.799 + if (this.fetched) {
135.800 + return;
135.801 + }
135.802 + this.fetched = true;
135.803 +
135.804 + context.startTime = (new Date()).getTime();
135.805 +
135.806 + var map = this.map;
135.807 +
135.808 + //If the manager is for a plugin managed resource,
135.809 + //ask the plugin to load it now.
135.810 + if (this.shim) {
135.811 + context.makeRequire(this.map, {
135.812 + enableBuildCallback: true
135.813 + })(this.shim.deps || [], bind(this, function () {
135.814 + return map.prefix ? this.callPlugin() : this.load();
135.815 + }));
135.816 + } else {
135.817 + //Regular dependency.
135.818 + return map.prefix ? this.callPlugin() : this.load();
135.819 + }
135.820 + },
135.821 +
135.822 + load: function () {
135.823 + var url = this.map.url;
135.824 +
135.825 + //Regular dependency.
135.826 + if (!urlFetched[url]) {
135.827 + urlFetched[url] = true;
135.828 + context.load(this.map.id, url);
135.829 + }
135.830 + },
135.831 +
135.832 + /**
135.833 + * Checks if the module is ready to define itself, and if so,
135.834 + * define it.
135.835 + */
135.836 + check: function () {
135.837 + if (!this.enabled || this.enabling) {
135.838 + return;
135.839 + }
135.840 +
135.841 + var err, cjsModule,
135.842 + id = this.map.id,
135.843 + depExports = this.depExports,
135.844 + exports = this.exports,
135.845 + factory = this.factory;
135.846 +
135.847 + if (!this.inited) {
135.848 + this.fetch();
135.849 + } else if (this.error) {
135.850 + this.emit('error', this.error);
135.851 + } else if (!this.defining) {
135.852 + //The factory could trigger another require call
135.853 + //that would result in checking this module to
135.854 + //define itself again. If already in the process
135.855 + //of doing that, skip this work.
135.856 + this.defining = true;
135.857 +
135.858 + if (this.depCount < 1 && !this.defined) {
135.859 + if (isFunction(factory)) {
135.860 + //If there is an error listener, favor passing
135.861 + //to that instead of throwing an error. However,
135.862 + //only do it for define()'d modules. require
135.863 + //errbacks should not be called for failures in
135.864 + //their callbacks (#699). However if a global
135.865 + //onError is set, use that.
135.866 + if ((this.events.error && this.map.isDefine) ||
135.867 + req.onError !== defaultOnError) {
135.868 + try {
135.869 + exports = context.execCb(id, factory, depExports, exports);
135.870 + } catch (e) {
135.871 + err = e;
135.872 + }
135.873 + } else {
135.874 + exports = context.execCb(id, factory, depExports, exports);
135.875 + }
135.876 +
135.877 + if (this.map.isDefine) {
135.878 + //If setting exports via 'module' is in play,
135.879 + //favor that over return value and exports. After that,
135.880 + //favor a non-undefined return value over exports use.
135.881 + cjsModule = this.module;
135.882 + if (cjsModule &&
135.883 + cjsModule.exports !== undefined &&
135.884 + //Make sure it is not already the exports value
135.885 + cjsModule.exports !== this.exports) {
135.886 + exports = cjsModule.exports;
135.887 + } else if (exports === undefined && this.usingExports) {
135.888 + //exports already set the defined value.
135.889 + exports = this.exports;
135.890 + }
135.891 + }
135.892 +
135.893 + if (err) {
135.894 + err.requireMap = this.map;
135.895 + err.requireModules = this.map.isDefine ? [this.map.id] : null;
135.896 + err.requireType = this.map.isDefine ? 'define' : 'require';
135.897 + return onError((this.error = err));
135.898 + }
135.899 +
135.900 + } else {
135.901 + //Just a literal value
135.902 + exports = factory;
135.903 + }
135.904 +
135.905 + this.exports = exports;
135.906 +
135.907 + if (this.map.isDefine && !this.ignore) {
135.908 + defined[id] = exports;
135.909 +
135.910 + if (req.onResourceLoad) {
135.911 + req.onResourceLoad(context, this.map, this.depMaps);
135.912 + }
135.913 + }
135.914 +
135.915 + //Clean up
135.916 + cleanRegistry(id);
135.917 +
135.918 + this.defined = true;
135.919 + }
135.920 +
135.921 + //Finished the define stage. Allow calling check again
135.922 + //to allow define notifications below in the case of a
135.923 + //cycle.
135.924 + this.defining = false;
135.925 +
135.926 + if (this.defined && !this.defineEmitted) {
135.927 + this.defineEmitted = true;
135.928 + this.emit('defined', this.exports);
135.929 + this.defineEmitComplete = true;
135.930 + }
135.931 +
135.932 + }
135.933 + },
135.934 +
135.935 + callPlugin: function () {
135.936 + var map = this.map,
135.937 + id = map.id,
135.938 + //Map already normalized the prefix.
135.939 + pluginMap = makeModuleMap(map.prefix);
135.940 +
135.941 + //Mark this as a dependency for this plugin, so it
135.942 + //can be traced for cycles.
135.943 + this.depMaps.push(pluginMap);
135.944 +
135.945 + on(pluginMap, 'defined', bind(this, function (plugin) {
135.946 + var load, normalizedMap, normalizedMod,
135.947 + name = this.map.name,
135.948 + parentName = this.map.parentMap ? this.map.parentMap.name : null,
135.949 + localRequire = context.makeRequire(map.parentMap, {
135.950 + enableBuildCallback: true
135.951 + });
135.952 +
135.953 + //If current map is not normalized, wait for that
135.954 + //normalized name to load instead of continuing.
135.955 + if (this.map.unnormalized) {
135.956 + //Normalize the ID if the plugin allows it.
135.957 + if (plugin.normalize) {
135.958 + name = plugin.normalize(name, function (name) {
135.959 + return normalize(name, parentName, true);
135.960 + }) || '';
135.961 + }
135.962 +
135.963 + //prefix and name should already be normalized, no need
135.964 + //for applying map config again either.
135.965 + normalizedMap = makeModuleMap(map.prefix + '!' + name,
135.966 + this.map.parentMap);
135.967 + on(normalizedMap,
135.968 + 'defined', bind(this, function (value) {
135.969 + this.init([], function () { return value; }, null, {
135.970 + enabled: true,
135.971 + ignore: true
135.972 + });
135.973 + }));
135.974 +
135.975 + normalizedMod = getOwn(registry, normalizedMap.id);
135.976 + if (normalizedMod) {
135.977 + //Mark this as a dependency for this plugin, so it
135.978 + //can be traced for cycles.
135.979 + this.depMaps.push(normalizedMap);
135.980 +
135.981 + if (this.events.error) {
135.982 + normalizedMod.on('error', bind(this, function (err) {
135.983 + this.emit('error', err);
135.984 + }));
135.985 + }
135.986 + normalizedMod.enable();
135.987 + }
135.988 +
135.989 + return;
135.990 + }
135.991 +
135.992 + load = bind(this, function (value) {
135.993 + this.init([], function () { return value; }, null, {
135.994 + enabled: true
135.995 + });
135.996 + });
135.997 +
135.998 + load.error = bind(this, function (err) {
135.999 + this.inited = true;
135.1000 + this.error = err;
135.1001 + err.requireModules = [id];
135.1002 +
135.1003 + //Remove temp unnormalized modules for this module,
135.1004 + //since they will never be resolved otherwise now.
135.1005 + eachProp(registry, function (mod) {
135.1006 + if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
135.1007 + cleanRegistry(mod.map.id);
135.1008 + }
135.1009 + });
135.1010 +
135.1011 + onError(err);
135.1012 + });
135.1013 +
135.1014 + //Allow plugins to load other code without having to know the
135.1015 + //context or how to 'complete' the load.
135.1016 + load.fromText = bind(this, function (text, textAlt) {
135.1017 + /*jslint evil: true */
135.1018 + var moduleName = map.name,
135.1019 + moduleMap = makeModuleMap(moduleName),
135.1020 + hasInteractive = useInteractive;
135.1021 +
135.1022 + //As of 2.1.0, support just passing the text, to reinforce
135.1023 + //fromText only being called once per resource. Still
135.1024 + //support old style of passing moduleName but discard
135.1025 + //that moduleName in favor of the internal ref.
135.1026 + if (textAlt) {
135.1027 + text = textAlt;
135.1028 + }
135.1029 +
135.1030 + //Turn off interactive script matching for IE for any define
135.1031 + //calls in the text, then turn it back on at the end.
135.1032 + if (hasInteractive) {
135.1033 + useInteractive = false;
135.1034 + }
135.1035 +
135.1036 + //Prime the system by creating a module instance for
135.1037 + //it.
135.1038 + getModule(moduleMap);
135.1039 +
135.1040 + //Transfer any config to this other module.
135.1041 + if (hasProp(config.config, id)) {
135.1042 + config.config[moduleName] = config.config[id];
135.1043 + }
135.1044 +
135.1045 + try {
135.1046 + req.exec(text);
135.1047 + } catch (e) {
135.1048 + return onError(makeError('fromtexteval',
135.1049 + 'fromText eval for ' + id +
135.1050 + ' failed: ' + e,
135.1051 + e,
135.1052 + [id]));
135.1053 + }
135.1054 +
135.1055 + if (hasInteractive) {
135.1056 + useInteractive = true;
135.1057 + }
135.1058 +
135.1059 + //Mark this as a dependency for the plugin
135.1060 + //resource
135.1061 + this.depMaps.push(moduleMap);
135.1062 +
135.1063 + //Support anonymous modules.
135.1064 + context.completeLoad(moduleName);
135.1065 +
135.1066 + //Bind the value of that module to the value for this
135.1067 + //resource ID.
135.1068 + localRequire([moduleName], load);
135.1069 + });
135.1070 +
135.1071 + //Use parentName here since the plugin's name is not reliable,
135.1072 + //could be some weird string with no path that actually wants to
135.1073 + //reference the parentName's path.
135.1074 + plugin.load(map.name, localRequire, load, config);
135.1075 + }));
135.1076 +
135.1077 + context.enable(pluginMap, this);
135.1078 + this.pluginMaps[pluginMap.id] = pluginMap;
135.1079 + },
135.1080 +
135.1081 + enable: function () {
135.1082 + enabledRegistry[this.map.id] = this;
135.1083 + this.enabled = true;
135.1084 +
135.1085 + //Set flag mentioning that the module is enabling,
135.1086 + //so that immediate calls to the defined callbacks
135.1087 + //for dependencies do not trigger inadvertent load
135.1088 + //with the depCount still being zero.
135.1089 + this.enabling = true;
135.1090 +
135.1091 + //Enable each dependency
135.1092 + each(this.depMaps, bind(this, function (depMap, i) {
135.1093 + var id, mod, handler;
135.1094 +
135.1095 + if (typeof depMap === 'string') {
135.1096 + //Dependency needs to be converted to a depMap
135.1097 + //and wired up to this module.
135.1098 + depMap = makeModuleMap(depMap,
135.1099 + (this.map.isDefine ? this.map : this.map.parentMap),
135.1100 + false,
135.1101 + !this.skipMap);
135.1102 + this.depMaps[i] = depMap;
135.1103 +
135.1104 + handler = getOwn(handlers, depMap.id);
135.1105 +
135.1106 + if (handler) {
135.1107 + this.depExports[i] = handler(this);
135.1108 + return;
135.1109 + }
135.1110 +
135.1111 + this.depCount += 1;
135.1112 +
135.1113 + on(depMap, 'defined', bind(this, function (depExports) {
135.1114 + this.defineDep(i, depExports);
135.1115 + this.check();
135.1116 + }));
135.1117 +
135.1118 + if (this.errback) {
135.1119 + on(depMap, 'error', bind(this, this.errback));
135.1120 + }
135.1121 + }
135.1122 +
135.1123 + id = depMap.id;
135.1124 + mod = registry[id];
135.1125 +
135.1126 + //Skip special modules like 'require', 'exports', 'module'
135.1127 + //Also, don't call enable if it is already enabled,
135.1128 + //important in circular dependency cases.
135.1129 + if (!hasProp(handlers, id) && mod && !mod.enabled) {
135.1130 + context.enable(depMap, this);
135.1131 + }
135.1132 + }));
135.1133 +
135.1134 + //Enable each plugin that is used in
135.1135 + //a dependency
135.1136 + eachProp(this.pluginMaps, bind(this, function (pluginMap) {
135.1137 + var mod = getOwn(registry, pluginMap.id);
135.1138 + if (mod && !mod.enabled) {
135.1139 + context.enable(pluginMap, this);
135.1140 + }
135.1141 + }));
135.1142 +
135.1143 + this.enabling = false;
135.1144 +
135.1145 + this.check();
135.1146 + },
135.1147 +
135.1148 + on: function (name, cb) {
135.1149 + var cbs = this.events[name];
135.1150 + if (!cbs) {
135.1151 + cbs = this.events[name] = [];
135.1152 + }
135.1153 + cbs.push(cb);
135.1154 + },
135.1155 +
135.1156 + emit: function (name, evt) {
135.1157 + each(this.events[name], function (cb) {
135.1158 + cb(evt);
135.1159 + });
135.1160 + if (name === 'error') {
135.1161 + //Now that the error handler was triggered, remove
135.1162 + //the listeners, since this broken Module instance
135.1163 + //can stay around for a while in the registry.
135.1164 + delete this.events[name];
135.1165 + }
135.1166 + }
135.1167 + };
135.1168 +
135.1169 + function callGetModule(args) {
135.1170 + //Skip modules already defined.
135.1171 + if (!hasProp(defined, args[0])) {
135.1172 + getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
135.1173 + }
135.1174 + }
135.1175 +
135.1176 + function removeListener(node, func, name, ieName) {
135.1177 + //Favor detachEvent because of IE9
135.1178 + //issue, see attachEvent/addEventListener comment elsewhere
135.1179 + //in this file.
135.1180 + if (node.detachEvent && !isOpera) {
135.1181 + //Probably IE. If not it will throw an error, which will be
135.1182 + //useful to know.
135.1183 + if (ieName) {
135.1184 + node.detachEvent(ieName, func);
135.1185 + }
135.1186 + } else {
135.1187 + node.removeEventListener(name, func, false);
135.1188 + }
135.1189 + }
135.1190 +
135.1191 + /**
135.1192 + * Given an event from a script node, get the requirejs info from it,
135.1193 + * and then removes the event listeners on the node.
135.1194 + * @param {Event} evt
135.1195 + * @returns {Object}
135.1196 + */
135.1197 + function getScriptData(evt) {
135.1198 + //Using currentTarget instead of target for Firefox 2.0's sake. Not
135.1199 + //all old browsers will be supported, but this one was easy enough
135.1200 + //to support and still makes sense.
135.1201 + var node = evt.currentTarget || evt.srcElement;
135.1202 +
135.1203 + //Remove the listeners once here.
135.1204 + removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
135.1205 + removeListener(node, context.onScriptError, 'error');
135.1206 +
135.1207 + return {
135.1208 + node: node,
135.1209 + id: node && node.getAttribute('data-requiremodule')
135.1210 + };
135.1211 + }
135.1212 +
135.1213 + function intakeDefines() {
135.1214 + var args;
135.1215 +
135.1216 + //Any defined modules in the global queue, intake them now.
135.1217 + takeGlobalQueue();
135.1218 +
135.1219 + //Make sure any remaining defQueue items get properly processed.
135.1220 + while (defQueue.length) {
135.1221 + args = defQueue.shift();
135.1222 + if (args[0] === null) {
135.1223 + return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
135.1224 + } else {
135.1225 + //args are id, deps, factory. Should be normalized by the
135.1226 + //define() function.
135.1227 + callGetModule(args);
135.1228 + }
135.1229 + }
135.1230 + }
135.1231 +
135.1232 + context = {
135.1233 + config: config,
135.1234 + contextName: contextName,
135.1235 + registry: registry,
135.1236 + defined: defined,
135.1237 + urlFetched: urlFetched,
135.1238 + defQueue: defQueue,
135.1239 + Module: Module,
135.1240 + makeModuleMap: makeModuleMap,
135.1241 + nextTick: req.nextTick,
135.1242 + onError: onError,
135.1243 +
135.1244 + /**
135.1245 + * Set a configuration for the context.
135.1246 + * @param {Object} cfg config object to integrate.
135.1247 + */
135.1248 + configure: function (cfg) {
135.1249 + //Make sure the baseUrl ends in a slash.
135.1250 + if (cfg.baseUrl) {
135.1251 + if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
135.1252 + cfg.baseUrl += '/';
135.1253 + }
135.1254 + }
135.1255 +
135.1256 + //Save off the paths and packages since they require special processing,
135.1257 + //they are additive.
135.1258 + var pkgs = config.pkgs,
135.1259 + shim = config.shim,
135.1260 + objs = {
135.1261 + paths: true,
135.1262 + config: true,
135.1263 + map: true
135.1264 + };
135.1265 +
135.1266 + eachProp(cfg, function (value, prop) {
135.1267 + if (objs[prop]) {
135.1268 + if (prop === 'map') {
135.1269 + if (!config.map) {
135.1270 + config.map = {};
135.1271 + }
135.1272 + mixin(config[prop], value, true, true);
135.1273 + } else {
135.1274 + mixin(config[prop], value, true);
135.1275 + }
135.1276 + } else {
135.1277 + config[prop] = value;
135.1278 + }
135.1279 + });
135.1280 +
135.1281 + //Merge shim
135.1282 + if (cfg.shim) {
135.1283 + eachProp(cfg.shim, function (value, id) {
135.1284 + //Normalize the structure
135.1285 + if (isArray(value)) {
135.1286 + value = {
135.1287 + deps: value
135.1288 + };
135.1289 + }
135.1290 + if ((value.exports || value.init) && !value.exportsFn) {
135.1291 + value.exportsFn = context.makeShimExports(value);
135.1292 + }
135.1293 + shim[id] = value;
135.1294 + });
135.1295 + config.shim = shim;
135.1296 + }
135.1297 +
135.1298 + //Adjust packages if necessary.
135.1299 + if (cfg.packages) {
135.1300 + each(cfg.packages, function (pkgObj) {
135.1301 + var location;
135.1302 +
135.1303 + pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
135.1304 + location = pkgObj.location;
135.1305 +
135.1306 + //Create a brand new object on pkgs, since currentPackages can
135.1307 + //be passed in again, and config.pkgs is the internal transformed
135.1308 + //state for all package configs.
135.1309 + pkgs[pkgObj.name] = {
135.1310 + name: pkgObj.name,
135.1311 + location: location || pkgObj.name,
135.1312 + //Remove leading dot in main, so main paths are normalized,
135.1313 + //and remove any trailing .js, since different package
135.1314 + //envs have different conventions: some use a module name,
135.1315 + //some use a file name.
135.1316 + main: (pkgObj.main || 'main')
135.1317 + .replace(currDirRegExp, '')
135.1318 + .replace(jsSuffixRegExp, '')
135.1319 + };
135.1320 + });
135.1321 +
135.1322 + //Done with modifications, assing packages back to context config
135.1323 + config.pkgs = pkgs;
135.1324 + }
135.1325 +
135.1326 + //If there are any "waiting to execute" modules in the registry,
135.1327 + //update the maps for them, since their info, like URLs to load,
135.1328 + //may have changed.
135.1329 + eachProp(registry, function (mod, id) {
135.1330 + //If module already has init called, since it is too
135.1331 + //late to modify them, and ignore unnormalized ones
135.1332 + //since they are transient.
135.1333 + if (!mod.inited && !mod.map.unnormalized) {
135.1334 + mod.map = makeModuleMap(id);
135.1335 + }
135.1336 + });
135.1337 +
135.1338 + //If a deps array or a config callback is specified, then call
135.1339 + //require with those args. This is useful when require is defined as a
135.1340 + //config object before require.js is loaded.
135.1341 + if (cfg.deps || cfg.callback) {
135.1342 + context.require(cfg.deps || [], cfg.callback);
135.1343 + }
135.1344 + },
135.1345 +
135.1346 + makeShimExports: function (value) {
135.1347 + function fn() {
135.1348 + var ret;
135.1349 + if (value.init) {
135.1350 + ret = value.init.apply(global, arguments);
135.1351 + }
135.1352 + return ret || (value.exports && getGlobal(value.exports));
135.1353 + }
135.1354 + return fn;
135.1355 + },
135.1356 +
135.1357 + makeRequire: function (relMap, options) {
135.1358 + options = options || {};
135.1359 +
135.1360 + function localRequire(deps, callback, errback) {
135.1361 + var id, map, requireMod;
135.1362 +
135.1363 + if (options.enableBuildCallback && callback && isFunction(callback)) {
135.1364 + callback.__requireJsBuild = true;
135.1365 + }
135.1366 +
135.1367 + if (typeof deps === 'string') {
135.1368 + if (isFunction(callback)) {
135.1369 + //Invalid call
135.1370 + return onError(makeError('requireargs', 'Invalid require call'), errback);
135.1371 + }
135.1372 +
135.1373 + //If require|exports|module are requested, get the
135.1374 + //value for them from the special handlers. Caveat:
135.1375 + //this only works while module is being defined.
135.1376 + if (relMap && hasProp(handlers, deps)) {
135.1377 + return handlers[deps](registry[relMap.id]);
135.1378 + }
135.1379 +
135.1380 + //Synchronous access to one module. If require.get is
135.1381 + //available (as in the Node adapter), prefer that.
135.1382 + if (req.get) {
135.1383 + return req.get(context, deps, relMap, localRequire);
135.1384 + }
135.1385 +
135.1386 + //Normalize module name, if it contains . or ..
135.1387 + map = makeModuleMap(deps, relMap, false, true);
135.1388 + id = map.id;
135.1389 +
135.1390 + if (!hasProp(defined, id)) {
135.1391 + return onError(makeError('notloaded', 'Module name "' +
135.1392 + id +
135.1393 + '" has not been loaded yet for context: ' +
135.1394 + contextName +
135.1395 + (relMap ? '' : '. Use require([])')));
135.1396 + }
135.1397 + return defined[id];
135.1398 + }
135.1399 +
135.1400 + //Grab defines waiting in the global queue.
135.1401 + intakeDefines();
135.1402 +
135.1403 + //Mark all the dependencies as needing to be loaded.
135.1404 + context.nextTick(function () {
135.1405 + //Some defines could have been added since the
135.1406 + //require call, collect them.
135.1407 + intakeDefines();
135.1408 +
135.1409 + requireMod = getModule(makeModuleMap(null, relMap));
135.1410 +
135.1411 + //Store if map config should be applied to this require
135.1412 + //call for dependencies.
135.1413 + requireMod.skipMap = options.skipMap;
135.1414 +
135.1415 + requireMod.init(deps, callback, errback, {
135.1416 + enabled: true
135.1417 + });
135.1418 +
135.1419 + checkLoaded();
135.1420 + });
135.1421 +
135.1422 + return localRequire;
135.1423 + }
135.1424 +
135.1425 + mixin(localRequire, {
135.1426 + isBrowser: isBrowser,
135.1427 +
135.1428 + /**
135.1429 + * Converts a module name + .extension into an URL path.
135.1430 + * *Requires* the use of a module name. It does not support using
135.1431 + * plain URLs like nameToUrl.
135.1432 + */
135.1433 + toUrl: function (moduleNamePlusExt) {
135.1434 + var ext,
135.1435 + index = moduleNamePlusExt.lastIndexOf('.'),
135.1436 + segment = moduleNamePlusExt.split('/')[0],
135.1437 + isRelative = segment === '.' || segment === '..';
135.1438 +
135.1439 + //Have a file extension alias, and it is not the
135.1440 + //dots from a relative path.
135.1441 + if (index !== -1 && (!isRelative || index > 1)) {
135.1442 + ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
135.1443 + moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
135.1444 + }
135.1445 +
135.1446 + return context.nameToUrl(normalize(moduleNamePlusExt,
135.1447 + relMap && relMap.id, true), ext, true);
135.1448 + },
135.1449 +
135.1450 + defined: function (id) {
135.1451 + return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
135.1452 + },
135.1453 +
135.1454 + specified: function (id) {
135.1455 + id = makeModuleMap(id, relMap, false, true).id;
135.1456 + return hasProp(defined, id) || hasProp(registry, id);
135.1457 + }
135.1458 + });
135.1459 +
135.1460 + //Only allow undef on top level require calls
135.1461 + if (!relMap) {
135.1462 + localRequire.undef = function (id) {
135.1463 + //Bind any waiting define() calls to this context,
135.1464 + //fix for #408
135.1465 + takeGlobalQueue();
135.1466 +
135.1467 + var map = makeModuleMap(id, relMap, true),
135.1468 + mod = getOwn(registry, id);
135.1469 +
135.1470 + delete defined[id];
135.1471 + delete urlFetched[map.url];
135.1472 + delete undefEvents[id];
135.1473 +
135.1474 + if (mod) {
135.1475 + //Hold on to listeners in case the
135.1476 + //module will be attempted to be reloaded
135.1477 + //using a different config.
135.1478 + if (mod.events.defined) {
135.1479 + undefEvents[id] = mod.events;
135.1480 + }
135.1481 +
135.1482 + cleanRegistry(id);
135.1483 + }
135.1484 + };
135.1485 + }
135.1486 +
135.1487 + return localRequire;
135.1488 + },
135.1489 +
135.1490 + /**
135.1491 + * Called to enable a module if it is still in the registry
135.1492 + * awaiting enablement. A second arg, parent, the parent module,
135.1493 + * is passed in for context, when this method is overriden by
135.1494 + * the optimizer. Not shown here to keep code compact.
135.1495 + */
135.1496 + enable: function (depMap) {
135.1497 + var mod = getOwn(registry, depMap.id);
135.1498 + if (mod) {
135.1499 + getModule(depMap).enable();
135.1500 + }
135.1501 + },
135.1502 +
135.1503 + /**
135.1504 + * Internal method used by environment adapters to complete a load event.
135.1505 + * A load event could be a script load or just a load pass from a synchronous
135.1506 + * load call.
135.1507 + * @param {String} moduleName the name of the module to potentially complete.
135.1508 + */
135.1509 + completeLoad: function (moduleName) {
135.1510 + var found, args, mod,
135.1511 + shim = getOwn(config.shim, moduleName) || {},
135.1512 + shExports = shim.exports;
135.1513 +
135.1514 + takeGlobalQueue();
135.1515 +
135.1516 + while (defQueue.length) {
135.1517 + args = defQueue.shift();
135.1518 + if (args[0] === null) {
135.1519 + args[0] = moduleName;
135.1520 + //If already found an anonymous module and bound it
135.1521 + //to this name, then this is some other anon module
135.1522 + //waiting for its completeLoad to fire.
135.1523 + if (found) {
135.1524 + break;
135.1525 + }
135.1526 + found = true;
135.1527 + } else if (args[0] === moduleName) {
135.1528 + //Found matching define call for this script!
135.1529 + found = true;
135.1530 + }
135.1531 +
135.1532 + callGetModule(args);
135.1533 + }
135.1534 +
135.1535 + //Do this after the cycle of callGetModule in case the result
135.1536 + //of those calls/init calls changes the registry.
135.1537 + mod = getOwn(registry, moduleName);
135.1538 +
135.1539 + if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
135.1540 + if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
135.1541 + if (hasPathFallback(moduleName)) {
135.1542 + return;
135.1543 + } else {
135.1544 + return onError(makeError('nodefine',
135.1545 + 'No define call for ' + moduleName,
135.1546 + null,
135.1547 + [moduleName]));
135.1548 + }
135.1549 + } else {
135.1550 + //A script that does not call define(), so just simulate
135.1551 + //the call for it.
135.1552 + callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
135.1553 + }
135.1554 + }
135.1555 +
135.1556 + checkLoaded();
135.1557 + },
135.1558 +
135.1559 + /**
135.1560 + * Converts a module name to a file path. Supports cases where
135.1561 + * moduleName may actually be just an URL.
135.1562 + * Note that it **does not** call normalize on the moduleName,
135.1563 + * it is assumed to have already been normalized. This is an
135.1564 + * internal API, not a public one. Use toUrl for the public API.
135.1565 + */
135.1566 + nameToUrl: function (moduleName, ext, skipExt) {
135.1567 + var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
135.1568 + parentPath;
135.1569 +
135.1570 + //If a colon is in the URL, it indicates a protocol is used and it is just
135.1571 + //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
135.1572 + //or ends with .js, then assume the user meant to use an url and not a module id.
135.1573 + //The slash is important for protocol-less URLs as well as full paths.
135.1574 + if (req.jsExtRegExp.test(moduleName)) {
135.1575 + //Just a plain path, not module name lookup, so just return it.
135.1576 + //Add extension if it is included. This is a bit wonky, only non-.js things pass
135.1577 + //an extension, this method probably needs to be reworked.
135.1578 + url = moduleName + (ext || '');
135.1579 + } else {
135.1580 + //A module that needs to be converted to a path.
135.1581 + paths = config.paths;
135.1582 + pkgs = config.pkgs;
135.1583 +
135.1584 + syms = moduleName.split('/');
135.1585 + //For each module name segment, see if there is a path
135.1586 + //registered for it. Start with most specific name
135.1587 + //and work up from it.
135.1588 + for (i = syms.length; i > 0; i -= 1) {
135.1589 + parentModule = syms.slice(0, i).join('/');
135.1590 + pkg = getOwn(pkgs, parentModule);
135.1591 + parentPath = getOwn(paths, parentModule);
135.1592 + if (parentPath) {
135.1593 + //If an array, it means there are a few choices,
135.1594 + //Choose the one that is desired
135.1595 + if (isArray(parentPath)) {
135.1596 + parentPath = parentPath[0];
135.1597 + }
135.1598 + syms.splice(0, i, parentPath);
135.1599 + break;
135.1600 + } else if (pkg) {
135.1601 + //If module name is just the package name, then looking
135.1602 + //for the main module.
135.1603 + if (moduleName === pkg.name) {
135.1604 + pkgPath = pkg.location + '/' + pkg.main;
135.1605 + } else {
135.1606 + pkgPath = pkg.location;
135.1607 + }
135.1608 + syms.splice(0, i, pkgPath);
135.1609 + break;
135.1610 + }
135.1611 + }
135.1612 +
135.1613 + //Join the path parts together, then figure out if baseUrl is needed.
135.1614 + url = syms.join('/');
135.1615 + url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
135.1616 + url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
135.1617 + }
135.1618 +
135.1619 + return config.urlArgs ? url +
135.1620 + ((url.indexOf('?') === -1 ? '?' : '&') +
135.1621 + config.urlArgs) : url;
135.1622 + },
135.1623 +
135.1624 + //Delegates to req.load. Broken out as a separate function to
135.1625 + //allow overriding in the optimizer.
135.1626 + load: function (id, url) {
135.1627 + req.load(context, id, url);
135.1628 + },
135.1629 +
135.1630 + /**
135.1631 + * Executes a module callback function. Broken out as a separate function
135.1632 + * solely to allow the build system to sequence the files in the built
135.1633 + * layer in the right sequence.
135.1634 + *
135.1635 + * @private
135.1636 + */
135.1637 + execCb: function (name, callback, args, exports) {
135.1638 + return callback.apply(exports, args);
135.1639 + },
135.1640 +
135.1641 + /**
135.1642 + * callback for script loads, used to check status of loading.
135.1643 + *
135.1644 + * @param {Event} evt the event from the browser for the script
135.1645 + * that was loaded.
135.1646 + */
135.1647 + onScriptLoad: function (evt) {
135.1648 + //Using currentTarget instead of target for Firefox 2.0's sake. Not
135.1649 + //all old browsers will be supported, but this one was easy enough
135.1650 + //to support and still makes sense.
135.1651 + if (evt.type === 'load' ||
135.1652 + (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
135.1653 + //Reset interactive script so a script node is not held onto for
135.1654 + //to long.
135.1655 + interactiveScript = null;
135.1656 +
135.1657 + //Pull out the name of the module and the context.
135.1658 + var data = getScriptData(evt);
135.1659 + context.completeLoad(data.id);
135.1660 + }
135.1661 + },
135.1662 +
135.1663 + /**
135.1664 + * Callback for script errors.
135.1665 + */
135.1666 + onScriptError: function (evt) {
135.1667 + var data = getScriptData(evt);
135.1668 + if (!hasPathFallback(data.id)) {
135.1669 + return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id]));
135.1670 + }
135.1671 + }
135.1672 + };
135.1673 +
135.1674 + context.require = context.makeRequire();
135.1675 + return context;
135.1676 + }
135.1677 +
135.1678 + /**
135.1679 + * Main entry point.
135.1680 + *
135.1681 + * If the only argument to require is a string, then the module that
135.1682 + * is represented by that string is fetched for the appropriate context.
135.1683 + *
135.1684 + * If the first argument is an array, then it will be treated as an array
135.1685 + * of dependency string names to fetch. An optional function callback can
135.1686 + * be specified to execute when all of those dependencies are available.
135.1687 + *
135.1688 + * Make a local req variable to help Caja compliance (it assumes things
135.1689 + * on a require that are not standardized), and to give a short
135.1690 + * name for minification/local scope use.
135.1691 + */
135.1692 + req = requirejs = function (deps, callback, errback, optional) {
135.1693 +
135.1694 + //Find the right context, use default
135.1695 + var context, config,
135.1696 + contextName = defContextName;
135.1697 +
135.1698 + // Determine if have config object in the call.
135.1699 + if (!isArray(deps) && typeof deps !== 'string') {
135.1700 + // deps is a config object
135.1701 + config = deps;
135.1702 + if (isArray(callback)) {
135.1703 + // Adjust args if there are dependencies
135.1704 + deps = callback;
135.1705 + callback = errback;
135.1706 + errback = optional;
135.1707 + } else {
135.1708 + deps = [];
135.1709 + }
135.1710 + }
135.1711 +
135.1712 + if (config && config.context) {
135.1713 + contextName = config.context;
135.1714 + }
135.1715 +
135.1716 + context = getOwn(contexts, contextName);
135.1717 + if (!context) {
135.1718 + context = contexts[contextName] = req.s.newContext(contextName);
135.1719 + }
135.1720 +
135.1721 + if (config) {
135.1722 + context.configure(config);
135.1723 + }
135.1724 +
135.1725 + return context.require(deps, callback, errback);
135.1726 + };
135.1727 +
135.1728 + /**
135.1729 + * Support require.config() to make it easier to cooperate with other
135.1730 + * AMD loaders on globally agreed names.
135.1731 + */
135.1732 + req.config = function (config) {
135.1733 + return req(config);
135.1734 + };
135.1735 +
135.1736 + /**
135.1737 + * Execute something after the current tick
135.1738 + * of the event loop. Override for other envs
135.1739 + * that have a better solution than setTimeout.
135.1740 + * @param {Function} fn function to execute later.
135.1741 + */
135.1742 + req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
135.1743 + setTimeout(fn, 4);
135.1744 + } : function (fn) { fn(); };
135.1745 +
135.1746 + /**
135.1747 + * Export require as a global, but only if it does not already exist.
135.1748 + */
135.1749 + if (!require) {
135.1750 + require = req;
135.1751 + }
135.1752 +
135.1753 + req.version = version;
135.1754 +
135.1755 + //Used to filter out dependencies that are already paths.
135.1756 + req.jsExtRegExp = /^\/|:|\?|\.js$/;
135.1757 + req.isBrowser = isBrowser;
135.1758 + s = req.s = {
135.1759 + contexts: contexts,
135.1760 + newContext: newContext
135.1761 + };
135.1762 +
135.1763 + //Create default context.
135.1764 + req({});
135.1765 +
135.1766 + //Exports some context-sensitive methods on global require.
135.1767 + each([
135.1768 + 'toUrl',
135.1769 + 'undef',
135.1770 + 'defined',
135.1771 + 'specified'
135.1772 + ], function (prop) {
135.1773 + //Reference from contexts instead of early binding to default context,
135.1774 + //so that during builds, the latest instance of the default context
135.1775 + //with its config gets used.
135.1776 + req[prop] = function () {
135.1777 + var ctx = contexts[defContextName];
135.1778 + return ctx.require[prop].apply(ctx, arguments);
135.1779 + };
135.1780 + });
135.1781 +
135.1782 + if (isBrowser) {
135.1783 + head = s.head = document.getElementsByTagName('head')[0];
135.1784 + //If BASE tag is in play, using appendChild is a problem for IE6.
135.1785 + //When that browser dies, this can be removed. Details in this jQuery bug:
135.1786 + //http://dev.jquery.com/ticket/2709
135.1787 + baseElement = document.getElementsByTagName('base')[0];
135.1788 + if (baseElement) {
135.1789 + head = s.head = baseElement.parentNode;
135.1790 + }
135.1791 + }
135.1792 +
135.1793 + /**
135.1794 + * Any errors that require explicitly generates will be passed to this
135.1795 + * function. Intercept/override it if you want custom error handling.
135.1796 + * @param {Error} err the error object.
135.1797 + */
135.1798 + req.onError = defaultOnError;
135.1799 +
135.1800 + /**
135.1801 + * Creates the node for the load command. Only used in browser envs.
135.1802 + */
135.1803 + req.createNode = function (config, moduleName, url) {
135.1804 + var node = config.xhtml ?
135.1805 + document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
135.1806 + document.createElement('script');
135.1807 + node.type = config.scriptType || 'text/javascript';
135.1808 + node.charset = 'utf-8';
135.1809 + node.async = true;
135.1810 + return node;
135.1811 + };
135.1812 +
135.1813 + /**
135.1814 + * Does the request to load a module for the browser case.
135.1815 + * Make this a separate function to allow other environments
135.1816 + * to override it.
135.1817 + *
135.1818 + * @param {Object} context the require context to find state.
135.1819 + * @param {String} moduleName the name of the module.
135.1820 + * @param {Object} url the URL to the module.
135.1821 + */
135.1822 + req.load = function (context, moduleName, url) {
135.1823 + var config = (context && context.config) || {},
135.1824 + node;
135.1825 + if (isBrowser) {
135.1826 + //In the browser so use a script tag
135.1827 + node = req.createNode(config, moduleName, url);
135.1828 +
135.1829 + node.setAttribute('data-requirecontext', context.contextName);
135.1830 + node.setAttribute('data-requiremodule', moduleName);
135.1831 +
135.1832 + //Set up load listener. Test attachEvent first because IE9 has
135.1833 + //a subtle issue in its addEventListener and script onload firings
135.1834 + //that do not match the behavior of all other browsers with
135.1835 + //addEventListener support, which fire the onload event for a
135.1836 + //script right after the script execution. See:
135.1837 + //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
135.1838 + //UNFORTUNATELY Opera implements attachEvent but does not follow the script
135.1839 + //script execution mode.
135.1840 + if (node.attachEvent &&
135.1841 + //Check if node.attachEvent is artificially added by custom script or
135.1842 + //natively supported by browser
135.1843 + //read https://github.com/jrburke/requirejs/issues/187
135.1844 + //if we can NOT find [native code] then it must NOT natively supported.
135.1845 + //in IE8, node.attachEvent does not have toString()
135.1846 + //Note the test for "[native code" with no closing brace, see:
135.1847 + //https://github.com/jrburke/requirejs/issues/273
135.1848 + !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
135.1849 + !isOpera) {
135.1850 + //Probably IE. IE (at least 6-8) do not fire
135.1851 + //script onload right after executing the script, so
135.1852 + //we cannot tie the anonymous define call to a name.
135.1853 + //However, IE reports the script as being in 'interactive'
135.1854 + //readyState at the time of the define call.
135.1855 + useInteractive = true;
135.1856 +
135.1857 + node.attachEvent('onreadystatechange', context.onScriptLoad);
135.1858 + //It would be great to add an error handler here to catch
135.1859 + //404s in IE9+. However, onreadystatechange will fire before
135.1860 + //the error handler, so that does not help. If addEventListener
135.1861 + //is used, then IE will fire error before load, but we cannot
135.1862 + //use that pathway given the connect.microsoft.com issue
135.1863 + //mentioned above about not doing the 'script execute,
135.1864 + //then fire the script load event listener before execute
135.1865 + //next script' that other browsers do.
135.1866 + //Best hope: IE10 fixes the issues,
135.1867 + //and then destroys all installs of IE 6-9.
135.1868 + //node.attachEvent('onerror', context.onScriptError);
135.1869 + } else {
135.1870 + node.addEventListener('load', context.onScriptLoad, false);
135.1871 + node.addEventListener('error', context.onScriptError, false);
135.1872 + }
135.1873 + node.src = url;
135.1874 +
135.1875 + //For some cache cases in IE 6-8, the script executes before the end
135.1876 + //of the appendChild execution, so to tie an anonymous define
135.1877 + //call to the module name (which is stored on the node), hold on
135.1878 + //to a reference to this node, but clear after the DOM insertion.
135.1879 + currentlyAddingScript = node;
135.1880 + if (baseElement) {
135.1881 + head.insertBefore(node, baseElement);
135.1882 + } else {
135.1883 + head.appendChild(node);
135.1884 + }
135.1885 + currentlyAddingScript = null;
135.1886 +
135.1887 + return node;
135.1888 + } else if (isWebWorker) {
135.1889 + try {
135.1890 + //In a web worker, use importScripts. This is not a very
135.1891 + //efficient use of importScripts, importScripts will block until
135.1892 + //its script is downloaded and evaluated. However, if web workers
135.1893 + //are in play, the expectation that a build has been done so that
135.1894 + //only one script needs to be loaded anyway. This may need to be
135.1895 + //reevaluated if other use cases become common.
135.1896 + importScripts(url);
135.1897 +
135.1898 + //Account for anonymous modules
135.1899 + context.completeLoad(moduleName);
135.1900 + } catch (e) {
135.1901 + context.onError(makeError('importscripts',
135.1902 + 'importScripts failed for ' +
135.1903 + moduleName + ' at ' + url,
135.1904 + e,
135.1905 + [moduleName]));
135.1906 + }
135.1907 + }
135.1908 + };
135.1909 +
135.1910 + function getInteractiveScript() {
135.1911 + if (interactiveScript && interactiveScript.readyState === 'interactive') {
135.1912 + return interactiveScript;
135.1913 + }
135.1914 +
135.1915 + eachReverse(scripts(), function (script) {
135.1916 + if (script.readyState === 'interactive') {
135.1917 + return (interactiveScript = script);
135.1918 + }
135.1919 + });
135.1920 + return interactiveScript;
135.1921 + }
135.1922 +
135.1923 + //Look for a data-main script attribute, which could also adjust the baseUrl.
135.1924 + if (isBrowser) {
135.1925 + //Figure out baseUrl. Get it from the script tag with require.js in it.
135.1926 + eachReverse(scripts(), function (script) {
135.1927 + //Set the 'head' where we can append children by
135.1928 + //using the script's parent.
135.1929 + if (!head) {
135.1930 + head = script.parentNode;
135.1931 + }
135.1932 +
135.1933 + //Look for a data-main attribute to set main script for the page
135.1934 + //to load. If it is there, the path to data main becomes the
135.1935 + //baseUrl, if it is not already set.
135.1936 + dataMain = script.getAttribute('data-main');
135.1937 + if (dataMain) {
135.1938 + //Preserve dataMain in case it is a path (i.e. contains '?')
135.1939 + mainScript = dataMain;
135.1940 +
135.1941 + //Set final baseUrl if there is not already an explicit one.
135.1942 + if (!cfg.baseUrl) {
135.1943 + //Pull off the directory of data-main for use as the
135.1944 + //baseUrl.
135.1945 + src = mainScript.split('/');
135.1946 + mainScript = src.pop();
135.1947 + subPath = src.length ? src.join('/') + '/' : './';
135.1948 +
135.1949 + cfg.baseUrl = subPath;
135.1950 + }
135.1951 +
135.1952 + //Strip off any trailing .js since mainScript is now
135.1953 + //like a module name.
135.1954 + mainScript = mainScript.replace(jsSuffixRegExp, '');
135.1955 +
135.1956 + //If mainScript is still a path, fall back to dataMain
135.1957 + if (req.jsExtRegExp.test(mainScript)) {
135.1958 + mainScript = dataMain;
135.1959 + }
135.1960 +
135.1961 + //Put the data-main script in the files to load.
135.1962 + cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
135.1963 +
135.1964 + return true;
135.1965 + }
135.1966 + });
135.1967 + }
135.1968 +
135.1969 + /**
135.1970 + * The function that handles definitions of modules. Differs from
135.1971 + * require() in that a string for the module should be the first argument,
135.1972 + * and the function to execute after dependencies are loaded should
135.1973 + * return a value to define the module corresponding to the first argument's
135.1974 + * name.
135.1975 + */
135.1976 + define = function (name, deps, callback) {
135.1977 + var node, context;
135.1978 +
135.1979 + //Allow for anonymous modules
135.1980 + if (typeof name !== 'string') {
135.1981 + //Adjust args appropriately
135.1982 + callback = deps;
135.1983 + deps = name;
135.1984 + name = null;
135.1985 + }
135.1986 +
135.1987 + //This module may not have dependencies
135.1988 + if (!isArray(deps)) {
135.1989 + callback = deps;
135.1990 + deps = null;
135.1991 + }
135.1992 +
135.1993 + //If no name, and callback is a function, then figure out if it a
135.1994 + //CommonJS thing with dependencies.
135.1995 + if (!deps && isFunction(callback)) {
135.1996 + deps = [];
135.1997 + //Remove comments from the callback string,
135.1998 + //look for require calls, and pull them into the dependencies,
135.1999 + //but only if there are function args.
135.2000 + if (callback.length) {
135.2001 + callback
135.2002 + .toString()
135.2003 + .replace(commentRegExp, '')
135.2004 + .replace(cjsRequireRegExp, function (match, dep) {
135.2005 + deps.push(dep);
135.2006 + });
135.2007 +
135.2008 + //May be a CommonJS thing even without require calls, but still
135.2009 + //could use exports, and module. Avoid doing exports and module
135.2010 + //work though if it just needs require.
135.2011 + //REQUIRES the function to expect the CommonJS variables in the
135.2012 + //order listed below.
135.2013 + deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
135.2014 + }
135.2015 + }
135.2016 +
135.2017 + //If in IE 6-8 and hit an anonymous define() call, do the interactive
135.2018 + //work.
135.2019 + if (useInteractive) {
135.2020 + node = currentlyAddingScript || getInteractiveScript();
135.2021 + if (node) {
135.2022 + if (!name) {
135.2023 + name = node.getAttribute('data-requiremodule');
135.2024 + }
135.2025 + context = contexts[node.getAttribute('data-requirecontext')];
135.2026 + }
135.2027 + }
135.2028 +
135.2029 + //Always save off evaluating the def call until the script onload handler.
135.2030 + //This allows multiple modules to be in a file without prematurely
135.2031 + //tracing dependencies, and allows for anonymous module support,
135.2032 + //where the module name is not known until the script onload event
135.2033 + //occurs. If no context, use the global queue, and get it processed
135.2034 + //in the onscript load callback.
135.2035 + (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
135.2036 + };
135.2037 +
135.2038 + define.amd = {
135.2039 + jQuery: true
135.2040 + };
135.2041 +
135.2042 +
135.2043 + /**
135.2044 + * Executes the text. Normally just uses eval, but can be modified
135.2045 + * to use a better, environment-specific call. Only used for transpiling
135.2046 + * loader plugins, not for plain JS modules.
135.2047 + * @param {String} text the text to execute/evaluate.
135.2048 + */
135.2049 + req.exec = function (text) {
135.2050 + /*jslint evil: true */
135.2051 + return eval(text);
135.2052 + };
135.2053 +
135.2054 + //Set up with config info.
135.2055 + req(cfg);
135.2056 +}(this));
136.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
136.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/main.js Mon Jun 02 14:23:34 2014 +0200
136.3 @@ -0,0 +1,20 @@
136.4 +requirejs.config({
136.5 + baseUrl: 'js/lib',
136.6 + paths: {
136.7 + app: '../app',
136.8 + piknic: '../picnic'
136.9 + }
136.10 +});
136.11 +
136.12 +requirejs(['moduleLib1',
136.13 + 'js/lib/moduleLib2.js',
136.14 + 'app/moduleApp1',
136.15 + 'proto/localization',
136.16 + 'piknic'],
136.17 + function(lib1, lib2, test, loc, pik) {
136.18 + console.log(lib1.const1);
136.19 + console.log(lib2.const4);
136.20 + console.log(test.second);
136.21 + console.log(pik.date1);
136.22 + console.log(loc.message1);
136.23 +});
136.24 \ No newline at end of file
137.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
137.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/main.js.testFSCompletion01.completion Mon Jun 02 14:23:34 2014 +0200
137.3 @@ -0,0 +1,6 @@
137.4 +Code completion result for source line:
137.5 +requirejs(['modul|eLib1',
137.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
137.7 +------------------------------------
137.8 +FILE moduleLib1.js
137.9 +FILE moduleLib2.js
138.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
138.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/main.js.testFSCompletion02.completion Mon Jun 02 14:23:34 2014 +0200
138.3 @@ -0,0 +1,7 @@
138.4 +Code completion result for source line:
138.5 +'js/|lib/moduleLib2.js',
138.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
138.7 +------------------------------------
138.8 +FILE app
138.9 +FILE lib
138.10 +FILE picnic.js
139.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
139.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/main.js.testFSCompletion03.completion Mon Jun 02 14:23:34 2014 +0200
139.3 @@ -0,0 +1,6 @@
139.4 +Code completion result for source line:
139.5 +'js/lib/moduleL|ib2.js',
139.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
139.7 +------------------------------------
139.8 +FILE moduleLib1.js
139.9 +FILE moduleLib2.js
140.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
140.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/main.js.testFSCompletion04.completion Mon Jun 02 14:23:34 2014 +0200
140.3 @@ -0,0 +1,5 @@
140.4 +Code completion result for source line:
140.5 +'app/module|App1',
140.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
140.7 +------------------------------------
140.8 +FILE moduleApp1.js
141.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
141.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/main.js.testFSCompletion06.completion Mon Jun 02 14:23:34 2014 +0200
141.3 @@ -0,0 +1,8 @@
141.4 +Code completion result for source line:
141.5 +'p|roto/localization',
141.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
141.7 +------------------------------------
141.8 +CLASS prototype [PUBLIC] require.js
141.9 +FILE picnic.js
141.10 +FILE piknic
141.11 +FILE proto
142.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
142.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/main.js.testFSCompletion07.completion Mon Jun 02 14:23:34 2014 +0200
142.3 @@ -0,0 +1,5 @@
142.4 +Code completion result for source line:
142.5 +'proto/loc|alization',
142.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
142.7 +------------------------------------
142.8 +FILE localization.js
143.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
143.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/main.js.testFSCompletion08.completion Mon Jun 02 14:23:34 2014 +0200
143.3 @@ -0,0 +1,5 @@
143.4 +Code completion result for source line:
143.5 +'pikn|ic'],
143.6 +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
143.7 +------------------------------------
143.8 +FILE piknic
144.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
144.2 +++ b/javascript2.requirejs/test/unit/data/TestProject2/public_html/js/picnic.js Mon Jun 02 14:23:34 2014 +0200
144.3 @@ -0,0 +1,6 @@
144.4 +define ({
144.5 + date1 : new Date(),
144.6 + date2 : new Date()
144.7 +});
144.8 +
144.9 +
145.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
145.2 +++ b/javascript2.requirejs/test/unit/src/org/netbeans/modules/javascript2/requirejs/TestProjectSupport.java Mon Jun 02 14:23:34 2014 +0200
145.3 @@ -0,0 +1,118 @@
145.4 +/*
145.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
145.6 + *
145.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
145.8 + *
145.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
145.10 + * Other names may be trademarks of their respective owners.
145.11 + *
145.12 + * The contents of this file are subject to the terms of either the GNU
145.13 + * General Public License Version 2 only ("GPL") or the Common
145.14 + * Development and Distribution License("CDDL") (collectively, the
145.15 + * "License"). You may not use this file except in compliance with the
145.16 + * License. You can obtain a copy of the License at
145.17 + * http://www.netbeans.org/cddl-gplv2.html
145.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
145.19 + * specific language governing permissions and limitations under the
145.20 + * License. When distributing the software, include this License Header
145.21 + * Notice in each file and include the License file at
145.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
145.23 + * particular file as subject to the "Classpath" exception as provided
145.24 + * by Oracle in the GPL Version 2 section of the License file that
145.25 + * accompanied this code. If applicable, add the following below the
145.26 + * License Header, with the fields enclosed by brackets [] replaced by
145.27 + * your own identifying information:
145.28 + * "Portions Copyrighted [year] [name of copyright owner]"
145.29 + *
145.30 + * If you wish your version of this file to be governed by only the CDDL
145.31 + * or only the GPL Version 2, indicate your decision by adding
145.32 + * "[Contributor] elects to include this software in this distribution
145.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
145.34 + * single choice of license, a recipient has the option to distribute
145.35 + * your version of this file under either the CDDL, the GPL Version 2 or
145.36 + * to extend the choice of license to its licensees as provided above.
145.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
145.38 + * Version 2 license, then the option applies only if the new code is
145.39 + * made subject to such option by the copyright holder.
145.40 + *
145.41 + * Contributor(s):
145.42 + *
145.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
145.44 + */
145.45 +
145.46 +package org.netbeans.modules.javascript2.requirejs;
145.47 +
145.48 +import java.net.URI;
145.49 +import org.netbeans.api.project.Project;
145.50 +import org.netbeans.spi.project.FileOwnerQueryImplementation;
145.51 +import org.netbeans.spi.project.ProjectState;
145.52 +import org.openide.filesystems.FileObject;
145.53 +import org.openide.util.Lookup;
145.54 +
145.55 +/**
145.56 + *
145.57 + * @author Petr Pisl
145.58 + */
145.59 +public class TestProjectSupport {
145.60 +
145.61 + public static final class TestProject implements Project {
145.62 +
145.63 + private Lookup lookup;
145.64 + private final FileObject dir;
145.65 + final ProjectState state;
145.66 + Throwable error;
145.67 +
145.68 + public TestProject(FileObject dir, ProjectState state) {
145.69 + this.dir = dir;
145.70 + this.state = state;
145.71 + }
145.72 +
145.73 + public void setLookup( Lookup lookup ) {
145.74 + this.lookup = lookup;
145.75 + }
145.76 +
145.77 + @Override
145.78 + public Lookup getLookup() {
145.79 + if ( lookup == null ) {
145.80 + return Lookup.EMPTY;
145.81 + }
145.82 + else {
145.83 + return lookup;
145.84 + }
145.85 + }
145.86 +
145.87 + @Override
145.88 + public FileObject getProjectDirectory() {
145.89 + return dir;
145.90 + }
145.91 +
145.92 + @Override
145.93 + public String toString() {
145.94 + return "testproject:" + getProjectDirectory().getNameExt();
145.95 + }
145.96 +
145.97 + }
145.98 +
145.99 + static public class FileOwnerQueryImpl implements FileOwnerQueryImplementation {
145.100 +
145.101 + private Project testProject1;
145.102 +
145.103 + public FileOwnerQueryImpl(Project testProject1) {
145.104 + this.testProject1 = testProject1;
145.105 + }
145.106 +
145.107 + @Override
145.108 + public Project getOwner(URI file) {
145.109 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
145.110 + }
145.111 +
145.112 + @Override
145.113 + public Project getOwner(FileObject file) {
145.114 + if (file.getPath().startsWith(testProject1.getProjectDirectory().getPath())){
145.115 + return testProject1;
145.116 + }
145.117 + return null;
145.118 + }
145.119 +
145.120 + }
145.121 +}
146.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
146.2 +++ b/javascript2.requirejs/test/unit/src/org/netbeans/modules/javascript2/requirejs/editor/RequireFileCodeCompletionBaseUrlTest.java Mon Jun 02 14:23:34 2014 +0200
146.3 @@ -0,0 +1,367 @@
146.4 +/*
146.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
146.6 + *
146.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
146.8 + *
146.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
146.10 + * Other names may be trademarks of their respective owners.
146.11 + *
146.12 + * The contents of this file are subject to the terms of either the GNU
146.13 + * General Public License Version 2 only ("GPL") or the Common
146.14 + * Development and Distribution License("CDDL") (collectively, the
146.15 + * "License"). You may not use this file except in compliance with the
146.16 + * License. You can obtain a copy of the License at
146.17 + * http://www.netbeans.org/cddl-gplv2.html
146.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
146.19 + * specific language governing permissions and limitations under the
146.20 + * License. When distributing the software, include this License Header
146.21 + * Notice in each file and include the License file at
146.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
146.23 + * particular file as subject to the "Classpath" exception as provided
146.24 + * by Oracle in the GPL Version 2 section of the License file that
146.25 + * accompanied this code. If applicable, add the following below the
146.26 + * License Header, with the fields enclosed by brackets [] replaced by
146.27 + * your own identifying information:
146.28 + * "Portions Copyrighted [year] [name of copyright owner]"
146.29 + *
146.30 + * If you wish your version of this file to be governed by only the CDDL
146.31 + * or only the GPL Version 2, indicate your decision by adding
146.32 + * "[Contributor] elects to include this software in this distribution
146.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
146.34 + * single choice of license, a recipient has the option to distribute
146.35 + * your version of this file under either the CDDL, the GPL Version 2 or
146.36 + * to extend the choice of license to its licensees as provided above.
146.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
146.38 + * Version 2 license, then the option applies only if the new code is
146.39 + * made subject to such option by the copyright holder.
146.40 + *
146.41 + * Contributor(s):
146.42 + *
146.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
146.44 + */
146.45 +
146.46 +package org.netbeans.modules.javascript2.requirejs.editor;
146.47 +
146.48 +import java.io.File;
146.49 +import java.util.ArrayList;
146.50 +import java.util.Collections;
146.51 +import java.util.HashMap;
146.52 +import java.util.LinkedList;
146.53 +import java.util.List;
146.54 +import java.util.Map;
146.55 +import java.util.concurrent.atomic.AtomicReference;
146.56 +import javax.swing.text.BadLocationException;
146.57 +import javax.swing.text.Document;
146.58 +import javax.swing.text.Position;
146.59 +import static junit.framework.Assert.assertEquals;
146.60 +import static junit.framework.Assert.assertNotNull;
146.61 +import static junit.framework.Assert.assertTrue;
146.62 +import org.netbeans.api.java.classpath.ClassPath;
146.63 +import org.netbeans.api.project.Project;
146.64 +import org.netbeans.editor.BaseDocument;
146.65 +import org.netbeans.modules.csl.api.CodeCompletionContext;
146.66 +import org.netbeans.modules.csl.api.CodeCompletionHandler;
146.67 +import org.netbeans.modules.csl.api.CodeCompletionResult;
146.68 +import org.netbeans.modules.csl.api.CompletionProposal;
146.69 +import org.netbeans.modules.csl.api.ElementKind;
146.70 +import org.netbeans.modules.csl.api.HtmlFormatter;
146.71 +import static org.netbeans.modules.csl.api.test.CslTestBase.getCaretOffset;
146.72 +import org.netbeans.modules.csl.spi.GsfUtilities;
146.73 +import org.netbeans.modules.csl.spi.ParserResult;
146.74 +import org.netbeans.modules.javascript2.editor.JsCodeCompletionBase;
146.75 +import static org.netbeans.modules.javascript2.editor.JsTestBase.JS_SOURCE_ID;
146.76 +import org.netbeans.modules.javascript2.requirejs.RequireJsPreferences;
146.77 +import org.netbeans.modules.javascript2.requirejs.TestProjectSupport;
146.78 +import org.netbeans.modules.parsing.api.ParserManager;
146.79 +import org.netbeans.modules.parsing.api.ResultIterator;
146.80 +import org.netbeans.modules.parsing.api.Source;
146.81 +import org.netbeans.modules.parsing.api.UserTask;
146.82 +import org.netbeans.modules.parsing.spi.Parser;
146.83 +import org.netbeans.spi.java.classpath.support.ClassPathSupport;
146.84 +import org.openide.filesystems.FileObject;
146.85 +import org.openide.filesystems.FileUtil;
146.86 +import org.openide.util.test.MockLookup;
146.87 +
146.88 +/**
146.89 + *
146.90 + * @author Petr Pisl
146.91 + */
146.92 +public class RequireFileCodeCompletionBaseUrlTest extends JsCodeCompletionBase {
146.93 +
146.94 + public RequireFileCodeCompletionBaseUrlTest(String testName) {
146.95 + super(testName);
146.96 + }
146.97 +
146.98 + @Override
146.99 + protected void setUp() throws Exception {
146.100 + super.setUp();
146.101 + FileObject folder = getTestFile("TestProject2");
146.102 + Project tp = new TestProjectSupport.TestProject(folder, null);
146.103 + List lookupAll = new ArrayList();
146.104 + lookupAll.addAll(MockLookup.getDefault().lookupAll(Object.class));
146.105 + lookupAll.add(new TestProjectSupport.FileOwnerQueryImpl(tp));
146.106 + MockLookup.setInstances(lookupAll.toArray());
146.107 + }
146.108 +
146.109 + public void testFSCompletion01() throws Exception {
146.110 + checkCompletion("TestProject2/public_html/js/main.js", "requirejs(['modul^eLib1', ", false);
146.111 + }
146.112 +
146.113 + public void testFSCompletion02() throws Exception {
146.114 + checkCompletion("TestProject2/public_html/js/main.js", "'js/^lib/moduleLib2.js',", false);
146.115 + }
146.116 +
146.117 + public void testFSCompletion03() throws Exception {
146.118 + checkCompletion("TestProject2/public_html/js/main.js", "'js/lib/moduleL^ib2.js',", false);
146.119 + }
146.120 +
146.121 + public void testFSCompletion04() throws Exception {
146.122 + checkCompletion("TestProject2/public_html/js/main.js", "'app/module^App1',", false);
146.123 + }
146.124 +
146.125 + public void testFSCompletion06() throws Exception {
146.126 + checkCompletion("TestProject2/public_html/js/main.js", "'p^roto/localization',", false);
146.127 + }
146.128 +
146.129 + public void testFSCompletion07() throws Exception {
146.130 + checkCompletion("TestProject2/public_html/js/main.js", "'proto/loc^alization',", false);
146.131 + }
146.132 +
146.133 + public void testFSCompletion08() throws Exception {
146.134 + checkCompletion("TestProject2/public_html/js/main.js", "'pikn^ic'", false);
146.135 + }
146.136 +
146.137 + public void checkAppliedCompletion(final String file, final String caretLine, final String expectedLine, final String itemToComplete, final boolean includeModifiers) throws Exception {
146.138 + final CodeCompletionHandler.QueryType type = CodeCompletionHandler.QueryType.COMPLETION;
146.139 + final boolean caseSensitive = true;
146.140 +
146.141 + Source testSource = getTestSource(getTestFile(file));
146.142 + final AtomicReference<CompletionProposal> found = new AtomicReference<CompletionProposal>();
146.143 +
146.144 + final int caretOffset;
146.145 + if (caretLine != null) {
146.146 + caretOffset = getCaretOffset(testSource.createSnapshot().getText().toString(), caretLine);
146.147 + enforceCaretOffset(testSource, caretOffset);
146.148 + } else {
146.149 + caretOffset = -1;
146.150 + }
146.151 +
146.152 + final Document[] doc = new Document[1];
146.153 + ParserManager.parse(Collections.singleton(testSource), new UserTask() {
146.154 + public @Override
146.155 + void run(ResultIterator resultIterator) throws Exception {
146.156 + Parser.Result r = caretOffset == -1 ? resultIterator.getParserResult() : resultIterator.getParserResult(caretOffset);
146.157 + assertTrue(r instanceof ParserResult);
146.158 + ParserResult pr = (ParserResult) r;
146.159 +
146.160 + CodeCompletionHandler cc = getCodeCompleter();
146.161 + assertNotNull("getCodeCompleter must be implemented", cc);
146.162 +
146.163 + doc[0] = GsfUtilities.getDocument(pr.getSnapshot().getSource().getFileObject(), true);
146.164 + boolean upToOffset = type == CodeCompletionHandler.QueryType.COMPLETION;
146.165 + String prefix = cc.getPrefix(pr, caretOffset, upToOffset);
146.166 + if (prefix == null) {
146.167 + if (prefix == null) {
146.168 + int[] blk =
146.169 + org.netbeans.editor.Utilities.getIdentifierBlock((BaseDocument) doc[0], caretOffset);
146.170 +
146.171 + if (blk != null) {
146.172 + int start = blk[0];
146.173 + if (start < caretOffset) {
146.174 + if (upToOffset) {
146.175 + prefix = doc[0].getText(start, caretOffset - start);
146.176 + } else {
146.177 + prefix = doc[0].getText(start, blk[1] - start);
146.178 + }
146.179 + }
146.180 + }
146.181 + }
146.182 + }
146.183 +
146.184 + final int finalCaretOffset = caretOffset;
146.185 + final String finalPrefix = prefix;
146.186 + final ParserResult finalParserResult = pr;
146.187 + CodeCompletionContext context = new CodeCompletionContext() {
146.188 + @Override
146.189 + public int getCaretOffset() {
146.190 + return finalCaretOffset;
146.191 + }
146.192 +
146.193 + @Override
146.194 + public ParserResult getParserResult() {
146.195 + return finalParserResult;
146.196 + }
146.197 +
146.198 + @Override
146.199 + public String getPrefix() {
146.200 + return finalPrefix;
146.201 + }
146.202 +
146.203 + @Override
146.204 + public boolean isPrefixMatch() {
146.205 + return true;
146.206 + }
146.207 +
146.208 + @Override
146.209 + public CodeCompletionHandler.QueryType getQueryType() {
146.210 + return type;
146.211 + }
146.212 +
146.213 + @Override
146.214 + public boolean isCaseSensitive() {
146.215 + return caseSensitive;
146.216 + }
146.217 + };
146.218 +
146.219 + CodeCompletionResult completionResult = cc.complete(context);
146.220 + List<CompletionProposal> proposals = completionResult.getItems();
146.221 +
146.222 + final boolean deprecatedHolder[] = new boolean[1];
146.223 + final HtmlFormatter formatter = new HtmlFormatter() {
146.224 + private StringBuilder sb = new StringBuilder();
146.225 +
146.226 + @Override
146.227 + public void reset() {
146.228 + sb.setLength(0);
146.229 + }
146.230 +
146.231 + @Override
146.232 + public void appendHtml(String html) {
146.233 + sb.append(html);
146.234 + }
146.235 +
146.236 + @Override
146.237 + public void appendText(String text, int fromInclusive, int toExclusive) {
146.238 + sb.append(text, fromInclusive, toExclusive);
146.239 + }
146.240 +
146.241 + @Override
146.242 + public void emphasis(boolean start) {
146.243 + }
146.244 +
146.245 + @Override
146.246 + public void active(boolean start) {
146.247 + }
146.248 +
146.249 + @Override
146.250 + public void name(ElementKind kind, boolean start) {
146.251 + }
146.252 +
146.253 + @Override
146.254 + public void parameters(boolean start) {
146.255 + }
146.256 +
146.257 + @Override
146.258 + public void type(boolean start) {
146.259 + }
146.260 +
146.261 + @Override
146.262 + public void deprecated(boolean start) {
146.263 + deprecatedHolder[0] = true;
146.264 + }
146.265 +
146.266 + @Override
146.267 + public String getText() {
146.268 + return sb.toString();
146.269 + }
146.270 + };
146.271 +
146.272 + assertCompletionItemNames(new String[]{itemToComplete}, completionResult, Match.CONTAINS);
146.273 +
146.274 + for (CompletionProposal ccp : completionResult.getItems()) {
146.275 + if (itemToComplete.equals(ccp.getName())) {
146.276 + //complete the item
146.277 + found.set(ccp);
146.278 + break;
146.279 + }
146.280 + }
146.281 +
146.282 + CompletionProposal proposal = found.get();
146.283 + assertNotNull(proposal);
146.284 +
146.285 + final String text = proposal.getCustomInsertTemplate() != null ? proposal.getCustomInsertTemplate() : proposal.getInsertPrefix();
146.286 + final int offset = proposal.getAnchorOffset();
146.287 + final int len = caretOffset - offset;
146.288 + final int[] resultPipeOffset = new int[1];
146.289 +
146.290 + final BaseDocument bd = (BaseDocument) doc[0];
146.291 +
146.292 + //since there's no access to the GsfCompletionItem.defaultAction() I've copied important code below:
146.293 + bd.runAtomic(new Runnable() {
146.294 + @Override
146.295 + public void run() {
146.296 + try {
146.297 + int semiPos = -2;
146.298 + String textToReplace = bd.getText(offset, len);
146.299 + int newCaretPos = text.indexOf("${cursor}");
146.300 + String rtext = text;
146.301 + if (newCaretPos > -1) {
146.302 + rtext = text.substring(0, newCaretPos) + text.substring(newCaretPos + 9);
146.303 + resultPipeOffset[0] = offset + newCaretPos;
146.304 + } else {
146.305 + resultPipeOffset[0] = offset + rtext.length();
146.306 + }
146.307 + if (rtext.equals(textToReplace)) {
146.308 + if (semiPos > -1) {
146.309 + bd.insertString(semiPos, ";", null); //NOI18N
146.310 + }
146.311 + return;
146.312 + }
146.313 + int common = 0;
146.314 + while (rtext.regionMatches(0, textToReplace, 0, ++common)) {
146.315 + //no-op
146.316 + }
146.317 + common--;
146.318 + Position position = bd.createPosition(offset + common);
146.319 + Position semiPosition = semiPos > -1 ? bd.createPosition(semiPos) : null;
146.320 + bd.remove(offset + common, len - common);
146.321 + bd.insertString(position.getOffset(), rtext.substring(common), null);
146.322 + if (semiPosition != null) {
146.323 + bd.insertString(semiPosition.getOffset(), ";", null);
146.324 + }
146.325 +
146.326 + } catch (BadLocationException e) {
146.327 + // Can't update
146.328 + }
146.329 + }
146.330 + });
146.331 +
146.332 + assertDescriptionMatches(file, bd.getText(0, bd.getLength()), true, ".expected.js");
146.333 + final String fileName = file.substring(0, file.indexOf(".")) + ".js." + getName() + ".expected.js";
146.334 + assertTrue("File not found: " + getTestFile(fileName).getPath(), getTestFile(fileName).isValid());
146.335 + Source expectedSource = getTestSource(getTestFile(fileName));
146.336 + final StringBuilder expectedContent = new StringBuilder(expectedSource.getDocument(false).getText(0, expectedSource.getDocument(false).getLength()));
146.337 + final int expectedOffset;
146.338 + if (expectedLine != null) {
146.339 + expectedOffset = getCaretOffset(expectedSource.createSnapshot().getText().toString(), expectedLine);
146.340 + enforceCaretOffset(expectedSource, expectedOffset);
146.341 + } else {
146.342 + expectedOffset = -1;
146.343 + }
146.344 + assertEquals(expectedContent.toString(), bd.getText(0, bd.getLength()));
146.345 + assertEquals(expectedOffset, resultPipeOffset[0]);
146.346 + }
146.347 + });
146.348 + }
146.349 +
146.350 + @Override
146.351 + protected Map<String, ClassPath> createClassPathsForTest() {
146.352 + List<FileObject> cpRoots = new LinkedList<FileObject>();
146.353 +
146.354 + cpRoots.add(FileUtil.toFileObject(new File(getDataDir(), "/TestProject2/public_html")));
146.355 + return Collections.singletonMap(
146.356 + JS_SOURCE_ID,
146.357 + ClassPathSupport.createClassPath(cpRoots.toArray(new FileObject[cpRoots.size()]))
146.358 + );
146.359 + }
146.360 +
146.361 + @Override
146.362 + protected boolean classPathContainsBinaries() {
146.363 + return false;
146.364 + }
146.365 +
146.366 + @Override
146.367 + protected boolean cleanCacheDir() {
146.368 + return false;
146.369 + }
146.370 +}
147.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
147.2 +++ b/javascript2.requirejs/test/unit/src/org/netbeans/modules/javascript2/requirejs/editor/RequireFileCodeCompletionTest.java Mon Jun 02 14:23:34 2014 +0200
147.3 @@ -0,0 +1,390 @@
147.4 +/*
147.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
147.6 + *
147.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
147.8 + *
147.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
147.10 + * Other names may be trademarks of their respective owners.
147.11 + *
147.12 + * The contents of this file are subject to the terms of either the GNU
147.13 + * General Public License Version 2 only ("GPL") or the Common
147.14 + * Development and Distribution License("CDDL") (collectively, the
147.15 + * "License"). You may not use this file except in compliance with the
147.16 + * License. You can obtain a copy of the License at
147.17 + * http://www.netbeans.org/cddl-gplv2.html
147.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
147.19 + * specific language governing permissions and limitations under the
147.20 + * License. When distributing the software, include this License Header
147.21 + * Notice in each file and include the License file at
147.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
147.23 + * particular file as subject to the "Classpath" exception as provided
147.24 + * by Oracle in the GPL Version 2 section of the License file that
147.25 + * accompanied this code. If applicable, add the following below the
147.26 + * License Header, with the fields enclosed by brackets [] replaced by
147.27 + * your own identifying information:
147.28 + * "Portions Copyrighted [year] [name of copyright owner]"
147.29 + *
147.30 + * If you wish your version of this file to be governed by only the CDDL
147.31 + * or only the GPL Version 2, indicate your decision by adding
147.32 + * "[Contributor] elects to include this software in this distribution
147.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
147.34 + * single choice of license, a recipient has the option to distribute
147.35 + * your version of this file under either the CDDL, the GPL Version 2 or
147.36 + * to extend the choice of license to its licensees as provided above.
147.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
147.38 + * Version 2 license, then the option applies only if the new code is
147.39 + * made subject to such option by the copyright holder.
147.40 + *
147.41 + * Contributor(s):
147.42 + *
147.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
147.44 + */
147.45 +
147.46 +package org.netbeans.modules.javascript2.requirejs.editor;
147.47 +
147.48 +import java.io.File;
147.49 +import java.util.ArrayList;
147.50 +import java.util.Collections;
147.51 +import java.util.HashMap;
147.52 +import java.util.LinkedList;
147.53 +import java.util.List;
147.54 +import java.util.Map;
147.55 +import java.util.concurrent.atomic.AtomicReference;
147.56 +import javax.swing.text.BadLocationException;
147.57 +import javax.swing.text.Document;
147.58 +import javax.swing.text.Position;
147.59 +import static junit.framework.Assert.assertEquals;
147.60 +import static junit.framework.Assert.assertNotNull;
147.61 +import static junit.framework.Assert.assertTrue;
147.62 +import org.netbeans.api.java.classpath.ClassPath;
147.63 +import org.netbeans.api.project.Project;
147.64 +import org.netbeans.editor.BaseDocument;
147.65 +import org.netbeans.modules.csl.api.CodeCompletionContext;
147.66 +import org.netbeans.modules.csl.api.CodeCompletionHandler;
147.67 +import org.netbeans.modules.csl.api.CodeCompletionResult;
147.68 +import org.netbeans.modules.csl.api.CompletionProposal;
147.69 +import org.netbeans.modules.csl.api.ElementKind;
147.70 +import org.netbeans.modules.csl.api.HtmlFormatter;
147.71 +import static org.netbeans.modules.csl.api.test.CslTestBase.getCaretOffset;
147.72 +import org.netbeans.modules.csl.spi.GsfUtilities;
147.73 +import org.netbeans.modules.csl.spi.ParserResult;
147.74 +import org.netbeans.modules.javascript2.editor.JsCodeCompletionBase;
147.75 +import static org.netbeans.modules.javascript2.editor.JsTestBase.JS_SOURCE_ID;
147.76 +import org.netbeans.modules.javascript2.requirejs.RequireJsPreferences;
147.77 +import org.netbeans.modules.javascript2.requirejs.TestProjectSupport;
147.78 +import org.netbeans.modules.parsing.api.ParserManager;
147.79 +import org.netbeans.modules.parsing.api.ResultIterator;
147.80 +import org.netbeans.modules.parsing.api.Source;
147.81 +import org.netbeans.modules.parsing.api.UserTask;
147.82 +import org.netbeans.modules.parsing.spi.Parser;
147.83 +import org.netbeans.spi.java.classpath.support.ClassPathSupport;
147.84 +import org.openide.filesystems.FileObject;
147.85 +import org.openide.filesystems.FileUtil;
147.86 +import org.openide.util.test.MockLookup;
147.87 +
147.88 +/**
147.89 + *
147.90 + * @author Petr Pisl
147.91 + */
147.92 +public class RequireFileCodeCompletionTest extends JsCodeCompletionBase {
147.93 +
147.94 + public RequireFileCodeCompletionTest(String testName) {
147.95 + super(testName);
147.96 + }
147.97 +
147.98 + @Override
147.99 + protected void setUp() throws Exception {
147.100 + super.setUp();
147.101 + FileObject folder = getTestFile("TestProject1");
147.102 + Project tp = new TestProjectSupport.TestProject(folder, null);
147.103 + List lookupAll = new ArrayList();
147.104 + lookupAll.addAll(MockLookup.getDefault().lookupAll(Object.class));
147.105 + lookupAll.add(new TestProjectSupport.FileOwnerQueryImpl(tp));
147.106 + MockLookup.setInstances(lookupAll.toArray());
147.107 +
147.108 + Map<String, String> mappings = new HashMap();
147.109 + mappings.put("utils", "js/folder1/api/utils.js");
147.110 + mappings.put("api", "js/folder1/api");
147.111 + mappings.put("lib/api", "js/folder1/api");
147.112 + RequireJsPreferences.storeMappings(tp, mappings);
147.113 + }
147.114 +
147.115 + public void testFSCompletion01() throws Exception {
147.116 + checkCompletion("TestProject1/js/main.js", "'fo^lder1/module1'", false);
147.117 + }
147.118 +
147.119 + public void testFSCompletion02() throws Exception {
147.120 + checkCompletion("TestProject1/js/folder2/fs.js", "'^'", false);
147.121 + }
147.122 +
147.123 + public void testFSCompletion03() throws Exception {
147.124 + checkCompletion("TestProject1/js/main2.js", "requirejs(['^']);", false);
147.125 + }
147.126 +
147.127 + public void testFSCompletion04() throws Exception {
147.128 + checkAppliedCompletion("TestProject1/js/fileCC/main3.js", "requirejs(['^']);", "requirejs(['folder1/^']);", "folder1", false);
147.129 +
147.130 + }
147.131 +
147.132 + public void testFSCompletion05() throws Exception {
147.133 + checkAppliedCompletion("TestProject1/js/fileCC/main4.js", "requirejs(['fold^']);", "requirejs(['folder1/^']);", "folder1", false);
147.134 + }
147.135 +
147.136 + public void testFSCompletion06() throws Exception {
147.137 + checkAppliedCompletion("TestProject1/js/fileCC/main5.js", "requirejs(['folder1/^']);", "requirejs(['folder1/module2^']);", "module2", false);
147.138 + }
147.139 +
147.140 + public void testFSCompletion07() throws Exception {
147.141 + checkAppliedCompletion("TestProject1/js/fileCC/main6.js", "requirejs(['folder1/mo^']);", "requirejs(['folder1/module2^']);", "module2", false);
147.142 + }
147.143 +
147.144 + public void testMappingCompletion01() throws Exception {
147.145 + checkCompletion("TestProject1/js/folder2/fs.js", "'lib/a^',", false);
147.146 + }
147.147 +
147.148 + public void testMappingCompletion02() throws Exception {
147.149 + checkCompletion("TestProject1/js/folder2/fs.js", "'lib/api/^',", false);
147.150 + }
147.151 +
147.152 + public void testMappingCompletion03() throws Exception {
147.153 + checkCompletion("TestProject1/js/folder2/fs.js", "'lib/api/v0.1/^',", false);
147.154 + }
147.155 +
147.156 + public void testMappingCompletion04() throws Exception {
147.157 + checkCompletion("TestProject1/js/folder2/fs.js", "'lib/api/v0.1/OM^',", false);
147.158 + }
147.159 +
147.160 + public void checkAppliedCompletion(final String file, final String caretLine, final String expectedLine, final String itemToComplete, final boolean includeModifiers) throws Exception {
147.161 + final CodeCompletionHandler.QueryType type = CodeCompletionHandler.QueryType.COMPLETION;
147.162 + final boolean caseSensitive = true;
147.163 +
147.164 + Source testSource = getTestSource(getTestFile(file));
147.165 + final AtomicReference<CompletionProposal> found = new AtomicReference<CompletionProposal>();
147.166 +
147.167 + final int caretOffset;
147.168 + if (caretLine != null) {
147.169 + caretOffset = getCaretOffset(testSource.createSnapshot().getText().toString(), caretLine);
147.170 + enforceCaretOffset(testSource, caretOffset);
147.171 + } else {
147.172 + caretOffset = -1;
147.173 + }
147.174 +
147.175 + final Document[] doc = new Document[1];
147.176 + ParserManager.parse(Collections.singleton(testSource), new UserTask() {
147.177 + public @Override
147.178 + void run(ResultIterator resultIterator) throws Exception {
147.179 + Parser.Result r = caretOffset == -1 ? resultIterator.getParserResult() : resultIterator.getParserResult(caretOffset);
147.180 + assertTrue(r instanceof ParserResult);
147.181 + ParserResult pr = (ParserResult) r;
147.182 +
147.183 + CodeCompletionHandler cc = getCodeCompleter();
147.184 + assertNotNull("getCodeCompleter must be implemented", cc);
147.185 +
147.186 + doc[0] = GsfUtilities.getDocument(pr.getSnapshot().getSource().getFileObject(), true);
147.187 + boolean upToOffset = type == CodeCompletionHandler.QueryType.COMPLETION;
147.188 + String prefix = cc.getPrefix(pr, caretOffset, upToOffset);
147.189 + if (prefix == null) {
147.190 + if (prefix == null) {
147.191 + int[] blk =
147.192 + org.netbeans.editor.Utilities.getIdentifierBlock((BaseDocument) doc[0], caretOffset);
147.193 +
147.194 + if (blk != null) {
147.195 + int start = blk[0];
147.196 + if (start < caretOffset) {
147.197 + if (upToOffset) {
147.198 + prefix = doc[0].getText(start, caretOffset - start);
147.199 + } else {
147.200 + prefix = doc[0].getText(start, blk[1] - start);
147.201 + }
147.202 + }
147.203 + }
147.204 + }
147.205 + }
147.206 +
147.207 + final int finalCaretOffset = caretOffset;
147.208 + final String finalPrefix = prefix;
147.209 + final ParserResult finalParserResult = pr;
147.210 + CodeCompletionContext context = new CodeCompletionContext() {
147.211 + @Override
147.212 + public int getCaretOffset() {
147.213 + return finalCaretOffset;
147.214 + }
147.215 +
147.216 + @Override
147.217 + public ParserResult getParserResult() {
147.218 + return finalParserResult;
147.219 + }
147.220 +
147.221 + @Override
147.222 + public String getPrefix() {
147.223 + return finalPrefix;
147.224 + }
147.225 +
147.226 + @Override
147.227 + public boolean isPrefixMatch() {
147.228 + return true;
147.229 + }
147.230 +
147.231 + @Override
147.232 + public CodeCompletionHandler.QueryType getQueryType() {
147.233 + return type;
147.234 + }
147.235 +
147.236 + @Override
147.237 + public boolean isCaseSensitive() {
147.238 + return caseSensitive;
147.239 + }
147.240 + };
147.241 +
147.242 + CodeCompletionResult completionResult = cc.complete(context);
147.243 + List<CompletionProposal> proposals = completionResult.getItems();
147.244 +
147.245 + final boolean deprecatedHolder[] = new boolean[1];
147.246 + final HtmlFormatter formatter = new HtmlFormatter() {
147.247 + private StringBuilder sb = new StringBuilder();
147.248 +
147.249 + @Override
147.250 + public void reset() {
147.251 + sb.setLength(0);
147.252 + }
147.253 +
147.254 + @Override
147.255 + public void appendHtml(String html) {
147.256 + sb.append(html);
147.257 + }
147.258 +
147.259 + @Override
147.260 + public void appendText(String text, int fromInclusive, int toExclusive) {
147.261 + sb.append(text, fromInclusive, toExclusive);
147.262 + }
147.263 +
147.264 + @Override
147.265 + public void emphasis(boolean start) {
147.266 + }
147.267 +
147.268 + @Override
147.269 + public void active(boolean start) {
147.270 + }
147.271 +
147.272 + @Override
147.273 + public void name(ElementKind kind, boolean start) {
147.274 + }
147.275 +
147.276 + @Override
147.277 + public void parameters(boolean start) {
147.278 + }
147.279 +
147.280 + @Override
147.281 + public void type(boolean start) {
147.282 + }
147.283 +
147.284 + @Override
147.285 + public void deprecated(boolean start) {
147.286 + deprecatedHolder[0] = true;
147.287 + }
147.288 +
147.289 + @Override
147.290 + public String getText() {
147.291 + return sb.toString();
147.292 + }
147.293 + };
147.294 +
147.295 + assertCompletionItemNames(new String[]{itemToComplete}, completionResult, Match.CONTAINS);
147.296 +
147.297 + for (CompletionProposal ccp : completionResult.getItems()) {
147.298 + if (itemToComplete.equals(ccp.getName())) {
147.299 + //complete the item
147.300 + found.set(ccp);
147.301 + break;
147.302 + }
147.303 + }
147.304 +
147.305 + CompletionProposal proposal = found.get();
147.306 + assertNotNull(proposal);
147.307 +
147.308 + final String text = proposal.getCustomInsertTemplate() != null ? proposal.getCustomInsertTemplate() : proposal.getInsertPrefix();
147.309 + final int offset = proposal.getAnchorOffset();
147.310 + final int len = caretOffset - offset;
147.311 + final int[] resultPipeOffset = new int[1];
147.312 +
147.313 + final BaseDocument bd = (BaseDocument) doc[0];
147.314 +
147.315 + //since there's no access to the GsfCompletionItem.defaultAction() I've copied important code below:
147.316 + bd.runAtomic(new Runnable() {
147.317 + @Override
147.318 + public void run() {
147.319 + try {
147.320 + int semiPos = -2;
147.321 + String textToReplace = bd.getText(offset, len);
147.322 + int newCaretPos = text.indexOf("${cursor}");
147.323 + String rtext = text;
147.324 + if (newCaretPos > -1) {
147.325 + rtext = text.substring(0, newCaretPos) + text.substring(newCaretPos + 9);
147.326 + resultPipeOffset[0] = offset + newCaretPos;
147.327 + } else {
147.328 + resultPipeOffset[0] = offset + rtext.length();
147.329 + }
147.330 + if (rtext.equals(textToReplace)) {
147.331 + if (semiPos > -1) {
147.332 + bd.insertString(semiPos, ";", null); //NOI18N
147.333 + }
147.334 + return;
147.335 + }
147.336 + int common = 0;
147.337 + while (rtext.regionMatches(0, textToReplace, 0, ++common)) {
147.338 + //no-op
147.339 + }
147.340 + common--;
147.341 + Position position = bd.createPosition(offset + common);
147.342 + Position semiPosition = semiPos > -1 ? bd.createPosition(semiPos) : null;
147.343 + bd.remove(offset + common, len - common);
147.344 + bd.insertString(position.getOffset(), rtext.substring(common), null);
147.345 + if (semiPosition != null) {
147.346 + bd.insertString(semiPosition.getOffset(), ";", null);
147.347 + }
147.348 +
147.349 + } catch (BadLocationException e) {
147.350 + // Can't update
147.351 + }
147.352 + }
147.353 + });
147.354 +
147.355 + assertDescriptionMatches(file, bd.getText(0, bd.getLength()), true, ".expected.js");
147.356 + final String fileName = file.substring(0, file.indexOf(".")) + ".js." + getName() + ".expected.js";
147.357 + assertTrue("File not found: " + getTestFile(fileName).getPath(), getTestFile(fileName).isValid());
147.358 + Source expectedSource = getTestSource(getTestFile(fileName));
147.359 + final StringBuilder expectedContent = new StringBuilder(expectedSource.getDocument(false).getText(0, expectedSource.getDocument(false).getLength()));
147.360 + final int expectedOffset;
147.361 + if (expectedLine != null) {
147.362 + expectedOffset = getCaretOffset(expectedSource.createSnapshot().getText().toString(), expectedLine);
147.363 + enforceCaretOffset(expectedSource, expectedOffset);
147.364 + } else {
147.365 + expectedOffset = -1;
147.366 + }
147.367 + assertEquals(expectedContent.toString(), bd.getText(0, bd.getLength()));
147.368 + assertEquals(expectedOffset, resultPipeOffset[0]);
147.369 + }
147.370 + });
147.371 + }
147.372 +
147.373 + @Override
147.374 + protected Map<String, ClassPath> createClassPathsForTest() {
147.375 + List<FileObject> cpRoots = new LinkedList<FileObject>();
147.376 +
147.377 + cpRoots.add(FileUtil.toFileObject(new File(getDataDir(), "/TestProject1")));
147.378 + return Collections.singletonMap(
147.379 + JS_SOURCE_ID,
147.380 + ClassPathSupport.createClassPath(cpRoots.toArray(new FileObject[cpRoots.size()]))
147.381 + );
147.382 + }
147.383 +
147.384 + @Override
147.385 + protected boolean classPathContainsBinaries() {
147.386 + return false;
147.387 + }
147.388 +
147.389 + @Override
147.390 + protected boolean cleanCacheDir() {
147.391 + return false;
147.392 + }
147.393 +}
148.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
148.2 +++ b/javascript2.requirejs/test/unit/src/org/netbeans/modules/javascript2/requirejs/editor/RequireJSCodeCompletionTest.java Mon Jun 02 14:23:34 2014 +0200
148.3 @@ -0,0 +1,131 @@
148.4 +/*
148.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
148.6 + *
148.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
148.8 + *
148.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
148.10 + * Other names may be trademarks of their respective owners.
148.11 + *
148.12 + * The contents of this file are subject to the terms of either the GNU
148.13 + * General Public License Version 2 only ("GPL") or the Common
148.14 + * Development and Distribution License("CDDL") (collectively, the
148.15 + * "License"). You may not use this file except in compliance with the
148.16 + * License. You can obtain a copy of the License at
148.17 + * http://www.netbeans.org/cddl-gplv2.html
148.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
148.19 + * specific language governing permissions and limitations under the
148.20 + * License. When distributing the software, include this License Header
148.21 + * Notice in each file and include the License file at
148.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
148.23 + * particular file as subject to the "Classpath" exception as provided
148.24 + * by Oracle in the GPL Version 2 section of the License file that
148.25 + * accompanied this code. If applicable, add the following below the
148.26 + * License Header, with the fields enclosed by brackets [] replaced by
148.27 + * your own identifying information:
148.28 + * "Portions Copyrighted [year] [name of copyright owner]"
148.29 + *
148.30 + * If you wish your version of this file to be governed by only the CDDL
148.31 + * or only the GPL Version 2, indicate your decision by adding
148.32 + * "[Contributor] elects to include this software in this distribution
148.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
148.34 + * single choice of license, a recipient has the option to distribute
148.35 + * your version of this file under either the CDDL, the GPL Version 2 or
148.36 + * to extend the choice of license to its licensees as provided above.
148.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
148.38 + * Version 2 license, then the option applies only if the new code is
148.39 + * made subject to such option by the copyright holder.
148.40 + *
148.41 + * Contributor(s):
148.42 + *
148.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
148.44 + */
148.45 +
148.46 +package org.netbeans.modules.javascript2.requirejs.editor;
148.47 +
148.48 +import java.io.File;
148.49 +import java.io.IOException;
148.50 +import java.util.ArrayList;
148.51 +import java.util.Collections;
148.52 +import java.util.HashMap;
148.53 +import java.util.LinkedList;
148.54 +import java.util.List;
148.55 +import java.util.Map;
148.56 +import org.netbeans.api.java.classpath.ClassPath;
148.57 +import org.netbeans.api.project.Project;
148.58 +import org.netbeans.modules.javascript2.editor.JsCodeCompletionBase;
148.59 +import static org.netbeans.modules.javascript2.editor.JsTestBase.JS_SOURCE_ID;
148.60 +import org.netbeans.modules.javascript2.editor.classpath.ClasspathProviderImplAccessor;
148.61 +import org.netbeans.modules.javascript2.requirejs.RequireJsPreferences;
148.62 +import org.netbeans.modules.javascript2.requirejs.TestProjectSupport;
148.63 +import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
148.64 +import org.netbeans.spi.java.classpath.support.ClassPathSupport;
148.65 +import org.openide.filesystems.FileObject;
148.66 +import org.openide.filesystems.FileUtil;
148.67 +import org.openide.util.test.MockLookup;
148.68 +
148.69 +/**
148.70 + *
148.71 + * @author Petr Pisl
148.72 + */
148.73 +public class RequireJSCodeCompletionTest extends JsCodeCompletionBase {
148.74 +
148.75 + public RequireJSCodeCompletionTest(String testName) throws IOException {
148.76 + super(testName);
148.77 + }
148.78 +
148.79 + @Override
148.80 + protected void setUp() throws Exception {
148.81 + super.setUp(); //To change body of generated methods, choose Tools | Templates.
148.82 + FileObject folder = getTestFile("TestProject1");
148.83 + Project tp = new TestProjectSupport.TestProject(folder, null);
148.84 + List lookupAll = new ArrayList();
148.85 + lookupAll.addAll(MockLookup.getDefault().lookupAll(Object.class));
148.86 + lookupAll.add(new TestProjectSupport.FileOwnerQueryImpl(tp));
148.87 + MockLookup.setInstances(lookupAll.toArray());
148.88 +
148.89 + Map<String, String> mappings = new HashMap();
148.90 + mappings.put("utils", "js/folder1/api/utils.js");
148.91 + mappings.put("api", "js/folder1/api");
148.92 + mappings.put("lib/api", "js/folder1/api");
148.93 + RequireJsPreferences.storeMappings(tp, mappings);
148.94 + RepositoryUpdater.getDefault().waitUntilFinished(10000);
148.95 + }
148.96 +
148.97 +
148.98 + public void testObjectLiteral01() throws Exception {
148.99 + checkCompletion("TestProject1/js/folder1/usingObjectLiteral.js", " ob.ol1^", false);
148.100 + }
148.101 +
148.102 + public void testObjectLiteral02() throws Exception {
148.103 + checkCompletion("TestProject1/js/folder1/usingObjectLiteral2.js", " ob.ol2^", false);
148.104 + }
148.105 +
148.106 + public void testObjectLiteral03() throws Exception {
148.107 + checkCompletion("TestProject1/js/folder1/usingObjectLiteral2.js", " ob.ol^2", false);
148.108 + }
148.109 +
148.110 + public void testProjectMappings01() throws Exception {
148.111 + checkCompletion("TestProject1/js/main.js", "utils.util^Method1();", false);
148.112 + }
148.113 +
148.114 + @Override
148.115 + protected Map<String, ClassPath> createClassPathsForTest() {
148.116 + List<FileObject> cpRoots = new LinkedList<FileObject>();
148.117 +
148.118 + cpRoots.add(FileUtil.toFileObject(new File(getDataDir(), "/TestProject1")));
148.119 + return Collections.singletonMap(
148.120 + JS_SOURCE_ID,
148.121 + ClassPathSupport.createClassPath(cpRoots.toArray(new FileObject[cpRoots.size()]))
148.122 + );
148.123 + }
148.124 +
148.125 + @Override
148.126 + protected boolean classPathContainsBinaries() {
148.127 + return false;
148.128 + }
148.129 +
148.130 + @Override
148.131 + protected boolean cleanCacheDir() {
148.132 + return false;
148.133 + }
148.134 +}
149.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
149.2 +++ b/javascript2.requirejs/test/unit/src/org/netbeans/modules/javascript2/requirejs/editor/RequireJsDeclarationFinderBaseUrlTest.java Mon Jun 02 14:23:34 2014 +0200
149.3 @@ -0,0 +1,143 @@
149.4 +/*
149.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
149.6 + *
149.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
149.8 + *
149.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
149.10 + * Other names may be trademarks of their respective owners.
149.11 + *
149.12 + * The contents of this file are subject to the terms of either the GNU
149.13 + * General Public License Version 2 only ("GPL") or the Common
149.14 + * Development and Distribution License("CDDL") (collectively, the
149.15 + * "License"). You may not use this file except in compliance with the
149.16 + * License. You can obtain a copy of the License at
149.17 + * http://www.netbeans.org/cddl-gplv2.html
149.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
149.19 + * specific language governing permissions and limitations under the
149.20 + * License. When distributing the software, include this License Header
149.21 + * Notice in each file and include the License file at
149.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
149.23 + * particular file as subject to the "Classpath" exception as provided
149.24 + * by Oracle in the GPL Version 2 section of the License file that
149.25 + * accompanied this code. If applicable, add the following below the
149.26 + * License Header, with the fields enclosed by brackets [] replaced by
149.27 + * your own identifying information:
149.28 + * "Portions Copyrighted [year] [name of copyright owner]"
149.29 + *
149.30 + * If you wish your version of this file to be governed by only the CDDL
149.31 + * or only the GPL Version 2, indicate your decision by adding
149.32 + * "[Contributor] elects to include this software in this distribution
149.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
149.34 + * single choice of license, a recipient has the option to distribute
149.35 + * your version of this file under either the CDDL, the GPL Version 2 or
149.36 + * to extend the choice of license to its licensees as provided above.
149.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
149.38 + * Version 2 license, then the option applies only if the new code is
149.39 + * made subject to such option by the copyright holder.
149.40 + *
149.41 + * Contributor(s):
149.42 + *
149.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
149.44 + */
149.45 +
149.46 +package org.netbeans.modules.javascript2.requirejs.editor;
149.47 +
149.48 +import java.io.File;
149.49 +import java.util.ArrayList;
149.50 +import java.util.Collections;
149.51 +import java.util.LinkedList;
149.52 +import java.util.List;
149.53 +import java.util.Map;
149.54 +import org.netbeans.api.java.classpath.ClassPath;
149.55 +import org.netbeans.api.project.Project;
149.56 +import org.netbeans.modules.javascript2.editor.JsCodeCompletionBase;
149.57 +import static org.netbeans.modules.javascript2.editor.JsTestBase.JS_SOURCE_ID;
149.58 +import org.netbeans.modules.javascript2.requirejs.TestProjectSupport;
149.59 +import org.netbeans.spi.java.classpath.support.ClassPathSupport;
149.60 +import org.openide.filesystems.FileObject;
149.61 +import org.openide.filesystems.FileUtil;
149.62 +import org.openide.util.test.MockLookup;
149.63 +
149.64 +/**
149.65 + *
149.66 + * @author Petr Pisl
149.67 + */
149.68 +public class RequireJsDeclarationFinderBaseUrlTest extends JsCodeCompletionBase {
149.69 +
149.70 + public RequireJsDeclarationFinderBaseUrlTest(String testName) {
149.71 + super(testName);
149.72 + }
149.73 +
149.74 + @Override
149.75 + protected void setUp() throws Exception {
149.76 + super.setUp();
149.77 + FileObject folder = getTestFile("TestProject2");
149.78 + Project testProject = new TestProjectSupport.TestProject(folder, null);
149.79 + List lookupAll = new ArrayList();
149.80 + lookupAll.addAll(MockLookup.getDefault().lookupAll(Object.class));
149.81 + lookupAll.add(new TestProjectSupport.FileOwnerQueryImpl(testProject));
149.82 + MockLookup.setInstances(lookupAll.toArray());
149.83 +
149.84 + }
149.85 +
149.86 + public void testNavigation01() throws Exception {
149.87 + checkDeclaration("TestProject2/public_html/js/main.js", "requirejs(['module^Lib1',", "moduleLib1.js", 0);
149.88 + }
149.89 +
149.90 + public void testNavigation02() throws Exception {
149.91 + checkDeclaration("TestProject2/public_html/js/main.js", "'js/lib/moduleLib2.^js',", "moduleLib2.js", 0);
149.92 + }
149.93 +
149.94 + public void testNavigation03() throws Exception {
149.95 + checkDeclaration("TestProject2/public_html/js/main.js", "'app/module^App1',", "moduleApp1.js", 0);
149.96 + }
149.97 +
149.98 + public void testNavigation04() throws Exception {
149.99 + checkDeclaration("TestProject2/public_html/js/main.js", "'pikn^ic'", "picnic.js", 0);
149.100 + }
149.101 +
149.102 + public void testNavigation05() throws Exception {
149.103 + checkDeclaration("TestProject2/public_html/js/main.js", "'proto/locali^zation',", "localization.js", 0);
149.104 + }
149.105 +
149.106 + public void testNavigationFromParameter01() throws Exception {
149.107 + checkDeclaration("TestProject2/public_html/js/main.js", "function(l^ib1, lib2, test, loc, pik)", "moduleLib1.js", 0);
149.108 + }
149.109 +
149.110 + public void testNavigationFromParameter02() throws Exception {
149.111 + checkDeclaration("TestProject2/public_html/js/main.js", "function(lib1, l^ib2, test, loc, pik)", "moduleLib2.js", 0);
149.112 + }
149.113 +
149.114 + public void testNavigationFromParameter03() throws Exception {
149.115 + checkDeclaration("TestProject2/public_html/js/main.js", "function(lib1, lib2, te^st, loc, pik)", "moduleApp1.js", 0);
149.116 + }
149.117 +
149.118 + public void testNavigationFromParameter04() throws Exception {
149.119 + checkDeclaration("TestProject2/public_html/js/main.js", "function(lib1, lib2, test, l^oc, pik)", "localization.js", 0);
149.120 + }
149.121 +
149.122 + public void testNavigationFromParameter05() throws Exception {
149.123 + checkDeclaration("TestProject2/public_html/js/main.js", "function(lib1, lib2, test, loc, p^ik)", "picnic.js", 0);
149.124 + }
149.125 +
149.126 + @Override
149.127 + protected Map<String, ClassPath> createClassPathsForTest() {
149.128 + List<FileObject> cpRoots = new LinkedList<FileObject>();
149.129 +
149.130 + cpRoots.add(FileUtil.toFileObject(new File(getDataDir(), "/TestProject2/public_html")));
149.131 + return Collections.singletonMap(
149.132 + JS_SOURCE_ID,
149.133 + ClassPathSupport.createClassPath(cpRoots.toArray(new FileObject[cpRoots.size()]))
149.134 + );
149.135 + }
149.136 +
149.137 + @Override
149.138 + protected boolean classPathContainsBinaries() {
149.139 + return false;
149.140 + }
149.141 +
149.142 + @Override
149.143 + protected boolean cleanCacheDir() {
149.144 + return false;
149.145 + }
149.146 +}
150.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
150.2 +++ b/javascript2.requirejs/test/unit/src/org/netbeans/modules/javascript2/requirejs/editor/RequireJsDeclarationFinderTest.java Mon Jun 02 14:23:34 2014 +0200
150.3 @@ -0,0 +1,116 @@
150.4 +/*
150.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
150.6 + *
150.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
150.8 + *
150.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
150.10 + * Other names may be trademarks of their respective owners.
150.11 + *
150.12 + * The contents of this file are subject to the terms of either the GNU
150.13 + * General Public License Version 2 only ("GPL") or the Common
150.14 + * Development and Distribution License("CDDL") (collectively, the
150.15 + * "License"). You may not use this file except in compliance with the
150.16 + * License. You can obtain a copy of the License at
150.17 + * http://www.netbeans.org/cddl-gplv2.html
150.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
150.19 + * specific language governing permissions and limitations under the
150.20 + * License. When distributing the software, include this License Header
150.21 + * Notice in each file and include the License file at
150.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
150.23 + * particular file as subject to the "Classpath" exception as provided
150.24 + * by Oracle in the GPL Version 2 section of the License file that
150.25 + * accompanied this code. If applicable, add the following below the
150.26 + * License Header, with the fields enclosed by brackets [] replaced by
150.27 + * your own identifying information:
150.28 + * "Portions Copyrighted [year] [name of copyright owner]"
150.29 + *
150.30 + * If you wish your version of this file to be governed by only the CDDL
150.31 + * or only the GPL Version 2, indicate your decision by adding
150.32 + * "[Contributor] elects to include this software in this distribution
150.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
150.34 + * single choice of license, a recipient has the option to distribute
150.35 + * your version of this file under either the CDDL, the GPL Version 2 or
150.36 + * to extend the choice of license to its licensees as provided above.
150.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
150.38 + * Version 2 license, then the option applies only if the new code is
150.39 + * made subject to such option by the copyright holder.
150.40 + *
150.41 + * Contributor(s):
150.42 + *
150.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
150.44 + */
150.45 +
150.46 +package org.netbeans.modules.javascript2.requirejs.editor;
150.47 +
150.48 +import java.util.ArrayList;
150.49 +import java.util.HashMap;
150.50 +import java.util.List;
150.51 +import java.util.Map;
150.52 +import org.netbeans.api.project.Project;
150.53 +import org.netbeans.modules.javascript2.editor.JsTestBase;
150.54 +import org.netbeans.modules.javascript2.requirejs.RequireJsPreferences;
150.55 +import org.netbeans.modules.javascript2.requirejs.TestProjectSupport;
150.56 +import org.openide.filesystems.FileObject;
150.57 +import org.openide.util.test.MockLookup;
150.58 +
150.59 +/**
150.60 + *
150.61 + * @author Petr Pisl
150.62 + */
150.63 +public class RequireJsDeclarationFinderTest extends JsTestBase {
150.64 +
150.65 + public RequireJsDeclarationFinderTest(String testName) {
150.66 + super(testName);
150.67 + }
150.68 +
150.69 + @Override
150.70 + protected void setUp() throws Exception {
150.71 + super.setUp();
150.72 + FileObject folder = getTestFile("TestProject1");
150.73 + Project testProject = new TestProjectSupport.TestProject(folder, null);
150.74 + List lookupAll = new ArrayList();
150.75 + lookupAll.addAll(MockLookup.getDefault().lookupAll(Object.class));
150.76 + lookupAll.add(new TestProjectSupport.FileOwnerQueryImpl(testProject));
150.77 + MockLookup.setInstances(lookupAll.toArray());
150.78 +
150.79 + Map<String, String> mappings = new HashMap();
150.80 + mappings.put("utils", "js/folder1/api/utils.js");
150.81 + mappings.put("api", "js/folder1/api");
150.82 + mappings.put("lib/api", "js/folder1/api");
150.83 + RequireJsPreferences.storeMappings(testProject, mappings);
150.84 + }
150.85 +
150.86 + public void testNavigationFromModuleDeclaration01() throws Exception {
150.87 + checkDeclaration("TestProject1/js/main.js", "'folde^r1/module1',", "module1.js", 0);
150.88 + }
150.89 +
150.90 + public void testNavigationFromModuleDeclaration02() throws Exception {
150.91 + checkDeclaration("TestProject1/js/main.js", "'./folde^r1/module1'", "module1.js", 0);
150.92 + }
150.93 +
150.94 + public void testNavigationFromModuleDeclaration03() throws Exception {
150.95 + checkDeclaration("TestProject1/js/folder1/api/utils.js", "'../../fol^der1/module1'", "module1.js", 0);
150.96 + }
150.97 +
150.98 + public void testNavigationFromParameter01() throws Exception {
150.99 + checkDeclaration("TestProject1/js/main.js", "function (modul^e1, module11, utils) {", "module1.js", 0);
150.100 + }
150.101 +
150.102 + public void testNavigationFromParameter02() throws Exception {
150.103 + checkDeclaration("TestProject1/js/main.js", "function (module1, module11, uti^ls) {", "utils.js", 0);
150.104 + }
150.105 +
150.106 + // project mapping through the RequireJS project customizer
150.107 + public void testNavigationThroughProjectProperties01() throws Exception {
150.108 + checkDeclaration("TestProject1/js/main.js", "'util^s'", "utils.js", 0);
150.109 + }
150.110 +
150.111 + public void testNavigationThroughProjectProperties02() throws Exception {
150.112 + checkDeclaration("TestProject1/js/main.js", "'api/v0^.1/Options'", "Options.js", 0);
150.113 + }
150.114 +
150.115 + public void testNavigationThroughProjectProperties03() throws Exception {
150.116 + checkDeclaration("TestProject1/js/main.js", "'lib/api/v0.1/OMe^ssages'", "OMessages.js", 0);
150.117 + }
150.118 +
150.119 +}
151.1 --- a/nbbuild/cluster.properties Mon Jun 02 14:22:13 2014 +0200
151.2 +++ b/nbbuild/cluster.properties Mon Jun 02 14:23:34 2014 +0200
151.3 @@ -342,6 +342,7 @@
151.4 html.editor.lib,\
151.5 html.knockout,\
151.6 html.lexer,\
151.7 + html.ojet,\
151.8 html.parser,\
151.9 html.validation,\
151.10 httpserver,\
151.11 @@ -360,6 +361,7 @@
151.12 javascript2.jquery,\
151.13 javascript2.kit,\
151.14 javascript2.knockout,\
151.15 + javascript2.requirejs,\
151.16 jellytools.ide,\
151.17 jumpto,\
151.18 languages,\
152.1 --- a/web.common/nbproject/project.xml Mon Jun 02 14:22:13 2014 +0200
152.2 +++ b/web.common/nbproject/project.xml Mon Jun 02 14:23:34 2014 +0200
152.3 @@ -247,6 +247,7 @@
152.4 <friend>org.netbeans.modules.html.editor</friend>
152.5 <friend>org.netbeans.modules.html.editor.lib</friend>
152.6 <friend>org.netbeans.modules.html.knockout</friend>
152.7 + <friend>org.netbeans.modules.html.ojet</friend>
152.8 <friend>org.netbeans.modules.html.parser</friend>
152.9 <friend>org.netbeans.modules.html.validation</friend>
152.10 <friend>org.netbeans.modules.j2ee.common</friend>