Lines 45-62
Link Here
|
45 |
package org.netbeans.modules.apisupport.project.ui.wizard.winsys; |
45 |
package org.netbeans.modules.apisupport.project.ui.wizard.winsys; |
46 |
|
46 |
|
47 |
import java.awt.Cursor; |
47 |
import java.awt.Cursor; |
|
|
48 |
import java.awt.EventQueue; |
49 |
import java.io.File; |
48 |
import java.io.IOException; |
50 |
import java.io.IOException; |
49 |
import java.util.ArrayList; |
51 |
import java.util.ArrayList; |
50 |
import java.util.Collection; |
52 |
import java.util.Collection; |
|
|
53 |
import java.util.Properties; |
54 |
import java.util.Set; |
55 |
import java.util.TreeSet; |
51 |
import javax.swing.DefaultComboBoxModel; |
56 |
import javax.swing.DefaultComboBoxModel; |
|
|
57 |
import org.apache.tools.ant.module.api.support.ActionUtils; |
58 |
import org.netbeans.api.project.Project; |
59 |
import org.netbeans.modules.apisupport.project.NbModuleProject; |
60 |
import org.netbeans.modules.apisupport.project.Util; |
52 |
import org.netbeans.modules.apisupport.project.layers.LayerUtils; |
61 |
import org.netbeans.modules.apisupport.project.layers.LayerUtils; |
53 |
import org.netbeans.modules.apisupport.project.ui.wizard.BasicWizardIterator; |
62 |
import org.netbeans.modules.apisupport.project.ui.wizard.BasicWizardIterator; |
|
|
63 |
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper; |
54 |
import org.openide.WizardDescriptor; |
64 |
import org.openide.WizardDescriptor; |
|
|
65 |
import org.openide.execution.ExecutorTask; |
55 |
import org.openide.filesystems.FileObject; |
66 |
import org.openide.filesystems.FileObject; |
56 |
import org.openide.filesystems.FileSystem; |
67 |
import org.openide.filesystems.FileSystem; |
|
|
68 |
import org.openide.filesystems.FileUtil; |
57 |
import org.openide.util.AsyncGUIJob; |
69 |
import org.openide.util.AsyncGUIJob; |
|
|
70 |
import org.openide.util.Exceptions; |
58 |
import org.openide.util.HelpCtx; |
71 |
import org.openide.util.HelpCtx; |
59 |
import org.openide.util.NbBundle; |
72 |
import org.openide.util.NbBundle; |
|
|
73 |
import org.openide.util.Task; |
74 |
import org.openide.util.TaskListener; |
60 |
import org.openide.util.Utilities; |
75 |
import org.openide.util.Utilities; |
61 |
|
76 |
|
62 |
/** |
77 |
/** |
Lines 138-143
Link Here
|
138 |
for (FileObject fo : fos) { |
153 |
for (FileObject fo : fos) { |
139 |
if (fo.isData() && "wsmode".equals(fo.getExt())) { //NOI18N |
154 |
if (fo.isData() && "wsmode".equals(fo.getExt())) { //NOI18N |
140 |
col.add(fo.getName()); |
155 |
col.add(fo.getName()); |
|
|
156 |
data.existingMode(fo.getName()); |
141 |
} |
157 |
} |
142 |
} |
158 |
} |
143 |
modes = col.toArray(new String[col.size()]); |
159 |
modes = col.toArray(new String[col.size()]); |
Lines 224-229
Link Here
|
224 |
cbUndockingNotAllowed = new javax.swing.JCheckBox(); |
240 |
cbUndockingNotAllowed = new javax.swing.JCheckBox(); |
225 |
cbDraggingNotAllowed = new javax.swing.JCheckBox(); |
241 |
cbDraggingNotAllowed = new javax.swing.JCheckBox(); |
226 |
cbMaximizationNotAllowed = new javax.swing.JCheckBox(); |
242 |
cbMaximizationNotAllowed = new javax.swing.JCheckBox(); |
|
|
243 |
redefine = new javax.swing.JButton(); |
227 |
|
244 |
|
228 |
setLayout(new java.awt.GridBagLayout()); |
245 |
setLayout(new java.awt.GridBagLayout()); |
229 |
|
246 |
|
Lines 320-325
Link Here
|
320 |
gridBagConstraints.weighty = 0.1; |
337 |
gridBagConstraints.weighty = 0.1; |
321 |
gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0); |
338 |
gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0); |
322 |
add(cbMaximizationNotAllowed, gridBagConstraints); |
339 |
add(cbMaximizationNotAllowed, gridBagConstraints); |
|
|
340 |
|
341 |
org.openide.awt.Mnemonics.setLocalizedText(redefine, "&Redefine..."); |
342 |
redefine.addActionListener(new java.awt.event.ActionListener() { |
343 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
344 |
redefineActionPerformed(evt); |
345 |
} |
346 |
}); |
347 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
348 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_END; |
349 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); |
350 |
add(redefine, gridBagConstraints); |
323 |
}// </editor-fold>//GEN-END:initComponents |
351 |
}// </editor-fold>//GEN-END:initComponents |
324 |
|
352 |
|
325 |
private void windowPosChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_windowPosChanged |
353 |
private void windowPosChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_windowPosChanged |
Lines 330-335
Link Here
|
330 |
if( !cbSlidingNotAllowed.isEnabled() ) |
358 |
if( !cbSlidingNotAllowed.isEnabled() ) |
331 |
cbSlidingNotAllowed.setSelected( false ); |
359 |
cbSlidingNotAllowed.setSelected( false ); |
332 |
}//GEN-LAST:event_windowPosChanged |
360 |
}//GEN-LAST:event_windowPosChanged |
|
|
361 |
|
362 |
private static FileObject findBuildXml(Project project) { |
363 |
return project.getProjectDirectory().getFileObject(GeneratedFilesHelper.BUILD_XML_PATH); |
364 |
} |
365 |
|
366 |
private void redefineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_redefineActionPerformed |
367 |
final Project prj = data.getProject(); |
368 |
final Properties p = new Properties(); |
369 |
redefine.setEnabled(false); |
370 |
redefine.setText("Launching..."); |
371 |
|
372 |
try { |
373 |
FileObject fo = prj.getProjectDirectory().getFileObject("build/designdir"); |
374 |
if (fo != null) { |
375 |
return; |
376 |
} |
377 |
fo = FileUtil.createFolder(prj.getProjectDirectory(), "build/designdir"); |
378 |
final FileObject finalFO = fo; |
379 |
File path = FileUtil.toFile(fo); |
380 |
p.setProperty("run.args", "--nosplash --designlayout --userdir " + path); |
381 |
|
382 |
ExecutorTask task = ActionUtils.runTarget(findBuildXml(prj), new String[] { "run" }, p); |
383 |
class PostProcess implements TaskListener, Runnable { |
384 |
Set<String> modeNames; |
385 |
|
386 |
@Override |
387 |
public void taskFinished(Task task) { |
388 |
FileObject modes = finalFO.getFileObject("config/Windows2Local/Modes"); |
389 |
if (modes != null) { |
390 |
modeNames = new TreeSet<String>(); |
391 |
for (FileObject m : modes.getChildren()) { |
392 |
if (m.isData() && "wsmode".equals(m.getExt())) { //NOI18N |
393 |
modeNames.add(m.getName()); |
394 |
try { |
395 |
data.defineMode(m.getName(), m.asText()); |
396 |
} catch (IOException ex) { |
397 |
Exceptions.printStackTrace(ex); |
398 |
} |
399 |
} |
400 |
} |
401 |
EventQueue.invokeLater(this); |
402 |
} |
403 |
} |
404 |
|
405 |
@Override |
406 |
public void run() { |
407 |
redefine.setEnabled(true); |
408 |
redefine.setText("Redefine..."); |
409 |
int s = comMode.getModel().getSize(); |
410 |
for (int i = 0; i < s; i++) { |
411 |
modeNames.remove((String)comMode.getModel().getElementAt(i)); |
412 |
} |
413 |
boolean first = true; |
414 |
for (String mn : modeNames) { |
415 |
((DefaultComboBoxModel)comMode.getModel()).addElement(mn); |
416 |
if (first) { |
417 |
comMode.getModel().setSelectedItem(mn); |
418 |
} |
419 |
first = false; |
420 |
} |
421 |
} |
422 |
} |
423 |
task.addTaskListener(new PostProcess()); |
424 |
} catch (IOException e) { |
425 |
Util.err.notify(e); |
426 |
} |
427 |
|
428 |
}//GEN-LAST:event_redefineActionPerformed |
333 |
|
429 |
|
334 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
430 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
335 |
private javax.swing.JCheckBox cbClosingNotAllowed; |
431 |
private javax.swing.JCheckBox cbClosingNotAllowed; |
Lines 341-346
Link Here
|
341 |
private javax.swing.JCheckBox cbUndockingNotAllowed; |
437 |
private javax.swing.JCheckBox cbUndockingNotAllowed; |
342 |
private javax.swing.JComboBox comMode; |
438 |
private javax.swing.JComboBox comMode; |
343 |
private javax.swing.JLabel lblMode; |
439 |
private javax.swing.JLabel lblMode; |
|
|
440 |
private javax.swing.JButton redefine; |
344 |
// End of variables declaration//GEN-END:variables |
441 |
// End of variables declaration//GEN-END:variables |
345 |
|
442 |
|
346 |
private void initAccessibility() { |
443 |
private void initAccessibility() { |