Lines 43-67
Link Here
|
43 |
import java.awt.event.ActionEvent; |
43 |
import java.awt.event.ActionEvent; |
44 |
import java.awt.event.ActionListener; |
44 |
import java.awt.event.ActionListener; |
45 |
import java.io.File; |
45 |
import java.io.File; |
46 |
import java.io.FilenameFilter; |
|
|
47 |
import java.io.IOException; |
48 |
import java.io.InputStream; |
49 |
import java.io.StringReader; |
46 |
import java.io.StringReader; |
|
|
47 |
import java.util.ArrayList; |
50 |
import java.util.Arrays; |
48 |
import java.util.Arrays; |
|
|
49 |
import java.util.Collections; |
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; |
59 |
import javax.swing.JFileChooser; |
55 |
import javax.swing.JFileChooser; |
|
|
56 |
import javax.swing.JLabel; |
60 |
import javax.swing.JList; |
57 |
import javax.swing.JList; |
|
|
58 |
import javax.swing.JSeparator; |
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.border.EmptyBorder; |
64 |
import javax.swing.event.DocumentListener; |
|
|
65 |
import org.netbeans.modules.maven.TextValueCompleter; |
62 |
import org.netbeans.modules.maven.TextValueCompleter; |
66 |
import org.netbeans.modules.maven.indexer.api.RepositoryIndexer; |
63 |
import org.netbeans.modules.maven.indexer.api.RepositoryIndexer; |
67 |
import org.netbeans.modules.maven.indexer.api.RepositoryInfo; |
64 |
import org.netbeans.modules.maven.indexer.api.RepositoryInfo; |
Lines 89-100
Link Here
|
89 |
*/ |
86 |
*/ |
90 |
public class SettingsPanel extends javax.swing.JPanel { |
87 |
public class SettingsPanel extends javax.swing.JPanel { |
91 |
private static final String CP_SELECTED = "wasSelected"; //NOI18N |
88 |
private static final String CP_SELECTED = "wasSelected"; //NOI18N |
|
|
89 |
private static final String SEPARATOR = "SEPARATOR"; |
90 |
private static final int RUNTIME_COUNT_LIMIT = 5; |
92 |
private boolean changed; |
91 |
private boolean changed; |
93 |
private boolean valid; |
92 |
private boolean valid; |
94 |
private ActionListener listener; |
93 |
private ActionListener listener; |
95 |
private DocumentListener docList; |
94 |
private ActionListener listItemChangedListener; |
96 |
private MavenOptionController controller; |
95 |
private MavenOptionController controller; |
97 |
private TextValueCompleter completer; |
96 |
private TextValueCompleter completer; |
|
|
97 |
private List<MavenRuntime> userDefinedMavenRuntimes = new ArrayList<MavenRuntime>(); |
98 |
private List<MavenRuntime> predefinedRuntimes = new ArrayList<MavenRuntime>(); |
99 |
private DefaultComboBoxModel mavenHomeDataModel = new DefaultComboBoxModel(); |
100 |
private MavenRuntime activeMavenRuntime = null; |
101 |
private int lastSelected = -1; |
102 |
|
103 |
private class ComboBoxRenderer extends JLabel implements ListCellRenderer { |
104 |
|
105 |
private JSeparator separator; |
106 |
|
107 |
public ComboBoxRenderer() { |
108 |
setOpaque(true); |
109 |
setBorder(new EmptyBorder(1, 1, 1, 1)); |
110 |
separator = new JSeparator(JSeparator.HORIZONTAL); |
111 |
} |
112 |
|
113 |
@Override |
114 |
public Component getListCellRendererComponent(JList list, Object value, |
115 |
int index, boolean isSelected, boolean cellHasFocus) { |
116 |
if (SEPARATOR.equals(value)) { |
117 |
return separator; |
118 |
} |
119 |
if (isSelected) { |
120 |
setBackground(list.getSelectionBackground()); |
121 |
setForeground(list.getSelectionForeground()); |
122 |
} else { |
123 |
setBackground(list.getBackground()); |
124 |
setForeground(list.getForeground()); |
125 |
} |
126 |
|
127 |
setFont(list.getFont()); |
128 |
setText(value.toString()); |
129 |
return this; |
130 |
} |
131 |
}; |
98 |
|
132 |
|
99 |
/** Creates new form SettingsPanel */ |
133 |
/** Creates new form SettingsPanel */ |
100 |
SettingsPanel(MavenOptionController controller) { |
134 |
SettingsPanel(MavenOptionController controller) { |
Lines 104-109
Link Here
|
104 |
comBinaries.setModel(new DefaultComboBoxModel(downloads)); |
138 |
comBinaries.setModel(new DefaultComboBoxModel(downloads)); |
105 |
comJavadoc.setModel(new DefaultComboBoxModel(downloads)); |
139 |
comJavadoc.setModel(new DefaultComboBoxModel(downloads)); |
106 |
comSource.setModel(new DefaultComboBoxModel(downloads)); |
140 |
comSource.setModel(new DefaultComboBoxModel(downloads)); |
|
|
141 |
comMavenHome.setModel(mavenHomeDataModel); |
107 |
|
142 |
|
108 |
ListCellRenderer rend = new DefaultListCellRenderer() { |
143 |
ListCellRenderer rend = new DefaultListCellRenderer() { |
109 |
@Override |
144 |
@Override |
Lines 122-147
Link Here
|
122 |
comBinaries.setRenderer(rend); |
157 |
comBinaries.setRenderer(rend); |
123 |
comSource.setRenderer(rend); |
158 |
comSource.setRenderer(rend); |
124 |
comJavadoc.setRenderer(rend); |
159 |
comJavadoc.setRenderer(rend); |
|
|
160 |
comMavenHome.setRenderer(new ComboBoxRenderer()); |
125 |
|
161 |
|
126 |
this.controller = controller; |
162 |
this.controller = controller; |
127 |
docList = new DocumentListener() { |
163 |
listItemChangedListener = new ActionListener() { |
128 |
public void insertUpdate(DocumentEvent e) { |
164 |
|
129 |
documentChanged(e); |
165 |
@Override |
|
|
166 |
public void actionPerformed(ActionEvent e) { |
167 |
if (SEPARATOR.equals(comMavenHome.getSelectedItem())) { |
168 |
comMavenHome.setSelectedIndex(lastSelected); |
169 |
return; |
170 |
} |
171 |
|
172 |
int selected = comMavenHome.getSelectedIndex(); |
173 |
if (selected == mavenHomeDataModel.getSize() - 1) { |
174 |
// clear all user defined runtimes |
175 |
if (userDefinedMavenRuntimes.isEmpty()) { |
176 |
comMavenHome.setSelectedIndex(lastSelected); |
177 |
return; |
178 |
} |
179 |
|
180 |
int count = userDefinedMavenRuntimes.size() + 1; |
181 |
userDefinedMavenRuntimes.clear(); |
182 |
for (int i = 0; i < count; ++i) { |
183 |
mavenHomeDataModel.removeElementAt(predefinedRuntimes.size()); |
184 |
} |
185 |
|
186 |
lastSelected = 0; |
187 |
comMavenHome.setSelectedIndex(lastSelected); |
188 |
return; |
189 |
} |
190 |
|
191 |
if (selected == mavenHomeDataModel.getSize() - 2) { |
192 |
// browse |
193 |
comMavenHome.setSelectedIndex(lastSelected); |
194 |
SwingUtilities.invokeLater(new Runnable() { |
195 |
|
196 |
@Override |
197 |
public void run() { |
198 |
browseAddNewRuntime(); |
199 |
} |
200 |
|
201 |
}); |
202 |
return; |
203 |
} |
204 |
|
205 |
listDataChanged(); |
206 |
lastSelected = selected; |
130 |
} |
207 |
} |
131 |
public void removeUpdate(DocumentEvent e) { |
208 |
|
132 |
documentChanged(e); |
|
|
133 |
} |
134 |
public void changedUpdate(DocumentEvent e) { |
135 |
documentChanged(e); |
136 |
} |
137 |
}; |
209 |
}; |
138 |
initValues(); |
210 |
initValues(); |
139 |
((MyJTextField)txtLocalRepository).setHintText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "txt_default_repository")); |
211 |
((JHintedTextField)txtLocalRepository).setHintText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "txt_default_repository")); |
140 |
listener = new ActionListenerImpl(); |
212 |
listener = new ActionListenerImpl(); |
141 |
cbSnapshots.addActionListener(listener); |
213 |
cbSnapshots.addActionListener(listener); |
142 |
comIndex.addActionListener(listener); |
214 |
comIndex.addActionListener(listener); |
143 |
completer = new TextValueCompleter(getGlobalOptions(), txtOptions, " "); //NOI18N |
215 |
completer = new TextValueCompleter(getGlobalOptions(), txtOptions, " "); //NOI18N |
144 |
initEmbeddedVersion(); |
|
|
145 |
} |
216 |
} |
146 |
|
217 |
|
147 |
static String[] AVAILABLE_OPTIONS = new String[] { |
218 |
static String[] AVAILABLE_OPTIONS = new String[] { |
Lines 183-289
Link Here
|
183 |
return Arrays.asList(AVAILABLE_OPTIONS); |
254 |
return Arrays.asList(AVAILABLE_OPTIONS); |
184 |
} |
255 |
} |
185 |
|
256 |
|
186 |
private void initEmbeddedVersion() |
|
|
187 |
{ |
188 |
//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 |
190 |
//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 |
|
193 |
// InputStream resourceAsStream; |
194 |
// try { |
195 |
// Properties properties = new Properties(); |
196 |
// resourceAsStream = EmbedderFactory.class.getClassLoader().getResourceAsStream( "META-INF/maven/org.apache.maven/maven-core/pom.properties" ); //NOI18N |
197 |
// properties.load( resourceAsStream ); |
198 |
// |
199 |
// if ( properties.getProperty( "builtOn" ) != null ) { //NOI18N |
200 |
// lblEmbeddedVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion1", |
201 |
// properties.getProperty( "version", "unknown" ), properties.getProperty( "builtOn" ))); |
202 |
// } else { |
203 |
// lblEmbeddedVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion2", properties.getProperty( "version", "unknown" ))); |
204 |
// } |
205 |
// } |
206 |
// catch ( IOException e ) { |
207 |
// lblEmbeddedVersion.setText(NbBundle.getMessage(SettingsPanel.class, "LBL_MavenVersion3")); |
208 |
// } |
209 |
} |
210 |
|
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() { |
257 |
private void initValues() { |
266 |
comIndex.setSelectedIndex(0); |
258 |
comIndex.setSelectedIndex(0); |
267 |
cbSnapshots.setSelected(true); |
259 |
cbSnapshots.setSelected(true); |
268 |
} |
260 |
} |
269 |
|
261 |
|
270 |
private void documentChanged(DocumentEvent e) { |
262 |
private MavenRuntime getSelectedRuntime(int selected) { |
|
|
263 |
if (selected < 0) { |
264 |
return null; |
265 |
} |
266 |
|
267 |
if (selected < predefinedRuntimes.size()) { |
268 |
return predefinedRuntimes.get(selected); |
269 |
|
270 |
} else if (!userDefinedMavenRuntimes.isEmpty() && |
271 |
selected - predefinedRuntimes.size() <= userDefinedMavenRuntimes.size()) { |
272 |
return userDefinedMavenRuntimes.get(selected - 1 - predefinedRuntimes.size()); |
273 |
} |
274 |
|
275 |
return null; |
276 |
} |
277 |
|
278 |
private void listDataChanged() { |
271 |
changed = true; |
279 |
changed = true; |
272 |
boolean oldvalid = valid; |
280 |
boolean oldvalid = valid; |
273 |
if (txtCommandLine.getText().trim().length() > 0) { |
281 |
int selected = comMavenHome.getSelectedIndex(); |
274 |
File fil = new File(txtCommandLine.getText()); |
282 |
String path = null; |
|
|
283 |
if (selected >= 0) { |
284 |
MavenRuntime runtime = getSelectedRuntime(selected); |
285 |
if (runtime != null) { |
286 |
activeMavenRuntime = runtime; |
287 |
if (!runtime.isExternal()) { |
288 |
path = null; |
289 |
valid = true; |
290 |
lblExternalVersion.setText(runtime.getVersion()); |
291 |
|
292 |
} else { |
293 |
path = runtime.getPath(); |
294 |
} |
295 |
|
296 |
} else { |
297 |
path = (String) mavenHomeDataModel.getElementAt(selected); |
298 |
activeMavenRuntime = new MavenRuntime(path, ""); |
299 |
userDefinedMavenRuntimes.add(activeMavenRuntime); |
300 |
} |
301 |
} |
302 |
|
303 |
if (path != null) { |
304 |
path = path.trim(); |
305 |
File fil = new File(path); |
306 |
String ver = null; |
275 |
if (fil.exists() && new File(fil, "bin" + File.separator + "mvn").exists()) { //NOI18N |
307 |
if (fil.exists() && new File(fil, "bin" + File.separator + "mvn").exists()) { //NOI18N |
|
|
308 |
ver = MavenUtil.getExternalVersion(path); |
309 |
} |
310 |
|
311 |
if (ver != null) { |
312 |
lblExternalVersion.setText(ver); |
276 |
valid = true; |
313 |
valid = true; |
|
|
314 |
activeMavenRuntime.setVersion(ver); |
315 |
|
277 |
} else { |
316 |
} else { |
278 |
valid = false; |
317 |
lblExternalVersion.setText(NbBundle.getMessage(SettingsPanel.class, "ERR_NoValidInstallation")); |
279 |
} |
318 |
} |
280 |
} else { |
|
|
281 |
valid = true; |
282 |
} |
319 |
} |
|
|
320 |
|
283 |
if (oldvalid != valid) { |
321 |
if (oldvalid != valid) { |
284 |
controller.firePropChange(MavenOptionController.PROP_VALID, Boolean.valueOf(oldvalid), Boolean.valueOf(valid)); |
322 |
controller.firePropChange(MavenOptionController.PROP_VALID, Boolean.valueOf(oldvalid), Boolean.valueOf(valid)); |
285 |
} |
323 |
} |
286 |
initExternalVersion(); |
|
|
287 |
} |
324 |
} |
288 |
|
325 |
|
289 |
private ComboBoxModel createComboModel() { |
326 |
private ComboBoxModel createComboModel() { |
Lines 308-324
Link Here
|
308 |
bgPlugins = new javax.swing.ButtonGroup(); |
345 |
bgPlugins = new javax.swing.ButtonGroup(); |
309 |
bgFailure = new javax.swing.ButtonGroup(); |
346 |
bgFailure = new javax.swing.ButtonGroup(); |
310 |
lblCommandLine = new javax.swing.JLabel(); |
347 |
lblCommandLine = new javax.swing.JLabel(); |
311 |
txtCommandLine = new javax.swing.JTextField(); |
|
|
312 |
btnCommandLine = new javax.swing.JButton(); |
313 |
lblExternalVersion = new javax.swing.JLabel(); |
348 |
lblExternalVersion = new javax.swing.JLabel(); |
314 |
lblOptions = new javax.swing.JLabel(); |
349 |
lblOptions = new javax.swing.JLabel(); |
315 |
txtOptions = new javax.swing.JTextField(); |
350 |
txtOptions = new javax.swing.JTextField(); |
316 |
btnOptions = new javax.swing.JButton(); |
351 |
btnOptions = new javax.swing.JButton(); |
317 |
cbSkipTests = new javax.swing.JCheckBox(); |
352 |
cbSkipTests = new javax.swing.JCheckBox(); |
318 |
lblLocalRepository = new javax.swing.JLabel(); |
353 |
lblLocalRepository = new javax.swing.JLabel(); |
319 |
txtLocalRepository = new MyJTextField(); |
354 |
txtLocalRepository = new org.netbeans.modules.maven.options.JHintedTextField(); |
320 |
btnLocalRepository = new javax.swing.JButton(); |
355 |
btnLocalRepository = new javax.swing.JButton(); |
321 |
lblEmbeddedVersion = new javax.swing.JLabel(); |
|
|
322 |
lblBinaries = new javax.swing.JLabel(); |
356 |
lblBinaries = new javax.swing.JLabel(); |
323 |
comBinaries = new javax.swing.JComboBox(); |
357 |
comBinaries = new javax.swing.JComboBox(); |
324 |
lblJavadoc = new javax.swing.JLabel(); |
358 |
lblJavadoc = new javax.swing.JLabel(); |
Lines 332-349
Link Here
|
332 |
comIndex = new javax.swing.JComboBox(); |
366 |
comIndex = new javax.swing.JComboBox(); |
333 |
btnIndex = new javax.swing.JButton(); |
367 |
btnIndex = new javax.swing.JButton(); |
334 |
cbSnapshots = new javax.swing.JCheckBox(); |
368 |
cbSnapshots = new javax.swing.JCheckBox(); |
|
|
369 |
comMavenHome = new javax.swing.JComboBox(); |
335 |
|
370 |
|
336 |
org.openide.awt.Mnemonics.setLocalizedText(lblCommandLine, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblCommandLine.text")); // NOI18N |
371 |
org.openide.awt.Mnemonics.setLocalizedText(lblCommandLine, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblCommandLine.text")); // NOI18N |
337 |
|
372 |
|
338 |
txtCommandLine.setText(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.txtCommandLine.text")); // NOI18N |
|
|
339 |
|
340 |
org.openide.awt.Mnemonics.setLocalizedText(btnCommandLine, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnCommandLine.text")); // NOI18N |
341 |
btnCommandLine.addActionListener(new java.awt.event.ActionListener() { |
342 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
343 |
btnCommandLineActionPerformed(evt); |
344 |
} |
345 |
}); |
346 |
|
347 |
org.openide.awt.Mnemonics.setLocalizedText(lblExternalVersion, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblExternalVersion.text", new Object[] {})); // NOI18N |
373 |
org.openide.awt.Mnemonics.setLocalizedText(lblExternalVersion, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblExternalVersion.text", new Object[] {})); // NOI18N |
348 |
|
374 |
|
349 |
org.openide.awt.Mnemonics.setLocalizedText(lblOptions, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblOptions.text")); // NOI18N |
375 |
org.openide.awt.Mnemonics.setLocalizedText(lblOptions, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblOptions.text")); // NOI18N |
Lines 366-373
Link Here
|
366 |
} |
392 |
} |
367 |
}); |
393 |
}); |
368 |
|
394 |
|
369 |
org.openide.awt.Mnemonics.setLocalizedText(lblEmbeddedVersion, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblEmbeddedVersion.text")); // NOI18N |
|
|
370 |
|
371 |
lblBinaries.setLabelFor(comBinaries); |
395 |
lblBinaries.setLabelFor(comBinaries); |
372 |
org.openide.awt.Mnemonics.setLocalizedText(lblBinaries, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblBinaries.text")); // NOI18N |
396 |
org.openide.awt.Mnemonics.setLocalizedText(lblBinaries, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblBinaries.text")); // NOI18N |
373 |
|
397 |
|
Lines 410-474
Link Here
|
410 |
.addContainerGap() |
434 |
.addContainerGap() |
411 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
435 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
412 |
.add(layout.createSequentialGroup() |
436 |
.add(layout.createSequentialGroup() |
|
|
437 |
.add(lblCommandLine) |
438 |
.add(31, 31, 31) |
413 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
439 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
414 |
.add(lblCommandLine) |
440 |
.add(comMavenHome, 0, 394, Short.MAX_VALUE) |
415 |
.add(lblOptions) |
441 |
.add(lblExternalVersion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)) |
416 |
.add(lblLocalRepository)) |
442 |
.add(137, 137, 137)) |
417 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
443 |
.add(layout.createSequentialGroup() |
418 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
444 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
419 |
.add(lblEmbeddedVersion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE) |
445 |
.add(layout.createSequentialGroup() |
|
|
446 |
.add(12, 12, 12) |
447 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
448 |
.add(lblJavadoc) |
449 |
.add(lblBinaries) |
450 |
.add(lblSource) |
451 |
.add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 570, Short.MAX_VALUE)) |
452 |
.add(106, 106, 106)) |
453 |
.add(btnGoals) |
420 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
454 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
421 |
.add(txtCommandLine, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE) |
455 |
.add(lblIndex) |
|
|
456 |
.add(18, 18, 18) |
457 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
458 |
.add(org.jdesktop.layout.GroupLayout.LEADING, cbSnapshots) |
459 |
.add(comIndex, 0, 398, Short.MAX_VALUE)) |
422 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
460 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
423 |
.add(btnCommandLine)) |
461 |
.add(btnIndex)) |
424 |
.add(lblExternalVersion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE) |
462 |
.add(layout.createSequentialGroup() |
425 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
|
|
426 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
463 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
427 |
.add(comSource, 0, 387, Short.MAX_VALUE) |
464 |
.add(lblOptions) |
428 |
.add(comJavadoc, 0, 387, Short.MAX_VALUE) |
465 |
.add(lblLocalRepository) |
429 |
.add(comBinaries, 0, 387, Short.MAX_VALUE) |
466 |
.add(jLabel1)) |
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) |
467 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
433 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
468 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
434 |
.add(btnLocalRepository) |
469 |
.add(cbSkipTests) |
435 |
.add(btnOptions))) |
470 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
436 |
.add(cbSkipTests))) |
471 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
437 |
.add(jLabel1) |
472 |
.add(org.jdesktop.layout.GroupLayout.LEADING, comSource, 0, 394, Short.MAX_VALUE) |
438 |
.add(layout.createSequentialGroup() |
473 |
.add(org.jdesktop.layout.GroupLayout.LEADING, comJavadoc, 0, 394, Short.MAX_VALUE) |
439 |
.add(12, 12, 12) |
474 |
.add(org.jdesktop.layout.GroupLayout.LEADING, comBinaries, 0, 394, Short.MAX_VALUE) |
440 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
475 |
.add(org.jdesktop.layout.GroupLayout.LEADING, txtLocalRepository, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) |
441 |
.add(lblJavadoc) |
476 |
.add(org.jdesktop.layout.GroupLayout.LEADING, txtOptions, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)) |
442 |
.add(lblBinaries) |
477 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
443 |
.add(lblSource) |
478 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
444 |
.add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)) |
479 |
.add(btnLocalRepository) |
445 |
.add(106, 106, 106)) |
480 |
.add(btnOptions)))))) |
446 |
.add(btnGoals) |
481 |
.addContainerGap()))) |
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()) |
456 |
); |
482 |
); |
457 |
|
483 |
|
458 |
layout.linkSize(new java.awt.Component[] {btnCommandLine, btnIndex, btnLocalRepository, btnOptions}, org.jdesktop.layout.GroupLayout.HORIZONTAL); |
484 |
layout.linkSize(new java.awt.Component[] {btnIndex, btnLocalRepository, btnOptions}, org.jdesktop.layout.GroupLayout.HORIZONTAL); |
459 |
|
485 |
|
460 |
layout.setVerticalGroup( |
486 |
layout.setVerticalGroup( |
461 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
487 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
462 |
.add(layout.createSequentialGroup() |
488 |
.add(layout.createSequentialGroup() |
463 |
.add(lblEmbeddedVersion) |
489 |
.addContainerGap() |
464 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
|
465 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
490 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
466 |
.add(lblCommandLine) |
491 |
.add(comMavenHome, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
467 |
.add(txtCommandLine, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
492 |
.add(lblCommandLine)) |
468 |
.add(btnCommandLine)) |
493 |
.add(8, 8, 8) |
469 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
|
470 |
.add(lblExternalVersion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
494 |
.add(lblExternalVersion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
471 |
.add(18, 18, 18) |
495 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) |
472 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
496 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
473 |
.add(lblOptions) |
497 |
.add(lblOptions) |
474 |
.add(txtOptions, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
498 |
.add(txtOptions, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
Lines 480-486
Link Here
|
480 |
.add(txtLocalRepository, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
504 |
.add(txtLocalRepository, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
481 |
.add(btnLocalRepository) |
505 |
.add(btnLocalRepository) |
482 |
.add(lblLocalRepository)) |
506 |
.add(lblLocalRepository)) |
483 |
.add(16, 16, 16) |
507 |
.add(18, 18, 18) |
484 |
.add(jLabel1) |
508 |
.add(jLabel1) |
485 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
509 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
486 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
510 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
Lines 505-511
Link Here
|
505 |
.add(comIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
529 |
.add(comIndex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
506 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
530 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
507 |
.add(cbSnapshots) |
531 |
.add(cbSnapshots) |
508 |
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
532 |
.addContainerGap(37, Short.MAX_VALUE)) |
509 |
); |
533 |
); |
510 |
}// </editor-fold>//GEN-END:initComponents |
534 |
}// </editor-fold>//GEN-END:initComponents |
511 |
|
535 |
|
Lines 533-539
Link Here
|
533 |
chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select")); |
557 |
chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select")); |
534 |
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
558 |
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
535 |
chooser.setFileHidingEnabled(false); |
559 |
chooser.setFileHidingEnabled(false); |
536 |
String path = ((MyJTextField)txtLocalRepository).getRealText(); |
560 |
String path = ((JHintedTextField)txtLocalRepository).getRealText(); |
537 |
if (path.trim().length() == 0) { |
561 |
if (path.trim().length() == 0) { |
538 |
path = new File(System.getProperty("user.home"), ".m2").getAbsolutePath(); //NOI18N |
562 |
path = new File(System.getProperty("user.home"), ".m2").getAbsolutePath(); //NOI18N |
539 |
} |
563 |
} |
Lines 545-562
Link Here
|
545 |
} |
569 |
} |
546 |
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { |
570 |
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { |
547 |
File projectDir = chooser.getSelectedFile(); |
571 |
File projectDir = chooser.getSelectedFile(); |
548 |
((MyJTextField)txtLocalRepository).setRealText(FileUtil.normalizeFile(projectDir).getAbsolutePath()); |
572 |
((JHintedTextField)txtLocalRepository).setRealText(FileUtil.normalizeFile(projectDir).getAbsolutePath()); |
549 |
} |
573 |
} |
550 |
}//GEN-LAST:event_btnLocalRepositoryActionPerformed |
574 |
}//GEN-LAST:event_btnLocalRepositoryActionPerformed |
551 |
|
575 |
|
552 |
private void btnCommandLineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCommandLineActionPerformed |
576 |
private void browseAddNewRuntime() { |
553 |
JFileChooser chooser = new JFileChooser(); |
577 |
JFileChooser chooser = new JFileChooser(); |
554 |
FileUtil.preventFileChooserSymlinkTraversal(chooser, null); |
578 |
FileUtil.preventFileChooserSymlinkTraversal(chooser, null); |
555 |
chooser.setDialogTitle(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "TIT_Select2")); |
579 |
chooser.setDialogTitle(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "TIT_Select2")); |
556 |
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
580 |
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
557 |
chooser.setFileHidingEnabled(false); |
581 |
chooser.setFileHidingEnabled(false); |
558 |
String path = txtCommandLine.getText(); |
582 |
int selected = comMavenHome.getSelectedIndex(); |
559 |
if (path.trim().length() == 0) { |
583 |
MavenRuntime selectedRuntime = getSelectedRuntime(selected); |
|
|
584 |
String path = selectedRuntime != null && selectedRuntime.isExternal() ? |
585 |
selectedRuntime.getPath() : null; |
586 |
if (path == null || path.trim().length() == 0) { |
560 |
path = new File(System.getProperty("user.home")).getAbsolutePath(); //NOI18N |
587 |
path = new File(System.getProperty("user.home")).getAbsolutePath(); //NOI18N |
561 |
} |
588 |
} |
562 |
if (path.length() > 0) { |
589 |
if (path.length() > 0) { |
Lines 567-577
Link Here
|
567 |
} |
594 |
} |
568 |
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { |
595 |
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { |
569 |
File projectDir = chooser.getSelectedFile(); |
596 |
File projectDir = chooser.getSelectedFile(); |
570 |
txtCommandLine.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath()); |
597 |
String newRuntimePath = FileUtil.normalizeFile(projectDir).getAbsolutePath(); |
|
|
598 |
boolean existed = false; |
599 |
List<MavenRuntime> runtimes = new ArrayList<MavenRuntime>(); |
600 |
runtimes.addAll(predefinedRuntimes); |
601 |
runtimes.addAll(userDefinedMavenRuntimes); |
602 |
for (MavenRuntime runtime : runtimes) { |
603 |
if (runtime.getPath().equals(newRuntimePath)) { |
604 |
existed = true; |
605 |
} |
606 |
} |
607 |
if (!existed) { |
608 |
// do not add duplicated directory |
609 |
if (userDefinedMavenRuntimes.isEmpty()) { |
610 |
mavenHomeDataModel.insertElementAt(SEPARATOR, predefinedRuntimes.size()); |
611 |
} |
612 |
mavenHomeDataModel.insertElementAt(newRuntimePath, runtimes.size() + 1); |
613 |
} |
614 |
comMavenHome.setSelectedItem(newRuntimePath); |
571 |
} |
615 |
} |
572 |
|
616 |
} |
573 |
}//GEN-LAST:event_btnCommandLineActionPerformed |
617 |
|
574 |
|
|
|
575 |
private void btnGoalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGoalsActionPerformed |
618 |
private void btnGoalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGoalsActionPerformed |
576 |
NbGlobalActionGoalProvider provider = null; |
619 |
NbGlobalActionGoalProvider provider = null; |
577 |
for (MavenActionsProvider prov : Lookup.getDefault().lookupAll(MavenActionsProvider.class)) { |
620 |
for (MavenActionsProvider prov : Lookup.getDefault().lookupAll(MavenActionsProvider.class)) { |
Lines 612-618
Link Here
|
612 |
private javax.swing.ButtonGroup bgChecksums; |
655 |
private javax.swing.ButtonGroup bgChecksums; |
613 |
private javax.swing.ButtonGroup bgFailure; |
656 |
private javax.swing.ButtonGroup bgFailure; |
614 |
private javax.swing.ButtonGroup bgPlugins; |
657 |
private javax.swing.ButtonGroup bgPlugins; |
615 |
private javax.swing.JButton btnCommandLine; |
|
|
616 |
private javax.swing.JButton btnGoals; |
658 |
private javax.swing.JButton btnGoals; |
617 |
private javax.swing.JButton btnIndex; |
659 |
private javax.swing.JButton btnIndex; |
618 |
private javax.swing.JButton btnLocalRepository; |
660 |
private javax.swing.JButton btnLocalRepository; |
Lines 622-656
Link Here
|
622 |
private javax.swing.JComboBox comBinaries; |
664 |
private javax.swing.JComboBox comBinaries; |
623 |
private javax.swing.JComboBox comIndex; |
665 |
private javax.swing.JComboBox comIndex; |
624 |
private javax.swing.JComboBox comJavadoc; |
666 |
private javax.swing.JComboBox comJavadoc; |
|
|
667 |
private javax.swing.JComboBox comMavenHome; |
625 |
private javax.swing.JComboBox comSource; |
668 |
private javax.swing.JComboBox comSource; |
626 |
private javax.swing.JLabel jLabel1; |
669 |
private javax.swing.JLabel jLabel1; |
627 |
private javax.swing.JLabel jLabel3; |
670 |
private javax.swing.JLabel jLabel3; |
628 |
private javax.swing.JLabel lblBinaries; |
671 |
private javax.swing.JLabel lblBinaries; |
629 |
private javax.swing.JLabel lblCommandLine; |
672 |
private javax.swing.JLabel lblCommandLine; |
630 |
private javax.swing.JLabel lblEmbeddedVersion; |
|
|
631 |
private javax.swing.JLabel lblExternalVersion; |
673 |
private javax.swing.JLabel lblExternalVersion; |
632 |
private javax.swing.JLabel lblIndex; |
674 |
private javax.swing.JLabel lblIndex; |
633 |
private javax.swing.JLabel lblJavadoc; |
675 |
private javax.swing.JLabel lblJavadoc; |
634 |
private javax.swing.JLabel lblLocalRepository; |
676 |
private javax.swing.JLabel lblLocalRepository; |
635 |
private javax.swing.JLabel lblOptions; |
677 |
private javax.swing.JLabel lblOptions; |
636 |
private javax.swing.JLabel lblSource; |
678 |
private javax.swing.JLabel lblSource; |
637 |
private javax.swing.JTextField txtCommandLine; |
|
|
638 |
private javax.swing.JTextField txtLocalRepository; |
679 |
private javax.swing.JTextField txtLocalRepository; |
639 |
private javax.swing.JTextField txtOptions; |
680 |
private javax.swing.JTextField txtOptions; |
640 |
// End of variables declaration//GEN-END:variables |
681 |
// End of variables declaration//GEN-END:variables |
641 |
|
682 |
|
642 |
public void setValues() { |
683 |
public void setValues() { |
643 |
txtOptions.setText(MavenSettings.getDefault().getDefaultOptions()); |
684 |
txtOptions.setText(MavenSettings.getDefault().getDefaultOptions()); |
644 |
txtCommandLine.getDocument().removeDocumentListener(docList); |
685 |
|
|
|
686 |
predefinedRuntimes.clear(); |
687 |
predefinedRuntimes.addAll(MavenSettings.getDefault().getPredefinedMavenRuntimes()); |
688 |
userDefinedMavenRuntimes.clear(); |
689 |
userDefinedMavenRuntimes.addAll(MavenSettings.getDefault().getUserDefinedMavenRuntimes()); |
690 |
comMavenHome.removeActionListener(listItemChangedListener); |
691 |
mavenHomeDataModel.removeAllElements(); |
645 |
File command = MavenSettings.getDefault().getCommandLinePath(); |
692 |
File command = MavenSettings.getDefault().getCommandLinePath(); |
646 |
txtCommandLine.setText(command != null ? command.getAbsolutePath() : ""); //NOI18N |
693 |
String embedded = null; |
647 |
initExternalVersion(); |
694 |
for (MavenRuntime runtime : predefinedRuntimes) { |
648 |
txtCommandLine.getDocument().addDocumentListener(docList); |
695 |
String desc = org.openide.util.NbBundle.getMessage(SettingsPanel.class, |
|
|
696 |
(runtime.isExternal() ? "MAVEN_RUNTIME_External" : "MAVEN_RUNTIME_Embedded"), |
697 |
new Object[]{runtime.getPath(), runtime.getVersion()}); // NOI18N |
698 |
mavenHomeDataModel.addElement(desc); |
699 |
if (embedded == null && !runtime.isExternal()) { |
700 |
embedded = desc; |
701 |
} |
702 |
} |
703 |
|
704 |
if (!userDefinedMavenRuntimes.isEmpty()) { |
705 |
mavenHomeDataModel.addElement(SEPARATOR); |
706 |
for (MavenRuntime runtime : userDefinedMavenRuntimes) { |
707 |
String desc = org.openide.util.NbBundle.getMessage(SettingsPanel.class, |
708 |
"MAVEN_RUNTIME_External", |
709 |
new Object[]{runtime.getPath(), runtime.getVersion()}); // NOI18N |
710 |
mavenHomeDataModel.addElement(desc); |
711 |
} |
712 |
} |
713 |
|
714 |
mavenHomeDataModel.addElement(SEPARATOR); |
715 |
mavenHomeDataModel.addElement(org.openide.util.NbBundle.getMessage(SettingsPanel.class, |
716 |
"MAVEN_RUNTIME_Browse")); |
717 |
mavenHomeDataModel.addElement(org.openide.util.NbBundle.getMessage(SettingsPanel.class, |
718 |
"MAVEN_RUNTIME_ClearUserDefines")); |
719 |
comMavenHome.setSelectedItem(command != null ? command.getAbsolutePath() : embedded); //NOI18N |
720 |
listDataChanged(); |
721 |
lastSelected = comMavenHome.getSelectedIndex(); |
722 |
comMavenHome.addActionListener(listItemChangedListener); |
649 |
|
723 |
|
650 |
cbSnapshots.setSelected(RepositoryPreferences.getInstance().isIncludeSnapshots()); |
724 |
cbSnapshots.setSelected(RepositoryPreferences.getInstance().isIncludeSnapshots()); |
651 |
comIndex.setSelectedIndex(RepositoryPreferences.getInstance().getIndexUpdateFrequency()); |
725 |
comIndex.setSelectedIndex(RepositoryPreferences.getInstance().getIndexUpdateFrequency()); |
652 |
String repo = MavenSettings.getDefault().getCustomLocalRepository(); |
726 |
String repo = MavenSettings.getDefault().getCustomLocalRepository(); |
653 |
((MyJTextField)txtLocalRepository).setRealText(repo != null ? repo : ""); |
727 |
((JHintedTextField)txtLocalRepository).setRealText(repo != null ? repo : ""); |
654 |
comBinaries.setSelectedItem(MavenSettings.getDefault().getBinaryDownloadStrategy()); |
728 |
comBinaries.setSelectedItem(MavenSettings.getDefault().getBinaryDownloadStrategy()); |
655 |
comJavadoc.setSelectedItem(MavenSettings.getDefault().getJavadocDownloadStrategy()); |
729 |
comJavadoc.setSelectedItem(MavenSettings.getDefault().getJavadocDownloadStrategy()); |
656 |
comSource.setSelectedItem(MavenSettings.getDefault().getSourceDownloadStrategy()); |
730 |
comSource.setSelectedItem(MavenSettings.getDefault().getSourceDownloadStrategy()); |
Lines 661-669
Link Here
|
661 |
|
735 |
|
662 |
public void applyValues() { |
736 |
public void applyValues() { |
663 |
MavenSettings.getDefault().setDefaultOptions(txtOptions.getText().trim()); |
737 |
MavenSettings.getDefault().setDefaultOptions(txtOptions.getText().trim()); |
664 |
MavenSettings.getDefault().setCustomLocalRepository(((MyJTextField)txtLocalRepository).getRealText()); |
738 |
MavenSettings.getDefault().setCustomLocalRepository(((JHintedTextField)txtLocalRepository).getRealText()); |
665 |
String cl = txtCommandLine.getText().trim(); |
739 |
// remember only user-defined runtimes of RUNTIME_COUNT_LIMIT count at the most |
666 |
if (cl.length() == 0) { |
740 |
List<MavenRuntime> runtimes = new ArrayList<MavenRuntime>(); |
|
|
741 |
runtimes.addAll(predefinedRuntimes); |
742 |
int startIndex = 0, endIndex = userDefinedMavenRuntimes.size(); |
743 |
if (!userDefinedMavenRuntimes.isEmpty() && endIndex - startIndex > RUNTIME_COUNT_LIMIT) { |
744 |
int selected = comMavenHome.getSelectedIndex() - predefinedRuntimes.size() - 1; |
745 |
if (selected < 0) { |
746 |
selected = 0; |
747 |
} |
748 |
if (selected + RUNTIME_COUNT_LIMIT < endIndex) { |
749 |
endIndex = selected + RUNTIME_COUNT_LIMIT; |
750 |
} |
751 |
if (endIndex - RUNTIME_COUNT_LIMIT > startIndex) { |
752 |
startIndex = endIndex - RUNTIME_COUNT_LIMIT; |
753 |
} |
754 |
} |
755 |
runtimes.addAll(userDefinedMavenRuntimes.subList(startIndex, endIndex)); |
756 |
MavenSettings.getDefault().setMavenRuntimes(runtimes); |
757 |
String cl = activeMavenRuntime != null ? activeMavenRuntime.getPath() : null; |
758 |
if (cl != null && cl.length() == 0) { |
667 |
cl = null; |
759 |
cl = null; |
668 |
} |
760 |
} |
669 |
//MEVENIDE-553 |
761 |
//MEVENIDE-553 |