// On button click, this displays the python module picker dialog.
fMainModuleBrowseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
// IFile currentFile = getMainModuleFile();
IResource resource = workspace.getRoot().findMember(fProjectName);
if (resource instanceof IProject) {
IProject project = (IProject) resource;
FileDialog fd = new FileDialog(lParent.getShell(), SWT.OPEN);
fd.setText("Choose Grinder Properties File");
fd.setFilterPath(project.getLocation().toOSString());
String[] filterExt = { "*.properties" };
fd.setFilterExtensions(filterExt);
String result = fd.open();
if ((result != null) && (result.length() > 0)) {
fMainModuleText.setText(result);
}
}
}
});
// Create a ModifyListener, used to listen for project modifications in
// the ProjectBlock.
// This assumes that the Project is in a Text control...
fProjectModifyListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
Widget widget = e.widget;
if (widget instanceof Text) {
Text text = (Text) widget;
fProjectName = text.getText();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IResource resource = workspace.getRoot().findMember(fProjectName);
boolean enabled = false;
if ((resource != null) && (resource instanceof IProject)) {
IProject project = (IProject) resource;
PythonNature nature = PythonNature.getPythonNature(project);