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/api/customizer/support/CheckBoxUpdater.java (-2 / +2 lines)
Lines 71-77 Link Here
71
            inherited = false;
71
            inherited = false;
72
            component.setFont(component.getFont().deriveFont(Font.BOLD));
72
            component.setFont(component.getFont().deriveFont(Font.BOLD));
73
73
74
            component.setToolTipText(""); //NOI18N
74
            component.setToolTipText(null);
75
        } else {
75
        } else {
76
            component.setToolTipText(NbBundle.getMessage(CheckBoxUpdater.class, "MSG_Value_Inherited")); //NOI18N
76
            component.setToolTipText(NbBundle.getMessage(CheckBoxUpdater.class, "MSG_Value_Inherited")); //NOI18N
77
            inherited = true;
77
            inherited = true;
Lines 100-106 Link Here
100
    private void setCheckBoxValue(Boolean value, boolean defValue, JCheckBox component) {
100
    private void setCheckBoxValue(Boolean value, boolean defValue, JCheckBox component) {
101
        if (value != null) {
101
        if (value != null) {
102
            component.setSelected(value.booleanValue());
102
            component.setSelected(value.booleanValue());
103
            component.setToolTipText(""); //NOI18N
103
            component.setToolTipText(null);
104
            inherited = false;
104
            inherited = false;
105
            component.setFont(component.getFont().deriveFont(Font.BOLD));
105
            component.setFont(component.getFont().deriveFont(Font.BOLD));
106
        } else {
106
        } else {
(-)a/maven/src/org/netbeans/modules/maven/api/execute/Bundle.properties (-3 / +3 lines)
Lines 34-39 Link Here
34
# Contributor(s):
34
# Contributor(s):
35
#
35
#
36
# Portions Copyrighted 2009 Sun Microsystems, Inc.
36
# Portions Copyrighted 2009 Sun Microsystems, Inc.
37
HINT_EmbeddedBuild=<html><b>No Apache Maven installation was found on your computer.</b> <p> As a fallback, an embedded instance will be used for building. \
37
HINT_EmbeddedBuild=<html><b>You're using an embedded Maven runtime for building.</b>\
38
However, the embedded version is not a stable release and errors and incompatibilities in the build execution are to be expected. <p><b>Please specify a Maven location in the Options window. </b>
38
<p>However, the embedded version is not a stable release and errors and incompatibilities in the build execution are to be expected.<p>\
39
39
<b>Please specify an external Maven runtime in the Options window.</b>
(-)a/maven/src/org/netbeans/modules/maven/api/execute/RunUtils.java (-1 / +1 lines)
Lines 84-90 Link Here
84
            }
84
            }
85
        }
85
        }
86
        
86
        
87
        if (!useEmbedded && MavenSettings.canFindExternalMaven()) {
87
        if (!useEmbedded && MavenSettings.getDefault().isUsingExternalRuntime()) {
88
            exec = new MavenCommandLineExecutor(config);
88
            exec = new MavenCommandLineExecutor(config);
89
        } else {
89
        } else {
90
            if (!warningShown && DontShowAgainSettings.getDefault().showWarningAboutEmbeddedBuild()) {
90
            if (!warningShown && DontShowAgainSettings.getDefault().showWarningAboutEmbeddedBuild()) {
(-)a/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.form (-9 / +9 lines)
Lines 1-4 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
4
  <AuxValues>
Lines 20-27 Link Here
20
              <Group type="103" groupAlignment="0" attributes="0">
20
              <Group type="103" groupAlignment="0" attributes="0">
21
                  <Group type="102" alignment="0" attributes="0">
21
                  <Group type="102" alignment="0" attributes="0">
22
                      <Component id="cbCommandLine" min="-2" max="-2" attributes="0"/>
22
                      <Component id="cbCommandLine" min="-2" max="-2" attributes="0"/>
23
                      <EmptySpace pref="53" max="32767" attributes="0"/>
23
                      <EmptySpace pref="172" max="32767" attributes="0"/>
24
                      <Component id="btnSetup" min="-2" pref="229" max="-2" attributes="0"/>
24
                      <Component id="btnSetup" min="-2" max="-2" attributes="0"/>
25
                  </Group>
25
                  </Group>
26
                  <Component id="jScrollPane2" alignment="0" pref="560" max="32767" attributes="0"/>
26
                  <Component id="jScrollPane2" alignment="0" pref="560" max="32767" attributes="0"/>
27
                  <Group type="102" alignment="0" attributes="0">
27
                  <Group type="102" alignment="0" attributes="0">
Lines 36-45 Link Here
36
                      </Group>
36
                      </Group>
37
                      <EmptySpace max="-2" attributes="0"/>
37
                      <EmptySpace max="-2" attributes="0"/>
38
                      <Group type="103" groupAlignment="0" attributes="0">
38
                      <Group type="103" groupAlignment="0" attributes="0">
39
                          <Component id="txtProfiles" pref="440" max="32767" attributes="2"/>
39
                          <Component id="txtProfiles" pref="442" max="32767" attributes="2"/>
40
                          <Component id="txtGoals" alignment="0" pref="440" max="32767" attributes="2"/>
40
                          <Component id="txtGoals" alignment="0" pref="442" max="32767" attributes="2"/>
41
                          <Group type="102" alignment="1" attributes="0">
41
                          <Group type="102" alignment="1" attributes="0">
42
                              <Component id="jScrollPane1" pref="297" max="32767" attributes="1"/>
42
                              <Component id="jScrollPane1" pref="325" max="32767" attributes="1"/>
43
                              <EmptySpace max="-2" attributes="0"/>
43
                              <EmptySpace max="-2" attributes="0"/>
44
                              <Group type="103" groupAlignment="0" attributes="0">
44
                              <Group type="103" groupAlignment="0" attributes="0">
45
                                  <Component id="btnRemove" linkSize="1" min="-2" max="-2" attributes="0"/>
45
                                  <Component id="btnRemove" linkSize="1" min="-2" max="-2" attributes="0"/>
Lines 51-63 Link Here
51
                              <EmptySpace type="separate" max="-2" attributes="0"/>
51
                              <EmptySpace type="separate" max="-2" attributes="0"/>
52
                              <Component id="cbBuildWithDeps" min="-2" max="-2" attributes="0"/>
52
                              <Component id="cbBuildWithDeps" min="-2" max="-2" attributes="0"/>
53
                          </Group>
53
                          </Group>
54
                          <Component id="jScrollPane3" alignment="0" pref="440" max="32767" attributes="0"/>
54
                          <Component id="jScrollPane3" alignment="0" pref="442" max="32767" attributes="0"/>
55
                          <Group type="102" alignment="1" attributes="0">
55
                          <Group type="102" alignment="1" attributes="0">
56
                              <Component id="comConfiguration" pref="297" max="32767" attributes="0"/>
56
                              <Component id="comConfiguration" pref="299" max="32767" attributes="0"/>
57
                              <EmptySpace min="-2" pref="143" max="-2" attributes="0"/>
57
                              <EmptySpace min="-2" pref="143" max="-2" attributes="0"/>
58
                          </Group>
58
                          </Group>
59
                          <Group type="102" alignment="1" attributes="0">
59
                          <Group type="102" alignment="1" attributes="0">
60
                              <Component id="txtDirectory" pref="211" max="32767" attributes="0"/>
60
                              <Component id="txtDirectory" pref="229" max="32767" attributes="0"/>
61
                              <EmptySpace max="-2" attributes="0"/>
61
                              <EmptySpace max="-2" attributes="0"/>
62
                              <Component id="btnDirectory" min="-2" max="-2" attributes="0"/>
62
                              <Component id="btnDirectory" min="-2" max="-2" attributes="0"/>
63
                          </Group>
63
                          </Group>
(-)a/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.java (-15 / +19 lines)
Lines 232-257 Link Here
232
                org.netbeans.modules.maven.model.profile.Profile prof = handle.getNetbeansPrivateProfile(false);
232
                org.netbeans.modules.maven.model.profile.Profile prof = handle.getNetbeansPrivateProfile(false);
233
                if (prof != null) {
233
                if (prof != null) {
234
                    org.netbeans.modules.maven.model.profile.Properties profprops = prof.getProperties();
234
                    org.netbeans.modules.maven.model.profile.Properties profprops = prof.getProperties();
235
                    if (profprops != null && profprops.getProperty(Constants.HINT_USE_EXTERNAL) != null) {
235
                    if (profprops != null && profprops.getProperty(Constants.HINT_USE_EXTERNAL) != null && !Boolean.valueOf(prof.getProperties().getProperty(Constants.HINT_USE_EXTERNAL))) {
236
                        return Boolean.valueOf(prof.getProperties().getProperty(Constants.HINT_USE_EXTERNAL));
236
                        return !Boolean.valueOf(prof.getProperties().getProperty(Constants.HINT_USE_EXTERNAL));
237
                    }
237
                    }
238
                }
238
                }
239
                org.netbeans.modules.maven.model.pom.Properties mdlprops = handle.getPOMModel().getProject().getProperties();
239
                org.netbeans.modules.maven.model.pom.Properties mdlprops = handle.getPOMModel().getProject().getProperties();
240
                String val;
240
                String val;
241
                if (mdlprops != null) {
241
                if (mdlprops != null) {
242
                    val = mdlprops.getProperty(Constants.HINT_USE_EXTERNAL);
242
                    val = mdlprops.getProperty(Constants.HINT_USE_EXTERNAL);
243
                    if (val != null) {
243
                    if (val != null && !Boolean.valueOf(val)) {
244
                        return Boolean.valueOf(val);
244
                        return !Boolean.valueOf(val);
245
                    }
245
                    }
246
                }
246
                }
247
                val = handle.getRawAuxiliaryProperty(Constants.HINT_USE_EXTERNAL, true);
247
                val = handle.getRawAuxiliaryProperty(Constants.HINT_USE_EXTERNAL, true);
248
                if (val != null) {
248
                if (val != null && !Boolean.valueOf(val)) {
249
                    return Boolean.valueOf(val);
249
                    return !Boolean.valueOf(val);
250
                }
250
                }
251
                return null;
251
                return null;
252
            }
252
            }
253
253
254
            public void setValue(Boolean value) {
254
            public void setValue(Boolean value) {
255
				// The meaning of this option is opposite to the configuration
256
				// Constants.HINT_USE_EXTERNAL
257
				value = (value == null) ? null : !value.booleanValue();
255
                boolean hasConfig = handle.getRawAuxiliaryProperty(Constants.HINT_USE_EXTERNAL, true) != null;
258
                boolean hasConfig = handle.getRawAuxiliaryProperty(Constants.HINT_USE_EXTERNAL, true) != null;
256
                //TODO also try to take the value in pom vs inherited pom value into account.
259
                //TODO also try to take the value in pom vs inherited pom value into account.
257
260
Lines 287-293 Link Here
287
            }
290
            }
288
291
289
            public boolean getDefaultValue() {
292
            public boolean getDefaultValue() {
290
                return true;
293
				// false means DON'T Force to use an embedded Maven runtime.
294
                return false;
291
            }
295
            }
292
        };
296
        };
293
        clearFields();
297
        clearFields();
Lines 475-482 Link Here
475
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
479
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
476
                    .addGroup(layout.createSequentialGroup()
480
                    .addGroup(layout.createSequentialGroup()
477
                        .addComponent(cbCommandLine)
481
                        .addComponent(cbCommandLine)
478
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53, Short.MAX_VALUE)
482
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 172, Short.MAX_VALUE)
479
                        .addComponent(btnSetup, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE))
483
                        .addComponent(btnSetup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
480
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
484
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
481
                    .addGroup(layout.createSequentialGroup()
485
                    .addGroup(layout.createSequentialGroup()
482
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
486
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Lines 489-498 Link Here
489
                            .addComponent(lblDirectory))
493
                            .addComponent(lblDirectory))
490
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
494
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
491
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
495
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
492
                            .addComponent(txtProfiles, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
496
                            .addComponent(txtProfiles, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
493
                            .addComponent(txtGoals, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
497
                            .addComponent(txtGoals, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
494
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
498
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
495
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
499
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)
496
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
500
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
497
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
501
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
498
                                    .addComponent(btnRemove)
502
                                    .addComponent(btnRemove)
Lines 501-512 Link Here
501
                                .addComponent(cbRecursively)
505
                                .addComponent(cbRecursively)
502
                                .addGap(18, 18, 18)
506
                                .addGap(18, 18, 18)
503
                                .addComponent(cbBuildWithDeps))
507
                                .addComponent(cbBuildWithDeps))
504
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
508
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
505
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
509
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
506
                                .addComponent(comConfiguration, 0, 297, Short.MAX_VALUE)
510
                                .addComponent(comConfiguration, 0, 299, Short.MAX_VALUE)
507
                                .addGap(143, 143, 143))
511
                                .addGap(143, 143, 143))
508
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
512
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
509
                                .addComponent(txtDirectory, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE)
513
                                .addComponent(txtDirectory, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE)
510
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
514
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
511
                                .addComponent(btnDirectory)))))
515
                                .addComponent(btnDirectory)))))
512
                .addContainerGap())
516
                .addContainerGap())
(-)a/maven/src/org/netbeans/modules/maven/customizer/Bundle.properties (-4 / +4 lines)
Lines 108-116 Link Here
108
TIT_Add_action=Action Name\:
108
TIT_Add_action=Action Name\:
109
LBL_AddAction=Enter action name
109
LBL_AddAction=Enter action name
110
LBL_Actions=Ac&tions:
110
LBL_Actions=Ac&tions:
111
LBL_UseExternal=&Use external Maven for build execution
111
LBL_UseExternal=Force to &use embedded Maven runtime
112
TLT_UseExternal=If selected, will build with external version of Maven. Otherwise builds with embedded Maven.
112
TLT_UseExternal=If selected, will build with external version of Maven. Otherwise builds with embedded Maven.
113
LBL_SetupExternal=<html><a href="">Setup external Maven &home</a></html>
113
LBL_SetupExternal=<html><a href="">Setup Maven &Runtimes</a></html>
114
ActionMappings.lblConfiguration.text=Confi&guration:
114
ActionMappings.lblConfiguration.text=Confi&guration:
115
TIT_Project_Properties=Project Properties - {0}
115
TIT_Project_Properties=Project Properties - {0}
116
ActionMappings.btnAddProps.text=A&dd >
116
ActionMappings.btnAddProps.text=A&dd >
Lines 132-140 Link Here
132
CompilePanel.cbDeprecate.text=Report Uses of &Deprecated APIs
132
CompilePanel.cbDeprecate.text=Report Uses of &Deprecated APIs
133
CompilePanel.lblJavaPlatform.text=Java &Platform:
133
CompilePanel.lblJavaPlatform.text=Java &Platform:
134
CompilePanel.btnMngPlatform.text=&Manage Java Platforms...
134
CompilePanel.btnMngPlatform.text=&Manage Java Platforms...
135
CompilePanel.lblWarnPlatform.text=<html>Warning: Setting Java Platform is not possible with the embedded Maven which is currently in use. To set the Java Platform you must use an external Maven installation.
135
CompilePanel.lblWarnPlatform.text=<html>Warning: Setting Java Platform is not possible with the embedded Maven which is currently in use. To set the Java Platform you must use an external Maven runtime.
136
AddPropertyDialog.lblPropertyExpressions.text=Property Expressions :
136
AddPropertyDialog.lblPropertyExpressions.text=Property Expressions :
137
CompilePanel.btnSetupHome.text=Set up &external Maven home
137
CompilePanel.btnSetupHome.text=Setup Mav&en Runtimes
138
AN_SourceLevel=Source level combo box
138
AN_SourceLevel=Source level combo box
139
SourcesPanel.lblSrc.text=&Source Folder:
139
SourcesPanel.lblSrc.text=&Source Folder:
140
SourcesPanel.lblTestSrc.text=&Test Source Folder:
140
SourcesPanel.lblTestSrc.text=&Test Source Folder:
(-)a/maven/src/org/netbeans/modules/maven/customizer/CompilePanel.form (-5 / +5 lines)
Lines 1-4 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <Properties>
4
  <Properties>
Lines 34-47 Link Here
34
                      </Group>
34
                      </Group>
35
                      <EmptySpace min="-2" max="-2" attributes="0"/>
35
                      <EmptySpace min="-2" max="-2" attributes="0"/>
36
                      <Group type="103" groupAlignment="0" attributes="0">
36
                      <Group type="103" groupAlignment="0" attributes="0">
37
                          <Component id="comJavaPlatform" pref="302" max="32767" attributes="2"/>
37
                          <Component id="comJavaPlatform" pref="273" max="32767" attributes="2"/>
38
                          <Component id="comCompileOnSave" alignment="0" pref="302" max="32767" attributes="2"/>
38
                          <Component id="comCompileOnSave" alignment="0" pref="273" max="32767" attributes="2"/>
39
                      </Group>
39
                      </Group>
40
                      <EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
40
                      <EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
41
                      <Component id="btnMngPlatform" min="-2" max="-2" attributes="0"/>
41
                      <Component id="btnMngPlatform" min="-2" max="-2" attributes="0"/>
42
                  </Group>
42
                  </Group>
43
                  <Group type="102" alignment="1" attributes="0">
43
                  <Group type="102" alignment="1" attributes="0">
44
                      <Component id="lblWarnPlatform" pref="389" max="32767" attributes="0"/>
44
                      <Component id="lblWarnPlatform" pref="409" max="32767" attributes="0"/>
45
                      <EmptySpace max="-2" attributes="0"/>
45
                      <EmptySpace max="-2" attributes="0"/>
46
                      <Component id="btnSetupHome" min="-2" max="-2" attributes="0"/>
46
                      <Component id="btnSetupHome" min="-2" max="-2" attributes="0"/>
47
                  </Group>
47
                  </Group>
Lines 71-77 Link Here
71
              <Component id="cbDebug" min="-2" max="-2" attributes="0"/>
71
              <Component id="cbDebug" min="-2" max="-2" attributes="0"/>
72
              <EmptySpace max="-2" attributes="0"/>
72
              <EmptySpace max="-2" attributes="0"/>
73
              <Component id="cbDeprecate" min="-2" max="-2" attributes="0"/>
73
              <Component id="cbDeprecate" min="-2" max="-2" attributes="0"/>
74
              <EmptySpace pref="109" max="32767" attributes="0"/>
74
              <EmptySpace pref="114" max="32767" attributes="0"/>
75
              <Group type="103" groupAlignment="0" attributes="0">
75
              <Group type="103" groupAlignment="0" attributes="0">
76
                  <Component id="btnSetupHome" min="-2" max="-2" attributes="0"/>
76
                  <Component id="btnSetupHome" min="-2" max="-2" attributes="0"/>
77
                  <Component id="lblWarnPlatform" min="-2" max="-2" attributes="0"/>
77
                  <Component id="lblWarnPlatform" min="-2" max="-2" attributes="0"/>
(-)a/maven/src/org/netbeans/modules/maven/customizer/CompilePanel.java (-6 / +6 lines)
Lines 380-386 Link Here
380
        String val = props.get(Constants.HINT_USE_EXTERNAL, true);
380
        String val = props.get(Constants.HINT_USE_EXTERNAL, true);
381
        boolean useEmbedded = "false".equalsIgnoreCase(val);
381
        boolean useEmbedded = "false".equalsIgnoreCase(val);
382
382
383
        return !useEmbedded && MavenSettings.canFindExternalMaven();
383
        return !useEmbedded && MavenSettings.getDefault().isUsingExternalRuntime();
384
    }
384
    }
385
385
386
    private void checkExternalMaven () {
386
    private void checkExternalMaven () {
Lines 464-475 Link Here
464
                            .add(lblJavaPlatform))
464
                            .add(lblJavaPlatform))
465
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
465
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
466
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
466
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
467
                            .add(comJavaPlatform, 0, 302, Short.MAX_VALUE)
467
                            .add(comJavaPlatform, 0, 273, Short.MAX_VALUE)
468
                            .add(comCompileOnSave, 0, 302, Short.MAX_VALUE))
468
                            .add(comCompileOnSave, 0, 273, Short.MAX_VALUE))
469
                        .add(16, 16, 16)
469
                        .add(16, 16, 16)
470
                        .add(btnMngPlatform))
470
                        .add(btnMngPlatform))
471
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
471
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
472
                        .add(lblWarnPlatform, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 389, Short.MAX_VALUE)
472
                        .add(lblWarnPlatform, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE)
473
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
473
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
474
                        .add(btnSetupHome)))
474
                        .add(btnSetupHome)))
475
                .addContainerGap())
475
                .addContainerGap())
Lines 493-502 Link Here
493
                .add(cbDebug)
493
                .add(cbDebug)
494
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
494
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
495
                .add(cbDeprecate)
495
                .add(cbDeprecate)
496
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 109, Short.MAX_VALUE)
496
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 114, Short.MAX_VALUE)
497
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
497
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
498
                    .add(btnSetupHome)
498
                    .add(btnSetupHome)
499
                    .add(lblWarnPlatform))
499
                    .add(lblWarnPlatform, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
500
                .addContainerGap())
500
                .addContainerGap())
501
        );
501
        );
502
502
(-)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 JHintedTextField 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 JHintedTextField() {
76
        addFocusListener(listener);
76
        addFocusListener(listener);
77
    }
77
    }
78
78
(-)a/maven/src/org/netbeans/modules/maven/options/MavenRuntime.java (+78 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.maven.options;
41
42
import java.io.Serializable;
43
44
/**
45
 *
46
 * @author johnsonlau@netbeans.org
47
 */
48
public class MavenRuntime implements Serializable {
49
50
	private String path;
51
	private String version;
52
53
	public MavenRuntime(String path, String version) {
54
		this.path = path;
55
		this.version = version;
56
	}
57
58
	public String getPath() {
59
		return path;
60
	}
61
62
	public void setPath(String path) {
63
		this.path = path;
64
	}
65
66
	public String getVersion() {
67
		return version;
68
	}
69
70
	public void setVersion(String version) {
71
		this.version = version;
72
	}
73
74
	public boolean isExternal() {
75
		return !"".equals(path);
76
	}
77
78
}
(-)a/maven/src/org/netbeans/modules/maven/options/MavenSettings.java (-33 / +104 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 263-269 Link Here
263
    }
267
    }
264
    
268
    
265
    public File getCommandLinePath() {
269
    public File getCommandLinePath() {
266
        String str =  getPreferences().get(PROP_COMMANDLINE_PATH, null);
270
        String str = getPreferences().get(PROP_COMMANDLINE_PATH, null);
267
        if (str != null) {
271
        if (str != null) {
268
            return FileUtil.normalizeFile(new File(str));
272
            return FileUtil.normalizeFile(new File(str));
269
        }
273
        }
Lines 350-386 Link Here
350
        }
354
        }
351
    }
355
    }
352
356
353
    private static Boolean cachedMaven = null;
354
    
355
    public static boolean canFindExternalMaven() {
356
        File home = MavenSettings.getDefault().getCommandLinePath();
357
        String ex = Utilities.isWindows() ? "mvn.bat" : "mvn"; //NOI18N
358
        if (home != null && home.exists()) {
359
            File bin = new File(home, "bin" + File.separator + ex);//NOI18N
360
            if (bin.exists()) {
361
                return true;
362
            }
363
        }
364
        if (cachedMaven != null) {
365
            return cachedMaven.booleanValue();
366
        }
367
        Commandline cmdline = new Commandline();
368
        cmdline.setExecutable(ex);
369
        Arg arg = cmdline.createArg();
370
        arg.setValue("--version"); //NOI18N
371
        cmdline.addArg(arg);
372
        RegExpConsumer cons = new RegExpConsumer();
373
        try {
374
            int ret = CommandLineUtils.executeCommandLine(cmdline, cons, cons);
375
            cachedMaven = cons.hasMavenAround;
376
            return cons.hasMavenAround;
377
        } catch (CommandLineException ex1) {
378
            Exceptions.printStackTrace(ex1);
379
            cachedMaven = false;
380
            return false;
381
        }
382
    }
383
    
384
    static String getDefaultMavenInstanceVersion() {
357
    static String getDefaultMavenInstanceVersion() {
385
        String ex = Utilities.isWindows() ? "mvn.bat" : "mvn"; //NOI18N
358
        String ex = Utilities.isWindows() ? "mvn.bat" : "mvn"; //NOI18N
386
        return getMavenVersion(ex);
359
        return getMavenVersion(ex);
Lines 416-422 Link Here
416
        //TODO examine the version's lib folder and the prop file in there.. see SettingsPanel.java
389
        //TODO examine the version's lib folder and the prop file in there.. see SettingsPanel.java
417
        return null;
390
        return null;
418
    }
391
    }
419
    
392
420
    private static class RegExpConsumer implements StreamConsumer {
393
    private static class RegExpConsumer implements StreamConsumer {
421
394
422
        private static final Pattern PATTERN = Pattern.compile("^Maven version:(.*)");
395
        private static final Pattern PATTERN = Pattern.compile("^Maven version:(.*)");
Lines 436-440 Link Here
436
        }
409
        }
437
    };
410
    };
438
411
412
    private void initExternalVersion(List<MavenRuntime> mavenRuntimes, String[] paths, boolean stopOnFirstValid) {
413
		for (String path : paths) {
414
			File file = new File(path);
415
			path = FileUtil.normalizeFile(file).getAbsolutePath();
416
			String version = MavenUtil.getExternalVersion(path);
417
			if (version != null) {
418
				mavenRuntimes.add(new MavenRuntime(path, version));
419
				if (stopOnFirstValid) {
420
					return;
421
				}
422
			}
423
		}
424
	}
425
426
	/**
427
	 * Searches Maven runtimes according to the environment settings.
428
	 *
429
	 * <p>It searches in this order:
430
	 * <ul>
431
	 * <li>MAVEN_HOME</li>
432
	 * <li>M2_HOME</li>
433
	 * <li>PATH</li></ul>
434
	 * </p>
435
	 * <p>Only the first appereance will be appended.</p>
436
	 *
437
	 * @param mavenRuntimes a list to store all Maven Runtime configurations.
438
	 */
439
    private void initDefaultExternalVersion(List<MavenRuntime> mavenRuntimes) {
440
		String paths = System.getenv("PATH"); // NOI18N
441
		String mavenHome = System.getenv("MAVEN_HOME"); // NOI18N
442
		String m2Home = System.getenv("M2_HOME"); // NOI18N
443
444
		List<String> mavenEnvDirs = new ArrayList<String>();
445
		if (mavenHome != null) {
446
			mavenEnvDirs.add(mavenHome);
447
		}
448
		if (m2Home != null) {
449
			mavenEnvDirs.add(m2Home);
450
		}
451
		if (paths != null) {
452
			for (String path : paths.split(File.pathSeparator)) {
453
				if (!path.endsWith("bin")) { // NOI18N
454
					continue;
455
				}
456
457
				mavenEnvDirs.add(path.substring(0,
458
						path.length() - "bin".length() - File.pathSeparator.length()));
459
			}
460
		}
461
462
		initExternalVersion(mavenRuntimes, mavenEnvDirs.toArray(new String[0]), true);
463
    }
464
465
	public MavenRuntime[] getMavenRuntimes() {
466
		List<MavenRuntime> runtimes = new ArrayList<MavenRuntime>();
467
		
468
		// Embedded
469
		runtimes.add(new MavenRuntime("",
470
				NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion2", "3.0-SNAPSHOT")));
471
		
472
		String runtimesPref = getPreferences().get(PROP_MAVEN_RUNTIMES, null);
473
		if (runtimesPref != null) {
474
			for (String runtimePath : runtimesPref.split(File.pathSeparator)) {
475
				if (!"".equals(runtimePath)) {
476
					String version = MavenUtil.getExternalVersion(runtimePath);
477
					if (version != null) {
478
						runtimes.add(new MavenRuntime(runtimePath, version));
479
					}
480
				}
481
			}
482
483
		} else {
484
			// Try to find 
485
			initDefaultExternalVersion(runtimes);
486
		}
487
		
488
		return runtimes.toArray(new MavenRuntime[0]);
489
	}
490
491
	public void setMavenRuntimes(MavenRuntime[] runtimes) {
492
		if (runtimes == null) {
493
			getPreferences().remove(PROP_MAVEN_RUNTIMES);
494
		} else {
495
			String runtimesPref = "";
496
			for (MavenRuntime runtime : runtimes) {
497
				runtimesPref += runtime.getPath() + File.pathSeparator;
498
			}
499
			putProperty(PROP_MAVEN_RUNTIMES, runtimesPref);
500
		}
501
	}
502
503
	/**
504
	 * Checks whether an external runtime is being used.
505
	 * @return true if using an external runtime. Otherwise false.
506
	 */
507
	public boolean isUsingExternalRuntime() {
508
		return getCommandLinePath() != null;
509
	}
439
    
510
    
440
}
511
}
(-)a/maven/src/org/netbeans/modules/maven/options/MavenUtil.java (+112 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.maven.options;
41
42
import java.io.File;
43
import java.io.FilenameFilter;
44
import java.io.IOException;
45
import java.io.InputStream;
46
import java.util.Properties;
47
import java.util.jar.JarFile;
48
import java.util.zip.ZipEntry;
49
import org.openide.util.NbBundle;
50
51
/**
52
 * Maven relevant utility methods.
53
 *
54
 * @author johnsonlau@netbeans.org
55
 */
56
public class MavenUtil {
57
58
	/**
59
	 * Gets an external Maven installation's version.
60
	 * 
61
	 * @param path external maven installation path.
62
	 * @return version description of the installation. null when failed.
63
	 */
64
    public static String getExternalVersion(String path) {
65
        File root = new File(path);
66
        File lib = new File(root, "lib"); //NOI18N
67
        if (lib.exists()) {
68
            File[] jars = lib.listFiles(new FilenameFilter() {
69
                public boolean accept(File dir, String name) {
70
                    return name.endsWith(".jar"); //NOI18N
71
                }
72
            });
73
            for (File jar : jars) {
74
                JarFile jf = null;
75
                try
76
                {
77
                    jf = new JarFile(jar);
78
                    ZipEntry entry = jf.getEntry("META-INF/maven/org.apache.maven/maven-core/pom.properties");//NOI18N
79
                    if (entry != null) {
80
                        InputStream resourceAsStream = jf.getInputStream(entry);
81
                        Properties properties = new Properties();
82
                        properties.load( resourceAsStream );
83
                        if ( properties.getProperty( "builtOn" ) != null ) { //NOI18N
84
							return NbBundle.getMessage(SettingsPanel.class, "LBL_ExMavenVersion1",
85
                                    properties.getProperty( "version", "unknown" ), properties.getProperty( "builtOn" ));//NOI18N
86
                        } else {
87
                            return NbBundle.getMessage(SettingsPanel.class, "LBL_ExMavenVersion2", properties.getProperty( "version", "unknown" ));//NOI18N
88
                        }
89
                    }
90
                } catch ( IOException ex )
91
                {
92
                    //ignore..
93
                } finally {
94
                    if (jf != null) {
95
                        try {
96
                            jf.close();
97
                        } catch (IOException x) {}
98
                    }
99
                }
100
            }
101
        }
102
103
		return null;
104
    }
105
106
	public static boolean isDefaultMavenRuntime(MavenRuntime runtime,
107
			File commandLinePath) {
108
		return (!runtime.isExternal() && commandLinePath == null) ||
109
				(commandLinePath != null && commandLinePath.getAbsolutePath().equals(runtime.getPath()));
110
	}
111
112
}
(-)a/maven/src/org/netbeans/modules/maven/options/RadioButtonTable.java (+155 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.maven.options;
41
42
import java.awt.Component;
43
import java.awt.Dimension;
44
import java.awt.GridBagConstraints;
45
import java.awt.GridBagLayout;
46
import java.awt.event.ItemEvent;
47
import java.awt.event.ItemListener;
48
import java.util.EventObject;
49
import javax.swing.AbstractCellEditor;
50
import javax.swing.JPanel;
51
import javax.swing.JRadioButton;
52
import javax.swing.JTable;
53
import javax.swing.ListSelectionModel;
54
import javax.swing.table.TableCellEditor;
55
import javax.swing.table.TableCellRenderer;
56
import javax.swing.table.TableColumn;
57
import javax.swing.table.TableColumnModel;
58
import javax.swing.table.TableModel;
59
60
/**
61
 * A simple JTable implementation with Radio Buttons for boolean value.
62
 *
63
 * @author johnsonlau
64
 */
65
public class RadioButtonTable extends JTable {
66
67
	private class RadioButtonCellRenderer extends JPanel implements TableCellRenderer {
68
69
		private boolean fixedWidth = false;
70
71
		private JRadioButton radioBtn;
72
73
		public RadioButtonCellRenderer(boolean fixedWidth) {
74
			this.fixedWidth = fixedWidth;
75
			radioBtn = new JRadioButton();
76
			setLayout(new GridBagLayout());
77
			GridBagConstraints c = new GridBagConstraints();
78
			add(radioBtn, c);
79
		}
80
81
		@Override
82
		public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
83
			radioBtn.setSelected(value != null ? (Boolean) value : false);
84
			if (isSelected) {
85
				radioBtn.setBackground(table.getSelectionBackground());
86
				setBackground(table.getSelectionBackground());
87
			} else {
88
				radioBtn.setBackground(table.getBackground());
89
				setBackground(table.getBackground());
90
			}
91
			Dimension preferredSize = getPreferredSize();
92
			int width = preferredSize.width;
93
			int rowHeight = table.getRowHeight();
94
			TableColumn tableColumn = table.getColumnModel().getColumn(column);
95
			tableColumn.setMinWidth(width);
96
			tableColumn.setPreferredWidth(width);
97
			if (fixedWidth) {
98
				tableColumn.setMaxWidth(width);
99
			}
100
			table.setRowHeight(row, rowHeight > preferredSize.height ? rowHeight : preferredSize.height);
101
			return this;
102
		}
103
104
	}
105
106
	private class RadioButtonCellEditor extends AbstractCellEditor implements TableCellEditor {
107
108
		private JPanel panel = new JPanel();
109
		private JRadioButton radioBtn = new JRadioButton();
110
111
		public RadioButtonCellEditor() {
112
			panel.setLayout(new GridBagLayout());
113
			GridBagConstraints c = new GridBagConstraints();
114
			panel.add(radioBtn, c);
115
		}
116
117
		@Override
118
		public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, final int row, int column) {
119
			radioBtn.setSelected(value != null ? (Boolean) value : false);
120
			panel.setBackground(table.getSelectionBackground());
121
			radioBtn.setBackground(table.getSelectionBackground());
122
			radioBtn.addItemListener(new ItemListener() {
123
124
				@Override
125
				public void itemStateChanged(ItemEvent e) {
126
					RadioButtonCellEditor.this.fireEditingStopped();
127
				}
128
129
			});
130
			return panel;
131
		}
132
133
		@Override
134
		public boolean shouldSelectCell(EventObject anEvent) {
135
			return true;
136
		}
137
138
		@Override
139
		public Object getCellEditorValue() {
140
			return radioBtn.isSelected();
141
		}
142
143
	}
144
145
	public RadioButtonTable() {
146
		this(null, null, null);
147
	}
148
149
	public RadioButtonTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm) {
150
		super(dm, cm, sm);
151
		setDefaultRenderer(Boolean.class, new RadioButtonCellRenderer(false));
152
		setDefaultEditor(Boolean.class, new RadioButtonCellEditor());
153
	}
154
155
}
(-)a/maven/src/org/netbeans/modules/maven/options/SettingsPanel.form (-122 / +210 lines)
Lines 1-4 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <NonVisualComponents>
4
  <NonVisualComponents>
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 JHintedTextField();"/>
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
          <AuxValues>
367
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new RadioButtonTable();"/>
368
          </AuxValues>
369
        </Component>
370
      </SubComponents>
371
    </Container>
372
    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
373
      <AuxValues>
374
        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
375
      </AuxValues>
376
377
      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
378
      <SubComponents>
379
        <Component class="javax.swing.JList" name="lstOptions">
380
          <Properties>
381
            <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
382
              <StringArray count="0"/>
383
            </Property>
384
          </Properties>
385
        </Component>
386
      </SubComponents>
387
    </Container>
388
    <Component class="javax.swing.JLabel" name="jLabel2">
389
      <Properties>
390
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
391
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
392
        </Property>
393
      </Properties>
394
    </Component>
395
    <Component class="javax.swing.JButton" name="btnAddOption">
396
      <Properties>
397
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
398
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnAddOption.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
399
        </Property>
400
      </Properties>
401
      <Events>
402
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddOptionActionPerformed"/>
403
      </Events>
404
    </Component>
405
    <Component class="javax.swing.JButton" name="btnRemoveOption">
406
      <Properties>
407
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
408
          <ResourceString bundle="org/netbeans/modules/maven/options/Bundle.properties" key="SettingsPanel.btnRemoveOption.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
409
        </Property>
410
        <Property name="enabled" type="boolean" value="false"/>
411
      </Properties>
412
      <Events>
413
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRemoveOptionActionPerformed"/>
414
      </Events>
415
    </Component>
328
  </SubComponents>
416
  </SubComponents>
329
</Form>
417
</Form>
(-)a/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java (-253 / +420 lines)
Lines 43-68 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;
65
import org.netbeans.modules.maven.TextValueCompleter;
63
import javax.swing.table.AbstractTableModel;
66
import org.netbeans.modules.maven.indexer.api.RepositoryIndexer;
64
import org.netbeans.modules.maven.indexer.api.RepositoryIndexer;
67
import org.netbeans.modules.maven.indexer.api.RepositoryInfo;
65
import org.netbeans.modules.maven.indexer.api.RepositoryInfo;
68
import org.netbeans.modules.maven.indexer.api.RepositoryPreferences;
66
import org.netbeans.modules.maven.indexer.api.RepositoryPreferences;
Lines 92-101 Link Here
92
    private boolean changed;
90
    private boolean changed;
93
    private boolean valid;
91
    private boolean valid;
94
    private ActionListener listener;
92
    private ActionListener listener;
95
    private DocumentListener docList;
93
	private File commandLinePath;
96
    private MavenOptionController controller;
94
	private List<MavenRuntime> mavenRuntimes;
97
    private TextValueCompleter completer;
95
	private AbstractTableModel tableModel = new AbstractTableModel() {
98
96
97
		@Override
98
		public int getRowCount() {
99
			return mavenRuntimes.size();
100
		}
101
102
		@Override
103
		public int getColumnCount() {
104
			return 2;
105
		}
106
107
		@Override
108
		public Class<?> getColumnClass(int columnIndex) {
109
			if (columnIndex == 0) {
110
				return Boolean.class;
111
			} else {
112
				return String.class;
113
			}
114
		}
115
116
		@Override
117
		public boolean isCellEditable(int rowIndex, int columnIndex) {
118
			if (columnIndex == 0) {
119
				MavenRuntime runtime = mavenRuntimes.get(rowIndex);
120
				return !MavenUtil.isDefaultMavenRuntime(runtime, commandLinePath);
121
			}
122
			
123
			return false;
124
		}
125
126
		@Override
127
		public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
128
			if (columnIndex == 0) {
129
				MavenRuntime runtime = mavenRuntimes.get(rowIndex);
130
				if (MavenUtil.isDefaultMavenRuntime(runtime, commandLinePath)) {
131
					return;
132
				}
133
134
				commandLinePath = runtime.isExternal() ? new File(runtime.getPath()) : null;
135
				for (int i = 0; i < mavenRuntimes.size(); ++i) {
136
					fireTableCellUpdated(i, columnIndex);
137
				}
138
139
			} else {
140
				super.setValueAt(aValue, rowIndex, columnIndex);
141
			}
142
		}
143
144
		@Override
145
		public Object getValueAt(int rowIndex, int columnIndex) {
146
			switch (columnIndex) {
147
				case 0: {
148
					MavenRuntime runtime = mavenRuntimes.get(rowIndex);
149
					return MavenUtil.isDefaultMavenRuntime(runtime, commandLinePath);
150
				}
151
152
				case 1: {
153
					MavenRuntime runtime = mavenRuntimes.get(rowIndex);
154
					String key = runtime.isExternal() ? "MAVEN_RUNTIME_External" : "MAVEN_RUNTIME_Embedded";
155
					return NbBundle.getMessage(SettingsPanel.class, key,
156
							new Object[]{runtime.getPath(), runtime.getVersion()});
157
				}
158
			}
159
160
			return null;
161
		}
162
	};
163
164
	private DefaultListModel optionsModel = new DefaultListModel();
165
	
99
    /** Creates new form SettingsPanel */
166
    /** Creates new form SettingsPanel */
100
    SettingsPanel(MavenOptionController controller) {
167
    SettingsPanel(MavenOptionController controller) {
101
        initComponents();
168
        initComponents();
Lines 105-110 Link Here
105
        comJavadoc.setModel(new DefaultComboBoxModel(downloads));
172
        comJavadoc.setModel(new DefaultComboBoxModel(downloads));
106
        comSource.setModel(new DefaultComboBoxModel(downloads));
173
        comSource.setModel(new DefaultComboBoxModel(downloads));
107
174
175
		mavenRuntimes = new ArrayList<MavenRuntime>();
176
		tblMavenRuntimes.setModel(tableModel);
177
		tblMavenRuntimes.setTableHeader(null);
178
		tblMavenRuntimes.getColumnModel().getColumn(0).setMaxWidth(20);
179
		tblMavenRuntimes.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
180
181
			@Override
182
			public void valueChanged(ListSelectionEvent e) {
183
				if (!e.getValueIsAdjusting()) {
184
					int selected = tblMavenRuntimes.getSelectedRow();
185
					if (selected != -1 && mavenRuntimes.get(selected).isExternal()) {
186
						btnEditRuntime.setEnabled(true);
187
						btnRemoveRuntime.setEnabled(true);
188
					} else {
189
						btnEditRuntime.setEnabled(false);
190
						btnRemoveRuntime.setEnabled(false);
191
					}
192
				}
193
			}
194
195
		});
196
197
		lstOptions.setModel(optionsModel);
198
		lstOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
199
200
			@Override
201
			public void valueChanged(ListSelectionEvent e) {
202
				if (!e.getValueIsAdjusting()) {
203
					if (optionsModel.getSize() > 0) {
204
						btnRemoveOption.setEnabled(true);
205
					} else {
206
						btnRemoveOption.setEnabled(false);
207
					}
208
				}
209
			}
210
211
		});
212
108
        ListCellRenderer rend = new DefaultListCellRenderer() {
213
        ListCellRenderer rend = new DefaultListCellRenderer() {
109
            @Override
214
            @Override
110
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
215
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Lines 123-147 Link Here
123
        comSource.setRenderer(rend);
228
        comSource.setRenderer(rend);
124
        comJavadoc.setRenderer(rend);
229
        comJavadoc.setRenderer(rend);
125
230
126
        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();
231
        initValues();
139
        ((MyJTextField)txtLocalRepository).setHintText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "txt_default_repository"));
232
        ((JHintedTextField)txtLocalRepository).setHintText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "txt_default_repository"));
140
        listener = new ActionListenerImpl();
233
        listener = new ActionListenerImpl();
141
        cbSnapshots.addActionListener(listener);
234
        cbSnapshots.addActionListener(listener);
142
        comIndex.addActionListener(listener);
235
        comIndex.addActionListener(listener);
143
        completer = new TextValueCompleter(getGlobalOptions(), txtOptions, " "); //NOI18N
144
        initEmbeddedVersion();
145
    }
236
    }
146
237
147
    static String[] AVAILABLE_OPTIONS = new String[] {
238
    static String[] AVAILABLE_OPTIONS = new String[] {
Lines 183-194 Link Here
183
        return Arrays.asList(AVAILABLE_OPTIONS);
274
        return Arrays.asList(AVAILABLE_OPTIONS);
184
    }
275
    }
185
276
186
    private void initEmbeddedVersion()
277
//    private void initEmbeddedVersion() {
187
    {
188
        //there was a renumbering scheme for maven. current trunk is not 2.1 but 3.0
278
        //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
279
        //http://blogs.sonatype.com/brian/2008/09/05/1220649145080.html
190
        //XXX: just hardwire here to not confuse people with old style versions.
280
        //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
        
281
        
193
//        InputStream resourceAsStream;
282
//        InputStream resourceAsStream;
194
//        try {
283
//        try {
Lines 206-291 Link Here
206
//        catch  ( IOException e ) {
295
//        catch  ( IOException e ) {
207
//            lblEmbeddedVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion3"));
296
//            lblEmbeddedVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion3"));
208
//        }
297
//        }
209
    }
298
//    }
210
299
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() {
300
    private void initValues() {
266
        comIndex.setSelectedIndex(0);
301
        comIndex.setSelectedIndex(0);
267
        cbSnapshots.setSelected(true);
302
        cbSnapshots.setSelected(true);
268
    }
303
    }
269
    
304
    
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() {
305
    private ComboBoxModel createComboModel() {
290
        return new DefaultComboBoxModel(
306
        return new DefaultComboBoxModel(
291
                new String[] { 
307
                new String[] { 
Lines 307-324 Link Here
307
        bgChecksums = new javax.swing.ButtonGroup();
323
        bgChecksums = new javax.swing.ButtonGroup();
308
        bgPlugins = new javax.swing.ButtonGroup();
324
        bgPlugins = new javax.swing.ButtonGroup();
309
        bgFailure = new javax.swing.ButtonGroup();
325
        bgFailure = new javax.swing.ButtonGroup();
310
        lblCommandLine = new javax.swing.JLabel();
326
        lblMavenRuntimes = new javax.swing.JLabel();
311
        txtCommandLine = new javax.swing.JTextField();
327
        btnRemoveRuntime = new javax.swing.JButton();
312
        btnCommandLine = new javax.swing.JButton();
313
        lblExternalVersion = new javax.swing.JLabel();
314
        lblOptions = new javax.swing.JLabel();
328
        lblOptions = new javax.swing.JLabel();
315
        txtOptions = new javax.swing.JTextField();
316
        btnOptions = new javax.swing.JButton();
317
        cbSkipTests = new javax.swing.JCheckBox();
329
        cbSkipTests = new javax.swing.JCheckBox();
318
        lblLocalRepository = new javax.swing.JLabel();
330
        lblLocalRepository = new javax.swing.JLabel();
319
        txtLocalRepository = new MyJTextField();
331
        txtLocalRepository = new JHintedTextField();
320
        btnLocalRepository = new javax.swing.JButton();
332
        btnLocalRepository = new javax.swing.JButton();
321
        lblEmbeddedVersion = new javax.swing.JLabel();
322
        lblBinaries = new javax.swing.JLabel();
333
        lblBinaries = new javax.swing.JLabel();
323
        comBinaries = new javax.swing.JComboBox();
334
        comBinaries = new javax.swing.JComboBox();
324
        lblJavadoc = new javax.swing.JLabel();
335
        lblJavadoc = new javax.swing.JLabel();
Lines 332-360 Link Here
332
        comIndex = new javax.swing.JComboBox();
343
        comIndex = new javax.swing.JComboBox();
333
        btnIndex = new javax.swing.JButton();
344
        btnIndex = new javax.swing.JButton();
334
        cbSnapshots = new javax.swing.JCheckBox();
345
        cbSnapshots = new javax.swing.JCheckBox();
346
        btnAddRuntime = new javax.swing.JButton();
347
        btnEditRuntime = new javax.swing.JButton();
348
        jScrollPane1 = new javax.swing.JScrollPane();
349
        tblMavenRuntimes = new RadioButtonTable();
350
        jScrollPane2 = new javax.swing.JScrollPane();
351
        lstOptions = new javax.swing.JList();
352
        jLabel2 = new javax.swing.JLabel();
353
        btnAddOption = new javax.swing.JButton();
354
        btnRemoveOption = new javax.swing.JButton();
335
355
336
        org.openide.awt.Mnemonics.setLocalizedText(lblCommandLine, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblCommandLine.text")); // NOI18N
356
        org.openide.awt.Mnemonics.setLocalizedText(lblMavenRuntimes, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblMavenRuntimes.text")); // NOI18N
337
357
338
        txtCommandLine.setText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.txtCommandLine.text")); // NOI18N
358
        org.openide.awt.Mnemonics.setLocalizedText(btnRemoveRuntime, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnRemoveRuntime.text")); // NOI18N
339
359
        btnRemoveRuntime.setEnabled(false);
340
        org.openide.awt.Mnemonics.setLocalizedText(btnCommandLine, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnCommandLine.text")); // NOI18N
360
        btnRemoveRuntime.addActionListener(new java.awt.event.ActionListener() {
341
        btnCommandLine.addActionListener(new java.awt.event.ActionListener() {
342
            public void actionPerformed(java.awt.event.ActionEvent evt) {
361
            public void actionPerformed(java.awt.event.ActionEvent evt) {
343
                btnCommandLineActionPerformed(evt);
362
                btnRemoveRuntimeActionPerformed(evt);
344
            }
363
            }
345
        });
364
        });
346
365
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
366
        org.openide.awt.Mnemonics.setLocalizedText(lblOptions, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblOptions.text")); // NOI18N
350
367
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
368
        org.openide.awt.Mnemonics.setLocalizedText(cbSkipTests, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbSkipTests.text")); // NOI18N
359
369
360
        org.openide.awt.Mnemonics.setLocalizedText(lblLocalRepository, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblLocalRepository.text")); // NOI18N
370
        org.openide.awt.Mnemonics.setLocalizedText(lblLocalRepository, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblLocalRepository.text")); // NOI18N
Lines 366-373 Link Here
366
            }
376
            }
367
        });
377
        });
368
378
369
        org.openide.awt.Mnemonics.setLocalizedText(lblEmbeddedVersion, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblEmbeddedVersion.text")); // NOI18N
370
371
        lblBinaries.setLabelFor(comBinaries);
379
        lblBinaries.setLabelFor(comBinaries);
372
        org.openide.awt.Mnemonics.setLocalizedText(lblBinaries, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblBinaries.text")); // NOI18N
380
        org.openide.awt.Mnemonics.setLocalizedText(lblBinaries, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblBinaries.text")); // NOI18N
373
381
Lines 402-511 Link Here
402
410
403
        org.openide.awt.Mnemonics.setLocalizedText(cbSnapshots, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbSnapshots.text")); // NOI18N
411
        org.openide.awt.Mnemonics.setLocalizedText(cbSnapshots, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbSnapshots.text")); // NOI18N
404
412
413
        org.openide.awt.Mnemonics.setLocalizedText(btnAddRuntime, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnAddRuntime.text")); // NOI18N
414
        btnAddRuntime.addActionListener(new java.awt.event.ActionListener() {
415
            public void actionPerformed(java.awt.event.ActionEvent evt) {
416
                btnAddRuntimeActionPerformed(evt);
417
            }
418
        });
419
420
        org.openide.awt.Mnemonics.setLocalizedText(btnEditRuntime, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnEditRuntime.text")); // NOI18N
421
        btnEditRuntime.setEnabled(false);
422
        btnEditRuntime.addActionListener(new java.awt.event.ActionListener() {
423
            public void actionPerformed(java.awt.event.ActionEvent evt) {
424
                btnEditRuntimeActionPerformed(evt);
425
            }
426
        });
427
428
        tblMavenRuntimes.setModel(new javax.swing.table.DefaultTableModel(
429
            new Object [][] {
430
                {},
431
                {},
432
                {},
433
                {}
434
            },
435
            new String [] {
436
437
            }
438
        ));
439
        tblMavenRuntimes.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN);
440
        tblMavenRuntimes.setShowVerticalLines(false);
441
        jScrollPane1.setViewportView(tblMavenRuntimes);
442
443
        jScrollPane2.setViewportView(lstOptions);
444
445
        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.jLabel2.text")); // NOI18N
446
447
        org.openide.awt.Mnemonics.setLocalizedText(btnAddOption, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnAddOption.text")); // NOI18N
448
        btnAddOption.addActionListener(new java.awt.event.ActionListener() {
449
            public void actionPerformed(java.awt.event.ActionEvent evt) {
450
                btnAddOptionActionPerformed(evt);
451
            }
452
        });
453
454
        org.openide.awt.Mnemonics.setLocalizedText(btnRemoveOption, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnRemoveOption.text")); // NOI18N
455
        btnRemoveOption.setEnabled(false);
456
        btnRemoveOption.addActionListener(new java.awt.event.ActionListener() {
457
            public void actionPerformed(java.awt.event.ActionEvent evt) {
458
                btnRemoveOptionActionPerformed(evt);
459
            }
460
        });
461
405
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
462
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
406
        this.setLayout(layout);
463
        this.setLayout(layout);
407
        layout.setHorizontalGroup(
464
        layout.setHorizontalGroup(
408
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
465
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
409
            .add(layout.createSequentialGroup()
466
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
410
                .addContainerGap()
467
                .addContainerGap()
411
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
468
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
469
                    .add(jLabel1)
412
                    .add(layout.createSequentialGroup()
470
                    .add(layout.createSequentialGroup()
413
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
471
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
414
                            .add(lblCommandLine)
472
                            .add(jLabel2)
415
                            .add(lblOptions)
473
                            .add(lblIndex))
416
                            .add(lblLocalRepository))
474
                        .add(10, 10, 10)
475
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
476
                            .add(layout.createSequentialGroup()
477
                                .add(2, 2, 2)
478
                                .add(comIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 425, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
479
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
480
                                .add(btnIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
481
                            .add(cbSnapshots)
482
                            .add(btnGoals, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 57, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
483
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
484
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
485
                            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
486
                                .add(9, 9, 9)
487
                                .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE))
488
                            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
489
                                .add(10, 10, 10)
490
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
491
                                    .add(lblBinaries)
492
                                    .add(lblJavadoc)
493
                                    .add(lblSource))
494
                                .add(36, 36, 36)
495
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
496
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, comSource, 0, 427, Short.MAX_VALUE)
497
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, comJavadoc, 0, 427, Short.MAX_VALUE)
498
                                    .add(comBinaries, 0, 427, Short.MAX_VALUE)))
499
                            .add(layout.createSequentialGroup()
500
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
501
                                    .add(lblMavenRuntimes)
502
                                    .add(lblOptions)
503
                                    .add(lblLocalRepository))
504
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
505
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
506
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)
507
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, cbSkipTests, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)
508
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)
509
                                    .add(txtLocalRepository, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE))))
417
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
510
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
418
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
511
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
419
                            .add(lblEmbeddedVersion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE)
512
                            .add(btnLocalRepository)
420
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
513
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
421
                                .add(txtCommandLine, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
514
                                .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)
515
                                .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))
516
                                .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)
517
                                .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()
518
                                .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())
519
                .addContainerGap())
456
        );
520
        );
457
458
        layout.linkSize(new java.awt.Component[] {btnCommandLine, btnIndex, btnLocalRepository, btnOptions}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
459
460
        layout.setVerticalGroup(
521
        layout.setVerticalGroup(
461
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
522
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
462
            .add(layout.createSequentialGroup()
523
            .add(layout.createSequentialGroup()
463
                .add(lblEmbeddedVersion)
524
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
525
                    .add(layout.createSequentialGroup()
526
                        .addContainerGap()
527
                        .add(lblMavenRuntimes))
528
                    .add(layout.createSequentialGroup()
529
                        .add(6, 6, 6)
530
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
531
                            .add(layout.createSequentialGroup()
532
                                .add(btnAddRuntime)
533
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
534
                                .add(btnEditRuntime)
535
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
536
                                .add(btnRemoveRuntime))
537
                            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 141, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
464
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
538
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
465
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
539
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
466
                    .add(lblCommandLine)
540
                    .add(lblOptions)
467
                    .add(txtCommandLine, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
541
                    .add(layout.createSequentialGroup()
468
                    .add(btnCommandLine))
542
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
543
                            .add(layout.createSequentialGroup()
544
                                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
545
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
546
                                .add(cbSkipTests))
547
                            .add(layout.createSequentialGroup()
548
                                .add(btnAddOption)
549
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
550
                                .add(btnRemoveOption)))
551
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
552
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
553
                            .add(txtLocalRepository, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
554
                            .add(lblLocalRepository)
555
                            .add(btnLocalRepository))))
469
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
556
                .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)
557
                .add(jLabel1)
485
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
558
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
486
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
559
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
487
                    .add(lblBinaries)
560
                    .add(lblBinaries)
488
                    .add(comBinaries, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
561
                    .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)
562
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
490
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
563
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
491
                    .add(lblJavadoc)
564
                    .add(lblJavadoc)
492
                    .add(comJavadoc, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
565
                    .add(comJavadoc, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
566
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
567
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
568
                    .add(comSource, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
569
                    .add(lblSource))
570
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
571
                .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
493
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
572
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
494
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
573
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
495
                    .add(lblSource)
574
                    .add(btnGoals)
496
                    .add(comSource, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
575
                    .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
497
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
576
                .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)
577
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
503
                    .add(btnIndex)
504
                    .add(lblIndex)
578
                    .add(lblIndex)
505
                    .add(comIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
579
                    .add(comIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
580
                    .add(btnIndex))
506
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
581
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
507
                .add(cbSnapshots)
582
                .add(cbSnapshots)
508
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
583
                .addContainerGap())
509
        );
584
        );
510
    }// </editor-fold>//GEN-END:initComponents
585
    }// </editor-fold>//GEN-END:initComponents
511
586
Lines 533-539 Link Here
533
        chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select"));
608
        chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select"));
534
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
609
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
535
        chooser.setFileHidingEnabled(false);
610
        chooser.setFileHidingEnabled(false);
536
        String path = ((MyJTextField)txtLocalRepository).getRealText();
611
        String path = ((JHintedTextField)txtLocalRepository).getRealText();
537
        if (path.trim().length() == 0) {
612
        if (path.trim().length() == 0) {
538
            path = new File(System.getProperty("user.home"), ".m2").getAbsolutePath(); //NOI18N
613
            path = new File(System.getProperty("user.home"), ".m2").getAbsolutePath(); //NOI18N
539
        }
614
        }
Lines 545-576 Link Here
545
        }
620
        }
546
        if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
621
        if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
547
            File projectDir = chooser.getSelectedFile();
622
            File projectDir = chooser.getSelectedFile();
548
            ((MyJTextField)txtLocalRepository).setRealText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
623
            ((JHintedTextField)txtLocalRepository).setRealText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
549
        }
624
        }
550
    }//GEN-LAST:event_btnLocalRepositoryActionPerformed
625
    }//GEN-LAST:event_btnLocalRepositoryActionPerformed
551
626
552
    private void btnCommandLineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCommandLineActionPerformed
627
    private void btnRemoveRuntimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveRuntimeActionPerformed
553
        JFileChooser chooser = new JFileChooser();
628
		int selected = tblMavenRuntimes.getSelectedRow();
554
        FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
629
		if (selected != -1 && selected < mavenRuntimes.size()) {
555
        chooser.setDialogTitle(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "TIT_Select2"));
630
			mavenRuntimes.remove(selected);
556
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
631
			tableModel.fireTableDataChanged();
557
        chooser.setFileHidingEnabled(false);
632
		}
558
        String path = txtCommandLine.getText();
633
    }//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
634
575
    private void btnGoalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGoalsActionPerformed
635
    private void btnGoalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGoalsActionPerformed
576
        NbGlobalActionGoalProvider provider = null;
636
        NbGlobalActionGoalProvider provider = null;
Lines 597-622 Link Here
597
        }
657
        }
598
    }//GEN-LAST:event_btnGoalsActionPerformed
658
    }//GEN-LAST:event_btnGoalsActionPerformed
599
659
600
    private void btnOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOptionsActionPerformed
660
	private boolean tryEditMavenRuntime(String path, MavenRuntime mavenRuntime) {
661
		if (path == null ||  path.length() == 0) {
662
			path = new File(System.getProperty("user.home")).getAbsolutePath(); //NOI18N
663
		}
664
		JFileChooser chooser = new JFileChooser();
665
		FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
666
		chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select2"));
667
		chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
668
		chooser.setFileHidingEnabled(false);
669
		if (path.length() > 0) {
670
			File f = new File(path);
671
			if (f.exists()) {
672
				chooser.setSelectedFile(f);
673
			}
674
		}
675
		if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
676
			File projectDir = chooser.getSelectedFile();
677
			path = FileUtil.normalizeFile(projectDir).getAbsolutePath();
678
			String version = MavenUtil.getExternalVersion(path);
679
			if (version == null) {
680
				JOptionPane.showMessageDialog(this,
681
						NbBundle.getMessage(SettingsPanel.class, "MAVEN_RUNTIME_Error_DuplicatedRuntime_Message", new Object[]{path}),
682
						NbBundle.getMessage(SettingsPanel.class, "MAVEN_RUNTIME_ErrorCaption"),
683
						JOptionPane.ERROR_MESSAGE);
684
				return false;
685
			}
686
687
			for (MavenRuntime runtime : mavenRuntimes) {
688
				if (runtime.isExternal() && runtime.getPath().equals(path)) {
689
					JOptionPane.showMessageDialog(this,
690
						NbBundle.getMessage(SettingsPanel.class, "MAVEN_RUNTIME_Error_AlreadyRegistered_Message", new Object[]{path}),
691
						NbBundle.getMessage(SettingsPanel.class, "MAVEN_RUNTIME_ErrorCaption"),
692
						JOptionPane.ERROR_MESSAGE);
693
					return false;
694
				}
695
			}
696
697
			mavenRuntime.setPath(path);
698
			mavenRuntime.setVersion(version);
699
			return true;
700
		}
701
702
		return false;
703
	}
704
705
	private void btnAddRuntimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddRuntimeActionPerformed
706
		int selected = tblMavenRuntimes.getSelectedRow();
707
		String path = null;
708
		if (selected != -1) {
709
			path = mavenRuntimes.get(selected).getPath();
710
		}
711
712
		MavenRuntime newRuntime = new MavenRuntime("", "");
713
		if (tryEditMavenRuntime(path, newRuntime)) {
714
			mavenRuntimes.add(newRuntime);
715
			tableModel.fireTableDataChanged();
716
		}
717
	}//GEN-LAST:event_btnAddRuntimeActionPerformed
718
719
	private void btnEditRuntimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditRuntimeActionPerformed
720
		int selected = tblMavenRuntimes.getSelectedRow();
721
		if (selected == -1) {
722
			return;
723
		}
724
725
		MavenRuntime runtime = mavenRuntimes.get(selected);
726
		if (tryEditMavenRuntime(runtime.getPath(), runtime)) {
727
			tableModel.fireTableDataChanged();
728
		}
729
730
	}//GEN-LAST:event_btnEditRuntimeActionPerformed
731
732
	private void btnAddOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddOptionActionPerformed
601
        GlobalOptionsPanel pnl = new GlobalOptionsPanel();
733
        GlobalOptionsPanel pnl = new GlobalOptionsPanel();
602
        DialogDescriptor dd = new DialogDescriptor(pnl, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "TIT_Add_Globals"));
734
        DialogDescriptor dd = new DialogDescriptor(pnl, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "TIT_Add_Globals"));
603
        Object ret = DialogDisplayer.getDefault().notify(dd);
735
        Object ret = DialogDisplayer.getDefault().notify(dd);
604
        if (ret == DialogDescriptor.OK_OPTION) {
736
        if (ret == DialogDescriptor.OK_OPTION) {
605
            txtOptions.setText(txtOptions.getText() + pnl.getSelectedOnes());
737
			String[] newOptions = pnl.getSelectedOnes();
738
			int size = optionsModel.getSize();
739
			for (String option : newOptions) {
740
				if (optionsModel.contains(option)) {
741
					continue;
742
				}
743
744
	            optionsModel.addElement(option);
745
			}
746
			if (lstOptions.getSelectedIndex() == -1 && size != optionsModel.getSize()) {
747
				lstOptions.setSelectedIndex(optionsModel.getSize() - 1);
748
			}
606
        }
749
        }
750
	}//GEN-LAST:event_btnAddOptionActionPerformed
607
751
608
    }//GEN-LAST:event_btnOptionsActionPerformed
752
	private void btnRemoveOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveOptionActionPerformed
753
		int[] selectedIndices = lstOptions.getSelectedIndices();
754
		for (int i = selectedIndices.length - 1; i >= 0; --i) {
755
			optionsModel.remove(selectedIndices[i]);
756
		}
757
		int newSelected = selectedIndices.length > 0 && selectedIndices[0] < optionsModel.getSize() ?
758
			selectedIndices[0] : optionsModel.getSize() - 1;
759
		lstOptions.setSelectedIndex(newSelected);
760
	}//GEN-LAST:event_btnRemoveOptionActionPerformed
609
    
761
    
610
    
762
    
611
    // Variables declaration - do not modify//GEN-BEGIN:variables
763
    // Variables declaration - do not modify//GEN-BEGIN:variables
612
    private javax.swing.ButtonGroup bgChecksums;
764
    private javax.swing.ButtonGroup bgChecksums;
613
    private javax.swing.ButtonGroup bgFailure;
765
    private javax.swing.ButtonGroup bgFailure;
614
    private javax.swing.ButtonGroup bgPlugins;
766
    private javax.swing.ButtonGroup bgPlugins;
615
    private javax.swing.JButton btnCommandLine;
767
    private javax.swing.JButton btnAddOption;
768
    private javax.swing.JButton btnAddRuntime;
769
    private javax.swing.JButton btnEditRuntime;
616
    private javax.swing.JButton btnGoals;
770
    private javax.swing.JButton btnGoals;
617
    private javax.swing.JButton btnIndex;
771
    private javax.swing.JButton btnIndex;
618
    private javax.swing.JButton btnLocalRepository;
772
    private javax.swing.JButton btnLocalRepository;
619
    private javax.swing.JButton btnOptions;
773
    private javax.swing.JButton btnRemoveOption;
774
    private javax.swing.JButton btnRemoveRuntime;
620
    private javax.swing.JCheckBox cbSkipTests;
775
    private javax.swing.JCheckBox cbSkipTests;
621
    private javax.swing.JCheckBox cbSnapshots;
776
    private javax.swing.JCheckBox cbSnapshots;
622
    private javax.swing.JComboBox comBinaries;
777
    private javax.swing.JComboBox comBinaries;
Lines 624-656 Link Here
624
    private javax.swing.JComboBox comJavadoc;
779
    private javax.swing.JComboBox comJavadoc;
625
    private javax.swing.JComboBox comSource;
780
    private javax.swing.JComboBox comSource;
626
    private javax.swing.JLabel jLabel1;
781
    private javax.swing.JLabel jLabel1;
782
    private javax.swing.JLabel jLabel2;
627
    private javax.swing.JLabel jLabel3;
783
    private javax.swing.JLabel jLabel3;
784
    private javax.swing.JScrollPane jScrollPane1;
785
    private javax.swing.JScrollPane jScrollPane2;
628
    private javax.swing.JLabel lblBinaries;
786
    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;
787
    private javax.swing.JLabel lblIndex;
633
    private javax.swing.JLabel lblJavadoc;
788
    private javax.swing.JLabel lblJavadoc;
634
    private javax.swing.JLabel lblLocalRepository;
789
    private javax.swing.JLabel lblLocalRepository;
790
    private javax.swing.JLabel lblMavenRuntimes;
635
    private javax.swing.JLabel lblOptions;
791
    private javax.swing.JLabel lblOptions;
636
    private javax.swing.JLabel lblSource;
792
    private javax.swing.JLabel lblSource;
637
    private javax.swing.JTextField txtCommandLine;
793
    private javax.swing.JList lstOptions;
794
    private javax.swing.JTable tblMavenRuntimes;
638
    private javax.swing.JTextField txtLocalRepository;
795
    private javax.swing.JTextField txtLocalRepository;
639
    private javax.swing.JTextField txtOptions;
640
    // End of variables declaration//GEN-END:variables
796
    // End of variables declaration//GEN-END:variables
641
    
797
    
642
    public void setValues() {
798
    public void setValues() {
643
        txtOptions.setText(MavenSettings.getDefault().getDefaultOptions());
799
		String defaultOptions = MavenSettings.getDefault().getDefaultOptions();
644
        txtCommandLine.getDocument().removeDocumentListener(docList);
800
		optionsModel.clear();
645
        File command = MavenSettings.getDefault().getCommandLinePath();
801
		if (!"".equals(defaultOptions.trim())) { // NOI18N
646
        txtCommandLine.setText(command != null ? command.getAbsolutePath() : ""); //NOI18N
802
			String[] optionArr = MavenSettings.getDefault().getDefaultOptions().split(" "); // NOI18N
647
        initExternalVersion();
803
			for (String option : optionArr) {
648
        txtCommandLine.getDocument().addDocumentListener(docList);
804
				optionsModel.addElement(option);
649
        
805
			}
806
		}
807
		lstOptions.setSelectedIndex(-1);
808
809
		mavenRuntimes.clear();
810
		MavenRuntime[] runtimes = MavenSettings.getDefault().getMavenRuntimes();
811
		mavenRuntimes.addAll(Arrays.asList(runtimes));
812
		tableModel.fireTableDataChanged();
813
814
		commandLinePath = MavenSettings.getDefault().getCommandLinePath();
650
        cbSnapshots.setSelected(RepositoryPreferences.getInstance().isIncludeSnapshots());
815
        cbSnapshots.setSelected(RepositoryPreferences.getInstance().isIncludeSnapshots());
651
        comIndex.setSelectedIndex(RepositoryPreferences.getInstance().getIndexUpdateFrequency());
816
        comIndex.setSelectedIndex(RepositoryPreferences.getInstance().getIndexUpdateFrequency());
652
        String repo = MavenSettings.getDefault().getCustomLocalRepository();
817
        String repo = MavenSettings.getDefault().getCustomLocalRepository();
653
        ((MyJTextField)txtLocalRepository).setRealText(repo != null ? repo : "");
818
        ((JHintedTextField)txtLocalRepository).setRealText(repo != null ? repo : "");
654
        comBinaries.setSelectedItem(MavenSettings.getDefault().getBinaryDownloadStrategy());
819
        comBinaries.setSelectedItem(MavenSettings.getDefault().getBinaryDownloadStrategy());
655
        comJavadoc.setSelectedItem(MavenSettings.getDefault().getJavadocDownloadStrategy());
820
        comJavadoc.setSelectedItem(MavenSettings.getDefault().getJavadocDownloadStrategy());
656
        comSource.setSelectedItem(MavenSettings.getDefault().getSourceDownloadStrategy());
821
        comSource.setSelectedItem(MavenSettings.getDefault().getSourceDownloadStrategy());
Lines 660-675 Link Here
660
    }
825
    }
661
    
826
    
662
    public void applyValues() {
827
    public void applyValues() {
663
        MavenSettings.getDefault().setDefaultOptions(txtOptions.getText().trim());
828
		String options = "";
664
        MavenSettings.getDefault().setCustomLocalRepository(((MyJTextField)txtLocalRepository).getRealText());
829
		Enumeration optEnum = optionsModel.elements();
665
        String cl = txtCommandLine.getText().trim();
830
		while(optEnum.hasMoreElements()) {
666
        if (cl.length() == 0) {
831
			options += optEnum.nextElement() + " ";
667
            cl = null;
832
		}
668
        }
833
834
        MavenSettings.getDefault().setDefaultOptions(options.trim());
835
        MavenSettings.getDefault().setCustomLocalRepository(((JHintedTextField)txtLocalRepository).getRealText());
836
		MavenSettings.getDefault().setMavenRuntimes(mavenRuntimes.toArray(new MavenRuntime[0]));
669
        //MEVENIDE-553
837
        //MEVENIDE-553
670
        File command = cl != null ? new File(cl) : null;
838
        if (commandLinePath != null && commandLinePath.exists()) {
671
        if (command != null && command.exists()) {
839
            MavenSettings.getDefault().setCommandLinePath(commandLinePath);
672
            MavenSettings.getDefault().setCommandLinePath(command);
673
        } else {
840
        } else {
674
            MavenSettings.getDefault().setCommandLinePath(null);
841
            MavenSettings.getDefault().setCommandLinePath(null);
675
        }
842
        }
Lines 689-695 Link Here
689
    boolean hasChangedValues() {
856
    boolean hasChangedValues() {
690
        return changed;
857
        return changed;
691
    }
858
    }
692
    
859
693
    private class ActionListenerImpl implements ActionListener {
860
    private class ActionListenerImpl implements ActionListener {
694
        
861
        
695
        public void actionPerformed(ActionEvent e) {
862
        public void actionPerformed(ActionEvent e) {

Return to bug 183455