org.eclipse.jface.wizard.IWizard Java Examples
The following examples show how to use
org.eclipse.jface.wizard.IWizard.
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: ExportHandler.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
/** * Tries to load the wizard for the LaTex export. If a project can be loaded, it will be opened. */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { if(tryLoadingProjectFiles(event)) { Shell activeShell = HandlerUtil.getActiveShell(event); IWizard wizard = new LatexExportWizard(); WizardDialog wizardDialog = new WizardDialog(activeShell, wizard); wizardDialog.open(); } else { // String errorMessage = "No taxonomy is present. Please load a taxonomy to be able to use the LaTex export."; // if (!ModelRegistryPlugin.getModelRegistry().getActiveTaxonomy().isPresent()) { // MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", // errorMessage); // return null; // } else { // // } } return null; }
Example #2
Source File: WizardDoubleClickListenerTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void should_not_close_on_double_click_if_finish_fail() { IWizard wizard = mock(IWizard.class); when(wizard.canFinish()).thenReturn(true); when(wizard.performFinish()).thenReturn(false); IWizardPage currentPage = mock(IWizardPage.class); when(currentPage.getWizard()).thenReturn(wizard); WizardDialog wizardContainer = mock(WizardDialog.class); when(wizardContainer.getCurrentPage()).thenReturn(currentPage); WizardDoubleClickListener listener = new WizardDoubleClickListener(wizardContainer); DoubleClickEvent event = mock(DoubleClickEvent.class); listener.doubleClick(event); verify(wizardContainer, times(0)).close(); }
Example #3
Source File: TSWizardDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #4
Source File: TSWizardDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 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(); }
Example #5
Source File: TSWizardDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 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(); }
Example #6
Source File: TSWizardDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #7
Source File: WizardDoubleClickListenerTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void should_perform_finish_on_double_click() { IWizard wizard = mock(IWizard.class); when(wizard.canFinish()).thenReturn(true); when(wizard.performFinish()).thenReturn(true); IWizardPage currentPage = mock(IWizardPage.class); when(currentPage.getWizard()).thenReturn(wizard); WizardDialog wizardContainer = mock(WizardDialog.class); when(wizardContainer.getCurrentPage()).thenReturn(currentPage); WizardDoubleClickListener listener = new WizardDoubleClickListener(wizardContainer); DoubleClickEvent event = mock(DoubleClickEvent.class); listener.doubleClick(event); verify(wizard).performFinish(); verify(wizardContainer).close(); }
Example #8
Source File: WizardUtils.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public static void openWizard(String wizardId, Shell parentShell, ISelection selection) { // First see if this is a "new wizard". IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(wizardId); // If not check if it is an "import wizard". if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(wizardId); } // Or maybe an export wizard if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(wizardId); } try { // Then if we have a wizard, open it. if (descriptor != null) { IWizard wizard = descriptor.createWizard(); if (wizard instanceof IWorkbenchWizard) { IStructuredSelection structuredSelection = selection instanceof IStructuredSelection? (IStructuredSelection)selection : new StructuredSelection(); ((IWorkbenchWizard)wizard).init(PlatformUI.getWorkbench(), structuredSelection); WizardDialog wd = new WizardDialog(parentShell, wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } else { Assert.isTrue(false, "Attempt to call not IWorkbenchWizard"); //$NON-NLS-1$ } } } catch (CoreException e) { e.printStackTrace(); } }
Example #9
Source File: AttachSourcesHandler.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
@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; }
Example #10
Source File: ParameterWizardDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public ParameterWizardDialog(final Shell parentShell, final IWizard newWizard, final ParameterPropertySection parameterPropertySection) { super(parentShell, newWizard, parameterPropertySection != null); this.parameterPropertySection = parameterPropertySection; if (this.parameterPropertySection == null) { setTitle(Messages.editParameterWizardTitle); } else { setTitle(Messages.newParameter); } }
Example #11
Source File: RefactoringLocationControl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Creates a new refactoring location control. * * @param wizard * the wizard * @param parent * the parent control * @param key * the dialog settings key */ public RefactoringLocationControl(final IWizard wizard, final Composite parent, final String key) { super(parent, SWT.NONE); final GridLayout gridLayout= new GridLayout(1, true); gridLayout.horizontalSpacing= 0; gridLayout.marginWidth= 0; setLayout(gridLayout); fCombo= new Combo(this, SWT.SINGLE | SWT.BORDER); fCombo.setLayoutData(createGridData(GridData.FILL_BOTH, 1, 0)); Assert.isNotNull(wizard); Assert.isTrue(key != null && !"".equals(key)); //$NON-NLS-1$ fWizard= wizard; fKey= key; }
Example #12
Source File: NodeFilterViewPart.java From depan with Apache License 2.0 | 5 votes |
private void runCreateWizard() { SteppingFilter filter = filterControl.buildFilter(); IWizard wizard = prepareWizard(resultNodes, filter.getName()); Shell shell = getSite().getWorkbenchWindow().getShell(); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.open(); }
Example #13
Source File: SelectDataWizardPageTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private IWizard wizardWithContainer() { final IWizard wizard = mock(IWizard.class); final IWizardContainer wizardContainer = mock(IWizardContainer.class); when(wizardContainer.getShell()).thenReturn(realmWithDisplay.getShell()); when(wizard.getContainer()).thenReturn(wizardContainer); return wizard; }
Example #14
Source File: TSWizardDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new wizard dialog for the given wizard. * * @param parentShell * the parent shell * @param newWizard * the wizard this dialog is working on */ public TSWizardDialog(Shell parentShell, IWizard newWizard) { super(parentShell); setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE | getDefaultOrientation()); setWizard(newWizard); // since VAJava can't initialize an instance var with an anonymous // class outside a constructor we do it here: cancelListener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { cancelPressed(); } }; }
Example #15
Source File: CreateExtensionWorkingSetsHandler.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
@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; }
Example #16
Source File: ClasspathContainerPreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected IWizard createWizard() { try { IJavaProject project= fJavaProject; IClasspathEntry[] entries= project.getRawClasspath(); return new ClasspathContainerWizard(fEntry, project, entries); } catch (JavaModelException e) { String title= ActionMessages.ConfigureContainerAction_error_title; String message= ActionMessages.ConfigureContainerAction_error_creationfailed_message; ExceptionHandler.handle(e, getShell(), title, message); } return null; }
Example #17
Source File: ConfigurationWizardDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public ConfigurationWizardDialog(Shell parentShell, IWizard newWizard) { super(parentShell, newWizard); IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings(); dialogSettings = workbenchSettings.getSection(ConfigurationWizardDialog.class.getName()); if (dialogSettings == null) { dialogSettings = workbenchSettings.addNewSection(ConfigurationWizardDialog.class.getName()); } isSimpleMode = dialogSettings.getBoolean(CONFIGURATION_WIZARD_DIALOG_SIMPLE_MODE); }
Example #18
Source File: ConnectorDefinitionWizardDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected ITestConfigurationListener getTestListener(final ConnectorConfiguration configuration, final IWizard wizard) { Connector connector = null; if (wizard instanceof ConnectorWizard) { connector = ((ConnectorWizard) wizard).getWorkingCopyConnector(); } return new TestConfigurationListener(configuration, this, connector); }
Example #19
Source File: TSWizardDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new wizard dialog for the given wizard. * * @param parentShell * the parent shell * @param newWizard * the wizard this dialog is working on */ public TSWizardDialog(Shell parentShell, IWizard newWizard) { super(parentShell); setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE | getDefaultOrientation()); setWizard(newWizard); // since VAJava can't initialize an instance var with an anonymous // class outside a constructor we do it here: cancelListener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { cancelPressed(); } }; }
Example #20
Source File: CreateDatabaseWizardPage1.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public IWizardPage getNextPage() { IWizard wiz = getWizard(); IWizardPage nextPage; switch ( databaseMeta.getAccessType() ) { case DatabaseMeta.TYPE_ACCESS_OCI: nextPage = wiz.getPage( "oci" ); // OCI break; case DatabaseMeta.TYPE_ACCESS_ODBC: nextPage = wiz.getPage( "odbc" ); // ODBC break; case DatabaseMeta.TYPE_ACCESS_PLUGIN: nextPage = wiz.getPage( databaseMeta.getPluginId() ); // e.g. SAPR3 break; default: // Generic or Native if ( databaseMeta.getDatabaseInterface() instanceof GenericDatabaseMeta ) { // Generic nextPage = wiz.getPage( "generic" ); // generic } else { // Native nextPage = wiz.getPage( "jdbc" ); if ( nextPage != null ) { // Set the port number... ( (CreateDatabaseWizardPageJDBC) nextPage ).setData(); } } break; } return nextPage; }
Example #21
Source File: TSWizardDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Sets the wizard this dialog is currently displaying. * * @param newWizard * the wizard */ protected void setWizard(IWizard newWizard) { wizard = newWizard; wizard.setContainer(this); if (!createdWizards.contains(wizard)) { createdWizards.add(wizard); // New wizard so just add it to the end of our nested list nestedWizards.add(wizard); if (pageContainer != null) { // Dialog is already open // Allow the wizard pages to precreate their page controls // This allows the wizard to open to the correct size createPageControls(); // Ensure the dialog is large enough for the wizard updateSizeForWizard(wizard); pageContainer.layout(true); } } else { // We have already seen this wizard, if it is the previous wizard // on the nested list then we assume we have gone back and remove // the last wizard from the list int size = nestedWizards.size(); if (size >= 2 && nestedWizards.get(size - 2) == wizard) { nestedWizards.remove(size - 1); } else { // Assume we are going forward to revisit a wizard nestedWizards.add(wizard); } } }
Example #22
Source File: AbstractManageDiagramWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Composite doCreateControl(final Composite parent, final DataBindingContext context) { final Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayout(fillDefaults().numColumns(2).equalWidth(true).create()); diagramTree = new FilteredTree(mainComposite, SWT.MULTI | SWT.BORDER, new PatternFilter(), false); final TreeViewer treeViewer = diagramTree.getViewer(); treeViewer.getTree().setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_OPEN_DIAGRAM_TREE_ID); diagramTree .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).hint(SWT.DEFAULT, 250).create()); treeViewer.setContentProvider( new ObservableListTreeContentProvider(diagramListObservableFactory(), diagramTreeStructure())); treeViewer.setLabelProvider(new DiagramLabelProvider(new FileStoreLabelProvider())); final IObservableList selectionObservable = PojoObservables.observeList(this, "selectedDiagrams"); context.bindList(ViewersObservables.observeMultiSelection(diagramTree.getViewer()), selectionObservable); context.addValidationStatusProvider(new MultiValidator() { @Override protected IStatus validate() { return selectionObservable.isEmpty() ? ValidationStatus.error(Messages.noDiagramSelected) : ValidationStatus.ok(); } }); treeViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent arg0) { final IWizard wizard = getWizard(); if (wizard.canFinish() && wizard.performFinish() && wizard.getContainer() instanceof WizardDialog) { ((WizardDialog) wizard.getContainer()).close(); } } }); treeViewer.setInput(diagramRepositoryStore); treeViewer.getTree().setFocus(); defaultSelection(selectionObservable); return mainComposite; }
Example #23
Source File: SaveReportAsWizardDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
protected void finishPressed( ) { super.finishPressed( ); IWizardPage page = getCurrentPage( ); IWizard wizard = page.getWizard(); this.saveAsPath = ( (SaveReportAsWizard) wizard ).getSaveAsPath(); }
Example #24
Source File: AbstractConnectorOutputWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public IWizardPage getPreviousPage() { if(previousPageBackup != null){ return previousPageBackup; } final IWizard wizard = getWizard(); if(wizard != null){ return wizard.getPreviousPage(this); } return super.getPreviousPage(); }
Example #25
Source File: SaveReportAsWizardDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
protected void finishPressed( ) { super.finishPressed( ); IWizardPage page = getCurrentPage( ); IWizard wizard = page.getWizard( ); this.saveAsPath = ( (SaveReportAsWizard) wizard ).getSaveAsPath( ); }
Example #26
Source File: TestConnectorDefinitionWizardDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public TestConnectorDefinitionWizardDialog(Shell parentShell, IWizard newWizard) { super( parentShell, newWizard, RepositoryManager.getInstance().getRepositoryStore(ConnectorConfRepositoryStore.class), RepositoryManager.getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class), (IImplementationRepositoryStore) RepositoryManager.getInstance().getRepositoryStore(ConnectorImplRepositoryStore.class)); }
Example #27
Source File: SelectNameAndDescWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public IWizardPage getPreviousPage() { IWizard wizard = getWizard(); if(wizard != null){ return wizard.getPreviousPage(this); } return super.getPreviousPage(); }
Example #28
Source File: CreateDatabaseWizardPageJDBC.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public IWizardPage getNextPage() { IWizard wiz = getWizard(); IWizardPage nextPage; if ( databaseMeta.getDatabaseInterface() instanceof OracleDatabaseMeta ) { nextPage = wiz.getPage( "oracle" ); // Oracle } else if ( databaseMeta.getDatabaseInterface() instanceof InformixDatabaseMeta ) { nextPage = wiz.getPage( "ifx" ); // Informix } else { nextPage = wiz.getPage( "2" ); // page 2 } return nextPage; }
Example #29
Source File: TestNewCargoProjectWizard.java From corrosion with Eclipse Public License 2.0 | 5 votes |
private static void confirmPageState(IWizard wizard, String expectedProjectName, String expectedVCS, Boolean expectedBinaryState) { NewCargoProjectWizardPage page = (NewCargoProjectWizardPage) wizard.getPages()[0]; assertEquals(expectedProjectName, page.getProjectName()); assertEquals(expectedVCS, page.getVCS()); assertEquals(expectedBinaryState, page.isBinaryTemplate()); }
Example #30
Source File: GitlabConnectorUI.java From mylyn-gitlab with Eclipse Public License 1.0 | 4 votes |
@Override public IWizard getNewTaskWizard(TaskRepository repository, ITaskMapping mapping) { return new NewTaskWizard(repository, mapping); }