[netbeans] branch master updated: [NETBEANS-4891] Fix missing file node of generic Gradle root project

2020-10-10 Thread lkishalmi
This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
 new 82af896  [NETBEANS-4891] Fix missing file node of generic Gradle root 
project
82af896 is described below

commit 82af8969406ae36fd9768e2ba901ab2f8b06d3d4
Author: Laszlo Kishalmi 
AuthorDate: Fri Oct 9 11:11:13 2020 -0700

[NETBEANS-4891] Fix missing file node of generic Gradle root project
---
 .travis.yml|   1 +
 .../gradle/queries/GenericProjectSources.java  | 111 +
 .../gradle/queries/GenericProjectSourcesTest.java  |  53 ++
 java/gradle.java/nbproject/project.properties  |   1 +
 java/gradle.java/nbproject/project.xml |   9 +-
 .../gradle/java/classpath/GradleSourcesImpl.java   |   5 -
 .../gradle/java/AbstractGradleJavaTestCase.java|  81 ---
 .../java/classpath/ClassPathProviderImplTest.java  |   4 +-
 .../java/classpath/GradleSourcesImplTest.java  |  15 ++-
 9 files changed, 185 insertions(+), 95 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 3903520..8ccec65 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -360,6 +360,7 @@ matrix:
 - hide-logs.sh ant $OPTS -f java/debugger.jpda.js test
 - hide-logs.sh ant $OPTS -f java/debugger.jpda.projects test
 - hide-logs.sh ant $OPTS -f java/debugger.jpda.projectsui test
+- hide-logs.sh ant $OPTS -f java/gradle.java test
 #- ant $OPTS -f java/debugger.jpda.truffle test
 #- ant $OPTS -f java/debugger.jpda.ui test
 - travis_wait hide-logs.sh ant $OPTS -f java/editor.htmlui test
diff --git 
a/extide/gradle/src/org/netbeans/modules/gradle/queries/GenericProjectSources.java
 
b/extide/gradle/src/org/netbeans/modules/gradle/queries/GenericProjectSources.java
new file mode 100644
index 000..64e422f
--- /dev/null
+++ 
b/extide/gradle/src/org/netbeans/modules/gradle/queries/GenericProjectSources.java
@@ -0,0 +1,111 @@
+/*
+ * 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.queries;
+
+import java.beans.PropertyChangeListener;
+import javax.swing.Icon;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.api.project.SourceGroup;
+import org.netbeans.api.project.Sources;
+import org.netbeans.modules.gradle.api.NbGradleProject;
+import org.netbeans.spi.project.ProjectServiceProvider;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ *
+ * @author lkishalmi
+ */
+@ProjectServiceProvider(service = Sources.class, projectType = 
NbGradleProject.GRADLE_PROJECT_TYPE)
+public class GenericProjectSources implements Sources {
+private final Project project;
+
+public GenericProjectSources(Project project) {
+this.project = project;
+}
+@Override
+public SourceGroup[] getSourceGroups(String type) {
+return Sources.TYPE_GENERIC.equals(type)? new SourceGroup[]{new 
ProjectSourceGroup()} : new SourceGroup[0];
+}
+
+@Override
+public void addChangeListener(ChangeListener listener) {
+}
+
+@Override
+public void removeChangeListener(ChangeListener listener) {
+}
+
+private final class ProjectSourceGroup implements SourceGroup {
+
+public ProjectSourceGroup() {
+}
+
+@Override
+public FileObject getRootFolder() {
+return project.getProjectDirectory();
+}
+
+@Override
+public String getName() {
+return ProjectUtils.getInformation(project).getName();
+}
+
+@Override
+public String getDisplayName() {
+return ProjectUtils.getInformation(project).getDisplayName();
+}
+
+@Override
+public Icon getIcon(boolean opened) {
+return null;
+}
+
+@Override
+public boolean 

[netbeans] branch master updated: [NETBEANS-4891] Fix missing file node of generic Gradle root project

2020-10-10 Thread lkishalmi
This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
 new 82af896  [NETBEANS-4891] Fix missing file node of generic Gradle root 
project
82af896 is described below

commit 82af8969406ae36fd9768e2ba901ab2f8b06d3d4
Author: Laszlo Kishalmi 
AuthorDate: Fri Oct 9 11:11:13 2020 -0700

[NETBEANS-4891] Fix missing file node of generic Gradle root project
---
 .travis.yml|   1 +
 .../gradle/queries/GenericProjectSources.java  | 111 +
 .../gradle/queries/GenericProjectSourcesTest.java  |  53 ++
 java/gradle.java/nbproject/project.properties  |   1 +
 java/gradle.java/nbproject/project.xml |   9 +-
 .../gradle/java/classpath/GradleSourcesImpl.java   |   5 -
 .../gradle/java/AbstractGradleJavaTestCase.java|  81 ---
 .../java/classpath/ClassPathProviderImplTest.java  |   4 +-
 .../java/classpath/GradleSourcesImplTest.java  |  15 ++-
 9 files changed, 185 insertions(+), 95 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 3903520..8ccec65 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -360,6 +360,7 @@ matrix:
 - hide-logs.sh ant $OPTS -f java/debugger.jpda.js test
 - hide-logs.sh ant $OPTS -f java/debugger.jpda.projects test
 - hide-logs.sh ant $OPTS -f java/debugger.jpda.projectsui test
+- hide-logs.sh ant $OPTS -f java/gradle.java test
 #- ant $OPTS -f java/debugger.jpda.truffle test
 #- ant $OPTS -f java/debugger.jpda.ui test
 - travis_wait hide-logs.sh ant $OPTS -f java/editor.htmlui test
diff --git 
a/extide/gradle/src/org/netbeans/modules/gradle/queries/GenericProjectSources.java
 
b/extide/gradle/src/org/netbeans/modules/gradle/queries/GenericProjectSources.java
new file mode 100644
index 000..64e422f
--- /dev/null
+++ 
b/extide/gradle/src/org/netbeans/modules/gradle/queries/GenericProjectSources.java
@@ -0,0 +1,111 @@
+/*
+ * 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.queries;
+
+import java.beans.PropertyChangeListener;
+import javax.swing.Icon;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.api.project.SourceGroup;
+import org.netbeans.api.project.Sources;
+import org.netbeans.modules.gradle.api.NbGradleProject;
+import org.netbeans.spi.project.ProjectServiceProvider;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ *
+ * @author lkishalmi
+ */
+@ProjectServiceProvider(service = Sources.class, projectType = 
NbGradleProject.GRADLE_PROJECT_TYPE)
+public class GenericProjectSources implements Sources {
+private final Project project;
+
+public GenericProjectSources(Project project) {
+this.project = project;
+}
+@Override
+public SourceGroup[] getSourceGroups(String type) {
+return Sources.TYPE_GENERIC.equals(type)? new SourceGroup[]{new 
ProjectSourceGroup()} : new SourceGroup[0];
+}
+
+@Override
+public void addChangeListener(ChangeListener listener) {
+}
+
+@Override
+public void removeChangeListener(ChangeListener listener) {
+}
+
+private final class ProjectSourceGroup implements SourceGroup {
+
+public ProjectSourceGroup() {
+}
+
+@Override
+public FileObject getRootFolder() {
+return project.getProjectDirectory();
+}
+
+@Override
+public String getName() {
+return ProjectUtils.getInformation(project).getName();
+}
+
+@Override
+public String getDisplayName() {
+return ProjectUtils.getInformation(project).getDisplayName();
+}
+
+@Override
+public Icon getIcon(boolean opened) {
+return null;
+}
+
+@Override
+public boolean