public static void triggerInstall(SolutionInstallationInfo info) {
   String installId = info.getInstallId();
   String mpcState = info.getState();
   CatalogDescriptor catalogDescriptor = info.getCatalogDescriptor();
   MarketplaceWizardCommand command = new MarketplaceWizardCommand();
   command.setSelectedCatalogDescriptor(catalogDescriptor);
   try {
     if (mpcState != null) {
       command.setWizardState(URLDecoder.decode(mpcState, UTF_8));
     }
     Map<String, Operation> nodeIdToOperation = new HashMap<String, Operation>();
     nodeIdToOperation.put(URLDecoder.decode(installId, UTF_8), Operation.INSTALL);
     command.setOperationByNodeId(nodeIdToOperation);
   } catch (UnsupportedEncodingException e1) {
     throw new IllegalStateException(e1);
   }
   try {
     command.execute(new ExecutionEvent());
   } catch (ExecutionException e) {
     IStatus status =
         MarketplaceClientUi.computeStatus(
             new InvocationTargetException(e),
             Messages.MarketplaceBrowserIntegration_cannotOpenMarketplaceWizard);
     StatusManager.getManager()
         .handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
   }
 }
Esempio n. 2
0
 private static ImageDescriptor imageDescriptorForUrl(ICatalog catalog, String imageUrl)
     throws MalformedURLException {
   if (imageUrl != null && imageUrl.length() > 0) {
     ResourceProvider resourceProvider =
         MarketplaceClientUiPlugin.getInstance().getResourceProvider();
     ResourceFuture resource = resourceProvider.getResource(imageUrl);
     if (resource == null) {
       String requestSource =
           NLS.bind(Messages.CatalogDescriptor_requestCatalog, catalog.getName(), catalog.getId());
       try {
         resource = resourceProvider.retrieveResource(requestSource, imageUrl);
       } catch (URISyntaxException e) {
         MarketplaceClientUi.log(
             IStatus.WARNING,
             Messages.CatalogDescriptor_badUri,
             catalog.getName(),
             catalog.getId(),
             resource,
             e);
       } catch (IOException e) {
         MarketplaceClientUi.log(
             IStatus.WARNING,
             Messages.CatalogDescriptor_downloadError,
             catalog.getName(),
             catalog.getId(),
             resource,
             e);
       }
     }
     if (resource != null) {
       return new ResourceProviderImageDescriptor(resourceProvider, imageUrl);
     }
     return ImageDescriptor.createFromURL(URLUtil.toURL(imageUrl));
   }
   return null;
 }