1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/bridges/jumpto/build.xml Thu Apr 28 20:13:40 2011 +0200
1.3 @@ -0,0 +1,9 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
1.6 +<!-- for some information on what you could do (e.g. targets to override). -->
1.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
1.8 +<project name="org.netbeans.modules.jackpot30.jumpto" default="netbeans" basedir=".">
1.9 + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.jumpto.</description>
1.10 + <import file="nbproject/build-impl.xml"/>
1.11 + <import file="${suite.dir}/findbugs-import.xml"/>
1.12 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/bridges/jumpto/manifest.mf Thu Apr 28 20:13:40 2011 +0200
2.3 @@ -0,0 +1,5 @@
2.4 +Manifest-Version: 1.0
2.5 +OpenIDE-Module: org.netbeans.modules.jackpot30.jumpto
2.6 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/jumpto/Bundle.properties
2.7 +OpenIDE-Module-Specification-Version: 1.0
2.8 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/bridges/jumpto/nbproject/build-impl.xml Thu Apr 28 20:13:40 2011 +0200
3.3 @@ -0,0 +1,45 @@
3.4 +<?xml version="1.0" encoding="UTF-8"?>
3.5 +<!--
3.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
3.7 +*** EDIT ../build.xml INSTEAD ***
3.8 +-->
3.9 +<project name="org.netbeans.modules.jackpot30.jumpto-impl" basedir="..">
3.10 + <fail message="Please build using Ant 1.7.1 or higher.">
3.11 + <condition>
3.12 + <not>
3.13 + <antversion atleast="1.7.1"/>
3.14 + </not>
3.15 + </condition>
3.16 + </fail>
3.17 + <property file="nbproject/private/suite-private.properties"/>
3.18 + <property file="nbproject/suite.properties"/>
3.19 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
3.20 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
3.21 + <property file="${suite.dir}/nbproject/platform.properties"/>
3.22 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
3.23 + <attribute name="name"/>
3.24 + <attribute name="value"/>
3.25 + <sequential>
3.26 + <property name="@{name}" value="${@{value}}"/>
3.27 + </sequential>
3.28 + </macrodef>
3.29 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
3.30 + <attribute name="property"/>
3.31 + <attribute name="value"/>
3.32 + <sequential>
3.33 + <property name="@{property}" value="@{value}"/>
3.34 + </sequential>
3.35 + </macrodef>
3.36 + <property file="${user.properties.file}"/>
3.37 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
3.38 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
3.39 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
3.40 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
3.41 + <condition>
3.42 + <not>
3.43 + <contains string="${cluster.path.evaluated}" substring="platform"/>
3.44 + </not>
3.45 + </condition>
3.46 + </fail>
3.47 + <import file="${harness.dir}/build.xml"/>
3.48 +</project>
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/bridges/jumpto/nbproject/genfiles.properties Thu Apr 28 20:13:40 2011 +0200
4.3 @@ -0,0 +1,8 @@
4.4 +build.xml.data.CRC32=14c2e29c
4.5 +build.xml.script.CRC32=c7b5d9b7
4.6 +build.xml.stylesheet.CRC32=a56c6a5b@1.45
4.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
4.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
4.9 +nbproject/build-impl.xml.data.CRC32=14c2e29c
4.10 +nbproject/build-impl.xml.script.CRC32=3404573f
4.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/bridges/jumpto/nbproject/project.properties Thu Apr 28 20:13:40 2011 +0200
5.3 @@ -0,0 +1,2 @@
5.4 +javac.source=1.6
5.5 +javac.compilerargs=-Xlint -Xlint:-serial
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/bridges/jumpto/nbproject/project.xml Thu Apr 28 20:13:40 2011 +0200
6.3 @@ -0,0 +1,105 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
6.6 + <type>org.netbeans.modules.apisupport.project</type>
6.7 + <configuration>
6.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
6.9 + <code-name-base>org.netbeans.modules.jackpot30.jumpto</code-name-base>
6.10 + <suite-component/>
6.11 + <module-dependencies>
6.12 + <dependency>
6.13 + <code-name-base>org.netbeans.api.java.classpath</code-name-base>
6.14 + <build-prerequisite/>
6.15 + <compile-dependency/>
6.16 + <run-dependency>
6.17 + <release-version>1</release-version>
6.18 + <specification-version>1.28</specification-version>
6.19 + </run-dependency>
6.20 + </dependency>
6.21 + <dependency>
6.22 + <code-name-base>org.netbeans.libs.javacapi</code-name-base>
6.23 + <build-prerequisite/>
6.24 + <compile-dependency/>
6.25 + <run-dependency>
6.26 + <specification-version>7.5.0.3</specification-version>
6.27 + </run-dependency>
6.28 + </dependency>
6.29 + <dependency>
6.30 + <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
6.31 + <build-prerequisite/>
6.32 + <compile-dependency/>
6.33 + <run-dependency>
6.34 + <implementation-version/>
6.35 + </run-dependency>
6.36 + </dependency>
6.37 + <dependency>
6.38 + <code-name-base>org.netbeans.modules.java.source</code-name-base>
6.39 + <build-prerequisite/>
6.40 + <compile-dependency/>
6.41 + <run-dependency>
6.42 + <implementation-version/>
6.43 + </run-dependency>
6.44 + </dependency>
6.45 + <dependency>
6.46 + <code-name-base>org.netbeans.modules.java.sourceui</code-name-base>
6.47 + <build-prerequisite/>
6.48 + <compile-dependency/>
6.49 + <run-dependency>
6.50 + <release-version>1</release-version>
6.51 + <specification-version>1.20.0.1.17</specification-version>
6.52 + </run-dependency>
6.53 + </dependency>
6.54 + <dependency>
6.55 + <code-name-base>org.netbeans.modules.jeriglib</code-name-base>
6.56 + <build-prerequisite/>
6.57 + <compile-dependency/>
6.58 + <run-dependency>
6.59 + <specification-version>1.16</specification-version>
6.60 + </run-dependency>
6.61 + </dependency>
6.62 + <dependency>
6.63 + <code-name-base>org.netbeans.modules.jumpto</code-name-base>
6.64 + <build-prerequisite/>
6.65 + <compile-dependency/>
6.66 + <run-dependency>
6.67 + <release-version>1</release-version>
6.68 + <implementation-version/>
6.69 + </run-dependency>
6.70 + </dependency>
6.71 + <dependency>
6.72 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
6.73 + <build-prerequisite/>
6.74 + <compile-dependency/>
6.75 + <run-dependency>
6.76 + <release-version>1</release-version>
6.77 + <specification-version>1.35</specification-version>
6.78 + </run-dependency>
6.79 + </dependency>
6.80 + <dependency>
6.81 + <code-name-base>org.openide.filesystems</code-name-base>
6.82 + <build-prerequisite/>
6.83 + <compile-dependency/>
6.84 + <run-dependency>
6.85 + <specification-version>7.46</specification-version>
6.86 + </run-dependency>
6.87 + </dependency>
6.88 + <dependency>
6.89 + <code-name-base>org.openide.util</code-name-base>
6.90 + <build-prerequisite/>
6.91 + <compile-dependency/>
6.92 + <run-dependency>
6.93 + <specification-version>8.14</specification-version>
6.94 + </run-dependency>
6.95 + </dependency>
6.96 + <dependency>
6.97 + <code-name-base>org.openide.util.lookup</code-name-base>
6.98 + <build-prerequisite/>
6.99 + <compile-dependency/>
6.100 + <run-dependency>
6.101 + <specification-version>8.6</specification-version>
6.102 + </run-dependency>
6.103 + </dependency>
6.104 + </module-dependencies>
6.105 + <public-packages/>
6.106 + </data>
6.107 + </configuration>
6.108 +</project>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/bridges/jumpto/nbproject/suite.properties Thu Apr 28 20:13:40 2011 +0200
7.3 @@ -0,0 +1,1 @@
7.4 +suite.dir=${basedir}/../..
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/bridges/jumpto/src/org/netbeans/modules/jackpot30/jumpto/Bundle.properties Thu Apr 28 20:13:40 2011 +0200
8.3 @@ -0,0 +1,1 @@
8.4 +OpenIDE-Module-Name=jackpot 3.0 Jumpto Bridge
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/bridges/jumpto/src/org/netbeans/modules/jackpot30/jumpto/RemoteGoToType.java Thu Apr 28 20:13:40 2011 +0200
9.3 @@ -0,0 +1,238 @@
9.4 +/*
9.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 + *
9.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
9.8 + *
9.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9.10 + * Other names may be trademarks of their respective owners.
9.11 + *
9.12 + * The contents of this file are subject to the terms of either the GNU
9.13 + * General Public License Version 2 only ("GPL") or the Common
9.14 + * Development and Distribution License("CDDL") (collectively, the
9.15 + * "License"). You may not use this file except in compliance with the
9.16 + * License. You can obtain a copy of the License at
9.17 + * http://www.netbeans.org/cddl-gplv2.html
9.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.19 + * specific language governing permissions and limitations under the
9.20 + * License. When distributing the software, include this License Header
9.21 + * Notice in each file and include the License file at
9.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
9.23 + * particular file as subject to the "Classpath" exception as provided
9.24 + * by Oracle in the GPL Version 2 section of the License file that
9.25 + * accompanied this code. If applicable, add the following below the
9.26 + * License Header, with the fields enclosed by brackets [] replaced by
9.27 + * your own identifying information:
9.28 + * "Portions Copyrighted [year] [name of copyright owner]"
9.29 + *
9.30 + * If you wish your version of this file to be governed by only the CDDL
9.31 + * or only the GPL Version 2, indicate your decision by adding
9.32 + * "[Contributor] elects to include this software in this distribution
9.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.34 + * single choice of license, a recipient has the option to distribute
9.35 + * your version of this file under either the CDDL, the GPL Version 2 or
9.36 + * to extend the choice of license to its licensees as provided above.
9.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
9.38 + * Version 2 license, then the option applies only if the new code is
9.39 + * made subject to such option by the copyright holder.
9.40 + *
9.41 + * Contributor(s):
9.42 + *
9.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
9.44 + */
9.45 +package org.netbeans.modules.jackpot30.jumpto;
9.46 +
9.47 +import java.io.File;
9.48 +import java.net.URI;
9.49 +import java.net.URISyntaxException;
9.50 +import java.util.EnumSet;
9.51 +import java.util.LinkedHashMap;
9.52 +import java.util.List;
9.53 +import java.util.Map;
9.54 +import java.util.Map.Entry;
9.55 +import java.util.concurrent.atomic.AtomicReference;
9.56 +import javax.lang.model.element.ElementKind;
9.57 +import javax.lang.model.element.Modifier;
9.58 +import javax.swing.Icon;
9.59 +import org.codeviation.pojson.Pojson;
9.60 +import org.netbeans.api.java.source.ClasspathInfo;
9.61 +import org.netbeans.api.java.source.ElementHandle;
9.62 +import org.netbeans.api.java.source.ui.ElementIcons;
9.63 +import org.netbeans.api.java.source.ui.ElementOpen;
9.64 +import org.netbeans.api.project.FileOwnerQuery;
9.65 +import org.netbeans.api.project.Project;
9.66 +import org.netbeans.api.project.ProjectUtils;
9.67 +import org.netbeans.modules.jackpot30.impl.WebUtilities;
9.68 +import org.netbeans.modules.jackpot30.impl.indexing.RemoteIndex;
9.69 +import org.netbeans.modules.java.source.ElementHandleAccessor;
9.70 +import org.netbeans.spi.jumpto.type.TypeDescriptor;
9.71 +import org.netbeans.spi.jumpto.type.TypeProvider;
9.72 +import org.openide.filesystems.FileObject;
9.73 +import org.openide.filesystems.FileUtil;
9.74 +import org.openide.util.Exceptions;
9.75 +import org.openide.util.lookup.ServiceProvider;
9.76 +
9.77 +/**
9.78 + *
9.79 + * @author lahvac
9.80 + */
9.81 +@ServiceProvider(service=TypeProvider.class)
9.82 +public class RemoteGoToType implements TypeProvider {
9.83 +
9.84 + @Override
9.85 + public String name() {
9.86 + return "Jackpot 3.0 Remote Index Type Provider";
9.87 + }
9.88 +
9.89 + @Override
9.90 + public String getDisplayName() {
9.91 + return "Jackpot 3.0 Remote Index Type Provider";
9.92 + }
9.93 +
9.94 + @Override
9.95 + public void computeTypeNames(Context context, Result result) {
9.96 + for (RemoteIndex ri : RemoteIndex.loadIndices()) {
9.97 + try {
9.98 + URI resolved = new URI(ri.remote.toExternalForm() + "/findType?path=" + WebUtilities.escapeForQuery(ri.remoteSegment) + "&prefix=" + WebUtilities.escapeForQuery(context.getText()));
9.99 + @SuppressWarnings("unchecked") //XXX: should not trust something got from the network!
9.100 + Map<String, List<String>> types = Pojson.load(LinkedHashMap.class, WebUtilities.requestStringResponse(resolved));
9.101 +
9.102 + for (Entry<String, List<String>> e : types.entrySet()) {
9.103 + for (String binaryName : e.getValue()) {
9.104 + result.addResult(new RemoteTypeDescriptor(ri, e.getKey(), binaryName));
9.105 + }
9.106 + }
9.107 + } catch (URISyntaxException ex) {
9.108 + Exceptions.printStackTrace(ex);
9.109 + }
9.110 + }
9.111 + }
9.112 +
9.113 + @Override
9.114 + public void cancel() {
9.115 + }
9.116 +
9.117 + @Override
9.118 + public void cleanup() {
9.119 + }
9.120 +
9.121 + private static final class RemoteTypeDescriptor extends TypeDescriptor {
9.122 +
9.123 + private final RemoteIndex origin;
9.124 + private final String relativePath;
9.125 + private final String binaryName;
9.126 + private final AtomicReference<FileObject> file = new AtomicReference<FileObject>();
9.127 +
9.128 + public RemoteTypeDescriptor(RemoteIndex origin, String relativePath, String binaryName) {
9.129 + this.origin = origin;
9.130 + this.relativePath = relativePath;
9.131 + this.binaryName = binaryName;
9.132 + }
9.133 +
9.134 + @Override
9.135 + public String getSimpleName() {
9.136 + int dollar = binaryName.lastIndexOf("$");
9.137 +
9.138 + if (dollar >= 0) return binaryName.substring(dollar + 1);
9.139 + else {
9.140 + int dot = binaryName.lastIndexOf(".");
9.141 +
9.142 + if (dot >= 0) return binaryName.substring(dot + 1);
9.143 + else return binaryName;
9.144 + }
9.145 + }
9.146 +
9.147 + @Override
9.148 + public String getOuterName() {
9.149 + int dollar = binaryName.lastIndexOf("$");
9.150 + int dot = binaryName.lastIndexOf(".");
9.151 +
9.152 + if (dollar >= 0 && dot >= 0) return binaryName.substring(dot + 1, dollar).replace("$", ".");
9.153 + else return null;
9.154 + }
9.155 +
9.156 + @Override
9.157 + public String getTypeName() {
9.158 + if (getOuterName() != null)
9.159 + return getSimpleName() + " in " + getOuterName();
9.160 + else
9.161 + return getSimpleName();
9.162 + }
9.163 +
9.164 + @Override
9.165 + public String getContextName() {
9.166 + int dot = binaryName.lastIndexOf(".");
9.167 +
9.168 + if (dot >= 0) return " (" + binaryName.substring(0, dot) + ")";
9.169 + else return "";
9.170 + }
9.171 +
9.172 + @Override
9.173 + public Icon getIcon() {
9.174 + return ElementIcons.getElementIcon(ElementKind.CLASS, EnumSet.noneOf(Modifier.class));
9.175 + }
9.176 +
9.177 + @Override
9.178 + public String getProjectName() {
9.179 + FileObject file = getFileObject();
9.180 +
9.181 + if (file == null) return null;
9.182 +
9.183 + Project prj = FileOwnerQuery.getOwner(file);
9.184 +
9.185 + if (prj == null) return null;
9.186 +
9.187 + return ProjectUtils.getInformation(prj).getDisplayName();
9.188 + }
9.189 +
9.190 + @Override
9.191 + public Icon getProjectIcon() {
9.192 + FileObject file = getFileObject();
9.193 +
9.194 + if (file == null) return null;
9.195 +
9.196 + Project prj = FileOwnerQuery.getOwner(file);
9.197 +
9.198 + if (prj == null) return null;
9.199 +
9.200 + return ProjectUtils.getInformation(prj).getIcon();
9.201 + }
9.202 +
9.203 + @Override
9.204 + public FileObject getFileObject() {
9.205 + FileObject f = this.file.get();
9.206 +
9.207 + if (f == null) {
9.208 + String fqn = binaryName;
9.209 +
9.210 + if (fqn.contains("$")) {
9.211 + fqn = fqn.substring(0, fqn.indexOf("$"));
9.212 + }
9.213 +
9.214 + FileObject originFolder = FileUtil.toFileObject(FileUtil.normalizeFile(new File(origin.folder)));
9.215 +
9.216 + if (originFolder != null) f = originFolder.getFileObject(relativePath + "/" + fqn.replace('.', '/') + ".java");
9.217 + if (f != null) this.file.set(f);
9.218 + }
9.219 +
9.220 + return f;
9.221 + }
9.222 +
9.223 + @Override
9.224 + public int getOffset() {
9.225 + return 0;
9.226 + }
9.227 +
9.228 + @Override
9.229 + public void open() {
9.230 + FileObject file = getFileObject();
9.231 +
9.232 + if (file == null) return ; //XXX tell to the user
9.233 +
9.234 + ClasspathInfo cpInfo = ClasspathInfo.create(file);
9.235 + ElementHandle<?> handle = ElementHandleAccessor.INSTANCE.create(ElementKind.CLASS, binaryName);
9.236 +
9.237 + ElementOpen.open(cpInfo, handle);
9.238 + }
9.239 +
9.240 + }
9.241 +}
10.1 --- a/nbproject/project.properties Thu Apr 28 20:13:39 2011 +0200
10.2 +++ b/nbproject/project.properties Thu Apr 28 20:13:40 2011 +0200
10.3 @@ -8,13 +8,15 @@
10.4 ${project.org.netbeans.modules.libs.jerig}:\
10.5 ${project.org.netbeans.modules.jackpot30.java.hints}:\
10.6 ${project.org.netbeans.modules.jackpot30.refactoring}:\
10.7 - ${project.org.netbeans.modules.jackpot30.apisupport}
10.8 + ${project.org.netbeans.modules.jackpot30.apisupport}:\
10.9 + ${project.org.netbeans.modules.jackpot30.jumpto}
10.10 project.org.netbeans.modules.jackpot30.api=api
10.11 project.org.netbeans.modules.jackpot30.apisupport=bridges/apisupport
10.12 project.org.netbeans.modules.jackpot30.file=file
10.13 project.org.netbeans.modules.jackpot30.help=help
10.14 project.org.netbeans.modules.jackpot30.hintsimpl=hintsimpl
10.15 project.org.netbeans.modules.jackpot30.java.hints=bridges/java.hints
10.16 +project.org.netbeans.modules.jackpot30.jumpto=bridges/jumpto
10.17 project.org.netbeans.modules.jackpot30.kit=kit
10.18 project.org.netbeans.modules.jackpot30.refactoring=bridges/refactoring
10.19 project.org.netbeans.modules.jackpot30.transformers=transformer