[Pydev-cvs] org.python.pydev/src/org/python/pydev/builder PyDevBuilder.java, 1.52, 1.53 PydevMarker
Brought to you by:
fabioz
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27940/src/org/python/pydev/builder Modified Files: PyDevBuilder.java PydevMarkerUtils.java PydevGrouperVisitor.java PydevInternalResourceDeltaVisitor.java Log Message: Using faster version of StringBuffer: FastStrintgBuffer / Better icons for auto-import. Index: PydevGrouperVisitor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PydevGrouperVisitor.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PydevGrouperVisitor.java 8 Mar 2007 20:03:39 -0000 1.12 --- PydevGrouperVisitor.java 14 Jun 2008 22:14:55 -0000 1.13 *************** *** 14,17 **** --- 14,18 ---- import org.python.pydev.core.REF; import org.python.pydev.core.log.Log; + import org.python.pydev.core.structure.FastStringBuffer; import org.python.pydev.plugin.nature.PythonNature; *************** *** 49,52 **** --- 50,56 ---- return; } + + FastStringBuffer bufferToCreateString = new FastStringBuffer(); + try{ if(!nature.isResourceInPythonpath(resource)){ *************** *** 61,66 **** visitor.memo = memo; //setting the memo must be the first thing. try { ! //communicate progress for each visitor ! PyDevBuilder.communicateProgress(monitor, totalResources, currentResourcesVisited, resource, visitor); REF.invoke(visitor, name, resource, document, monitor); --- 65,70 ---- 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); Index: PydevInternalResourceDeltaVisitor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PydevInternalResourceDeltaVisitor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PydevInternalResourceDeltaVisitor.java 30 May 2006 01:31:59 -0000 1.5 --- PydevInternalResourceDeltaVisitor.java 14 Jun 2008 22:14:55 -0000 1.6 *************** *** 13,16 **** --- 13,17 ---- import org.python.pydev.core.REF; import org.python.pydev.core.log.Log; + import org.python.pydev.core.structure.FastStringBuffer; import org.python.pydev.editor.codecompletion.revisited.PythonPathHelper; import org.python.pydev.plugin.nature.PythonNature; *************** *** 104,108 **** //communicate the progress currentResourcesVisited++; ! PyDevBuilder.communicateProgress(monitor, totalResources, currentResourcesVisited, resource, this); } }else if(ext.equals("pyc")){ --- 105,110 ---- //communicate the progress currentResourcesVisited++; ! FastStringBuffer bufferToCreateString = new FastStringBuffer(); ! PyDevBuilder.communicateProgress(monitor, totalResources, currentResourcesVisited, resource, this, bufferToCreateString); } }else if(ext.equals("pyc")){ Index: PyDevBuilder.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PyDevBuilder.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** PyDevBuilder.java 15 Sep 2007 18:48:50 -0000 1.52 --- PyDevBuilder.java 14 Jun 2008 22:14:55 -0000 1.53 *************** *** 29,32 **** --- 29,33 ---- import org.python.pydev.core.IPythonPathNature; import org.python.pydev.core.REF; + import org.python.pydev.core.structure.FastStringBuffer; import org.python.pydev.editor.codecompletion.revisited.PyCodeCompletionVisitor; import org.python.pydev.editor.codecompletion.revisited.PythonPathHelper; *************** *** 231,234 **** --- 232,237 ---- int totalResources = resourcesToParse.size(); int i = 0; + + FastStringBuffer bufferToCreateString = new FastStringBuffer(); for (Iterator<IFile> iter = resourcesToParse.iterator(); iter.hasNext() && monitor.isCanceled() == false;) { *************** *** 258,262 **** visitor.memo = memo; //setting the memo must be the first thing. ! communicateProgress(monitor, totalResources, i, r, visitor); //on a full build, all visits are as some add... --- 261,265 ---- 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... *************** *** 277,294 **** /** * Used so that we can communicate the progress to the user */ ! public static void communicateProgress(IProgressMonitor monitor, int totalResources, int i, IResource r, PyDevBuilderVisitor visitor) { if(monitor != null){ ! StringBuffer msgBuf = new StringBuffer(); ! msgBuf.append("Pydev: Analyzing "); ! msgBuf.append(i); ! msgBuf.append(" of "); ! msgBuf.append(totalResources); ! msgBuf.append(" ("); ! msgBuf.append(r.getName()); ! msgBuf.append(")"); //in this case the visitor does not have the progress and therefore does not communicate the progress ! String name = msgBuf.toString(); monitor.subTask(name); } --- 280,301 ---- /** * Used so that we can communicate the progress to the user + * + * @param bufferToCreateString: this is a buffer that's emptied and used to create the string to be shown to the + * user with the progress. */ ! public static void communicateProgress(IProgressMonitor monitor, int totalResources, int i, IResource r, ! PyDevBuilderVisitor visitor, FastStringBuffer bufferToCreateString) { if(monitor != null){ ! bufferToCreateString.clear(); ! bufferToCreateString.append("Pydev: Analyzing "); ! bufferToCreateString.append(i); ! bufferToCreateString.append(" of "); ! bufferToCreateString.append(totalResources); ! bufferToCreateString.append(" ("); ! bufferToCreateString.append(r.getName()); ! bufferToCreateString.append(")"); //in this case the visitor does not have the progress and therefore does not communicate the progress ! String name = bufferToCreateString.toString(); monitor.subTask(name); } Index: PydevMarkerUtils.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/PydevMarkerUtils.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PydevMarkerUtils.java 21 May 2008 01:38:09 -0000 1.12 --- PydevMarkerUtils.java 14 Jun 2008 22:14:55 -0000 1.13 *************** *** 15,18 **** --- 15,19 ---- import org.eclipse.jface.text.IRegion; import org.eclipse.ui.texteditor.MarkerUtilities; + import org.python.pydev.core.structure.FastStringBuffer; import org.python.pydev.plugin.PydevPlugin; *************** *** 110,121 **** String line = doc.get(start.getOffset(), start.getLength()); int i; ! StringBuffer buffer; if ((i = line.indexOf('#')) != -1) { ! buffer = new StringBuffer(line.substring(0, i)); } else { ! buffer = new StringBuffer(line); } while (buffer.length() > 0 && Character.isWhitespace(buffer.charAt(buffer.length() - 1))) { ! buffer.deleteCharAt(buffer.length() - 1); } absoluteEnd = start.getOffset() + buffer.length(); --- 111,122 ---- String line = doc.get(start.getOffset(), start.getLength()); int i; ! FastStringBuffer buffer; if ((i = line.indexOf('#')) != -1) { ! buffer = new FastStringBuffer(line.substring(0, i), 0); } else { ! buffer = new FastStringBuffer(line, 0); } while (buffer.length() > 0 && Character.isWhitespace(buffer.charAt(buffer.length() - 1))) { ! buffer.deleteLast(); } absoluteEnd = start.getOffset() + buffer.length(); |