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 5c20715 [NETBEANS-4766] Arrange Gradle Source info detail tabs to the right 5c20715 is described below commit 5c2071541bd7b2d1aeb2e698b10c9e857e8c3323 Author: Laszlo Kishalmi <laszlo.kisha...@gmail.com> AuthorDate: Fri Sep 11 10:10:50 2020 -0700 [NETBEANS-4766] Arrange Gradle Source info detail tabs to the right --- .../gradle/java/customizer/Bundle.properties | 6 --- .../gradle/java/customizer/SourceSetPanel.form | 46 +++++++++--------- .../gradle/java/customizer/SourceSetPanel.java | 54 ++++++++++++++++------ .../gradle/java/customizer/SourcesPanel.java | 20 +++++++- 4 files changed, 83 insertions(+), 43 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 53c6c77..a3172dc 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 @@ -24,11 +24,5 @@ CompileOptionsPanel.lbPlatform.text=Java &Platform: SourceSetPanel.jLabel1.text=Output Classes: SourceSetPanel.jLabel2.text=Output Resources: SourceSetPanel.jLabel3.text=Source/Binary Format: -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. -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 2d24624..0afcb80 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 @@ -40,11 +40,11 @@ <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jTabbedPane1" pref="494" max="32767" attributes="0"/> + <Component id="tpDetails" max="32767" attributes="0"/> <Group type="102" attributes="0"> <Component id="jLabel3" min="-2" pref="169" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> - <Component id="tfSourceLevel" max="32767" attributes="0"/> + <Component id="tfSourceLevel" pref="402" max="32767" attributes="0"/> </Group> <Group type="102" alignment="0" attributes="0"> <Group type="103" groupAlignment="1" max="-2" attributes="0"> @@ -71,7 +71,7 @@ <Component id="tfSourceLevel" alignment="3" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> - <Component id="jTabbedPane1" pref="232" max="32767" attributes="0"/> + <Component id="tpDetails" pref="232" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> <Component id="jLabel1" min="-2" max="-2" attributes="0"/> @@ -109,9 +109,12 @@ </Property> </Properties> </Component> - <Container class="javax.swing.JTabbedPane" name="jTabbedPane1"> + <Container class="javax.swing.JTabbedPane" name="tpDetails"> <Properties> - <Property name="tabPlacement" type="int" value="3"/> + <Property name="tabPlacement" type="int" value="4"/> + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[150, 32]"/> + </Property> </Properties> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/> @@ -122,9 +125,9 @@ </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> - <JTabbedPaneConstraints tabName="Source"> - <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.jScrollPane1.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + <JTabbedPaneConstraints tabName="<User Code>"> + <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="Details.SOURCES.toString()" type="code"/> </Property> </JTabbedPaneConstraints> </Constraint> @@ -148,9 +151,9 @@ </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> - <JTabbedPaneConstraints tabName="Compile Classpath"> - <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.jScrollPane2.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + <JTabbedPaneConstraints tabName="<User Code>"> + <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="Details.COMPILE_CP.toString()" type="code"/> </Property> </JTabbedPaneConstraints> </Constraint> @@ -171,9 +174,9 @@ </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> - <JTabbedPaneConstraints tabName="Runtime Classpath"> - <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.jScrollPane3.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + <JTabbedPaneConstraints tabName="<User Code>"> + <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="Details.RUNTIME_CP.toString()" type="code"/> </Property> </JTabbedPaneConstraints> </Constraint> @@ -194,9 +197,9 @@ </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> - <JTabbedPaneConstraints tabName="Annotation Processors"> - <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.jScrollPane4.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + <JTabbedPaneConstraints tabName="<User Code>"> + <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="Details.ANNOTATION_PROC.toString()" type="code"/> </Property> </JTabbedPaneConstraints> </Constraint> @@ -217,9 +220,9 @@ </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, "{key}")"/> + <JTabbedPaneConstraints tabName="<User Code>"> + <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="Details.COMPILER_ARGS.toString()" type="code"/> </Property> </JTabbedPaneConstraints> </Constraint> @@ -242,9 +245,6 @@ <Component class="javax.swing.JTextField" name="tfSourceLevel"> <Properties> <Property name="editable" type="boolean" value="false"/> - <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="SourceSetPanel.tfSourceLevel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> </Properties> </Component> <Component class="javax.swing.JTextField" name="tfOutputResources"> 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 f4d4e98..adbef5a 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 @@ -31,17 +31,37 @@ import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JTree; +import javax.swing.event.ChangeListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import org.openide.util.ImageUtilities; +import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; /** * * @author Laszlo Kishalmi */ public class SourceSetPanel extends javax.swing.JPanel { + + @Messages({ + "sourceSetDetail.SOURCES=Sources", + "sourceSetDetail.COMPILE_CP=Compile Classpath", + "sourceSetDetail.RUNTIME_CP=Runtime Classpath", + "sourceSetDetail.ANNOTATION_PROC=Annotation Processors", + "sourceSetDetail.COMPILER_ARGS=Compiler Args", + }) + enum Details { + SOURCES, COMPILE_CP, RUNTIME_CP, ANNOTATION_PROC, COMPILER_ARGS; + + @Override + public String toString() { + return NbBundle.getMessage(SourceSetPanel.class, "sourceSetDetail." + name()); //NOI18N + } + } + private static final String PROJECT_ICON = "org.netbeans.modules/gradle/resources/gradle.png"; //NOI18N private static final String ARTIFACT_ICON = "org.netbeans.modules/gradle/resources/module-artifact.png"; //NOI18N @@ -124,6 +144,14 @@ public class SourceSetPanel extends javax.swing.JPanel { lsAnnotationProcessors.setCellRenderer(new MyListCellRenderer()); } + void addDetailsChangeListener(ChangeListener l) { + tpDetails.addChangeListener(l); + } + + void setActiveDetails(Details detail) { + tpDetails.setSelectedIndex(detail.ordinal()); + } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -136,7 +164,7 @@ public class SourceSetPanel extends javax.swing.JPanel { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); - jTabbedPane1 = new javax.swing.JTabbedPane(); + tpDetails = new javax.swing.JTabbedPane(); jScrollPane1 = new javax.swing.JScrollPane(); trSources = new javax.swing.JTree(); jScrollPane2 = new javax.swing.JScrollPane(); @@ -157,34 +185,34 @@ public class SourceSetPanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(SourceSetPanel.class, "SourceSetPanel.jLabel3.text")); // NOI18N - jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.BOTTOM); + tpDetails.setTabPlacement(javax.swing.JTabbedPane.RIGHT); + tpDetails.setMinimumSize(new java.awt.Dimension(150, 32)); trSources.setModel(sourcesModel); trSources.setRootVisible(false); jScrollPane1.setViewportView(trSources); - jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(SourceSetPanel.class, "SourceSetPanel.jScrollPane1.TabConstraints.tabTitle"), jScrollPane1); // NOI18N + tpDetails.addTab(Details.SOURCES.toString(), jScrollPane1); jScrollPane2.setViewportView(lsCompile); - jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(SourceSetPanel.class, "SourceSetPanel.jScrollPane2.TabConstraints.tabTitle"), jScrollPane2); // NOI18N + tpDetails.addTab(Details.COMPILE_CP.toString(), jScrollPane2); jScrollPane3.setViewportView(lsRuntime); - jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(SourceSetPanel.class, "SourceSetPanel.jScrollPane3.TabConstraints.tabTitle"), jScrollPane3); // NOI18N + tpDetails.addTab(Details.RUNTIME_CP.toString(), jScrollPane3); jScrollPane4.setViewportView(lsAnnotationProcessors); - jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(SourceSetPanel.class, "SourceSetPanel.jScrollPane4.TabConstraints.tabTitle"), jScrollPane4); // NOI18N + tpDetails.addTab(Details.ANNOTATION_PROC.toString(), jScrollPane4); trCompilerArgs.setModel(argumentsModel); trCompilerArgs.setRootVisible(false); jScrollPane6.setViewportView(trCompilerArgs); - jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(SourceSetPanel.class, "SourceSetPanel.jScrollPane6.TabConstraints.tabTitle"), jScrollPane6); // NOI18N + tpDetails.addTab(Details.COMPILER_ARGS.toString(), jScrollPane6); tfSourceLevel.setEditable(false); - tfSourceLevel.setText(org.openide.util.NbBundle.getMessage(SourceSetPanel.class, "SourceSetPanel.tfSourceLevel.text")); // NOI18N tfOutputResources.setEditable(false); @@ -197,11 +225,11 @@ public class SourceSetPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 494, Short.MAX_VALUE) + .addComponent(tpDetails, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(tfSourceLevel)) + .addComponent(tfSourceLevel, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -220,7 +248,7 @@ public class SourceSetPanel extends javax.swing.JPanel { .addComponent(jLabel3) .addComponent(tfSourceLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE) + .addComponent(tpDetails, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) @@ -280,7 +308,7 @@ public class SourceSetPanel extends javax.swing.JPanel { } } - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; @@ -290,13 +318,13 @@ public class SourceSetPanel extends javax.swing.JPanel { 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; private javax.swing.JList<File> lsRuntime; private javax.swing.JTextField tfOutputClasses; private javax.swing.JTextField tfOutputResources; private javax.swing.JTextField tfSourceLevel; + private javax.swing.JTabbedPane tpDetails; private javax.swing.JTree trCompilerArgs; private javax.swing.JTree trSources; // End of variables declaration//GEN-END:variables diff --git a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourcesPanel.java b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourcesPanel.java index 1ef7065..f99cd7d 100644 --- a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourcesPanel.java +++ b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourcesPanel.java @@ -32,7 +32,11 @@ import org.netbeans.modules.gradle.spi.Utils; import org.netbeans.modules.gradle.spi.customizer.support.FilterPanelProvider; import java.io.File; import javax.swing.JComponent; +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import org.netbeans.api.project.Project; +import org.netbeans.modules.gradle.java.customizer.SourceSetPanel.Details; import org.netbeans.spi.project.ui.support.ProjectCustomizer; import org.openide.util.Lookup; import org.openide.util.NbBundle; @@ -43,18 +47,32 @@ import org.openide.util.NbBundle; */ public class SourcesPanel extends javax.swing.JPanel { + Details activeDetail = Details.SOURCES; + /** * Creates new form SourcesPanel */ public SourcesPanel(Project project) { initComponents(); GradleJavaProject gjp = GradleJavaProject.get(project); + ChangeListener chl = (ChangeEvent evt) -> { + JTabbedPane details = (JTabbedPane) evt.getSource(); + int selected = details.getSelectedIndex() != -1 ? details.getSelectedIndex() : 0; + activeDetail = Details.values()[selected]; + }; if (gjp != null) { for (GradleJavaSourceSet sourceSet : gjp.getSourceSets().values()) { File rootDir = GradleBaseProject.get(project).getRootDir(); SourceSetPanel panel = new SourceSetPanel(sourceSet, rootDir); tbSourceSets.addTab(Utils.camelCaseToTitle(sourceSet.getName()), null, panel, sourceSet.getName()); + panel.addDetailsChangeListener(chl); } + tbSourceSets.addChangeListener((ChangeEvent evt) -> { + SourceSetPanel selected = (SourceSetPanel) tbSourceSets.getSelectedComponent(); + if (selected != null) { + selected.setActiveDetails(activeDetail); + } + }); } } @@ -75,7 +93,7 @@ public class SourcesPanel extends javax.swing.JPanel { return customizer; } }; - return new FilterPanelProvider(provider, "java-base"); + return new FilterPanelProvider(provider, "java-base"); //NOI18N } /** --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists