diff -r 955ee765ccb6 autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Bundle.properties
--- a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Bundle.properties Wed Apr 22 23:51:37 2009 +0200
+++ b/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Bundle.properties Thu Apr 23 17:00:50 2009 +0200
@@ -102,7 +102,7 @@
AvailableTableModel_Columns_Name=Name
AvailableTableModel_Source_Category=Source
AvailableTableModel_Columns_Category=Category
-InstalledTableModel_Columns_Uninstall=Uninstall
+InstalledTableModel_Columns_Uninstall=Select
InstalledTableModel_Columns_Name=Name
InstalledTableModel_Columns_Installed=Installed
InstalledTableModel_Columns_Category=Category
diff -r 955ee765ccb6 autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UnitTab.form
--- a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UnitTab.form Wed Apr 22 23:51:37 2009 +0200
+++ b/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UnitTab.form Thu Apr 23 17:00:50 2009 +0200
@@ -20,7 +20,7 @@
-
+
@@ -28,10 +28,14 @@
-
+
+
+
+
+
-
+
@@ -50,13 +54,15 @@
-
+
+
+
@@ -131,5 +137,9 @@
+
+
+
+
diff -r 955ee765ccb6 autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UnitTab.java
--- a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UnitTab.java Wed Apr 22 23:51:37 2009 +0200
+++ b/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UnitTab.java Thu Apr 23 17:00:50 2009 +0200
@@ -41,6 +41,8 @@
package org.netbeans.modules.autoupdate.ui;
+import org.netbeans.api.autoupdate.OperationContainer;
+import org.netbeans.api.autoupdate.OperationSupport;
import org.netbeans.modules.autoupdate.ui.wizards.UninstallUnitWizard;
import org.netbeans.modules.autoupdate.ui.wizards.InstallUnitWizard;
import java.awt.Component;
@@ -69,6 +71,7 @@
import java.util.prefs.PreferenceChangeListener;
import java.util.prefs.Preferences;
import javax.swing.AbstractAction;
+import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.ImageIcon;
@@ -120,8 +123,8 @@
private String filter = "";
private PluginManagerUI manager = null;
private PopupActionSupport popupActionsSupport;
- private RowTabAction activateAction;
- private RowTabAction deactivateAction;
+ private TabAction activateAction;
+ private TabAction deactivateAction;
private TabAction reloadAction;
private RowTabAction moreAction;
private RowTabAction lessAction;
@@ -230,9 +233,10 @@
boolean enabled = !waitingState;
Component[] all = getComponents ();
for (Component component : all) {
- if (component == bTabAction) {
+ if (component == bTabAction || component == bTabAction1 || component == bTabAction2) {
if (enabled) {
- component.setEnabled (model.getMarkedUnits ().size () > 0);
+ TabAction a = (TabAction) ((AbstractButton)component).getAction();
+ component.setEnabled (a == null ? false : a.isEnabled());
} else {
component.setEnabled (enabled);
}
@@ -337,7 +341,7 @@
} else {
setSelectionInfo (null, units.size ());
}
- getDefaultAction ().setEnabled (units.size () > 0);
+ getDefaultAction ().tableDataChanged(units);
boolean alreadyScheduled = false;
if (getDownloadSizeTask != null) {
if (getDownloadSizeTask.getDelay () > 0) {
@@ -382,18 +386,23 @@
activateAction = new ActivateAction ();
deactivateAction = new DeactivateAction ();
+ UninstallAction uninstall = new UninstallAction();
forPopup = new TabAction[] {
activateAction, deactivateAction,activateCategoryAction,deactivateCategoryAction,
checkCategoryAction, uncheckCategoryAction,
- checkAllAction, uncheckAllAction, new CheckAction ()
+ checkAllAction, uncheckAllAction, new CheckAction (), uninstall
};
+ bTabAction1.setVisible(true);
+ bTabAction2.setVisible(true);
+ bTabAction.setAction(activateAction);
+ bTabAction1.setAction(deactivateAction);
+ bTabAction2.setAction (uninstall);
+ prepareTopButton (reloadAction = new ReloadAction ());
+ table.setEnableRenderer (new EnableRenderer ());
+ initReloadTooltip();
+ break;
}
- bTabAction.setAction (new UninstallAction ());
- prepareTopButton (reloadAction = new ReloadAction ());
- table.setEnableRenderer (new EnableRenderer ());
- initReloadTooltip();
- break;
case UPDATE :
{
RowTabAction selectCategoryAction = new CheckCategoryAction ();
@@ -410,6 +419,8 @@
};
}
bTabAction.setAction (new UpdateAction ());
+ bTabAction1.setVisible(false);
+ bTabAction2.setVisible(false);
prepareTopButton (reloadAction = new ReloadAction ());
initReloadTooltip();
break;
@@ -429,6 +440,8 @@
};
}
bTabAction.setAction (new AvailableAction ());
+ bTabAction1.setVisible(false);
+ bTabAction2.setVisible(false);
prepareTopButton (reloadAction = new ReloadAction ());
table.setEnableRenderer (new SourceCategoryRenderer ());
initReloadTooltip();
@@ -441,6 +454,8 @@
};
}
bTabAction.setAction (new LocalUpdateAction ());
+ bTabAction1.setVisible(false);
+ bTabAction2.setVisible(false);
prepareTopButton (new AddLocallyDownloadedAction ());
break;
}
@@ -528,9 +543,9 @@
//selectedRow is selected
Action action = null;
if (activateAction != null && activateAction.isEnabled ()) {
- action = activateAction;
+ //action = activateAction;
} else if (deactivateAction != null && deactivateAction.isEnabled ()) {
- action = deactivateAction;
+ //action = deactivateAction;
} else if (removeLocallyDownloaded != null && removeLocallyDownloaded.isEnabled ()) {
action = removeLocallyDownloaded;
}
@@ -589,6 +604,8 @@
topButton = new javax.swing.JButton();
lWarning = new javax.swing.JLabel();
advView = new javax.swing.JCheckBox();
+ bTabAction1 = new javax.swing.JButton();
+ bTabAction2 = new javax.swing.JButton();
lSearch.setLabelFor(tfSearch);
org.openide.awt.Mnemonics.setLocalizedText(lSearch, org.openide.util.NbBundle.getMessage(UnitTab.class, "lSearch1.text")); // NOI18N
@@ -625,9 +642,13 @@
.add(layout.createSequentialGroup()
.add(bTabAction)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(bTabAction1)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(bTabAction2)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(lSelectionInfo)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
- .add(lWarning, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE)
+ .add(lWarning, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(advView)))
.addContainerGap())
@@ -641,13 +662,15 @@
.add(lSearch)
.add(topButton))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
- .add(spTab, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
+ .add(spTab, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER, false)
.add(bTabAction)
.add(lSelectionInfo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(lWarning)
- .add(advView))
+ .add(advView)
+ .add(bTabAction1)
+ .add(bTabAction2))
.addContainerGap())
);
@@ -1019,7 +1042,7 @@
}
- public abstract void performerImpl ();
+ public abstract void performerImpl ();
}
private abstract class RowTabAction extends TabAction {
@@ -1267,10 +1290,60 @@
}
}
- private class ActivateAction extends RowTabAction {
+ private class ActivateAction extends TabAction {
public ActivateAction () {
super ("UnitTab_ActivateAction", /*KeyStroke.getKeyStroke (KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK),*/ "EnableDisable");
}
+
+ @Override
+ public void tableDataChanged(Collection units) {
+ if (units.isEmpty()) {
+ setEnabled(false);
+ return;
+ }
+ for (Unit u : units) {
+ if (!isEnabled(u)) {
+ setEnabled(false);
+ return;
+ }
+ }
+ setEnabled(true);
+ }
+
+ @Override
+ public void performerImpl() {
+ final int row = getSelectedRow ();
+ final Map state = UnitCategoryTableModel.captureState (model.getUnits ());
+ OperationContainer c = Containers.forEnable();
+ for (Unit u : model.getUnits()) {
+ if (u.isMarked()) {
+ c.add(u.updateUnit, u.getRelevantElement());
+ }
+ }
+ UninstallUnitWizard wizard = new UninstallUnitWizard ();
+ wizard.invokeWizard (true);
+ Containers.forEnable ().removeAll ();
+ restoreSelectedRow(row);
+ refreshState ();
+ focusTable ();
+ }
+ /*
+ public void performerImpl (Unit u) {
+ Unit.Installed unit = (Unit.Installed)u;
+ final int row = getSelectedRow();
+
+ if (!unit.getRelevantElement ().isEnabled ()) {
+ OperationInfo info = Containers.forEnable ().add (unit.updateUnit, unit.getRelevantElement ());
+ assert info != null;
+ UninstallUnitWizard wizard = new UninstallUnitWizard ();
+ wizard.invokeWizard (true);
+ Containers.forEnable ().removeAll ();
+ }
+ fireUpdataUnitChange ();
+ restoreSelectedRow(row);
+ focusTable();
+ }
+ */
protected boolean isEnabled (Unit u) {
boolean retval = false;
@@ -1287,27 +1360,6 @@
return getActionName ()+ " " + u.getDisplayName ();
}*/
return getActionName ();
- }
- public void performerImpl (Unit u) {
- Unit.Installed unit = (Unit.Installed)u;
- final int row = getSelectedRow();
-
- if (!unit.getRelevantElement ().isEnabled ()) {
- OperationInfo info = Containers.forEnable ().add (unit.updateUnit, unit.getRelevantElement ());
- assert info != null;
- UninstallUnitWizard wizard = new UninstallUnitWizard ();
- wizard.invokeWizard (true);
- Containers.forEnable ().removeAll ();
- }
- fireUpdataUnitChange ();
- restoreSelectedRow(row);
- focusTable();
- }
-
-
- @Override
- protected boolean isVisible (Unit u) {
- return false;
}
}
@@ -1372,11 +1424,62 @@
}
- private class DeactivateAction extends RowTabAction {
+ private class DeactivateAction extends TabAction {
public DeactivateAction () {
super ("UnitTab_DeactivateAction", /*KeyStroke.getKeyStroke (KeyEvent.VK_D, KeyEvent.CTRL_DOWN_MASK),*/ "EnableDisable");
}
+ @Override
+ public void tableDataChanged(Collection units) {
+ if (units.isEmpty()) {
+ setEnabled(false);
+ return;
+ }
+
+ for (Unit u : units) {
+ if (!isEnabled(u)) {
+ setEnabled(false);
+ return;
+ }
+ }
+ setEnabled(true);
+ }
+
+ @Override
+ public void performerImpl() {
+ final int row = getSelectedRow ();
+ OperationContainer c = Containers.forDisable();
+ for (Unit u : model.getUnits()) {
+ if (u.isMarked()) {
+ c.add(u.updateUnit, u.getRelevantElement());
+ }
+ }
+ UninstallUnitWizard wizard = new UninstallUnitWizard ();
+ if (wizard.invokeWizard (false)) {
+ Containers.forUninstall().removeAll();
+ }
+ Containers.forDisable().removeAll();
+ restoreSelectedRow(row);
+ refreshState ();
+ focusTable ();
+ }
+ /*
+ Unit.Installed unit = (Unit.Installed)u;
+ final int row = getSelectedRow();
+
+ if (unit.getRelevantElement ().isEnabled ()) {
+ OperationInfo info = Containers.forDisable ().add (unit.updateUnit, unit.getRelevantElement ());
+ assert info != null;
+ UninstallUnitWizard wizard = new UninstallUnitWizard ();
+ if (wizard.invokeWizard (false)) {
+ Containers.forUninstall ().remove (unit.getRelevantElement ());
+ }
+ Containers.forDisable ().removeAll ();
+ }
+ fireUpdataUnitChange ();
+ restoreSelectedRow(row);
+ focusTable ();
+ */
protected boolean isEnabled (Unit u) {
boolean retval = false;
if ((u != null) && (u instanceof Unit.Installed)) {
@@ -1392,29 +1495,6 @@
return getActionName ()+ " " + u.getDisplayName ();
}*/
return getActionName ();
- }
- public void performerImpl (Unit u) {
- Unit.Installed unit = (Unit.Installed)u;
- final int row = getSelectedRow();
-
- if (unit.getRelevantElement ().isEnabled ()) {
- OperationInfo info = Containers.forDisable ().add (unit.updateUnit, unit.getRelevantElement ());
- assert info != null;
- UninstallUnitWizard wizard = new UninstallUnitWizard ();
- if (wizard.invokeWizard (false)) {
- Containers.forUninstall ().remove (unit.getRelevantElement ());
- }
- Containers.forDisable ().removeAll ();
- }
- fireUpdataUnitChange ();
- restoreSelectedRow(row);
- focusTable ();
- }
-
-
- @Override
- protected boolean isVisible (Unit u) {
- return false;
}
}
@@ -1830,6 +1910,8 @@
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox advView;
private javax.swing.JButton bTabAction;
+ private javax.swing.JButton bTabAction1;
+ private javax.swing.JButton bTabAction2;
private javax.swing.JLabel lSearch;
private javax.swing.JLabel lSelectionInfo;
private javax.swing.JLabel lWarning;