Merge branch 'master' of git.labs.intellij.net:idea/ultimate

This commit is contained in:
Dmitry Trofimov
2010-12-02 21:34:40 +03:00
4 changed files with 19 additions and 11 deletions
+1 -1
View File
@@ -561,7 +561,7 @@ def layoutWin(String target) {
}
def layoutUnix(String target) {
ant.copy(file: "$home/pycharm/build/pycharm.sh", todir: "$target/bin")
ant.copy(file: "$home/python/build/pycharm.sh", todir: "$target/bin")
ant.replace(file: "$target/bin/pycharm.sh") {
replacefilter(token: "@@isEap@@", value: isEap())
}
+5 -4
View File
@@ -65,12 +65,13 @@ def loadModulesFromFolderUsingPattern(folder, pattern):
''' loads modules from folder ,
check if module name matches given pattern'''
modules = loadModulesFromFolderRec(folder)
result = []
prog = re.compile(pattern)
prog_list = [re.compile(pat.strip()) for pat in pattern.split(',')]
result = []
for module in modules:
if prog.match(module.__name__):
result.append(module)
for prog in prog_list:
if prog.match(module.__name__):
result.append(module)
return result
if __name__ == "__main__":
@@ -61,12 +61,13 @@ public class UnresolvedRefCreateFunctionQuickFix implements LocalQuickFix {
if (parentFunction != null ) {
PsiFile file = myElement.getContainingFile();
function = (PyFunction)file.addBefore(function, parentFunction);
}
PyStatement statement = PsiTreeUtil.getParentOfType(myElement, PyStatement.class);
if (statement != null) {
PsiElement parent = statement.getParent();
if (parent != null)
function = (PyFunction)parent.addBefore(function, statement);
} else {
PyStatement statement = PsiTreeUtil.getParentOfType(myElement, PyStatement.class);
if (statement != null) {
PsiElement parent = statement.getParent();
if (parent != null)
function = (PyFunction)parent.addBefore(function, statement);
}
}
function = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(function);
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(function);
@@ -123,6 +123,12 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
public void visitPyImportElement(PyImportElement node) {
super.visitPyImportElement(node);
final PyFromImportStatement fromImport = PsiTreeUtil.getParentOfType(node, PyFromImportStatement.class);
PsiFile file = node.getContainingFile();
String fileNameWithExt = file.getName();
String fileName = fileNameWithExt.substring(0, fileNameWithExt.length() - 3);
if (fromImport == null && fileName.equals(node.getText())) {
registerProblem(node, "Import resolves to its containing file.");
}
if (fromImport == null || !fromImport.isFromFuture()) {
myAllImports.add(node);
}