protected void saveModel(final IFile file) throws InvocationTargetException, InterruptedException { WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor progressMonitor) { try { EObject model = createInitialModel(); EcoreIOUtil.saveModelAs(model, file); } finally { progressMonitor.done(); } } }; IWizardContainer container = getContainer(); container.run(false, false, operation); }
/** * Run the host name validator in the context of the wizard container and * provide a custom error message * @param appUrl * @param server * @param container * @param message - override with custom error message * @return */ public static HostnameValidationResult validateHostname(CloudApplicationURL appUrl, CloudFoundryServer server, IWizardContainer container, String message) { HostnameValidator val = message == null ? new HostnameValidator(appUrl, server) : new HostnameValidator(appUrl, server, message); try { container.run(true, true, val); } catch (Exception e) { CloudFoundryPlugin.logWarning("Hostname taken validation was not completed. " + e.getMessage()); //$NON-NLS-1$ IStatus status = new Status(IStatus.ERROR, CloudFoundryServerUiPlugin.PLUGIN_ID, Messages.CloudApplicationUrlPart_ERROR_UNABLE_TO_CHECK_HOSTNAME); return new HostnameValidationResult(status, val.isRouteCreated()); } return new HostnameValidationResult(val.getStatus(), val.isRouteCreated()); }
public IFile createModelFile(IWizardContainer context, IPackageFragmentRoot packageFragmentRoot, IPackageFragment packageFragment, String typeName, boolean isXtxtUml) { try { String filename; StringBuilder contentBuilder = new StringBuilder(); if (isXtxtUml) { filename = buildXtxtUmlModelFileContent(packageFragment, typeName, contentBuilder); } else { filename = buildJavaModelFileContent(packageFragment, typeName, contentBuilder); } if (createFile(context, packageFragmentRoot, packageFragment, contentBuilder.toString(), filename)) { return (IFile) resource; } } catch (Throwable e) { Logger.sys.error("Error while creating package/model-info file", e); } return null; }
private void carefullyDisplayErrorDialog(String message) { if(message == null) { message = "Unknown error."; } int errorCode = MessageDialog.ERROR; IWizardContainer container = getContainer(); Shell shell = null; if(container != null) { shell = container.getShell(); } // get a shell if the current one is null, we need to show the error. if(shell == null) { shell = WidgetUtils.getShell(); } MessageDialog.open(errorCode, shell, getErrorDialogTitle(), "Error encountered while " + getExportingActionVerb() + " " + getOutputProductNameSingular() + ": " + message, SWT.SHEET); }
public static IEditorPart openPlanEditorFromWizard(final IFile planFile, final IWorkbench workbench, IWizardContainer container) { final IEditorPart[] result = new IEditorPart[1]; try { container.run(false, false, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) { try { monitor.beginTask("Opening " + planFile.getName() + " in editor", IProgressMonitor.UNKNOWN); result[0] = openEditorOnPlanFile(planFile, workbench); } finally { monitor.done(); } } }); } catch (Exception e) { LogUtil.error(e); } return result[0]; }
/** * Sets the error message for the active wizard page. * * Note that this method has no effect if the current page doesn't support error messages. */ private void setErrorMessage(String message) { IWizardContainer container = getContainer(); if (container != null) { IWizardPage currentPage = container.getCurrentPage(); if (currentPage instanceof DialogPage) { ((DialogPage) currentPage).setErrorMessage(message); } } }
@Override public void setContainer(IWizardContainer wizardContainer) { IWizardContainer oldContainer = this.getContainer(); if (oldContainer instanceof WizardDialog) { ((WizardDialog) oldContainer).removePageChangedListener(pageListener); } if (wizardContainer instanceof WizardDialog) { WizardDialog wizDialog = (WizardDialog) wizardContainer; wizDialog.addPageChangedListener(pageListener); } super.setContainer(wizardContainer); }
public void setUseTemplate(boolean useTemplate){ fUseTemplate.setSelection(useTemplate); wizardSelectionViewer.getControl().setEnabled(useTemplate); if (!useTemplate) setDescription(""); //$NON-NLS-1$ setDescriptionEnabled(useTemplate); IWizardContainer container = getContainer(); if(container.getCurrentPage() != null){ container.updateButtons(); } }
/** * Resets the current page state by clearing the error message and making * the page complete, thereby allowing users to flip to the next page. */ protected void resetPageState() { if (pages.size() == 0) return; WizardPage firstPage = pages.get(0).page; IWizardContainer container = firstPage.getWizard().getContainer(); WizardPage currentPage = (WizardPage) container.getCurrentPage(); currentPage.setErrorMessage(null); currentPage.setPageComplete(true); }
public IFile createXtxtUmlFile(IWizardContainer context, IPackageFragmentRoot packageFragmentRoot, IPackageFragment packageFragment, String filename) { try { StringBuilder contentBuilder = new StringBuilder(); buildXtxtUmlFileContent(packageFragment, contentBuilder); if (createFile(context, packageFragmentRoot, packageFragment, contentBuilder.toString(), filename)) { return (IFile) resource; } } catch (Throwable e) { Logger.sys.error("Error while creating XtxtUML file", e); } return null; }
@Override public void setContainer(IWizardContainer wizardContainer) { super.setContainer(wizardContainer); if (wizardContainer instanceof WizardDialog) { WizardDialog wizardDialog = (WizardDialog) wizardContainer; wizardDialog.addPageChangingListener(new ChangingListener()); wizardDialog.addPageChangedListener(new ChangedListener(wizardDialog)); wizardDialog.setHelpAvailable(true); } }
@Override public void setContainer(IWizardContainer wizardContainer) { if(getContainer() instanceof IPageChangeProvider) { ((IPageChangeProvider)getContainer()).removePageChangedListener(mPageChangedListener); } super.setContainer(wizardContainer); if(getContainer() instanceof IPageChangeProvider) { ((IPageChangeProvider)getContainer()).addPageChangedListener(mPageChangedListener); } }
@Override public void setContainer(IWizardContainer wizardContainer) { super.setContainer(wizardContainer); if (wizardContainer != null) { final WizardDialog wizardDialog = (WizardDialog)wizardContainer; wizardDialog.addPageChangingListener(authenticationWizardPage); wizardDialog.addPageChangedListener(workspaceWizardPage); } }
@Override public void setContainer(IWizardContainer wizardContainer) { super.setContainer(wizardContainer); if (wizardContainer != null) { final WizardDialog wizardDialog = (WizardDialog)wizardContainer; wizardDialog.addPageChangingListener(authenticationWizardPage); wizardDialog.addPageChangedListener(projectWizardPage); } }
/** * Called whenever the wizard page has changed and forces its container * to resize its content. * * @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent) */ public void pageChanged( PageChangedEvent event ) { if ( this.wizardPage == event.getSelectedPage( ) ) { // force size update IWizardContainer container = getContainer( ); if ( container instanceof IWizardContainer2 ) { ( (IWizardContainer2) container ).updateSize( ); } } }
@Override public void setContainer(IWizardContainer wizardContainer) { super.setContainer(wizardContainer); // if(wizardContainer != null) { // WizardDialog wizardDialog = assertInstance(wizardContainer, WizardDialog.class); // wizardDialog.addPageChangingListener(this); // } }
@Override public IWizardContainer getContainer() { return super.getContainer(); }
public IWizardContainer getContainer() { return super.getContainer(); }
@Override public void setContainer(IWizardContainer wizardContainer) { // TODO Auto-generated method stub super.setContainer(wizardContainer); if (wizardContainer == null) { if (this.dialog != null) { this.dialog = null; } return; } this.dialog = (WizardDialog)wizardContainer; this.dialog.addPageChangingListener(new IPageChangingListener() { @Override public void handlePageChanging(PageChangingEvent event) { // TODO Auto-generated method stub Object current = event.getCurrentPage(); Object target = event.getTargetPage(); List<IWizardPage> list = Arrays.asList(getPages()); int idxCurrent = list.indexOf(current); int idxTarget = list.indexOf(target); java.lang.System.out.println("Current: "+current.getClass().getName()+" ;; Target: "+target.getClass().getName()); if (current instanceof IWizardPageControll) { if (idxCurrent < idxTarget) { // perform Next ((IWizardPageControll)current).performNext(); } else { // perform Back ((IWizardPageControll)current).performBack(); } } if (target instanceof IWizardPageControll) { ((IWizardPageControll)target).performUpdate(); currentPage = (IWizardPageControll)target; } else { currentPage = null; } } }); }
@Override public IWizardContainer getContainer() { // TODO Auto-generated method stub return null; }
@Override public void setContainer(IWizardContainer wizardContainer) { // TODO Auto-generated method stub }
public IWizardContainer getContainer() { return null; }
public void setContainer(IWizardContainer wizardContainer) { }
public IWizardContainer getContainer() { return delegate.getContainer(); }
public void setContainer(IWizardContainer wizardContainer) { delegate.setContainer(wizardContainer); }