本文整理汇总了Java中org.netbeans.installer.product.Registry.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Registry.getInstance方法的具体用法?Java Registry.getInstance怎么用?Java Registry.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.installer.product.Registry
的用法示例。
在下文中一共展示了Registry.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeForward
import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
@Override
public void executeForward() {
final Registry registry = Registry.getInstance();
// remove all current children (if there are any), as the components
// selection has probably changed and we need to rebuild from scratch
getChildren().clear();
// we're creating a bundle - we only need to download and package things
addChild(preCreateBundleSummaryPanel);
addChild(downloadConfigurationLogicAction);
addChild(downloadInstallationDataAction);
addChild(createBundleAction);
if (registry.getTargetPlatform().isCompatibleWith(Platform.MACOSX)) {
addChild(createAppLauncherAction);
} else {
addChild(createNativeLauncherAction);
}
addChild(postCreateBundleSummaryPanel);
super.executeForward();
}
示例2: 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;
}
示例3: InstallationDetailsTreeModel
import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
public InstallationDetailsTreeModel() {
final Registry registry = Registry.getInstance();
components.addAll(registry.getProducts(DetailedStatus.INSTALLED_SUCCESSFULLY));
components.addAll(registry.getProducts(DetailedStatus.INSTALLED_WITH_WARNINGS));
components.addAll(registry.getProducts(DetailedStatus.FAILED_TO_INSTALL));
components.addAll(registry.getProducts(DetailedStatus.UNINSTALLED_SUCCESSFULLY));
components.addAll(registry.getProducts(DetailedStatus.UNINSTALLED_WITH_WARNINGS));
components.addAll(registry.getProducts(DetailedStatus.FAILED_TO_UNINSTALL));
}
示例4: isThereAnythingVisibleToInstall
import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
private boolean isThereAnythingVisibleToInstall() {
final Registry registry = Registry.getInstance();
final List<Product> toInstall = new LinkedList<Product>();
toInstall.addAll(registry.getProducts(Status.NOT_INSTALLED));
toInstall.addAll(registry.getProducts(Status.TO_BE_INSTALLED));
for (Product product: toInstall) {
if (product.isVisible()) {
return true;
}
}
return false;
}
示例5: isThereAnythingVisibleToUninstall
import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
private boolean isThereAnythingVisibleToUninstall() {
final Registry registry = Registry.getInstance();
final List<Product> toUninstall = new LinkedList<Product>();
toUninstall.addAll(registry.getProducts(Status.INSTALLED));
toUninstall.addAll(registry.getProducts(Status.TO_BE_UNINSTALLED));
for (Product product: toUninstall) {
if (product.isVisible()) {
return true;
}
}
return false;
}
示例6: 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)));
}
}
示例7: initializeRegistry
import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
private void initializeRegistry() {
LogManager.logEntry("... initializing Registry");
final Registry registry = Registry.getInstance();
registry.setLocalDirectory(getLocalDirectory());
registry.setFinishHandler(this);
LogManager.logExit("... end of initializing ErrorHandler");
}
示例8: WelcomePanel
import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
public WelcomePanel() {
setProperty(TITLE_PROPERTY,
DEFAULT_TITLE);
setProperty(DESCRIPTION_PROPERTY,
DEFAULT_DESCRIPTION);
setProperty(WELCOME_TEXT_PROPERTY,
DEFAULT_WELCOME_TEXT);
setProperty(WELCOME_ALREADY_INSTALLED_TEXT_PROPERTY,
DEFAULT_WELCOME_ALREADY_INSTALLED_TEXT);
setProperty(WELCOME_ALREADY_INSTALLED_NEXT_BUTTON_TEXT_PROPERTY,
DEFAULT_WELCOME_ALREADY_INSTALLED_NEXT_BUTTON_TEXT);
try {
defaultRegistry = Registry.getInstance();
bundledRegistry = new Registry();
final String bundledRegistryUri = System.getProperty(
Registry.BUNDLED_PRODUCT_REGISTRY_URI_PROPERTY);
if (bundledRegistryUri != null) {
bundledRegistry.loadProductRegistry(bundledRegistryUri);
} else {
bundledRegistry.loadProductRegistry(
Registry.DEFAULT_BUNDLED_PRODUCT_REGISTRY_URI);
}
} catch (InitializationException e) {
ErrorManager.notifyError("Cannot load bundled registry", e);
}
}
示例9: 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");
}
示例10: 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);
}
}
}
示例11: 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");
}
示例12: initialize
import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
@Override
protected void initialize() {
final Registry registry = Registry.getInstance();
final boolean errorsEncountered =
registry.getProducts(FAILED_TO_INSTALL).size() > 0 &&
registry.getProducts(FAILED_TO_UNINSTALL).size() > 0;
if (errorsEncountered) {
messagePane.setContentType(component.getProperty(MESSAGE_ERRORS_CONTENT_TYPE_PROPERTY));
messagePane.setText(component.getProperty(MESSAGE_ERRORS_TEXT_PROPERTY));
} else {
messagePane.setContentType(component.getProperty(MESSAGE_SUCCESS_CONTENT_TYPE_PROPERTY));
messagePane.setText(component.getProperty(MESSAGE_SUCCESS_TEXT_PROPERTY));
}
List<Product> components;
components = registry.getProducts(INSTALLED_SUCCESSFULLY);
if (components.size() > 0) {
successfullyBundledComponentsLabel.setVisible(true);
successfullyBundledComponentsPane.setVisible(true);
successfullyBundledComponentsLabel.setText(component.getProperty(SUCCESSFULLY_BUNDLED_COMPONENTS_LABEL_TEXT_PROPERTY));
successfullyBundledComponentsPane.setContentType(component.getProperty(SUCCESSFULLY_BUNDLED_COMPONENTS_CONTENT_TYPE_PROPERTY));
successfullyBundledComponentsPane.setText(StringUtils.format(component.getProperty(SUCCESSFULLY_BUNDLED_COMPONENTS_TEXT_PROPERTY), StringUtils.asString(components, component.getProperty(COMPONENTS_LIST_SEPARATOR_PROPERTY))));
} else {
successfullyBundledComponentsLabel.setVisible(false);
successfullyBundledComponentsPane.setVisible(false);
}
components = registry.getProducts(FAILED_TO_INSTALL);
if (components.size() > 0) {
componentsFailedToBundleLabel.setVisible(true);
componentsFailedToBundlePane.setVisible(true);
componentsFailedToBundleLabel.setText(component.getProperty(COMPONENTS_FAILED_TO_BUNDLE_LABEL_TEXT_PROPERTY));
componentsFailedToBundlePane.setContentType(component.getProperty(COMPONENTS_FAILED_TO_BUNDLE_CONTENT_TYPE_PROPERTY));
componentsFailedToBundlePane.setText(StringUtils.format(component.getProperty(COMPONENTS_FAILED_TO_BUNDLE_TEXT_PROPERTY), StringUtils.asString(components, component.getProperty(COMPONENTS_LIST_SEPARATOR_PROPERTY))));
} else {
componentsFailedToBundleLabel.setVisible(false);
componentsFailedToBundlePane.setVisible(false);
}
viewLogButton.setText(component.getProperty(VIEW_LOG_BUTTON_TEXT_PROPERTY));
sendLogButton.setText(component.getProperty(SEND_LOG_BUTTON_TEXT_PROPERTY));
}
示例13: 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();
}
示例14: initialize
import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
protected void initialize() {
final Registry registry = Registry.getInstance();
final List<Product> successfulInstall = registry.getProducts(INSTALLED_SUCCESSFULLY);
final List<Product> warningInstall = registry.getProducts(INSTALLED_WITH_WARNINGS);
final List<Product> errorInstall = registry.getProducts(FAILED_TO_INSTALL);
final List<Product> successfulUninstall = registry.getProducts(UNINSTALLED_SUCCESSFULLY);
final List<Product> warningUninstall = registry.getProducts(UNINSTALLED_WITH_WARNINGS);
final List<Product> errorUninstall = registry.getProducts(FAILED_TO_UNINSTALL);
if (errorInstall.size() > 0) {
messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_ERRORS_PROPERTY));
messagePaneInstall.setText(StringUtils.format(
component.getProperty(MESSAGE_TEXT_ERRORS_PROPERTY),
errorInstall.get(0).getDisplayName(),
LogManager.getLogFile()));
} else if (warningInstall.size() > 0) {
messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_WARNINGS_PROPERTY));
messagePaneInstall.setText(StringUtils.format(
component.getProperty(MESSAGE_TEXT_WARNINGS_PROPERTY),
warningInstall.get(0).getDisplayName(),
LogManager.getLogFile()));
} else if (successfulInstall.size() > 0) {
messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_SUCCESS_PROPERTY));
messagePaneInstall.setText(StringUtils.format(
component.getProperty(MESSAGE_TEXT_SUCCESS_PROPERTY),
successfulInstall.get(0).getDisplayName(),
LogManager.getLogFile()));
} else {
messagePaneInstall.setVisible(false);
}
messagePaneFinish.setVisible(true);
messagePaneFinish.setContentType(DEFAULT_MESSAGE_FINISH_PROCESS_CONTENT_TYPE);
messagePaneFinish.setText(DEFAULT_MESSAGE_FINISH_PROCESS);
if (errorUninstall.size() > 0) {
messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_ERRORS_UNINSTALL_PROPERTY));
messagePaneUninstall.setText(StringUtils.format(
component.getProperty(MESSAGE_TEXT_ERRORS_UNINSTALL_PROPERTY),
errorUninstall.get(0).getDisplayName(),
LogManager.getLogFile()));
} else if (warningUninstall.size() > 0) {
messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_WARNINGS_UNINSTALL_PROPERTY));
messagePaneUninstall.setText(StringUtils.format(
component.getProperty(MESSAGE_TEXT_WARNINGS_UNINSTALL_PROPERTY),
warningUninstall.get(0).getDisplayName(),
LogManager.getLogFile()));
} else if (successfulUninstall.size() > 0) {
messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_SUCCESS_UNINSTALL_PROPERTY));
messagePaneUninstall.setText(StringUtils.format(
component.getProperty(MESSAGE_TEXT_SUCCESS_UNINSTALL_PROPERTY),
successfulUninstall.get(0).getDisplayName(),
LogManager.getLogFile()));
} else {
messagePaneUninstall.setVisible(false);
}
final List<Product> products = new LinkedList<Product>();
products.addAll(successfulInstall);
products.addAll(warningInstall);
runAppNow.setSelected(false);
if (!products.isEmpty()) {
runAppNow.setText(StringUtils.format(DEFAULT_MESSAGE_LAUNCH_APPLICATION_NOW,
products.get(0).getDisplayName()));
runAppNow.doClick();
app = products.get(0);
} else {
runAppNow.setVisible(false);
}
}
示例15: 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();
}