org.eclipse.jface.wizard.Wizard Java Examples
The following examples show how to use
org.eclipse.jface.wizard.Wizard.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NewLocationAction.java From hadoop-gpu with Apache License 2.0 | 6 votes |
@Override public void run() { WizardDialog dialog = new WizardDialog(null, new Wizard() { private HadoopLocationWizard page = new HadoopLocationWizard(); @Override public void addPages() { super.addPages(); setWindowTitle("New Hadoop location..."); addPage(page); } @Override public boolean performFinish() { page.performFinish(); return true; } }); dialog.create(); dialog.setBlockOnOpen(true); dialog.open(); super.run(); }
Example #2
Source File: CodewindInstall.java From codewind-eclipse with Eclipse Public License 2.0 | 6 votes |
public static Runnable getNewProjectPrompt() { return new Runnable() { @Override public void run() { Shell shell = Display.getDefault().getActiveShell(); if (MessageDialog.openQuestion(shell, Messages.InstallCodewindDialogTitle, Messages.InstallCodewindNewProjectMessage)) { CodewindConnection connection = CodewindConnectionManager.getLocalConnection(); if (connection != null && connection.isConnected()) { Wizard wizard = new NewCodewindProjectWizard(connection); WizardLauncher.launchWizardWithoutSelection(wizard); } else { Logger.logError("Codewind did not install or start properly in order to create a new project."); //$NON-NLS-1$ } } } }; }
Example #3
Source File: CodewindInstall.java From codewind-eclipse with Eclipse Public License 2.0 | 6 votes |
public static Runnable addExistingProjectPrompt(IProject project) { return new Runnable() { @Override public void run() { Shell shell = Display.getDefault().getActiveShell(); if (MessageDialog.openQuestion(shell, Messages.InstallCodewindDialogTitle, NLS.bind(Messages.InstallCodewindAddProjectMessage, project.getName()))) { CodewindConnection connection = CodewindConnectionManager.getLocalConnection(); if (connection != null && connection.isConnected()) { Wizard wizard = new BindProjectWizard(connection, project); WizardLauncher.launchWizardWithoutSelection(wizard); } else { Logger.logError("Codewind not installed or has unknown status when trying to bind project: " + project.getName()); //$NON-NLS-1$ } } } }; }
Example #4
Source File: WizardUtils.java From saros with GNU General Public License v2.0 | 6 votes |
/** * Open a wizard in the SWT thread and returns the {@link WizardDialog}'s return code. * * @param parentShell * @param wizard * @return */ public static Integer openWizard(final Shell parentShell, final Wizard wizard) { try { return SWTUtils.runSWTSync( new Callable<Integer>() { @Override public Integer call() { WizardDialog wizardDialog = new WizardDialog(parentShell, wizard); wizardDialog.setHelpAvailable(false); return wizardDialog.open(); } }); } catch (Exception e) { log.warn("Error opening wizard " + wizard.getWindowTitle(), e); } return null; }
Example #5
Source File: NewLocationAction.java From RDFS with Apache License 2.0 | 6 votes |
@Override public void run() { WizardDialog dialog = new WizardDialog(null, new Wizard() { private HadoopLocationWizard page = new HadoopLocationWizard(); @Override public void addPages() { super.addPages(); setWindowTitle("New Hadoop location..."); addPage(page); } @Override public boolean performFinish() { page.performFinish(); return true; } }); dialog.create(); dialog.setBlockOnOpen(true); dialog.open(); super.run(); }
Example #6
Source File: ConditionHelpers.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Is the wizard on the page you want? * * @param wizard * wizard * @param page * the desired page * @return ICondition for verification */ public static ICondition isWizardOnPage(final Wizard wizard, final IWizardPage page) { return new SWTBotTestCondition() { @Override public boolean test() throws Exception { if (wizard == null || page == null) { return false; } final IWizardContainer container = wizard.getContainer(); if (container == null) { return false; } IWizardPage currentPage = container.getCurrentPage(); return page.equals(currentPage); } }; }
Example #7
Source File: WizardStartPage.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
@Override public WizardPage getNextPage() { refreshData(); if(wizardData.pageList.size() > 0) { // Add the first sub page WizardDataSub pd = wizardData.pageList.get(0); if (pd != null) { if (pd.wizardPage[0] == null) { pd.wizardPage[0] = new WizardSubPageMain(pd); ((Wizard)(getWizard())).addPage(pd.wizardPage[0]); } return(pd.wizardPage[0]); } } return(null); }
Example #8
Source File: WizardSubPage.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
@Override public WizardPage getNextPage() { refreshData(); // Get the Next Sub Main Page // If pages provide more Sub Pages this function // should be overridden int newPageNumber = getSubPageNumber()+1; if(newPageNumber < wizardData.getPageCount()) { WizardDataSub pd = wizardData.pageList.get(newPageNumber); if(pd != null) { if (pd.wizardPage[0] == null) { pd.wizardPage[0] = new WizardSubPageMain(pd); ((Wizard)getWizard()).addPage(pd.wizardPage[0]); } return(pd.wizardPage[0]); } } return null; }
Example #9
Source File: WizardSubPageDataSource.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
@Override public WizardPage getNextPage() { refreshData(); switch(dsType) { case DS_VIEW: if (!(pageData.wizardPage[2] instanceof WizardSubPageDataView)) { pageData.wizardPage[2] = new WizardSubPageDataView(pageData); ((Wizard)getWizard()).addPage(pageData.wizardPage[2]); } return(pageData.wizardPage[2]); case DS_DOC: if (!(pageData.wizardPage[2] instanceof WizardSubPageFormTable)) { pageData.wizardPage[2] = new WizardSubPageFormTable(pageData); ((Wizard)getWizard()).addPage(pageData.wizardPage[2]); } return(pageData.wizardPage[2]); } return null; }
Example #10
Source File: ManageOrganizationHandler.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Execute public void execute() { final Wizard newWizard = new ManageOrganizationWizard(); final WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), newWizard) { @Override protected Point getInitialSize() { return new Point(1200, 800); } }; dialog.open(); }
Example #11
Source File: OrganizationFileStore.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected IWorkbenchPart doOpen() { final Wizard newWizard = new ManageOrganizationWizard(getContent()); final WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), newWizard) { @Override protected Point getInitialSize() { return new Point(1200, 800); } }; dialog.open(); return null; }
Example #12
Source File: ProcessDiagramEditorUtil.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * Runs the wizard in a dialog. * * @generated */ public static void runWizard(Shell shell, Wizard wizard, String settingsKey) { IDialogSettings pluginDialogSettings = ProcessDiagramEditorPlugin.getInstance().getDialogSettings(); IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey); if (wizardDialogSettings == null) { wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey); } wizard.setDialogSettings(wizardDialogSettings); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500); dialog.open(); }
Example #13
Source File: EditLocationAction.java From RDFS with Apache License 2.0 | 5 votes |
@Override public void run() { final HadoopServer server = serverView.getSelectedServer(); if (server == null) return; WizardDialog dialog = new WizardDialog(null, new Wizard() { private HadoopLocationWizard page = new HadoopLocationWizard(server); @Override public void addPages() { super.addPages(); setWindowTitle("Edit Hadoop location..."); addPage(page); } @Override public boolean performFinish() { page.performFinish(); return true; } }); dialog.create(); dialog.setBlockOnOpen(true); dialog.open(); super.run(); }
Example #14
Source File: ICEItemTemplate.java From ice with Eclipse Public License 1.0 | 5 votes |
/** * Adds the page to the wizard. */ public void addPages(Wizard wizard) { WizardPage p1 = createPage(0); p1.setPageComplete(false); p1.setTitle("New ICE Item Project"); p1.setDescription("Specify ICE Item Parameters."); wizard.addPage(p1); markPagesAdded(); }
Example #15
Source File: WizardSubPageMain.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
@Override public WizardPage getNextPage() { boolean newPage = true; refreshData(); switch(pageData.type) { case WizardData.PAGE_TYPE_NAVIGATOR: if (!(pageData.wizardPage[1] instanceof WizardSubPageNav) ) { pageData.wizardPage[1] = new WizardSubPageNav(pageData); ((Wizard)getWizard()).addPage(pageData.wizardPage[1]); } return(pageData.wizardPage[1]); case WizardData.PAGE_TYPE_VIEW: if (pageData.wizardPage[1] instanceof WizardSubPageDataSource) { if (((WizardSubPageDataSource)pageData.wizardPage[1]).getType() == WizardSubPageDataSource.DS_VIEW) { newPage = false; } } if (newPage) { pageData.wizardPage[1] = new WizardSubPageDataSource(pageData, WizardSubPageDataSource.DS_VIEW); ((Wizard)getWizard()).addPage(pageData.wizardPage[1]); } return(pageData.wizardPage[1]); case WizardData.PAGE_TYPE_FORM: if (pageData.wizardPage[1] instanceof WizardSubPageDataSource) { if (((WizardSubPageDataSource)pageData.wizardPage[1]).getType() == WizardSubPageDataSource.DS_DOC) { newPage = false; } } if (newPage) { pageData.wizardPage[1] = new WizardSubPageDataSource(pageData, WizardSubPageDataSource.DS_DOC); ((Wizard)getWizard()).addPage(pageData.wizardPage[1]); } return(pageData.wizardPage[1]); } return super.getNextPage(); }
Example #16
Source File: DynamicWorkingSetPagePDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
private void openPageInWizardDialog() { Wizard wizard = new Wizard() { @Override public boolean performFinish() { return true; } }; WizardDialog wizardDialog = new WizardDialog( displayHelper.createShell(), wizard ); wizard.setContainer( wizardDialog ); wizard.addPage( page ); page.setWizard( wizard ); wizardDialog.setBlockOnOpen( false ); wizardDialog.open(); wizardDialog.showPage( page ); }
Example #17
Source File: ConditionHelpers.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Checks if the wizard's shell is null * * @param wizard * the null * @return ICondition for verification */ public static ICondition isWizardReady(final Wizard wizard) { return new SWTBotTestCondition() { @Override public boolean test() throws Exception { if (wizard.getShell() == null) { return false; } return true; } }; }
Example #18
Source File: CrossflowDiagramEditorUtil.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * Runs the wizard in a dialog. * * @generated */ public static void runWizard(Shell shell, Wizard wizard, String settingsKey) { IDialogSettings pluginDialogSettings = CrossflowDiagramEditorPlugin.getInstance().getDialogSettings(); IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey); if (wizardDialogSettings == null) { wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey); } wizard.setDialogSettings(wizardDialogSettings); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500); dialog.open(); }
Example #19
Source File: ConnectionContextTemplate.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void addPages ( final Wizard wizard ) { final WizardPage page = createPage ( 0, IHelpContextIds.TEMPLATE_CONNECTION ); page.setTitle ( "Connection" ); page.setDescription ( "Connection options" ); wizard.addPage ( page ); markPagesAdded (); }
Example #20
Source File: DetailViewTemplate.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void addPages ( final Wizard wizard ) { if ( this.id == null ) { final WizardPage page = createPage ( 0, IHelpContextIds.TEMPLATE_DETAIL_VIEW ); page.setTitle ( Messages.DetailViewTemplate_Page_Title ); page.setDescription ( Messages.DetailViewTemplate_Page_Description ); wizard.addPage ( page ); markPagesAdded (); } }
Example #21
Source File: EditLocationAction.java From hadoop-gpu with Apache License 2.0 | 5 votes |
@Override public void run() { final HadoopServer server = serverView.getSelectedServer(); if (server == null) return; WizardDialog dialog = new WizardDialog(null, new Wizard() { private HadoopLocationWizard page = new HadoopLocationWizard(server); @Override public void addPages() { super.addPages(); setWindowTitle("Edit Hadoop location..."); addPage(page); } @Override public boolean performFinish() { page.performFinish(); return true; } }); dialog.create(); dialog.setBlockOnOpen(true); dialog.open(); super.run(); }
Example #22
Source File: TextFileInputDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void getFixed() { TextFileInputMeta info = new TextFileInputMeta(); getInfo( info, true ); Shell sh = new Shell( shell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); try { List<String> rows = getFirst( 50, false ); fields = getFields( info, rows ); final TextFileImportWizardPage1 page1 = new TextFileImportWizardPage1( "1", props, rows, fields ); page1.createControl( sh ); final TextFileImportWizardPage2 page2 = new TextFileImportWizardPage2( "2", props, rows, fields ); page2.createControl( sh ); Wizard wizard = new Wizard() { public boolean performFinish() { wFields.clearAll( false ); for ( TextFileInputFieldInterface field1 : fields ) { BaseFileField field = (BaseFileField) field1; if ( !field.isIgnored() && field.getLength() > 0 ) { TableItem item = new TableItem( wFields.table, SWT.NONE ); item.setText( 1, field.getName() ); item.setText( 2, "" + field.getTypeDesc() ); item.setText( 3, "" + field.getFormat() ); item.setText( 4, "" + field.getPosition() ); item.setText( 5, field.getLength() < 0 ? "" : "" + field.getLength() ); item.setText( 6, field.getPrecision() < 0 ? "" : "" + field.getPrecision() ); item.setText( 7, "" + field.getCurrencySymbol() ); item.setText( 8, "" + field.getDecimalSymbol() ); item.setText( 9, "" + field.getGroupSymbol() ); item.setText( 10, "" + field.getNullString() ); item.setText( 11, "" + field.getIfNullValue() ); item.setText( 12, "" + field.getTrimTypeDesc() ); item.setText( 13, field.isRepeated() ? BaseMessages.getString( PKG, "System.Combo.Yes" ) : BaseMessages .getString( PKG, "System.Combo.No" ) ); } } int size = wFields.table.getItemCount(); if ( size == 0 ) { new TableItem( wFields.table, SWT.NONE ); } wFields.removeEmptyRows(); wFields.setRowNums(); wFields.optWidth( true ); input.setChanged(); return true; } }; wizard.addPage( page1 ); wizard.addPage( page2 ); WizardDialog wd = new WizardDialog( shell, wizard ); WizardDialog.setDefaultImage( GUIResource.getInstance().getImageWizard() ); wd.setMinimumPageSize( 700, 375 ); wd.updateSize(); wd.open(); } catch ( Exception e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogTitle" ), BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogMessage" ), e ); } }
Example #23
Source File: TextFileInputDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void getFixed() { TextFileInputMeta info = new TextFileInputMeta(); getInfo( info ); Shell sh = new Shell( shell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); try { List<String> rows = getFirst( 50, false ); fields = getFields( info, rows ); final TextFileImportWizardPage1 page1 = new TextFileImportWizardPage1( "1", props, rows, fields ); page1.createControl( sh ); final TextFileImportWizardPage2 page2 = new TextFileImportWizardPage2( "2", props, rows, fields ); page2.createControl( sh ); Wizard wizard = new Wizard() { public boolean performFinish() { wFields.clearAll( false ); for ( TextFileInputFieldInterface field1 : fields ) { TextFileInputField field = (TextFileInputField) field1; if ( !field.isIgnored() && field.getLength() > 0 ) { TableItem item = new TableItem( wFields.table, SWT.NONE ); item.setText( 1, field.getName() ); item.setText( 2, "" + field.getTypeDesc() ); item.setText( 3, "" + field.getFormat() ); item.setText( 4, "" + field.getPosition() ); item.setText( 5, field.getLength() < 0 ? "" : "" + field.getLength() ); item.setText( 6, field.getPrecision() < 0 ? "" : "" + field.getPrecision() ); item.setText( 7, "" + field.getCurrencySymbol() ); item.setText( 8, "" + field.getDecimalSymbol() ); item.setText( 9, "" + field.getGroupSymbol() ); item.setText( 10, "" + field.getNullString() ); item.setText( 11, "" + field.getIfNullValue() ); item.setText( 12, "" + field.getTrimTypeDesc() ); item.setText( 13, field.isRepeated() ? BaseMessages.getString( PKG, "System.Combo.Yes" ) : BaseMessages .getString( PKG, "System.Combo.No" ) ); } } int size = wFields.table.getItemCount(); if ( size == 0 ) { new TableItem( wFields.table, SWT.NONE ); } wFields.removeEmptyRows(); wFields.setRowNums(); wFields.optWidth( true ); input.setChanged(); return true; } }; wizard.addPage( page1 ); wizard.addPage( page2 ); WizardDialog wd = new WizardDialog( shell, wizard ); WizardDialog.setDefaultImage( GUIResource.getInstance().getImageWizard() ); wd.setMinimumPageSize( 700, 375 ); wd.updateSize(); wd.open(); } catch ( Exception e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogTitle" ), BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogMessage" ), e ); } }
Example #24
Source File: SpoonJobDelegate.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * Create a job that extracts tables & data from a database. * <p> * <p> * * 0) Select the database to rip * <p> * 1) Select the tables in the database to rip * <p> * 2) Select the database to dump to * <p> * 3) Select the repository directory in which it will end up * <p> * 4) Select a name for the new job * <p> * 5) Create an empty job with the selected name. * <p> * 6) Create 1 transformation for every selected table * <p> * 7) add every created transformation to the job & evaluate * <p> * */ public void ripDBWizard() { final List<DatabaseMeta> databases = spoon.getActiveDatabases(); if ( databases.size() == 0 ) { return; // Nothing to do here } final RipDatabaseWizardPage1 page1 = new RipDatabaseWizardPage1( "1", databases ); final RipDatabaseWizardPage2 page2 = new RipDatabaseWizardPage2( "2" ); final RipDatabaseWizardPage3 page3 = new RipDatabaseWizardPage3( "3", spoon.getRepository() ); Wizard wizard = new Wizard() { public boolean performFinish() { try { JobMeta jobMeta = ripDB( databases, page3.getJobname(), page3.getRepositoryDirectory(), page3.getDirectory(), page1 .getSourceDatabase(), page1.getTargetDatabase(), page2.getSelection() ); if ( jobMeta == null ) { return false; } if ( page3.getRepositoryDirectory() != null ) { spoon.saveToRepository( jobMeta, false ); } else { spoon.saveToFile( jobMeta ); } addJobGraph( jobMeta ); return true; } catch ( Exception e ) { new ErrorDialog( spoon.getShell(), "Error", "An unexpected error occurred!", e ); return false; } } /** * @see org.eclipse.jface.wizard.Wizard#canFinish() */ public boolean canFinish() { return page3.canFinish(); } }; wizard.addPage( page1 ); wizard.addPage( page2 ); wizard.addPage( page3 ); WizardDialog wd = new WizardDialog( spoon.getShell(), wizard ); WizardDialog.setDefaultImage( GUIResource.getInstance().getImageWizard() ); wd.setMinimumPageSize( 700, 400 ); wd.updateSize(); wd.open(); }
Example #25
Source File: DataWizardDialog.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public DataWizardDialog(final Shell parentShell, final Wizard newWizard, final IAddData addData) { super(parentShell, newWizard, addData != null); this.addData = addData; }
Example #26
Source File: AbstractDataSection.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected WizardDialog createWizardDialog( final Wizard wizard, final String finishLabel) { return new CustomWizardDialog(getActiveShell(), wizard, finishLabel); }
Example #27
Source File: DataViewer.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected WizardDialog createWizardDialog( final Wizard wizard, final String finishLabel) { return new CustomWizardDialog(Display.getDefault().getActiveShell(), wizard, finishLabel); }
Example #28
Source File: CreateDatabaseWizard.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * Shows a wizard that creates a new database connection... * * @param shell * @param props * @param databases * @return DatabaseMeta when finished or null when canceled */ public DatabaseMeta createAndRunDatabaseWizard( Shell shell, PropsUI props, List<DatabaseMeta> databases ) { DatabaseMeta newDBInfo = new DatabaseMeta(); final CreateDatabaseWizardPage1 page1 = new CreateDatabaseWizardPage1( "1", props, newDBInfo, databases ); final CreateDatabaseWizardPageInformix pageifx = new CreateDatabaseWizardPageInformix( "ifx", props, newDBInfo ); final CreateDatabaseWizardPageJDBC pagejdbc = new CreateDatabaseWizardPageJDBC( "jdbc", props, newDBInfo ); final CreateDatabaseWizardPageOCI pageoci = new CreateDatabaseWizardPageOCI( "oci", props, newDBInfo ); final CreateDatabaseWizardPageODBC pageodbc = new CreateDatabaseWizardPageODBC( "odbc", props, newDBInfo ); final CreateDatabaseWizardPageOracle pageoracle = new CreateDatabaseWizardPageOracle( "oracle", props, newDBInfo ); final CreateDatabaseWizardPageGeneric pageGeneric = new CreateDatabaseWizardPageGeneric( "generic", props, newDBInfo ); final CreateDatabaseWizardPage2 page2 = new CreateDatabaseWizardPage2( "2", props, newDBInfo ); for ( PluginInterface pluginInterface : PluginRegistry.getInstance().getPlugins( DatabasePluginType.class ) ) { try { Object plugin = PluginRegistry.getInstance().loadClass( pluginInterface ); if ( plugin instanceof WizardPageFactory ) { WizardPageFactory factory = (WizardPageFactory) plugin; additionalPages.add( factory.createWizardPage( props, newDBInfo ) ); } } catch ( KettlePluginException kpe ) { // Don't do anything } } wizardFinished = false; // set to false for safety only Wizard wizard = new Wizard() { /** * @see org.eclipse.jface.wizard.Wizard#performFinish() */ public boolean performFinish() { wizardFinished = true; return true; } /** * @see org.eclipse.jface.wizard.Wizard#canFinish() */ public boolean canFinish() { return page2.canFinish(); } }; wizard.addPage( page1 ); wizard.addPage( pageoci ); wizard.addPage( pageodbc ); wizard.addPage( pagejdbc ); wizard.addPage( pageoracle ); wizard.addPage( pageifx ); wizard.addPage( pageGeneric ); for ( WizardPage page : additionalPages ) { wizard.addPage( page ); } wizard.addPage( page2 ); WizardDialog wd = new WizardDialog( shell, wizard ); WizardDialog.setDefaultImage( GUIResource.getInstance().getImageWizard() ); wd.setMinimumPageSize( 700, 400 ); wd.updateSize(); wd.open(); if ( !wizardFinished ) { newDBInfo = null; } return newDBInfo; }
Example #29
Source File: WizardBuilder.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * Create an instance of {@link Wizard} from the builder */ public Wizard asWizard() { final Wizard wizard = new Wizard() { @Override public boolean performFinish() { pages.stream() .map(WizardPageBuilder::getControlSupplier) .filter(Objects::nonNull) .forEachOrdered(controlSupplier -> controlSupplier.saveSettings(getDialogSettings())); try { if (finishHandler != null) { finishResult = finishHandler.finish(getContainer()); return finishResult.isPresent(); } return true; } catch (final Throwable t) { new ExceptionDialogHandler().openErrorDialog(getShell(), Messages.errorOccuredDuringFinish, t); return false; } } @Override public void setContainer(IWizardContainer wizardContainer) { super.setContainer(wizardContainer); if (wizardContainer instanceof IPageChangeProvider) { IWizardPage startingPage = getStartingPage(); if (startingPage instanceof IPageChangedListener) { ((IPageChangeProvider) wizardContainer) .addPageChangedListener((IPageChangedListener) startingPage); } } } }; pages.stream().forEachOrdered(page -> wizard.addPage(page.asPage())); wizard.setNeedsProgressMonitor(needProgress); wizard.setWindowTitle(windowTitle); wizard.setDefaultPageImageDescriptor(imageDescriptor); wizard.setDialogSettings(WorkbenchPlugin.getDefault().getDialogSettings()); return wizard; }
Example #30
Source File: TextFileInputDialog.java From hop with Apache License 2.0 | 4 votes |
private void getFixed() { TextFileInputMeta info = new TextFileInputMeta(); getInfo( info, true ); Shell sh = new Shell( shell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); try { List<String> rows = getFirst( 50, false ); fields = getFields( info, rows ); final TextFileImportWizardPage1 page1 = new TextFileImportWizardPage1( "1", props, rows, fields ); page1.createControl( sh ); final TextFileImportWizardPage2 page2 = new TextFileImportWizardPage2( "2", props, rows, fields ); page2.createControl( sh ); Wizard wizard = new Wizard() { public boolean performFinish() { wFields.clearAll( false ); for ( ITextFileInputField field1 : fields ) { BaseFileField field = (BaseFileField) field1; if ( !field.isIgnored() && field.getLength() > 0 ) { TableItem item = new TableItem( wFields.table, SWT.NONE ); item.setText( 1, field.getName() ); item.setText( 2, "" + field.getTypeDesc() ); item.setText( 3, "" + field.getFormat() ); item.setText( 4, "" + field.getPosition() ); item.setText( 5, field.getLength() < 0 ? "" : "" + field.getLength() ); item.setText( 6, field.getPrecision() < 0 ? "" : "" + field.getPrecision() ); item.setText( 7, "" + field.getCurrencySymbol() ); item.setText( 8, "" + field.getDecimalSymbol() ); item.setText( 9, "" + field.getGroupSymbol() ); item.setText( 10, "" + field.getNullString() ); item.setText( 11, "" + field.getIfNullValue() ); item.setText( 12, "" + field.getTrimTypeDesc() ); item.setText( 13, field.isRepeated() ? BaseMessages.getString( PKG, "System.Combo.Yes" ) : BaseMessages .getString( PKG, "System.Combo.No" ) ); } } int size = wFields.table.getItemCount(); if ( size == 0 ) { new TableItem( wFields.table, SWT.NONE ); } wFields.removeEmptyRows(); wFields.setRowNums(); wFields.optWidth( true ); input.setChanged(); return true; } }; wizard.addPage( page1 ); wizard.addPage( page2 ); WizardDialog wd = new WizardDialog( shell, wizard ); WizardDialog.setDefaultImage( GuiResource.getInstance().getImageWizard() ); wd.setMinimumPageSize( 700, 375 ); wd.updateSize(); wd.open(); } catch ( Exception e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogTitle" ), BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogMessage" ), e ); } }