[Pydev-cvs] org.python.pydev/src/org/python/pydev/builder PydevInternalResourceDeltaVisitor.java, 1
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-28 12:46:25
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4313/src/org/python/pydev/builder Modified Files: PydevInternalResourceDeltaVisitor.java PyDevBuilder.java PyDevBuilderPrefPage.java PyDevDeltaCounter.java PyDevBuilderVisitor.java PydevGrouperVisitor.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: PydevGrouperVisitor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PydevGrouperVisitor.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PydevGrouperVisitor.java 14 Jun 2008 22:14:55 -0000 1.13 --- PydevGrouperVisitor.java 28 Sep 2008 12:45:46 -0000 1.14 *************** *** 40,89 **** */ private void visitWith(String name, boolean isAddOrChange, IResource resource, IDocument document, IProgressMonitor monitor){ ! if(monitor.isCanceled()){ ! return; //it's already cancelled ! } ! IPythonNature nature = PythonNature.getPythonNature(resource); ! if(nature == null){ ! return; ! } ! if(!nature.startRequests()){ ! return; ! } ! ! FastStringBuffer bufferToCreateString = new FastStringBuffer(); ! ! try{ ! if(!nature.isResourceInPythonpath(resource)){ ! return; // we only analyze resources that are in the pythonpath ! } ! HashMap<String, Object> memo = new HashMap<String, Object>(); ! memo.put(PyDevBuilderVisitor.IS_FULL_BUILD, false); //mark it as a delta build ! ! for (PyDevBuilderVisitor visitor : visitors) { ! // some visitors cannot visit too many elements because they do a lot of processing ! if (visitor.maxResourcesToVisit() == PyDevBuilderVisitor.MAX_TO_VISIT_INFINITE || visitor.maxResourcesToVisit() >= totalResources) { ! visitor.memo = memo; //setting the memo must be the first thing. ! try { //communicate progress for each visitor ! PyDevBuilder.communicateProgress(monitor, totalResources, currentResourcesVisited, resource, visitor, bufferToCreateString); ! REF.invoke(visitor, name, resource, document, monitor); ! ! //ok, standard visiting ended... now, we have to check if we should visit the other ! //resources if it was an __init__.py file that changed ! if(isAddOrChange && visitor.shouldVisitInitDependency() && isInitFile(resource)){ ! IResource[] initDependents = getInitDependents(resource); ! ! for (int i = 0; i < initDependents.length; i++) { ! IDocument doc = REF.getDocFromResource(initDependents[i]); ! REF.invoke(visitor, name, initDependents[i], doc, monitor); ! } ! } ! } catch (Exception e) { ! Log.log(e); ! } ! } } }finally{ ! nature.endRequests(); } --- 40,89 ---- */ private void visitWith(String name, boolean isAddOrChange, IResource resource, IDocument document, IProgressMonitor monitor){ ! if(monitor.isCanceled()){ ! return; //it's already cancelled ! } ! IPythonNature nature = PythonNature.getPythonNature(resource); ! if(nature == null){ ! return; ! } ! if(!nature.startRequests()){ ! return; ! } ! ! FastStringBuffer bufferToCreateString = new FastStringBuffer(); ! ! try{ ! if(!nature.isResourceInPythonpath(resource)){ ! return; // we only analyze resources that are in the pythonpath ! } ! HashMap<String, Object> memo = new HashMap<String, Object>(); ! memo.put(PyDevBuilderVisitor.IS_FULL_BUILD, false); //mark it as a delta build ! ! for (PyDevBuilderVisitor visitor : visitors) { ! // some visitors cannot visit too many elements because they do a lot of processing ! if (visitor.maxResourcesToVisit() == PyDevBuilderVisitor.MAX_TO_VISIT_INFINITE || visitor.maxResourcesToVisit() >= totalResources) { ! visitor.memo = memo; //setting the memo must be the first thing. ! try { //communicate progress for each visitor ! PyDevBuilder.communicateProgress(monitor, totalResources, currentResourcesVisited, resource, visitor, bufferToCreateString); ! REF.invoke(visitor, name, resource, document, monitor); ! ! //ok, standard visiting ended... now, we have to check if we should visit the other ! //resources if it was an __init__.py file that changed ! if(isAddOrChange && visitor.shouldVisitInitDependency() && isInitFile(resource)){ ! IResource[] initDependents = getInitDependents(resource); ! ! for (int i = 0; i < initDependents.length; i++) { ! IDocument doc = REF.getDocFromResource(initDependents[i]); ! REF.invoke(visitor, name, initDependents[i], doc, monitor); ! } ! } ! } catch (Exception e) { ! Log.log(e); ! } ! } } }finally{ ! nature.endRequests(); } Index: PyDevBuilderVisitor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PyDevBuilderVisitor.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** PyDevBuilderVisitor.java 8 Mar 2007 10:47:16 -0000 1.37 --- PyDevBuilderVisitor.java 28 Sep 2008 12:45:46 -0000 1.38 *************** *** 24,27 **** --- 24,28 ---- import org.python.pydev.core.IPythonNature; import org.python.pydev.editor.codecompletion.revisited.modules.AbstractModule; + import org.python.pydev.editor.codecompletion.revisited.modules.SourceModule; import org.python.pydev.plugin.nature.PythonNature; *************** *** 52,81 **** * Higher priorities are minor numbers (and vice-versa). */ ! public static final int PRIORITY_DEFAULT = 5; ! /** ! * Maximum priority is 0 ! */ ! public static final int PRIORITY_MAX = 0; ! ! /** ! * Minimum priority is 10 ! */ ! public static final int PRIORITY_MIN = 10; ! ! /** ! * Compares them by priority (they are ordered before visiting by priority, so, this can ! * be useful if some visitor needs to run only after some other visitor was executed). ! */ public int compareTo(PyDevBuilderVisitor o) { ! int priority = getPriority(); ! int otherPriority = o.getPriority(); ! if(priority < otherPriority){ ! return -1; ! } ! if(otherPriority < priority){ ! return 1; ! } ! return 0; //equal } --- 53,82 ---- * Higher priorities are minor numbers (and vice-versa). */ ! public static final int PRIORITY_DEFAULT = 5; ! /** ! * Maximum priority is 0 ! */ ! public static final int PRIORITY_MAX = 0; ! ! /** ! * Minimum priority is 10 ! */ ! public static final int PRIORITY_MIN = 10; ! ! /** ! * Compares them by priority (they are ordered before visiting by priority, so, this can ! * be useful if some visitor needs to run only after some other visitor was executed). ! */ public int compareTo(PyDevBuilderVisitor o) { ! int priority = getPriority(); ! int otherPriority = o.getPriority(); ! if(priority < otherPriority){ ! return -1; ! } ! if(otherPriority < priority){ ! return 1; ! } ! return 0; //equal } *************** *** 85,92 **** */ protected int getPriority() { ! return PRIORITY_DEFAULT; ! } ! /** * This field acts like a memory. * --- 86,93 ---- */ protected int getPriority() { ! return PRIORITY_DEFAULT; ! } ! /** * This field acts like a memory. * *************** *** 124,129 **** * @return the module that is created by the given resource */ ! protected IModule getSourceModule(IResource resource, IDocument document, IPythonNature nature) { ! IModule module = (IModule) memo.get(MODULE_CACHE); if(module == null){ module = createSoureModule(resource, document, getModuleName(resource, nature)); --- 125,130 ---- * @return the module that is created by the given resource */ ! protected SourceModule getSourceModule(IResource resource, IDocument document, IPythonNature nature) { ! SourceModule module = (SourceModule) memo.get(MODULE_CACHE); if(module == null){ module = createSoureModule(resource, document, getModuleName(resource, nature)); *************** *** 138,147 **** * @return */ ! public static IModule createSoureModule(IResource resource, IDocument document, String moduleName) { ! IModule module; PythonNature nature = PythonNature.getPythonNature(resource.getProject()); IFile f = (IFile) resource; String file = f.getRawLocation().toOSString(); ! module = AbstractModule.createModuleFromDoc(moduleName, new File(file), document, nature, 0); return module; } --- 139,148 ---- * @return */ ! private static SourceModule createSoureModule(IResource resource, IDocument document, String moduleName) { ! SourceModule module; PythonNature nature = PythonNature.getPythonNature(resource.getProject()); IFile f = (IFile) resource; String file = f.getRawLocation().toOSString(); ! module = (SourceModule)AbstractModule.createModuleFromDoc(moduleName, new File(file), document, nature, 0); return module; } *************** *** 174,178 **** setModuleNameInCache(moduleName); }else{ ! throw new RuntimeException("Unable to resolve module for:"+resource); } } --- 175,179 ---- setModuleNameInCache(moduleName); }else{ ! throw new RuntimeException("Unable to resolve module for:"+resource); } } *************** *** 204,210 **** */ public static boolean isInPythonPath(IResource resource){ ! if(resource == null){ ! return false; ! } IProject project = resource.getProject(); PythonNature nature = PythonNature.getPythonNature(project); --- 205,211 ---- */ public static boolean isInPythonPath(IResource resource){ ! if(resource == null){ ! return false; ! } IProject project = resource.getProject(); PythonNature nature = PythonNature.getPythonNature(project); *************** *** 238,242 **** } ! /** * @param toRet * @param parent --- 239,243 ---- } ! /** * @param toRet * @param parent *************** *** 257,269 **** ! /** ! * ! * @return the maximun number of resources that it is allowed to visit (if this ! * number is higher than the number of resources changed, this visitor is not called). */ public int maxResourcesToVisit() { return MAX_TO_VISIT_INFINITE; } ! /** * if all the files below a folder that has an __init__.py just added or removed should --- 258,270 ---- ! /** ! * ! * @return the maximun number of resources that it is allowed to visit (if this ! * number is higher than the number of resources changed, this visitor is not called). */ public int maxResourcesToVisit() { return MAX_TO_VISIT_INFINITE; } ! /** * if all the files below a folder that has an __init__.py just added or removed should Index: PyDevDeltaCounter.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PyDevDeltaCounter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyDevDeltaCounter.java 16 Mar 2006 19:43:08 -0000 1.7 --- PyDevDeltaCounter.java 28 Sep 2008 12:45:46 -0000 1.8 *************** *** 25,44 **** * Overriden so that we don't load the document on this visitor (there is no need for that). */ ! protected boolean chooseVisit(IResourceDelta delta, IResource resource, boolean isAddOrChange) { ! switch (delta.getKind()) { ! case IResourceDelta.ADDED : ! visitAddedResource(resource, null, monitor); ! isAddOrChange = true; ! break; ! case IResourceDelta.CHANGED: ! visitChangedResource(resource, null, monitor); ! isAddOrChange = true; ! break; ! case IResourceDelta.REMOVED: ! visitRemovedResource(resource, null, monitor); ! break; ! } ! return isAddOrChange; ! } /** --- 25,44 ---- * Overriden so that we don't load the document on this visitor (there is no need for that). */ ! protected boolean chooseVisit(IResourceDelta delta, IResource resource, boolean isAddOrChange) { ! switch (delta.getKind()) { ! case IResourceDelta.ADDED : ! visitAddedResource(resource, null, monitor); ! isAddOrChange = true; ! break; ! case IResourceDelta.CHANGED: ! visitChangedResource(resource, null, monitor); ! isAddOrChange = true; ! break; ! case IResourceDelta.REMOVED: ! visitRemovedResource(resource, null, monitor); ! break; ! } ! return isAddOrChange; ! } /** Index: PydevInternalResourceDeltaVisitor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PydevInternalResourceDeltaVisitor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PydevInternalResourceDeltaVisitor.java 14 Jun 2008 22:14:55 -0000 1.6 --- PydevInternalResourceDeltaVisitor.java 28 Sep 2008 12:45:46 -0000 1.7 *************** *** 123,142 **** } ! protected boolean chooseVisit(IResourceDelta delta, IResource resource, boolean isAddOrChange) { ! switch (delta.getKind()) { ! case IResourceDelta.ADDED : ! visitAddedResource(resource, REF.getDocFromResource(resource), monitor); ! isAddOrChange = true; ! break; ! case IResourceDelta.CHANGED: ! visitChangedResource(resource, REF.getDocFromResource(resource), monitor); ! isAddOrChange = true; ! break; ! case IResourceDelta.REMOVED: ! visitRemovedResource(resource, null, monitor); ! break; ! } ! return isAddOrChange; ! } } --- 123,142 ---- } ! protected boolean chooseVisit(IResourceDelta delta, IResource resource, boolean isAddOrChange) { ! switch (delta.getKind()) { ! case IResourceDelta.ADDED : ! visitAddedResource(resource, REF.getDocFromResource(resource), monitor); ! isAddOrChange = true; ! break; ! case IResourceDelta.CHANGED: ! visitChangedResource(resource, REF.getDocFromResource(resource), monitor); ! isAddOrChange = true; ! break; ! case IResourceDelta.REMOVED: ! visitRemovedResource(resource, null, monitor); ! break; ! } ! return isAddOrChange; ! } } Index: PyDevBuilderPrefPage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PyDevBuilderPrefPage.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyDevBuilderPrefPage.java 2 Apr 2007 00:19:56 -0000 1.5 --- PyDevBuilderPrefPage.java 28 Sep 2008 12:45:46 -0000 1.6 *************** *** 31,34 **** --- 31,37 ---- public static final String PYDEV_ELAPSE_BEFORE_ANALYSIS = PyParserManager.PYDEV_ELAPSE_BEFORE_ANALYSIS; + public static final String ANALYZE_ONLY_ACTIVE_EDITOR = "ANALYZE_ONLY_ACTIVE_EDITOR"; + public static final boolean DEFAULT_ANALYZE_ONLY_ACTIVE_EDITOR = true; + /** * @param style *************** *** 37,41 **** super(GRID); setPreferenceStore(PydevPlugin.getDefault().getPreferenceStore()); ! setDescription("PyDev builders"); } --- 40,44 ---- super(GRID); setPreferenceStore(PydevPlugin.getDefault().getPreferenceStore()); ! setDescription("Pydev builders"); } *************** *** 47,65 **** String s = "WARNING: \n\n" + ! "PyDev builders are required for many features \n" + ! "provided by Pydev such as:\n" + ! "\n" + ! "- Code completion\n" + ! "- PyLint\n" + ! "- TODO tasks\n" + ! "\n" + ! "So, if you choose to disable it, note that the features \n" + ! "mentioned above may not work as expected or may even not \n" + ! "work at all (use at your own risk).\n"; addField(new LabelFieldEditor("LabelFieldEditor", s, p)); addField(new BooleanFieldEditor(USE_PYDEV_BUILDERS, "Use builders?", p)); ! addField(new BooleanFieldEditor(PyParserManager.USE_PYDEV_ANALYSIS_ONLY_ON_DOC_SAVE, "Build only on save?", p)); ! addField(new IntegerFieldEditor(PyParserManager.PYDEV_ELAPSE_BEFORE_ANALYSIS, "Time to elapse before analyzing changed file (millis)", p)); } --- 50,78 ---- String s = "WARNING: \n\n" + ! "Pydev builders are required for many features \n" + ! "provided by Pydev such as:\n" + ! "\n" + ! "- Code completion\n" + ! "- PyLint\n" + ! "- TODO tasks\n" + ! "\n" + ! "So, if you choose to disable it, note that the features \n" + ! "mentioned above may not work as expected or may even not \n" + ! "work at all (use at your own risk).\n"; addField(new LabelFieldEditor("LabelFieldEditor", s, p)); addField(new BooleanFieldEditor(USE_PYDEV_BUILDERS, "Use builders?", p)); ! ! ! //Analysis only on save means that we'll not have parse notifications (so, things will be analyzed only on save) ! addField(new BooleanFieldEditor(PyParserManager.USE_PYDEV_ANALYSIS_ONLY_ON_DOC_SAVE, "Disable parser notifications?", p)); ! addField(new IntegerFieldEditor(PyParserManager.PYDEV_ELAPSE_BEFORE_ANALYSIS, "Time to elapse before reparsing changed file (millis)", p)); ! ! s = "If only open editors are analyzed, markers will only be added\n" + ! "to the opened Pydev editors and will be removed upon close.\n" + ! "(note that a full rebuild may be needed to remove existing markers)"; ! addField(new LabelFieldEditor("ActiveBufferLabelFieldEditor", s, p)); ! ! addField(new BooleanFieldEditor(ANALYZE_ONLY_ACTIVE_EDITOR, "Only analyze open editors?", p)); } *************** *** 78,81 **** --- 91,102 ---- } + public static boolean getAnalyzeOnlyActiveEditor() { + return PydevPrefs.getPreferences().getBoolean(ANALYZE_ONLY_ACTIVE_EDITOR); + } + + public static void setAnalyzeOnlyActiveEditor(boolean b) { + PydevPrefs.getPreferences().setValue(ANALYZE_ONLY_ACTIVE_EDITOR, b); + } + public static int getElapseMillisBeforeAnalysis() { return PyParserManager.getPyParserManager(PydevPrefs.getPreferences()).getElapseMillisBeforeAnalysis(); Index: PyDevBuilder.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PyDevBuilder.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** PyDevBuilder.java 14 Jun 2008 22:14:55 -0000 1.53 --- PyDevBuilder.java 28 Sep 2008 12:45:46 -0000 1.54 *************** *** 24,27 **** --- 24,28 ---- import org.python.pydev.builder.pycremover.PycRemoverBuilderVisitor; import org.python.pydev.builder.pylint.PyLintVisitor; + import org.python.pydev.builder.syntaxchecker.PySyntaxChecker; import org.python.pydev.builder.todo.PyTodoVisitor; import org.python.pydev.core.ExtensionHelper; *************** *** 44,48 **** private static final boolean DEBUG = false; ! /** * * @return a list of visitors for building the application. --- 45,49 ---- private static final boolean DEBUG = false; ! /** * * @return a list of visitors for building the application. *************** *** 55,58 **** --- 56,60 ---- list.add(new PyCodeCompletionVisitor()); list.add(new PycRemoverBuilderVisitor()); + list.add(new PySyntaxChecker()); list.addAll(ExtensionHelper.getParticipants(ExtensionHelper.PYDEV_BUILDER)); *************** *** 68,71 **** --- 70,74 ---- * @see org.eclipse.core.internal.events InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor) */ + @SuppressWarnings("unchecked") protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { *************** *** 121,177 **** if (nature != null && nature.startRequests()){ ! try{ ! IPythonPathNature pythonPathNature = nature.getPythonPathNature(); ! pythonPathNature.getProjectSourcePath(); //this is just to update the paths (in case the project name has just changed) ! ! List<IFile> resourcesToParse = new ArrayList<IFile>(); ! ! List<PyDevBuilderVisitor> visitors = getVisitors(); ! notifyVisitingWillStart(visitors, monitor, true, nature); ! ! monitor.beginTask("Building...", (visitors.size() * 100) + 30); ! ! IResource[] members = project.members(); ! ! if (members != null) { ! // get all the python files to get information. ! for (int i = 0; i < members.length; i++) { ! try { ! IResource member = members[i]; ! if (member == null) { ! continue; ! } ! ! if (member.getType() == IResource.FILE) { ! addToResourcesToParse(resourcesToParse, (IFile)member, nature); ! ! } else if (member.getType() == IResource.FOLDER) { ! //if it is a folder, let's get all python files that are beneath it ! //the heuristics to know if we have to analyze them are the same we have ! //for a single file ! List<IFile> l = PyFileListing.getAllIFilesBelow((IFolder) member); ! ! for (Iterator<IFile> iter = l.iterator(); iter.hasNext();) { ! IFile element = iter.next(); ! if (element != null) { ! addToResourcesToParse(resourcesToParse, element, nature); ! } ! } ! } else { ! if (DEBUG){ ! System.out.println("Unknown type: "+member.getType()); ! } ! } ! } catch (Exception e) { ! // that's ok... ! } ! } ! monitor.worked(30); ! buildResources(resourcesToParse, monitor, visitors); ! } ! notifyVisitingEnded(visitors, monitor); ! }finally{ ! nature.endRequests(); ! } } } --- 124,180 ---- if (nature != null && nature.startRequests()){ ! try{ ! IPythonPathNature pythonPathNature = nature.getPythonPathNature(); ! pythonPathNature.getProjectSourcePath(); //this is just to update the paths (in case the project name has just changed) ! ! List<IFile> resourcesToParse = new ArrayList<IFile>(); ! ! List<PyDevBuilderVisitor> visitors = getVisitors(); ! notifyVisitingWillStart(visitors, monitor, true, nature); ! ! monitor.beginTask("Building...", (visitors.size() * 100) + 30); ! ! IResource[] members = project.members(); ! ! if (members != null) { ! // get all the python files to get information. ! for (int i = 0; i < members.length; i++) { ! try { ! IResource member = members[i]; ! if (member == null) { ! continue; ! } ! ! if (member.getType() == IResource.FILE) { ! addToResourcesToParse(resourcesToParse, (IFile)member, nature); ! ! } else if (member.getType() == IResource.FOLDER) { ! //if it is a folder, let's get all python files that are beneath it ! //the heuristics to know if we have to analyze them are the same we have ! //for a single file ! List<IFile> l = PyFileListing.getAllIFilesBelow((IFolder) member); ! ! for (Iterator<IFile> iter = l.iterator(); iter.hasNext();) { ! IFile element = iter.next(); ! if (element != null) { ! addToResourcesToParse(resourcesToParse, element, nature); ! } ! } ! } else { ! if (DEBUG){ ! System.out.println("Unknown type: "+member.getType()); ! } ! } ! } catch (Exception e) { ! // that's ok... ! } ! } ! monitor.worked(30); ! buildResources(resourcesToParse, monitor, visitors); ! } ! notifyVisitingEnded(visitors, monitor); ! }finally{ ! nature.endRequests(); ! } } } *************** *** 204,215 **** String fileExtension = member.getFileExtension(); if(DEBUG){ ! System.out.println("Checking name:'"+member.getName()+"' projPath:'"+member.getProjectRelativePath()+ "' ext:'"+fileExtension+"'"); ! System.out.println("loc:'"+member.getLocation()+"' rawLoc:'"+member.getRawLocation()+"'"); ! } if (fileExtension != null && PythonPathHelper.isValidSourceFile("."+fileExtension)) { ! if(DEBUG){ ! System.out.println("Adding resource to parse:"+member.getProjectRelativePath()); ! } resourcesToParse.add(member); } --- 207,218 ---- String fileExtension = member.getFileExtension(); if(DEBUG){ ! System.out.println("Checking name:'"+member.getName()+"' projPath:'"+member.getProjectRelativePath()+ "' ext:'"+fileExtension+"'"); ! System.out.println("loc:'"+member.getLocation()+"' rawLoc:'"+member.getRawLocation()+"'"); ! } if (fileExtension != null && PythonPathHelper.isValidSourceFile("."+fileExtension)) { ! if(DEBUG){ ! System.out.println("Adding resource to parse:"+member.getProjectRelativePath()); ! } resourcesToParse.add(member); } *************** *** 224,228 **** * @param visitors */ ! public void buildResources(List<IFile> resourcesToParse, IProgressMonitor monitor, List visitors) { // we have 100 units here --- 227,231 ---- * @param visitors */ ! public void buildResources(List<IFile> resourcesToParse, IProgressMonitor monitor, List<PyDevBuilderVisitor> visitors) { // we have 100 units here *************** *** 241,277 **** IPythonNature nature = PythonNature.getPythonNature(r); if (nature == null){ ! continue; } if(!nature.startRequests()){ ! continue; } try{ ! if(!nature.isResourceInPythonpath(r)){ ! continue; // we only analyze resources that are in the pythonpath ! } ! IDocument doc = REF.getDocFromResource(r); ! ! HashMap<String, Object> memo = new HashMap<String, Object>(); ! memo.put(PyDevBuilderVisitor.IS_FULL_BUILD, true); //mark it as full build ! ! if(doc != null){ //might be out of synch ! for (Iterator it = visitors.iterator(); it.hasNext() && monitor.isCanceled() == false;) { ! ! PyDevBuilderVisitor visitor = (PyDevBuilderVisitor) it.next(); ! visitor.memo = memo; //setting the memo must be the first thing. ! ! communicateProgress(monitor, totalResources, i, r, visitor, bufferToCreateString); ! ! //on a full build, all visits are as some add... ! visitor.visitAddedResource(r, doc, monitor); ! } ! ! if (total > 1) { ! monitor.worked((int) total); ! total -= (int) total; ! } ! } }finally{ ! nature.endRequests(); } } --- 244,280 ---- IPythonNature nature = PythonNature.getPythonNature(r); if (nature == null){ ! continue; } if(!nature.startRequests()){ ! continue; } try{ ! if(!nature.isResourceInPythonpath(r)){ ! continue; // we only analyze resources that are in the pythonpath ! } ! IDocument doc = REF.getDocFromResource(r); ! ! HashMap<String, Object> memo = new HashMap<String, Object>(); ! memo.put(PyDevBuilderVisitor.IS_FULL_BUILD, true); //mark it as full build ! ! if(doc != null){ //might be out of synch ! for (Iterator<PyDevBuilderVisitor> it = visitors.iterator(); it.hasNext() && monitor.isCanceled() == false;) { ! ! PyDevBuilderVisitor visitor = it.next(); ! visitor.memo = memo; //setting the memo must be the first thing. ! ! communicateProgress(monitor, totalResources, i, r, visitor, bufferToCreateString); ! ! //on a full build, all visits are as some add... ! visitor.visitAddedResource(r, doc, monitor); ! } ! ! if (total > 1) { ! monitor.worked((int) total); ! total -= (int) total; ! } ! } }finally{ ! nature.endRequests(); } } |