Search in sources :

Example 1 with LazyUnit

use of org.netbeans.modules.autoupdate.ui.wizards.LazyInstallUnitWizardIterator.LazyUnit in project netbeans-rcp-lite by outersky.

the class LazyOperationDescriptionStep method preparePluginsForShow.

private String preparePluginsForShow(Collection<LazyUnit> units, OperationType type) {
    String s = new String();
    List<String> names = new ArrayList<String>();
    if (units != null && !units.isEmpty()) {
        for (LazyUnit u : units) {
            String updatename;
            // NOI18N
            updatename = "<b>" + u.getDisplayName() + "</b> ";
            if (OperationWizardModel.OperationType.UPDATE == type) {
                updatename += getBundle("OperationDescriptionStep_UpdatePluginVersionFormat", u.getOldVersion(), u.getNewVersion());
            } else {
                updatename += getBundle(// NOI18N
                "OperationDescriptionStep_PluginVersionFormat", u.getNewVersion());
            }
            // NOI18N
            updatename += "<br>";
            String notification = u.getNotification();
            if (notification != null && notification.length() > 0) {
                // NOI18N
                updatename += "<font color=\"red\">" + notification + "</font><br><br>";
            }
            names.add(updatename);
        }
        Collections.sort(names);
        for (String name : names) {
            s += name;
        }
    }
    return s.trim();
}
Also used : ArrayList(java.util.ArrayList) LazyUnit(org.netbeans.modules.autoupdate.ui.wizards.LazyInstallUnitWizardIterator.LazyUnit)

Example 2 with LazyUnit

use of org.netbeans.modules.autoupdate.ui.wizards.LazyInstallUnitWizardIterator.LazyUnit in project netbeans-rcp-lite by outersky.

the class InstallStep method handleLazyUnits.

private void handleLazyUnits(boolean clearLazyUnits, boolean notifyUsers) {
    if (clearLazyUnits) {
        LazyUnit.storeLazyUnits(model.getOperation(), null);
        if (notifyUsers) {
            AutoupdateCheckScheduler.notifyAvailable(null, OperationType.UPDATE);
        }
    } else {
        // get LazyUnit being installed
        Collection<String> tmp = new HashSet<String>();
        for (UpdateElement el : model.getAllUpdateElements()) {
            tmp.add(LazyUnit.toString(el));
        }
        // remove them from LazyUnits stored for next IDE run
        Collection<LazyUnit> res = new HashSet<LazyUnit>();
        for (LazyUnit lu : LazyUnit.loadLazyUnits(model.getOperation())) {
            if (!tmp.contains(lu.toString())) {
                res.add(lu);
            }
        }
        LazyUnit.storeLazyUnits(model.getOperation(), res);
        if (notifyUsers) {
            AutoupdateCheckScheduler.notifyAvailable(res, OperationType.UPDATE);
        }
    }
}
Also used : UpdateElement(org.netbeans.api.autoupdate.UpdateElement) LazyUnit(org.netbeans.modules.autoupdate.ui.wizards.LazyInstallUnitWizardIterator.LazyUnit) HashSet(java.util.HashSet)

Aggregations

LazyUnit (org.netbeans.modules.autoupdate.ui.wizards.LazyInstallUnitWizardIterator.LazyUnit)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 UpdateElement (org.netbeans.api.autoupdate.UpdateElement)1