use of org.netbeans.modules.autoupdate.ui.PluginManagerUI in project netbeans-rcp-lite by outersky.
the class AutoupdateCheckScheduler method getRefresher.
private static Runnable getRefresher(final UpdateUnitProvider p, final Collection<String> problems, final ProgressHandle progress) {
return new Runnable() {
@Override
public void run() {
try {
err.log(Level.FINE, "Start refresh " + p.getName() + "[" + p.getDisplayName() + "]");
p.refresh(progress, true);
PluginManagerUI pluginManagerUI = PluginManagerAction.getPluginManagerUI();
if (pluginManagerUI != null) {
if (pluginManagerUI.initTask.isFinished()) {
pluginManagerUI.updateUnitsChanged();
}
}
Utilities.showProviderNotification(p);
} catch (IOException ioe) {
if (ioe instanceof UnknownHostException || ioe.getCause() instanceof UnknownHostException) {
// Most likely just offline. Do not print a stack trace. DownloadListener.notifyException already issuing warning.
} else {
err.log(Level.INFO, null, ioe);
}
if (problems != null) {
problems.add(ioe.getLocalizedMessage());
}
} finally {
err.log(Level.FINEST, "Refresh of " + p.getName() + "[" + p.getDisplayName() + "]" + " is finish.");
}
}
};
}
use of org.netbeans.modules.autoupdate.ui.PluginManagerUI in project netbeans-rcp-lite by outersky.
the class AutoupdateCheckScheduler method notifyAvailable.
public static void notifyAvailable(final Collection<LazyUnit> units, final OperationType type) {
if (units == null || units.isEmpty()) {
if (updatesNotification != null) {
updatesNotification.clear();
updatesNotification = null;
}
return;
}
// Some modules found
ActionListener onMouseClickAction = new ActionListener() {
@SuppressWarnings("unchecked")
@Override
public void actionPerformed(ActionEvent ae) {
boolean wizardFinished = false;
RequestProcessor.Task t = PluginManagerUI.getRunningTask();
if (t != null && !t.isFinished()) {
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message(NbBundle.getMessage(AutoupdateCheckScheduler.class, // NOI18N
"AutoupdateCheckScheduler_InstallInProgress"), NotifyDescriptor.WARNING_MESSAGE));
return;
}
try {
wizardFinished = new InstallUnitWizard().invokeLazyWizard(units, type, false);
} finally {
if (wizardFinished) {
PluginManagerUI pluginManagerUI = PluginManagerAction.getPluginManagerUI();
if (pluginManagerUI != null) {
pluginManagerUI.updateUnitsChanged();
}
Installer.RP.post(doCheckAvailableUpdates);
}
}
}
};
int updateCount = units.size();
String title = updateCount == 1 ? // NOI18N
NbBundle.getMessage(AutoupdateCheckScheduler.class, "AutoupdateCheckScheduler_UpdateFound_ToolTip", updateCount) : // NOI18N
NbBundle.getMessage(AutoupdateCheckScheduler.class, "AutoupdateCheckScheduler_UpdatesFound_ToolTip", updateCount);
synchronized (AutoupdateCheckScheduler.class) {
if (updatesNotification != null) {
updatesNotification.clear();
updatesNotification = null;
}
updatesNotification = NotificationDisplayer.getDefault().notify(title, ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/newUpdates.png", false), NbBundle.getMessage(AutoupdateCheckScheduler.class, "AutoupdateCheckScheduler_UpdateFound_Hint"), onMouseClickAction, NotificationDisplayer.Priority.HIGH);
}
}
use of org.netbeans.modules.autoupdate.ui.PluginManagerUI in project netbeans-rcp-lite by outersky.
the class PluginManagerAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent ev) {
if (dlg == null) {
JButton close = new JButton();
close.setDefaultCapable(false);
Mnemonics.setLocalizedText(close, NbBundle.getMessage(PluginManagerAction.class, "PluginManager_CloseButton_Name"));
String initialTab = null;
if (ev.getID() == 100) {
initialTab = ev.getActionCommand();
}
pluginManagerUI = new PluginManagerUI(close, initialTab);
DialogDescriptor dd = new DialogDescriptor(pluginManagerUI, NbBundle.getMessage(PluginManagerAction.class, "PluginManager_Panel_Name"), // modal
false, new JButton[] { close }, close, DialogDescriptor.DEFAULT_ALIGN, null, null);
dd.setOptions(new Object[0]);
dlg = DialogDisplayer.getDefault().createDialog(dd);
dlg.setVisible(true);
dlg.addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
dlg = null;
pluginManagerUI = null;
}
public void windowClosed(WindowEvent e) {
dlg = null;
pluginManagerUI = null;
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
});
} else {
dlg.requestFocus();
}
}
use of org.netbeans.modules.autoupdate.ui.PluginManagerUI in project netbeans-rcp-lite by outersky.
the class CheckForUpdatesProviderImpl method openCheckForUpdatesWizard.
@Override
public boolean openCheckForUpdatesWizard(boolean reload) {
boolean wizardFinished = false;
RequestProcessor.Task t = PluginManagerUI.getRunningTask();
if (t != null && !t.isFinished()) {
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message(NbBundle.getMessage(AutoupdateCheckScheduler.class, // NOI18N
"AutoupdateCheckScheduler_InstallInProgress"), NotifyDescriptor.WARNING_MESSAGE));
return false;
}
Collection<LazyInstallUnitWizardIterator.LazyUnit> units = LazyInstallUnitWizardIterator.LazyUnit.loadLazyUnits(OperationWizardModel.OperationType.UPDATE);
try {
wizardFinished = new InstallUnitWizard().invokeLazyWizard(units, OperationWizardModel.OperationType.UPDATE, reload);
} finally {
if (wizardFinished) {
PluginManagerUI pluginManagerUI = PluginManagerAction.getPluginManagerUI();
if (pluginManagerUI != null) {
pluginManagerUI.updateUnitsChanged();
}
}
}
return wizardFinished;
}
Aggregations