This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 183455
Collapse All | Expand All

(-)a/maven/src/org/netbeans/modules/maven/options/Bundle.properties (-14 / +19 lines)
Lines 40-64 Link Here
40
40
41
TIP_Maven_Category=Setting up of default Maven execution options.
41
TIP_Maven_Category=Setting up of default Maven execution options.
42
SettingsPanel.btnIndex.text=Index &Now
42
SettingsPanel.btnIndex.text=Index &Now
43
SettingsPanel.lblLocalRepository.text=&Local Repository \:
43
SettingsPanel.lblLocalRepository.text=&Local Repository:
44
SettingsPanel.btnLocalRepository.text=&Browse...
44
SettingsPanel.btnLocalRepository.text=&Browse...
45
SettingsPanel.lblIndex.text=&Index Update Frequency\:
45
SettingsPanel.lblIndex.text=&Index Update Frequency\:
46
SettingsPanel.cbSnapshots.text=Include &Snapshots In Local Index
46
SettingsPanel.cbSnapshots.text=Include &Snapshots In Local Index
47
47
48
TIT_Select=Select Local Repository Location
48
TIT_Select=Select Local Repository Location
49
SettingsPanel.lblCommandLine.text=External &Maven Home :
50
TIT_Select2=Select Maven2 Installation Location
49
TIT_Select2=Select Maven2 Installation Location
51
50
SettingsPanel.btnGoals.text=Edit
52
SettingsPanel.txtCommandLine.text=
53
SettingsPanel.btnCommandLine.text=&Browse...
54
SettingsPanel.btnGoals.text=Edit &Global Custom Goal Definitions...
55
TIT_Global=Global Maven Goal definitions
51
TIT_Global=Global Maven Goal definitions
56
ACSD_Global=Global Maven Goal definitions
52
ACSD_Global=Global Maven Goal definitions
57
SettingsPanel.lblEmbeddedVersion.text=
58
LBL_MavenVersion1=(Embedded Maven version: {0} built on {1})
53
LBL_MavenVersion1=(Embedded Maven version: {0} built on {1})
59
LBL_MavenVersion2=(Embedded Maven version: {0})
54
LBL_MavenVersion2=(Embedded Maven version: {0})
60
LBL_MavenVersion3=Cannot figure version of embedded Maven
55
LBL_MavenVersion3=Cannot figure version of embedded Maven
61
SettingsPanel.lblExternalVersion.text=
62
LBL_ExMavenVersion1=(Version: {0} built on {1})
56
LBL_ExMavenVersion1=(Version: {0} built on {1})
63
LBL_ExMavenVersion2=(Version: {0})
57
LBL_ExMavenVersion2=(Version: {0})
64
LBL_ExMavenVersion3=Using Default Maven Version: {0} (as found on PATH)
58
LBL_ExMavenVersion3=Using Default Maven Version: {0} (as found on PATH)
Lines 68-81 Link Here
68
FREQ_Always=On every startup
62
FREQ_Always=On every startup
69
FREQ_Never=Never
63
FREQ_Never=Never
70
ERR_Wrong_Settings_file=Cannot parse the ~/.m2/settings.xml file, any options related to that file will be disabled.
64
ERR_Wrong_Settings_file=Cannot parse the ~/.m2/settings.xml file, any options related to that file will be disabled.
71
SettingsPanel.lblOptions.text=Global Execution &Options :
65
SettingsPanel.lblOptions.text=Global Execution &Options:
72
SettingsPanel.btnOptions.text=&Add
73
GlobalOptionsPanel.lblOptions.text=&Global Execution Options :
66
GlobalOptionsPanel.lblOptions.text=&Global Execution Options :
74
SettingsPanel.lblBinaries.text=&Download Binaries :
67
SettingsPanel.lblBinaries.text=&Download Binaries:
75
SettingsPanel.jLabel3.text=<html><b>Please note</b> that setting any of these to values other than <b>"Never"</b> can make opening projects significantly slower.
68
SettingsPanel.jLabel3.text=<html><b>Please note</b> that setting any of these to values other than <b>"Never"</b> can make opening projects significantly slower.
76
On_Project_Open=On Project Open
69
On_Project_Open=On Project Open
77
SettingsPanel.lblSource.text=Check &Sources :
70
SettingsPanel.lblSource.text=Check &Sources:
78
SettingsPanel.lblJavadoc.text=Check &Javadoc :
71
SettingsPanel.lblJavadoc.text=Check &Javadoc:
79
txt_default_repository=<Use default local repository as defined by Maven>
72
txt_default_repository=<Use default local repository as defined by Maven>
80
WORK_OFFLINE=Work offline.
73
WORK_OFFLINE=Work offline.
81
PRODUCE_EXECUTION_DEBUG_OUTPUT=Produce execution debug output.
74
PRODUCE_EXECUTION_DEBUG_OUTPUT=Produce execution debug output.
Lines 91-98 Link Here
91
FORCES_A_CHECK=Forces a check for updated releases and snapshots on remote repositories.
84
FORCES_A_CHECK=Forces a check for updated releases and snapshots on remote repositories.
92
DON'T_USE_PLUGIN-REGISTRY=Don't use ~/.m2/plugin-registry.xml for plugin versions
85
DON'T_USE_PLUGIN-REGISTRY=Don't use ~/.m2/plugin-registry.xml for plugin versions
93
TIT_Add_Globals=Add Global Option(s)
86
TIT_Add_Globals=Add Global Option(s)
94
SettingsPanel.jLabel1.text=On Project Open :
87
SettingsPanel.jLabel1.text=On Project Open:
95
TIT_NEVER=Never
88
TIT_NEVER=Never
96
TIT_EVERY=Every Project Open
89
TIT_EVERY=Every Project Open
97
TIT_FIRST=First Open Only
90
TIT_FIRST=First Open Only
98
SettingsPanel.cbSkipTests.text=Skip &Tests for any build executions not directly related to testing
91
SettingsPanel.cbSkipTests.text=Skip &Tests for any build executions not directly related to testing
92
SettingsPanel.btnAddRuntime.text=&Add
93
SettingsPanel.btnEditRuntime.text=&Edit
94
SettingsPanel.btnRemoveRuntime.text=&Remove
95
SettingsPanel.lblMavenRuntimes.text=&Maven Runtimes:
96
SettingsPanel.jLabel2.text=Global Goal Definitions:
97
SettingsPanel.btnAddOption.text=Add
98
SettingsPanel.btnRemoveOption.text=Remove
99
MAVEN_RUNTIME_Embedded=Embedded {1}
100
MAVEN_RUNTIME_External=External {0} {1}
101
MAVEN_RUNTIME_ErrorCaption=Error
102
MAVEN_RUNTIME_Error_DuplicatedRuntime_Message=The selected directory {0} is not a valid Maven directory.
103
MAVEN_RUNTIME_Error_AlreadyRegistered_Message=The selected Maven directory is already registered.
(-)a/maven/src/org/netbeans/modules/maven/options/GlobalOptionsPanel.java (-5 / +6 lines)
Lines 40-45 Link Here
40
package org.netbeans.modules.maven.options;
40
package org.netbeans.modules.maven.options;
41
41
42
import java.util.HashMap;
42
import java.util.HashMap;
43
import java.util.LinkedList;
43
import javax.swing.DefaultListModel;
44
import javax.swing.DefaultListModel;
44
import javax.swing.event.ListSelectionEvent;
45
import javax.swing.event.ListSelectionEvent;
45
import javax.swing.event.ListSelectionListener;
46
import javax.swing.event.ListSelectionListener;
Lines 76-90 Link Here
76
        });
77
        });
77
    }
78
    }
78
79
79
    String getSelectedOnes() {
80
    String[] getSelectedOnes() {
80
        String toRet = "";
81
        Object[] objs = jList1.getSelectedValues();
81
        Object[] objs = jList1.getSelectedValues();
82
		String[] result = new String[objs == null ? 0 : objs.length];
82
        if (objs != null) {
83
        if (objs != null) {
83
            for (Object obj : objs) {
84
            for (int i = 0; i < objs.length; ++i) {
84
                toRet = toRet + " " + obj;
85
                result[i] = (String) objs[i];
85
            }
86
            }
86
        }
87
        }
87
        return toRet;
88
        return result;
88
    }
89
    }
89
90
90
    /** This method is called from within the constructor to
91
    /** This method is called from within the constructor to
(-)a/maven/src/org/netbeans/modules/maven/options/MyJTextField.java (-2 / +2 lines)
Lines 47-53 Link Here
47
 *
47
 *
48
 * @author mkleint
48
 * @author mkleint
49
 */
49
 */
50
public class MyJTextField extends JTextField {
50
public class JHintTextField extends JTextField {
51
51
52
    Color origForeground;
52
    Color origForeground;
53
    String origText = "";
53
    String origText = "";
Lines 72-78 Link Here
72
        }
72
        }
73
    };
73
    };
74
74
75
    public MyJTextField() {
75
    public JHintTextField() {
76
        addFocusListener(listener);
76
        addFocusListener(listener);
77
    }
77
    }
78
78
(-)a/maven/src/org/netbeans/modules/maven/options/MavenSettings.java (+94 lines)
Lines 46-51 Link Here
46
import hidden.org.codehaus.plexus.util.cli.Commandline;
46
import hidden.org.codehaus.plexus.util.cli.Commandline;
47
import hidden.org.codehaus.plexus.util.cli.StreamConsumer;
47
import hidden.org.codehaus.plexus.util.cli.StreamConsumer;
48
import java.io.File;
48
import java.io.File;
49
import java.util.ArrayList;
50
import java.util.List;
49
import java.util.logging.Logger;
51
import java.util.logging.Logger;
50
import java.util.prefs.BackingStoreException;
52
import java.util.prefs.BackingStoreException;
51
import java.util.prefs.Preferences;
53
import java.util.prefs.Preferences;
Lines 55-60 Link Here
55
import org.netbeans.modules.maven.embedder.EmbedderFactory;
57
import org.netbeans.modules.maven.embedder.EmbedderFactory;
56
import org.openide.filesystems.FileUtil;
58
import org.openide.filesystems.FileUtil;
57
import org.openide.util.Exceptions;
59
import org.openide.util.Exceptions;
60
import org.openide.util.NbBundle;
58
import org.openide.util.NbPreferences;
61
import org.openide.util.NbPreferences;
59
import org.openide.util.Utilities;
62
import org.openide.util.Utilities;
60
63
Lines 74-79 Link Here
74
    public static final String PROP_LAST_ARCHETYPE_GROUPID = "lastArchetypeGroupId"; //NOI18N
77
    public static final String PROP_LAST_ARCHETYPE_GROUPID = "lastArchetypeGroupId"; //NOI18N
75
    public static final String PROP_CUSTOM_LOCAL_REPOSITORY = "localRepository"; //NOI18N
78
    public static final String PROP_CUSTOM_LOCAL_REPOSITORY = "localRepository"; //NOI18N
76
    public static final String PROP_SKIP_TESTS = "skipTests"; //NOI18N
79
    public static final String PROP_SKIP_TESTS = "skipTests"; //NOI18N
80
    public static final String PROP_MAVEN_RUNTIMES = "mavenRuntimes"; //NOI18N
77
81
78
    //these are from former versions (6.5) and are here only for conversion
82
    //these are from former versions (6.5) and are here only for conversion
79
    private static final String PROP_DEBUG = "showDebug"; // NOI18N
83
    private static final String PROP_DEBUG = "showDebug"; // NOI18N
Lines 436-440 Link Here
436
        }
440
        }
437
    };
441
    };
438
442
443
    private void initExternalVersion(List<MavenRuntime> mavenRuntimes, String[] paths, boolean stopOnFirstValid) {
444
		for (String path : paths) {
445
			File file = new File(path);
446
			path = FileUtil.normalizeFile(file).getAbsolutePath();
447
			String version = MavenUtil.getExternalVersion(path);
448
			if (version != null) {
449
				mavenRuntimes.add(new MavenRuntime(path, version));
450
				if (stopOnFirstValid) {
451
					return;
452
				}
453
			}
454
		}
455
	}
456
457
	/**
458
	 * Searches Maven runtime according to the environment settings.
459
	 *
460
	 * <p>It searches in this order:
461
	 * <ul>
462
	 * <li>MAVEN_HOME</li>
463
	 * <li>M2_HOME</li>
464
	 * <li>PATH</li></ul>
465
	 * </p>
466
	 * <p>Only the first appereance will be appended.</p>
467
	 *
468
	 * @param mavenRuntimes a list to store all Maven Runtime configurations.
469
	 */
470
    private void initDefaultExternalVersion(List<MavenRuntime> mavenRuntimes) {
471
		String paths = System.getenv("PATH"); // NOI18N
472
		String mavenHome = System.getenv("MAVEN_HOME"); // NOI18N
473
		String m2Home = System.getenv("M2_HOME"); // NOI18N
474
475
		List<String> mavenEnvDirs = new ArrayList<String>();
476
		if (mavenHome != null) {
477
			mavenEnvDirs.add(mavenHome);
478
		}
479
		if (m2Home != null) {
480
			mavenEnvDirs.add(m2Home);
481
		}
482
		if (paths != null) {
483
			for (String path : paths.split(File.pathSeparator)) {
484
				if (!path.endsWith("bin")) { // NOI18N
485
					continue;
486
				}
487
488
				mavenEnvDirs.add(path.substring(0,
489
						path.length() - "bin".length() - File.pathSeparator.length()));
490
			}
491
		}
492
493
		initExternalVersion(mavenRuntimes, mavenEnvDirs.toArray(new String[0]), true);
494
    }
495
496
	public MavenRuntime[] getMavenRuntimes() {
497
		List<MavenRuntime> runtimes = new ArrayList<MavenRuntime>();
498
		
499
		// Embedded
500
		runtimes.add(new MavenRuntime("",
501
				NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion2", "3.0-SNAPSHOT")));
502
		
503
		String runtimesPref = getPreferences().get(PROP_MAVEN_RUNTIMES, null);
504
		if (runtimesPref != null) {
505
			for (String runtimePath : runtimesPref.split(File.pathSeparator)) {
506
				if (!"".equals(runtimePath)) {
507
					String version = MavenUtil.getExternalVersion(runtimePath);
508
					if (version != null) {
509
						runtimes.add(new MavenRuntime(runtimePath, version));
510
					}
511
				}
512
			}
513
514
		} else {
515
			// Try to find 
516
			initDefaultExternalVersion(runtimes);
517
		}
518
		
519
		return runtimes.toArray(new MavenRuntime[0]);
520
	}
521
522
	public void setMavenRuntimes(MavenRuntime[] runtimes) {
523
		if (runtimes == null) {
524
			getPreferences().remove(PROP_MAVEN_RUNTIMES);
525
		} else {
526
			String runtimesPref = "";
527
			for (MavenRuntime runtime : runtimes) {
528
				runtimesPref += runtime.getPath() + File.pathSeparator;
529
			}
530
			putProperty(PROP_MAVEN_RUNTIMES, runtimesPref);
531
		}
532
	}
439
    
533
    
440
}
534
}
(-)a/maven/src/org/netbeans/modules/maven/options/SettingsPanel.form (-121 / +206 lines)
Lines 24-183 Link Here
24
  <Layout>
24
  <Layout>
25
    <DimensionLayout dim="0">
25
    <DimensionLayout dim="0">
26
      <Group type="103" groupAlignment="0" attributes="0">
26
      <Group type="103" groupAlignment="0" attributes="0">
27
          <Group type="102" attributes="0">
27
          <Group type="102" alignment="1" attributes="0">
28
              <EmptySpace max="-2" attributes="0"/>
28
              <EmptySpace min="-2" max="-2" attributes="0"/>
29
              <Group type="103" groupAlignment="0" attributes="0">
29
              <Group type="103" groupAlignment="0" attributes="0">
30
                  <Group type="102" alignment="0" attributes="0">
30
                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
31
                  <Group type="102" alignment="0" max="-2" attributes="0">
31
                      <Group type="103" groupAlignment="0" attributes="0">
32
                      <Group type="103" groupAlignment="0" attributes="0">
32
                          <Component id="lblCommandLine" alignment="0" min="-2" max="-2" attributes="0"/>
33
                          <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
33
                          <Component id="lblOptions" alignment="0" min="-2" max="-2" attributes="0"/>
34
                          <Component id="lblIndex" alignment="0" min="-2" max="-2" attributes="0"/>
34
                          <Component id="lblLocalRepository" alignment="0" min="-2" max="-2" attributes="0"/>
35
                      </Group>
36
                      <EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
37
                      <Group type="103" groupAlignment="0" attributes="0">
38
                          <Group type="102" alignment="0" attributes="0">
39
                              <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
40
                              <Component id="comIndex" min="-2" pref="425" max="-2" attributes="0"/>
41
                              <EmptySpace max="-2" attributes="0"/>
42
                              <Component id="btnIndex" min="-2" pref="87" max="-2" attributes="1"/>
43
                          </Group>
44
                          <Component id="cbSnapshots" alignment="0" min="-2" max="-2" attributes="0"/>
45
                          <Component id="btnGoals" alignment="0" min="-2" pref="57" max="-2" attributes="0"/>
46
                      </Group>
47
                  </Group>
48
                  <Group type="102" alignment="1" attributes="0">
49
                      <Group type="103" groupAlignment="1" attributes="0">
50
                          <Group type="102" alignment="0" attributes="0">
51
                              <EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
52
                              <Component id="jLabel3" pref="578" max="32767" attributes="0"/>
53
                          </Group>
54
                          <Group type="102" alignment="0" max="-2" attributes="0">
55
                              <EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
56
                              <Group type="103" groupAlignment="0" attributes="0">
57
                                  <Component id="lblBinaries" alignment="0" min="-2" max="-2" attributes="0"/>
58
                                  <Component id="lblJavadoc" alignment="0" min="-2" max="-2" attributes="0"/>
59
                                  <Component id="lblSource" alignment="0" min="-2" max="-2" attributes="0"/>
60
                              </Group>
61
                              <EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
62
                              <Group type="103" groupAlignment="0" max="-2" attributes="0">
63
                                  <Component id="comSource" alignment="1" pref="427" max="32767" attributes="1"/>
64
                                  <Component id="comJavadoc" alignment="1" pref="427" max="32767" attributes="1"/>
65
                                  <Component id="comBinaries" alignment="0" pref="427" max="32767" attributes="1"/>
66
                              </Group>
67
                          </Group>
68
                          <Group type="102" alignment="1" attributes="0">
69
                              <Group type="103" groupAlignment="0" attributes="0">
70
                                  <Component id="lblMavenRuntimes" alignment="0" min="-2" max="-2" attributes="0"/>
71
                                  <Component id="lblOptions" alignment="0" min="-2" max="-2" attributes="0"/>
72
                                  <Component id="lblLocalRepository" alignment="0" min="-2" max="-2" attributes="0"/>
73
                              </Group>
74
                              <EmptySpace max="-2" attributes="0"/>
75
                              <Group type="103" groupAlignment="1" attributes="0">
76
                                  <Component id="jScrollPane2" alignment="0" pref="433" max="32767" attributes="2"/>
77
                                  <Component id="cbSkipTests" alignment="0" pref="433" max="32767" attributes="1"/>
78
                                  <Component id="jScrollPane1" alignment="0" pref="433" max="32767" attributes="2"/>
79
                                  <Component id="txtLocalRepository" pref="433" max="32767" attributes="2"/>
80
                              </Group>
81
                          </Group>
35
                      </Group>
82
                      </Group>
36
                      <EmptySpace max="-2" attributes="0"/>
83
                      <EmptySpace max="-2" attributes="0"/>
37
                      <Group type="103" groupAlignment="0" attributes="0">
84
                      <Group type="103" groupAlignment="0" attributes="0">
38
                          <Component id="lblEmbeddedVersion" alignment="0" pref="470" max="32767" attributes="0"/>
85
                          <Component id="btnLocalRepository" min="-2" max="-2" attributes="1"/>
39
                          <Group type="102" alignment="1" attributes="0">
86
                          <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
40
                              <Component id="txtCommandLine" pref="387" max="32767" attributes="0"/>
87
                              <Component id="btnRemoveOption" alignment="0" max="32767" attributes="1"/>
41
                              <EmptySpace max="-2" attributes="0"/>
88
                              <Component id="btnAddOption" alignment="0" max="32767" attributes="1"/>
42
                              <Component id="btnCommandLine" linkSize="1" min="-2" max="-2" attributes="0"/>
89
                              <Component id="btnRemoveRuntime" alignment="0" max="32767" attributes="1"/>
90
                              <Component id="btnEditRuntime" alignment="0" max="32767" attributes="1"/>
91
                              <Component id="btnAddRuntime" alignment="0" pref="85" max="32767" attributes="1"/>
43
                          </Group>
92
                          </Group>
44
                          <Component id="lblExternalVersion" alignment="0" pref="470" max="32767" attributes="0"/>
45
                          <Group type="102" alignment="1" attributes="0">
46
                              <Group type="103" groupAlignment="0" attributes="0">
47
                                  <Component id="comSource" alignment="0" pref="387" max="32767" attributes="1"/>
48
                                  <Component id="comJavadoc" alignment="0" pref="387" max="32767" attributes="1"/>
49
                                  <Component id="comBinaries" alignment="0" pref="387" max="32767" attributes="1"/>
50
                                  <Component id="txtLocalRepository" alignment="0" pref="387" max="32767" attributes="1"/>
51
                                  <Component id="txtOptions" pref="387" max="32767" attributes="0"/>
52
                              </Group>
53
                              <EmptySpace max="-2" attributes="0"/>
54
                              <Group type="103" groupAlignment="0" attributes="0">
55
                                  <Component id="btnLocalRepository" linkSize="1" min="-2" max="-2" attributes="0"/>
56
                                  <Component id="btnOptions" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
57
                              </Group>
58
                          </Group>
59
                          <Component id="cbSkipTests" alignment="0" min="-2" max="-2" attributes="0"/>
60
                      </Group>
93
                      </Group>
61
                  </Group>
94
                  </Group>
62
                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
63
                  <Group type="102" alignment="0" attributes="0">
64
                      <EmptySpace min="12" pref="12" max="12" attributes="0"/>
65
                      <Group type="103" groupAlignment="0" attributes="0">
66
                          <Component id="lblJavadoc" alignment="0" min="-2" max="-2" attributes="0"/>
67
                          <Component id="lblBinaries" alignment="0" min="-2" max="-2" attributes="0"/>
68
                          <Component id="lblSource" alignment="0" min="-2" max="-2" attributes="0"/>
69
                          <Component id="jLabel3" alignment="0" pref="531" max="32767" attributes="0"/>
70
                      </Group>
71
                      <EmptySpace min="-2" pref="106" max="-2" attributes="0"/>
72
                  </Group>
73
                  <Component id="btnGoals" alignment="0" min="-2" max="-2" attributes="0"/>
74
                  <Group type="102" alignment="1" attributes="0">
75
                      <Component id="lblIndex" min="-2" max="-2" attributes="0"/>
76
                      <EmptySpace max="-2" attributes="0"/>
77
                      <Group type="103" groupAlignment="0" attributes="0">
78
                          <Component id="cbSnapshots" min="-2" max="-2" attributes="0"/>
79
                          <Component id="comIndex" pref="391" max="32767" attributes="0"/>
80
                      </Group>
81
                      <EmptySpace max="-2" attributes="0"/>
82
                      <Component id="btnIndex" linkSize="1" min="-2" max="-2" attributes="0"/>
83
                  </Group>
84
              </Group>
95
              </Group>
85
              <EmptySpace max="-2" attributes="0"/>
96
              <EmptySpace min="-2" max="-2" attributes="0"/>
86
          </Group>
97
          </Group>
87
      </Group>
98
      </Group>
88
    </DimensionLayout>
99
    </DimensionLayout>
89
    <DimensionLayout dim="1">
100
    <DimensionLayout dim="1">
90
      <Group type="103" groupAlignment="0" attributes="0">
101
      <Group type="103" groupAlignment="0" attributes="0">
91
          <Group type="102" alignment="0" attributes="0">
102
          <Group type="102" attributes="0">
92
              <Component id="lblEmbeddedVersion" min="-2" max="-2" attributes="0"/>
103
              <Group type="103" groupAlignment="0" attributes="0">
93
              <EmptySpace max="-2" attributes="0"/>
104
                  <Group type="102" alignment="0" attributes="0">
94
              <Group type="103" groupAlignment="3" attributes="0">
105
                      <EmptySpace max="-2" attributes="0"/>
95
                  <Component id="lblCommandLine" alignment="3" min="-2" max="-2" attributes="0"/>
106
                      <Component id="lblMavenRuntimes" min="-2" max="-2" attributes="0"/>
96
                  <Component id="txtCommandLine" alignment="3" min="-2" max="-2" attributes="0"/>
107
                  </Group>
97
                  <Component id="btnCommandLine" alignment="3" min="-2" max="-2" attributes="0"/>
108
                  <Group type="102" alignment="0" attributes="0">
109
                      <EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
110
                      <Group type="103" groupAlignment="0" attributes="0">
111
                          <Group type="102" alignment="0" attributes="0">
112
                              <Component id="btnAddRuntime" min="-2" max="-2" attributes="0"/>
113
                              <EmptySpace max="-2" attributes="0"/>
114
                              <Component id="btnEditRuntime" min="-2" max="-2" attributes="0"/>
115
                              <EmptySpace max="-2" attributes="0"/>
116
                              <Component id="btnRemoveRuntime" min="-2" max="-2" attributes="0"/>
117
                          </Group>
118
                          <Component id="jScrollPane1" alignment="0" min="-2" pref="141" max="-2" attributes="2"/>
119
                      </Group>
120
                  </Group>
121
              </Group>
122
              <EmptySpace min="-2" max="-2" attributes="0"/>
123
              <Group type="103" groupAlignment="0" attributes="0">
124
                  <Component id="lblOptions" min="-2" max="-2" attributes="0"/>
125
                  <Group type="102" attributes="0">
126
                      <Group type="103" groupAlignment="0" attributes="0">
127
                          <Group type="102" attributes="0">
128
                              <Component id="jScrollPane2" min="-2" pref="100" max="-2" attributes="1"/>
129
                              <EmptySpace max="-2" attributes="0"/>
130
                              <Component id="cbSkipTests" min="-2" max="-2" attributes="0"/>
131
                          </Group>
132
                          <Group type="102" attributes="0">
133
                              <Component id="btnAddOption" min="-2" max="-2" attributes="0"/>
134
                              <EmptySpace max="-2" attributes="0"/>
135
                              <Component id="btnRemoveOption" min="-2" max="-2" attributes="0"/>
136
                          </Group>
137
                      </Group>
138
                      <EmptySpace max="-2" attributes="0"/>
139
                      <Group type="103" groupAlignment="3" attributes="0">
140
                          <Component id="txtLocalRepository" alignment="3" min="-2" max="-2" attributes="0"/>
141
                          <Component id="lblLocalRepository" alignment="3" min="-2" max="-2" attributes="0"/>
142
                          <Component id="btnLocalRepository" alignment="3" min="-2" max="-2" attributes="0"/>
143
                      </Group>
144
                  </Group>
98
              </Group>
145
              </Group>
99
              <EmptySpace max="-2" attributes="0"/>
146
              <EmptySpace max="-2" attributes="0"/>
100
              <Component id="lblExternalVersion" min="-2" pref="14" max="-2" attributes="0"/>
101
              <EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
102
              <Group type="103" groupAlignment="3" attributes="0">
103
                  <Component id="lblOptions" alignment="3" min="-2" max="-2" attributes="0"/>
104
                  <Component id="txtOptions" alignment="3" min="-2" max="-2" attributes="0"/>
105
                  <Component id="btnOptions" alignment="3" min="-2" max="-2" attributes="0"/>
106
              </Group>
107
              <EmptySpace max="-2" attributes="0"/>
108
              <Component id="cbSkipTests" min="-2" max="-2" attributes="0"/>
109
              <EmptySpace max="-2" attributes="0"/>
110
              <Group type="103" groupAlignment="3" attributes="0">
111
                  <Component id="txtLocalRepository" alignment="3" min="-2" max="-2" attributes="0"/>
112
                  <Component id="btnLocalRepository" alignment="3" min="-2" max="-2" attributes="0"/>
113
                  <Component id="lblLocalRepository" alignment="3" min="-2" max="-2" attributes="0"/>
114
              </Group>
115
              <EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
116
              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
147
              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
117
              <EmptySpace max="-2" attributes="0"/>
148
              <EmptySpace max="-2" attributes="0"/>
118
              <Group type="103" groupAlignment="3" attributes="0">
149
              <Group type="103" groupAlignment="3" attributes="0">
119
                  <Component id="lblBinaries" alignment="3" min="-2" max="-2" attributes="0"/>
150
                  <Component id="lblBinaries" alignment="3" min="-2" max="-2" attributes="0"/>
120
                  <Component id="comBinaries" alignment="3" min="-2" max="-2" attributes="0"/>
151
                  <Component id="comBinaries" alignment="3" min="-2" max="-2" attributes="0"/>
121
              </Group>
152
              </Group>
122
              <EmptySpace max="-2" attributes="0"/>
153
              <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
123
              <Group type="103" groupAlignment="3" attributes="0">
154
              <Group type="103" groupAlignment="3" attributes="0">
124
                  <Component id="lblJavadoc" alignment="3" min="-2" max="-2" attributes="0"/>
155
                  <Component id="lblJavadoc" alignment="3" min="-2" max="-2" attributes="0"/>
125
                  <Component id="comJavadoc" alignment="3" min="-2" max="-2" attributes="0"/>
156
                  <Component id="comJavadoc" alignment="3" min="-2" max="-2" attributes="0"/>
126
              </Group>
157
              </Group>
158
              <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
159
              <Group type="103" groupAlignment="3" attributes="0">
160
                  <Component id="comSource" alignment="3" min="-2" max="-2" attributes="0"/>
161
                  <Component id="lblSource" alignment="3" min="-2" max="-2" attributes="0"/>
162
              </Group>
163
              <EmptySpace max="-2" attributes="0"/>
164
              <Component id="jLabel3" min="-2" pref="46" max="-2" attributes="0"/>
127
              <EmptySpace max="-2" attributes="0"/>
165
              <EmptySpace max="-2" attributes="0"/>
128
              <Group type="103" groupAlignment="3" attributes="0">
166
              <Group type="103" groupAlignment="3" attributes="0">
129
                  <Component id="lblSource" alignment="3" min="-2" max="-2" attributes="0"/>
167
                  <Component id="btnGoals" alignment="3" min="-2" max="-2" attributes="0"/>
130
                  <Component id="comSource" alignment="3" min="-2" max="-2" attributes="0"/>
168
                  <Component id="jLabel2" alignment="3" min="-2" pref="19" max="-2" attributes="0"/>
131
              </Group>
169
              </Group>
132
              <EmptySpace max="-2" attributes="0"/>
170
              <EmptySpace max="-2" attributes="0"/>
133
              <Component id="jLabel3" min="-2" pref="44" max="-2" attributes="0"/>
134
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
135
              <Component id="btnGoals" min="-2" max="-2" attributes="0"/>
136
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
137
              <Group type="103" groupAlignment="3" attributes="0">
171
              <Group type="103" groupAlignment="3" attributes="0">
138
                  <Component id="btnIndex" alignment="3" min="-2" max="-2" attributes="0"/>
139
                  <Component id="lblIndex" alignment="3" min="-2" max="-2" attributes="0"/>
172
                  <Component id="lblIndex" alignment="3" min="-2" max="-2" attributes="0"/>
140
                  <Component id="comIndex" alignment="3" min="-2" max="-2" attributes="0"/>
173
                  <Component id="comIndex" alignment="3" min="-2" max="-2" attributes="0"/>
174
                  <Component id="btnIndex" alignment="3" min="-2" max="-2" attributes="1"/>
141
              </Group>
175
              </Group>
142
              <EmptySpace max="-2" attributes="0"/>
176
              <EmptySpace max="-2" attributes="0"/>
143
              <Component id="cbSnapshots" min="-2" max="-2" attributes="0"/>
177
              <Component id="cbSnapshots" min="-2" max="-2" attributes="0"/>
144
              <EmptySpace max="32767" attributes="0"/>
178
              <EmptySpace min="-2" max="-2" attributes="0"/>
145
          </Group>
179
          </Group>
146
      </Group>
180
      </Group>
147
    </DimensionLayout>
181
    </DimensionLayout>
148
  </Layout>
182
  </Layout>
149
  <SubComponents>
183
  <SubComponents>
150
    <Component class="javax.swing.JLabel" name="lblCommandLine">
184
    <Component class="javax.swing.JLabel" name="lblMavenRuntimes">
151
      <Properties>
185
      <Properties>
152
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
186
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.lblCommandLine.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
187
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.lblMavenRuntimes.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
154
        </Property>
188
        </Property>
155
      </Properties>
189
      </Properties>
156
    </Component>
190
    </Component>
157
    <Component class="javax.swing.JTextField" name="txtCommandLine">
191
    <Component class="javax.swing.JButton" name="btnRemoveRuntime">
158
      <Properties>
192
      <Properties>
159
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
193
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
160
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.txtCommandLine.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
194
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnRemoveRuntime.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
161
        </Property>
195
        </Property>
162
      </Properties>
196
        <Property name="enabled" type="boolean" value="false"/>
163
    </Component>
164
    <Component class="javax.swing.JButton" name="btnCommandLine">
165
      <Properties>
166
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
167
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnCommandLine.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
168
        </Property>
169
      </Properties>
197
      </Properties>
170
      <Events>
198
      <Events>
171
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCommandLineActionPerformed"/>
199
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRemoveRuntimeActionPerformed"/>
172
      </Events>
200
      </Events>
173
    </Component>
201
    </Component>
174
    <Component class="javax.swing.JLabel" name="lblExternalVersion">
175
      <Properties>
176
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
177
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.lblExternalVersion.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
178
        </Property>
179
      </Properties>
180
    </Component>
181
    <Component class="javax.swing.JLabel" name="lblOptions">
202
    <Component class="javax.swing.JLabel" name="lblOptions">
182
      <Properties>
203
      <Properties>
183
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
204
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
Lines 185-202 Link Here
185
        </Property>
206
        </Property>
186
      </Properties>
207
      </Properties>
187
    </Component>
208
    </Component>
188
    <Component class="javax.swing.JTextField" name="txtOptions">
189
    </Component>
190
    <Component class="javax.swing.JButton" name="btnOptions">
191
      <Properties>
192
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
193
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnOptions.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
194
        </Property>
195
      </Properties>
196
      <Events>
197
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnOptionsActionPerformed"/>
198
      </Events>
199
    </Component>
200
    <Component class="javax.swing.JCheckBox" name="cbSkipTests">
209
    <Component class="javax.swing.JCheckBox" name="cbSkipTests">
201
      <Properties>
210
      <Properties>
202
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
211
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
Lines 213-219 Link Here
213
    </Component>
222
    </Component>
214
    <Component class="javax.swing.JTextField" name="txtLocalRepository">
223
    <Component class="javax.swing.JTextField" name="txtLocalRepository">
215
      <AuxValues>
224
      <AuxValues>
216
        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new MyJTextField();"/>
225
        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new org.netbeans.modules.maven.options.JHintTextField();"/>
217
      </AuxValues>
226
      </AuxValues>
218
    </Component>
227
    </Component>
219
    <Component class="javax.swing.JButton" name="btnLocalRepository">
228
    <Component class="javax.swing.JButton" name="btnLocalRepository">
Lines 226-238 Link Here
226
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnLocalRepositoryActionPerformed"/>
235
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnLocalRepositoryActionPerformed"/>
227
      </Events>
236
      </Events>
228
    </Component>
237
    </Component>
229
    <Component class="javax.swing.JLabel" name="lblEmbeddedVersion">
230
      <Properties>
231
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
232
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.lblEmbeddedVersion.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
233
        </Property>
234
      </Properties>
235
    </Component>
236
    <Component class="javax.swing.JLabel" name="lblBinaries">
238
    <Component class="javax.swing.JLabel" name="lblBinaries">
237
      <Properties>
239
      <Properties>
238
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
240
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
Lines 325-329 Link Here
325
        </Property>
327
        </Property>
326
      </Properties>
328
      </Properties>
327
    </Component>
329
    </Component>
330
    <Component class="javax.swing.JButton" name="btnAddRuntime">
331
      <Properties>
332
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
333
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnAddRuntime.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
334
        </Property>
335
      </Properties>
336
      <Events>
337
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddRuntimeActionPerformed"/>
338
      </Events>
339
    </Component>
340
    <Component class="javax.swing.JButton" name="btnEditRuntime">
341
      <Properties>
342
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
343
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnEditRuntime.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
344
        </Property>
345
        <Property name="enabled" type="boolean" value="false"/>
346
      </Properties>
347
      <Events>
348
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnEditRuntimeActionPerformed"/>
349
      </Events>
350
    </Component>
351
    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
352
      <AuxValues>
353
        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
354
      </AuxValues>
355
356
      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
357
      <SubComponents>
358
        <Component class="javax.swing.JTable" name="tblMavenRuntimes">
359
          <Properties>
360
            <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
361
              <Table columnCount="0" rowCount="4"/>
362
            </Property>
363
            <Property name="autoResizeMode" type="int" value="3"/>
364
            <Property name="showVerticalLines" type="boolean" value="false"/>
365
          </Properties>
366
        </Component>
367
      </SubComponents>
368
    </Container>
369
    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
370
      <AuxValues>
371
        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
372
      </AuxValues>
373
374
      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
375
      <SubComponents>
376
        <Component class="javax.swing.JList" name="lstOptions">
377
          <Properties>
378
            <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
379
              <StringArray count="0"/>
380
            </Property>
381
          </Properties>
382
        </Component>
383
      </SubComponents>
384
    </Container>
385
    <Component class="javax.swing.JLabel" name="jLabel2">
386
      <Properties>
387
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
388
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
389
        </Property>
390
      </Properties>
391
    </Component>
392
    <Component class="javax.swing.JButton" name="btnAddOption">
393
      <Properties>
394
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
395
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnAddOption.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
396
        </Property>
397
      </Properties>
398
      <Events>
399
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddOptionActionPerformed"/>
400
      </Events>
401
    </Component>
402
    <Component class="javax.swing.JButton" name="btnRemoveOption">
403
      <Properties>
404
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
405
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnRemoveOption.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
406
        </Property>
407
        <Property name="enabled" type="boolean" value="false"/>
408
      </Properties>
409
      <Events>
410
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRemoveOptionActionPerformed"/>
411
      </Events>
412
    </Component>
328
  </SubComponents>
413
  </SubComponents>
329
</Form>
414
</Form>
(-)a/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java (-248 / +439 lines)
Lines 43-67 Link Here
43
import java.awt.event.ActionEvent;
43
import java.awt.event.ActionEvent;
44
import java.awt.event.ActionListener;
44
import java.awt.event.ActionListener;
45
import java.io.File;
45
import java.io.File;
46
import java.io.FilenameFilter;
47
import java.io.IOException;
48
import java.io.InputStream;
49
import java.io.StringReader;
46
import java.io.StringReader;
47
import java.util.ArrayList;
50
import java.util.Arrays;
48
import java.util.Arrays;
49
import java.util.Enumeration;
51
import java.util.List;
50
import java.util.List;
52
import java.util.Properties;
53
import java.util.jar.JarFile;
54
import java.util.zip.ZipEntry;
55
import javax.swing.BorderFactory;
51
import javax.swing.BorderFactory;
56
import javax.swing.ComboBoxModel;
52
import javax.swing.ComboBoxModel;
57
import javax.swing.DefaultComboBoxModel;
53
import javax.swing.DefaultComboBoxModel;
58
import javax.swing.DefaultListCellRenderer;
54
import javax.swing.DefaultListCellRenderer;
55
import javax.swing.DefaultListModel;
59
import javax.swing.JFileChooser;
56
import javax.swing.JFileChooser;
60
import javax.swing.JList;
57
import javax.swing.JList;
58
import javax.swing.JOptionPane;
61
import javax.swing.ListCellRenderer;
59
import javax.swing.ListCellRenderer;
62
import javax.swing.SwingUtilities;
60
import javax.swing.SwingUtilities;
63
import javax.swing.event.DocumentEvent;
61
import javax.swing.event.ListSelectionEvent;
64
import javax.swing.event.DocumentListener;
62
import javax.swing.event.ListSelectionListener;
63
import javax.swing.table.AbstractTableModel;
65
import org.netbeans.modules.maven.TextValueCompleter;
64
import org.netbeans.modules.maven.TextValueCompleter;
66
import org.netbeans.modules.maven.indexer.api.RepositoryIndexer;
65
import org.netbeans.modules.maven.indexer.api.RepositoryIndexer;
67
import org.netbeans.modules.maven.indexer.api.RepositoryInfo;
66
import org.netbeans.modules.maven.indexer.api.RepositoryInfo;
Lines 92-101 Link Here
92
    private boolean changed;
91
    private boolean changed;
93
    private boolean valid;
92
    private boolean valid;
94
    private ActionListener listener;
93
    private ActionListener listener;
95
    private DocumentListener docList;
96
    private MavenOptionController controller;
94
    private MavenOptionController controller;
97
    private TextValueCompleter completer;
95
    private TextValueCompleter completer;
96
	private File commandLinePath;
97
	private List<MavenRuntime> mavenRuntimes;
98
	private AbstractTableModel tableModel = new AbstractTableModel() {
98
99
100
		@Override
101
		public int getRowCount() {
102
			return mavenRuntimes.size();
103
		}
104
105
		@Override
106
		public int getColumnCount() {
107
			return 2;
108
		}
109
110
		@Override
111
		public Class<?> getColumnClass(int columnIndex) {
112
			if (columnIndex == 0) {
113
				return Boolean.class;
114
			} else {
115
				return String.class;
116
			}
117
		}
118
119
		@Override
120
		public boolean isCellEditable(int rowIndex, int columnIndex) {
121
			if (columnIndex == 0) {
122
				MavenRuntime runtime = mavenRuntimes.get(rowIndex);
123
				if (!runtime.isExternal() && commandLinePath == null) {
124
					return false;
125
				}
126
				
127
				return true;
128
			}
129
			return false;
130
		}
131
132
		@Override
133
		public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
134
			if (columnIndex == 0) {
135
				MavenRuntime runtime = mavenRuntimes.get(rowIndex);
136
				boolean newValue = (Boolean) aValue;
137
				if (!runtime.isExternal()) {
138
					if (commandLinePath != null) {
139
						if (newValue) {
140
							commandLinePath = null;
141
							fireTableDataChanged();
142
						}
143
					}
144
					if (newValue == false && commandLinePath != null) {
145
						return;
146
					}
147
148
					commandLinePath = null;
149
					
150
				} else {
151
					commandLinePath = newValue ? new File(runtime.getPath()) : null;
152
					fireTableDataChanged();
153
				}
154
155
			} else {
156
				super.setValueAt(aValue, rowIndex, columnIndex);
157
			}
158
		}
159
160
		@Override
161
		public Object getValueAt(int rowIndex, int columnIndex) {
162
			switch (columnIndex) {
163
				case 0: {
164
					MavenRuntime runtime = mavenRuntimes.get(rowIndex);
165
					if (commandLinePath != null && commandLinePath.getAbsolutePath().equals(runtime.getPath())) {
166
						return true;
167
168
					} else if (commandLinePath == null && !runtime.isExternal()) {
169
						return true;
170
					}
171
172
					return false;
173
				}
174
175
				case 1: {
176
					MavenRuntime runtime = mavenRuntimes.get(rowIndex);
177
					String key = runtime.isExternal() ? "MAVEN_RUNTIME_External" : "MAVEN_RUNTIME_Embedded";
178
					return NbBundle.getMessage(SettingsPanel.class, key,
179
							new Object[]{runtime.getPath(), runtime.getVersion()});
180
				}
181
			}
182
183
			return null;
184
		}
185
	};
186
187
	private DefaultListModel optionsModel = new DefaultListModel();
188
	
99
    /** Creates new form SettingsPanel */
189
    /** Creates new form SettingsPanel */
100
    SettingsPanel(MavenOptionController controller) {
190
    SettingsPanel(MavenOptionController controller) {
101
        initComponents();
191
        initComponents();
Lines 105-110 Link Here
105
        comJavadoc.setModel(new DefaultComboBoxModel(downloads));
195
        comJavadoc.setModel(new DefaultComboBoxModel(downloads));
106
        comSource.setModel(new DefaultComboBoxModel(downloads));
196
        comSource.setModel(new DefaultComboBoxModel(downloads));
107
197
198
		mavenRuntimes = new ArrayList<MavenRuntime>();
199
		tblMavenRuntimes.setModel(tableModel);
200
		tblMavenRuntimes.setTableHeader(null);
201
		tblMavenRuntimes.getColumnModel().getColumn(0).setMaxWidth(20);
202
		tblMavenRuntimes.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
203
204
			@Override
205
			public void valueChanged(ListSelectionEvent e) {
206
				if (!e.getValueIsAdjusting()) {
207
					int selected = tblMavenRuntimes.getSelectedRow();
208
					if (selected != -1 && mavenRuntimes.get(selected).isExternal()) {
209
						btnEditRuntime.setEnabled(true);
210
						btnRemoveRuntime.setEnabled(true);
211
					} else {
212
						btnEditRuntime.setEnabled(false);
213
						btnRemoveRuntime.setEnabled(false);
214
					}
215
				}
216
			}
217
218
		});
219
220
		lstOptions.setModel(optionsModel);
221
		lstOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
222
223
			@Override
224
			public void valueChanged(ListSelectionEvent e) {
225
				if (!e.getValueIsAdjusting()) {
226
					if (optionsModel.getSize() > 0) {
227
						btnRemoveOption.setEnabled(true);
228
					} else {
229
						btnRemoveOption.setEnabled(false);
230
					}
231
				}
232
			}
233
234
		});
235
108
        ListCellRenderer rend = new DefaultListCellRenderer() {
236
        ListCellRenderer rend = new DefaultListCellRenderer() {
109
            @Override
237
            @Override
110
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
238
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Lines 124-147 Link Here
124
        comJavadoc.setRenderer(rend);
252
        comJavadoc.setRenderer(rend);
125
253
126
        this.controller = controller;
254
        this.controller = controller;
127
        docList = new DocumentListener() {
128
            public void insertUpdate(DocumentEvent e) {
129
                documentChanged(e);
130
            }
131
            public void removeUpdate(DocumentEvent e) {
132
                documentChanged(e);
133
            }
134
            public void changedUpdate(DocumentEvent e) {
135
                documentChanged(e);
136
            }
137
        };
138
        initValues();
255
        initValues();
139
        ((MyJTextField)txtLocalRepository).setHintText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "txt_default_repository"));
256
        ((JHintTextField)txtLocalRepository).setHintText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "txt_default_repository"));
140
        listener = new ActionListenerImpl();
257
        listener = new ActionListenerImpl();
141
        cbSnapshots.addActionListener(listener);
258
        cbSnapshots.addActionListener(listener);
142
        comIndex.addActionListener(listener);
259
        comIndex.addActionListener(listener);
143
        completer = new TextValueCompleter(getGlobalOptions(), txtOptions, " "); //NOI18N
144
        initEmbeddedVersion();
145
    }
260
    }
146
261
147
    static String[] AVAILABLE_OPTIONS = new String[] {
262
    static String[] AVAILABLE_OPTIONS = new String[] {
Lines 183-194 Link Here
183
        return Arrays.asList(AVAILABLE_OPTIONS);
298
        return Arrays.asList(AVAILABLE_OPTIONS);
184
    }
299
    }
185
300
186
    private void initEmbeddedVersion()
301
//    private void initEmbeddedVersion() {
187
    {
188
        //there was a renumbering scheme for maven. current trunk is not 2.1 but 3.0
302
        //there was a renumbering scheme for maven. current trunk is not 2.1 but 3.0
189
        //http://blogs.sonatype.com/brian/2008/09/05/1220649145080.html
303
        //http://blogs.sonatype.com/brian/2008/09/05/1220649145080.html
190
        //XXX: just hardwire here to not confuse people with old style versions.
304
        //XXX: just hardwire here to not confuse people with old style versions.
191
          lblEmbeddedVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion2", "3.0-SNAPSHOT")); //NOI18N
192
        
305
        
193
//        InputStream resourceAsStream;
306
//        InputStream resourceAsStream;
194
//        try {
307
//        try {
Lines 206-291 Link Here
206
//        catch  ( IOException e ) {
319
//        catch  ( IOException e ) {
207
//            lblEmbeddedVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion3"));
320
//            lblEmbeddedVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion3"));
208
//        }
321
//        }
209
    }
322
//    }
210
323
211
    private void initExternalVersion()
212
    {
213
        String path = txtCommandLine.getText().trim();
214
        if (path.length() == 0) {
215
            String ver = MavenSettings.getDefaultMavenInstanceVersion();
216
            if (ver != null) {
217
                lblExternalVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_ExMavenVersion3", ver));//NOI18N
218
            } else {
219
                lblExternalVersion.setText(ver != null ? ver : ""); //NOI18N
220
            }
221
            return;
222
        }
223
        File root = new File(path);
224
        File lib = new File(root, "lib"); //NOI18N
225
        if (lib.exists()) {
226
            File[] jars = lib.listFiles(new FilenameFilter() {
227
                public boolean accept(File dir, String name) {
228
                    return name.endsWith(".jar"); //NOI18N
229
                }
230
            });
231
            for (File jar : jars) {
232
                JarFile jf = null;
233
                try
234
                {
235
                    jf = new JarFile(jar);
236
                    ZipEntry entry = jf.getEntry("META-INF/maven/org.apache.maven/maven-core/pom.properties");//NOI18N
237
                    if (entry != null) {
238
                        InputStream resourceAsStream = jf.getInputStream(entry);
239
                        Properties properties = new Properties();
240
                        properties.load( resourceAsStream );
241
                        if ( properties.getProperty( "builtOn" ) != null ) { //NOI18N
242
                            lblExternalVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_ExMavenVersion1", 
243
                                    properties.getProperty( "version", "unknown" ), properties.getProperty( "builtOn" )));//NOI18N
244
                        } else {
245
                            lblExternalVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_ExMavenVersion2", properties.getProperty( "version", "unknown" )));//NOI18N
246
                        }
247
                        return;
248
                    }
249
                } catch ( IOException ex )
250
                {
251
                    //ignore..
252
                } finally {
253
                    if (jf != null) {
254
                        try {
255
                            jf.close();
256
                        } catch (IOException x) {}
257
                    }
258
                }
259
            }
260
        }
261
        //add red color..
262
        lblExternalVersion.setText(NbBundle.getMessage(SettingsPanel.class, "ERR_NoValidInstallation"));
263
    }
264
    
265
    private void initValues() {
324
    private void initValues() {
266
        comIndex.setSelectedIndex(0);
325
        comIndex.setSelectedIndex(0);
267
        cbSnapshots.setSelected(true);
326
        cbSnapshots.setSelected(true);
268
    }
327
    }
269
    
328
    
270
    private void documentChanged(DocumentEvent e) {
271
        changed = true;
272
        boolean oldvalid = valid;
273
        if (txtCommandLine.getText().trim().length() > 0) {
274
            File fil = new File(txtCommandLine.getText());
275
            if (fil.exists() && new File(fil, "bin" + File.separator + "mvn").exists()) { //NOI18N
276
                valid = true;
277
            } else {
278
                valid = false;
279
            }
280
        } else {
281
            valid = true;
282
        }
283
        if (oldvalid != valid) {
284
            controller.firePropChange(MavenOptionController.PROP_VALID, Boolean.valueOf(oldvalid), Boolean.valueOf(valid));
285
        }
286
        initExternalVersion();
287
    }
288
    
289
    private ComboBoxModel createComboModel() {
329
    private ComboBoxModel createComboModel() {
290
        return new DefaultComboBoxModel(
330
        return new DefaultComboBoxModel(
291
                new String[] { 
331
                new String[] { 
Lines 307-324 Link Here
307
        bgChecksums = new javax.swing.ButtonGroup();
347
        bgChecksums = new javax.swing.ButtonGroup();
308
        bgPlugins = new javax.swing.ButtonGroup();
348
        bgPlugins = new javax.swing.ButtonGroup();
309
        bgFailure = new javax.swing.ButtonGroup();
349
        bgFailure = new javax.swing.ButtonGroup();
310
        lblCommandLine = new javax.swing.JLabel();
350
        lblMavenRuntimes = new javax.swing.JLabel();
311
        txtCommandLine = new javax.swing.JTextField();
351
        btnRemoveRuntime = new javax.swing.JButton();
312
        btnCommandLine = new javax.swing.JButton();
313
        lblExternalVersion = new javax.swing.JLabel();
314
        lblOptions = new javax.swing.JLabel();
352
        lblOptions = new javax.swing.JLabel();
315
        txtOptions = new javax.swing.JTextField();
316
        btnOptions = new javax.swing.JButton();
317
        cbSkipTests = new javax.swing.JCheckBox();
353
        cbSkipTests = new javax.swing.JCheckBox();
318
        lblLocalRepository = new javax.swing.JLabel();
354
        lblLocalRepository = new javax.swing.JLabel();
319
        txtLocalRepository = new MyJTextField();
355
        txtLocalRepository = new org.netbeans.modules.maven.options.JHintTextField();
320
        btnLocalRepository = new javax.swing.JButton();
356
        btnLocalRepository = new javax.swing.JButton();
321
        lblEmbeddedVersion = new javax.swing.JLabel();
322
        lblBinaries = new javax.swing.JLabel();
357
        lblBinaries = new javax.swing.JLabel();
323
        comBinaries = new javax.swing.JComboBox();
358
        comBinaries = new javax.swing.JComboBox();
324
        lblJavadoc = new javax.swing.JLabel();
359
        lblJavadoc = new javax.swing.JLabel();
Lines 332-360 Link Here
332
        comIndex = new javax.swing.JComboBox();
367
        comIndex = new javax.swing.JComboBox();
333
        btnIndex = new javax.swing.JButton();
368
        btnIndex = new javax.swing.JButton();
334
        cbSnapshots = new javax.swing.JCheckBox();
369
        cbSnapshots = new javax.swing.JCheckBox();
370
        btnAddRuntime = new javax.swing.JButton();
371
        btnEditRuntime = new javax.swing.JButton();
372
        jScrollPane1 = new javax.swing.JScrollPane();
373
        tblMavenRuntimes = new javax.swing.JTable();
374
        jScrollPane2 = new javax.swing.JScrollPane();
375
        lstOptions = new javax.swing.JList();
376
        jLabel2 = new javax.swing.JLabel();
377
        btnAddOption = new javax.swing.JButton();
378
        btnRemoveOption = new javax.swing.JButton();
335
379
336
        org.openide.awt.Mnemonics.setLocalizedText(lblCommandLine, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblCommandLine.text")); // NOI18N
380
        org.openide.awt.Mnemonics.setLocalizedText(lblMavenRuntimes, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblMavenRuntimes.text")); // NOI18N
337
381
338
        txtCommandLine.setText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.txtCommandLine.text")); // NOI18N
382
        org.openide.awt.Mnemonics.setLocalizedText(btnRemoveRuntime, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnRemoveRuntime.text")); // NOI18N
339
383
        btnRemoveRuntime.setEnabled(false);
340
        org.openide.awt.Mnemonics.setLocalizedText(btnCommandLine, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnCommandLine.text")); // NOI18N
384
        btnRemoveRuntime.addActionListener(new java.awt.event.ActionListener() {
341
        btnCommandLine.addActionListener(new java.awt.event.ActionListener() {
342
            public void actionPerformed(java.awt.event.ActionEvent evt) {
385
            public void actionPerformed(java.awt.event.ActionEvent evt) {
343
                btnCommandLineActionPerformed(evt);
386
                btnRemoveRuntimeActionPerformed(evt);
344
            }
387
            }
345
        });
388
        });
346
389
347
        org.openide.awt.Mnemonics.setLocalizedText(lblExternalVersion, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblExternalVersion.text", new Object[] {})); // NOI18N
348
349
        org.openide.awt.Mnemonics.setLocalizedText(lblOptions, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblOptions.text")); // NOI18N
390
        org.openide.awt.Mnemonics.setLocalizedText(lblOptions, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblOptions.text")); // NOI18N
350
391
351
        org.openide.awt.Mnemonics.setLocalizedText(btnOptions, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnOptions.text")); // NOI18N
352
        btnOptions.addActionListener(new java.awt.event.ActionListener() {
353
            public void actionPerformed(java.awt.event.ActionEvent evt) {
354
                btnOptionsActionPerformed(evt);
355
            }
356
        });
357
358
        org.openide.awt.Mnemonics.setLocalizedText(cbSkipTests, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbSkipTests.text")); // NOI18N
392
        org.openide.awt.Mnemonics.setLocalizedText(cbSkipTests, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbSkipTests.text")); // NOI18N
359
393
360
        org.openide.awt.Mnemonics.setLocalizedText(lblLocalRepository, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblLocalRepository.text")); // NOI18N
394
        org.openide.awt.Mnemonics.setLocalizedText(lblLocalRepository, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblLocalRepository.text")); // NOI18N
Lines 366-373 Link Here
366
            }
400
            }
367
        });
401
        });
368
402
369
        org.openide.awt.Mnemonics.setLocalizedText(lblEmbeddedVersion, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblEmbeddedVersion.text")); // NOI18N
370
371
        lblBinaries.setLabelFor(comBinaries);
403
        lblBinaries.setLabelFor(comBinaries);
372
        org.openide.awt.Mnemonics.setLocalizedText(lblBinaries, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblBinaries.text")); // NOI18N
404
        org.openide.awt.Mnemonics.setLocalizedText(lblBinaries, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblBinaries.text")); // NOI18N
373
405
Lines 402-511 Link Here
402
434
403
        org.openide.awt.Mnemonics.setLocalizedText(cbSnapshots, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbSnapshots.text")); // NOI18N
435
        org.openide.awt.Mnemonics.setLocalizedText(cbSnapshots, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbSnapshots.text")); // NOI18N
404
436
437
        org.openide.awt.Mnemonics.setLocalizedText(btnAddRuntime, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnAddRuntime.text")); // NOI18N
438
        btnAddRuntime.addActionListener(new java.awt.event.ActionListener() {
439
            public void actionPerformed(java.awt.event.ActionEvent evt) {
440
                btnAddRuntimeActionPerformed(evt);
441
            }
442
        });
443
444
        org.openide.awt.Mnemonics.setLocalizedText(btnEditRuntime, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnEditRuntime.text")); // NOI18N
445
        btnEditRuntime.setEnabled(false);
446
        btnEditRuntime.addActionListener(new java.awt.event.ActionListener() {
447
            public void actionPerformed(java.awt.event.ActionEvent evt) {
448
                btnEditRuntimeActionPerformed(evt);
449
            }
450
        });
451
452
        tblMavenRuntimes.setModel(new javax.swing.table.DefaultTableModel(
453
            new Object [][] {
454
                {},
455
                {},
456
                {},
457
                {}
458
            },
459
            new String [] {
460
461
            }
462
        ));
463
        tblMavenRuntimes.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN);
464
        tblMavenRuntimes.setShowVerticalLines(false);
465
        jScrollPane1.setViewportView(tblMavenRuntimes);
466
467
        jScrollPane2.setViewportView(lstOptions);
468
469
        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.jLabel2.text")); // NOI18N
470
471
        org.openide.awt.Mnemonics.setLocalizedText(btnAddOption, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnAddOption.text")); // NOI18N
472
        btnAddOption.addActionListener(new java.awt.event.ActionListener() {
473
            public void actionPerformed(java.awt.event.ActionEvent evt) {
474
                btnAddOptionActionPerformed(evt);
475
            }
476
        });
477
478
        org.openide.awt.Mnemonics.setLocalizedText(btnRemoveOption, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnRemoveOption.text")); // NOI18N
479
        btnRemoveOption.setEnabled(false);
480
        btnRemoveOption.addActionListener(new java.awt.event.ActionListener() {
481
            public void actionPerformed(java.awt.event.ActionEvent evt) {
482
                btnRemoveOptionActionPerformed(evt);
483
            }
484
        });
485
405
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
486
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
406
        this.setLayout(layout);
487
        this.setLayout(layout);
407
        layout.setHorizontalGroup(
488
        layout.setHorizontalGroup(
408
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
489
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
409
            .add(layout.createSequentialGroup()
490
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
410
                .addContainerGap()
491
                .addContainerGap()
411
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
492
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
493
                    .add(jLabel1)
412
                    .add(layout.createSequentialGroup()
494
                    .add(layout.createSequentialGroup()
413
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
495
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
414
                            .add(lblCommandLine)
496
                            .add(jLabel2)
415
                            .add(lblOptions)
497
                            .add(lblIndex))
416
                            .add(lblLocalRepository))
498
                        .add(10, 10, 10)
499
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
500
                            .add(layout.createSequentialGroup()
501
                                .add(2, 2, 2)
502
                                .add(comIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 425, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
503
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
504
                                .add(btnIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
505
                            .add(cbSnapshots)
506
                            .add(btnGoals, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 57, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
507
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
508
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
509
                            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
510
                                .add(9, 9, 9)
511
                                .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE))
512
                            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
513
                                .add(10, 10, 10)
514
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
515
                                    .add(lblBinaries)
516
                                    .add(lblJavadoc)
517
                                    .add(lblSource))
518
                                .add(36, 36, 36)
519
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
520
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, comSource, 0, 427, Short.MAX_VALUE)
521
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, comJavadoc, 0, 427, Short.MAX_VALUE)
522
                                    .add(comBinaries, 0, 427, Short.MAX_VALUE)))
523
                            .add(layout.createSequentialGroup()
524
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
525
                                    .add(lblMavenRuntimes)
526
                                    .add(lblOptions)
527
                                    .add(lblLocalRepository))
528
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
529
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
530
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)
531
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, cbSkipTests, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)
532
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)
533
                                    .add(txtLocalRepository, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE))))
417
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
534
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
418
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
535
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
419
                            .add(lblEmbeddedVersion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE)
536
                            .add(btnLocalRepository)
420
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
537
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
421
                                .add(txtCommandLine, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
538
                                .add(org.jdesktop.layout.GroupLayout.LEADING, btnRemoveOption, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
422
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
539
                                .add(org.jdesktop.layout.GroupLayout.LEADING, btnAddOption, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
423
                                .add(btnCommandLine))
540
                                .add(org.jdesktop.layout.GroupLayout.LEADING, btnRemoveRuntime, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
424
                            .add(lblExternalVersion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE)
541
                                .add(org.jdesktop.layout.GroupLayout.LEADING, btnEditRuntime, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
425
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
542
                                .add(org.jdesktop.layout.GroupLayout.LEADING, btnAddRuntime, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)))))
426
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
427
                                    .add(comSource, 0, 387, Short.MAX_VALUE)
428
                                    .add(comJavadoc, 0, 387, Short.MAX_VALUE)
429
                                    .add(comBinaries, 0, 387, Short.MAX_VALUE)
430
                                    .add(txtLocalRepository, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
431
                                    .add(txtOptions, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE))
432
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
433
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
434
                                    .add(btnLocalRepository)
435
                                    .add(btnOptions)))
436
                            .add(cbSkipTests)))
437
                    .add(jLabel1)
438
                    .add(layout.createSequentialGroup()
439
                        .add(12, 12, 12)
440
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
441
                            .add(lblJavadoc)
442
                            .add(lblBinaries)
443
                            .add(lblSource)
444
                            .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE))
445
                        .add(106, 106, 106))
446
                    .add(btnGoals)
447
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
448
                        .add(lblIndex)
449
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
450
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
451
                            .add(cbSnapshots)
452
                            .add(comIndex, 0, 391, Short.MAX_VALUE))
453
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
454
                        .add(btnIndex)))
455
                .addContainerGap())
543
                .addContainerGap())
456
        );
544
        );
457
458
        layout.linkSize(new java.awt.Component[] {btnCommandLine, btnIndex, btnLocalRepository, btnOptions}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
459
460
        layout.setVerticalGroup(
545
        layout.setVerticalGroup(
461
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
546
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
462
            .add(layout.createSequentialGroup()
547
            .add(layout.createSequentialGroup()
463
                .add(lblEmbeddedVersion)
548
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
549
                    .add(layout.createSequentialGroup()
550
                        .addContainerGap()
551
                        .add(lblMavenRuntimes))
552
                    .add(layout.createSequentialGroup()
553
                        .add(6, 6, 6)
554
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
555
                            .add(layout.createSequentialGroup()
556
                                .add(btnAddRuntime)
557
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
558
                                .add(btnEditRuntime)
559
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
560
                                .add(btnRemoveRuntime))
561
                            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 141, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
464
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
562
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
465
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
563
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
466
                    .add(lblCommandLine)
564
                    .add(lblOptions)
467
                    .add(txtCommandLine, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
565
                    .add(layout.createSequentialGroup()
468
                    .add(btnCommandLine))
566
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
567
                            .add(layout.createSequentialGroup()
568
                                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
569
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
570
                                .add(cbSkipTests))
571
                            .add(layout.createSequentialGroup()
572
                                .add(btnAddOption)
573
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
574
                                .add(btnRemoveOption)))
575
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
576
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
577
                            .add(txtLocalRepository, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
578
                            .add(lblLocalRepository)
579
                            .add(btnLocalRepository))))
469
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
580
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
470
                .add(lblExternalVersion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
471
                .add(18, 18, 18)
472
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
473
                    .add(lblOptions)
474
                    .add(txtOptions, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
475
                    .add(btnOptions))
476
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
477
                .add(cbSkipTests)
478
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
479
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
480
                    .add(txtLocalRepository, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
481
                    .add(btnLocalRepository)
482
                    .add(lblLocalRepository))
483
                .add(16, 16, 16)
484
                .add(jLabel1)
581
                .add(jLabel1)
485
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
582
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
486
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
583
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
487
                    .add(lblBinaries)
584
                    .add(lblBinaries)
488
                    .add(comBinaries, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
585
                    .add(comBinaries, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
489
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
586
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
490
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
587
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
491
                    .add(lblJavadoc)
588
                    .add(lblJavadoc)
492
                    .add(comJavadoc, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
589
                    .add(comJavadoc, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
590
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
591
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
592
                    .add(comSource, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
593
                    .add(lblSource))
594
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
595
                .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
493
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
596
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
494
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
597
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
495
                    .add(lblSource)
598
                    .add(btnGoals)
496
                    .add(comSource, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
599
                    .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
497
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
600
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
498
                .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 44, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
499
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
500
                .add(btnGoals)
501
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
502
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
601
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
503
                    .add(btnIndex)
504
                    .add(lblIndex)
602
                    .add(lblIndex)
505
                    .add(comIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
603
                    .add(comIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
604
                    .add(btnIndex))
506
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
605
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
507
                .add(cbSnapshots)
606
                .add(cbSnapshots)
508
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
607
                .addContainerGap())
509
        );
608
        );
510
    }// </editor-fold>//GEN-END:initComponents
609
    }// </editor-fold>//GEN-END:initComponents
511
610
Lines 533-539 Link Here
533
        chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select"));
632
        chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select"));
534
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
633
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
535
        chooser.setFileHidingEnabled(false);
634
        chooser.setFileHidingEnabled(false);
536
        String path = ((MyJTextField)txtLocalRepository).getRealText();
635
        String path = ((JHintTextField)txtLocalRepository).getRealText();
537
        if (path.trim().length() == 0) {
636
        if (path.trim().length() == 0) {
538
            path = new File(System.getProperty("user.home"), ".m2").getAbsolutePath(); //NOI18N
637
            path = new File(System.getProperty("user.home"), ".m2").getAbsolutePath(); //NOI18N
539
        }
638
        }
Lines 545-576 Link Here
545
        }
644
        }
546
        if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
645
        if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
547
            File projectDir = chooser.getSelectedFile();
646
            File projectDir = chooser.getSelectedFile();
548
            ((MyJTextField)txtLocalRepository).setRealText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
647
            ((JHintTextField)txtLocalRepository).setRealText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
549
        }
648
        }
550
    }//GEN-LAST:event_btnLocalRepositoryActionPerformed
649
    }//GEN-LAST:event_btnLocalRepositoryActionPerformed
551
650
552
    private void btnCommandLineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCommandLineActionPerformed
651
    private void btnRemoveRuntimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveRuntimeActionPerformed
553
        JFileChooser chooser = new JFileChooser();
652
		int selected = tblMavenRuntimes.getSelectedRow();
554
        FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
653
		if (selected != -1 && selected < mavenRuntimes.size()) {
555
        chooser.setDialogTitle(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "TIT_Select2"));
654
			mavenRuntimes.remove(selected);
556
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
655
			tableModel.fireTableDataChanged();
557
        chooser.setFileHidingEnabled(false);
656
		}
558
        String path = txtCommandLine.getText();
657
    }//GEN-LAST:event_btnRemoveRuntimeActionPerformed
559
        if (path.trim().length() == 0) {
560
            path = new File(System.getProperty("user.home")).getAbsolutePath(); //NOI18N
561
        }
562
        if (path.length() > 0) {
563
            File f = new File(path);
564
            if (f.exists()) {
565
                chooser.setSelectedFile(f);
566
            }
567
        }
568
        if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
569
            File projectDir = chooser.getSelectedFile();
570
            txtCommandLine.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
571
        }
572
        
573
    }//GEN-LAST:event_btnCommandLineActionPerformed
574
658
575
    private void btnGoalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGoalsActionPerformed
659
    private void btnGoalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGoalsActionPerformed
576
        NbGlobalActionGoalProvider provider = null;
660
        NbGlobalActionGoalProvider provider = null;
Lines 597-622 Link Here
597
        }
681
        }
598
    }//GEN-LAST:event_btnGoalsActionPerformed
682
    }//GEN-LAST:event_btnGoalsActionPerformed
599
683
600
    private void btnOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOptionsActionPerformed
684
	private boolean tryEditMavenRuntime(String path, MavenRuntime mavenRuntime) {
685
		if (path == null ||  path.length() == 0) {
686
			path = new File(System.getProperty("user.home")).getAbsolutePath(); //NOI18N
687
		}
688
		JFileChooser chooser = new JFileChooser();
689
		FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
690
		chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select2"));
691
		chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
692
		chooser.setFileHidingEnabled(false);
693
		if (path.length() > 0) {
694
			File f = new File(path);
695
			if (f.exists()) {
696
				chooser.setSelectedFile(f);
697
			}
698
		}
699
		if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
700
			File projectDir = chooser.getSelectedFile();
701
			path = FileUtil.normalizeFile(projectDir).getAbsolutePath();
702
			String version = MavenUtil.getExternalVersion(path);
703
			if (version == null) {
704
				JOptionPane.showMessageDialog(this,
705
						NbBundle.getMessage(SettingsPanel.class, "MAVEN_RUNTIME_Error_DuplicatedRuntime_Message", new Object[]{path}),
706
						NbBundle.getMessage(SettingsPanel.class, "MAVEN_RUNTIME_ErrorCaption"),
707
						JOptionPane.ERROR_MESSAGE);
708
				return false;
709
			}
710
711
			for (MavenRuntime runtime : mavenRuntimes) {
712
				if (runtime.isExternal() && runtime.getPath().equals(path)) {
713
					JOptionPane.showMessageDialog(this,
714
						NbBundle.getMessage(SettingsPanel.class, "MAVEN_RUNTIME_Error_AlreadyRegistered_Message", new Object[]{path}),
715
						NbBundle.getMessage(SettingsPanel.class, "MAVEN_RUNTIME_ErrorCaption"),
716
						JOptionPane.ERROR_MESSAGE);
717
					return false;
718
				}
719
			}
720
721
			mavenRuntime.setPath(path);
722
			mavenRuntime.setVersion(version);
723
			return true;
724
		}
725
726
		return false;
727
	}
728
729
	private void btnAddRuntimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddRuntimeActionPerformed
730
		int selected = tblMavenRuntimes.getSelectedRow();
731
		String path = null;
732
		if (selected != -1) {
733
			path = mavenRuntimes.get(selected).getPath();
734
		}
735
736
		MavenRuntime newRuntime = new MavenRuntime("", "");
737
		if (tryEditMavenRuntime(path, newRuntime)) {
738
			mavenRuntimes.add(newRuntime);
739
			tableModel.fireTableDataChanged();
740
		}
741
	}//GEN-LAST:event_btnAddRuntimeActionPerformed
742
743
	private void btnEditRuntimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditRuntimeActionPerformed
744
		int selected = tblMavenRuntimes.getSelectedRow();
745
		if (selected == -1) {
746
			return;
747
		}
748
749
		MavenRuntime runtime = mavenRuntimes.get(selected);
750
		if (tryEditMavenRuntime(runtime.getPath(), runtime)) {
751
			tableModel.fireTableDataChanged();
752
		}
753
754
	}//GEN-LAST:event_btnEditRuntimeActionPerformed
755
756
	private void btnAddOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddOptionActionPerformed
601
        GlobalOptionsPanel pnl = new GlobalOptionsPanel();
757
        GlobalOptionsPanel pnl = new GlobalOptionsPanel();
602
        DialogDescriptor dd = new DialogDescriptor(pnl, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "TIT_Add_Globals"));
758
        DialogDescriptor dd = new DialogDescriptor(pnl, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "TIT_Add_Globals"));
603
        Object ret = DialogDisplayer.getDefault().notify(dd);
759
        Object ret = DialogDisplayer.getDefault().notify(dd);
604
        if (ret == DialogDescriptor.OK_OPTION) {
760
        if (ret == DialogDescriptor.OK_OPTION) {
605
            txtOptions.setText(txtOptions.getText() + pnl.getSelectedOnes());
761
			String[] newOptions = pnl.getSelectedOnes();
762
			int size = optionsModel.getSize();
763
			for (String option : newOptions) {
764
				if (optionsModel.contains(option)) {
765
					continue;
766
				}
767
768
	            optionsModel.addElement(option);
769
			}
770
			if (lstOptions.getSelectedIndex() == -1 && size != optionsModel.getSize()) {
771
				lstOptions.setSelectedIndex(optionsModel.getSize() - 1);
772
			}
606
        }
773
        }
774
	}//GEN-LAST:event_btnAddOptionActionPerformed
607
775
608
    }//GEN-LAST:event_btnOptionsActionPerformed
776
	private void btnRemoveOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveOptionActionPerformed
777
		int[] selectedIndices = lstOptions.getSelectedIndices();
778
		for (int i = selectedIndices.length - 1; i >= 0; --i) {
779
			optionsModel.remove(selectedIndices[i]);
780
		}
781
		int newSelected = selectedIndices.length > 0 && selectedIndices[0] < optionsModel.getSize() ?
782
			selectedIndices[0] : optionsModel.getSize() - 1;
783
		lstOptions.setSelectedIndex(newSelected);
784
	}//GEN-LAST:event_btnRemoveOptionActionPerformed
609
    
785
    
610
    
786
    
611
    // Variables declaration - do not modify//GEN-BEGIN:variables
787
    // Variables declaration - do not modify//GEN-BEGIN:variables
612
    private javax.swing.ButtonGroup bgChecksums;
788
    private javax.swing.ButtonGroup bgChecksums;
613
    private javax.swing.ButtonGroup bgFailure;
789
    private javax.swing.ButtonGroup bgFailure;
614
    private javax.swing.ButtonGroup bgPlugins;
790
    private javax.swing.ButtonGroup bgPlugins;
615
    private javax.swing.JButton btnCommandLine;
791
    private javax.swing.JButton btnAddOption;
792
    private javax.swing.JButton btnAddRuntime;
793
    private javax.swing.JButton btnEditRuntime;
616
    private javax.swing.JButton btnGoals;
794
    private javax.swing.JButton btnGoals;
617
    private javax.swing.JButton btnIndex;
795
    private javax.swing.JButton btnIndex;
618
    private javax.swing.JButton btnLocalRepository;
796
    private javax.swing.JButton btnLocalRepository;
619
    private javax.swing.JButton btnOptions;
797
    private javax.swing.JButton btnRemoveOption;
798
    private javax.swing.JButton btnRemoveRuntime;
620
    private javax.swing.JCheckBox cbSkipTests;
799
    private javax.swing.JCheckBox cbSkipTests;
621
    private javax.swing.JCheckBox cbSnapshots;
800
    private javax.swing.JCheckBox cbSnapshots;
622
    private javax.swing.JComboBox comBinaries;
801
    private javax.swing.JComboBox comBinaries;
Lines 624-656 Link Here
624
    private javax.swing.JComboBox comJavadoc;
803
    private javax.swing.JComboBox comJavadoc;
625
    private javax.swing.JComboBox comSource;
804
    private javax.swing.JComboBox comSource;
626
    private javax.swing.JLabel jLabel1;
805
    private javax.swing.JLabel jLabel1;
806
    private javax.swing.JLabel jLabel2;
627
    private javax.swing.JLabel jLabel3;
807
    private javax.swing.JLabel jLabel3;
808
    private javax.swing.JScrollPane jScrollPane1;
809
    private javax.swing.JScrollPane jScrollPane2;
628
    private javax.swing.JLabel lblBinaries;
810
    private javax.swing.JLabel lblBinaries;
629
    private javax.swing.JLabel lblCommandLine;
630
    private javax.swing.JLabel lblEmbeddedVersion;
631
    private javax.swing.JLabel lblExternalVersion;
632
    private javax.swing.JLabel lblIndex;
811
    private javax.swing.JLabel lblIndex;
633
    private javax.swing.JLabel lblJavadoc;
812
    private javax.swing.JLabel lblJavadoc;
634
    private javax.swing.JLabel lblLocalRepository;
813
    private javax.swing.JLabel lblLocalRepository;
814
    private javax.swing.JLabel lblMavenRuntimes;
635
    private javax.swing.JLabel lblOptions;
815
    private javax.swing.JLabel lblOptions;
636
    private javax.swing.JLabel lblSource;
816
    private javax.swing.JLabel lblSource;
637
    private javax.swing.JTextField txtCommandLine;
817
    private javax.swing.JList lstOptions;
818
    private javax.swing.JTable tblMavenRuntimes;
638
    private javax.swing.JTextField txtLocalRepository;
819
    private javax.swing.JTextField txtLocalRepository;
639
    private javax.swing.JTextField txtOptions;
640
    // End of variables declaration//GEN-END:variables
820
    // End of variables declaration//GEN-END:variables
641
    
821
    
642
    public void setValues() {
822
    public void setValues() {
643
        txtOptions.setText(MavenSettings.getDefault().getDefaultOptions());
823
		String defaultOptions = MavenSettings.getDefault().getDefaultOptions();
644
        txtCommandLine.getDocument().removeDocumentListener(docList);
824
		optionsModel.clear();
645
        File command = MavenSettings.getDefault().getCommandLinePath();
825
		if (!"".equals(defaultOptions.trim())) { // NOI18N
646
        txtCommandLine.setText(command != null ? command.getAbsolutePath() : ""); //NOI18N
826
			String[] optionArr = MavenSettings.getDefault().getDefaultOptions().split(" "); // NOI18N
647
        initExternalVersion();
827
			for (String option : optionArr) {
648
        txtCommandLine.getDocument().addDocumentListener(docList);
828
				optionsModel.addElement(option);
649
        
829
			}
830
		}
831
		lstOptions.setSelectedIndex(-1);
832
833
		mavenRuntimes.clear();
834
		MavenRuntime[] runtimes = MavenSettings.getDefault().getMavenRuntimes();
835
		mavenRuntimes.addAll(Arrays.asList(runtimes));
836
		tableModel.fireTableDataChanged();
837
838
		commandLinePath = MavenSettings.getDefault().getCommandLinePath();
650
        cbSnapshots.setSelected(RepositoryPreferences.getInstance().isIncludeSnapshots());
839
        cbSnapshots.setSelected(RepositoryPreferences.getInstance().isIncludeSnapshots());
651
        comIndex.setSelectedIndex(RepositoryPreferences.getInstance().getIndexUpdateFrequency());
840
        comIndex.setSelectedIndex(RepositoryPreferences.getInstance().getIndexUpdateFrequency());
652
        String repo = MavenSettings.getDefault().getCustomLocalRepository();
841
        String repo = MavenSettings.getDefault().getCustomLocalRepository();
653
        ((MyJTextField)txtLocalRepository).setRealText(repo != null ? repo : "");
842
        ((JHintTextField)txtLocalRepository).setRealText(repo != null ? repo : "");
654
        comBinaries.setSelectedItem(MavenSettings.getDefault().getBinaryDownloadStrategy());
843
        comBinaries.setSelectedItem(MavenSettings.getDefault().getBinaryDownloadStrategy());
655
        comJavadoc.setSelectedItem(MavenSettings.getDefault().getJavadocDownloadStrategy());
844
        comJavadoc.setSelectedItem(MavenSettings.getDefault().getJavadocDownloadStrategy());
656
        comSource.setSelectedItem(MavenSettings.getDefault().getSourceDownloadStrategy());
845
        comSource.setSelectedItem(MavenSettings.getDefault().getSourceDownloadStrategy());
Lines 660-675 Link Here
660
    }
849
    }
661
    
850
    
662
    public void applyValues() {
851
    public void applyValues() {
663
        MavenSettings.getDefault().setDefaultOptions(txtOptions.getText().trim());
852
		String options = "";
664
        MavenSettings.getDefault().setCustomLocalRepository(((MyJTextField)txtLocalRepository).getRealText());
853
		Enumeration optEnum = optionsModel.elements();
665
        String cl = txtCommandLine.getText().trim();
854
		while(optEnum.hasMoreElements()) {
666
        if (cl.length() == 0) {
855
			options += optEnum.nextElement() + " ";
667
            cl = null;
856
		}
668
        }
857
858
        MavenSettings.getDefault().setDefaultOptions(options.trim());
859
        MavenSettings.getDefault().setCustomLocalRepository(((JHintTextField)txtLocalRepository).getRealText());
860
		MavenSettings.getDefault().setMavenRuntimes(mavenRuntimes.toArray(new MavenRuntime[0]));
669
        //MEVENIDE-553
861
        //MEVENIDE-553
670
        File command = cl != null ? new File(cl) : null;
862
        if (commandLinePath != null && commandLinePath.exists()) {
671
        if (command != null && command.exists()) {
863
            MavenSettings.getDefault().setCommandLinePath(commandLinePath);
672
            MavenSettings.getDefault().setCommandLinePath(command);
673
        } else {
864
        } else {
674
            MavenSettings.getDefault().setCommandLinePath(null);
865
            MavenSettings.getDefault().setCommandLinePath(null);
675
        }
866
        }

Return to bug 183455