try {
String selectedText = getSelectedText();
if (selectedText == null) {
return;
}
SyntaxDocument pythonDoc = (SyntaxDocument) doc;
// now check if the corresponding line, import exist
int lineIndex = yToLine(e.getY());
int startIndex = pythonDoc.getDefaultRootElement().getElement(lineIndex + 1).getStartOffset();
int endIndex = pythonDoc.getDefaultRootElement().getElement(lineIndex + 1).getEndOffset();
String text = pythonDoc.getText(startIndex, endIndex - startIndex);
if (selectedText.equals("importTestScript")) {
int parenPos = text.indexOf("(");
if (parenPos > 0) {
// retrieve the script name
String quoteStr = text.substring(parenPos + 1, parenPos + 2);