List of usage examples for org.eclipse.jface.wizard WizardPage WizardPage
protected WizardPage(String pageName)
From source file:de.ovgu.cide.export.xml.ExportXMLWizard.java
License:Open Source License
@Override public void addPages() { super.addPages(); addPage(new WizardPage("Note") { public void createControl(Composite parent) { Label label = new Label(parent, SWT.NONE); label.setText("Creates XML files containing all annotations inside the source project."); setControl(label);// w w w . j a va 2 s . c o m } }); }
From source file:eu.numberfour.n4js.ui.workingsets.WorkingSetManualAssociationWizard.java
License:Open Source License
@Override public void addPages() { addPage(new WizardPage("") { private Text nameText; private final Collection<IProject> workspaceProjects = newTreeSet(PROJECT_NAME_COMPARATOR); private final Collection<IProject> workingSetProjects = newTreeSet(PROJECT_NAME_COMPARATOR); @Override/*from w ww. ja v a 2 s .co m*/ public void createControl(Composite parent) { final Composite composite = new Composite(parent, NONE); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).create()); composite.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create()); new Label(composite, NONE).setText("Working set name:"); nameText = new Text(composite, BORDER); nameText.setLayoutData(fillDefaults().align(FILL, CENTER).grab(true, false).create()); Composite tableComposite = new Composite(composite, NONE); tableComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).create()); tableComposite.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).span(2, 1).create()); Group workspaceGroup = new Group(tableComposite, SHADOW_IN); workspaceGroup.setText("Available workspace projects"); workspaceGroup.setLayout(GridLayoutFactory.fillDefaults().create()); workspaceGroup.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create()); final TableViewer allProjectsViewer = new TableViewerBuilder(singletonList("")).setHasBorder(true) .setHeaderVisible(false).setLinesVisible(false).setMultipleSelection(true) .setColumnWidthsInPixel(Ints.asList(350)).setLabelProvider(labelProvider) .build(workspaceGroup); Composite buttonComposite = new Composite(tableComposite, NONE); buttonComposite.setLayout(GridLayoutFactory.fillDefaults().create()); // buttonComposite.setLayoutData(fillDefaults().align(CENTER, CENTER).grab(false, false).create()); final Button addButton = new Button(buttonComposite, PUSH); addButton.setImage(ImageRef.RIGHT_ARROW.asImage().orNull()); addButton.setToolTipText("Add all selected workspace projects"); addButton.setEnabled(false); final Button removeButton = new Button(buttonComposite, PUSH); removeButton.setImage(ImageRef.LEFT_ARROW.asImage().orNull()); removeButton.setToolTipText("Remove all selected working set element projects"); removeButton.setEnabled(false); Group workingSetGroup = new Group(tableComposite, SHADOW_IN); workingSetGroup.setText("Associated working set projects"); workingSetGroup.setLayout(GridLayoutFactory.fillDefaults().create()); workingSetGroup.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create()); final TableViewer associatedProjectsViewer = new TableViewerBuilder(singletonList("")) .setHasBorder(true).setHeaderVisible(false).setLinesVisible(false) .setMultipleSelection(true).setColumnWidthsInPixel(Ints.asList(350)) .setLabelProvider(labelProvider).build(workingSetGroup); addButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = allProjectsViewer.getStructuredSelection(); if (selection != null && !selection.isEmpty()) { final IProject[] projects = Arrays2.filter(selection.toArray(), IProject.class); allProjectsViewer.remove(projects); associatedProjectsViewer.add(projects); workspaceProjects.removeAll(Arrays.asList(projects)); workingSetProjects.addAll(Arrays.asList(projects)); setPageComplete(validatePage()); } } }); removeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = associatedProjectsViewer.getStructuredSelection(); if (selection != null && !selection.isEmpty()) { final IProject[] projects = Arrays2.filter(selection.toArray(), IProject.class); associatedProjectsViewer.remove(projects); allProjectsViewer.add(projects); workingSetProjects.removeAll(Arrays.asList(projects)); workspaceProjects.addAll(Arrays.asList(projects)); setPageComplete(validatePage()); } } }); associatedProjectsViewer.addSelectionChangedListener(event -> { final IStructuredSelection selection = associatedProjectsViewer.getStructuredSelection(); removeButton.setEnabled(null != selection && !selection.isEmpty()); }); allProjectsViewer.addSelectionChangedListener(event -> { final IStructuredSelection selection = allProjectsViewer.getStructuredSelection(); addButton.setEnabled(null != selection && !selection.isEmpty()); }); setPageComplete(false); setControl(composite); final Optional<WorkingSet> editedWorkingSet = getEditedWorkingSet(); workspaceProjects.addAll(Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects())); if (editedWorkingSet.isPresent()) { final ManualAssociationWorkingSet workingSet = (ManualAssociationWorkingSet) editedWorkingSet .get(); workingSetRef.set(workingSet); nameText.setText(workingSet.getName()); nameText.selectAll(); workingSetProjects.addAll(workingSet.getAssociatedProjects()); workspaceProjects.removeAll(workingSetProjects); originalName.set(workingSet.getName()); } composite.getDisplay().asyncExec(() -> { setTitle(TITLE); setDescription(DESCRIPTION); allProjectsViewer.setInput(workspaceProjects); associatedProjectsViewer.setInput(workingSetProjects); }); nameText.addModifyListener(e -> setPageComplete(validatePage())); } @Override public void setVisible(boolean visible) { if (visible) { Rectangle location = UIUtils.getConstrainedShellBounds(getShell(), SHELL_SIZE); getShell().setBounds(location); } super.setVisible(visible); } @SuppressWarnings("null") private boolean validatePage() { String errorMessage = null; final String name = nameText.getText(); final WorkingSetManager manager = getManager(); if (manager == null) { errorMessage = "No active working set manager is available."; } if (errorMessage == null) { if (name == null || name.trim().length() == 0) { errorMessage = "Working set name should be specified."; } } if (errorMessage == null) { if (!name.equals(originalName.get()) // This case ID and name are equal. Intentionally name. && Arrays2.transform(manager.getAllWorkingSets(), ws -> ws.getName()).contains(name)) { errorMessage = "A working set already exists with name '" + name + "'."; } } if (errorMessage != null) { workingSetRef.set(null); } else { final Iterable<String> projectNames = from(workingSetProjects).transform(p -> p.getName()); workingSetRef.set(new ManualAssociationWorkingSet(projectNames, name, manager)); } setMessage(errorMessage, ERROR); return errorMessage == null; } }); }
From source file:eu.numberfour.n4js.ui.workingsets.WorkingSetProjectNameFilterWizard.java
License:Open Source License
@Override public void addPages() { addPage(new WizardPage("") { private Text nameText; private Text filterText; @Override/*from w w w . j a va2 s . c o m*/ public void createControl(final Composite parent) { final Composite composite = new Composite(parent, NONE); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).create()); composite.setLayoutData(GridDataFactory.fillDefaults().align(FILL, FILL).grab(true, true).create()); new Label(composite, NONE).setText("Working set name:"); nameText = new Text(composite, BORDER); nameText.setLayoutData( GridDataFactory.fillDefaults().align(FILL, CENTER).grab(true, false).create()); new Label(composite, NONE).setText("Project name filter:"); filterText = new Text(composite, BORDER); filterText.setLayoutData( GridDataFactory.fillDefaults().align(FILL, CENTER).grab(true, false).create()); setPageComplete(false); setControl(composite); composite.getDisplay().asyncExec(() -> { setTitle(TITLE); setDescription(DESCRIPTION); }); final Optional<WorkingSet> editedWorkingSet = getEditedWorkingSet(); if (editedWorkingSet.isPresent()) { final ProjectNameFilterWorkingSet workingSet = (ProjectNameFilterWorkingSet) editedWorkingSet .get(); workingSetRef.set(workingSet); nameText.setText(workingSet.getName()); filterText.setText(workingSet.getFilter().pattern()); nameText.selectAll(); originalName.set(workingSet.getName()); } nameText.addModifyListener(e -> setPageComplete(validatePage())); filterText.addModifyListener(e -> setPageComplete(validatePage())); } @SuppressWarnings("null") private boolean validatePage() { String errorMessage = null; final String name = nameText.getText(); final String filter = filterText.getText(); final WorkingSetManager manager = getManager(); if (manager == null) { errorMessage = "No active working set manager is available."; } if (errorMessage == null) { if (name == null || name.trim().length() == 0) { errorMessage = "Working set name should be specified."; } } if (errorMessage == null) { if (!name.equals(originalName.get()) // This case ID and name are equal. Intentionally name. && Arrays2.transform(manager.getAllWorkingSets(), ws -> ws.getName()).contains(name)) { errorMessage = "A working set already exists with name '" + name + "'."; } } if (errorMessage == null) { if (filter == null || filter.trim().length() == 0) { errorMessage = "Project name filter should be specified."; } } Pattern pattern = null; if (errorMessage == null) { try { pattern = Pattern.compile(filter); } catch (final PatternSyntaxException e) { errorMessage = "Invalid project name filter. " + e.getDescription() + "."; } } if (errorMessage != null || pattern == null) { workingSetRef.set(null); } else { workingSetRef.set(new ProjectNameFilterWorkingSet(pattern, name, manager)); } setMessage(errorMessage, ERROR); return errorMessage == null; } }); }
From source file:net.enilink.komma.edit.ui.wizards.RefactorMoveWizard.java
License:Open Source License
protected void createPages() { selectModelPage = new WizardPage("Select Target Model") { @Override/*from www . ja va 2s . co m*/ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); Label label = new Label(composite, SWT.NONE); label.setText("Select target model:"); final Combo combo = new Combo(composite, SWT.DROP_DOWN); final ComboViewer cViewer = new ComboViewer(combo); cViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { targetModel = (IModel) cViewer.getElementAt(combo.getSelectionIndex()); setPageComplete(true); } }); // get potential target models from list of active editors IEditorReference[] openEditors = workbench.getActiveWorkbenchWindow().getActivePage() .getEditorReferences(); for (IEditorReference ref : openEditors) { IEditorPart editor = ref.getEditor(true); if (editor != null && editor != workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor()) { IModel model = (IModel) editor.getAdapter(IModel.class); if (model != null) { cViewer.add(model); } } } final Button keepNamespaceButton = new Button(composite, SWT.CHECK); keepNamespaceButton.setSelection(keepNamespace); keepNamespaceButton.setText("Keep namespaces"); keepNamespaceButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { keepNamespace = keepNamespaceButton.getSelection(); } }); setDescription("Select the target model from the list of open editors."); setControl(composite); setPageComplete(false); } }; showPreviewPage = new RefactorPreviewPage("Preview") { @Override public Collection<Change> collectChanges() { changes = new RefactoringProcessor(domain).createMoveChanges(currentSelection.toList(), targetModel, keepNamespace); return changes; } }; }
From source file:net.enilink.komma.edit.ui.wizards.RefactorRenameWizard.java
License:Open Source License
protected void createPages() { configureRenamesPage = new WizardPage("Configure the new URIs to use.") { @Override/* w ww . java 2 s. c o m*/ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); // nested composite for "one namespace to rule them all" Composite nsComposite = new Composite(composite, SWT.NONE); GridLayout ncLayout = new GridLayout(2, false); ncLayout.marginHeight = 0; ncLayout.marginWidth = 0; nsComposite.setLayout(ncLayout); // toggle button for generic or individual renaming final Button useSameButton = new Button(nsComposite, SWT.CHECK); useSameButton.setSelection(false); useSameButton.setText("Move all elements into this namespace:"); // FIXME: add validation (URI) for text input field final Text namespace = new Text(nsComposite, SWT.BORDER); namespace.setLayoutData(new GridData(300, SWT.DEFAULT)); namespace.setEnabled(useSameButton.getSelection()); // the table viewer for the rename-mappings final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); tableViewer.getTable().setEnabled(!useSameButton.getSelection()); tableViewer.getTable().setHeaderVisible(true); tableViewer.getTable().setLinesVisible(true); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.LEFT); column.getColumn().setText("Current URI"); column.getColumn().setWidth(300); column.setLabelProvider(new TableLabelProvider(TableLabelProvider.ColumnType.BEFORE)); column = new TableViewerColumn(tableViewer, SWT.LEFT); column.getColumn().setText("New URI"); column.getColumn().setWidth(300); column.setLabelProvider(new TableLabelProvider(TableLabelProvider.ColumnType.AFTER)); // FIXME: add validation (URI) for text input field final CellEditor cellEditor = new TextCellEditor((Composite) tableViewer.getControl()); column.setEditingSupport(new EditingSupport(tableViewer) { @Override protected CellEditor getCellEditor(Object element) { return cellEditor; } @Override protected boolean canEdit(Object element) { return (element instanceof Map.Entry); } @SuppressWarnings("rawtypes") @Override protected Object getValue(Object element) { if (element instanceof Map.Entry) { IReference value = (IReference) ((Map.Entry) element).getValue(); return value != null ? value.toString() : ""; } return ""; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override protected void setValue(Object element, Object value) { if (element instanceof Map.Entry) { if (!(value instanceof IReference)) { if (value.toString().isEmpty()) { value = null; } else { value = URIs.createURI(value.toString()); } } ((Map.Entry) element).setValue(value); tableViewer.refresh(element); } setPageComplete(!renameMap.values().contains(null)); getContainer().updateButtons(); } }); // button selection toggles text input and table viewer states useSameButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { namespace.setEnabled(useSameButton.getSelection()); tableViewer.getTable().setEnabled(!useSameButton.getSelection()); } }); // leaving the text input sets the namespace on all elements namespace.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { URI namespaceURI = URIs.createURI(namespace.getText()); for (Map.Entry<IObject, IReference> entry : renameMap.entrySet()) { entry.setValue(namespaceURI.appendFragment(entry.getKey().getURI().fragment())); } tableViewer.refresh(); setPageComplete(true); getContainer().updateButtons(); } }); tableViewer.setInput(renameMap.entrySet()); setDescription("Set the new URIs for your selected elements."); setControl(composite); setPageComplete(false); } }; showPreviewPage = new RefactorPreviewPage("Preview") { @Override public Collection<Change> collectChanges() { changes = new RefactoringProcessor(domain).createRenameChanges(renameMap); return changes; } }; }
From source file:net.sourceforge.eclipsetrader.core.ui.wizards.SecurityWizard.java
License:Open Source License
public WizardDialog create() { securityPage = new SecurityPage(); addPage(securityPage);/* ww w . ja va 2 s .c om*/ WizardPage page = new WizardPage("") { //$NON-NLS-1$ public void createControl(Composite parent) { setControl(quoteFeedOptions.createControls(parent)); } }; page.setTitle(Messages.SecurityWizard_QuoteFeedTitle); page.setDescription(Messages.SecurityWizard_QuoteFeedDescription); page.setPageComplete(true); addPage(page); page = new WizardPage("") { //$NON-NLS-1$ public void createControl(Composite parent) { setControl(level2FeedOptions.createControls(parent)); } }; page.setTitle(Messages.SecurityWizard_Level2FeedTitle); page.setDescription(Messages.SecurityWizard_Level2FeedDescription); page.setPageComplete(true); addPage(page); page = new WizardPage("") { //$NON-NLS-1$ public void createControl(Composite parent) { setControl(historyFeedOptions.createControls(parent)); } }; page.setTitle(Messages.SecurityWizard_HistoryFeedTitle); page.setDescription(Messages.SecurityWizard_HistoryFeedDescription); page.setPageComplete(true); addPage(page); page = new WizardPage("") { //$NON-NLS-1$ public void createControl(Composite parent) { setControl(tradeSourceOptions.createControls(parent, null)); } }; page.setTitle(Messages.SecurityWizard_TradeSourceTitle); page.setDescription(Messages.SecurityWizard_TradeSourceDescription); addPage(page); page = new WizardPage("") { //$NON-NLS-1$ public void createControl(Composite parent) { setControl(intradayOptions.createControls(parent, null)); } }; page.setTitle(Messages.SecurityWizard_IntradayChartsTitle); page.setDescription(Messages.SecurityWizard_IntradayChartsDescription); addPage(page); WizardDialog dlg = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), this); dlg.create(); return dlg; }
From source file:net.sourceforge.eclipsetrader.directaworld.wizards.SecurityWizard.java
License:Open Source License
public WizardDialog create() { securityPage = new SecurityPage(); addPage(securityPage);//from w ww. ja v a 2s . c om WizardPage page = new WizardPage("") { //$NON-NLS-1$ public void createControl(Composite parent) { setControl(options.createControls(parent, null)); } }; page.setTitle(Messages.SecurityWizard_IntradayChartsTitle); page.setDescription(Messages.SecurityWizard_IntradayChartsDescription); addPage(page); WizardDialog dlg = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), this); dlg.create(); return dlg; }
From source file:net.sourceforge.eclipsetrader.opentick.ui.wizards.SecurityWizard.java
License:Open Source License
private void addIntradayOptionsPage() { WizardPage page = new WizardPage("") { public void createControl(Composite parent) { setControl(options.createControls(parent, null)); }// w w w . j av a2 s . co m }; page.setTitle("Intraday Charts"); page.setDescription("Set the options to automatically build intraday charts"); addPage(page); }
From source file:net.sourceforge.eclipsetrader.yahoo.wizards.SecurityWizard.java
License:Open Source License
private void addIntradayOptionsPage() { WizardPage page = new WizardPage("") { //$NON-NLS-1$ public void createControl(Composite parent) { setControl(options.createControls(parent, null)); }/*ww w. java2s . c om*/ }; page.setTitle(Messages.SecurityWizard_IntradayChartsTitle); page.setDescription(Messages.SecurityWizard_IntradayChartsDescription); addPage(page); }
From source file:org.csstudio.opibuilder.examples.ImportWizard.java
License:Open Source License
@Override public void addPages() { super.addPages(); setWindowTitle("Import BOY Examples"); addPage(new WizardPage("BOY Examples") { public void createControl(Composite parent) { setTitle("Import BOY Examples"); setDescription("Import the OPI Examples come with BOY"); Composite container = new Composite(parent, SWT.None); container.setLayout(new GridLayout()); setControl(container);/*from w w w . jav a 2 s. c o m*/ Label label = new Label(container, SWT.WRAP); GridData gd = new GridData(); gd.widthHint = 500; label.setLayoutData(gd); label.setText("BOY Examples will be imported to your workspace. " + NLS.bind("If there is already a project named \"{0}\" in your workspace," + "the import will fail. ", InstallExamplesAction.PROJECT_NAME) + "Please rename or delete it and import again."); } }); }