List of usage examples for org.eclipse.jface.wizard IWizard getNextPage
IWizardPage getNextPage(IWizardPage page);
From source file:com.android.ide.eclipse.adt.internal.wizards.templates.InstallDependencyPage.java
License:Open Source License
private void showNextPage() { validatePage();//from w ww. j ava 2s .co m if (isPageComplete()) { // Finish button will be enabled now mInstallButton.setEnabled(false); mCheckButton.setEnabled(false); IWizard wizard = getWizard(); IWizardPage next = wizard.getNextPage(this); if (next != null) { wizard.getContainer().showPage(next); } } }
From source file:org.eclipse.cdt.ui.wizards.TemplateSelectionPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout(1, false)); templateTree = new TreeViewer(comp); templateTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); templateTree.setContentProvider(new ITreeContentProvider() { @Override/* w w w . ja v a 2 s .co m*/ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } @Override public void dispose() { } @Override public boolean hasChildren(Object element) { if (element instanceof Node) return !((Node) element).getChildren().isEmpty(); return false; } @Override public Object getParent(Object element) { if (element instanceof Node) return ((Node) element).getParent(); return null; } @Override public Object[] getElements(Object inputElement) { if (inputElement instanceof Node) return ((Node) inputElement).getChildren().toArray(); return null; } @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof Node) return ((Node) parentElement).getChildren().toArray(); return null; } }); templateTree.setLabelProvider(new ILabelProvider() { @Override public void removeListener(ILabelProviderListener listener) { } @Override public boolean isLabelProperty(Object element, String property) { return false; } @Override public void dispose() { } @Override public void addListener(ILabelProviderListener listener) { } @Override public String getText(Object element) { if (element instanceof Node) { Object object = ((Node) element).getObject(); if (object instanceof TemplateCategory) return ((TemplateCategory) object).getLabel(); else if (object instanceof Template) return ((Template) object).getLabel(); } return element.toString(); } @Override public Image getImage(Object element) { return null; } }); templateTree.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { selectedTemplate = null; nextPage = null; IStructuredSelection selection = (IStructuredSelection) templateTree.getSelection(); Object selObj = selection.getFirstElement(); if (selObj instanceof Node) { Object object = ((Node) selObj).getObject(); if (object instanceof Template) { IWizard wizard = getWizard(); selectedTemplate = (Template) object; // Get the template pages IWizardPage[] templatePages = selectedTemplate.getTemplateWizardPages( TemplateSelectionPage.this, wizard.getNextPage(TemplateSelectionPage.this), wizard); if (templatePages != null && templatePages.length > 0) nextPage = templatePages[0]; String projectType = selectedTemplate.getTemplateInfo().getProjectType(); ProjectTypePage projectTypePage = getProjectTypePage(projectType); if (projectTypePage != null) { if (projectTypePage.init(selectedTemplate, wizard, nextPage)) nextPage = projectTypePage; } setPageComplete(true); } else { setPageComplete(false); } } else { setPageComplete(false); } } }); buildTree(); templateTree.setInput(tree); setControl(comp); }
From source file:org.eclipse.ice.client.common.wizards.ImportItemWizardPage.java
License:Open Source License
/** * Override the default behavior to add a <code>ListViewer</code> with the * available item types./*w w w . j av a 2 s . c om*/ */ @Override public void createControl(Composite parent) { // Get the client. IClient client = null; try { client = IClient.getClient(); } catch (CoreException e) { logger.error("Error getting IClient instance", e); } if (client != null) { // Get the list of available Items from the client final ArrayList<String> itemTypes = client.getAvailableItemTypes(); // Sort the list so that items are displayed lexographically. Collections.sort(itemTypes); // Create the Text and browse Button. super.createControl(parent); if (parent != null) { GridData gridData; // Create a label for the Project Combo Label label = new Label(wizardPageComposite, SWT.NONE); label.setText("Please select the Project where this Item should be created"); // Create the Combo projectCombo = new Combo(wizardPageComposite, SWT.READ_ONLY); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.horizontalSpan = 2; projectCombo.setLayoutData(gridData); // Get a list of all Project Names ArrayList<String> projectNames = new ArrayList<String>(); for (IProject p : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { projectNames.add(p.getName()); } // Set the possible projectCombo.setItems(projectNames.toArray(new String[projectNames.size()])); if (selectedProject != null) { projectCombo.select(projectNames.indexOf(selectedProject)); } else { projectCombo.select(0); } // Create a label above the list. label = new Label(wizardPageComposite, SWT.NONE); label.setText("Please select an Item that this file represents"); gridData = new GridData(SWT.LEFT, SWT.END, false, false); gridData.horizontalSpan = 2; label.setLayoutData(gridData); // Create the list. ListViewer itemList = new ListViewer(wizardPageComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.horizontalSpan = 2; itemList.getControl().setLayoutData(gridData); // Add the label provider for the list viewer itemList.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return (String) element; } }); // Add the content provider for the list viewer itemList.setContentProvider(new IStructuredContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // Nothing to do } @Override public void dispose() { // Nothing to do } @Override public Object[] getElements(Object inputElement) { return ((ArrayList<?>) inputElement).toArray(); } }); // Create the selection listener itemList.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { // Get and store the selection String selection = (String) ((IStructuredSelection) event.getSelection()).getFirstElement(); if (selection != null) { selectedItemType = selection; } // Validate the file and Item selection to enable // the finish button ImportItemWizardPage.this.setPageComplete(checkSelection()); } }); // Set the input to the list from the client itemList.setInput(itemTypes); // Add a double-click listener to the ListViewer. If the file // was already selected, then a double-click can advance or // finish the wizard. itemList.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { // If the page is complete, we can try to finish the // wizard. if (isPageComplete()) { // Get the wizard and its container. IWizard wizard = getWizard(); IWizardContainer container = wizard.getContainer(); // If the container is a WizardDialog, we can try to // finish the wizard and close the dialog. if (container instanceof WizardDialog) { if (wizard.performFinish()) { ((WizardDialog) container).close(); } } // Otherwise, we can try to advance to the next page // if one exists. else { // Get the next page. IWizardPage nextPage = wizard.getNextPage(ImportItemWizardPage.this); // If it exists, move to it. if (nextPage != null) { container.showPage(nextPage); } } } return; } }); // Force the parent Composite to repaint. parent.layout(); } } else { MessageBox errorMessage = new MessageBox(parent.getShell(), ERROR); errorMessage.setMessage("The ICE Client is not available. " + "Please file a bug report."); } return; }
From source file:org.eclipse.ice.client.common.wizards.NewItemWizardPage.java
License:Open Source License
/** * This operation draws the wizard on the screen. * * @param itemSelectionComposite/*from w w w. j a v a 2s. c o m*/ * The composite that should hold the contents of the wizard * @param client * The ICE Client */ private void drawWizard(Composite itemSelectionComposite, IClient client) { // Get the list of available Items from the client final List<String> itemTypeList = client.getAvailableItemTypes(); // Sort the list so that items are displayed lexographically. Collections.sort(itemTypeList); // Create the item selection label Label itemLabel = new Label(itemSelectionComposite, SWT.NONE); itemLabel.setText("Please select an Item type."); // Add the list for selecting an Item ListViewer itemListViewer = new ListViewer(itemSelectionComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); // Set the layout data so that it fills the space GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); itemListViewer.getControl().setLayoutData(data); // Add the label provider for the list viewer itemListViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return (String) element; } }); // Add the content provider for the list viewer itemListViewer.setContentProvider(new IStructuredContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // Nothing to do } @Override public void dispose() { // Nothing to do } @Override public Object[] getElements(Object inputElement) { return ((List<?>) inputElement).toArray(); } }); // Create the selection listener itemListViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { // Get and store the selection String selection = (String) ((IStructuredSelection) event.getSelection()).getFirstElement(); if (selection != null) { selectedItemType = selection; } // Validate the file and Item selection to enable // the finish button NewItemWizardPage.this.setPageComplete(checkSelection()); } }); // Set the input to the list from the client itemListViewer.setInput(itemTypeList); // Add a double-click listener to the ListViewer. If the file was // already selected, then a double-click can advance or finish the // wizard. itemListViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { // If the page is complete, we can try to finish the wizard. if (isPageComplete()) { // Get the wizard and its container. IWizard wizard = getWizard(); IWizardContainer container = wizard.getContainer(); // If the container is a WizardDialog, we can try to // finish the wizard and close the dialog. if (container instanceof WizardDialog) { if (wizard.performFinish()) { ((WizardDialog) container).close(); } } // Otherwise, we can try to advance to the next page if // one exists. else { // Get the next page. IWizardPage nextPage = wizard.getNextPage(NewItemWizardPage.this); // If it exists, move to it. if (nextPage != null) { container.showPage(nextPage); } } } return; } }); }
From source file:org.eclipse.ice.client.widgets.wizards.ImportItemWizardPage.java
License:Open Source License
/** * Override the default behavior to add a <code>ListViewer</code> with the * available item types.// ww w. j av a 2 s .c om */ @Override public void createControl(Composite parent) { // Get the client. IClient client = ClientHolder.getClient(); if (client != null) { // Get the list of available Items from the client final ArrayList<String> itemTypes = client.getAvailableItemTypes(); // Sort the list so that items are displayed lexographically. Collections.sort(itemTypes); // Create the Text and browse Button. super.createControl(parent); if (parent != null) { GridData gridData; // Create a label above the list. Label label = new Label(wizardPageComposite, SWT.NONE); label.setText("Please select an item that this file represents"); gridData = new GridData(SWT.LEFT, SWT.END, false, false); gridData.horizontalSpan = 2; label.setLayoutData(gridData); // Create the list. ListViewer itemList = new ListViewer(wizardPageComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.horizontalSpan = 2; itemList.getControl().setLayoutData(gridData); // Add the label provider for the list viewer itemList.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return (String) element; } }); // Add the content provider for the list viewer itemList.setContentProvider(new IStructuredContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // Nothing to do } @Override public void dispose() { // Nothing to do } @Override public Object[] getElements(Object inputElement) { return ((ArrayList<?>) inputElement).toArray(); } }); // Create the selection listener itemList.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { // Get and store the selection String selection = (String) ((IStructuredSelection) event.getSelection()).getFirstElement(); if (selection != null) { selectedItemType = selection; } // Validate the file and Item selection to enable // the finish button ImportItemWizardPage.this.setPageComplete(checkSelection()); } }); // Set the input to the list from the client itemList.setInput(itemTypes); // Add a double-click listener to the ListViewer. If the file // was already selected, then a double-click can advance or // finish the wizard. itemList.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { // If the page is complete, we can try to finish the // wizard. if (isPageComplete()) { // Get the wizard and its container. IWizard wizard = getWizard(); IWizardContainer container = wizard.getContainer(); // If the container is a WizardDialog, we can try to // finish the wizard and close the dialog. if (container instanceof WizardDialog) { if (wizard.performFinish()) { ((WizardDialog) container).close(); } } // Otherwise, we can try to advance to the next page // if one exists. else { // Get the next page. IWizardPage nextPage = wizard.getNextPage(ImportItemWizardPage.this); // If it exists, move to it. if (nextPage != null) { container.showPage(nextPage); } } } return; } }); // Force the parent Composite to repaint. parent.layout(); } } else { MessageBox errorMessage = new MessageBox(parent.getShell(), ERROR); errorMessage.setMessage("The ICE Client is not available. " + "Please file a bug report."); } return; }
From source file:org.eclipse.ice.client.widgets.wizards.NewItemWizardPage.java
License:Open Source License
/** * This operation creates the view that shows the list of Items that can be * created by the user.//w w w .j av a 2 s. c o m */ @Override public void createControl(Composite parent) { // Set the parent reference parentComposite = parent; // Get the client IClient client = ClientHolder.getClient(); // Only create the wizard if the client is available if (client != null) { // Create the composite for file selection pieces Composite itemSelectionComposite = new Composite(parentComposite, SWT.NONE); // Set its layout GridLayout layout = new GridLayout(1, true); itemSelectionComposite.setLayout(layout); // Set its layout data GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); itemSelectionComposite.setLayoutData(data); // Get the list of available Items from the client final List<String> itemTypeList = client.getAvailableItemTypes(); // Sort the list so that items are displayed lexographically. Collections.sort(itemTypeList); // Create the item selection label Label itemLabel = new Label(itemSelectionComposite, SWT.NONE); itemLabel.setText("Please select an Item type."); // Add the list for selecting an Item ListViewer itemListViewer = new ListViewer(itemSelectionComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); // Set the layout data so that it fills the space data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); itemListViewer.getControl().setLayoutData(data); // Add the label provider for the list viewer itemListViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { return (String) element; } }); // Add the content provider for the list viewer itemListViewer.setContentProvider(new IStructuredContentProvider() { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // Nothing to do } public void dispose() { // Nothing to do } public Object[] getElements(Object inputElement) { return ((List<?>) inputElement).toArray(); } }); // Create the selection listener itemListViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { // Get and store the selection String selection = (String) ((IStructuredSelection) event.getSelection()).getFirstElement(); if (selection != null) { selectedItemType = selection; } // Validate the file and Item selection to enable // the finish button NewItemWizardPage.this.setPageComplete(checkSelection()); } }); // Set the input to the list from the client itemListViewer.setInput(itemTypeList); // Add a double-click listener to the ListViewer. If the file was // already selected, then a double-click can advance or finish the // wizard. itemListViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { // If the page is complete, we can try to finish the wizard. if (isPageComplete()) { // Get the wizard and its container. IWizard wizard = getWizard(); IWizardContainer container = wizard.getContainer(); // If the container is a WizardDialog, we can try to // finish the wizard and close the dialog. if (container instanceof WizardDialog) { if (wizard.performFinish()) { ((WizardDialog) container).close(); } } // Otherwise, we can try to advance to the next page if // one exists. else { // Get the next page. IWizardPage nextPage = wizard.getNextPage(NewItemWizardPage.this); // If it exists, move to it. if (nextPage != null) { container.showPage(nextPage); } } } return; } }); // Set the control setControl(itemSelectionComposite); // Disable the finished condition to start setPageComplete(false); // Otherwise throw an error } else { MessageBox errorMessage = new MessageBox(parent.getShell(), ERROR); errorMessage.setMessage("The ICE Client is not available. " + "Please file a bug report."); } return; }
From source file:org.eclipse.team.svn.ui.wizard.selectresource.SelectSimpleRepositoryLocationPage.java
License:Open Source License
protected Composite createControlImpl(Composite parent) { GridLayout layout = null;/*from w ww .j a v a2s.c om*/ GridData data = null; this.initializeDialogUnits(parent); Composite composite = new Composite(parent, SWT.NONE); layout = new GridLayout(); composite.setLayout(layout); data = new GridData(GridData.FILL_BOTH); composite.setLayoutData(data); Label description = new Label(composite, SWT.WRAP); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; data.heightHint = this.convertHeightInCharsToPixels(2); description.setLayoutData(data); description.setText(SVNUIMessages.SelectSimpleRepositoryLocationPage_Details); this.repositoriesView = SelectRepositoryLocationPage.createRepositoriesListTable(composite, this.repositories); this.repositoriesView.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IWizard wizard = SelectSimpleRepositoryLocationPage.this.getWizard(); IWizardPage nextPage = wizard.getNextPage(SelectSimpleRepositoryLocationPage.this); if (nextPage != null) { wizard.getContainer().showPage(nextPage); } } }); this.repositoriesView.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) SelectSimpleRepositoryLocationPage.this.repositoriesView .getSelection(); SelectSimpleRepositoryLocationPage.this.location = (IRepositoryLocation) selection .getFirstElement(); SelectSimpleRepositoryLocationPage.this.setPageComplete(true); } }); IStructuredSelection selection = (IStructuredSelection) this.repositoriesView.getSelection(); this.location = (IRepositoryLocation) selection.getFirstElement(); //Setting context help PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, "org.eclipse.team.svn.help.selectRepositoryLocationContext"); //$NON-NLS-1$ return composite; }
From source file:org.eclipse.team.svn.ui.wizard.shareproject.SelectRepositoryLocationPage.java
License:Open Source License
protected Composite createControlImpl(Composite parent) { GridLayout layout = null;//from w ww . java2 s. c o m GridData data = null; this.initializeDialogUnits(parent); Composite composite = new Composite(parent, SWT.NONE); layout = new GridLayout(); composite.setLayout(layout); data = new GridData(GridData.FILL_BOTH); composite.setLayoutData(data); Label description = new Label(composite, SWT.WRAP); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; data.heightHint = this.convertHeightInCharsToPixels(2); description.setLayoutData(data); description.setText(SVNUIMessages.getString("SelectRepositoryLocationPage_Hint" //$NON-NLS-1$ + SelectRepositoryLocationPage.getNationalizationSuffix(this.importProject))); Button addLocationButton = new Button(composite, SWT.RADIO); data = new GridData(GridData.FILL_HORIZONTAL); addLocationButton.setText(SVNUIMessages.SelectRepositoryLocationPage_AddLocation); addLocationButton.setSelection(false); Button useExistingLocationButton = new Button(composite, SWT.RADIO); data = new GridData(GridData.FILL_HORIZONTAL); useExistingLocationButton.setLayoutData(data); useExistingLocationButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Button button = (Button) e.widget; SelectRepositoryLocationPage.this.repositoriesView.getTable() .setEnabled(SelectRepositoryLocationPage.this.useExistingLocation = button.getSelection()); SelectRepositoryLocationPage.this.setPageComplete(true); } }); useExistingLocationButton.setText(SVNUIMessages.SelectRepositoryLocationPage_UseLocation); useExistingLocationButton.setSelection(true); this.repositoriesView = SelectRepositoryLocationPage.createRepositoriesListTable(composite, this.repositories); this.repositoriesView.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IWizard wizard = SelectRepositoryLocationPage.this.getWizard(); IWizardPage nextPage = wizard.getNextPage(SelectRepositoryLocationPage.this); if (nextPage != null) { wizard.getContainer().showPage(nextPage); } } }); this.repositoriesView.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) SelectRepositoryLocationPage.this.repositoriesView .getSelection(); SelectRepositoryLocationPage.this.location = (IRepositoryLocation) selection.getFirstElement(); SelectRepositoryLocationPage.this.setPageComplete(true); } }); IStructuredSelection selection = (IStructuredSelection) this.repositoriesView.getSelection(); this.location = (IRepositoryLocation) selection.getFirstElement(); //Setting context help PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, "org.eclipse.team.svn.help.reposLocationContext"); //$NON-NLS-1$ return composite; }
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. jav a 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.nightlabs.base.ui.wizard.WizardHop.java
License:Open Source License
public IWizardPage getNextPage(IWizardPage currentPage) { IWizard wizard = getWizard(); if (wizard == null) return null; if (currentPage == entryPage) { if (hopPages.isEmpty()) { if (getParentHop() != null) { return getParentHop().getNextPage(currentPage); }/*from ww w .j a v a 2 s .co m*/ return wizard.getNextPage(entryPage); } return hopPages.get(0); } int currIdx = hopPages.indexOf(currentPage); int nextIdx = -1; if (currIdx >= 0) nextIdx = currIdx + 1; if (nextIdx >= 0) { if (nextIdx < hopPages.size()) return hopPages.get(nextIdx); if (exitPage != null) return exitPage; if (getParentHop() != null) return getParentHop().getNextPage(entryPage); } // find out the first entry page of the current branch of hops, which is // known to the wizard. IWizardHopPage firstEntryPage = entryPage; while (firstEntryPage.getWizardHop().getParentHop() != null) { firstEntryPage = firstEntryPage.getWizardHop().getParentHop().getEntryPage(); } return wizard.getNextPage(firstEntryPage); }