Lines 41-46
Link Here
|
41 |
|
41 |
|
42 |
package org.netbeans.modules.autoupdate.ui; |
42 |
package org.netbeans.modules.autoupdate.ui; |
43 |
|
43 |
|
|
|
44 |
import org.netbeans.api.autoupdate.OperationContainer; |
45 |
import org.netbeans.api.autoupdate.OperationSupport; |
44 |
import org.netbeans.modules.autoupdate.ui.wizards.UninstallUnitWizard; |
46 |
import org.netbeans.modules.autoupdate.ui.wizards.UninstallUnitWizard; |
45 |
import org.netbeans.modules.autoupdate.ui.wizards.InstallUnitWizard; |
47 |
import org.netbeans.modules.autoupdate.ui.wizards.InstallUnitWizard; |
46 |
import java.awt.Component; |
48 |
import java.awt.Component; |
Lines 69-74
Link Here
|
69 |
import java.util.prefs.PreferenceChangeListener; |
71 |
import java.util.prefs.PreferenceChangeListener; |
70 |
import java.util.prefs.Preferences; |
72 |
import java.util.prefs.Preferences; |
71 |
import javax.swing.AbstractAction; |
73 |
import javax.swing.AbstractAction; |
|
|
74 |
import javax.swing.AbstractButton; |
72 |
import javax.swing.Action; |
75 |
import javax.swing.Action; |
73 |
import javax.swing.Icon; |
76 |
import javax.swing.Icon; |
74 |
import javax.swing.ImageIcon; |
77 |
import javax.swing.ImageIcon; |
Lines 120-127
Link Here
|
120 |
private String filter = ""; |
123 |
private String filter = ""; |
121 |
private PluginManagerUI manager = null; |
124 |
private PluginManagerUI manager = null; |
122 |
private PopupActionSupport popupActionsSupport; |
125 |
private PopupActionSupport popupActionsSupport; |
123 |
private RowTabAction activateAction; |
126 |
private TabAction activateAction; |
124 |
private RowTabAction deactivateAction; |
127 |
private TabAction deactivateAction; |
125 |
private TabAction reloadAction; |
128 |
private TabAction reloadAction; |
126 |
private RowTabAction moreAction; |
129 |
private RowTabAction moreAction; |
127 |
private RowTabAction lessAction; |
130 |
private RowTabAction lessAction; |
Lines 230-238
Link Here
|
230 |
boolean enabled = !waitingState; |
233 |
boolean enabled = !waitingState; |
231 |
Component[] all = getComponents (); |
234 |
Component[] all = getComponents (); |
232 |
for (Component component : all) { |
235 |
for (Component component : all) { |
233 |
if (component == bTabAction) { |
236 |
if (component == bTabAction || component == bTabAction1 || component == bTabAction2) { |
234 |
if (enabled) { |
237 |
if (enabled) { |
235 |
component.setEnabled (model.getMarkedUnits ().size () > 0); |
238 |
TabAction a = (TabAction) ((AbstractButton)component).getAction(); |
|
|
239 |
component.setEnabled (a == null ? false : a.isEnabled()); |
236 |
} else { |
240 |
} else { |
237 |
component.setEnabled (enabled); |
241 |
component.setEnabled (enabled); |
238 |
} |
242 |
} |
Lines 337-343
Link Here
|
337 |
} else { |
341 |
} else { |
338 |
setSelectionInfo (null, units.size ()); |
342 |
setSelectionInfo (null, units.size ()); |
339 |
} |
343 |
} |
340 |
getDefaultAction ().setEnabled (units.size () > 0); |
344 |
getDefaultAction ().tableDataChanged(units); |
341 |
boolean alreadyScheduled = false; |
345 |
boolean alreadyScheduled = false; |
342 |
if (getDownloadSizeTask != null) { |
346 |
if (getDownloadSizeTask != null) { |
343 |
if (getDownloadSizeTask.getDelay () > 0) { |
347 |
if (getDownloadSizeTask.getDelay () > 0) { |
Lines 382-399
Link Here
|
382 |
|
386 |
|
383 |
activateAction = new ActivateAction (); |
387 |
activateAction = new ActivateAction (); |
384 |
deactivateAction = new DeactivateAction (); |
388 |
deactivateAction = new DeactivateAction (); |
|
|
389 |
UninstallAction uninstall = new UninstallAction(); |
385 |
|
390 |
|
386 |
forPopup = new TabAction[] { |
391 |
forPopup = new TabAction[] { |
387 |
activateAction, deactivateAction,activateCategoryAction,deactivateCategoryAction, |
392 |
activateAction, deactivateAction,activateCategoryAction,deactivateCategoryAction, |
388 |
checkCategoryAction, uncheckCategoryAction, |
393 |
checkCategoryAction, uncheckCategoryAction, |
389 |
checkAllAction, uncheckAllAction, new CheckAction () |
394 |
checkAllAction, uncheckAllAction, new CheckAction (), uninstall |
390 |
}; |
395 |
}; |
|
|
396 |
bTabAction1.setVisible(true); |
397 |
bTabAction2.setVisible(true); |
398 |
bTabAction.setAction(activateAction); |
399 |
bTabAction1.setAction(deactivateAction); |
400 |
bTabAction2.setAction (uninstall); |
401 |
prepareTopButton (reloadAction = new ReloadAction ()); |
402 |
table.setEnableRenderer (new EnableRenderer ()); |
403 |
initReloadTooltip(); |
404 |
break; |
391 |
} |
405 |
} |
392 |
bTabAction.setAction (new UninstallAction ()); |
|
|
393 |
prepareTopButton (reloadAction = new ReloadAction ()); |
394 |
table.setEnableRenderer (new EnableRenderer ()); |
395 |
initReloadTooltip(); |
396 |
break; |
397 |
case UPDATE : |
406 |
case UPDATE : |
398 |
{ |
407 |
{ |
399 |
RowTabAction selectCategoryAction = new CheckCategoryAction (); |
408 |
RowTabAction selectCategoryAction = new CheckCategoryAction (); |
Lines 410-415
Link Here
|
410 |
}; |
419 |
}; |
411 |
} |
420 |
} |
412 |
bTabAction.setAction (new UpdateAction ()); |
421 |
bTabAction.setAction (new UpdateAction ()); |
|
|
422 |
bTabAction1.setVisible(false); |
423 |
bTabAction2.setVisible(false); |
413 |
prepareTopButton (reloadAction = new ReloadAction ()); |
424 |
prepareTopButton (reloadAction = new ReloadAction ()); |
414 |
initReloadTooltip(); |
425 |
initReloadTooltip(); |
415 |
break; |
426 |
break; |
Lines 429-434
Link Here
|
429 |
}; |
440 |
}; |
430 |
} |
441 |
} |
431 |
bTabAction.setAction (new AvailableAction ()); |
442 |
bTabAction.setAction (new AvailableAction ()); |
|
|
443 |
bTabAction1.setVisible(false); |
444 |
bTabAction2.setVisible(false); |
432 |
prepareTopButton (reloadAction = new ReloadAction ()); |
445 |
prepareTopButton (reloadAction = new ReloadAction ()); |
433 |
table.setEnableRenderer (new SourceCategoryRenderer ()); |
446 |
table.setEnableRenderer (new SourceCategoryRenderer ()); |
434 |
initReloadTooltip(); |
447 |
initReloadTooltip(); |
Lines 441-446
Link Here
|
441 |
}; |
454 |
}; |
442 |
} |
455 |
} |
443 |
bTabAction.setAction (new LocalUpdateAction ()); |
456 |
bTabAction.setAction (new LocalUpdateAction ()); |
|
|
457 |
bTabAction1.setVisible(false); |
458 |
bTabAction2.setVisible(false); |
444 |
prepareTopButton (new AddLocallyDownloadedAction ()); |
459 |
prepareTopButton (new AddLocallyDownloadedAction ()); |
445 |
break; |
460 |
break; |
446 |
} |
461 |
} |
Lines 528-536
Link Here
|
528 |
//selectedRow is selected |
543 |
//selectedRow is selected |
529 |
Action action = null; |
544 |
Action action = null; |
530 |
if (activateAction != null && activateAction.isEnabled ()) { |
545 |
if (activateAction != null && activateAction.isEnabled ()) { |
531 |
action = activateAction; |
546 |
//action = activateAction; |
532 |
} else if (deactivateAction != null && deactivateAction.isEnabled ()) { |
547 |
} else if (deactivateAction != null && deactivateAction.isEnabled ()) { |
533 |
action = deactivateAction; |
548 |
//action = deactivateAction; |
534 |
} else if (removeLocallyDownloaded != null && removeLocallyDownloaded.isEnabled ()) { |
549 |
} else if (removeLocallyDownloaded != null && removeLocallyDownloaded.isEnabled ()) { |
535 |
action = removeLocallyDownloaded; |
550 |
action = removeLocallyDownloaded; |
536 |
} |
551 |
} |
Lines 589-594
Link Here
|
589 |
topButton = new javax.swing.JButton(); |
604 |
topButton = new javax.swing.JButton(); |
590 |
lWarning = new javax.swing.JLabel(); |
605 |
lWarning = new javax.swing.JLabel(); |
591 |
advView = new javax.swing.JCheckBox(); |
606 |
advView = new javax.swing.JCheckBox(); |
|
|
607 |
bTabAction1 = new javax.swing.JButton(); |
608 |
bTabAction2 = new javax.swing.JButton(); |
592 |
|
609 |
|
593 |
lSearch.setLabelFor(tfSearch); |
610 |
lSearch.setLabelFor(tfSearch); |
594 |
org.openide.awt.Mnemonics.setLocalizedText(lSearch, org.openide.util.NbBundle.getMessage(UnitTab.class, "lSearch1.text")); // NOI18N |
611 |
org.openide.awt.Mnemonics.setLocalizedText(lSearch, org.openide.util.NbBundle.getMessage(UnitTab.class, "lSearch1.text")); // NOI18N |
Lines 625-633
Link Here
|
625 |
.add(layout.createSequentialGroup() |
642 |
.add(layout.createSequentialGroup() |
626 |
.add(bTabAction) |
643 |
.add(bTabAction) |
627 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
644 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
|
645 |
.add(bTabAction1) |
646 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
647 |
.add(bTabAction2) |
648 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
628 |
.add(lSelectionInfo) |
649 |
.add(lSelectionInfo) |
629 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) |
650 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) |
630 |
.add(lWarning, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE) |
651 |
.add(lWarning, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE) |
631 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
652 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
632 |
.add(advView))) |
653 |
.add(advView))) |
633 |
.addContainerGap()) |
654 |
.addContainerGap()) |
Lines 641-653
Link Here
|
641 |
.add(lSearch) |
662 |
.add(lSearch) |
642 |
.add(topButton)) |
663 |
.add(topButton)) |
643 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
664 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
644 |
.add(spTab, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE) |
665 |
.add(spTab, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE) |
645 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
666 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
646 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER, false) |
667 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER, false) |
647 |
.add(bTabAction) |
668 |
.add(bTabAction) |
648 |
.add(lSelectionInfo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
669 |
.add(lSelectionInfo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
649 |
.add(lWarning) |
670 |
.add(lWarning) |
650 |
.add(advView)) |
671 |
.add(advView) |
|
|
672 |
.add(bTabAction1) |
673 |
.add(bTabAction2)) |
651 |
.addContainerGap()) |
674 |
.addContainerGap()) |
652 |
); |
675 |
); |
653 |
|
676 |
|
Lines 1019-1025
Link Here
|
1019 |
} |
1042 |
} |
1020 |
|
1043 |
|
1021 |
|
1044 |
|
1022 |
public abstract void performerImpl (); |
1045 |
public abstract void performerImpl (); |
1023 |
} |
1046 |
} |
1024 |
|
1047 |
|
1025 |
private abstract class RowTabAction extends TabAction { |
1048 |
private abstract class RowTabAction extends TabAction { |
Lines 1267-1276
Link Here
|
1267 |
} |
1290 |
} |
1268 |
} |
1291 |
} |
1269 |
|
1292 |
|
1270 |
private class ActivateAction extends RowTabAction { |
1293 |
private class ActivateAction extends TabAction { |
1271 |
public ActivateAction () { |
1294 |
public ActivateAction () { |
1272 |
super ("UnitTab_ActivateAction", /*KeyStroke.getKeyStroke (KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK),*/ "EnableDisable"); |
1295 |
super ("UnitTab_ActivateAction", /*KeyStroke.getKeyStroke (KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK),*/ "EnableDisable"); |
1273 |
} |
1296 |
} |
|
|
1297 |
|
1298 |
@Override |
1299 |
public void tableDataChanged(Collection<Unit> units) { |
1300 |
if (units.isEmpty()) { |
1301 |
setEnabled(false); |
1302 |
return; |
1303 |
} |
1304 |
for (Unit u : units) { |
1305 |
if (!isEnabled(u)) { |
1306 |
setEnabled(false); |
1307 |
return; |
1308 |
} |
1309 |
} |
1310 |
setEnabled(true); |
1311 |
} |
1312 |
|
1313 |
@Override |
1314 |
public void performerImpl() { |
1315 |
final int row = getSelectedRow (); |
1316 |
final Map<String, Boolean> state = UnitCategoryTableModel.captureState (model.getUnits ()); |
1317 |
OperationContainer<OperationSupport> c = Containers.forEnable(); |
1318 |
for (Unit u : model.getUnits()) { |
1319 |
if (u.isMarked()) { |
1320 |
c.add(u.updateUnit, u.getRelevantElement()); |
1321 |
} |
1322 |
} |
1323 |
UninstallUnitWizard wizard = new UninstallUnitWizard (); |
1324 |
wizard.invokeWizard (true); |
1325 |
Containers.forEnable ().removeAll (); |
1326 |
restoreSelectedRow(row); |
1327 |
refreshState (); |
1328 |
focusTable (); |
1329 |
} |
1330 |
/* |
1331 |
public void performerImpl (Unit u) { |
1332 |
Unit.Installed unit = (Unit.Installed)u; |
1333 |
final int row = getSelectedRow(); |
1334 |
|
1335 |
if (!unit.getRelevantElement ().isEnabled ()) { |
1336 |
OperationInfo info = Containers.forEnable ().add (unit.updateUnit, unit.getRelevantElement ()); |
1337 |
assert info != null; |
1338 |
UninstallUnitWizard wizard = new UninstallUnitWizard (); |
1339 |
wizard.invokeWizard (true); |
1340 |
Containers.forEnable ().removeAll (); |
1341 |
} |
1342 |
fireUpdataUnitChange (); |
1343 |
restoreSelectedRow(row); |
1344 |
focusTable(); |
1345 |
} |
1346 |
*/ |
1274 |
|
1347 |
|
1275 |
protected boolean isEnabled (Unit u) { |
1348 |
protected boolean isEnabled (Unit u) { |
1276 |
boolean retval = false; |
1349 |
boolean retval = false; |
Lines 1287-1313
Link Here
|
1287 |
return getActionName ()+ " " + u.getDisplayName (); |
1360 |
return getActionName ()+ " " + u.getDisplayName (); |
1288 |
}*/ |
1361 |
}*/ |
1289 |
return getActionName (); |
1362 |
return getActionName (); |
1290 |
} |
|
|
1291 |
public void performerImpl (Unit u) { |
1292 |
Unit.Installed unit = (Unit.Installed)u; |
1293 |
final int row = getSelectedRow(); |
1294 |
|
1295 |
if (!unit.getRelevantElement ().isEnabled ()) { |
1296 |
OperationInfo info = Containers.forEnable ().add (unit.updateUnit, unit.getRelevantElement ()); |
1297 |
assert info != null; |
1298 |
UninstallUnitWizard wizard = new UninstallUnitWizard (); |
1299 |
wizard.invokeWizard (true); |
1300 |
Containers.forEnable ().removeAll (); |
1301 |
} |
1302 |
fireUpdataUnitChange (); |
1303 |
restoreSelectedRow(row); |
1304 |
focusTable(); |
1305 |
} |
1306 |
|
1307 |
|
1308 |
@Override |
1309 |
protected boolean isVisible (Unit u) { |
1310 |
return false; |
1311 |
} |
1363 |
} |
1312 |
} |
1364 |
} |
1313 |
|
1365 |
|
Lines 1372-1382
Link Here
|
1372 |
} |
1424 |
} |
1373 |
|
1425 |
|
1374 |
|
1426 |
|
1375 |
private class DeactivateAction extends RowTabAction { |
1427 |
private class DeactivateAction extends TabAction { |
1376 |
public DeactivateAction () { |
1428 |
public DeactivateAction () { |
1377 |
super ("UnitTab_DeactivateAction", /*KeyStroke.getKeyStroke (KeyEvent.VK_D, KeyEvent.CTRL_DOWN_MASK),*/ "EnableDisable"); |
1429 |
super ("UnitTab_DeactivateAction", /*KeyStroke.getKeyStroke (KeyEvent.VK_D, KeyEvent.CTRL_DOWN_MASK),*/ "EnableDisable"); |
1378 |
} |
1430 |
} |
1379 |
|
1431 |
|
|
|
1432 |
@Override |
1433 |
public void tableDataChanged(Collection<Unit> units) { |
1434 |
if (units.isEmpty()) { |
1435 |
setEnabled(false); |
1436 |
return; |
1437 |
} |
1438 |
|
1439 |
for (Unit u : units) { |
1440 |
if (!isEnabled(u)) { |
1441 |
setEnabled(false); |
1442 |
return; |
1443 |
} |
1444 |
} |
1445 |
setEnabled(true); |
1446 |
} |
1447 |
|
1448 |
@Override |
1449 |
public void performerImpl() { |
1450 |
final int row = getSelectedRow (); |
1451 |
OperationContainer<OperationSupport> c = Containers.forDisable(); |
1452 |
for (Unit u : model.getUnits()) { |
1453 |
if (u.isMarked()) { |
1454 |
c.add(u.updateUnit, u.getRelevantElement()); |
1455 |
} |
1456 |
} |
1457 |
UninstallUnitWizard wizard = new UninstallUnitWizard (); |
1458 |
if (wizard.invokeWizard (false)) { |
1459 |
Containers.forUninstall().removeAll(); |
1460 |
} |
1461 |
Containers.forDisable().removeAll(); |
1462 |
restoreSelectedRow(row); |
1463 |
refreshState (); |
1464 |
focusTable (); |
1465 |
} |
1466 |
/* |
1467 |
Unit.Installed unit = (Unit.Installed)u; |
1468 |
final int row = getSelectedRow(); |
1469 |
|
1470 |
if (unit.getRelevantElement ().isEnabled ()) { |
1471 |
OperationInfo info = Containers.forDisable ().add (unit.updateUnit, unit.getRelevantElement ()); |
1472 |
assert info != null; |
1473 |
UninstallUnitWizard wizard = new UninstallUnitWizard (); |
1474 |
if (wizard.invokeWizard (false)) { |
1475 |
Containers.forUninstall ().remove (unit.getRelevantElement ()); |
1476 |
} |
1477 |
Containers.forDisable ().removeAll (); |
1478 |
} |
1479 |
fireUpdataUnitChange (); |
1480 |
restoreSelectedRow(row); |
1481 |
focusTable (); |
1482 |
*/ |
1380 |
protected boolean isEnabled (Unit u) { |
1483 |
protected boolean isEnabled (Unit u) { |
1381 |
boolean retval = false; |
1484 |
boolean retval = false; |
1382 |
if ((u != null) && (u instanceof Unit.Installed)) { |
1485 |
if ((u != null) && (u instanceof Unit.Installed)) { |
Lines 1392-1420
Link Here
|
1392 |
return getActionName ()+ " " + u.getDisplayName (); |
1495 |
return getActionName ()+ " " + u.getDisplayName (); |
1393 |
}*/ |
1496 |
}*/ |
1394 |
return getActionName (); |
1497 |
return getActionName (); |
1395 |
} |
|
|
1396 |
public void performerImpl (Unit u) { |
1397 |
Unit.Installed unit = (Unit.Installed)u; |
1398 |
final int row = getSelectedRow(); |
1399 |
|
1400 |
if (unit.getRelevantElement ().isEnabled ()) { |
1401 |
OperationInfo info = Containers.forDisable ().add (unit.updateUnit, unit.getRelevantElement ()); |
1402 |
assert info != null; |
1403 |
UninstallUnitWizard wizard = new UninstallUnitWizard (); |
1404 |
if (wizard.invokeWizard (false)) { |
1405 |
Containers.forUninstall ().remove (unit.getRelevantElement ()); |
1406 |
} |
1407 |
Containers.forDisable ().removeAll (); |
1408 |
} |
1409 |
fireUpdataUnitChange (); |
1410 |
restoreSelectedRow(row); |
1411 |
focusTable (); |
1412 |
} |
1413 |
|
1414 |
|
1415 |
@Override |
1416 |
protected boolean isVisible (Unit u) { |
1417 |
return false; |
1418 |
} |
1498 |
} |
1419 |
} |
1499 |
} |
1420 |
|
1500 |
|
Lines 1830-1835
Link Here
|
1830 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
1910 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
1831 |
private javax.swing.JCheckBox advView; |
1911 |
private javax.swing.JCheckBox advView; |
1832 |
private javax.swing.JButton bTabAction; |
1912 |
private javax.swing.JButton bTabAction; |
|
|
1913 |
private javax.swing.JButton bTabAction1; |
1914 |
private javax.swing.JButton bTabAction2; |
1833 |
private javax.swing.JLabel lSearch; |
1915 |
private javax.swing.JLabel lSearch; |
1834 |
private javax.swing.JLabel lSelectionInfo; |
1916 |
private javax.swing.JLabel lSelectionInfo; |
1835 |
private javax.swing.JLabel lWarning; |
1917 |
private javax.swing.JLabel lWarning; |