use of org.eclipse.vorto.wizard.AbstractProjectWizardPage in project vorto by eclipse.
the class AbstractProjectSelectionViewPart method createProjectSelectionViewer.
private ComboViewer createProjectSelectionViewer(final Composite container, String labelStr) {
Button newProjectButton = new Button(container, SWT.NONE);
newProjectButton.setImage(ImageUtil.getImage("add_obj.gif"));
newProjectButton.setToolTipText(getAddToolTipText());
newProjectButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
switch(e.type) {
case SWT.Selection:
WizardDialog wizardDialog = new WizardDialog(container.getShell(), getProjectWizard());
if (wizardDialog.open() == Window.OK) {
projectSelectionViewer.setInput(getModelProjects());
AbstractProjectWizardPage page = (AbstractProjectWizardPage) wizardDialog.getCurrentPage();
IModelProject project = getModelProjectFromName(page.getProjName());
selectedProject = project;
projectSelectionViewer.setSelection(new StructuredSelection(project), true);
}
break;
default:
}
}
});
FormData buttonFormdata = new FormData();
buttonFormdata.top = new FormAttachment(0, 0);
buttonFormdata.right = new FormAttachment(100, 0);
newProjectButton.setLayoutData(buttonFormdata);
Button deleteButton = new Button(container, SWT.NONE);
deleteButton.setImage(ImageUtil.getImage("delete.gif"));
deleteButton.setToolTipText(getDeleteToolTipText());
deleteButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
switch(e.type) {
case SWT.Selection:
if (selectedProject != null) {
if (!Display.getDefault().isDisposed()) {
Display.getDefault().syncExec(newDeleteProjectRunnable(selectedProject));
}
}
break;
default:
}
}
});
FormData deleteButtonFormdata = new FormData();
deleteButtonFormdata.top = new FormAttachment(0, 0);
deleteButtonFormdata.right = new FormAttachment(newProjectButton, -10);
deleteButton.setLayoutData(deleteButtonFormdata);
ComboViewer comboViewer = new ComboViewer(container, SWT.READ_ONLY);
Combo combo = comboViewer.getCombo();
FormData viewerFormData = new FormData();
viewerFormData.top = new FormAttachment(newProjectButton, 10);
viewerFormData.left = new FormAttachment(0, 0);
viewerFormData.right = new FormAttachment(100, 0);
combo.setLayoutData(viewerFormData);
Label label = new Label(container, SWT.NONE);
label.setText(labelStr);
FormData labelFormData = new FormData();
labelFormData.bottom = new FormAttachment(comboViewer.getCombo(), -10);
labelFormData.left = new FormAttachment(0, 0);
label.setLayoutData(labelFormData);
return comboViewer;
}
Aggregations