--- java.j2seproject/nbproject/project.xml +++ java.j2seproject/nbproject/project.xml @@ -329,13 +329,17 @@ org.openide.loaders - 7.61 + + 7.61 + org.netbeans.api.templates - 1.0 + + 1.0 + org.openide.modules @@ -528,14 +532,16 @@ com.sun.tools.java.analysis.parfait + org.netbeans.modules.cnd.mixeddev org.netbeans.modules.hudsonfindbugs org.netbeans.modules.java.j2sedeploy org.netbeans.modules.java.j2seembedded org.netbeans.modules.javafx2.project org.netbeans.modules.javawebstart - org.netbeans.modules.cnd.mixeddev + org.netbeans.modules.maven org.netbeans.modules.swingapp org.netbeans.modules.java.j2seproject.api + org.netbeans.modules.java.j2seproject.ui.customizer.vmo --- java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties +++ java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties @@ -183,7 +183,7 @@ LBL_CustomizeRun_Run_Working_Directory_Browse_Title=Browse Working Directory LBL_CustomizeRun_Run_VM_Options=&VM Options: LBL_CustomizeRun_Run_VM_Options_Example=(e.g. -Xms10m) -LBL_CustomizeRun_Run_VM_Options_JButton=C&ustomize +LBL_CustomizeRun_Run_VM_Options_JButton=C&ustomize... LBL_ChooseMainClass_OK=Select Main Class LBL_ChooseMainClass_Title=Browse Main Classes --- maven/nbproject/project.xml +++ maven/nbproject/project.xml @@ -125,6 +125,14 @@ + org.netbeans.api.templates + + + + 1.0 + + + org.netbeans.libs.javacapi @@ -186,6 +194,15 @@ + org.netbeans.modules.java.j2seproject + + + + 1 + 1.78 + + + org.netbeans.modules.java.platform @@ -479,14 +496,6 @@ - org.netbeans.api.templates - - - - 1.0 - - - org.openide.modules @@ -511,7 +520,7 @@ - org.openide.util.ui + org.openide.util @@ -519,19 +528,19 @@ - org.openide.util + org.openide.util.lookup - 9.3 + 8.0 - org.openide.util.lookup + org.openide.util.ui - 8.0 + 9.3 @@ -586,15 +595,17 @@ org.javeleon.netbeans - org.nbheaven.sqe.core.maven org.nbheaven.sqe.core.maven3 + org.netbeans.api.maven + org.netbeans.modules.android.maven org.netbeans.modules.apisupport.installer.maven org.netbeans.modules.groovy.support org.netbeans.modules.hudson.maven + org.netbeans.modules.j2ee.appengine org.netbeans.modules.jbi.fuji.support org.netbeans.modules.kenai.maven - org.netbeans.api.maven + org.netbeans.modules.ko4j.debugging org.netbeans.modules.maven.apisupport org.netbeans.modules.maven.checkstyle org.netbeans.modules.maven.coverage @@ -612,19 +623,12 @@ org.netbeans.modules.maven.repository org.netbeans.modules.maven.samples org.netbeans.modules.maven.spring + org.netbeans.modules.maven.util + org.netbeans.modules.scala.maven org.netbeans.modules.selenium.maven org.netbeans.modules.selenium2.maven - org.netbeans.modules.ko4j.debugging org.netbeans.modules.testng.maven - - org.netbeans.modules.android.maven - - org.netbeans.modules.scala.maven - org.vaadin.netbeans.maven - - org.netbeans.modules.j2ee.appengine - org.netbeans.modules.maven.util org.netbeans.modules.maven.api org.netbeans.modules.maven.api.archetype org.netbeans.modules.maven.api.classpath --- maven/src/org/netbeans/modules/maven/customizer/Bundle.properties +++ maven/src/org/netbeans/modules/maven/customizer/Bundle.properties @@ -166,3 +166,5 @@ CompilePanel.cbCompileOnSave.text=Compile On &Save CompilePanel.btnLearnMore.text=Learn More about Compile On Save feature in Maven projects ActionMappings.jButton1.text=Show in Toolbar +RunJarPanel.txtVMOptions.AccessibleContext.accessibleDescription=VM options +RunJarPanel.customizeOptionsButton.text=C&utomize... --- maven/src/org/netbeans/modules/maven/customizer/RunJarPanel.form +++ maven/src/org/netbeans/modules/maven/customizer/RunJarPanel.form @@ -16,7 +16,7 @@ - + @@ -26,24 +26,28 @@ - - - - - + + + + + + + + + + + - - - + + + + - - - - + @@ -70,13 +74,14 @@ - - - + + + + - + @@ -160,11 +165,6 @@ - - - - - @@ -197,5 +197,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --- maven/src/org/netbeans/modules/maven/customizer/RunJarPanel.java +++ maven/src/org/netbeans/modules/maven/customizer/RunJarPanel.java @@ -52,6 +52,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultListCellRenderer; @@ -60,6 +61,7 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JTextField; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; @@ -68,6 +70,7 @@ import org.netbeans.api.project.ProjectUtils; import org.netbeans.api.project.SourceGroup; import org.netbeans.api.project.Sources; +import org.netbeans.modules.java.j2seproject.ui.customizer.vmo.OptionsDialog; import org.netbeans.modules.maven.NbMavenProjectImpl; import org.netbeans.modules.maven.api.customizer.ModelHandle2; import org.netbeans.modules.maven.classpath.MavenSourcesImpl; @@ -90,6 +93,7 @@ * @author Milos Kleint */ public class RunJarPanel extends javax.swing.JPanel implements HelpCtx.Provider { + public static final Logger log = Logger.getLogger(RunJarPanel.class.getName()); private boolean isCurrentRun = true; private boolean isCurrentDebug = true; @@ -109,8 +113,8 @@ private String oldVMParams; private String oldWorkDir; private String oldAllParams; - private DocumentListener docListener; - private ActionListener comboListener; + private final DocumentListener docListener; + private final ActionListener comboListener; private ProjectCustomizer.Category category; public RunJarPanel(ModelHandle2 handle, NbMavenProjectImpl project, ProjectCustomizer.Category category) { @@ -135,7 +139,7 @@ initValues(); lblMainClass.setFont(lblMainClass.getFont().deriveFont(Font.BOLD)); - List roots = new ArrayList(); + List roots = new ArrayList<>(); Sources srcs = ProjectUtils.getSources(project); SourceGroup[] grps = srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); for (int i = 0; i < grps.length; i++) { @@ -319,10 +323,12 @@ txtWorkDir = new javax.swing.JTextField(); btnWorkDir = new javax.swing.JButton(); lblVMOptions = new javax.swing.JLabel(); - txtVMOptions = new javax.swing.JTextField(); lblHint = new javax.swing.JLabel(); lblConfiguration = new javax.swing.JLabel(); comConfiguration = new javax.swing.JComboBox(); + jScrollPane1 = new javax.swing.JScrollPane(); + txtVMOptions = new javax.swing.JTextArea(); + customizeOptionsButton = new javax.swing.JButton(); lblMainClass.setLabelFor(txtMainClass); org.openide.awt.Mnemonics.setLocalizedText(lblMainClass, org.openide.util.NbBundle.getMessage(RunJarPanel.class, "LBL_MainClass")); // NOI18N @@ -352,11 +358,24 @@ comConfiguration.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + txtVMOptions.setColumns(20); + txtVMOptions.setLineWrap(true); + txtVMOptions.setRows(5); + jScrollPane1.setViewportView(txtVMOptions); + txtVMOptions.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(RunJarPanel.class, "RunJarPanel.txtVMOptions.AccessibleContext.accessibleDescription")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(customizeOptionsButton, org.openide.util.NbBundle.getMessage(RunJarPanel.class, "RunJarPanel.customizeOptionsButton.text")); // NOI18N + customizeOptionsButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + customizeOptionsButtonActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblWorkDir) .addComponent(lblVMOptions) @@ -365,19 +384,21 @@ .addComponent(lblMainClass)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(txtVMOptions, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE) - .addComponent(txtWorkDir, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE) - .addComponent(txtArguments, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE) - .addComponent(txtMainClass, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE) - .addComponent(comConfiguration, 0, 225, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(btnWorkDir) - .addComponent(btnMainClass))) .addGroup(layout.createSequentialGroup() - .addGap(128, 128, 128) .addComponent(lblHint) - .addContainerGap(246, Short.MAX_VALUE)) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txtWorkDir, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txtArguments, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txtMainClass, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(comConfiguration, javax.swing.GroupLayout.Alignment.LEADING, 0, 230, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(btnWorkDir, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnMainClass, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(customizeOptionsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -400,12 +421,13 @@ .addComponent(txtWorkDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnWorkDir)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblVMOptions) - .addComponent(txtVMOptions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(customizeOptionsButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblHint) - .addContainerGap(139, Short.MAX_VALUE)) + .addContainerGap(91, Short.MAX_VALUE)) ); txtMainClass.getAccessibleContext().setAccessibleDescription("Main class"); @@ -413,7 +435,6 @@ txtArguments.getAccessibleContext().setAccessibleDescription("Arguments"); txtWorkDir.getAccessibleContext().setAccessibleDescription("Working directory"); btnWorkDir.getAccessibleContext().setAccessibleDescription("Browse working directory"); - txtVMOptions.getAccessibleContext().setAccessibleDescription("VM options"); comConfiguration.getAccessibleContext().setAccessibleDescription("Configuration"); }// //GEN-END:initComponents @@ -435,6 +456,16 @@ } }//GEN-LAST:event_btnWorkDirActionPerformed + private void customizeOptionsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customizeOptionsButtonActionPerformed + String origin = txtVMOptions.getText(); + try { + String result = OptionsDialog.showCustomizer(SwingUtilities.getWindowAncestor(this), origin); + txtVMOptions.setText(result); + } catch (Exception e) { + log.log(Level.WARNING, "Cannot parse vm options.", e); // NOI18N + } + }//GEN-LAST:event_customizeOptionsButtonActionPerformed + void applyChanges() { String newMainClass = txtMainClass.getText().trim(); String newParams = txtArguments.getText().trim(); @@ -446,9 +477,9 @@ if (newMainClass.trim().length() > 0) { newAllParams = newAllParams + newMainClass + " "; //NOI18N } else { - newAllParams = newAllParams + "${packageClassName} "; //NOI18N + newAllParams += "${packageClassName} "; //NOI18N } - newAllParams = newAllParams + newParams; + newAllParams += newParams; newAllParams = newAllParams.trim(); if (isCurrentRun) { boolean changed = false; @@ -506,7 +537,7 @@ while (it.hasNext()) { String goal = (String) it.next(); if (goal.matches("org\\.codehaus\\.mojo\\:exec-maven-plugin\\:(.)+\\:exec") //NOI18N - || goal.indexOf("exec:exec") > -1) { //NOI18N + || goal.contains("exec:exec")) { //NOI18N if (map.getProperties() != null && map.getProperties().containsKey("exec.args")) { String execArgs = map.getProperties().get("exec.args"); if (execArgs.contains("-classpath")) { @@ -567,7 +598,7 @@ } else if (s.equals("${packageClassName}") || s.matches("[\\w]+[\\.]{0,1}[\\w\\.]*")) { //NOI18N return s; } else { - Logger.getLogger(RunJarPanel.class.getName()).fine("failed splitting main class from=" + line); //NOI18N + log.log(Level.WARNING, "failed splitting main class from={0}", line); //NOI18N } s = ps.nextPair(); } @@ -587,6 +618,8 @@ private javax.swing.JButton btnMainClass; private javax.swing.JButton btnWorkDir; private javax.swing.JComboBox comConfiguration; + private javax.swing.JButton customizeOptionsButton; + private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel lblArguments; private javax.swing.JLabel lblConfiguration; private javax.swing.JLabel lblHint; @@ -595,7 +628,7 @@ private javax.swing.JLabel lblWorkDir; private javax.swing.JTextField txtArguments; private javax.swing.JTextField txtMainClass; - private javax.swing.JTextField txtVMOptions; + private javax.swing.JTextArea txtVMOptions; private javax.swing.JTextField txtWorkDir; // End of variables declaration//GEN-END:variables @@ -621,8 +654,8 @@ private class MainClassListener implements ActionListener /*, DocumentListener */ { private final JButton okButton; - private FileObject[] sourceRoots; - private JTextField mainClassTextField; + private final FileObject[] sourceRoots; + private final JTextField mainClassTextField; MainClassListener( FileObject[] sourceRoots, JTextField mainClassTextField ) { this.sourceRoots = sourceRoots;