List of usage examples for org.eclipse.jface.wizard Wizard setContainer
@Override
public void setContainer(IWizardContainer wizardContainer)
From source file:com.siteview.mde.internal.ui.shared.target.AddBundleContainerSelectionPage.java
License:Open Source License
/** * Creates a wizard node that will get the pages from the contributed wizard and create a directory bundle container from the result * @param element wizard element representing the extension * @return wizard node//w w w . j a va 2 s .co m */ private AbstractBundleContainerNode createExtensionNode(final WizardElement element) { return new AbstractBundleContainerNode(element.getLabel(), element.getDescription(), element.getImage()) { public IWizard createWizard() { Wizard wizard = new Wizard() { private IProvisionerWizard fWizard; public void addPages() { try { fWizard = (IProvisionerWizard) element.createExecutableExtension(); } catch (CoreException e) { MDEPlugin.log(e); MessageDialog.openError(getContainer().getShell(), Messages.Errors_CreationError, Messages.Errors_CreationError_NoWizard); } fWizard.setContainer(getContainer()); fWizard.addPages(); IWizardPage[] pages = fWizard.getPages(); for (int i = 0; i < pages.length; i++) addPage(pages[i]); } public boolean performFinish() { if (fWizard != null) { if (!fWizard.performFinish()) { return false; } File[] dirs = fWizard.getLocations(); for (int i = 0; i < dirs.length; i++) { if (dirs[i] == null || !dirs[i].isDirectory()) { ErrorDialog.openError(getShell(), Messages.AddBundleContainerSelectionPage_0, Messages.AddBundleContainerSelectionPage_5, new Status(IStatus.ERROR, MDEPlugin.getPluginId(), Messages.AddDirectoryContainerPage_6)); return false; } try { // First try the specified dir, then try the plugins dir IBundleContainer container = getTargetPlatformService() .newDirectoryContainer(dirs[i].getPath()); IBundleContainer[] oldContainers = fTarget.getBundleContainers(); if (oldContainers == null) { fTarget.setBundleContainers(new IBundleContainer[] { container }); } else { IBundleContainer[] newContainers = new IBundleContainer[oldContainers.length + 1]; System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length); newContainers[oldContainers.length] = container; fTarget.setBundleContainers(newContainers); } } catch (CoreException ex) { ErrorDialog.openError(getShell(), Messages.AddBundleContainerSelectionPage_0, Messages.AddBundleContainerSelectionPage_5, ex.getStatus()); return false; } } } return true; } }; wizard.setContainer(getContainer()); wizard.setWindowTitle(Messages.AddBundleContainerSelectionPage_1); return wizard; } }; }
From source file:org.eclipse.pde.internal.ui.shared.target.AddBundleContainerSelectionPage.java
License:Open Source License
/** * Creates a wizard node that will get the pages from the contributed wizard and create a directory bundle container from the result * @param element wizard element representing the extension * @return wizard node/*from w w w . j a v a2 s.com*/ */ private AbstractBundleContainerNode createTargetLocationProvisionerNode(final WizardElement element) { return new AbstractBundleContainerNode(element.getLabel(), element.getDescription(), element.getImage()) { public IWizard createWizard() { Wizard wizard = new Wizard() { private ITargetLocationWizard fWizard; public void addPages() { try { fWizard = (ITargetLocationWizard) element.createExecutableExtension(); } catch (CoreException e) { PDEPlugin.log(e); MessageDialog.openError(getContainer().getShell(), Messages.Errors_CreationError, Messages.Errors_CreationError_NoWizard); } fWizard.setTarget(fTarget); fWizard.setContainer(getContainer()); fWizard.addPages(); IWizardPage[] pages = fWizard.getPages(); for (int i = 0; i < pages.length; i++) addPage(pages[i]); } public boolean performFinish() { if (fWizard != null) { if (!fWizard.performFinish()) { return false; } ITargetLocation[] locations = fWizard.getLocations(); if (locations != null) { ITargetLocation[] oldContainers = fTarget.getTargetLocations(); if (oldContainers == null) { fTarget.setTargetLocations(locations); } else { ITargetLocation[] newContainers = new ITargetLocation[oldContainers.length + locations.length]; System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length); System.arraycopy(locations, 0, newContainers, oldContainers.length, locations.length); fTarget.setTargetLocations(newContainers); } } } return true; } }; wizard.setContainer(getContainer()); wizard.setWindowTitle(Messages.AddBundleContainerSelectionPage_1); return wizard; } }; }
From source file:org.eclipse.pde.internal.ui.shared.target.AddBundleContainerSelectionPage.java
License:Open Source License
/** * Creates a wizard node that will get the pages from the contributed wizard and create a directory bundle container from the result * @param element wizard element representing the extension * @return wizard node// ww w .j a v a 2 s . co m */ private AbstractBundleContainerNode createDeprecatedExtensionNode(final WizardElement element) { return new AbstractBundleContainerNode(element.getLabel(), element.getDescription(), element.getImage()) { public IWizard createWizard() { Wizard wizard = new Wizard() { private IProvisionerWizard fWizard; public void addPages() { try { fWizard = (IProvisionerWizard) element.createExecutableExtension(); } catch (CoreException e) { PDEPlugin.log(e); MessageDialog.openError(getContainer().getShell(), Messages.Errors_CreationError, Messages.Errors_CreationError_NoWizard); } fWizard.setContainer(getContainer()); fWizard.addPages(); IWizardPage[] pages = fWizard.getPages(); for (int i = 0; i < pages.length; i++) addPage(pages[i]); } public boolean performFinish() { if (fWizard != null) { if (!fWizard.performFinish()) { return false; } File[] dirs = fWizard.getLocations(); for (int i = 0; i < dirs.length; i++) { if (dirs[i] == null || !dirs[i].isDirectory()) { ErrorDialog.openError(getShell(), Messages.AddBundleContainerSelectionPage_0, Messages.AddBundleContainerSelectionPage_5, new Status(IStatus.ERROR, PDEPlugin.getPluginId(), Messages.AddDirectoryContainerPage_6)); return false; } try { // First try the specified dir, then try the plugins dir ITargetLocation container = getTargetPlatformService() .newDirectoryLocation(dirs[i].getPath()); ITargetLocation[] oldContainers = fTarget.getTargetLocations(); if (oldContainers == null) { fTarget.setTargetLocations(new ITargetLocation[] { container }); } else { ITargetLocation[] newContainers = new ITargetLocation[oldContainers.length + 1]; System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length); newContainers[oldContainers.length] = container; fTarget.setTargetLocations(newContainers); } } catch (CoreException ex) { ErrorDialog.openError(getShell(), Messages.AddBundleContainerSelectionPage_0, Messages.AddBundleContainerSelectionPage_5, ex.getStatus()); return false; } } } return true; } }; wizard.setContainer(getContainer()); wizard.setWindowTitle(Messages.AddBundleContainerSelectionPage_1); return wizard; } }; }