use of org.eclipse.jface.wizard.WizardPage in project dbeaver by serge-rider.
the class AbstractToolWizard method createPageControls.
@Override
public void createPageControls(Composite pageContainer) {
super.createPageControls(pageContainer);
WizardPage currentPage = (WizardPage) getStartingPage();
String clientHomeId = connectionInfo.getClientHomeId();
if (clientHomeId == null) {
currentPage.setErrorMessage(CoreMessages.tools_wizard_message_no_client_home);
getContainer().updateMessage();
return;
}
//MySQLDataSourceProvider.getServerHome(clientHomeId);
clientHome = findServerHome(clientHomeId);
if (clientHome == null) {
currentPage.setErrorMessage(NLS.bind(CoreMessages.tools_wizard_message_client_home_not_found, clientHomeId));
getContainer().updateMessage();
}
}
use of org.eclipse.jface.wizard.WizardPage in project yamcs-studio by yamcs.
the class ImportOPIExamplesWizard method addPages.
@Override
public void addPages() {
super.addPages();
setWindowTitle("Install OPI Examples");
addPage(new WizardPage("OPI Examples") {
@Override
public void createControl(Composite parent) {
setTitle("Install OPI Examples");
setDescription("Creates a new project with sample OPI displays");
Composite container = new Composite(parent, SWT.None);
container.setLayout(new GridLayout());
setControl(container);
Label label = new Label(container, SWT.WRAP);
GridData gd = new GridData();
gd.widthHint = 500;
label.setLayoutData(gd);
label.setText("OPI Examples will be imported to your workspace. " + NLS.bind("If there is already a project named \"{0}\" in your workspace," + "the import will fail. ", InstallOPIExamplesAction.PROJECT_NAME) + "Please rename or delete it and import again.");
}
});
}
use of org.eclipse.jface.wizard.WizardPage in project dbeaver by dbeaver.
the class AbstractToolWizard method createPageControls.
@Override
public void createPageControls(Composite pageContainer) {
super.createPageControls(pageContainer);
WizardPage currentPage = (WizardPage) getStartingPage();
if (clientHomeRequired) {
String clientHomeId = connectionInfo.getClientHomeId();
if (clientHomeId == null) {
currentPage.setErrorMessage(CoreMessages.tools_wizard_message_no_client_home);
getContainer().updateMessage();
return;
}
// MySQLDataSourceProvider.getServerHome(clientHomeId);
clientHome = findServerHome(clientHomeId);
if (clientHome == null) {
currentPage.setErrorMessage(NLS.bind(CoreMessages.tools_wizard_message_client_home_not_found, clientHomeId));
getContainer().updateMessage();
}
}
}
use of org.eclipse.jface.wizard.WizardPage in project n4js by eclipse.
the class WorkingSetManualAssociationWizard method addPages.
@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
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.
getAllWorkingSets().stream().anyMatch(ws -> ws.getName().equals(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;
}
});
}
use of org.eclipse.jface.wizard.WizardPage in project ecf by eclipse.
the class RemoteServiceConsumerExample1Template method addPages.
public void addPages(Wizard wizard) {
WizardPage page = createPage(0, "org.eclipse.pde.doc.user.rcp_mail");
page.setTitle("Hello Remote Service Consumer");
page.setDescription("This template creates a Hello remote service consumer");
wizard.addPage(page);
markPagesAdded();
}
Aggregations