http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/source/nbproject/build-impl.xml ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/source/nbproject/build-impl.xml b/remoting/server/indexer/source/nbproject/build-impl.xml new file mode 100644 index 0000000..b8c8063 --- /dev/null +++ b/remoting/server/indexer/source/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.indexer.source-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/remoting/server/indexer/source/nbproject/genfiles.properties ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/source/nbproject/genfiles.properties b/remoting/server/indexer/source/nbproject/genfiles.properties new file mode 100644 index 0000000..03ba9f7 --- /dev/null +++ b/remoting/server/indexer/source/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=006ca2fd +build.xml.script.CRC32=aab17f8c [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=d1935879 +nbproject/build-impl.xml.script.CRC32=279e9fd9 +nbproject/[email protected] http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/source/nbproject/project.properties ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/source/nbproject/project.properties b/remoting/server/indexer/source/nbproject/project.properties new file mode 100644 index 0000000..b92aeb5 --- /dev/null +++ b/remoting/server/indexer/source/nbproject/project.properties @@ -0,0 +1,43 @@ +# 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 http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/source/nbproject/project.xml ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/source/nbproject/project.xml b/remoting/server/indexer/source/nbproject/project.xml new file mode 100644 index 0000000..1bbdb8e --- /dev/null +++ b/remoting/server/indexer/source/nbproject/project.xml @@ -0,0 +1,116 @@ +<?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.indexer.source</code-name-base> + <suite-component/> + <module-dependencies> + <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.3</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.23</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.jackpot30.backend.impl</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.parsing.api</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.43.0.6</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.queries</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.29</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.util.lookup</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>8.16</specification-version> + </run-dependency> + </dependency> + </module-dependencies> + <public-packages/> + </data> + </configuration> +</project> http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/source/nbproject/suite.properties ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/source/nbproject/suite.properties b/remoting/server/indexer/source/nbproject/suite.properties new file mode 100644 index 0000000..942e12b --- /dev/null +++ b/remoting/server/indexer/source/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/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/Bundle.properties ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/Bundle.properties b/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/Bundle.properties new file mode 100644 index 0000000..6e1fc0b --- /dev/null +++ b/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/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 Source Indexer http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/SourceIndexer.java ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/SourceIndexer.java b/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/SourceIndexer.java new file mode 100644 index 0000000..7790fb6 --- /dev/null +++ b/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/SourceIndexer.java @@ -0,0 +1,145 @@ +/* + * 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.indexer.source; + +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.apache.lucene.document.CompressionTools; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.document.Field.Index; +import org.apache.lucene.document.Field.Store; +import org.netbeans.api.editor.mimelookup.MimeRegistration; +import org.netbeans.modules.jackpot30.backend.impl.spi.IndexAccessor; +import org.netbeans.modules.jackpot30.backend.impl.spi.Utilities; +import org.netbeans.modules.parsing.spi.indexing.Context; +import org.netbeans.modules.parsing.spi.indexing.CustomIndexer; +import org.netbeans.modules.parsing.spi.indexing.CustomIndexerFactory; +import org.netbeans.modules.parsing.spi.indexing.Indexable; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.URLMapper; + +/** + * + * @author lahvac + */ +public class SourceIndexer extends CustomIndexer { + + private static final String KEY_CONTENT = "content"; + + @Override + protected void index(Iterable<? extends Indexable> files, Context context) { + try { + for (Indexable i : files) { + if (!IndexAccessor.getCurrent().isAcceptable(i.getURL())) continue; + String relPath = IndexAccessor.getCurrent().getPath(i.getURL()); + + if (relPath == null) continue; + + FileObject file = URLMapper.findFileObject(i.getURL()); + + if (file == null) { + //TODO: log + continue; + } + + Document doc = new Document(); + + doc.add(new Field("relativePath", relPath, Store.YES, Index.NOT_ANALYZED)); + doc.add(new Field(KEY_CONTENT, CompressionTools.compressString(Utilities.readFully(file)), Store.YES)); + doc.add(new Field("fileMimeType", file.getMIMEType(), Store.YES, Index.NO)); + doc.add(new Field("sizeInBytes", Long.toString(file.getSize()), Store.YES, Index.NO)); + + IndexAccessor.getCurrent().getIndexWriter().addDocument(doc); + } + } catch (IOException ex) { + Logger.getLogger(SourceIndexer.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @MimeRegistration(mimeType="", service=CustomIndexerFactory.class) + public static final class FactoryImpl extends CustomIndexerFactory { + + @Override + public CustomIndexer createIndexer() { + return new SourceIndexer(); + } + + @Override + public boolean supportsEmbeddedIndexers() { + return true; + } + + @Override + public void filesDeleted(Iterable<? extends Indexable> deleted, Context context) { + assert !deleted.iterator().hasNext(); + //TODO: ability to delete from the index: +// try { +// DocumentIndex idx = IndexManager.createDocumentIndex(FileUtil.toFile(context.getIndexFolder())); +// +// for (Indexable i : deleted) { +// idx.removeDocument(i.getRelativePath()); +// } +// +// idx.close(); +// } catch (IOException ex) { +// Logger.getLogger(SourceIndexer.class.getName()).log(Level.SEVERE, null, ex); +// } + } + + @Override + public void filesDirty(Iterable<? extends Indexable> dirty, Context context) { + } + + @Override + public String getIndexerName() { + return "fullsource"; + } + + @Override + public int getIndexVersion() { + return 1; + } + + } +} http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/SourceStatisticsGenerator.java ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/SourceStatisticsGenerator.java b/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/SourceStatisticsGenerator.java new file mode 100644 index 0000000..fbce56a --- /dev/null +++ b/remoting/server/indexer/source/src/org/netbeans/modules/jackpot30/indexer/source/SourceStatisticsGenerator.java @@ -0,0 +1,77 @@ +/* + * 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.indexer.source; + +import java.io.IOException; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Fieldable; +import org.apache.lucene.index.IndexReader; +import org.netbeans.modules.jackpot30.backend.impl.spi.StatisticsGenerator; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author lahvac + */ +@ServiceProvider(service=StatisticsGenerator.class) +public class SourceStatisticsGenerator extends StatisticsGenerator { + + @Override + protected void amendStatistics(IndexReader r, Document doc) throws IOException { + if (doc.getFieldable("relativePath") != null) { + increment("files/total"); + Fieldable mimeType = doc.getFieldable("fileMimeType"); + if (mimeType != null) { + increment("files/" + mimeType.stringValue()); + } + Fieldable sizeInBytes = doc.getFieldable("sizeInBytes"); + if (sizeInBytes != null) { + long size = Long.parseLong(sizeInBytes.stringValue()); + add("fileSize/total", size); + if (mimeType != null) { + add("fileSize/" + mimeType.stringValue(), size); + } + } + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/usages/build.xml ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/build.xml b/remoting/server/indexer/usages/build.xml new file mode 100644 index 0000000..e187a8b --- /dev/null +++ b/remoting/server/indexer/usages/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.indexer.usages" default="netbeans" basedir="."> + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.indexer.usages.</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/remoting/server/indexer/usages/manifest.mf ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/manifest.mf b/remoting/server/indexer/usages/manifest.mf new file mode 100644 index 0000000..b908d76 --- /dev/null +++ b/remoting/server/indexer/usages/manifest.mf @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +OpenIDE-Module: org.netbeans.modules.jackpot30.indexer.usages +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/indexer/usages/Bundle.properties +OpenIDE-Module-Specification-Version: 1.0 + http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/usages/nbproject/build-impl.xml ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/nbproject/build-impl.xml b/remoting/server/indexer/usages/nbproject/build-impl.xml new file mode 100644 index 0000000..cc63d85 --- /dev/null +++ b/remoting/server/indexer/usages/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.indexer.usages-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/remoting/server/indexer/usages/nbproject/genfiles.properties ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/nbproject/genfiles.properties b/remoting/server/indexer/usages/nbproject/genfiles.properties new file mode 100644 index 0000000..0c1c75d --- /dev/null +++ b/remoting/server/indexer/usages/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=80410336 +build.xml.script.CRC32=4ae79e41 [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=75ee014b +nbproject/build-impl.xml.script.CRC32=16d3b827 +nbproject/[email protected] http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/usages/nbproject/project.properties ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/nbproject/project.properties b/remoting/server/indexer/usages/nbproject/project.properties new file mode 100644 index 0000000..b92aeb5 --- /dev/null +++ b/remoting/server/indexer/usages/nbproject/project.properties @@ -0,0 +1,43 @@ +# 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 http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/usages/nbproject/project.xml ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/nbproject/project.xml b/remoting/server/indexer/usages/nbproject/project.xml new file mode 100644 index 0000000..32edb98 --- /dev/null +++ b/remoting/server/indexer/usages/nbproject/project.xml @@ -0,0 +1,182 @@ +<?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.indexer.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.3</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.23</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.jackpot30.backend.impl</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.java.preprocessorbridge</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <implementation-version/> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.java.source</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <implementation-version/> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.java.source.base</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <implementation-version/> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.parsing.api</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.43.0.6</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.parsing.indexing</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>9.6.0.1.1.8</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.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> + </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.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/server/indexer/usages/nbproject/suite.properties ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/nbproject/suite.properties b/remoting/server/indexer/usages/nbproject/suite.properties new file mode 100644 index 0000000..942e12b --- /dev/null +++ b/remoting/server/indexer/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/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/Bundle.properties ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/Bundle.properties b/remoting/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/Bundle.properties new file mode 100644 index 0000000..b35f705 --- /dev/null +++ b/remoting/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/Bundle.properties @@ -0,0 +1,41 @@ +# 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. +# +OpenIDE-Module-Name=Jackpot 3.0 Usages Indexer http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/remoting/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/Common.java ---------------------------------------------------------------------- diff --git a/remoting/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/Common.java b/remoting/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/Common.java new file mode 100644 index 0000000..02d50a7 --- /dev/null +++ b/remoting/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/Common.java @@ -0,0 +1,81 @@ +/* + * 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.indexer.usages; + +import java.util.Arrays; +import java.util.EnumSet; +import java.util.Set; +import javax.lang.model.element.ElementKind; +import org.netbeans.api.java.source.ElementHandle; +import org.netbeans.api.java.source.SourceUtils; + +/**XXX: Copied between indexing and ide! + * + * @author lahvac + */ +public class Common { + + public static final Set<ElementKind> SUPPORTED_KINDS = EnumSet.of(ElementKind.PACKAGE, ElementKind.CLASS, + ElementKind.INTERFACE, ElementKind.ENUM, ElementKind.ANNOTATION_TYPE, ElementKind.METHOD, + ElementKind.CONSTRUCTOR, ElementKind.INSTANCE_INIT, ElementKind.STATIC_INIT, + ElementKind.FIELD, ElementKind.ENUM_CONSTANT); + + public static String serialize(ElementHandle<?> h) { + StringBuilder result = new StringBuilder(); + + result.append(h.getKind()); + + String[] signatures = SourceUtils.getJVMSignature(h); + + if (h.getKind().isField()) { + signatures = Arrays.copyOf(signatures, signatures.length - 1); + } + + for (String sig : signatures) { + result.append(":"); + result.append(sig); + } + + return result.toString(); + } + +}
