Skip to content

Commit

Permalink
Merge branch 'master' into record-fix-br
Browse files Browse the repository at this point in the history
  • Loading branch information
singh-akhilesh authored Jan 17, 2020
2 parents a2a5f82 + f21f266 commit 2396970
Show file tree
Hide file tree
Showing 90 changed files with 1,427 additions and 196 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ addons:
- ant-optional
- xvfb
- openjfx
- libgfortran3
install:
- export PATH="$PATH:$TRAVIS_BUILD_DIR/nbbuild/travis"
- export DISPLAY=:99.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,9 @@ public Enumeration enabled(GrammarEnvironment ctx) {
Enumeration en = ctx.getDocumentChildren();
while (en.hasMoreElements()) {
Node next = (Node) en.nextElement();
if (next.getNodeType() == next.DOCUMENT_TYPE_NODE) {
if (next.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
return null; // null for web.xml specified by DTD
} else if (next.getNodeType() == next.ELEMENT_NODE) {
} else if (next.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) next;
String tag = element.getTagName();
if (EJB_JAR_TAG.equals(tag)) { // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,9 @@ public Enumeration enabled(GrammarEnvironment ctx) {
Enumeration en = ctx.getDocumentChildren();
while (en.hasMoreElements()) {
Node next = (Node) en.nextElement();
if (next.getNodeType() == next.DOCUMENT_TYPE_NODE) {
if (next.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
return null; // null for web.xml specified by DTD
} else if (next.getNodeType() == next.ELEMENT_NODE) {
} else if (next.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) next;
String tag = element.getTagName();
if (EJB_JAR_TAG.equals(tag)) { // NOI18N
Expand Down
7 changes: 6 additions & 1 deletion groovy/gradle.java/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.4</specification-version>
<specification-version>1.5</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down Expand Up @@ -333,6 +333,11 @@
<compile-dependency/>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.masterfs</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.util.lookup</code-name-base>
<compile-dependency/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ SourceSetPanel.jScrollPane1.TabConstraints.tabTitle=Source
SourceSetPanel.jScrollPane2.TabConstraints.tabTitle=Compile Classpath
SourceSetPanel.jScrollPane3.TabConstraints.tabTitle=Runtime Classpath
SourceSetPanel.tfSourceLevel.text=
CompileOptionsPanel.cbIncludeOpenProjects.text=Include Open Projects
CompileOptionsPanel.lbIncludeOpenProjects.text=<html>Create a composite project from this project and the other open Gradle projects by generating '--include-build' parameters.
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,23 @@
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
<Component id="jLabel2" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Component id="lbIncludeOpenProjects" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="cbIncludeOpenProjects" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
Expand All @@ -78,15 +91,19 @@
<Component id="cbPlatform" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btManagePlatforms" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Component id="cbCompileOnSave" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="lbCompileOnSave" min="-2" pref="60" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="cbAugmentedBuild" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" pref="51" max="-2" attributes="0"/>
<EmptySpace pref="136" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="cbIncludeOpenProjects" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lbIncludeOpenProjects" min="-2" pref="56" max="-2" attributes="0"/>
<EmptySpace pref="67" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -145,6 +162,22 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/netbeans/modules/gradle/java/customizer/Bundle.properties" key="CompileOptionsPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="verticalAlignment" type="int" value="1"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="cbIncludeOpenProjects">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/netbeans/modules/gradle/java/customizer/Bundle.properties" key="CompileOptionsPanel.cbIncludeOpenProjects.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lbIncludeOpenProjects">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/netbeans/modules/gradle/java/customizer/Bundle.properties" key="CompileOptionsPanel.lbIncludeOpenProjects.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="verticalAlignment" type="int" value="1"/>
</Properties>
</Component>
</SubComponents>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private CompileOptionsPanel(Project project) {
initComponents();
setupCheckBox(cbCompileOnSave, RunUtils.PROP_COMPILE_ON_SAVE, false);
setupCheckBox(cbAugmentedBuild, RunUtils.PROP_AUGMENTED_BUILD, true);
setupCheckBox(cbIncludeOpenProjects, RunUtils.PROP_INCLUDE_OPEN_PROJECTS, false);
setupPlatform();
}

Expand Down Expand Up @@ -150,6 +151,7 @@ private void savePlatform() {
private void save() {
saveCheckBox(cbCompileOnSave, RunUtils.PROP_COMPILE_ON_SAVE);
saveCheckBox(cbAugmentedBuild, RunUtils.PROP_AUGMENTED_BUILD);
saveCheckBox(cbIncludeOpenProjects, RunUtils.PROP_INCLUDE_OPEN_PROJECTS);
savePlatform();
try {
NbGradleProject.getPreferences(project, false).flush();
Expand All @@ -172,6 +174,8 @@ private void initComponents() {
cbPlatform = new javax.swing.JComboBox<>();
btManagePlatforms = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
cbIncludeOpenProjects = new javax.swing.JCheckBox();
lbIncludeOpenProjects = new javax.swing.JLabel();

org.openide.awt.Mnemonics.setLocalizedText(cbCompileOnSave, org.openide.util.NbBundle.getMessage(CompileOptionsPanel.class, "CompileOptionsPanel.cbCompileOnSave.text")); // NOI18N
cbCompileOnSave.setEnabled(false);
Expand All @@ -192,6 +196,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});

org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(CompileOptionsPanel.class, "CompileOptionsPanel.jLabel2.text")); // NOI18N
jLabel2.setVerticalAlignment(javax.swing.SwingConstants.TOP);

org.openide.awt.Mnemonics.setLocalizedText(cbIncludeOpenProjects, org.openide.util.NbBundle.getMessage(CompileOptionsPanel.class, "CompileOptionsPanel.cbIncludeOpenProjects.text")); // NOI18N

org.openide.awt.Mnemonics.setLocalizedText(lbIncludeOpenProjects, org.openide.util.NbBundle.getMessage(CompileOptionsPanel.class, "CompileOptionsPanel.lbIncludeOpenProjects.text")); // NOI18N
lbIncludeOpenProjects.setVerticalAlignment(javax.swing.SwingConstants.TOP);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
Expand All @@ -217,7 +227,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(lbCompileOnSave, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(lbIncludeOpenProjects, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(cbIncludeOpenProjects)
.addGap(0, 0, Short.MAX_VALUE)))))
.addContainerGap())
);
layout.setVerticalGroup(
Expand All @@ -235,8 +254,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbAugmentedBuild)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(136, Short.MAX_VALUE))
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(cbIncludeOpenProjects)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lbIncludeOpenProjects, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(67, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents

Expand Down Expand Up @@ -278,9 +301,11 @@ public JComponent createComponent(ProjectCustomizer.Category category, Lookup co
private javax.swing.JButton btManagePlatforms;
private javax.swing.JCheckBox cbAugmentedBuild;
private javax.swing.JCheckBox cbCompileOnSave;
private javax.swing.JCheckBox cbIncludeOpenProjects;
private javax.swing.JComboBox<JavaPlatform> cbPlatform;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel lbCompileOnSave;
private javax.swing.JLabel lbIncludeOpenProjects;
private javax.swing.JLabel lbPlatform;
// End of variables declaration//GEN-END:variables

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.gradle.java.queries;

import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.netbeans.api.java.queries.SourceForBinaryQuery;
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ui.OpenProjects;
import org.netbeans.modules.gradle.java.api.GradleJavaProject;
import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation;
import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation2;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.Utilities;
import org.openide.util.lookup.ServiceProvider;
import org.openide.util.lookup.ServiceProviders;

/**
*
* @author lkishalmi
*/
@ServiceProviders({
@ServiceProvider(service = SourceForBinaryQueryImplementation.class, position = 105),
@ServiceProvider(service = SourceForBinaryQueryImplementation2.class, position = 105)
})
public class OpenGradleProjectForBinary implements SourceForBinaryQueryImplementation2 {

@Override
public Result findSourceRoots2(URL binaryRoot) {
if ("jar".equals(binaryRoot.getProtocol())) {
try {
URI uri = FileUtil.getArchiveFile(binaryRoot).toURI();
if ("file".equals(uri.getScheme())) {
FileObject jar = FileUtil.toFileObject(FileUtil.normalizeFile(Utilities.toFile(uri)));
Map<String, Project> projectArchives = projectArchives();
if (projectArchives.containsKey(jar.getNameExt())) {
Project p = projectArchives.get(jar.getNameExt());
GradleJavaProject gjp = GradleJavaProject.get(p);
File archive = gjp.getArchive(GradleJavaProject.CLASSIFIER_NONE);
URL root = FileUtil.urlForArchiveOrDir(archive);
SourceForBinaryQueryImplementation2 query = p.getLookup().lookup(SourceForBinaryQueryImplementation2.class);
return (query != null) ? query.findSourceRoots2(root) : null;
}
}
} catch (URISyntaxException ex) {
}
}
return null;
}

@Override
public SourceForBinaryQuery.Result findSourceRoots(URL binaryRoot) {
return findSourceRoots2(binaryRoot);
}

Map<String, Project> projectArchives() {
Map<String, Project> ret = new HashMap<>();
Project[] projects = OpenProjects.getDefault().getOpenProjects();
for (Project project : projects) {
GradleJavaProject gjp = GradleJavaProject.get(project);
if (gjp != null) {
String archive = gjp.getArchive(GradleJavaProject.CLASSIFIER_NONE).getName();
ret.put(archive, project);
}
}
return ret;
}
}
2 changes: 1 addition & 1 deletion groovy/gradle/manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ AutoUpdate-Show-In-Client: false
OpenIDE-Module: org.netbeans.modules.gradle/1
OpenIDE-Module-Layer: org/netbeans/modules/gradle/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/gradle/Bundle.properties
OpenIDE-Module-Specification-Version: 1.4
OpenIDE-Module-Specification-Version: 1.5
OpenIDE-Module-Requires: cnb.org.netbeans.modules.groovy.kit
3 changes: 3 additions & 0 deletions groovy/gradle/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ javadoc.arch=${basedir}/arch.xml
nbm.module.author=Laszlo Kishalmi
source.reference.netbeans-gradle-tooling.jar=netbeans-gradle-tooling/src/main/groovy

test-unit-sys-prop.test.netbeans.dest.dir=${netbeans.dest.dir}
test-unit-sys-prop.java.awt.headless=true

release.external/gradle-tooling-api-6.0.jar=modules/gradle/gradle-tooling-api.jar
release.build/tooling/netbeans-gradle-tooling.jar=modules/gradle/netbeans-gradle-tooling.jar
release.build/tooling/nb-tooling.gradle=modules/gradle/nb-tooling.gradle
33 changes: 33 additions & 0 deletions groovy/gradle/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,44 @@
<code-name-base>org.netbeans.libs.junit4</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.apisupport.project</code-name-base>
<compile-dependency/>
<test/>
</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.projectapi.nb</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.projectui</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.filesystems</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.masterfs</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.util.lookup</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.util.ui</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
</test-type>
</test-dependencies>
<public-packages>
Expand Down
Loading

0 comments on commit 2396970

Please sign in to comment.