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


Java Registry.getProductsToInstall方法代码示例

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


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

示例1: updateSizes

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
private void updateSizes() {
    final Registry registry = Registry.getInstance();
    
    long installationSize = 0;
    long downloadSize     = 0;
    for (Product product: registry.getProductsToInstall()) {
        installationSize += product.getRequiredDiskSpace();
        downloadSize += product.getDownloadSize();
    }
    
    String template = panel.getProperty(SIZES_LABEL_TEXT_NO_DOWNLOAD_PROPERTY);
    for (RegistryNode remoteNode: registry.getNodes(RegistryType.REMOTE)) {
        if (remoteNode.isVisible()) {
            template = panel.getProperty(
                    SIZES_LABEL_TEXT_PROPERTY);
        }
    }
    
    if (installationSize == 0) {
        sizesLabel.setText(StringUtils.format(
                template,
                panel.getProperty(DEFAULT_INSTALLATION_SIZE_PROPERTY),
                panel.getProperty(DEFAULT_DOWNLOAD_SIZE_PROPERTY)));
    } else {
        sizesLabel.setText(StringUtils.format(
                template,
                StringUtils.formatSize(installationSize),
                StringUtils.formatSize(downloadSize)));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:ComponentsSelectionPanel.java

示例2: execute

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
public void execute() {
    LogManager.logEntry("getting all installation data");
    final Registry registry = Registry.getInstance();
    final List<Product> products = registry.getProductsToInstall();
    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 (int i = 0; i < products.size(); i++) {
        // get the handle of the current item
        final Product product = products.get(i);
        
        // initiate the progress for the current element
        currentProgress = new Progress();
        
        overallProgress.addChild(currentProgress, percentageChunk);
        try {
            String prop = product.getRegistryType() == RegistryType.REMOTE ?
                PROGRESS_TITLE_REMOTE_PROPERTY :
                PROGRESS_TITLE_LOCAL_PROPERTY;
            String overallProgressTitle = StringUtils.format(
                    getProperty(prop), product.getDisplayName());
            overallProgress.setTitle(overallProgressTitle);
            
            product.downloadData(currentProgress);
            
            // check for cancel status
            if (isCanceled()) return;
            
            // sleep a little so that the user can perceive that something
            // is happening
            SystemUtils.sleep(200);
        }  catch (DownloadException e) {
            // wrap the download exception with a more user-friendly one
            InstallationException error = new InstallationException(
                     StringUtils.format(
                    getProperty(DOWNLOAD_FAILED_EXCEPTION_PROPERTY),
                    product.getDisplayName()), e);
            
            // adjust the product's status and save this error - it will
            // be reused later at the PostInstallSummary
            product.setStatus(Status.NOT_INSTALLED);
            product.setInstallationError(error);
            
            // since the installation data for the current product failed to
            // be downloaded, we should cancel the installation of the products
            // that may require this one
            for(Product dependent: registry.getProducts()) {
                if ((dependent.getStatus()  == Status.TO_BE_INSTALLED) &&
                        registry.satisfiesRequirement(product, dependent)) {
                   String exString = StringUtils.format(
                            getProperty(DEPENDENT_FAILED_EXCEPTION_PROPERTY),
                            dependent.getDisplayName(),
                            product.getDisplayName());
                    
                    final InstallationException dependentError =
                            new InstallationException(exString, error);
                    
                    dependent.setStatus(Status.NOT_INSTALLED);
                    dependent.setInstallationError(dependentError);
                    
                    products.remove(dependent);
                }
            }
            
            // finally notify the user of what has happened
            LogManager.log(ErrorLevel.ERROR, error);
        }
    }
    LogManager.logExit("... finished getting of the installation data");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:76,代码来源:DownloadInstallationDataAction.java

示例3: execute

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
public void execute() {
    final Registry registry = Registry.getInstance();
    final List<Product> products = registry.getProductsToInstall();
    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 (int i = 0; i < products.size(); i++) {
        // get the handle of the current item
        final Product product = products.get(i);
        
        // initiate the progress for the current element
        currentProgress = new Progress();
        
        overallProgress.addChild(currentProgress, percentageChunk);
        try {
            String prop = product.getRegistryType() == RegistryType.REMOTE ?
                PROGRESS_TITLE_REMOTE_PROPERTY :
                PROGRESS_TITLE_LOCAL_PROPERTY;
            String overallProgressTitle = StringUtils.format(
                    getProperty(prop), product.getDisplayName());
            
            overallProgress.setTitle(overallProgressTitle);
            
            product.downloadLogic(currentProgress);
            
            // ensure that the current progress has reached the complete state
            // (sometimes it just does not happen and we're left over with 99%)
            currentProgress.setPercentage(Progress.COMPLETE);
            
            // check for cancel status
            if (isCanceled()) return;
            
            // sleep a little so that the user can perceive that something
            // is happening
            SystemUtils.sleep(200);
        } catch (DownloadException e) {
            // wrap the download exception with a more user-friendly one
            final InstallationException error = new InstallationException(
                    StringUtils.format(
                    getProperty(DOWNLOAD_FAILED_EXCEPTION_PROPERTY),
                    product.getDisplayName()), e);
            
            // adjust the product's status and save this error - it will
            // be reused later at the PostInstallSummary
            product.setStatus(Status.NOT_INSTALLED);
            product.setInstallationError(error);
            
            // since the configuration logic for the current product failed to
            // be downloaded, we should cancel the installation of the products
            // that may require this one
            for(Product dependent: registry.getProducts()) {
                if ((dependent.getStatus()  == Status.TO_BE_INSTALLED) &&
                        registry.satisfiesRequirement(product, dependent)) {
                    String exString = StringUtils.format(
                            getProperty(DEPENDENT_FAILED_EXCEPTION_PROPERTY),
                            dependent.getDisplayName(),
                            product.getDisplayName());
                    
                    final InstallationException dependentError =
                            new InstallationException(exString, error);
                    
                    dependent.setStatus(Status.NOT_INSTALLED);
                    dependent.setInstallationError(dependentError);
                    
                    products.remove(dependent);
                }
            }
            
            // finally notify the user of what has happened
            ErrorManager.notify(ErrorLevel.ERROR, error);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:79,代码来源:DownloadConfigurationLogicAction.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();

    // 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

示例5: 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.getProductsToInstall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。