You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by po...@apache.org on 2017/09/03 17:33:14 UTC
[21/51] [partial] incubator-netbeans-jackpot30 git commit:
INFRA-15006 Import for http://bits.netbeans.org/download/apache-donation
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/ide/usages/nbproject/project.xml
----------------------------------------------------------------------
diff --git a/remoting/ide/usages/nbproject/project.xml b/remoting/ide/usages/nbproject/project.xml
new file mode 100644
index 0000000..200dd73
--- /dev/null
+++ b/remoting/ide/usages/nbproject/project.xml
@@ -0,0 +1,303 @@
+<?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.ide.usages</code-name-base>
+ <suite-component/>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.java.classpath</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.30</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.7.0.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.libs.lucene</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>3</release-version>
+ <specification-version>3.7</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.58.0.5.13.10</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.43.0.10</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.jackpot30.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.jackpot30.remoting.api</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.11</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.84</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.netbeans.modules.java.sourceui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.23.0.1.17</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.37</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.52.0.8</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.settings</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.32</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0</release-version>
+ <specification-version>1.25</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.spi.java.hints</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.4</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.actions</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.23</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.awt</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.35</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.dialogs</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.21</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.explorer</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.36</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.48</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.loaders</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.23</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.23</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.text</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.39</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.16</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.9</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>
+ <dependency>
+ <code-name-base>org.openide.windows</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.43</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.nbjunit</code-name-base>
+ <recursive/>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.projectui</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/remoting/ide/usages/nbproject/suite.properties
----------------------------------------------------------------------
diff --git a/remoting/ide/usages/nbproject/suite.properties b/remoting/ide/usages/nbproject/suite.properties
new file mode 100644
index 0000000..942e12b
--- /dev/null
+++ b/remoting/ide/usages/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/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Bundle.properties
----------------------------------------------------------------------
diff --git a/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Bundle.properties b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Bundle.properties
new file mode 100644
index 0000000..d9ed9c8
--- /dev/null
+++ b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Bundle.properties
@@ -0,0 +1,49 @@
+# 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.
+#
+CTL_RemoteUsagesWindowAction=RemoteUsagesWindow
+CTL_RemoteUsagesWindowTopComponent=RemoteUsagesWindow Window
+HINT_RemoteUsagesWindowTopComponent=This is a RemoteUsagesWindow window
+OpenIDE-Module-Name=Jackpot 3.0 Usage IDE
+MethodOptions.usages.text=Usages
+MethodOptions.overriding.text=Overriding methods
+ClassOptions.usages.text=Usages
+ClassOptions.subclasses.text=Subclasses
+MethodOptions.jLabel3.text=From:
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/ClassOptions.form
----------------------------------------------------------------------
diff --git a/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/ClassOptions.form b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/ClassOptions.form
new file mode 100644
index 0000000..ddce61a
--- /dev/null
+++ b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/ClassOptions.form
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <NonVisualComponents>
+ <Component class="javax.swing.ButtonGroup" name="buttonGroup">
+ </Component>
+ </NonVisualComponents>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="usages" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="subclasses" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="usages" min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="subclasses" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JRadioButton" name="usages">
+ <Properties>
+ <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
+ <ComponentRef name="buttonGroup"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/jackpot30/ide/usages/Bundle.properties" key="ClassOptions.usages.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}", {arguments})"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="usagesItemStateChanged"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JRadioButton" name="subclasses">
+ <Properties>
+ <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
+ <ComponentRef name="buttonGroup"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/jackpot30/ide/usages/Bundle.properties" key="ClassOptions.subclasses.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}", {arguments})"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="subclassesItemStateChanged"/>
+ </Events>
+ </Component>
+ </SubComponents>
+</Form>
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/ClassOptions.java
----------------------------------------------------------------------
diff --git a/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/ClassOptions.java b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/ClassOptions.java
new file mode 100644
index 0000000..844d5e1
--- /dev/null
+++ b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/ClassOptions.java
@@ -0,0 +1,130 @@
+/*
+ * 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.ide.usages;
+
+import java.util.Set;
+
+/**
+ *
+ * @author lahvac
+ */
+public class ClassOptions extends javax.swing.JPanel {
+
+ private final Set<RemoteUsages.SearchOptions> options;
+
+ public ClassOptions(Set<RemoteUsages.SearchOptions> options) {
+ this.options = options;
+ initComponents();
+ usages.setSelected(true);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ buttonGroup = new javax.swing.ButtonGroup();
+ usages = new javax.swing.JRadioButton();
+ subclasses = new javax.swing.JRadioButton();
+
+ buttonGroup.add(usages);
+ usages.setText(org.openide.util.NbBundle.getMessage(ClassOptions.class, "ClassOptions.usages.text", new Object[] {})); // NOI18N
+ usages.addItemListener(new java.awt.event.ItemListener() {
+ public void itemStateChanged(java.awt.event.ItemEvent evt) {
+ usagesItemStateChanged(evt);
+ }
+ });
+
+ buttonGroup.add(subclasses);
+ subclasses.setText(org.openide.util.NbBundle.getMessage(ClassOptions.class, "ClassOptions.subclasses.text", new Object[] {})); // NOI18N
+ subclasses.addItemListener(new java.awt.event.ItemListener() {
+ public void itemStateChanged(java.awt.event.ItemEvent evt) {
+ subclassesItemStateChanged(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(usages)
+ .addComponent(subclasses))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(usages)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(subclasses)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void usagesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_usagesItemStateChanged
+ if (usages.isSelected())
+ options.add(RemoteUsages.SearchOptions.USAGES);
+ else
+ options.remove(RemoteUsages.SearchOptions.USAGES);
+ }//GEN-LAST:event_usagesItemStateChanged
+
+ private void subclassesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_subclassesItemStateChanged
+ if (subclasses.isSelected())
+ options.add(RemoteUsages.SearchOptions.SUB);
+ else
+ options.remove(RemoteUsages.SearchOptions.SUB);
+ }//GEN-LAST:event_subclassesItemStateChanged
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.ButtonGroup buttonGroup;
+ private javax.swing.JRadioButton subclasses;
+ private javax.swing.JRadioButton usages;
+ // End of variables declaration//GEN-END:variables
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/MethodOptions.form
----------------------------------------------------------------------
diff --git a/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/MethodOptions.form b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/MethodOptions.form
new file mode 100644
index 0000000..78a2116
--- /dev/null
+++ b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/MethodOptions.form
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="fromClass" max="32767" attributes="0"/>
+ </Group>
+ <Component id="overriding" pref="328" max="32767" attributes="0"/>
+ <Component id="usages" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="fromClass" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Component id="usages" min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="overriding" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JCheckBox" name="usages">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/jackpot30/ide/usages/Bundle.properties" key="MethodOptions.usages.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="usagesItemStateChanged"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="overriding">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/jackpot30/ide/usages/Bundle.properties" key="MethodOptions.overriding.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="overridingItemStateChanged"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel3">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/jackpot30/ide/usages/Bundle.properties" key="MethodOptions.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}", {arguments})"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="fromClass">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+ <StringArray count="4">
+ <StringItem index="0" value="Item 1"/>
+ <StringItem index="1" value="Item 2"/>
+ <StringItem index="2" value="Item 3"/>
+ <StringItem index="3" value="Item 4"/>
+ </StringArray>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/MethodOptions.java
----------------------------------------------------------------------
diff --git a/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/MethodOptions.java b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/MethodOptions.java
new file mode 100644
index 0000000..9c1d7d7
--- /dev/null
+++ b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/MethodOptions.java
@@ -0,0 +1,182 @@
+/*
+ * 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.ide.usages;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Set;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JList;
+import org.netbeans.api.java.source.ElementHandle;
+import org.netbeans.api.java.source.SourceUtils;
+import org.netbeans.modules.jackpot30.ide.usages.RemoteUsages.SelectionListener;
+
+/**
+ *
+ * @author lahvac
+ */
+public class MethodOptions extends javax.swing.JPanel {
+
+ private final Set<RemoteUsages.SearchOptions> options;
+
+ public MethodOptions(RemoteUsages.ElementDescription element, Set<RemoteUsages.SearchOptions> options, final SelectionListener sl) {
+ this.options = options;
+
+ initComponents();
+
+ fromClass.removeAllItems();
+ fromClass.addItem(element.element);
+
+ for (ElementHandle<?> superMethod : element.superMethods) {
+ fromClass.addItem(superMethod);
+ }
+
+ fromClass.setRenderer(new DefaultListCellRenderer() {
+ @Override
+ public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ if (value instanceof ElementHandle) {
+ ElementHandle<?> m = (ElementHandle<?>) value;
+
+ value = SourceUtils.getJVMSignature(m)[0]; //TODO: icon???
+ }
+ return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+ }
+ });
+
+ fromClass.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ sl.elementSelected((ElementHandle<?>) fromClass.getSelectedItem());
+ }
+ });
+
+ if (fromClass.getModel().getSize() == 1) {
+ fromClass.setEnabled(false);
+ }
+
+ usages.setSelected(true);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ usages = new javax.swing.JCheckBox();
+ overriding = new javax.swing.JCheckBox();
+ jLabel3 = new javax.swing.JLabel();
+ fromClass = new javax.swing.JComboBox();
+
+ usages.setText(org.openide.util.NbBundle.getMessage(MethodOptions.class, "MethodOptions.usages.text")); // NOI18N
+ usages.addItemListener(new java.awt.event.ItemListener() {
+ public void itemStateChanged(java.awt.event.ItemEvent evt) {
+ usagesItemStateChanged(evt);
+ }
+ });
+
+ overriding.setText(org.openide.util.NbBundle.getMessage(MethodOptions.class, "MethodOptions.overriding.text")); // NOI18N
+ overriding.addItemListener(new java.awt.event.ItemListener() {
+ public void itemStateChanged(java.awt.event.ItemEvent evt) {
+ overridingItemStateChanged(evt);
+ }
+ });
+
+ jLabel3.setText(org.openide.util.NbBundle.getMessage(MethodOptions.class, "MethodOptions.jLabel3.text", new Object[] {})); // NOI18N
+
+ fromClass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(fromClass, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(overriding, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
+ .addComponent(usages, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel3)
+ .addComponent(fromClass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addComponent(usages)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(overriding)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void usagesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_usagesItemStateChanged
+ if (usages.isSelected())
+ options.add(RemoteUsages.SearchOptions.USAGES);
+ else
+ options.remove(RemoteUsages.SearchOptions.USAGES);
+ }//GEN-LAST:event_usagesItemStateChanged
+
+ private void overridingItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_overridingItemStateChanged
+ if (overriding.isSelected())
+ options.add(RemoteUsages.SearchOptions.SUB);
+ else
+ options.remove(RemoteUsages.SearchOptions.SUB);
+ }//GEN-LAST:event_overridingItemStateChanged
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JComboBox fromClass;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JCheckBox overriding;
+ private javax.swing.JCheckBox usages;
+ // End of variables declaration//GEN-END:variables
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Nodes.java
----------------------------------------------------------------------
diff --git a/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Nodes.java b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Nodes.java
new file mode 100644
index 0000000..4e33a38
--- /dev/null
+++ b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Nodes.java
@@ -0,0 +1,672 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2010-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 2008-2011 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.jackpot30.ide.usages;
+
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.IdentifierTree;
+import com.sun.source.tree.MemberSelectTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.NewClassTree;
+import com.sun.source.tree.ParameterizedTypeTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.util.SourcePositions;
+import java.awt.Image;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.swing.Action;
+import org.netbeans.api.java.classpath.ClassPath;
+import org.netbeans.api.java.classpath.GlobalPathRegistry;
+import org.netbeans.api.java.source.CompilationController;
+import org.netbeans.api.java.source.CompilationInfo;
+import org.netbeans.api.java.source.ElementHandle;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.api.java.source.JavaSource.Phase;
+import org.netbeans.api.java.source.SourceUtils;
+import org.netbeans.api.java.source.Task;
+import org.netbeans.api.java.source.UiUtils;
+import org.netbeans.api.java.source.support.CancellableTreePathScanner;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.modules.jackpot30.remoting.api.RemoteIndex;
+import org.netbeans.spi.project.ui.LogicalViewProvider;
+import org.openide.actions.OpenAction;
+import org.openide.cookies.EditorCookie;
+import org.openide.cookies.LineCookie;
+import org.openide.cookies.OpenCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectNotFoundException;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.ChildFactory;
+import org.openide.nodes.Children;
+import org.openide.nodes.FilterNode;
+import org.openide.nodes.Node;
+import org.openide.nodes.NodeOp;
+import org.openide.text.Line;
+import org.openide.util.Exceptions;
+import org.openide.util.ImageUtilities;
+import org.openide.util.NbBundle;
+import org.openide.util.lookup.AbstractLookup;
+import org.openide.util.lookup.InstanceContent;
+import org.openide.util.lookup.Lookups;
+
+/**
+ *
+ * @author lahvac
+ */
+public class Nodes {
+
+ public static Node constructSemiLogicalView(Iterable<? extends FileObject> filesWithOccurrences, Map<RemoteIndex, List<String>> unmappable, ElementHandle<?> eh, Set<RemoteUsages.SearchOptions> options) {
+ Map<Project, Collection<FileObject>> projects = new HashMap<Project, Collection<FileObject>>();
+
+ for (FileObject file : filesWithOccurrences) {
+ Project project = FileOwnerQuery.getOwner(file);
+
+ if (project == null) {
+ Logger.getLogger(Nodes.class.getName()).log(Level.WARNING, "Cannot find project for: {0}", FileUtil.getFileDisplayName(file));
+ }
+
+ Collection<FileObject> projectFiles = projects.get(project);
+
+ if (projectFiles == null) {
+ projects.put(project, projectFiles = new ArrayList<FileObject>());
+ }
+
+ projectFiles.add(file);
+
+ //XXX: workarounding NbProject's Evaluator, which is too stupid to fire meaningfull property events, which leads to PackageView rebuilding inadvertedly itself due to virtual CONTAINERSHIP change:
+ ClassPath.getClassPath(file, ClassPath.COMPILE).getRoots();
+ }
+
+ final Collection<FileObject> outsideProjects = projects.remove(null);
+
+ List<Node> nodes = new ArrayList<Node>(projects.size());
+
+ for (Project p : projects.keySet()) {
+ nodes.add(constructSemiLogicalView(p, projects.get(p), eh, options));
+ }
+
+ Collections.sort(nodes, new Comparator<Node>() {
+ @Override public int compare(Node o1, Node o2) {
+ return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName());
+ }
+ });
+
+ if (outsideProjects != null) {
+ AbstractNode outsideProjectsNode = new AbstractNode(Children.create(new ChildFactory<FileObject>() {
+ @Override protected boolean createKeys(List<FileObject> toPopulate) {
+ toPopulate.addAll(outsideProjects);
+ return true;
+ }
+ @Override protected Node createNodeForKey(FileObject file) {
+ try {
+ DataObject od = DataObject.find(file);
+ return od.getNodeDelegate();
+ } catch (DataObjectNotFoundException ex) {
+ Exceptions.printStackTrace(ex);
+ return null;
+ }
+ }
+ }, true));
+
+ outsideProjectsNode.setDisplayName("Occurrences outside locally recognized projects");
+ nodes.add(outsideProjectsNode);
+ }
+
+ if (!unmappable.isEmpty()) {
+ List<Node> localNodes = new ArrayList<Node>(unmappable.size());
+
+ for (final Entry<RemoteIndex, List<String>> e : unmappable.entrySet()) {
+ AbstractNode localNode = new AbstractNode(Children.create(new ChildFactory<String>() {
+ @Override protected boolean createKeys(List<String> toPopulate) {
+ Collections.sort(e.getValue());
+ toPopulate.addAll(e.getValue());
+ return true;
+ }
+ @Override protected Node createNodeForKey(final String rel) {
+ OpenCookie open = new OpenCookie() {
+ @Override public void open() {
+ UiUtils.open(e.getKey().getFile(rel), 0);
+ }
+ };
+ AbstractNode fileNode = new AbstractNode(Children.LEAF, Lookups.singleton(open)) {
+ @Override public Action[] getActions(boolean context) {
+ return new Action[] {
+ OpenAction.get(OpenAction.class)
+ };
+ }
+ @Override public Action getPreferredAction() {
+ return OpenAction.get(OpenAction.class);
+ }
+ };
+
+ fileNode.setDisplayName(rel);
+ return fileNode;
+ }
+ }, true));
+
+ localNode.setDisplayName("Index: " + e.getKey().remote.toExternalForm() + ", segment: " + e.getKey().remoteSegment);
+ localNodes.add(localNode);
+ }
+
+ AbstractNode notExisting = new AbstractNode(new DirectChildren(localNodes));
+
+ notExisting.setDisplayName("Occurrences in files that are not locally available");
+ nodes.add(notExisting);
+ }
+
+ return new AbstractNode(new DirectChildren(nodes));
+ }
+
+ private static Node constructSemiLogicalView(final Project p, final Iterable<? extends FileObject> files, ElementHandle<?> eh, Set<RemoteUsages.SearchOptions> options) {
+ final LogicalViewProvider lvp = p.getLookup().lookup(LogicalViewProvider.class);
+ final Node view;
+
+ if (lvp != null) {
+ view = lvp.createLogicalView();
+ } else {
+ try {
+ view = DataObject.find(p.getProjectDirectory()).getNodeDelegate();
+ } catch (DataObjectNotFoundException ex) {
+ Exceptions.printStackTrace(ex);
+ return new AbstractNode(Children.LEAF);
+ }
+ }
+
+ return new Wrapper(view, new ComputeNodes(files, view, lvp, p), eh, options);
+ }
+
+ private static Node locateChild(Node parent, LogicalViewProvider lvp, FileObject file) {
+ if (lvp != null) {
+ return lvp.findPath(parent, file);
+ }
+
+ throw new UnsupportedOperationException("Not done yet");
+ }
+
+ private static class Wrapper extends FilterNode {
+
+ public Wrapper(Node orig, ComputeNodes fileNodes, ElementHandle<?> eh, Set<RemoteUsages.SearchOptions> options) {
+ super(orig, new WrapperChildren(orig, fileNodes, eh, options));
+ }
+
+ @Override
+ public Action[] getActions(boolean context) {
+ return new Action[0];
+ }
+
+ }
+
+ private static boolean isParent(Node parent, Node child) {
+ if (NodeOp.isSon(parent, child)) {
+ return true;
+ }
+
+ Node p = child.getParentNode();
+
+ if (p == null) {
+ return false;
+ }
+
+ return isParent(parent, p);
+ }
+
+ private static class WrapperChildren extends Children.Keys<Node> {
+
+ private final Node orig;
+ private final ComputeNodes fileNodes;
+ private final ElementHandle<?> eh;
+ private final Set<RemoteUsages.SearchOptions> options;
+
+ public WrapperChildren(Node orig, ComputeNodes fileNodes, ElementHandle<?> eh, Set<RemoteUsages.SearchOptions> options) {
+ this.orig = orig;
+ this.fileNodes = fileNodes;
+ this.eh = eh;
+ this.options = options;
+
+ }
+
+ @Override
+ protected void addNotify() {
+ super.addNotify();
+ doSetKeys();
+ }
+
+ private void doSetKeys() {
+ Node[] nodes = orig.getChildren().getNodes(true);
+ List<Node> toSet = new LinkedList<Node>();
+
+ OUTER: for (Node n : nodes) {
+ for (Node c : fileNodes.compute()) {
+ if (n == c || isParent(n, c)) {
+ toSet.add(n);
+ continue OUTER;
+ }
+ }
+ }
+
+ setKeys(toSet);
+ }
+
+ @Override
+ protected Node[] createNodes(Node key) {
+ if (fileNodes.compute().contains(key)) {
+ FileObject file = key.getLookup().lookup(FileObject.class);
+ Children c = file != null ? Children.create(new UsagesChildren(file, eh, options), true) : Children.LEAF;
+
+ return new Node[] {new FilterNode(key, c)}; //XXX
+ }
+ return new Node[] {new Wrapper(key, fileNodes, eh, options)};
+ }
+
+ }
+
+ private static final class DirectChildren extends Children.Keys<Node> {
+
+ public DirectChildren(Collection<Node> nodes) {
+ setKeys(nodes);
+ }
+
+ @Override
+ protected Node[] createNodes(Node key) {
+ return new Node[] {key};
+ }
+ }
+
+ private static Node noOccurrencesNode() {
+ AbstractNode noOccurrences = new AbstractNode(Children.LEAF);
+
+ noOccurrences.setDisplayName("No Occurrences Found");
+
+ return noOccurrences;
+ }
+
+ private static final class UsagesChildren extends ChildFactory<Node> {
+
+ private final FileObject file;
+ private final ElementHandle<?> eh;
+ private final Set<RemoteUsages.SearchOptions> options;
+
+ public UsagesChildren(FileObject file, ElementHandle<?> eh, Set<RemoteUsages.SearchOptions> options) {
+ this.file = file;
+ this.eh = eh;
+ this.options = options;
+ }
+
+ @Override
+ protected boolean createKeys(final List<Node> toPopulate) {
+ List<Node> result = new ArrayList<Node>();
+
+ if (!computeOccurrences(file, eh, options, result)) {
+ result.clear();
+
+ ClassPath source = ClassPath.getClassPath(file, ClassPath.SOURCE);
+
+ GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {source});
+
+ try {
+ SourceUtils.waitScanFinished();
+ computeOccurrences(file, eh, options, result);
+ } catch (InterruptedException ex) {
+ Exceptions.printStackTrace(ex);
+ } finally {
+ GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, new ClassPath[] {source});
+ }
+ }
+
+ toPopulate.addAll(result);
+
+ if (toPopulate.isEmpty()) toPopulate.add(noOccurrencesNode());
+
+ return true;
+ }
+
+ @Override
+ protected Node createNodeForKey(Node key) {
+ return key;
+ }
+
+ }
+
+ static boolean computeOccurrences(FileObject file, final ElementHandle<?> eh, final Set<RemoteUsages.SearchOptions> options, final List<Node> toPopulate) {
+ final boolean[] success = new boolean[] {true};
+
+ try {
+ JavaSource.forFileObject(file).runUserActionTask(new Task<CompilationController>() {
+ @Override public void run(final CompilationController parameter) throws Exception {
+ parameter.toPhase(Phase.RESOLVED);
+
+ final Element toFind = eh.resolve(parameter);
+
+ if (toFind == null) {
+ return;
+ }
+
+ final AtomicBoolean stop = new AtomicBoolean();
+
+ new CancellableTreePathScanner<Void, Void>(stop) {
+ @Override public Void visitIdentifier(IdentifierTree node, Void p) {
+ handleNode(node.getName(), getCurrentPath().getLeaf());
+ return super.visitIdentifier(node, p);
+ }
+ @Override public Void visitMemberSelect(MemberSelectTree node, Void p) {
+ handleNode(node.getIdentifier(), getCurrentPath().getLeaf());
+ return super.visitMemberSelect(node, p);
+ }
+ @Override public Void visitNewClass(NewClassTree node, Void p) {
+ Name simpleName = null;
+ Tree name = node.getIdentifier();
+
+ OUTER: while (true) {
+ switch (name.getKind()) {
+ case PARAMETERIZED_TYPE: name = ((ParameterizedTypeTree) name).getType(); break;
+ case MEMBER_SELECT: simpleName = ((MemberSelectTree) name).getIdentifier(); break OUTER;
+ case IDENTIFIER: simpleName = ((IdentifierTree) name).getName(); break OUTER;
+ default: name = node; break OUTER;
+ }
+ }
+
+ handleNode(simpleName, name);
+ return super.visitNewClass(node, p);
+ }
+ private void handleNode(Name simpleName, Tree toHighlight) {
+ if (!options.contains(RemoteUsages.SearchOptions.USAGES)) return;
+ Element el = parameter.getTrees().getElement(getCurrentPath());
+
+ if (el == null || el.asType().getKind() == TypeKind.ERROR) {
+ if (toFind.getSimpleName().equals(simpleName)) {
+ success[0] = false;
+ stop.set(true);
+ return; //TODO: correct? what about the second pass?
+ }
+ }
+ if (Nodes.equals(parameter, toFind, el)) {
+ toPopulate.add(new OccurrenceNode(parameter, toHighlight));
+ }
+ }
+ @Override
+ public Void visitMethod(MethodTree node, Void p) {
+ if (options.contains(RemoteUsages.SearchOptions.SUB) && toFind.getKind() == ElementKind.METHOD) {
+ boolean found = false;
+ Element el = parameter.getTrees().getElement(getCurrentPath());
+
+ if (el != null && el.getKind() == ElementKind.METHOD) {
+ if (parameter.getElements().overrides((ExecutableElement) el, (ExecutableElement) toFind, (TypeElement) el.getEnclosingElement())) {
+ toPopulate.add(new OccurrenceNode(parameter, node));
+ found = true;
+ }
+ }
+
+ if (!found && el != null && el.getSimpleName().contentEquals(toFind.getSimpleName())) {
+ for (TypeMirror sup : superTypes((TypeElement) el.getEnclosingElement())) {
+ if (sup.getKind() == TypeKind.ERROR) {
+ success[0] = false;
+ stop.set(true);
+ return null; //TODO: correct? what about the second pass?
+ }
+ }
+ }
+ }
+ return super.visitMethod(node, p);
+ }
+ @Override
+ public Void visitClass(ClassTree node, Void p) {
+ if (options.contains(RemoteUsages.SearchOptions.SUB) && (toFind.getKind().isClass() || toFind.getKind().isInterface())) {
+ Element el = parameter.getTrees().getElement(getCurrentPath());
+ boolean wasError = false;
+
+ for (TypeMirror sup : superTypes((TypeElement) el)) {
+ if (sup.getKind() == TypeKind.ERROR) {
+ wasError = true;
+ } else {
+ if (toFind.equals(parameter.getTypes().asElement(sup))) {
+ wasError = false;
+ toPopulate.add(new OccurrenceNode(parameter, node));
+ break;
+ }
+ }
+ }
+
+ if (wasError) {
+ success[0] = false;
+ stop.set(true);
+ return null; //TODO: correct? what about the second pass?
+ }
+ }
+
+ return super.visitClass(node, p);
+ }
+ private Set<TypeMirror> superTypes(TypeElement type) {
+ Set<TypeMirror> result = new HashSet<TypeMirror>();
+ List<TypeMirror> todo = new LinkedList<TypeMirror>();
+
+ todo.add(type.asType());
+
+ while (!todo.isEmpty()) {
+ List<? extends TypeMirror> directSupertypes = parameter.getTypes().directSupertypes(todo.remove(0));
+
+ todo.addAll(directSupertypes);
+ result.addAll(directSupertypes);
+ }
+
+ return result;
+ }
+ }.scan(parameter.getCompilationUnit(), null);
+ }
+ }, true);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ return success[0];
+ }
+
+ private static boolean equals(CompilationInfo info, Element toFind, Element what) {
+ if (toFind == what) return true;
+ if (what == null) return false;
+ if (toFind.getKind() != what.getKind()) return false;
+ if (toFind.getKind() != ElementKind.METHOD) return false;
+
+ return info.getElements().overrides((ExecutableElement) what, (ExecutableElement) toFind, (TypeElement) what.getEnclosingElement());
+ }
+
+ private static final class OccurrenceNode extends AbstractNode {
+ private final FileObject file;
+ private final int pos;
+ private final String htmlDisplayName;
+
+ public OccurrenceNode(CompilationInfo info, Tree occurrence) {
+ this(info, occurrence, new InstanceContent());
+ }
+
+ private OccurrenceNode(CompilationInfo info, Tree occurrence, InstanceContent content) {
+ super(Children.LEAF, new AbstractLookup(content));
+
+ int[] span;
+
+ switch (occurrence.getKind()) {
+ case MEMBER_SELECT: span = info.getTreeUtilities().findNameSpan((MemberSelectTree) occurrence); break;
+ case METHOD: span = info.getTreeUtilities().findNameSpan((MethodTree) occurrence); break;
+ case CLASS: span = info.getTreeUtilities().findNameSpan((ClassTree) occurrence); break;
+ default:
+ SourcePositions sp = info.getTrees().getSourcePositions();
+
+ span = new int[] {(int) sp.getStartPosition(info.getCompilationUnit(), occurrence),
+ (int) sp.getEndPosition(info.getCompilationUnit(), occurrence)};
+ break;
+ }
+
+ long startLine = info.getCompilationUnit().getLineMap().getLineNumber(span[0]);
+ long startLineStart = info.getCompilationUnit().getLineMap().getStartPosition(startLine);
+
+ String dn;
+
+ try {
+ DataObject od = DataObject.find(info.getFileObject());
+ LineCookie lc = od.getLookup().lookup(LineCookie.class);
+ Line l = lc.getLineSet().getCurrent((int) startLine - 1);
+ od.getLookup().lookup(EditorCookie.class).openDocument();
+ String line = l.getText();
+ int endOnLine = (int) Math.min(line.length(), span[1] - startLineStart);
+
+ dn = translate(line.substring(0, (int) (span[0] - startLineStart))) + "<b>" + translate(line.substring((int) (span[0] - startLineStart), endOnLine)) + "</b>" + translate(line.substring(endOnLine));
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ dn = "Occurrence";
+ }
+
+ this.htmlDisplayName = dn;
+ this.file = info.getFileObject();
+ this.pos = span[0];
+
+ content.add(new OpenCookie() {
+ @Override public void open() {
+ UiUtils.open(file, pos);
+ }
+ });
+ }
+
+ @Override
+ public String getHtmlDisplayName() {
+ return htmlDisplayName;
+ }
+
+ @Override
+ public Action[] getActions(boolean context) {
+ return new Action[] {
+ OpenAction.get(OpenAction.class)
+ };
+ }
+
+ @Override
+ public Action getPreferredAction() {
+ return OpenAction.get(OpenAction.class);
+ }
+
+ }
+
+ private static String[] c = new String[] {"&", "<", ">", "\n", "\""}; // NOI18N
+ private static String[] tags = new String[] {"&", "<", ">", "<br>", """}; // NOI18N
+
+ private static String translate(String input) {
+ for (int cntr = 0; cntr < c.length; cntr++) {
+ input = input.replaceAll(c[cntr], tags[cntr]);
+ }
+
+ return input;
+ }
+
+ private static class ComputeNodes {
+
+ private final Iterable<? extends FileObject> files;
+ private final Node view;
+ private final LogicalViewProvider lvp;
+ private final Project p;
+
+ public ComputeNodes(Iterable<? extends FileObject> files, Node view, LogicalViewProvider lvp, Project p) {
+ this.files = files;
+ this.view = view;
+ this.lvp = lvp;
+ this.p = p;
+ }
+
+ private Collection<Node> result;
+
+ public synchronized Collection<Node> compute() {
+ if (result != null) return result;
+
+ Collection<Node> fileNodes = new ArrayList<Node>();
+
+ for (FileObject file : files) {
+ Node foundChild = locateChild(view, lvp, file);
+
+ if (foundChild == null) {
+ foundChild = new AbstractNode(Children.LEAF) {
+ @Override
+ public Image getIcon(int type) {
+ return ImageUtilities.icon2Image(ProjectUtils.getInformation(p).getIcon());
+ }
+ @Override
+ public Image getOpenedIcon(int type) {
+ return getIcon(type);
+ }
+ @Override
+ public String getHtmlDisplayName() {
+ return view.getHtmlDisplayName() != null ? NbBundle.getMessage(Nodes.class, "ERR_ProjectNotSupported", view.getHtmlDisplayName()) : null;
+ }
+ @Override
+ public String getDisplayName() {
+ return NbBundle.getMessage(Nodes.class, "ERR_ProjectNotSupported", view.getDisplayName());
+ }
+ };
+ }
+
+ fileNodes.add(foundChild);
+ }
+
+ return result = fileNodes;
+ }
+ }
+}