@Override public IWizard getWizard() { SetupWizard wizard = (SetupWizard) super.getWizard(); wizard.postRegisterState(this.getClass().getSimpleName().toLowerCase()); StringBuffer summary = new StringBuffer(); for (IWizardPage page : wizard.getPages()) { if (page instanceof SummaryGenerator) { summary.append(((SummaryGenerator) page).getSummary() + "\n"); } } summaryText.setText(summary.toString()); setPageComplete(true); return wizard; }
@Override public IWizard getWizard() { IWizardPage previousPage = getPreviousPage(); setErrorMessage(null); setMessage(getDescription()); SetupWizard wizard = (SetupWizard) super.getWizard(); wizard.postRegisterState(this.getClass().getSimpleName().toLowerCase()); if (previousPage instanceof RegistrationPage) { RegistrationPage registrationPage = (RegistrationPage) previousPage; if (registrationPage.isConnected()) { if (registrationPage.register(this)) { infoLink.setText("Online registration in progress, please wait…"); } } else { infoLink.setText("Studio offline. Please register manually on " + RegistrationPage.registrationLink + " and paste your PSC here."); setErrorMessage("Studio offline! Check your proxy settings"); } } else { infoLink.setText("Please paste your previous PSC here and click the 'Next >' button..."); } infoLink.getParent().layout(); return super.getWizard(); }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID); if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID); } if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID); } try { if (descriptor != null) { IWizard wizard = descriptor.createWizard(); WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } } catch (CoreException e) { e.printStackTrace(); } return null; }
/** * Open sub graph save dialog. * * @return the i file */ public IFile openSubJobSaveDialog() { IFile iFile = null; IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(Messages.JOB_WIZARD_ID); if (descriptor != null) { IWizard wizard = null; try { wizard = descriptor.createWizard(); } catch (CoreException coreException) { logger.error("Error while opening create job wizard", coreException); } WizardDialog wizardDialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard); wizardDialog.setTitle(wizard.getWindowTitle()); wizardDialog.open(); JobCreationPage jobCreationPage = (JobCreationPage) wizardDialog.getSelectedPage(); iFile = jobCreationPage.getNewFile(); } return iFile; }
/** * Clean up reserved URLs except those specified in the deployment info, * from the context of a wizard * * @param workingCopy * @param wizard - the wizard * @param server - the CloudFoundryServer * @param reservedUrls - the list of all reserved route URLS */ public static void cleanupReservedRoutesIfNotNeeded(DeploymentInfoWorkingCopy workingCopy, IWizard wizard, final CloudFoundryServer server, List<CloudApplicationURL> reservedUrls) { List<String> urls = workingCopy.getUris(); if (urls == null) { urls = new ArrayList<String>(); } // Clean up unused routes that were reserved and no longer needed for (CloudApplicationURL cloudURL : reservedUrls) { boolean isNeeded = false; for (String url : urls) { if (url.equals(cloudURL.getUrl())) { isNeeded = true; break; } } if (!isNeeded) { deleteRoute(wizard, server, cloudURL); } } reservedUrls.clear(); }
public void openWizard(String id) { IWizardDescriptor descriptor = PlatformUI.getWorkbench() .getNewWizardRegistry().findWizard(id); if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry() .findWizard(id); } if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry() .findWizard(id); } try { if (descriptor != null) { IWizard wizard = descriptor.createWizard(); WizardDialog wd = new WizardDialog(Display.getDefault() .getActiveShell(), wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } } catch (CoreException e) { e.printStackTrace(); } }
protected void handleOptionSelected() { storeSettings(); comboBoxDatasets.setEnabled(radioButtonUseDataset.getSelection()); if (radioButtonAddDataset.getSelection()) { setSelectedNode(new AWizardNode() { public IWizard createWizard() { IWizard pwizard = WizardDatasetPage.this.getWizard(); DatasetWizard w = new DatasetWizard(pwizard, pwizard.getNextPage(WizardDatasetPage.this)); if (pwizard instanceof JSSWizard) w.setConfig( ((JSSWizard) pwizard).getConfig() ); return w; } }); setPageComplete(true); } }
/** * Adds a new page to this wizard. The page is inserted at the end of the page list. * * @param page * the new page */ public void addPage(IWizardPage page) { wizardPages.add(page); page.setWizard(this); if (page instanceof JSSWizardPage) { ((JSSWizardPage) page).addChangeListener(this); IWizard wiz = this.getParentWizard(); while (wiz != null && wiz instanceof JSSWizard) { JSSWizard parentw = (JSSWizard) wiz; ((JSSWizardPage) page).addChangeListener(parentw); wiz = parentw.getParentWizard(); } } }
/** * The <code>WizardSelectionPage</code> implementation of this <code>IWizardPage</code> method returns the first page * of the currently selected wizard if there is one. */ @Override public IWizardPage getNextPage() { if (selectedNode == null) { return super.getNextPage(); } boolean isCreated = selectedNode.isContentCreated(); IWizard wizard = selectedNode.getWizard(); if (wizard == null) { setSelectedNode(null); return null; } if (!isCreated) { // Allow the wizard to create its pages wizard.addPages(); } IWizardPage nextPage = wizard.getStartingPage(); return nextPage; }
protected InputStream getInitialContents() { IWizard wizard = getWizard(); TemplateSelectionPage templateSelectionPage = (TemplateSelectionPage) wizard .getPage(NewFileWizard.TEMPLATE_PAGE_NAME); if (wizard.getContainer().getCurrentPage() == templateSelectionPage) { String templateContent = NewFileWizard.getTemplateContent(templateSelectionPage.getSelectedTemplate(), getContainerFullPath().append(getFileName())); if (templateContent != null) { return new ReaderInputStream(new StringReader(templateContent), IOUtil.UTF_8); } } return super.getInitialContents(); }
/** * The Finish button has been pressed. */ protected void finishPressed() { // Wizards are added to the nested wizards list in setWizard. // This means that the current wizard is always the last wizard in the // list. // Note that we first call the current wizard directly (to give it a // chance to // abort, do work, and save state) then call the remaining n-1 wizards // in the // list (to save state). if (wizard.performFinish()) { // Call perform finish on outer wizards in the nested chain // (to allow them to save state for example) for (int i = 0; i < nestedWizards.size() - 1; i++) { ((IWizard) nestedWizards.get(i)).performFinish(); } // Hard close the dialog. setReturnCode(OK); hardClose(); } }
/** * Closes this window. * * @return <code>true</code> if the window is (or was already) closed, and * <code>false</code> if it is still open */ private boolean hardClose() { // inform wizards for (int i = 0; i < createdWizards.size(); i++) { IWizard createdWizard = (IWizard) createdWizards.get(i); try { createdWizard.dispose(); } catch (Exception e) { Status status = new Status(IStatus.ERROR, Policy.JFACE, IStatus.ERROR, e.getMessage(), e); Policy.getLog().log(status); } // Remove this dialog as a parent from the managed wizard. // Note that we do this after calling dispose as the wizard or // its pages may need access to the container during // dispose code createdWizard.setContainer(null); } // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=202534 // disposing the wizards could cause the image currently set in // this dialog to be disposed. A subsequent repaint event during // close would then fail. To prevent this case, we null out the image. setTitleImage(null); return super.close(); }
/** * Computes the correct dialog size for the given wizard and resizes its shell if necessary. * * @param sizingWizard the wizard */ private void updateSizeForWizard(IWizard sizingWizard) { Point delta = new Point(0, 0); IWizardPage[] pages = sizingWizard.getPages(); for (int i = 0; i < pages.length; i++) { // ensure the page container is large enough Point pageDelta = calculatePageSizeDelta(pages[i]); delta.x = Math.max(delta.x, pageDelta.x); delta.y = Math.max(delta.y, pageDelta.y); } if (delta.x > 0 || delta.y > 0) { // increase the size of the shell Shell shell = getShell(); Point shellSize = shell.getSize(); setShellSize(shellSize.x + delta.x, shellSize.y + delta.y); } }
public IWizardPage getNextPage() { IWizard wiz = getWizard(); IWizardPage nextPage; switch(info.getDatabaseType()) { case DatabaseMeta.TYPE_DATABASE_ORACLE: nextPage = wiz.getPage("oracle"); // Oracle //$NON-NLS-1$ break; case DatabaseMeta.TYPE_DATABASE_INFORMIX: nextPage = wiz.getPage("ifx"); // Informix //$NON-NLS-1$ break; default: nextPage = wiz.getPage("2"); // page 2 //$NON-NLS-1$ break; } return nextPage; }
public IWizardPage getNextPage() { IWizard wiz = getWizard(); IWizardPage nextPage; if (databaseMeta.getDatabaseInterface() instanceof OracleDatabaseMeta) { nextPage = wiz.getPage("oracle"); // Oracle //$NON-NLS-1$ } else if (databaseMeta.getDatabaseInterface() instanceof InformixDatabaseMeta) { nextPage = wiz.getPage("ifx"); // Informix //$NON-NLS-1$ } else { nextPage = wiz.getPage("2"); // page 2 //$NON-NLS-1$ } return nextPage; }
@Override public IWizard getWizard() { checkValidity(); SetupWizard wizard = (SetupWizard) super.getWizard(); setControlsEnabled(false); notConnectedLink.setText("Checking for connection to " + registrationLink + " …"); ((GridData) notConnectedLink.getLayoutData()).exclude = false; notConnectedLink.setVisible(true); notConnectedLink.getParent().layout(); wizard.checkConnected(this); return wizard; }
@Override public IWizard getWizard() { setErrorMessage(null); setMessage(getDescription()); SetupWizard wizard = (SetupWizard) super.getWizard(); wizard.postRegisterState(this.getClass().getSimpleName().toLowerCase()); return super.getWizard(); }
/** * Initializes the options that require late initialization when the page is * made visible. * * @param visible */ public void setVisible(boolean visible) { if (visible && section.isDependentOnParentWizard()) { IWizard wizard = getWizard(); if (wizard instanceof AbstractNewProjectTemplateWizard) { AbstractNewProjectTemplateWizard templateWizard = (AbstractNewProjectTemplateWizard) wizard; section.initializeFields(templateWizard.getData()); } } super.setVisible(visible); }
@Override public void setWizard(IWizard newWizard) { super.setWizard(newWizard); try { GenerationWizard wizard = (GenerationWizard) newWizard; converter = wizard.getConverter(); } catch (ClassCastException e) { e.printStackTrace(); } }
public Object execute(ExecutionEvent event) throws ExecutionException { // Open the new Time4Sys project wizard final IWizard wizard = new Time4SysProjectWizard(); final WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard); dialog.open(); return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell = HandlerUtil.getActiveShell(event); IWizard wizard = new EGradleNewProjectWizard(); WizardDialog dialog = new WizardDialog(activeShell, wizard); dialog.open(); return null; }
@Override public boolean performFinish() { // if we're finishing from the main page then perform finish on the // selected wizard. if (getContainer().getCurrentPage() == mainPage) { if (mainPage.canFinishEarly()) { final IWizard wizard = mainPage.getSelectedNode().getWizard(); wizard.setContainer(getContainer()); return wizard.performFinish(); } } return true; }
@Override public Object execute(ExecutionEvent event) { Shell activeShell = HandlerUtil.getActiveShell(event); IWizard wizard = new SynchronizePlatformWizard(); WizardDialog dialog = new WizardDialog(activeShell, wizard); dialog.open(); return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell = HandlerUtil.getActiveShell(event); IWizard wizard = new CreateWorkingSetWizard(); WizardDialog dialog = new WizardDialog(activeShell, wizard); dialog.open(); return null; }
@Override public Object execute( ExecutionEvent event ) throws ExecutionException { Shell activeShell = HandlerUtil.getActiveShell(event); IWizard wizard = new AttachSourcesWizard(); WizardDialog dialog = new WizardDialog(activeShell, wizard); dialog.open(); return null; }
@Override public Object execute( ExecutionEvent event ) throws ExecutionException { Shell activeShell = HandlerUtil.getActiveShell(event); NewImpexWizard newWizard = new NewImpexWizard(); newWizard.setCurrentSelection(HandlerUtil.getCurrentSelection(event)); IWizard wizard = (IWizard) newWizard; WizardDialog dialog = new WizardDialog(activeShell, wizard); dialog.open(); return null; }
/** * Do initial validation not invoked by user (eg. not by using the Validate Button). This is called * only if the manifest.yml is present. See CloudFoundryDeploymentWizardPage::performWhenPageVisible */ public void doInitialValidate() { if (!visited) { visited = true; CloudApplicationURL appUrl = null; try { appUrl = lookupService.getCloudApplicationURL(currentUrl); } catch (CoreException ce) { // if already invalid, say, manifest has some invalid text, then don't do hostname taken check return; } if (appUrl != null) { IWizard wizard = page.getWizard(); if (wizard instanceof IReservedURLTracker) { IReservedURLTracker reservedURLTracker = (IReservedURLTracker)wizard; if (!reservedURLTracker.isReserved(appUrl)) { HostnameValidationResult validationResult = reservedURLTracker.validateURL(appUrl); if (validationResult.getStatus().isOK()) { // Reserve the URL reservedURLTracker.addToReserved(appUrl, validationResult.isRouteCreated()); } notifyChange(new WizardPartChangeEvent(appUrl, validationResult.getStatus(), CloudUIEvent.VALIDATE_HOST_TAKEN_EVENT, ValidationEvents.VALIDATION_HOSTNAME_TAKEN, true)); } } } } }