org.netbeans.api.autoupdate.OperationContainer Java Examples

The following examples show how to use org.netbeans.api.autoupdate.OperationContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PluginManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Open standard dialog for installing set of modules. Shows it to the user,
 * asks for confirmation, license acceptance, etc. The whole operation requires
 * AWT dispatch thread access (to show the dialog) and blocks
 * (until the user clicks through), so either call from AWT dispatch thread
 * directly, or be sure you hold no locks and block no progress of other
 * threads to avoid deadlocks.
 *
 * @param container the container with list of modules for install
 * @param runInBackground if <code>true</code> then installation run in the background after license acceptance
 */
public static void openInstallWizard(OperationContainer<InstallSupport> container, boolean runInBackground) {
    if (container == null) {
        throw new IllegalArgumentException ("OperationContainer cannot be null."); // NOI18N
    }
    List<OperationContainer.OperationInfo<InstallSupport>> all = container.listAll ();
    if (all.isEmpty ()) {
        throw new IllegalArgumentException ("OperationContainer cannot be empty."); // NOI18N
    }
    List<OperationContainer.OperationInfo<InstallSupport>> invalid = container.listInvalid();
    if (! invalid.isEmpty ()) {
        throw new IllegalArgumentException ("OperationContainer cannot contain invalid elements but " + invalid); // NOI18N
    }
    OperationInfo<InstallSupport> info = all.get (0);
    OperationType doOperation = info.getUpdateUnit ().getInstalled () == null ? OperationType.INSTALL : OperationType.UPDATE;
    new InstallUnitWizard ().invokeWizard (new InstallUnitWizardModel (doOperation, container), true, runInBackground);
}
 
Example #2
Source File: NbmExternalTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void doInstall(OperationContainer<InstallSupport> installContainer) throws OperationException {
    InstallSupport support = installContainer.getSupport();
    assertNotNull(support);

    InstallSupport.Validator v = support.doDownload(null, false);
    assertNotNull(v);
    InstallSupport.Installer i = support.doValidate(v, null);
    assertNotNull(i);
    Restarter r = null;
    try {
        r = support.doInstall(i, null);
    } catch (OperationException ex) {
        if (OperationException.ERROR_TYPE.INSTALL == ex.getErrorType()) {
            // can ingore
            // module system cannot load the module either
        } else {
            fail(ex.toString());
        }
    }
    assertNull("Installing new element require restarting though it should not", r);
}
 
Example #3
Source File: FindComponentModules.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private Collection<UpdateElement> getAllForEnable (Collection<UpdateElement> elements) {
    Collection<UpdateElement> all = new HashSet<UpdateElement> ();
    for (UpdateElement el : elements) {
        OperationContainer<OperationSupport> ocForEnable = OperationContainer.createForEnable ();
        if (ocForEnable.canBeAdded (el.getUpdateUnit (), el)) {
            OperationContainer.OperationInfo<OperationSupport> info = ocForEnable.add (el);
            if (info == null) {
                continue;
            }
            Set<UpdateElement> reqs = info.getRequiredElements ();
            ocForEnable.add (reqs);
            Set<String> breaks = info.getBrokenDependencies ();
            if (breaks.isEmpty ()) {
                all.add (el);
                all.addAll (reqs);
            } else {
                problemDescription = NbBundle.getMessage (FindComponentModules.class,
                        "FindComponentModules_Problem_DependingPluginNotFound",
                        codeNames,
                        breaks);
            }
        }
    }
    return all;
}
 
Example #4
Source File: FindComponentModules.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private Collection<UpdateElement> getAllForInstall (Collection<UpdateElement> elements) {
    Collection<UpdateElement> all = new HashSet<UpdateElement> ();
    for (UpdateElement el : elements) {
        OperationContainer<InstallSupport> ocForInstall = OperationContainer.createForInstall ();
        if (ocForInstall.canBeAdded (el.getUpdateUnit (), el)) {
            OperationContainer.OperationInfo<InstallSupport> info = ocForInstall.add (el);
            if (info == null) {
                continue;
            }
            Set<UpdateElement> reqs = info.getRequiredElements ();
            ocForInstall.add (reqs);
            Set<String> breaks = info.getBrokenDependencies ();
            if (breaks.isEmpty ()) {
                all.add (el);
                all.addAll (reqs);
            } else {
                problemDescription = NbBundle.getMessage (FindComponentModules.class,
                        "FindComponentModules_Problem_DependingPluginNotFound",
                        codeNames,
                        breaks);
            }
        }
    }
    return all;
}
 
Example #5
Source File: OperationsTestImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public UpdateElement installNativeComponent (UpdateUnit toInstall, UpdateElement installElement) throws Exception {
    installElement = (installElement != null) ? installElement : toInstall.getAvailableUpdates ().get (0);
    
    assertNotNull (toInstall);
    
    // XXX: assert same could be broken later
    assertSame (toInstall, Utilities.toUpdateUnit (toInstall.getCodeName ()));
    
    OperationContainer<OperationSupport> container = OperationContainer.createForCustomInstallComponent ();
    OperationContainer.OperationInfo<OperationSupport> info = container.add (installElement);
    assertNotNull (info);
    container.add (info.getRequiredElements ());
    assertEquals (0,container.listInvalid ().size ());
    
    OperationSupport support = container.getSupport ();
    assertNotNull (support);
    support.doOperation (null);
    
    return installElement;
}
 
Example #6
Source File: JUnitLibraryInstaller.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Messages({"writePermission=You don't have permission to install JUnit Library into the installation directory which is recommended.",
    "showDetails=Show details"})
private static void notifyWarning(final OperationContainer<InstallSupport> oc, final UpdateElement jUnitElement, final UpdateUnit jUnitLib) {
    // lack of privileges for writing
    ActionListener onMouseClickAction = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Runnable r = new Runnable() {
                @Override
                public void run() {
                    try {
                        install(oc, jUnitElement, jUnitLib, true);
                    } catch (OperationException ex) {
                        LOG.log(Level.INFO, "While installing " + jUnitLib + " thrown " + ex, ex);
                    }
                }
            };
            showWritePermissionDialog(r);
        }
    };
    String title = writePermission();
    String description = showDetails();
    NotificationDisplayer.getDefault().notify(title,
            ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/pluginimporter/resources/warning.gif", false), // NOI18N
            description, onMouseClickAction, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING);
}
 
Example #7
Source File: FindComponentModules.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private Collection<UpdateElement> getAllForInstall (Collection<UpdateElement> elements) {
    Collection<UpdateElement> all = new HashSet<UpdateElement> ();
    for (UpdateElement el : elements) {
        OperationContainer<InstallSupport> ocForInstall = OperationContainer.createForInstall ();
        if (ocForInstall.canBeAdded (el.getUpdateUnit (), el)) {
            OperationContainer.OperationInfo<InstallSupport> info = ocForInstall.add (el);
            if (info == null) {
                continue;
            }
            Set<UpdateElement> reqs = info.getRequiredElements ();
            ocForInstall.add (reqs);
            // PENDING: broken dependencies may mean the feature contains a platform/java-specific
            // module, but could be used even without that one.
            Set<String> breaks = info.getBrokenDependencies ();
            if (breaks.isEmpty ()) {
                all.add (el);
                all.addAll (reqs);
            }
        }
    }
    return all;
}
 
Example #8
Source File: UpdateDisabledModuleTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testSelf() throws Exception {
    File f = new File(new File(new File(ud, "config"), "Modules"), "com-example-testmodule-cluster.xml");
    f.delete();

    assertFalse("No Config file before: " + f, f.exists());

    MockServices.setServices(UP.class);
    UpdateUnit update = UpdateManagerImpl.getInstance().getUpdateUnit(moduleCodeNameBaseForTest());

    assertNotNull("There is an NBM to update", update);
    OperationContainer<InstallSupport> oc = OperationContainer.createForUpdate();
    oc.add(update, update.getAvailableUpdates().get(0));
    final InstallSupport support = oc.getSupport();
    Validator down = support.doDownload(null, true);
    Installer inst = support.doValidate(down, null);
    Restarter res = support.doInstall(inst, null);
    System.setProperty("netbeans.close.no.exit", "true");
    support.doRestart(res, null);
    UpdaterInternal.update(null, null, null);

    assertFalse("No Config file created in for upgrade: " + f, f.exists());
}
 
Example #9
Source File: UnitTab.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void performerImpl() {
    final int row = getSelectedRow ();
    state = UnitCategoryTableModel.captureState (model.getUnits ());
    UninstallUnitWizard wizard = new UninstallUnitWizard ();
    finished = false;
    // unused, but hold the reference on stack.
    OperationContainer c = prepareContainer();
    try {
        finished = wizard.invokeWizard(true, this::refreshData);
    } finally {
        clearContainers();
        if (finished) {
            for (Unit u : model.getMarkedUnits()) {
                u.setMarked(false);
            }
        }
        fireUpdataUnitChange();
        if(!finished) {
            UnitCategoryTableModel.restoreState (model.getUnits (), state, model.isMarkedAsDefault ());
        }
        restoreSelectedRow(row);
        refreshState ();
        focusTable ();
    }
}
 
Example #10
Source File: UninstallUnitWizard.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean invokeWizardImpl (Boolean doUninstall, Boolean doEnable, Callable<OperationContainer> refresher) {
    assert doUninstall != null || doEnable != null : "At least one action is enabled";
    assert ! (doUninstall != null && doEnable != null) : "Only once action is enabled";
    assert doUninstall == null || Containers.forUninstall () != null : "The OperationContainer<OperationSupport> forUninstall must exist!";
    assert doUninstall != null || !doEnable || (doEnable && Containers.forEnable () != null) : "The OperationContainer<OperationSupport> forEnable must exist!";
    assert doUninstall != null || doEnable || (! doEnable && Containers.forDisable () != null) : "The OperationContainer<OperationSupport> forDisable must exist!";
    
    UninstallUnitWizardModel model = new UninstallUnitWizardModel (doUninstall != null
            ? OperationWizardModel.OperationType.UNINSTALL : doEnable ? OperationWizardModel.OperationType.ENABLE : OperationWizardModel.OperationType.DISABLE);
    model.setRefreshCallable(refresher);
    WizardDescriptor.Iterator<WizardDescriptor> iterator = new UninstallUnitWizardIterator (model);
    WizardDescriptor wizardDescriptor = new WizardDescriptor (iterator);
    wizardDescriptor.setModal (true);
    
    // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName()
    // {1} will be replaced by WizardDescriptor.Iterator.name()
    wizardDescriptor.setTitleFormat (new MessageFormat("{1}"));
    wizardDescriptor.setTitle (NbBundle.getMessage (UninstallUnitWizard.class, "UninstallUnitWizard_Title"));
    
    Dialog dialog = DialogDisplayer.getDefault ().createDialog (wizardDescriptor);
    dialog.setVisible (true);
    dialog.toFront ();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    log.log (Level.FINE, "InstallUnitWizard returns with value " + wizardDescriptor.getValue ());
    return !cancelled;
}
 
Example #11
Source File: FragmentDisabledNoRestartTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void testSelf() throws Exception {
    UpdateUnit hostUnit = UpdateManagerImpl.getInstance().getUpdateUnit("org.yourorghere.engine");
    installModule(hostUnit, null);
    
    OperationContainer<OperationSupport> container = OperationContainer.createForDirectDisable ();
    container.add(hostUnit.getInstalled());
    OperationSupport support = container.getSupport ();
    support.doOperation (null);

    UpdateUnit toInstall = UpdateManagerImpl.getInstance().getUpdateUnit(moduleCodeNameBaseForTest());
    
    AtomicReference<OperationSupport.Restarter> restarter = new AtomicReference<>();
    installModuleWithRestart(toInstall, null, restarter);
    
    assertNull ("Module must not cause restart, host is disabled", restarter.get());
}
 
Example #12
Source File: OperationWizardModel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addRequiredElements (Set<UpdateElement> elems) {
    OperationContainer baseContainer = getBaseContainer();
    OperationContainer customContainer = getCustomHandledContainer();
    OperationContainer installContainer = getInstallContainer();
    for (UpdateElement el : elems) {
        if (el == null || el.getUpdateUnit () == null) {
            Logger.getLogger (OperationWizardModel.class.getName ()).log (Level.INFO, "UpdateElement " + el + " cannot be null"
                    + (el == null ? "" : " or UpdateUnit " + el.getUpdateUnit () + " cannot be null"));
            continue;
        }
        if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == el.getUpdateUnit ().getType ()) {
            customContainer.add (el);
        } else if (baseContainer.canBeAdded(el.getUpdateUnit(), el)) {
            baseContainer.add (el);
        } else if (installContainer != null && installContainer.canBeAdded(el.getUpdateUnit(), el)) {
            installContainer.add(el);
        }
    }
}
 
Example #13
Source File: Unit.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void setMarked(boolean marked) {
    if (marked == isMarked()) {
        log.info("Not necessary mark "  + this + " as " + marked + " if it'is marked as " + isMarked());
        return ;
    }
    OperationContainer container = Containers.forUpdate();
    for (UpdateUnit invisible : getUpdateUnits()) {
        if (marked) {
            if (container.canBeAdded(invisible, invisible.getAvailableUpdates().get(0))) {
                container.add(invisible, invisible.getAvailableUpdates().get(0));
            }
        } else {
            container.remove(invisible.getAvailableUpdates().get(0));
        }
    }
    if (! hasInternalsOnly()) {
        if (marked) {
            if (container.canBeAdded(updateUnit, getRelevantElement())) {
                container.add(updateUnit, getRelevantElement());
            }
        } else {
            container.remove(getRelevantElement());
        }
    }
}
 
Example #14
Source File: Unit.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void setMarked (boolean marked) {
    if (marked == isMarked()) {
        return;
    }
    OperationContainer container;
    if (isNbms) {
        container = Containers.forUpdateNbms ();
    } else if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType ()) {
        container = Containers.forCustomInstall ();
    } else {
        container = Containers.forUpdate ();
    }
    if (marked) {
        try {
            container.add (updateUnit, updateEl);
        } catch (IllegalArgumentException ex) {
            log.log(Level.WARNING, ex.getMessage());
        }
    } else {
        container.remove (updateEl);
    }
}
 
Example #15
Source File: MissingModuleProblemsProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static InstallationResult installUpdate(@NonNull final UpdateElement update) {
    final ProgressHandle installHandle = ProgressHandle.createHandle(NbBundle.getMessage(
            MissingModuleProblemsProvider.class,
            "TXT_InstallModule",
            update.getDisplayName()));
    installHandle.start();
    try {
        final OperationContainer<InstallSupport> container = OperationContainer.createForInstall();
        container.add(Collections.singleton(update));
        final InstallSupport support = container.getSupport();
        try {
            final InstallSupport.Validator v = support.doDownload(installHandle, true, true);
            final InstallSupport.Installer i = support.doValidate(v, installHandle);
            final Restarter r = support.doInstall(i, installHandle);
            return InstallationResult.success(support, r);
        } catch (OperationException ex) {
            Exceptions.printStackTrace(ex);
        }
    } finally {
        installHandle.finish();
    }
    return InstallationResult.failure();
}
 
Example #16
Source File: JUnitLibraryInstaller.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void install(OperationContainer<InstallSupport> oc, UpdateElement jUnitElement, UpdateUnit jUnitLib, boolean useUserdirAsFallback) throws OperationException {
    // download
    LOG.log(Level.FINE, "Try to download {0}", jUnitElement);
    ProgressHandle downloadHandle = ProgressHandleFactory.createHandle (download_handle());
    Validator validator = oc.getSupport().doDownload(downloadHandle, null, useUserdirAsFallback);
    // install
    ProgressHandle validateHandle = ProgressHandleFactory.createHandle (validate_handle());
    Installer installer = oc.getSupport().doValidate(validator, validateHandle);
    LOG.log(Level.FINE, "Try to install {0}", jUnitElement);
    ProgressHandle installHandle = ProgressHandleFactory.createHandle (install_handle());
    Restarter restarter = oc.getSupport().doInstall(installer, installHandle);
    assert restarter == null : "Not need to restart while installing " + jUnitLib;
    LOG.log(Level.FINE, "Done {0}", jUnitElement);
}
 
Example #17
Source File: UnitTab.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Forces refresh of UI data. Replans work to EDT, but waits for the result.
 * First waits until the download/install task completes, so that UI models
 * for checking items are not suspended by the pending operation.
 * <p/>
 * Will <b>clean all containers</b> and populate them again from the UI.
 * @return newly populated Container
 */
OperationContainer refreshData() {
    if (!SwingUtilities.isEventDispatchThread()) {
        final OperationContainer[] c = new OperationContainer[1];
        RequestProcessor.Task runningTask = PluginManagerUI.getRunningTask();
        if (runningTask != null) {
            runningTask.waitFinished();
        }
        try {
            SwingUtilities.invokeAndWait(() -> {
                c[0] = refreshData();
            });
        } catch (InterruptedException | InvocationTargetException ex) {
            OperationContainer x = Containers.forEnable();
            x.removeAll();
        }
        return c[0];
    }
    refreshState ();
    try {
        clearContainers();
        fireUpdataUnitChange();
    } catch (Throwable t) {
        t.printStackTrace();
    }
    if(!finished) {
        UnitCategoryTableModel.restoreState (model.getUnits (), state, model.isMarkedAsDefault ());
    }
    return prepareContainer();
}
 
Example #18
Source File: UnitTab.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void performerImpl() {
    final int row = getSelectedRow ();
    final Map<String, Boolean> state = UnitCategoryTableModel.captureState (model.getUnits ());
    OperationContainer<OperationSupport> c = Containers.forDisable();
    for (Unit u : model.getUnits()) {
        if (u.isMarked() && isEnabled(u)) {
            c.add(u.updateUnit, u.getRelevantElement());
        }
    }
    UninstallUnitWizard wizard = new UninstallUnitWizard ();
    boolean finished = false;
    try {
        finished = wizard.invokeWizard(false);
    } finally {
        Containers.forUninstall().removeAll();
        Containers.forDisable().removeAll();
        Containers.forEnable().removeAll();
        fireUpdataUnitChange();
        if (!finished) {
            UnitCategoryTableModel.restoreState(model.getUnits(), state, model.isMarkedAsDefault());
        }
        restoreSelectedRow(row);
        refreshState();
        focusTable();
    }
}
 
Example #19
Source File: UpdateHandler.java    From jeddict with Apache License 2.0 5 votes vote down vote up
static OperationContainer<InstallSupport> feedContainer(Collection<UpdateElement> updates, boolean update) {
    if (updates == null || updates.isEmpty()) {
        return null;
    }
    // create a container for update
    OperationContainer<InstallSupport> container;
    if (update) {
        container = OperationContainer.createForUpdate();
    } else {
        container = OperationContainer.createForInstall();
    }

    // loop all updates and add to container for update
    for (UpdateElement ue : updates) {
        if (container.canBeAdded(ue.getUpdateUnit(), ue) && JeddictInstaller.CATEGORY.equals(ue.getCategory())) {
            JeddictInstaller.info("Update to Jeddict plugin found: " + ue);
            OperationInfo<InstallSupport> operationInfo = container.add(ue);
            if (operationInfo == null) {
                continue;
            }
            container.add(operationInfo.getRequiredElements());
            if (!operationInfo.getBrokenDependencies().isEmpty()) {
                // have a problem => cannot continue
                JeddictInstaller.info("There are broken dependencies => cannot continue, broken deps: " + operationInfo.getBrokenDependencies());
                return null;
            }
        }
    }
    return container;
}
 
Example #20
Source File: DisableJ2EEKeepsMobilityEnabledTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testEnablingJ2EEEnablesJavaViaAutoUpdateManager() throws Exception {
    if (j2ee == null || mobility == null) {
        return;
    }
    OperationContainer<OperationSupport> cc = OperationContainer.createForDisable();
    OperationInfo<OperationSupport> info;
    info = cc.add(j2eeUE);
    assertFalse("Mobility remains enabled so far", cc.listAll().toString().contains("org.netbeans.modules.mobility.kit"));
    cc.add(info.getRequiredElements());
    assertFalse("Mobility remains enabled finally", cc.listAll().toString().contains("org.netbeans.modules.mobility.kit"));
}
 
Example #21
Source File: Containers.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static OperationContainer<InstallSupport> forInternalUpdate () {
    synchronized (Containers.class) {
        OperationContainer<InstallSupport> container = null;
        if (INTERNAL_UPDATE != null) {
            container = INTERNAL_UPDATE.get ();
        }
        if(container == null) {
            container = OperationContainer.createForInternalUpdate();
            INTERNAL_UPDATE = new WeakReference<OperationContainer<InstallSupport>> (container);
        }
        return container;
    }
}
 
Example #22
Source File: DeveloperOptionsPanel.java    From constellation with Apache License 2.0 5 votes vote down vote up
private void masterResetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_masterResetButtonActionPerformed

        Collection<UpdateElement> toUninstall = new ArrayList<>();

        for (UpdateUnit unit : UpdateManager.getDefault().getUpdateUnits()) {
            String codeName = unit.getCodeName();
            if (!codeName.equals("au.gov.asd.tac.constellation.autoupdate")
                    && !codeName.startsWith("org.netbeans.")
                    && !codeName.startsWith("org.openide.")
                    && !codeName.startsWith("org.jdesktop.")) {
                UpdateElement element = unit.getInstalled();
                if (element != null) {
                    toUninstall.add(element);
                }
            }
        }

        OperationContainer<OperationSupport> operationContainer = OperationContainer.createForUninstall();
        operationContainer.add(toUninstall);

        OperationSupport operationSupport = operationContainer.getSupport();
        try {
            operationSupport.doOperation(null);
        } catch (OperationException ex) {
            ex.printStackTrace();
        }
    }
 
Example #23
Source File: Containers.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static OperationContainer<OperationSupport> forCustomUninstall () {
    synchronized (Containers.class) {
        OperationContainer<OperationSupport> container = null;
        if (CUSTOM_UNINSTALL != null) {
            container = CUSTOM_UNINSTALL.get ();
        }
        if(container == null) {
            container = OperationContainer.createForCustomUninstallComponent ();
            CUSTOM_UNINSTALL = new WeakReference<OperationContainer<OperationSupport>> (container);
        }
        return container;
    }        
}
 
Example #24
Source File: Containers.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static OperationContainer<OperationSupport> forCustomInstall () {
    synchronized (Containers.class) {
        OperationContainer<OperationSupport> container = null;
        if (CUSTOM_INSTALL != null) {
            container = CUSTOM_INSTALL.get ();
        }
        if(container == null) {
            container = OperationContainer.createForCustomInstallComponent ();
            CUSTOM_INSTALL = new WeakReference<OperationContainer<OperationSupport>> (container);
        }
        return container;
    }        
}
 
Example #25
Source File: Containers.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static OperationContainer<OperationSupport> forDisable() {
    synchronized(Containers.class) {
        OperationContainer<OperationSupport> container = null;
        if (DISABLE != null) {
            container = DISABLE.get();
        }
        if(container == null) {
            container = OperationContainer.createForDisable();
            DISABLE = new WeakReference<OperationContainer<OperationSupport>>(container);
        }
        return container;
    }        
}
 
Example #26
Source File: Containers.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static OperationContainer<OperationSupport> forEnable() {
    synchronized(Containers.class) {
        OperationContainer<OperationSupport> container = null;
        if (ENABLE != null) {
            container = ENABLE.get();
        }
        if(container == null) {
            container = OperationContainer.createForEnable();
            ENABLE = new WeakReference<OperationContainer<OperationSupport>>(container);
        }
        return container;
    }        
}
 
Example #27
Source File: UpdateHandler.java    From netbeans-wakatime with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
static boolean allLicensesApproved(OperationContainer<InstallSupport> container) {
    if (!container.listInvalid().isEmpty()) {
        return false;
    }
    for (OperationInfo<InstallSupport> info : container.listAll()) {
        String license = info.getUpdateElement().getLicence();
        if (!isLicenseApproved(license)) {
            return false;
        }
    }
    return true;
}
 
Example #28
Source File: Containers.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static OperationContainer<OperationSupport> forUninstall() {
    synchronized(Containers.class) {
        OperationContainer<OperationSupport> container = null;
        if (UNINSTALL != null) {
            container = UNINSTALL.get();
        }
        if (container == null) {
            container = OperationContainer.createForUninstall();
            UNINSTALL = new WeakReference<OperationContainer<OperationSupport>>(container);
        }
        return container;
    }        
}
 
Example #29
Source File: Containers.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static OperationContainer<InstallSupport> forUpdate() {
    synchronized(Containers.class) {
        OperationContainer<InstallSupport> container = null;
        if (UPDATE != null) {
            container = UPDATE.get();
        }
        if (container == null) {
            container = OperationContainer.createForUpdate();
            UPDATE = new WeakReference<OperationContainer<InstallSupport>>(container);
        }
        return container;
    }        
}
 
Example #30
Source File: OperationWizardModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Determines if there are modules to install before the main enable operation
 * may be successful.
 * @return modules to install
 */
public boolean hasComponentsToInstall() {
    OperationContainer<InstallSupport> oc = getInstallContainer();
    if (oc == null) {
        return false;
    }
    return !oc.listAll().isEmpty();
}