use of org.python.pydev.ui.dialogs.ProjectFolderSelectionDialog in project Pydev by fabioz.
the class PyProjectProperties method createTabProjectSourceFolders.
private void createTabProjectSourceFolders(String sourcePath) {
TabItem tabItem = new TabItem(tabFolder, SWT.None);
tabItem.setText("Source Folders");
tabItem.setImage(ImageCache.asImage(SharedUiPlugin.getImageCache().get(UIConstants.SOURCE_FOLDER_ICON)));
Composite topComp = new Composite(tabFolder, SWT.None);
topComp.setLayout(new GridLayout(1, false));
GridData gd;
GridData data;
Label l2 = new Label(topComp, SWT.None);
l2.setText("Project Source Folders (and zips/jars/eggs).\n\n" + "When using variables, the final paths resolved must be workspace-relative.");
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = false;
l2.setLayoutData(gd);
treeSourceFolders = new TreeWithAddRemove(topComp, 0, PythonNature.getStrAsStrItems(sourcePath)) {
@Override
protected String getButtonLabel(int i) {
switch(i) {
case 0:
return "Add source folder";
case 1:
return "Add zip/jar/egg";
case 2:
return "Add based on variable";
default:
throw new AssertionError("Unexpected: " + i);
}
}
@Override
protected void handleAddButtonSelected(int nButton) {
if (nButton == 0) {
addItemWithDialog(new ProjectFolderSelectionDialog(getShell(), project, true, "Choose source folders to add to PYTHONPATH"), project);
} else if (nButton == 1) {
addItemWithDialog(new ResourceSelectionDialog(getShell(), project, "Choose zip/jar/egg to add to PYTHONPATH"), project);
} else if (nButton == 2) {
addItemWithDialog(new InputDialog(getShell(), "Add path to resolve with variable", "Add path to resolve with variable in the format: ${VARIABLE}", "", null));
} else {
throw new AssertionError("Unexpected");
}
}
@Override
protected String getImageConstant() {
return UIConstants.SOURCE_FOLDER_ICON;
}
};
data = new GridData(GridData.FILL_BOTH);
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
treeSourceFolders.setLayoutData(data);
tabItem.setControl(topComp);
}
Aggregations