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 37a005b  [NETBEANS-4615] Display compiler arg in Gradle Source 
Customizer Panel
37a005b is described below

commit 37a005b364ab058bef24f2ed6efbe7597269b05e
Author: Laszlo Kishalmi <[email protected]>
AuthorDate: Wed Jul 22 10:56:31 2020 -0700

    [NETBEANS-4615] Display compiler arg in Gradle Source Customizer Panel
---
 .../gradle/java/customizer/Bundle.properties       |  1 +
 .../gradle/java/customizer/SourceSetPanel.form     | 30 +++++++++++++++--
 .../gradle/java/customizer/SourceSetPanel.java     | 39 ++++++++++++++--------
 3 files changed, 55 insertions(+), 15 deletions(-)

diff --git 
a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/Bundle.properties
 
b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/Bundle.properties
index 8089bb4..53c6c77 100644
--- 
a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/Bundle.properties
+++ 
b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/Bundle.properties
@@ -31,3 +31,4 @@ 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.
 SourceSetPanel.jScrollPane4.TabConstraints.tabTitle=Annotation Processors
+SourceSetPanel.jScrollPane6.TabConstraints.tabTitle=Compiler Args
diff --git 
a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.form
 
b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.form
index 9fec81e..2d24624 100644
--- 
a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.form
+++ 
b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.form
@@ -134,8 +134,8 @@
           <SubComponents>
             <Component class="javax.swing.JTree" name="trSources">
               <Properties>
-                <Property name="model" type="javax.swing.tree.TreeModel" 
editor="org.netbeans.modules.form.editors2.TreeModelEditor">
-                  <TreeModel code=""/>
+                <Property name="model" type="javax.swing.tree.TreeModel" 
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+                  <Connection code="sourcesModel" type="code"/>
                 </Property>
                 <Property name="rootVisible" type="boolean" value="false"/>
               </Properties>
@@ -211,6 +211,32 @@
             </Component>
           </SubComponents>
         </Container>
+        <Container class="javax.swing.JScrollPane" name="jScrollPane6">
+          <AuxValues>
+            <AuxValue name="autoScrollPane" type="java.lang.Boolean" 
value="true"/>
+          </AuxValues>
+          <Constraints>
+            <Constraint 
layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"
 
value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
+              <JTabbedPaneConstraints tabName="Compiler Args">
+                <Property name="tabTitle" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+                  <ResourceString 
bundle="org/netbeans/modules/gradle/java/customizer/Bundle.properties" 
key="SourceSetPanel.jScrollPane6.TabConstraints.tabTitle" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+                </Property>
+              </JTabbedPaneConstraints>
+            </Constraint>
+          </Constraints>
+
+          <Layout 
class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+          <SubComponents>
+            <Component class="javax.swing.JTree" name="trCompilerArgs">
+              <Properties>
+                <Property name="model" type="javax.swing.tree.TreeModel" 
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+                  <Connection code="argumentsModel" type="code"/>
+                </Property>
+                <Property name="rootVisible" type="boolean" value="false"/>
+              </Properties>
+            </Component>
+          </SubComponents>
+        </Container>
       </SubComponents>
     </Container>
     <Component class="javax.swing.JTextField" name="tfSourceLevel">
diff --git 
a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.java
 
b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.java
index 1f6c370..f4d4e98 100644
--- 
a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.java
+++ 
b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.java
@@ -51,7 +51,10 @@ public class SourceSetPanel extends javax.swing.JPanel {
 
     final Path relativeRoot;
     final GradleJavaSourceSet sourceSet;
-    DefaultMutableTreeNode sourcesRoot = new DefaultMutableTreeNode(new 
Object());
+    private final DefaultMutableTreeNode sourcesRoot = new 
DefaultMutableTreeNode(new Object());
+    private final DefaultTreeModel sourcesModel = new 
DefaultTreeModel(sourcesRoot, true);
+    private final DefaultMutableTreeNode argumentsRoot = new 
DefaultMutableTreeNode(new Object());
+    private final DefaultTreeModel argumentsModel = new 
DefaultTreeModel(argumentsRoot, true);
 
     /**
      * Creates new form SourceSetPanel
@@ -82,20 +85,21 @@ public class SourceSetPanel extends javax.swing.JPanel {
         for (GradleJavaSourceSet.SourceType type : 
GradleJavaSourceSet.SourceType.values()) {
             if (!sourceSet.getSourceDirs(type).isEmpty()) {
                 DefaultMutableTreeNode typeNode = new 
DefaultMutableTreeNode(type);
-                sourcesRoot.add(typeNode);
+                sourcesModel.insertNodeInto(typeNode, sourcesRoot, 
sourcesRoot.getChildCount());
                 for (File dir : sourceSet.getSourceDirs(type)) {
-                    typeNode.add(new DefaultMutableTreeNode(dir, false));
+                    sourcesModel.insertNodeInto(new 
DefaultMutableTreeNode(dir, false), typeNode, typeNode.getChildCount());
                 }
+                trSources.expandPath(new TreePath(typeNode.getPath()));
             }
-        }
-        trSources.setModel(new DefaultTreeModel(sourcesRoot, true));
-        DefaultMutableTreeNode currentNode = sourcesRoot;
-        do {
-            if (currentNode.getLevel() <= 1) {
-                trSources.expandPath(new TreePath(currentNode.getPath()));
+            if (!sourceSet.getCompilerArgs(type).isEmpty()) {
+                DefaultMutableTreeNode typeNode = new 
DefaultMutableTreeNode(type, true);
+                argumentsModel.insertNodeInto(typeNode, argumentsRoot, 
argumentsRoot.getChildCount());
+                for (String compilerArg : sourceSet.getCompilerArgs(type)) {
+                    argumentsModel.insertNodeInto(new 
DefaultMutableTreeNode(compilerArg, false), typeNode, typeNode.getChildCount());
+                }
+                trCompilerArgs.expandPath(new TreePath(typeNode.getPath()));
             }
-            currentNode = currentNode.getNextNode();
-        } while (currentNode != null);
+        }
         trSources.setCellRenderer(new MyTreeCellRenderer());
 
         DefaultListModel<File> compileModel = new DefaultListModel<>();
@@ -141,6 +145,8 @@ public class SourceSetPanel extends javax.swing.JPanel {
         lsRuntime = new javax.swing.JList<>();
         jScrollPane4 = new javax.swing.JScrollPane();
         lsAnnotationProcessors = new javax.swing.JList<>();
+        jScrollPane6 = new javax.swing.JScrollPane();
+        trCompilerArgs = new javax.swing.JTree();
         tfSourceLevel = new javax.swing.JTextField();
         tfOutputResources = new javax.swing.JTextField();
         tfOutputClasses = new javax.swing.JTextField();
@@ -153,8 +159,7 @@ public class SourceSetPanel extends javax.swing.JPanel {
 
         jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
 
-        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new 
javax.swing.tree.DefaultMutableTreeNode("root");
-        trSources.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
+        trSources.setModel(sourcesModel);
         trSources.setRootVisible(false);
         jScrollPane1.setViewportView(trSources);
 
@@ -172,6 +177,12 @@ public class SourceSetPanel extends javax.swing.JPanel {
 
         
jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(SourceSetPanel.class, 
"SourceSetPanel.jScrollPane4.TabConstraints.tabTitle"), jScrollPane4); // NOI18N
 
+        trCompilerArgs.setModel(argumentsModel);
+        trCompilerArgs.setRootVisible(false);
+        jScrollPane6.setViewportView(trCompilerArgs);
+
+        
jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(SourceSetPanel.class, 
"SourceSetPanel.jScrollPane6.TabConstraints.tabTitle"), jScrollPane6); // NOI18N
+
         tfSourceLevel.setEditable(false);
         
tfSourceLevel.setText(org.openide.util.NbBundle.getMessage(SourceSetPanel.class,
 "SourceSetPanel.tfSourceLevel.text")); // NOI18N
 
@@ -278,6 +289,7 @@ public class SourceSetPanel extends javax.swing.JPanel {
     private javax.swing.JScrollPane jScrollPane2;
     private javax.swing.JScrollPane jScrollPane3;
     private javax.swing.JScrollPane jScrollPane4;
+    private javax.swing.JScrollPane jScrollPane6;
     private javax.swing.JTabbedPane jTabbedPane1;
     private javax.swing.JList<File> lsAnnotationProcessors;
     private javax.swing.JList<File> lsCompile;
@@ -285,6 +297,7 @@ public class SourceSetPanel extends javax.swing.JPanel {
     private javax.swing.JTextField tfOutputClasses;
     private javax.swing.JTextField tfOutputResources;
     private javax.swing.JTextField tfSourceLevel;
+    private javax.swing.JTree trCompilerArgs;
     private javax.swing.JTree trSources;
     // End of variables declaration//GEN-END:variables
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to