Button browseProject = new Button(projectGroup, SWT.NONE);
browseProject.setText("Browse ...");
browseProject.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ILabelProvider labelProvider = new WorkbenchLabelProvider();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
labelProvider);
dialog.setTitle("Project Selection");
dialog.setMessage("Select a project");
dialog.setElements(getWorkspaceRoot().getProjects());
IProject project = getSelectedProject();
if (project != null) {
dialog.setInitialSelections(new Object[] { project });
}
if (dialog.open() == Window.OK) {
IProject selectedProject = (IProject) dialog.getFirstResult();
projectText.setText(selectedProject.getName());
}
}
});
// Descriptor Group
Group descriptorGroup = new Group(projectComposite, SWT.None);
descriptorGroup.setText("Descriptor:");
GridData descriptorGroupData = new GridData();
descriptorGroupData.grabExcessHorizontalSpace = true;
descriptorGroupData.horizontalAlignment = SWT.FILL;
descriptorGroup.setLayoutData(projectGroupData);
GridLayout descriptorGroupLayout = new GridLayout(2, false);
descriptorGroup.setLayout(descriptorGroupLayout);
descriptorText = new Text(descriptorGroup, SWT.BORDER);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
grab(true, false).applyTo(descriptorText);
descriptorText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
Button browseDescriptor = new Button(descriptorGroup, SWT.NONE);
browseDescriptor.setText("Browse ...");
browseDescriptor.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
new WorkbenchLabelProvider(), new WorkbenchContentProvider());
dialog.setTitle("Select descriptor");
dialog.setMessage("Select descriptor");
dialog.setInput(getWorkspaceRoot());
dialog.setInitialSelection(getWorkspaceRoot().findMember(descriptorText.getText()));
if (dialog.open() == IDialogConstants.OK_ID) {
IResource resource = (IResource) dialog.getFirstResult();
if (resource != null) {
String fileLoc = resource.getFullPath().toString();
descriptorText.setText(fileLoc);
}
}
}
});
// Input Resource Group
Group inputResourceGroup = new Group(projectComposite, SWT.None);
inputResourceGroup.setText("Input Resource:");
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
grab(true, false).applyTo(inputResourceGroup);
GridLayout inputResourceGroupLayout = new GridLayout(2, false);
inputResourceGroup.setLayout(inputResourceGroupLayout);
inputText = new Text(inputResourceGroup, SWT.BORDER);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
grab(true, false).applyTo(inputText);
inputText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
Button browseInputResource = new Button(inputResourceGroup, SWT.NONE);
browseInputResource.setText("Browse ...");
browseInputResource.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
new WorkbenchLabelProvider(), new WorkbenchContentProvider());
dialog.setTitle("Select input folder or file");
dialog.setMessage("Select input folder or file");
dialog.setInput(getSelectedProject());
dialog.setInitialSelection(getWorkspaceRoot().findMember(inputText.getText()));
if (dialog.open() == IDialogConstants.OK_ID) {