List of usage examples for org.eclipse.jface.wizard IWizardPage canFlipToNextPage
public boolean canFlipToNextPage();
From source file:com.codesourcery.internal.installer.ui.InstallWizardDialog.java
License:Open Source License
@Override public void updateButtons() { super.updateButtons(); // Rename 'Finish' button to 'Install or 'Uninstall' getButton(IDialogConstants.FINISH_ID) .setText(getInstallWizard().isInstall() ? InstallMessages.Install : InstallMessages.Uninstall); // Override the wizard dialog default behavior to set the finish button // as default. Always set the next button as default. IWizardPage currentPage = getCurrentPage(); if ((currentPage != null) && currentPage.canFlipToNextPage()) { getShell().setDefaultButton(this.getButton(IDialogConstants.NEXT_ID)); }/*w w w . ja va2 s . co m*/ }
From source file:org.eclipse.compare.tests.PatchUITest.java
License:Open Source License
public void testApplyClipboardPatch() throws CoreException { // Clipboard support on Mac OS is not reliable when tests are run // through an SSH session, see bug 272870 for details if (Platform.getOS().equals(Platform.OS_MACOSX)) { return;//from w w w.j av a 2 s.c om } copyIntoClipboard("patch_context0.txt"); copyIntoWorkspace("context.txt"); openPatchWizard(); assertTrue(wizard.getPageCount() == 3); IWizardPage patchWizardPage = wizard.getPages()[0]; assertTrue(patchWizardPage.canFlipToNextPage()); callMethod(wizardDialog, "nextPressed", new Object[] {}); processQueuedEvents(); assertTrue(wizard.canFinish()); wizard.performFinish(); wizardDialog.close(); InputStream expected = PatchUtils.asInputStream("exp_context.txt"); InputStream actual = testProject.getFile("context.txt").getContents(); compareStreams(expected, actual); }
From source file:org.eclipse.compare.tests.PatchUITest.java
License:Open Source License
public void testApplyWorkspacePatch() throws CoreException { copyIntoWorkspace("patch_addition.txt"); openPatchWizard();/*from w ww .java2 s.com*/ assertTrue(wizard.getPageCount() == 3); IWizardPage patchWizardPage = wizard.getPages()[0]; getButton(patchWizardPage, "fUseClipboardButton").setSelection(false); getButton(patchWizardPage, "fUsePatchFileButton").setSelection(false); getButton(patchWizardPage, "fUseWorkspaceButton").setSelection(true); TreeViewer tree = getTreeViewer(patchWizardPage, "fTreeViewer"); treeSelect(tree, TEST_PROJECT + "/patch_addition.txt"); processQueuedEvents(); assertTrue(patchWizardPage.canFlipToNextPage()); callMethod(wizardDialog, "nextPressed", new Object[] {}); assertTrue(wizard.canFinish()); wizard.performFinish(); wizardDialog.close(); InputStream expected = PatchUtils.asInputStream("exp_addition.txt"); InputStream actual = testProject.getFile("exp_addition.txt").getContents(); compareStreams(expected, actual); }
From source file:org.eclipse.compare.tests.PatchUITest.java
License:Open Source License
public void testApplyClipboardPatch_AdditionWithWindowsLD() throws Exception { // Clipboard support on Mac OS is not reliable when tests are run // through an SSH session, see bug 272870 for details if (Platform.getOS().equals(Platform.OS_MACOSX)) { return;/*from w w w. j a va 2 s . c om*/ } Preferences workspacePreferences = Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE); final String previous = getStoredValue(workspacePreferences); // set new text file line delimiter to "\r\n" (Windows) saveValue(workspacePreferences, "\r\n"); copyIntoClipboard("patch_addition.txt"); openPatchWizard(); assertTrue(wizard.getPageCount() == 3); IWizardPage patchWizardPage = wizard.getPages()[0]; assertTrue(patchWizardPage.canFlipToNextPage()); callMethod(wizardDialog, "nextPressed", new Object[] {}); processQueuedEvents(); assertTrue(wizard.canFinish()); wizard.performFinish(); wizardDialog.close(); InputStream expectedIS = PatchUtils.asInputStream("exp_addition.txt"); InputStream actualIS = testProject.getFile("exp_addition.txt").getContents(); String expected = PatchUtils.asString(expectedIS).replaceAll("\n", "\r\n"); String actual = PatchUtils.asString(actualIS); assertEquals(expected, actual); // restore previously saved value for LD saveValue(workspacePreferences, previous); }
From source file:org.eclipse.team.tests.ccvs.ui.CreatePatchTest.java
License:Open Source License
public void _testCreateWorkspacePatch() throws Exception { copyIntoWorkspace("exp_addition.txt", "addition.txt"); openGenerateDiffFileWizard(new IResource[] { testProject }); assertTrue(wizard.getPageCount() == 2); IWizardPage locationPage = wizard.getPages()[0]; getButton(locationPage, "cpRadio").setSelection(false); getButton(locationPage, "fsRadio").setSelection(false); getButton(locationPage, "wsRadio").setSelection(true); getButton(locationPage, "wsRadio").notifyListeners(SWT.Selection, createSelectionEvent()); getText(locationPage, "wsPathText").setText("/" + testProject.getName() + "/patch_addition.txt"); waitForSelection();//from w w w . ja va2s .com processQueuedEvents(); assertTrue(locationPage.canFlipToNextPage()); callMethod(wizardDialog, "nextPressed"); IWizardPage optionsPage = wizard.getPages()[1]; getButton(optionsPage, "unifiedDiffOption").setSelection(true); getButton(optionsPage, "contextDiffOption").setSelection(false); getButton(optionsPage, "regularDiffOption").setSelection(false); getButton(optionsPage, "unified_workspaceRelativeOption").setSelection(true); getButton(optionsPage, "unified_projectRelativeOption").setSelection(false); getButton(optionsPage, "unified_selectionRelativeOption").setSelection(false); processQueuedEvents(); assertTrue(wizard.canFinish()); wizard.performFinish(); wizardDialog.close(); // Ignore lines prefixed with following values to avoid timestamps // mismatches String prefixesToIgnore[] = new String[] { "#P ApplyPatchTest-", "--- /dev/null", "+++ addition.txt" }; InputStream expectedIS = asInputStream("patch_addition.txt"); String expected = filterStream(expectedIS, prefixesToIgnore); IFile patchFile = testProject.getFile("patch_addition.txt"); String actual = readProjectFile(patchFile, prefixesToIgnore); assertEquals(expected, actual); }
From source file:org.eclipse.ui.tests.dialogs.UIEditWorkingSetWizardAuto.java
License:Open Source License
public void testEditPage() throws Throwable { IWizardPage page = fWizardDialog.getCurrentPage(); assertTrue(page instanceof IWorkingSetPage); /*/*www . ja v a 2 s . co m*/ * Verify that correct working set edit page is displayed */ assertTrue(page.getClass() == fDefaultEditPage.getClass()); /* * Test initial page state */ assertTrue(page.canFlipToNextPage() == false); assertTrue(fWizard.canFinish() == false); assertNull(page.getErrorMessage()); /* * Test page state with preset page input */ IWorkingSetManager workingSetManager = fWorkbench.getWorkingSetManager(); IWorkingSet workingSet = workingSetManager.createWorkingSet(WORKING_SET_NAME_1, new IAdaptable[] { p1, f2 }); ((WorkingSetEditWizard) fWizard).setSelection(workingSet); List widgets = getWidgets((Composite) page.getControl(), Text.class); Text text = (Text) widgets.get(0); assertEquals(WORKING_SET_NAME_1, text.getText()); assertTrue(page.canFlipToNextPage() == false); assertTrue(fWizard.canFinish() == false); assertNull(page.getErrorMessage()); widgets = getWidgets((Composite) page.getControl(), Tree.class); Tree tree = (Tree) widgets.get(0); IWorkspace workspace = ResourcesPlugin.getWorkspace(); assertEquals(workspace.getRoot().getProjects().length, tree.getItemCount()); setTextWidgetText(WORKING_SET_NAME_2, page); assertTrue(fWizard.canFinish()); /* * Test page state with partial page input */ setTextWidgetText("", page); assertTrue(page.canFlipToNextPage() == false); assertTrue(fWizard.canFinish() == false); assertNotNull(page.getErrorMessage()); /* * Test page state with complete page input */ setTextWidgetText(WORKING_SET_NAME_2, page); checkTreeItems(); assertTrue(page.canFlipToNextPage() == false); assertTrue(fWizard.canFinish()); assertNull(page.getErrorMessage()); fWizard.performFinish(); workingSet = ((WorkingSetEditWizard) fWizard).getSelection(); IAdaptable[] workingSetItems = workingSet.getElements(); assertEquals(WORKING_SET_NAME_2, workingSet.getName()); assertTrue(ArrayUtil.contains(workingSetItems, p1)); assertTrue(ArrayUtil.contains(workingSetItems, p2)); DialogCheck.assertDialogTexts(fWizardDialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UINewWorkingSetWizardAuto.java
License:Open Source License
public void testEditPage() throws Throwable { WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry(); IWizardPage page = fWizardDialog.getCurrentPage(); IWizardPage defaultEditPage = registry.getDefaultWorkingSetPage(); String defaultEditPageClassName = defaultEditPage.getClass().getName(); WorkingSetDescriptor[] descriptors = getEditableWorkingSetDescriptors(); // the first page must be the type selection page iff there is more than one working set type assertEquals(descriptors.length > 1, (page instanceof WorkingSetTypePage)); if (page instanceof WorkingSetTypePage) { /*//from w w w. j av a 2s .c o m * Select the default (Resource) working set type * and advance to edit page. */ List widgets = getWidgets((Composite) page.getControl(), Table.class); Table table = (Table) widgets.get(0); TableItem[] items = table.getItems(); String workingSetName = null; for (int descriptorIndex = 0; descriptorIndex < descriptors.length; descriptorIndex++) { WorkingSetDescriptor descriptor = descriptors[descriptorIndex]; if (defaultEditPageClassName.equals(descriptor.getPageClassName())) { workingSetName = descriptor.getName(); break; } } assertNotNull(workingSetName); boolean found = false; for (int i = 0; i < items.length; i++) { if (items[i].getText().equals(workingSetName)) { table.setSelection(i); found = true; break; } } assertTrue(found); fWizardDialog.showPage(fWizard.getNextPage(page)); } page = fWizardDialog.getCurrentPage(); assertTrue(page instanceof IWorkingSetPage); /* * Verify that correct working set edit page is displayed */ assertTrue(page.getClass() == defaultEditPage.getClass()); /* * Test initial page state */ assertFalse(page.canFlipToNextPage()); assertFalse(fWizard.canFinish()); assertNull(page.getErrorMessage()); assertNull(page.getMessage()); /* * Test page state with partial page input */ setTextWidgetText(WORKING_SET_NAME_1, page); assertFalse(page.canFlipToNextPage()); assertTrue(fWizard.canFinish()); // allow for empty sets assertNull(page.getErrorMessage()); assertNotNull(page.getMessage()); /* * Test page state with page complete input */ checkTreeItems(); assertFalse(page.canFlipToNextPage()); assertTrue(fWizard.canFinish()); assertNull(page.getErrorMessage()); assertNull(page.getMessage()); fWizard.performFinish(); IWorkingSet workingSet = ((WorkingSetNewWizard) fWizard).getSelection(); IAdaptable[] workingSetItems = workingSet.getElements(); assertEquals(WORKING_SET_NAME_1, workingSet.getName()); List widgets = getWidgets((Composite) page.getControl(), Tree.class); Tree tree = (Tree) widgets.get(0); assertEquals(workingSetItems.length, tree.getItemCount()); assertTrue(ArrayUtil.contains(workingSetItems, p1)); assertTrue(ArrayUtil.contains(workingSetItems, p2)); /* * Check page texts */ DialogCheck.assertDialogTexts(fWizardDialog, this); }
From source file:org.jboss.tools.common.ui.WizardUtils.java
License:Open Source License
/** * Flips to the next wizard page or finishes the current wizard. * /*from w w w. java 2 s . c o m*/ * @param wizardPage * the wizard page this call is executed in */ public static void nextPageOrFinish(IWizardPage wizardPage) { IWizard wizard = wizardPage.getWizard(); if (wizardPage.canFlipToNextPage()) { IWizardPage nextPage = wizard.getNextPage(wizardPage); wizard.getContainer().showPage(nextPage); } else if (wizard.canFinish()) { if (wizard.performFinish()) { wizard.getContainer().getShell().close(); } } }
From source file:org.jboss.tools.jst.web.ui.test.WebWizardsTest.java
License:Open Source License
public void testNewXhtmlWizardInstanceIsCreated() { /*//w ww. j av a2 s .c o m * commented by Maksim Areshkau, * because in this method not called init for wizard */ //testNewWizardInstanceIsCreated(NewXHTMLWizard.class.getName()); IWorkbenchWizard aWizard = (IWorkbenchWizard) WorkbenchUtils .findWizardByDefId(NewXHTMLWizard.class.getName()); WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), aWizard); try { /* * here we show view to get initialized selection */ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView("org.eclipse.jdt.ui.PackageExplorer"); //$NON-NLS-1$ } catch (PartInitException e) { fail(e.toString()); } ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getSelectionService(); ISelection eclipseSelection = selectionService.getSelection(); aWizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) eclipseSelection); dialog.setBlockOnOpen(false); try { dialog.open(); IWizardPage htmlWizardNewFileCreationPage = dialog.getCurrentPage(); assertEquals("The Page should be", "XHTMLWizardNewFileCreationPage", //$NON-NLS-1$//$NON-NLS-2$ htmlWizardNewFileCreationPage.getName()); IWizardPage newXHTMLTemplatesWizardPage = htmlWizardNewFileCreationPage.getNextPage(); assertEquals("The Page should be", "NewXHTMLTemplatesWizardPage", //$NON-NLS-1$//$NON-NLS-2$ newXHTMLTemplatesWizardPage.getName()); if (newXHTMLTemplatesWizardPage.canFlipToNextPage()) { IWizardPage newXHTMLTagLibrariesWizardPage = newXHTMLTemplatesWizardPage.getNextPage(); assertTrue("Start page is not loaded", //$NON-NLS-1$ newXHTMLTagLibrariesWizardPage instanceof DefaultStandardStep); } } finally { dialog.close(); } }
From source file:org.locationtech.udig.catalog.ui.IDataWizard.java
License:Open Source License
@Override /**//from w w w .j ava 2s . c o m * Determines if there are any more pages in the sequence. * <p> * The wizard can finish if the following 3 properies hold. * <ol> * <li>The current page is complete (@see IWizardPage#isPageComplete()) * <li>The current page can not flip to the next page (@see IWizardPage#canFlipToNextPage()) * <li>There are no more primary pages. * </ol> * </p> * * @see org.eclipse.jface.wizard.IWizard#canFinish() */ public boolean canFinish() { // check if current page is complete IWizardPage page = getContainer().getCurrentPage(); if (!page.isPageComplete()) return false; // first as the page if it has more pages if (page.canFlipToNextPage()) { return false; } // find out if there is another primary page return getNextPrimaryPage(page) == null; }