当前位置: 首页>>代码示例>>Java>>正文


Java Registry.getProductsToUninstall方法代码示例

本文整理汇总了Java中org.netbeans.installer.product.Registry.getProductsToUninstall方法的典型用法代码示例。如果您正苦于以下问题:Java Registry.getProductsToUninstall方法的具体用法?Java Registry.getProductsToUninstall怎么用?Java Registry.getProductsToUninstall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.installer.product.Registry的用法示例。


在下文中一共展示了Registry.getProductsToUninstall方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInstallationLocation

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
/**
 * Returns installation location
 *
 * @return installation location
 */
private static File getInstallationLocation() {
    if (installationLocation == null) {
        String target = System.getProperty(Registry.TARGET_COMPONENT_UID_PROPERTY);
        Registry registry = Registry.getInstance();

        for (Product product : registry.getProductsToUninstall()) {
            if (product.getUid().equals(target)) {
                installationLocation = product.getInstallationLocation();
            }
        }
    }

    return installationLocation;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:UninstallUtils.java

示例2: execute

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
@Override
public void execute() {
    LogManager.logIndent("Start products uninstallation");
    final Registry registry = Registry.getInstance();
    final List<Product> products = registry.getProductsToUninstall();
    final int percentageChunk = Progress.COMPLETE / products.size();
    final int percentageLeak = Progress.COMPLETE % products.size();
    
    overallProgress = new CompositeProgress();
    overallProgress.setPercentage(percentageLeak);
    overallProgress.synchronizeDetails(true);
    
    getWizardUi().setProgress(overallProgress);
    for (Product product : products) {         
        // initiate the progress for the current element
        currentProgress = new Progress();
        
        overallProgress.addChild(currentProgress, percentageChunk);
        overallProgress.setTitle(StringUtils.format(
                getProperty(PROGRESS_UNINSTALL_TITLE_PROPERTY),
                product.getDisplayName()));
        try {
            product.uninstall(currentProgress);
            
            // sleep a little so that the user can perceive that something
            // is happening
            SystemUtils.sleep(200);
        }  catch (UninstallationException e) {
            // do not override already set exit code
            if (System.getProperties().get(Installer.EXIT_CODE_PROPERTY) == null) {
                 System.getProperties().put(Installer.EXIT_CODE_PROPERTY, 
                         new Integer(UNINSTALLATION_ERROR_CODE));
            }
            // adjust the component's status and save this error - it will
            // be reused later at the PostInstallSummary
            product.setStatus(Status.INSTALLED);
            product.setUninstallationError(e);
            
            // since the product failed to uninstall  - we should remove
            // the components it depends on from our plans to uninstall
            for(Product requirement : registry.getProducts()) {
                if ((requirement.getStatus() == Status.TO_BE_UNINSTALLED) &&
                        registry.satisfiesRequirement(requirement, product)) {
                    UninstallationException requirementError =
                            new UninstallationException(
                            StringUtils.format(
                            getProperty(PROGRESS_UNINSTALL_TITLE_PROPERTY),
                            requirement.getDisplayName(),
                            product.getDisplayName()), e);
                    
                    requirement.setStatus(Status.INSTALLED);
                    requirement.setUninstallationError(requirementError);
                    
                    products.remove(requirement);
                }
            }
            
            // finally notify the user of what has happened
            ErrorManager.notify(ErrorLevel.ERROR, e);
        }
    }
    LogManager.logUnindent("... finished products uninstallation");
            
    LogManager.logUnindent("... starting updates and plugins uninstallation");        
    try {
        // delete updated files and downloaded plugins in installation folder
        FileUtils.deleteFiles(new ArrayList<File>(UninstallUtils.getFilesToDeteleAfterUninstallation()));            
        
        // delete all empty folders in installation directory                          
        FileUtils.deleteFiles(UninstallUtils.getEmptyFolders());
    } catch (IOException ex) {
        LogManager.log(ex);
    }
    LogManager.logUnindent("... finished updates and plugins uninstallation");        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:76,代码来源:UninstallAction.java

示例3: executeForward

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
@Override
public void executeForward() {
    final Registry registry = Registry.getInstance();
    final List<Product> toInstall = registry.getProductsToInstall();
    final List<Product> toUninstall = registry.getProductsToUninstall();

    // remove all current children (if there are any), as the components
    // selection has probably changed and we need to rebuild from scratch
    getChildren().clear();

    // if we're installing, we ask for input, run a wizard sequence for
    // each selected component and then download and install
    if (toInstall.size() > 0) {
        addChild(downloadConfigurationLogicAction);
        addChild(licensesPanel);

        for (Product product : toInstall) {
            if (!productSequences.containsKey(product)) {
                productSequences.put(
                        product,
                        new ProductWizardSequence(product));
            }

            addChild(productSequences.get(product));
        }
    }

    addChild(preInstallSummaryPanel);

    if (toUninstall.size() > 0) {
        addChild(uninstallAction);
    }

    if (toInstall.size() > 0) {
        addChild(downloadInstallationDataAction);
        addChild(installAction);
    }

    addChild(postInstallSummaryPanel);

    super.executeForward();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:MainSequence.java

示例4: executeForward

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
@Override
public void executeForward() {
    final Registry registry = Registry.getInstance();
    final List<Product> toInstall = registry.getProductsToInstall();
    final List<Product> toUninstall = registry.getProductsToUninstall();

    // remove all current children (if there are any), as the components
    // selection has probably changed and we need to rebuild from scratch
    getChildren().clear();

    // the set of wizard components differs greatly depending on the execution
    // mode - if we're installing, we ask for input, run a wizard sequence for
    // each selected component and then download and install; if we're creating
    // a bundle, we only need to download and package things

    if (toInstall.size() > 0) {
        addChild(downloadConfigurationLogicAction);
        addChild(licensesPanel);

        for (Product product : toInstall) {
            if (!productSequences.containsKey(product)) {
                productSequences.put(
                        product,
                        new ProductWizardSequence(product));
            }

            addChild(productSequences.get(product));
        }
    }

    addChild(preInstallSummaryPanel);

    if (toUninstall.size() > 0) {
        addChild(uninstallAction);
    }

    if (toInstall.size() > 0) {
        addChild(downloadInstallationDataAction);
        addChild(installAction);            
    }

    addChild(postInstallSummaryPanel);
    
    super.executeForward();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:MainSequence.java


注:本文中的org.netbeans.installer.product.Registry.getProductsToUninstall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。