Search in sources :

Example 1 with MarketplaceWizardCommand

use of org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand in project epp.mpc by eclipse.

the class MarketplaceClientService method openProvisioning.

public void openProvisioning(IMarketplaceClientConfiguration configuration) {
    checkInitialState(configuration);
    MarketplaceWizardCommand command = new MarketplaceWizardCommand();
    command.setConfiguration(configuration);
    WizardState wizardState = new WizardState();
    wizardState.setProceedWithInstallation(true);
    command.setWizardDialogState(wizardState);
    execute(command);
}
Also used : AbstractMarketplaceWizardCommand(org.eclipse.epp.internal.mpc.ui.commands.AbstractMarketplaceWizardCommand) MarketplaceWizardCommand(org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand) WizardState(org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.WizardState)

Example 2 with MarketplaceWizardCommand

use of org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand in project epp.mpc by eclipse.

the class MarketplaceClientService method openInstalled.

public void openInstalled(IMarketplaceClientConfiguration configuration) {
    MarketplaceWizardCommand command = new MarketplaceWizardCommand();
    command.setConfiguration(configuration);
    WizardState wizardState = new WizardState();
    wizardState.setContentType(ContentType.INSTALLED);
    wizardState.setProceedWithInstallation(false);
    command.setWizardDialogState(wizardState);
    execute(command);
}
Also used : AbstractMarketplaceWizardCommand(org.eclipse.epp.internal.mpc.ui.commands.AbstractMarketplaceWizardCommand) MarketplaceWizardCommand(org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand) WizardState(org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.WizardState)

Example 3 with MarketplaceWizardCommand

use of org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand in project epp.mpc by eclipse.

the class AbstractMarketplaceWizardBotTest method launchMarketplaceWizard.

protected void launchMarketplaceWizard() {
    final MarketplaceWizardCommand marketplaceWizardCommand = new MarketplaceWizardCommand();
    WizardState wizardState = new WizardState();
    wizardState.setContent(new LinkedHashSet<INode>(Arrays.asList(TEST_NODES)));
    wizardState.setProceedWithInstallation(false);
    marketplaceWizardCommand.setWizardDialogState(wizardState);
    UIThreadRunnable.asyncExec(new VoidResult() {

        public void run() {
            try {
                marketplaceWizardCommand.execute(new ExecutionEvent());
            } catch (ExecutionException e) {
                fail("ExecutionException: " + e.getMessage());
            // otherwise ignore, we'll notice in the test thread when we don't get the wizard dialog in time
            }
        }
    });
}
Also used : INode(org.eclipse.epp.mpc.core.model.INode) VoidResult(org.eclipse.swtbot.swt.finder.results.VoidResult) ExecutionEvent(org.eclipse.core.commands.ExecutionEvent) ExecutionException(org.eclipse.core.commands.ExecutionException) MarketplaceWizardCommand(org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand) WizardState(org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.WizardState)

Example 4 with MarketplaceWizardCommand

use of org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand in project epp.mpc by eclipse.

the class MarketplaceWizard method resumeWizard.

public static void resumeWizard(Display display, Object state, boolean proceedWithInstall) {
    String catalogUrl = (String) state;
    if (proceedWithInstall) {
        org.eclipse.epp.mpc.ui.MarketplaceUrlHandler.SolutionInstallationInfo installInfo = MarketplaceUrlHandler.createSolutionInstallInfo(catalogUrl);
        if (installInfo != null) {
            MarketplaceUrlHandler.triggerInstall(installInfo);
            return;
        }
    }
    CatalogDescriptor descriptor = catalogUrl == null ? null : CatalogRegistry.getInstance().findCatalogDescriptor(catalogUrl);
    final MarketplaceWizardCommand command = new MarketplaceWizardCommand();
    if (descriptor != null) {
        descriptor = new CatalogDescriptor(descriptor);
        descriptor.setLabel(MarketplaceUrlHandler.DESCRIPTOR_HINT);
        command.setSelectedCatalogDescriptor(descriptor);
    }
    String mpcState = MarketplaceUrlHandler.getMPCState(catalogUrl);
    if (mpcState != null && mpcState.length() > 0) {
        try {
            // $NON-NLS-1$
            command.setWizardState(URLDecoder.decode(mpcState, "UTF-8"));
        } catch (UnsupportedEncodingException e) {
            // should never happen
            throw new IllegalStateException(e);
        }
        if (!proceedWithInstall) {
            WizardState wizardState = new WizardState();
            wizardState.setProceedWithInstallation(false);
            command.setWizardDialogState(wizardState);
        }
    }
    display.asyncExec(new Runnable() {

        public void run() {
            try {
                command.execute(new ExecutionEvent());
            } catch (ExecutionException e) {
                IStatus status = MarketplaceClientCore.computeStatus(e, Messages.MarketplaceBrowserIntegration_cannotOpenMarketplaceWizard);
                MarketplaceClientUi.handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
            }
        }
    });
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MarketplaceUrlHandler(org.eclipse.epp.mpc.ui.MarketplaceUrlHandler) SolutionInstallationInfo(org.eclipse.epp.mpc.ui.MarketplaceUrlHandler.SolutionInstallationInfo) ExecutionEvent(org.eclipse.core.commands.ExecutionEvent) ExecutionException(org.eclipse.core.commands.ExecutionException) MarketplaceWizardCommand(org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand) CatalogDescriptor(org.eclipse.epp.mpc.ui.CatalogDescriptor)

Example 5 with MarketplaceWizardCommand

use of org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand in project epp.mpc by eclipse.

the class MarketplaceUrlHandler method triggerInstall.

public static void triggerInstall(SolutionInstallationInfo info) {
    if (info.getRequestUrl() != null) {
        MarketplaceClientUi.getLog().log(new Status(IStatus.INFO, MarketplaceClientUi.BUNDLE_ID, NLS.bind(Messages.MarketplaceUrlHandler_performInstallRequest, info.getRequestUrl())));
    }
    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> nodeToOperation = new HashMap<String, Operation>();
        nodeToOperation.put(URLDecoder.decode(installId, UTF_8), Operation.INSTALL);
        command.setOperations(nodeToOperation);
    } catch (UnsupportedEncodingException e1) {
        throw new IllegalStateException(e1);
    }
    try {
        command.execute(new ExecutionEvent());
    } catch (ExecutionException e) {
        IStatus status = MarketplaceClientCore.computeStatus(e, Messages.MarketplaceUrlHandler_cannotOpenMarketplaceWizard);
        MarketplaceClientUi.handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ExecutionEvent(org.eclipse.core.commands.ExecutionEvent) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ExecutionException(org.eclipse.core.commands.ExecutionException) MarketplaceWizardCommand(org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand)

Aggregations

MarketplaceWizardCommand (org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand)11 WizardState (org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.WizardState)8 AbstractMarketplaceWizardCommand (org.eclipse.epp.internal.mpc.ui.commands.AbstractMarketplaceWizardCommand)7 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)3 ExecutionException (org.eclipse.core.commands.ExecutionException)3 IStatus (org.eclipse.core.runtime.IStatus)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 URL (java.net.URL)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Status (org.eclipse.core.runtime.Status)1 ServiceLocator (org.eclipse.epp.internal.mpc.core.ServiceLocator)1 DefaultCatalogService (org.eclipse.epp.internal.mpc.core.service.DefaultCatalogService)1 INode (org.eclipse.epp.mpc.core.model.INode)1 ICatalogService (org.eclipse.epp.mpc.core.service.ICatalogService)1 CatalogDescriptor (org.eclipse.epp.mpc.ui.CatalogDescriptor)1 MarketplaceUrlHandler (org.eclipse.epp.mpc.ui.MarketplaceUrlHandler)1 SolutionInstallationInfo (org.eclipse.epp.mpc.ui.MarketplaceUrlHandler.SolutionInstallationInfo)1 VoidResult (org.eclipse.swtbot.swt.finder.results.VoidResult)1 Test (org.junit.Test)1