本文整理汇总了Java中org.netbeans.installer.product.RegistryType类的典型用法代码示例。如果您正苦于以下问题:Java RegistryType类的具体用法?Java RegistryType怎么用?Java RegistryType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistryType类属于org.netbeans.installer.product包,在下文中一共展示了RegistryType类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateSizes
import org.netbeans.installer.product.RegistryType; //导入依赖的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)));
}
}
示例2: execute
import org.netbeans.installer.product.RegistryType; //导入依赖的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");
}
示例3: execute
import org.netbeans.installer.product.RegistryType; //导入依赖的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);
}
}
}