}
exeOrJarOfInterpretersWithBuiltinsChanged.add(info.getExecutableOrJar());
}
protected String getInput() {
IInputValidator validator = new IInputValidator() {
public String isValid(String newText) {
for (char c : newText.toCharArray()) {
if (!Character.isJavaIdentifierPart(c) && c != ' ' && c != ',' && c != '.') {
return "Can only accept valid python module names (char: '" + c + "' not accepted)";
}
}
return null;
}
};
InputDialog d = new InputDialog(getShell(), "Builtin to add", "Builtin to add (comma separated)", "",
validator);
int retCode = d.open();
String builtins = null;
if (retCode == InputDialog.OK) {
builtins = d.getValue();
}
return builtins;
}
protected void addInputToInfo(InterpreterInfo info, String builtins) {
java.util.List<String> split = StringUtils.splitAndRemoveEmptyTrimmed(builtins, ',');
for (String string : split) {
String trimmed = string.trim();
if (trimmed.length() > 0) {
info.addForcedLib(trimmed);
}
}
exeOrJarOfInterpretersWithBuiltinsChanged.add(info.getExecutableOrJar());
}
};
forcedBuiltins.createTab("Forced Builtins", "Forced Builtins (check <a>Manual</a> for more info).");
//----------------------- PREDEFINED COMPLETIONS
predefinedCompletions = new AbstractListWithNewRemoveControl(this) {
private Button addAPIBt;
protected List<String> getStringsFromInfo(InterpreterInfo info) {
return info.getPredefinedCompletionsPath();
}
protected void removeSelectedFrominfo(InterpreterInfo info, String[] items) {
for (String item : items) {
info.removePredefinedCompletionPath(item);
}
exeOrJarOfInterpretersWithPredefinedChanged.add(info.getExecutableOrJar());
}
protected String getInput() {
DirectoryDialog dialog = new DirectoryDialog(getShell());
dialog.setFilterPath(lastDirectoryDialogPath);
String filePath = dialog.open();
if (filePath != null) {
lastDirectoryDialogPath = filePath;
}
return filePath;
}
protected void addInputToInfo(InterpreterInfo info, String item) {
info.addPredefinedCompletionsPath(item);
exeOrJarOfInterpretersWithPredefinedChanged.add(info.getExecutableOrJar());
}
protected void createButtons(AbstractInterpreterEditor interpreterEditor) {
super.createButtons(interpreterEditor);
addAPIBt = interpreterEditor.createBt(box, "Add from QScintilla api file", this);//$NON-NLS-1$
}
public void widgetDisposed(DisposeEvent event) {
super.widgetDisposed(event);
if (addAPIBt != null) {
addAPIBt.dispose();
addAPIBt = null;
}
}
public void widgetSelected(SelectionEvent event) {
super.widgetSelected(event);
Widget widget = event.widget;
if (widget == addAPIBt) {
addAPIBt();
}
}
private void addAPIBt() {
final AbstractInterpreterEditor interpreterEditor = this.container.get();
Assert.isNotNull(interpreterEditor);
final InterpreterInfo info = interpreterEditor.getSelectedInfo();
if (info != null) {
FileDialog dialog = new FileDialog(getShell(), SWT.PRIMARY_MODAL | SWT.MULTI);
dialog.setFilterExtensions(new String[] { "*.api" });
dialog.setText("Select .api file to be converted to .pypredef.");
dialog.setFilterPath(lastFileDialogPath);
final String filePath = dialog.open();
if (filePath != null) {
lastFileDialogPath = filePath;
File filePath1 = new File(filePath);
final String dir = filePath1.getParent();
IInputValidator validator = new IInputValidator() {
public String isValid(String newText) {
if (newText.length() == 0) {
return "Number not provided.";
}