http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/nbproject/project.properties ---------------------------------------------------------------------- diff --git a/language/ide/nbproject/project.properties b/language/ide/nbproject/project.properties new file mode 100644 index 0000000..ca8a646 --- /dev/null +++ b/language/ide/nbproject/project.properties @@ -0,0 +1,48 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. +# +# Oracle and Java are registered trademarks of Oracle and/or its affiliates. +# Other names may be trademarks of their respective owners. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# Contributor(s): +# +# The Original Software is NetBeans. The Initial Developer of the Original +# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +# Microsystems, Inc. All Rights Reserved. +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. +modules=\ + ${project.org.netbeans.modules.jackpot30.indexing}:\ + ${project.org.netbeans.modules.jackpot30.ui}:\ + ${project.org.netbeans.modules.jackpot30.apisupport} +project.org.netbeans.modules.jackpot30.apisupport=bridges/apisupport +project.org.netbeans.modules.jackpot30.indexing=indexing +project.org.netbeans.modules.jackpot30.ui=ui
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/nbproject/project.xml ---------------------------------------------------------------------- diff --git a/language/ide/nbproject/project.xml b/language/ide/nbproject/project.xml new file mode 100644 index 0000000..6fb1f58 --- /dev/null +++ b/language/ide/nbproject/project.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + +Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. + +Oracle and Java are registered trademarks of Oracle and/or its affiliates. +Other names may be trademarks of their respective owners. + +The contents of this file are subject to the terms of either the GNU +General Public License Version 2 only ("GPL") or the Common +Development and Distribution License("CDDL") (collectively, the +"License"). You may not use this file except in compliance with the +License. You can obtain a copy of the License at +http://www.netbeans.org/cddl-gplv2.html +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +specific language governing permissions and limitations under the +License. When distributing the software, include this License Header +Notice in each file and include the License file at +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +particular file as subject to the "Classpath" exception as provided +by Oracle in the GPL Version 2 section of the License file that +accompanied this code. If applicable, add the following below the +License Header, with the fields enclosed by brackets [] replaced by +your own identifying information: +"Portions Copyrighted [year] [name of copyright owner]" + +Contributor(s): + +The Original Software is NetBeans. The Initial Developer of the Original +Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +Microsystems, Inc. All Rights Reserved. + +If you wish your version of this file to be governed by only the CDDL +or only the GPL Version 2, indicate your decision by adding +"[Contributor] elects to include this software in this distribution +under the [CDDL or GPL Version 2] license." If you do not indicate a +single choice of license, a recipient has the option to distribute +your version of this file under either the CDDL, the GPL Version 2 or +to extend the choice of license to its licensees as provided above. +However, if you add GPL Version 2 code and therefore, elected the GPL +Version 2 license, then the option applies only if the new code is +made subject to such option by the copyright holder. +--> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.apisupport.project.suite</type> + <configuration> + <data xmlns="http://www.netbeans.org/ns/nb-module-suite-project/1"> + <name>language-ide</name> + </data> + </configuration> +</project> http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/build.xml ---------------------------------------------------------------------- diff --git a/language/ide/ui/build.xml b/language/ide/ui/build.xml new file mode 100644 index 0000000..f2b85ce --- /dev/null +++ b/language/ide/ui/build.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + +Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. + +Oracle and Java are registered trademarks of Oracle and/or its affiliates. +Other names may be trademarks of their respective owners. + +The contents of this file are subject to the terms of either the GNU +General Public License Version 2 only ("GPL") or the Common +Development and Distribution License("CDDL") (collectively, the +"License"). You may not use this file except in compliance with the +License. You can obtain a copy of the License at +http://www.netbeans.org/cddl-gplv2.html +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +specific language governing permissions and limitations under the +License. When distributing the software, include this License Header +Notice in each file and include the License file at +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +particular file as subject to the "Classpath" exception as provided +by Oracle in the GPL Version 2 section of the License file that +accompanied this code. If applicable, add the following below the +License Header, with the fields enclosed by brackets [] replaced by +your own identifying information: +"Portions Copyrighted [year] [name of copyright owner]" + +Contributor(s): + +The Original Software is NetBeans. The Initial Developer of the Original +Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +Microsystems, Inc. All Rights Reserved. + +If you wish your version of this file to be governed by only the CDDL +or only the GPL Version 2, indicate your decision by adding +"[Contributor] elects to include this software in this distribution +under the [CDDL or GPL Version 2] license." If you do not indicate a +single choice of license, a recipient has the option to distribute +your version of this file under either the CDDL, the GPL Version 2 or +to extend the choice of license to its licensees as provided above. +However, if you add GPL Version 2 code and therefore, elected the GPL +Version 2 license, then the option applies only if the new code is +made subject to such option by the copyright holder. +--> +<!-- You may freely edit this file. See harness/README in the NetBeans platform --> +<!-- for some information on what you could do (e.g. targets to override). --> +<!-- If you delete this file and reopen the project it will be recreated. --> +<project name="org.netbeans.modules.jackpot30.ui" default="netbeans" basedir="."> + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.ui.</description> + <import file="nbproject/build-impl.xml"/> + <import file="${suite.dir}/../../findbugs-import.xml"/> +</project> http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/manifest.mf ---------------------------------------------------------------------- diff --git a/language/ide/ui/manifest.mf b/language/ide/ui/manifest.mf new file mode 100644 index 0000000..ece7a4e --- /dev/null +++ b/language/ide/ui/manifest.mf @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +OpenIDE-Module: org.netbeans.modules.jackpot30.ui +OpenIDE-Module-Implementation-Version: 1 +OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/ui/layer.xml +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/ui/Bundle.properties + http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/nbproject/build-impl.xml ---------------------------------------------------------------------- diff --git a/language/ide/ui/nbproject/build-impl.xml b/language/ide/ui/nbproject/build-impl.xml new file mode 100644 index 0000000..a6e73ec --- /dev/null +++ b/language/ide/ui/nbproject/build-impl.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + +Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. + +Oracle and Java are registered trademarks of Oracle and/or its affiliates. +Other names may be trademarks of their respective owners. + +The contents of this file are subject to the terms of either the GNU +General Public License Version 2 only ("GPL") or the Common +Development and Distribution License("CDDL") (collectively, the +"License"). You may not use this file except in compliance with the +License. You can obtain a copy of the License at +http://www.netbeans.org/cddl-gplv2.html +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +specific language governing permissions and limitations under the +License. When distributing the software, include this License Header +Notice in each file and include the License file at +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +particular file as subject to the "Classpath" exception as provided +by Oracle in the GPL Version 2 section of the License file that +accompanied this code. If applicable, add the following below the +License Header, with the fields enclosed by brackets [] replaced by +your own identifying information: +"Portions Copyrighted [year] [name of copyright owner]" + +Contributor(s): + +The Original Software is NetBeans. The Initial Developer of the Original +Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +Microsystems, Inc. All Rights Reserved. + +If you wish your version of this file to be governed by only the CDDL +or only the GPL Version 2, indicate your decision by adding +"[Contributor] elects to include this software in this distribution +under the [CDDL or GPL Version 2] license." If you do not indicate a +single choice of license, a recipient has the option to distribute +your version of this file under either the CDDL, the GPL Version 2 or +to extend the choice of license to its licensees as provided above. +However, if you add GPL Version 2 code and therefore, elected the GPL +Version 2 license, then the option applies only if the new code is +made subject to such option by the copyright holder. +--> +<!-- +*** GENERATED FROM project.xml - DO NOT EDIT *** +*** EDIT ../build.xml INSTEAD *** +--> +<project name="org.netbeans.modules.jackpot30.ui-impl" basedir=".."> + <fail message="Please build using Ant 1.7.1 or higher."> + <condition> + <not> + <antversion atleast="1.7.1"/> + </not> + </condition> + </fail> + <property file="nbproject/private/suite-private.properties"/> + <property file="nbproject/suite.properties"/> + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail> + <property file="${suite.dir}/nbproject/private/platform-private.properties"/> + <property file="${suite.dir}/nbproject/platform.properties"/> + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="${@{value}}"/> + </sequential> + </macrodef> + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2"> + <attribute name="property"/> + <attribute name="value"/> + <sequential> + <property name="@{property}" value="@{value}"/> + </sequential> + </macrodef> + <property file="${user.properties.file}"/> + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness)."> + <condition> + <not> + <contains string="${cluster.path.evaluated}" substring="platform"/> + </not> + </condition> + </fail> + <import file="${harness.dir}/build.xml"/> +</project> http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/nbproject/genfiles.properties ---------------------------------------------------------------------- diff --git a/language/ide/ui/nbproject/genfiles.properties b/language/ide/ui/nbproject/genfiles.properties new file mode 100644 index 0000000..7258ff3 --- /dev/null +++ b/language/ide/ui/nbproject/genfiles.properties @@ -0,0 +1,49 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. +# +# Oracle and Java are registered trademarks of Oracle and/or its affiliates. +# Other names may be trademarks of their respective owners. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# Contributor(s): +# +# The Original Software is NetBeans. The Initial Developer of the Original +# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +# Microsystems, Inc. All Rights Reserved. +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. +build.xml.data.CRC32=8268870d +build.xml.script.CRC32=4ac38acd [email protected] +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=98db8493 +nbproject/build-impl.xml.script.CRC32=e59dabeb +nbproject/[email protected] http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/nbproject/project.properties ---------------------------------------------------------------------- diff --git a/language/ide/ui/nbproject/project.properties b/language/ide/ui/nbproject/project.properties new file mode 100644 index 0000000..fcd211a --- /dev/null +++ b/language/ide/ui/nbproject/project.properties @@ -0,0 +1,45 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. +# +# Oracle and Java are registered trademarks of Oracle and/or its affiliates. +# Other names may be trademarks of their respective owners. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# Contributor(s): +# +# The Original Software is NetBeans. The Initial Developer of the Original +# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +# Microsystems, Inc. All Rights Reserved. +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. +javac.source=1.6 +javac.compilerargs=-Xlint -Xlint:-serial +requires.nb.javac=true +spec.version.base=1.0 http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/nbproject/project.xml ---------------------------------------------------------------------- diff --git a/language/ide/ui/nbproject/project.xml b/language/ide/ui/nbproject/project.xml new file mode 100644 index 0000000..e55930a --- /dev/null +++ b/language/ide/ui/nbproject/project.xml @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + +Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. + +Oracle and Java are registered trademarks of Oracle and/or its affiliates. +Other names may be trademarks of their respective owners. + +The contents of this file are subject to the terms of either the GNU +General Public License Version 2 only ("GPL") or the Common +Development and Distribution License("CDDL") (collectively, the +"License"). You may not use this file except in compliance with the +License. You can obtain a copy of the License at +http://www.netbeans.org/cddl-gplv2.html +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +specific language governing permissions and limitations under the +License. When distributing the software, include this License Header +Notice in each file and include the License file at +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +particular file as subject to the "Classpath" exception as provided +by Oracle in the GPL Version 2 section of the License file that +accompanied this code. If applicable, add the following below the +License Header, with the fields enclosed by brackets [] replaced by +your own identifying information: +"Portions Copyrighted [year] [name of copyright owner]" + +Contributor(s): + +The Original Software is NetBeans. The Initial Developer of the Original +Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +Microsystems, Inc. All Rights Reserved. + +If you wish your version of this file to be governed by only the CDDL +or only the GPL Version 2, indicate your decision by adding +"[Contributor] elects to include this software in this distribution +under the [CDDL or GPL Version 2] license." If you do not indicate a +single choice of license, a recipient has the option to distribute +your version of this file under either the CDDL, the GPL Version 2 or +to extend the choice of license to its licensees as provided above. +However, if you add GPL Version 2 code and therefore, elected the GPL +Version 2 license, then the option applies only if the new code is +made subject to such option by the copyright holder. +--> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.apisupport.project</type> + <configuration> + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3"> + <code-name-base>org.netbeans.modules.jackpot30.ui</code-name-base> + <suite-component/> + <module-dependencies> + <dependency> + <code-name-base>org.netbeans.api.annotations.common</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.13</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.libs.javacapi</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.9.0.3</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.editor</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>3</release-version> + <specification-version>1.60.0.5.19.25</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.editor.lib</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>3</release-version> + <specification-version>3.19.0.19.25</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.editor.lib2</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.54.0.25</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.java.hints.ui</code-name-base> + <run-dependency> + <specification-version>1.3.0.1.4</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.java.source</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>0.95.0.19.18.6</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.java.source.base</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>2.4.1.2.25.8.1</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.awt</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.42</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.dialogs</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.24</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.filesystems</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.59</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.loaders</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.36</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.nodes</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.27</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.util</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>8.22</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.util.lookup</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>8.12</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.util.ui</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>9.3</specification-version> + </run-dependency> + </dependency> + </module-dependencies> + <test-dependencies> + <test-type> + <name>unit</name> + <test-dependency> + <code-name-base>org.netbeans.libs.junit4</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.modules.java.editor</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.modules.java.hints</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.modules.nbjunit</code-name-base> + <recursive/> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.modules.parsing.nb</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.spi.editor.hints</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.spi.java.hints</code-name-base> + <compile-dependency/> + </test-dependency> + </test-type> + </test-dependencies> + <public-packages/> + </data> + </configuration> +</project> http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/nbproject/suite.properties ---------------------------------------------------------------------- diff --git a/language/ide/ui/nbproject/suite.properties b/language/ide/ui/nbproject/suite.properties new file mode 100644 index 0000000..942e12b --- /dev/null +++ b/language/ide/ui/nbproject/suite.properties @@ -0,0 +1,42 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. +# +# Oracle and Java are registered trademarks of Oracle and/or its affiliates. +# Other names may be trademarks of their respective owners. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# Contributor(s): +# +# The Original Software is NetBeans. The Initial Developer of the Original +# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +# Microsystems, Inc. All Rights Reserved. +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. +suite.dir=${basedir}/.. http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/Bundle.properties ---------------------------------------------------------------------- diff --git a/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/Bundle.properties b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/Bundle.properties new file mode 100644 index 0000000..274155a --- /dev/null +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/Bundle.properties @@ -0,0 +1,42 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. +# +# Oracle and Java are registered trademarks of Oracle and/or its affiliates. +# Other names may be trademarks of their respective owners. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# Contributor(s): +# +# The Original Software is NetBeans. The Initial Developer of the Original +# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +# Microsystems, Inc. All Rights Reserved. +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. +OpenIDE-Module-Name=Jackpot 3.0 Extra UI http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/GenerateJackpotScript.java ---------------------------------------------------------------------- diff --git a/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/GenerateJackpotScript.java b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/GenerateJackpotScript.java new file mode 100644 index 0000000..b13ab29 --- /dev/null +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/GenerateJackpotScript.java @@ -0,0 +1,112 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2012 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2012 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.jackpot30.ui; + +import com.sun.source.util.TreePath; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import java.awt.event.ActionEvent; +import java.io.IOException; +import javax.lang.model.element.Element; +import javax.swing.text.JTextComponent; +import org.netbeans.api.editor.EditorActionRegistration; +import org.netbeans.api.java.source.CompilationController; +import org.netbeans.api.java.source.JavaSource; +import org.netbeans.api.java.source.JavaSource.Phase; +import org.netbeans.api.java.source.Task; +import org.netbeans.editor.BaseAction; +import org.openide.awt.StatusDisplayer; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.NbBundle.Messages; +import org.openide.util.datatransfer.ExClipboard; + +@Messages("generate-jackpot-script=Generate Jackpot Script") +@EditorActionRegistration(name = "generate-jackpot-script") +public final class GenerateJackpotScript extends BaseAction { + + public GenerateJackpotScript() { + super(); + } + + @Override + public void actionPerformed(ActionEvent evt, JTextComponent target) { + JavaSource js = JavaSource.forDocument(target.getDocument()); + + if (js == null) { + StatusDisplayer.getDefault().setStatusText("Not a Java file."); + return ; + } + + final int caret = target.getCaretPosition(); + + try { + js.runUserActionTask(new Task<CompilationController>() { + @Override public void run(CompilationController parameter) throws Exception { + parameter.toPhase(Phase.RESOLVED); + TreePath tp = parameter.getTreeUtilities().pathFor(caret); + Element el = parameter.getTrees().getElement(tp); + + if (el != null) { + String script = PatternGenerator.generateFindUsagesScript(parameter, el); + Clipboard clipboard = Lookup.getDefault().lookup(ExClipboard.class); + + if (clipboard == null) { + clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + } + + clipboard.setContents(new StringSelection(script), null); + + StatusDisplayer.getDefault().setStatusText("Script generated into clipboard."); + } else { + StatusDisplayer.getDefault().setStatusText("Cannot resolve Java element."); + } + } + }, true); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/PatternGenerator.java ---------------------------------------------------------------------- diff --git a/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/PatternGenerator.java b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/PatternGenerator.java new file mode 100644 index 0000000..54e0203 --- /dev/null +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/PatternGenerator.java @@ -0,0 +1,146 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2011 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2011 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.jackpot30.ui; + +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import org.netbeans.api.annotations.common.CheckForNull; +import org.netbeans.api.annotations.common.NonNull; +import org.netbeans.api.java.source.CompilationInfo; + +/** + * + * @author lahvac + */ +public class PatternGenerator { + + public static @CheckForNull String generateFindUsagesScript(CompilationInfo info, Element usagesOf) { + switch (usagesOf.getKind()) { + case METHOD: return generateMethodFindUsagesScript(info, (ExecutableElement) usagesOf); + case ENUM_CONSTANT: + case FIELD: return generateFieldFindUsagesScript(info, (VariableElement) usagesOf); + case ANNOTATION_TYPE: + case CLASS: + case ENUM: + case INTERFACE: return generateClassFindUsagesScript(info, (TypeElement) usagesOf); + default: return null; + } + } + + private static @NonNull String generateMethodFindUsagesScript(CompilationInfo info, ExecutableElement usagesOf) { + StringBuilder script = new StringBuilder(); + StringBuilder parameters = new StringBuilder(); + StringBuilder constraints = new StringBuilder(); + String enclosingType = info.getTypes().erasure(usagesOf.getEnclosingElement().asType()).toString(); + int count = 1; + + if (usagesOf.getModifiers().contains(Modifier.STATIC)) { + script.append(enclosingType); + } else { + script.append("$this"); + constraints.append("$this instanceof ").append(enclosingType); + } + + script.append(".").append(usagesOf.getSimpleName()).append("("); + + for (VariableElement p : usagesOf.getParameters()) { + if (count > 1) { + parameters.append(", "); + } + + if (constraints.length() > 0) { + constraints.append(" && "); + } + parameters.append("$").append(count); + constraints.append("$").append(count).append(" instanceof ").append(info.getTypes().erasure(p.asType())); + count++; + } + + script.append(parameters).append(")"); + + if (constraints.length() > 0) { + script.append(" :: ").append(constraints); + } + + script.append(";;"); + + return script.toString(); + } + + private static @NonNull String generateFieldFindUsagesScript(CompilationInfo info, VariableElement usagesOf) { + StringBuilder script = new StringBuilder(); + StringBuilder constraints = new StringBuilder(); + String enclosingType = info.getTypes().erasure(usagesOf.getEnclosingElement().asType()).toString(); + int count = 1; + + if (usagesOf.getModifiers().contains(Modifier.STATIC)) { + script.append(enclosingType); + } else { + script.append("$this"); + constraints.append("$this instanceof ").append(enclosingType); + } + + script.append(".").append(usagesOf.getSimpleName()); + + if (constraints.length() > 0) { + script.append(" :: ").append(constraints); + } + + script.append(";;"); + + return script.toString(); + } + + private static @NonNull String generateClassFindUsagesScript(CompilationInfo info, TypeElement usagesOf) { + StringBuilder script = new StringBuilder(); + + script.append(usagesOf.getQualifiedName()); + script.append(";;"); + + return script.toString(); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/layer.xml ---------------------------------------------------------------------- diff --git a/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/layer.xml b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/layer.xml new file mode 100644 index 0000000..5431e0a --- /dev/null +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/layer.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + +Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. + +Oracle and Java are registered trademarks of Oracle and/or its affiliates. +Other names may be trademarks of their respective owners. + +The contents of this file are subject to the terms of either the GNU +General Public License Version 2 only ("GPL") or the Common +Development and Distribution License("CDDL") (collectively, the +"License"). You may not use this file except in compliance with the +License. You can obtain a copy of the License at +http://www.netbeans.org/cddl-gplv2.html +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +specific language governing permissions and limitations under the +License. When distributing the software, include this License Header +Notice in each file and include the License file at +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +particular file as subject to the "Classpath" exception as provided +by Oracle in the GPL Version 2 section of the License file that +accompanied this code. If applicable, add the following below the +License Header, with the fields enclosed by brackets [] replaced by +your own identifying information: +"Portions Copyrighted [year] [name of copyright owner]" + +Contributor(s): + +The Original Software is NetBeans. The Initial Developer of the Original +Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +Microsystems, Inc. All Rights Reserved. + +If you wish your version of this file to be governed by only the CDDL +or only the GPL Version 2, indicate your decision by adding +"[Contributor] elects to include this software in this distribution +under the [CDDL or GPL Version 2] license." If you do not indicate a +single choice of license, a recipient has the option to distribute +your version of this file under either the CDDL, the GPL Version 2 or +to extend the choice of license to its licensees as provided above. +However, if you add GPL Version 2 code and therefore, elected the GPL +Version 2 license, then the option applies only if the new code is +made subject to such option by the copyright holder. +--> +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd"> +<filesystem> + <folder name="Editors"> + <folder name="text"> + <folder name="x-java"> + <folder name="Popup"> + <file name="generate-jackpot-script"> + <attr name="position" intvalue="1590" /> + </file> + </folder> + </folder> + </folder> + </folder> +</filesystem> http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/settings/HintSettingsAction.java ---------------------------------------------------------------------- diff --git a/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/settings/HintSettingsAction.java b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/settings/HintSettingsAction.java new file mode 100644 index 0000000..176308a --- /dev/null +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/settings/HintSettingsAction.java @@ -0,0 +1,183 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2012 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2012 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.jackpot30.ui.settings; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFileChooser; +import javax.swing.JPanel; +import javax.swing.filechooser.FileFilter; +import org.openide.DialogDescriptor; +import org.openide.DialogDisplayer; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.NbBundle.Messages; + +@ActionID( + category = "Tools", + id = "org.netbeans.modules.jackpot30.ui.settings.HintSettingsAction") +@ActionRegistration( + displayName = "#CTL_HintSettingsAction") +@ActionReferences({ + @ActionReference(path = "Menu/Tools", position = 1250) +}) +@Messages("CTL_HintSettingsAction=Hint Settings") +public final class HintSettingsAction implements ActionListener { + + public void actionPerformed(ActionEvent e) { + JFileChooser f = new JFileChooser(); + + f.setFileFilter(new FileFilter() { + @Override public boolean accept(File f) { + return f.getName().endsWith(".xml"); + } + @Override public String getDescription() { + return "XML Files"; + } + }); + + if (f.showDialog(null, "Open") == JFileChooser.APPROVE_OPTION) { + try { + File settings = f.getSelectedFile(); + final Preferences p = XMLHintPreferences.from(settings); + JPanel hintPanel = createHintPanel(p.node("settings")); + + if (hintPanel == null) { + //TODO: warn the user + return ; + } + + final JCheckBox runDeclarativeHints = new JCheckBox("Run Declarative Rules"); + + runDeclarativeHints.setToolTipText("Should the declarative rules found on classpath be run?"); + runDeclarativeHints.setSelected(p.getBoolean("runDeclarative", true)); + runDeclarativeHints.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { + p.putBoolean("runDeclarative", runDeclarativeHints.isSelected()); + } + }); + + JPanel customizer = new JPanel(new BorderLayout()); + + customizer.add(hintPanel, BorderLayout.CENTER); + customizer.add(runDeclarativeHints, BorderLayout.SOUTH); + + JButton save = new JButton("Save"); + DialogDescriptor dd = new DialogDescriptor(customizer, "Settings", true, new Object[] {save, DialogDescriptor.CANCEL_OPTION}, save, DialogDescriptor.DEFAULT_ALIGN, null, null); + + if (DialogDisplayer.getDefault().notify(dd) == save) { + p.flush(); + } + } catch (BackingStoreException ex) { + Exceptions.printStackTrace(ex); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + } + } + + private static Class<?> loadGlobalClass(String loadClass) { + ClassLoader l = Lookup.getDefault().lookup(ClassLoader.class); + + if (l == null) { + l = HintSettingsAction.class.getClassLoader(); + } + + try { + if (l != null) { + return l.loadClass(loadClass); + } else { + return Class.forName(loadClass); + } + } catch (ClassNotFoundException ex) { + Logger.getLogger(HintSettingsAction.class.getName()).log(Level.FINE, null, ex); + return null; + } + } + + private static JPanel createHintPanel(Preferences p) { + //XXX: constructing through reflection, so that we don't need to have too broad implementation dependencies: + //new HintsPanel(p, new ClassPathBasedHintWrapper()) + try { + Class<?> classPathBasedHintsWrapper = loadGlobalClass("org.netbeans.modules.java.hints.spiimpl.refactoring.Utilities$ClassPathBasedHintWrapper"); + Class<?> hintsPanel = loadGlobalClass("org.netbeans.modules.java.hints.spiimpl.options.HintsPanel"); + + if (classPathBasedHintsWrapper == null || hintsPanel == null) return null; + + Constructor<?> newCPBHW = hintsPanel.getConstructor(Preferences.class, classPathBasedHintsWrapper); + + newCPBHW.setAccessible(true); + + return (JPanel) newCPBHW.newInstance(p, classPathBasedHintsWrapper.newInstance()); + } catch (InstantiationException ex) { + Exceptions.printStackTrace(ex); + } catch (IllegalAccessException ex) { + Exceptions.printStackTrace(ex); + } catch (IllegalArgumentException ex) { + Exceptions.printStackTrace(ex); + } catch (InvocationTargetException ex) { + Exceptions.printStackTrace(ex); + } catch (NoSuchMethodException ex) { + Exceptions.printStackTrace(ex); + } catch (SecurityException ex) { + Exceptions.printStackTrace(ex); + } + + return null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/settings/XMLHintPreferences.java ---------------------------------------------------------------------- diff --git a/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/settings/XMLHintPreferences.java b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/settings/XMLHintPreferences.java new file mode 100644 index 0000000..ee1c369 --- /dev/null +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/settings/XMLHintPreferences.java @@ -0,0 +1,227 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2012 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2012 Sun Microsystems, Inc. + */ +package org.netbeans.modules.jackpot30.ui.settings; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.prefs.AbstractPreferences; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; +import org.openide.util.Exceptions; +import org.openide.xml.XMLUtil; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * + * @author lahvac + */ +public class XMLHintPreferences extends AbstractPreferences { + + private final Element node; + + private XMLHintPreferences(XMLHintPreferences parent, String nodeName, Element node) { + super(parent, nodeName); + this.node = node; + } + + @Override + protected void putSpi(String key, String value) { + node.setAttribute(escape(key), value); + } + + @Override + protected String getSpi(String key) { + return node.hasAttribute(escape(key)) ? node.getAttribute(escape(key)) : null; + } + + @Override + protected void removeSpi(String key) { + node.removeAttribute(key); + } + + @Override + protected void removeNodeSpi() throws BackingStoreException { + node.getParentNode().removeChild(node); + } + + @Override + protected String[] keysSpi() throws BackingStoreException { + List<String> keys = new ArrayList<String>(); + NamedNodeMap nnm = node.getAttributes(); + + for (int i = 0; i < nnm.getLength(); i++) { + keys.add(resolve(((Attr) nnm.item(i)).getName())); + } + + return keys.toArray(new String[keys.size()]); + } + + @Override + protected String[] childrenNamesSpi() throws BackingStoreException { + List<String> names = new ArrayList<String>(); + NodeList nl = node.getChildNodes(); + + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + + if (n instanceof Element) { + names.add(resolve(((Element) n).getNodeName())); + } + } + + return names.toArray(new String[names.size()]); + } + + @Override + protected AbstractPreferences childSpi(String name) { + String escapedName = escape(name); + NodeList nl = node.getChildNodes(); + + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + + if (n instanceof Element && escapedName.equals(((Element) n).getNodeName())) { + return new XMLHintPreferences(this, name, (Element) n); + } + } + + Element nue = node.getOwnerDocument().createElement(escapedName); + + node.appendChild(nue); + + return new XMLHintPreferences(this, name, nue); + } + + @Override + protected void syncSpi() throws BackingStoreException { + //TODO: + } + + @Override + public void flush() throws BackingStoreException { + synchronized (lock) { + parent().flush(); + } + } + + @Override + protected void flushSpi() throws BackingStoreException { + throw new IllegalStateException(); + } + + private static String escape(String what) { + return what.replace("__", "___").replace("$", "__d"); + } + + private static String resolve(String what) { + return what.replace("__d", "$").replace("___", "__"); + } + + public static Preferences from(File file) throws IOException { + if (!file.canRead()) { + Document nueDocument = XMLUtil.createDocument("hints", null, null, null); + + return new RootXMLHintPreferences(nueDocument, file); + } + + InputStream in = new BufferedInputStream(new FileInputStream(file)); + + try { + Document parsed = XMLUtil.parse(new InputSource(in), false, false, null, null); + + return new RootXMLHintPreferences(parsed, file); + } catch (SAXException ex) { + throw new IOException(ex); + } finally { + in.close(); + } + } + + private static final class RootXMLHintPreferences extends XMLHintPreferences { + private final Document doc; + private final File file; + + public RootXMLHintPreferences(Document doc, File file) { + super(null, "", doc.getDocumentElement()); + this.doc = doc; + this.file = file; + } + + @Override + public void flush() throws BackingStoreException { + synchronized (lock) { + OutputStream out = null; + try { + out = new BufferedOutputStream(new FileOutputStream(file)); + XMLUtil.write(doc, out, "UTF-8"); + } catch (IOException ex) { + throw new BackingStoreException(ex); + } finally { + try { + if (out != null) { + out.close(); + } + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + } + } + } + + } + +} http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/PatternGeneratorTest.java ---------------------------------------------------------------------- diff --git a/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/PatternGeneratorTest.java b/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/PatternGeneratorTest.java new file mode 100644 index 0000000..44e8838 --- /dev/null +++ b/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/PatternGeneratorTest.java @@ -0,0 +1,153 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2011 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2011 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.jackpot30.ui; + +import com.sun.source.util.TreePath; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import org.netbeans.api.editor.mimelookup.MimePath; +import org.netbeans.api.java.source.CompilationInfo; +import org.netbeans.modules.java.hints.infrastructure.TreeRuleTestBase; +import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor; +import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker; +import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings; +import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings.GlobalSettingsProvider; +import org.netbeans.spi.editor.hints.ErrorDescription; +import org.netbeans.spi.editor.mimelookup.MimeDataProvider; +import org.openide.util.Lookup; +import org.openide.util.lookup.Lookups; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author lahvac + */ +public class PatternGeneratorTest extends TreeRuleTestBase { + + public PatternGeneratorTest(String name) { + super(name); + } + + public void testStaticMethod() throws Exception { + performTest("package test;\n" + + "public class Test {\n" + + " public static void te|st(int i, String s) {\n" + + " test(i, s);\n" + + " }\n" + + "}\n", + "3:8-3:12:verifier:TODO: No display name"); + } + + public void testInstanceMethod() throws Exception { + performTest("package test;\n" + + "public class Test {\n" + + " public void te|st(int i, String s) {\n" + + " new Test().test(i, s);\n" + + " test(i, s);\n" + + " }\n" + + "}\n", + "3:19-3:23:verifier:TODO: No display name", + "4:8-4:12:verifier:TODO: No display name"); + } + + public void testStaticField() throws Exception { + performTest("package test;\n" + + "public class Test {\n" + + " public static int I|I = 0;" + + " public int test() {\n" + + " return II;\n" + + " }\n" + + "}\n", + "3:15-3:17:verifier:TODO: No display name"); + } + + public void testInstanceField() throws Exception { + performTest("package test;\n" + + "public class Test {\n" + + " public int I|I = 0;" + + " public int test() {\n" + + " if (true) return II; else return new Test().II;\n" + + " }\n" + + "}\n", + "3:25-3:27:verifier:TODO: No display name", + "3:52-3:54:verifier:TODO: No display name"); + } + + private void performTest(String code, String... golden) throws Exception { + performAnalysisTest("test/Test.java", + code, + golden); + } + + @Override + protected List<ErrorDescription> computeErrors(CompilationInfo info, TreePath path) { + String script = PatternGenerator.generateFindUsagesScript(info, info.getTrees().getElement(path)); + + return new HintsInvoker(HintsSettings.getSettingsFor(info.getFileObject()), new AtomicBoolean()).computeHints(info, PatternConvertor.create(script)); + } + + @Override + public void testIssue105979() throws Exception {} + + @Override + public void testIssue108246() throws Exception {} + + @Override + public void testIssue113933() throws Exception {} + + @Override + public void testNoHintsForSimpleInitialize() throws Exception {} + + @ServiceProvider(service=MimeDataProvider.class) + public static class MimeLookupProviderImpl implements MimeDataProvider { + private final Lookup lookup = Lookups.singleton(new GlobalSettingsProvider()); + + @Override + public Lookup getLookup(MimePath mimePath) { + if ("text/x-java".equals(mimePath.getPath())) + return lookup; + return null; + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/settings/XMLHintPreferencesTest.java ---------------------------------------------------------------------- diff --git a/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/settings/XMLHintPreferencesTest.java b/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/settings/XMLHintPreferencesTest.java new file mode 100644 index 0000000..12f3a65 --- /dev/null +++ b/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/settings/XMLHintPreferencesTest.java @@ -0,0 +1,123 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2012 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2012 Sun Microsystems, Inc. + */ +package org.netbeans.modules.jackpot30.ui.settings; + +import java.io.File; +import java.util.Arrays; +import java.util.prefs.Preferences; +import org.netbeans.junit.NbTestCase; + +/** + * + * @author lahvac + */ +public class XMLHintPreferencesTest extends NbTestCase { + + public XMLHintPreferencesTest(String name) { + super(name); + } + + public void testStorage() throws Exception { + clearWorkDir(); + + File storage = new File(getWorkDir(), "test.xml"); + Preferences p = XMLHintPreferences.from(storage); + + p.put("key", "value"); + p.node("subnode").put("innerkey", "innervalue"); + + for (String phase : new String[] {"before-reload", "after-reload"}) { + assertTrue(Arrays.equals(new String[] {"key"}, p.keys())); + assertEquals("value", p.get("key", null)); + assertTrue(Arrays.equals(new String[] {"subnode"}, p.childrenNames())); + + Preferences subnode = p.node("subnode"); + + assertEquals("innervalue", subnode.get("innerkey", null)); + + p.flush(); + p = XMLHintPreferences.from(storage); + } + + p.remove("key"); + p.put("key2", "value2"); + p.node("subnode").removeNode(); + p.node("subnode2").put("innerkey2", "innervalue2"); + + for (String phase : new String[] {"before-reload", "after-reload"}) { + assertTrue(Arrays.equals(new String[] {"key2"}, p.keys())); + assertEquals("value2", p.get("key2", null)); + assertTrue(Arrays.equals(new String[] {"subnode2"}, p.childrenNames())); + + Preferences subnode = p.node("subnode2"); + + assertEquals("innervalue2", subnode.get("innerkey2", null)); + + p.flush(); + p = XMLHintPreferences.from(storage); + } + } + + public void testEscaping() throws Exception { + clearWorkDir(); + + File storage = new File(getWorkDir(), "test.xml"); + Preferences p = XMLHintPreferences.from(storage); + + p.put("a$b", "a$b"); + p.node("a$b").put("a$b", "a$b"); + + for (String phase : new String[] {"before-reload", "after-reload"}) { + assertTrue(Arrays.equals(new String[] {"a$b"}, p.keys())); + assertEquals("a$b", p.get("a$b", null)); + assertTrue(Arrays.equals(new String[] {"a$b"}, p.childrenNames())); + + Preferences subnode = p.node("a$b"); + + assertEquals("a$b", subnode.get("a$b", null)); + + p.flush(); + p = XMLHintPreferences.from(storage); + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/language/post-build.sh ---------------------------------------------------------------------- diff --git a/language/post-build.sh b/language/post-build.sh new file mode 100755 index 0000000..d11c30a --- /dev/null +++ b/language/post-build.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved. +# +# Oracle and Java are registered trademarks of Oracle and/or its affiliates. +# Other names may be trademarks of their respective owners. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# Contributor(s): +# +# The Original Software is NetBeans. The Initial Developer of the Original +# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun +# Microsystems, Inc. All Rights Reserved. +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. + +(cd server/web/language.web.api; ant "$@" clean && ant "$@") || exit 1
