pydev-cvs Mailing List for PyDev for Eclipse (Page 14)
Brought to you by:
fabioz
You can subscribe to this list here.
2004 |
Jan
|
Feb
(4) |
Mar
(48) |
Apr
(56) |
May
(64) |
Jun
(27) |
Jul
(66) |
Aug
(81) |
Sep
(148) |
Oct
(194) |
Nov
(78) |
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(125) |
Feb
(126) |
Mar
(163) |
Apr
(133) |
May
(115) |
Jun
(307) |
Jul
(387) |
Aug
(417) |
Sep
(283) |
Oct
(148) |
Nov
(45) |
Dec
(53) |
2006 |
Jan
(240) |
Feb
(200) |
Mar
(267) |
Apr
(231) |
May
(245) |
Jun
(361) |
Jul
(142) |
Aug
(12) |
Sep
(210) |
Oct
(99) |
Nov
(7) |
Dec
(30) |
2007 |
Jan
(161) |
Feb
(511) |
Mar
(265) |
Apr
(74) |
May
(147) |
Jun
(151) |
Jul
(94) |
Aug
(68) |
Sep
(98) |
Oct
(144) |
Nov
(26) |
Dec
(36) |
2008 |
Jan
(98) |
Feb
(107) |
Mar
(199) |
Apr
(113) |
May
(119) |
Jun
(112) |
Jul
(92) |
Aug
(71) |
Sep
(101) |
Oct
(16) |
Nov
|
Dec
|
From: Fabio Z. <fa...@us...> - 2008-06-15 17:39:12
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/nature In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29931/src/org/python/pydev/plugin/nature Modified Files: PythonPathNature.java Log Message: Minor Index: PythonPathNature.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/nature/PythonPathNature.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** PythonPathNature.java 15 Jun 2008 00:45:56 -0000 1.28 --- PythonPathNature.java 15 Jun 2008 17:39:16 -0000 1.29 *************** *** 171,187 **** * @throws CoreException */ private String getContributedSourcePath() throws CoreException { FastStringBuffer buff = new FastStringBuffer(); ! synchronized (buff) { ! List contributors = ExtensionHelper.getParticipants("org.python.pydev.pydev_pythonpath_contrib"); ! for (Object contribObj : contributors) { ! IPythonPathContributor contributor = (IPythonPathContributor) contribObj; ! String additionalPythonPath = contributor.getAdditionalPythonPath(project); ! if (additionalPythonPath != null && additionalPythonPath.trim().length() > 0) { ! if (buff.length() > 0){ ! buff.append("|"); ! } ! buff.append(additionalPythonPath.trim()); } } } --- 171,185 ---- * @throws CoreException */ + @SuppressWarnings("unchecked") private String getContributedSourcePath() throws CoreException { FastStringBuffer buff = new FastStringBuffer(); ! List<IPythonPathContributor> contributors = ExtensionHelper.getParticipants("org.python.pydev.pydev_pythonpath_contrib"); ! for (IPythonPathContributor contributor : contributors) { ! String additionalPythonPath = contributor.getAdditionalPythonPath(project); ! if (additionalPythonPath != null && additionalPythonPath.trim().length() > 0) { ! if (buff.length() > 0){ ! buff.append("|"); } + buff.append(additionalPythonPath.trim()); } } |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:46:08
|
Update of /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/visitors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2515/tests/org/python/pydev/parser/visitors Modified Files: ParsingUtilsTest.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: ParsingUtilsTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/visitors/ParsingUtilsTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ParsingUtilsTest.java 25 Feb 2006 00:12:51 -0000 1.3 --- ParsingUtilsTest.java 15 Jun 2008 16:46:15 -0000 1.4 *************** *** 5,8 **** --- 5,9 ---- import org.python.pydev.core.docutils.ParsingUtils; + import org.python.pydev.core.structure.FastStringBuffer; import junit.framework.TestCase; *************** *** 24,28 **** public void testRemoveCommentsAndWhitespaces() { String s = "a , b = 0,#ignore\n*args, **kwargs"; ! StringBuffer buf = new StringBuffer(s); ParsingUtils.removeCommentsAndWhitespaces(buf); assertEquals("a,b=0,*args,**kwargs", buf.toString()); --- 25,29 ---- public void testRemoveCommentsAndWhitespaces() { String s = "a , b = 0,#ignore\n*args, **kwargs"; ! FastStringBuffer buf = new FastStringBuffer(s, 0); ParsingUtils.removeCommentsAndWhitespaces(buf); assertEquals("a,b=0,*args,**kwargs", buf.toString()); *************** *** 34,38 **** "*args, **kwargs\n" + "'''"; ! StringBuffer buf = new StringBuffer(s); ParsingUtils.removeCommentsWhitespacesAndLiterals(buf); assertEquals("a,b=0,*args,**kwargs", buf.toString()); --- 35,39 ---- "*args, **kwargs\n" + "'''"; ! FastStringBuffer buf = new FastStringBuffer(s, 0); ParsingUtils.removeCommentsWhitespacesAndLiterals(buf); assertEquals("a,b=0,*args,**kwargs", buf.toString()); *************** *** 42,46 **** "*args, **kwargs\n" + "'''remove'\""; ! buf = new StringBuffer(s); ParsingUtils.removeCommentsWhitespacesAndLiterals(buf); assertEquals("a,b=0,*args,**kwargs", buf.toString()); --- 43,47 ---- "*args, **kwargs\n" + "'''remove'\""; ! buf = new FastStringBuffer(s, 0); ParsingUtils.removeCommentsWhitespacesAndLiterals(buf); assertEquals("a,b=0,*args,**kwargs", buf.toString()); *************** *** 50,54 **** "*args, **kwargs\n" + "'''remove'''keep"; ! buf = new StringBuffer(s); ParsingUtils.removeCommentsWhitespacesAndLiterals(buf); assertEquals("a,b=0,*args,**kwargskeep", buf.toString()); --- 51,55 ---- "*args, **kwargs\n" + "'''remove'''keep"; ! buf = new FastStringBuffer(s, 0); ParsingUtils.removeCommentsWhitespacesAndLiterals(buf); assertEquals("a,b=0,*args,**kwargskeep", buf.toString()); |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:45:20
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1992/src/org/python/pydev/editor/actions Modified Files: PyFormatStd.java PyAction.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: PyAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyAction.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** PyAction.java 14 Jun 2008 22:14:55 -0000 1.36 --- PyAction.java 15 Jun 2008 16:45:26 -0000 1.37 *************** *** 273,276 **** --- 273,294 ---- /** + * Counts the number of occurences of a certain character in a string. + * + * @param line the string to search in + * @param c the character to search for + * @return an integer (int) representing the number of occurences of this character + */ + public static int countChars(char c, FastStringBuffer line) { + int ret = 0; + int len = line.length(); + for (int i = 0; i < len; i++) { + if(line.charAt(i) == c){ + ret += 1; + } + } + return ret; + } + + /** * @param ps * @return string with the token or empty token if not found. Index: PyFormatStd.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyFormatStd.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PyFormatStd.java 26 Feb 2008 16:33:01 -0000 1.16 --- PyFormatStd.java 15 Jun 2008 16:45:26 -0000 1.17 *************** *** 15,20 **** import org.python.pydev.core.docutils.ParsingUtils; import org.python.pydev.core.docutils.PySelection; import org.python.pydev.editor.PyEdit; - import org.python.pydev.parser.prettyprinter.Formatter; import org.python.pydev.parser.prettyprinter.IFormatter; import org.python.pydev.plugin.PyCodeFormatterPage; --- 15,20 ---- import org.python.pydev.core.docutils.ParsingUtils; import org.python.pydev.core.docutils.PySelection; + import org.python.pydev.core.structure.FastStringBuffer; import org.python.pydev.editor.PyEdit; import org.python.pydev.parser.prettyprinter.IFormatter; import org.python.pydev.plugin.PyCodeFormatterPage; *************** *** 23,70 **** * @author Fabio Zadrozny */ ! public class PyFormatStd extends PyAction implements IFormatter{ ! public static class FormatStd{ public boolean spaceAfterComma; public boolean parametersWithSpace; } ! /** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run(IAction action) { ! try { IFormatter participant = (IFormatter) ExtensionHelper.getParticipant(ExtensionHelper.PYDEV_FORMATTER); ! if(participant==null){ participant = this; } ! PySelection ps = new PySelection ( getTextEditor ()); IDocument doc = ps.getDoc(); ! int startLine = ps.getStartLineIndex(); PyEdit pyEdit = getPyEdit(); ! if(ps.getTextSelection().getLength() == 0){ participant.formatAll(doc, pyEdit); ! }else{ participant.formatSelection(doc, startLine, ps.getEndLineIndex(), pyEdit, ps); } ! ! if(startLine >= doc.getNumberOfLines()){ ! startLine = doc.getNumberOfLines()-1; } TextSelection sel = new TextSelection(doc, doc.getLineOffset(startLine), 0); getTextEditor().getSelectionProvider().setSelection(sel); ! } catch ( Exception e ) { ! beep ( e ); ! } } ! public void formatSelection(IDocument doc, int startLine, int endLineIndex, IPyEdit edit, PySelection ps){ // Formatter formatter = new Formatter(); // formatter.formatSelection(doc, startLine, endLineIndex, edit, ps); performFormatSelection(doc, startLine, endLineIndex); } ! public void formatAll(IDocument doc, IPyEdit edit) { // Formatter formatter = new Formatter(); --- 23,71 ---- * @author Fabio Zadrozny */ ! public class PyFormatStd extends PyAction implements IFormatter { ! public static class FormatStd { public boolean spaceAfterComma; + public boolean parametersWithSpace; } ! /** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run(IAction action) { ! try { IFormatter participant = (IFormatter) ExtensionHelper.getParticipant(ExtensionHelper.PYDEV_FORMATTER); ! if (participant == null) { participant = this; } ! PySelection ps = new PySelection(getTextEditor()); IDocument doc = ps.getDoc(); ! int startLine = ps.getStartLineIndex(); PyEdit pyEdit = getPyEdit(); ! if (ps.getTextSelection().getLength() == 0) { participant.formatAll(doc, pyEdit); ! } else { participant.formatSelection(doc, startLine, ps.getEndLineIndex(), pyEdit, ps); } ! ! if (startLine >= doc.getNumberOfLines()) { ! startLine = doc.getNumberOfLines() - 1; } TextSelection sel = new TextSelection(doc, doc.getLineOffset(startLine), 0); getTextEditor().getSelectionProvider().setSelection(sel); ! } catch (Exception e) { ! beep(e); ! } } ! public void formatSelection(IDocument doc, int startLine, int endLineIndex, IPyEdit edit, PySelection ps) { // Formatter formatter = new Formatter(); // formatter.formatSelection(doc, startLine, endLineIndex, edit, ps); performFormatSelection(doc, startLine, endLineIndex); } ! public void formatAll(IDocument doc, IPyEdit edit) { // Formatter formatter = new Formatter(); *************** *** 72,76 **** performFormatAll(doc); } ! /** * @param doc --- 73,77 ---- performFormatAll(doc); } ! /** * @param doc *************** *** 83,96 **** IRegion start = doc.getLineInformation(startLineIndex); IRegion end = doc.getLineInformation(endLineIndex); ! int iStart = start.getOffset(); ! int iEnd = end.getOffset()+end.getLength(); ! ! String d = doc.get(iStart, iEnd-iStart); ! FormatStd formatStd = getFormat(); ! String formatted = formatStr(d, formatStd); ! ! doc.replace(iStart, iEnd-iStart, formatted); ! } catch (BadLocationException e) { e.printStackTrace(); --- 84,97 ---- IRegion start = doc.getLineInformation(startLineIndex); IRegion end = doc.getLineInformation(endLineIndex); ! int iStart = start.getOffset(); ! int iEnd = end.getOffset() + end.getLength(); ! ! String d = doc.get(iStart, iEnd - iStart); ! FormatStd formatStd = getFormat(); ! String formatted = formatStr(d, formatStd); ! ! doc.replace(iStart, iEnd - iStart, formatted); ! } catch (BadLocationException e) { e.printStackTrace(); *************** *** 98,102 **** } ! private FormatStd getFormat(){ FormatStd formatStd = new FormatStd(); formatStd.parametersWithSpace = PyCodeFormatterPage.useSpaceForParentesis(); --- 99,103 ---- } ! private FormatStd getFormat() { FormatStd formatStd = new FormatStd(); formatStd.parametersWithSpace = PyCodeFormatterPage.useSpaceForParentesis(); *************** *** 104,108 **** return formatStd; } ! /** * @param doc --- 105,109 ---- return formatStd; } ! /** * @param doc *************** *** 116,120 **** } - /** * This method formats a string given some standard. --- 117,120 ---- *************** *** 124,154 **** * @return */ ! public static String formatStr(String str, FormatStd std ){ char[] cs = str.toCharArray(); ! StringBuffer buf = new StringBuffer(); char lastChar = '\0'; for (int i = 0; i < cs.length; i++) { char c = cs[i]; ! ! if(c == '\'' || c == '"'){ //ignore comments or multiline comments... i = ParsingUtils.eatLiterals(cs, buf, i); ! ! }else if(c == '#'){ i = ParsingUtils.eatComments(cs, buf, i); ! ! }else if(c == ','){ ! i = formatForComma(std, cs, buf, i); ! ! }else if(c == '('){ ! i = formatForPar(cs, i, std, buf); ! ! ! }else{ ! if(c == '\r' || c == '\n'){ ! if(lastChar == ',' && std.spaceAfterComma){ ! buf.deleteCharAt(buf.length()-1); ! } ! } buf.append(c); } --- 124,153 ---- * @return */ ! public static String formatStr(String str, FormatStd std) { char[] cs = str.toCharArray(); ! FastStringBuffer buf = new FastStringBuffer(); char lastChar = '\0'; for (int i = 0; i < cs.length; i++) { char c = cs[i]; ! ! if (c == '\'' || c == '"') { //ignore comments or multiline comments... i = ParsingUtils.eatLiterals(cs, buf, i); ! ! } else if (c == '#') { i = ParsingUtils.eatComments(cs, buf, i); ! ! } else if (c == ',') { ! i = formatForComma(std, cs, buf, i); ! ! } else if (c == '(') { ! i = formatForPar(cs, i, std, buf); ! ! } else { ! if (c == '\r' || c == '\n') { ! if (lastChar == ',' && std.spaceAfterComma) { ! buf.deleteLast(); ! } ! } buf.append(c); } *************** *** 162,232 **** * @param i */ ! private static int formatForPar(char[] cs, int i, FormatStd std, StringBuffer buf) { char c = ' '; ! StringBuffer locBuf = new StringBuffer(); ! ! int j = i+1; ! while(j < cs.length && (c = cs[j]) != ')'){ ! j++; ! ! if(c == '\'' || c == '"'){ //ignore comments or multiline comments... ! j = ParsingUtils.eatLiterals( cs, locBuf, j-1)+1; ! ! }else if(c == '#'){ ! j = ParsingUtils.eatComments(cs, locBuf, j-1)+1; ! ! }else if( c == '('){ //open another par. ! j = formatForPar(cs, j-1, std, locBuf)+1; ! ! }else{ locBuf.append(c); } } ! ! if(c == ')'){ ! char c1; ! StringBuffer buf1 = new StringBuffer(); ! ! if(locBuf.indexOf("\n") != -1){ ! for (int k = locBuf.length(); k > 0 && (c1 = locBuf.charAt(k-1))!= '\n'; k--) { ! buf1.insert(0, c1); ! } } ! ! String formatStr = formatStr(trim(locBuf), std); ! formatStr = trim(new StringBuffer(formatStr)); ! ! String closing = ")"; ! if(buf1.length() > 0 && PySelection.containsOnlyWhitespaces(buf1.toString())){ ! formatStr += buf1.toString(); ! }else if(std.parametersWithSpace){ ! closing = " )"; ! } ! ! if(std.parametersWithSpace){ ! if(formatStr.length() == 0){ ! buf.append( "()" ); ! ! }else{ ! buf.append( "( " ); ! buf.append( formatStr ); ! buf.append( closing ); ! } ! }else{ ! buf.append( "(" ); ! buf.append( formatStr ); ! buf.append( closing ); ! } ! return j; ! }else{ return i; } } - - /** * We just want to trim whitespaces, not newlines! --- 161,230 ---- * @param i */ ! private static int formatForPar(char[] cs, int i, FormatStd std, FastStringBuffer buf) { char c = ' '; ! FastStringBuffer locBuf = new FastStringBuffer(); ! ! int j = i + 1; ! while (j < cs.length && (c = cs[j]) != ')') { ! j++; ! ! if (c == '\'' || c == '"') { //ignore comments or multiline comments... ! j = ParsingUtils.eatLiterals(cs, locBuf, j - 1) + 1; ! ! } else if (c == '#') { ! j = ParsingUtils.eatComments(cs, locBuf, j - 1) + 1; ! ! } else if (c == '(') { //open another par. ! j = formatForPar(cs, j - 1, std, locBuf) + 1; ! ! } else { locBuf.append(c); } } ! ! if (c == ')') { ! char c1; ! FastStringBuffer buf1 = new FastStringBuffer(); ! ! if (locBuf.indexOf('\n') != -1) { ! for (int k = locBuf.length(); k > 0 && (c1 = locBuf.charAt(k - 1)) != '\n'; k--) { ! buf1.insert(0, c1); ! } } ! ! String formatStr = formatStr(trim(locBuf).toString(), std); ! FastStringBuffer formatStrBuf = trim(new FastStringBuffer(formatStr, 10)); ! ! String closing = ")"; ! if (buf1.length() > 0 && PySelection.containsOnlyWhitespaces(buf1.toString())) { ! formatStrBuf.append(buf1); ! ! } else if (std.parametersWithSpace) { ! closing = " )"; ! } ! ! if (std.parametersWithSpace) { ! if (formatStrBuf.length() == 0) { ! buf.append("()"); ! ! } else { ! buf.append("( "); ! buf.append(formatStrBuf); ! buf.append(closing); ! } ! } else { ! buf.append('('); ! buf.append(formatStrBuf); ! buf.append(closing); ! } ! return j; ! } else { return i; } } /** * We just want to trim whitespaces, not newlines! *************** *** 234,245 **** * @return */ ! private static String trim(StringBuffer locBuf) { ! while(locBuf.length() > 0 && locBuf.charAt(0) == ' '){ locBuf.deleteCharAt(0); } ! while(locBuf.length() > 0 && locBuf.charAt(locBuf.length()-1) == ' '){ ! locBuf.deleteCharAt(locBuf.length()-1); } ! return locBuf.toString(); } --- 232,243 ---- * @return */ ! private static FastStringBuffer trim(FastStringBuffer locBuf) { ! while (locBuf.length() > 0 && locBuf.firstChar() == ' ') { locBuf.deleteCharAt(0); } ! while (locBuf.length() > 0 && locBuf.lastChar() == ' ') { ! locBuf.deleteLast(); } ! return locBuf; } *************** *** 251,262 **** * @return */ ! private static int formatForComma(FormatStd std, char[] cs, StringBuffer buf, int i) { ! while(i < cs.length-1 && (cs[i+1]) == ' '){ i++; } ! ! if(std.spaceAfterComma){ buf.append(", "); ! }else{ buf.append(','); } --- 249,260 ---- * @return */ ! private static int formatForComma(FormatStd std, char[] cs, FastStringBuffer buf, int i) { ! while (i < cs.length - 1 && (cs[i + 1]) == ' ') { i++; } ! ! if (std.spaceAfterComma) { buf.append(", "); ! } else { buf.append(','); } |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:45:19
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/copiedfromeclipsesrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1992/src/org/python/copiedfromeclipsesrc Modified Files: PythonCodeReader.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: PythonCodeReader.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/copiedfromeclipsesrc/PythonCodeReader.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PythonCodeReader.java 15 Jul 2007 20:09:38 -0000 1.9 --- PythonCodeReader.java 15 Jun 2008 16:45:26 -0000 1.10 *************** *** 115,124 **** switch (current) { case '#': ! fOffset = ParsingUtils.eatComments(fDocument, new StringBuffer(), fOffset); return current; case '"': case '\'': ! fOffset = ParsingUtils.eatLiterals(fDocument, new StringBuffer(), fOffset-1)+1; continue; } --- 115,124 ---- switch (current) { case '#': ! fOffset = ParsingUtils.eatComments(fDocument, null, fOffset); return current; case '"': case '\'': ! fOffset = ParsingUtils.eatLiterals(fDocument, null, fOffset-1)+1; continue; } |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:45:19
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/autoedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1992/src/org/python/pydev/editor/autoedit Modified Files: PyAutoIndentStrategy.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: PyAutoIndentStrategy.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/autoedit/PyAutoIndentStrategy.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** PyAutoIndentStrategy.java 14 Jun 2008 22:14:57 -0000 1.68 --- PyAutoIndentStrategy.java 15 Jun 2008 16:45:26 -0000 1.69 *************** *** 764,768 **** char peer = DocUtils.getPeer(c); ! StringBuffer doc = new StringBuffer(document.get()); //it is not enough just counting the chars, we have to ignore those that are within comments or literals. ParsingUtils.removeCommentsWhitespacesAndLiterals(doc); --- 764,768 ---- char peer = DocUtils.getPeer(c); ! FastStringBuffer doc = new FastStringBuffer(document.get(), 2); //it is not enough just counting the chars, we have to ignore those that are within comments or literals. ParsingUtils.removeCommentsWhitespacesAndLiterals(doc); |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:45:19
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1992/src_completions/org/python/pydev/editor/codecompletion Modified Files: PyContextInformationValidator.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: PyContextInformationValidator.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/PyContextInformationValidator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyContextInformationValidator.java 12 Apr 2008 15:41:17 -0000 1.4 --- PyContextInformationValidator.java 15 Jun 2008 16:45:26 -0000 1.5 *************** *** 20,23 **** --- 20,24 ---- import org.eclipse.swt.custom.StyleRange; import org.python.pydev.core.docutils.ParsingUtils; + import org.python.pydev.core.structure.FastStringBuffer; import org.python.pydev.plugin.PydevPlugin; *************** *** 218,222 **** case '"': case '\'': ! int eaten = ParsingUtils.eatLiterals(document, new StringBuffer(), offset - 1) + 1; if (eaten > offset) { offset = eaten; --- 219,223 ---- case '"': case '\'': ! int eaten = ParsingUtils.eatLiterals(document, null, offset - 1) + 1; if (eaten > offset) { offset = eaten; |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:45:14
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1941/src/org/python/pydev/core/docutils Modified Files: WordUtils.java ParsingUtils.java PySelection.java ImportHandle.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: PySelection.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils/PySelection.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** PySelection.java 19 May 2008 00:58:28 -0000 1.62 --- PySelection.java 15 Jun 2008 16:45:20 -0000 1.63 *************** *** 29,32 **** --- 29,33 ---- import org.python.pydev.core.ICodeCompletionASTManager.ImportInfo; import org.python.pydev.core.log.Log; + import org.python.pydev.core.structure.FastStringBuffer; /** *************** *** 179,183 **** */ public int getLineAvailableForImport() { ! StringBuffer multiLineBuf = new StringBuffer(); int[] firstGlobalLiteral = getFirstGlobalLiteral(multiLineBuf, 0); --- 180,184 ---- */ public int getLineAvailableForImport() { ! FastStringBuffer multiLineBuf = new FastStringBuffer(); int[] firstGlobalLiteral = getFirstGlobalLiteral(multiLineBuf, 0); *************** *** 232,236 **** if(importInfo != null && importInfo.importsTipperStr != null && importInfo.importsTipperStr.trim().length() > 0){ if((i = str.indexOf('(')) != -1){ - StringBuffer buf = new StringBuffer(); //start of a multiline import int lineOffset = -1; --- 233,236 ---- *************** *** 240,244 **** throw new RuntimeException(e1); } ! int j = ParsingUtils.eatPar(document, lineOffset+i, buf); try { line = document.getLineOfOffset(j); --- 240,244 ---- throw new RuntimeException(e1); } ! int j = ParsingUtils.eatPar(document, lineOffset+i, null); try { line = document.getLineOfOffset(j); *************** *** 268,272 **** * @return a tuple with the offset of the start and end of the first multiline comment found */ ! public int[] getFirstGlobalLiteral(StringBuffer buf, int initialOffset){ try { IDocument d = getDoc(); --- 268,272 ---- * @return a tuple with the offset of the start and end of the first multiline comment found */ ! public int[] getFirstGlobalLiteral(FastStringBuffer buf, int initialOffset){ try { IDocument d = getDoc(); *************** *** 327,331 **** public static String getLineWithoutCommentsOrLiterals(String l) { ! StringBuffer buf = new StringBuffer(l); ParsingUtils.removeCommentsWhitespacesAndLiterals(buf, false); return buf.toString(); --- 327,331 ---- public static String getLineWithoutCommentsOrLiterals(String l) { ! FastStringBuffer buf = new FastStringBuffer(l, 2); ParsingUtils.removeCommentsWhitespacesAndLiterals(buf, false); return buf.toString(); *************** *** 337,341 **** public static String getLineWithoutLiterals(String line) { ! StringBuffer buf = new StringBuffer(line); ParsingUtils.removeLiterals(buf); return buf.toString(); --- 337,341 ---- public static String getLineWithoutLiterals(String line) { ! FastStringBuffer buf = new FastStringBuffer(line, 2); ParsingUtils.removeLiterals(buf); return buf.toString(); *************** *** 851,858 **** } int lineOffset = getStartLineOffset(); - StringBuffer buf = new StringBuffer(); String docContents = doc.get(); int i = lineOffset + openParIndex; ! int j = ParsingUtils.eatPar(docContents, i, buf); String insideParentesisTok = docContents.substring(i + 1, j); --- 851,857 ---- } int lineOffset = getStartLineOffset(); String docContents = doc.get(); int i = lineOffset + openParIndex; ! int j = ParsingUtils.eatPar(docContents, i, null); String insideParentesisTok = docContents.substring(i + 1, j); Index: ParsingUtils.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils/ParsingUtils.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ParsingUtils.java 18 May 2008 20:02:26 -0000 1.19 --- ParsingUtils.java 15 Jun 2008 16:45:20 -0000 1.20 *************** *** 11,14 **** --- 11,15 ---- import org.eclipse.jface.text.IDocumentPartitionerExtension2; import org.python.pydev.core.IPythonPartitions; + import org.python.pydev.core.structure.FastStringBuffer; *************** *** 22,26 **** * @return the : position */ ! public static int eatToColon(char[] cs, StringBuffer buf, int i) { while(i < cs.length && cs[i] != ':'){ buf.append(cs[i]); --- 23,27 ---- * @return the : position */ ! public static int eatToColon(char[] cs, FastStringBuffer buf, int i) { while(i < cs.length && cs[i] != ':'){ buf.append(cs[i]); *************** *** 35,49 **** /** * @param cs the char array we are parsing ! * @param buf used to add the comments contents (out) * @param i the # position * @return the end of the comments position (end of document or new line char) */ ! public static int eatComments(Object cs, StringBuffer buf, int i) { while(i < len(cs) && charAt(cs,i) != '\n' && charAt(cs,i) != '\r'){ ! buf.append(charAt(cs,i)); i++; } if(i < len(cs)) ! buf.append(charAt(cs,i)); return i; --- 36,55 ---- /** * @param cs the char array we are parsing ! * @param buf used to add the comments contents (out) -- if it's null, it'll simply advance to the position and ! * return it. * @param i the # position * @return the end of the comments position (end of document or new line char) */ ! public static int eatComments(Object cs, FastStringBuffer buf, int i) { while(i < len(cs) && charAt(cs,i) != '\n' && charAt(cs,i) != '\r'){ ! if(buf != null){ ! buf.append(charAt(cs,i)); ! } i++; } if(i < len(cs)) ! if(buf != null){ ! buf.append(charAt(cs,i)); ! } return i; *************** *** 70,74 **** * @return the end of the token position (end of document or new line char or whitespace) */ ! public static int eatToken(char[] cs, StringBuffer buf, int i) { while(i < cs.length && !Character.isWhitespace(cs[i])){ buf.append(cs[i]); --- 76,80 ---- * @return the end of the token position (end of document or new line char or whitespace) */ ! public static int eatToken(char[] cs, FastStringBuffer buf, int i) { while(i < cs.length && !Character.isWhitespace(cs[i])){ buf.append(cs[i]); *************** *** 87,91 **** * @return the end of the literal position (or end of document) */ ! public static int eatLiterals(Object cs, StringBuffer buf, int i) { //ok, current pos is ' or " //check if we're starting a single or multiline comment... --- 93,97 ---- * @return the end of the literal position (or end of document) */ ! public static int eatLiterals(Object cs, FastStringBuffer buf, int i) { //ok, current pos is ' or " //check if we're starting a single or multiline comment... *************** *** 131,139 **** * @return the end of the literal position (or end of document) */ ! public static int eatPar(Object cs, int i, StringBuffer buf) { return eatPar(cs, i, buf, '('); } ! public static int eatPar(Object cs, int i, StringBuffer buf, char par) { char c = ' '; --- 137,148 ---- * @return the end of the literal position (or end of document) */ ! public static int eatPar(Object cs, int i, FastStringBuffer buf) { return eatPar(cs, i, buf, '('); } ! /** ! * @param buf if null, it'll simply advance without adding anything to the buffer. ! */ ! public static int eatPar(Object cs, int i, FastStringBuffer buf, char par) { char c = ' '; *************** *** 146,160 **** if(c == '\'' || c == '"'){ //ignore comments or multiline comments... ! j = ParsingUtils.eatLiterals( cs, new StringBuffer(), j-1)+1; }else if(c == '#'){ ! j = ParsingUtils.eatComments(cs, new StringBuffer(), j-1)+1; }else if( c == par){ //open another par. ! j = eatPar(cs, j-1, new StringBuffer(), par)+1; }else{ ! ! buf.append(c); } } --- 155,170 ---- if(c == '\'' || c == '"'){ //ignore comments or multiline comments... ! j = ParsingUtils.eatLiterals( cs, null, j-1)+1; }else if(c == '#'){ ! j = ParsingUtils.eatComments(cs, null, j-1)+1; }else if( c == par){ //open another par. ! j = eatPar(cs, j-1, null, par)+1; }else{ ! if(buf != null){ ! buf.append(c); ! } } } *************** *** 213,216 **** --- 223,229 ---- return ((char[]) o)[i]; } + if (o instanceof FastStringBuffer) { + return ((FastStringBuffer) o).charAt(i); + } if (o instanceof StringBuffer) { return ((StringBuffer) o).charAt(i); *************** *** 233,236 **** --- 246,252 ---- return ((char[]) o).length; } + if (o instanceof FastStringBuffer) { + return ((FastStringBuffer) o).length(); + } if (o instanceof StringBuffer) { return ((StringBuffer) o).length(); *************** *** 269,273 **** } ! public static int eatWhitespaces(StringBuffer buf, int i) { while(i < buf.length() && Character.isWhitespace(buf.charAt(i))){ i++; --- 285,289 ---- } ! public static int eatWhitespaces(FastStringBuffer buf, int i) { while(i < buf.length() && Character.isWhitespace(buf.charAt(i))){ i++; *************** *** 276,284 **** } ! public static void removeCommentsWhitespacesAndLiterals(StringBuffer buf) { removeCommentsWhitespacesAndLiterals(buf, true); } /** ! * Removes all the comments, whitespaces and literals from a stringbuffer (might be useful when * just finding matches for something). * --- 292,300 ---- } ! public static void removeCommentsWhitespacesAndLiterals(FastStringBuffer buf) { removeCommentsWhitespacesAndLiterals(buf, true); } /** ! * Removes all the comments, whitespaces and literals from a FastStringBuffer (might be useful when * just finding matches for something). * *************** *** 288,292 **** * @param whitespacesToo: are you sure about the whitespaces? */ ! public static void removeCommentsWhitespacesAndLiterals(StringBuffer buf, boolean whitespacesToo) { for (int i = 0; i < buf.length(); i++) { char ch = buf.charAt(i); --- 304,308 ---- * @param whitespacesToo: are you sure about the whitespaces? */ ! public static void removeCommentsWhitespacesAndLiterals(FastStringBuffer buf, boolean whitespacesToo) { for (int i = 0; i < buf.length(); i++) { char ch = buf.charAt(i); *************** *** 323,327 **** } } ! public static void removeLiterals(StringBuffer buf) { for (int i = 0; i < buf.length(); i++) { char ch = buf.charAt(i); --- 339,343 ---- } } ! public static void removeLiterals(FastStringBuffer buf) { for (int i = 0; i < buf.length(); i++) { char ch = buf.charAt(i); *************** *** 348,352 **** ! public static void removeCommentsAndWhitespaces(StringBuffer buf) { for (int i = 0; i < buf.length(); i++) { --- 364,368 ---- ! public static void removeCommentsAndWhitespaces(FastStringBuffer buf) { for (int i = 0; i < buf.length(); i++) { *************** *** 372,376 **** } ! public static void removeToClosingPar(StringBuffer buf) { int length = buf.length(); for (int i = length -1; i >= 0; i--) { --- 388,392 ---- } ! public static void removeToClosingPar(FastStringBuffer buf) { int length = buf.length(); for (int i = length -1; i >= 0; i--) { *************** *** 398,402 **** */ public static String getContentType(String initial, int currPos) { ! StringBuffer buf = new StringBuffer(initial); String curr = PY_DEFAULT; --- 414,418 ---- */ public static String getContentType(String initial, int currPos) { ! FastStringBuffer buf = new FastStringBuffer(initial, 0); String curr = PY_DEFAULT; *************** *** 449,453 **** public static String makePythonParseable(String code, String delimiter) { ! return makePythonParseable(code, delimiter, new StringBuffer()); } --- 465,469 ---- public static String makePythonParseable(String code, String delimiter) { ! return makePythonParseable(code, delimiter, new FastStringBuffer()); } *************** *** 458,464 **** * @return a String that can be passed to the shell */ ! public static String makePythonParseable(String code, String delimiter, StringBuffer lastLine) { ! StringBuffer buffer = new StringBuffer(); ! StringBuffer currLine = new StringBuffer(); //we may have line breaks with \r\n, or only \n or \r --- 474,480 ---- * @return a String that can be passed to the shell */ ! public static String makePythonParseable(String code, String delimiter, FastStringBuffer lastLine) { ! FastStringBuffer buffer = new FastStringBuffer(); ! FastStringBuffer currLine = new FastStringBuffer(); //we may have line breaks with \r\n, or only \n or \r *************** *** 498,507 **** buffer.append(currLine); lastLine = currLine; ! currLine = new StringBuffer(); buffer.append(delimiter); foundNewLine = true; }else{ //found a line only with whitespaces ! currLine = new StringBuffer(); } } --- 514,523 ---- buffer.append(currLine); lastLine = currLine; ! currLine = new FastStringBuffer(); buffer.append(delimiter); foundNewLine = true; }else{ //found a line only with whitespaces ! currLine = new FastStringBuffer(); } } Index: ImportHandle.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils/ImportHandle.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ImportHandle.java 11 Jun 2008 00:00:09 -0000 1.6 --- ImportHandle.java 15 Jun 2008 16:45:20 -0000 1.7 *************** *** 8,11 **** --- 8,12 ---- import org.eclipse.jface.text.IDocument; import org.python.pydev.core.Tuple; + import org.python.pydev.core.structure.FastStringBuffer; /** *************** *** 131,146 **** ArrayList<String> importComments = new ArrayList<String>(); ! StringBuffer alias = new StringBuffer(); for(int i=0;i<importedStr.length();i++){ char c = importedStr.charAt(i); if(c == '#'){ ! StringBuffer comments = new StringBuffer(); i = ParsingUtils.eatComments(importedStr, comments, i); addImportAlias(lst, importComments, alias, comments.toString()); ! alias = new StringBuffer(); }else if(c == ',' || c == '\r' || c == '\n'){ addImportAlias(lst, importComments, alias, ""); ! alias = new StringBuffer(); }else if(c == '(' || c == ')' || c == '\\'){ --- 132,148 ---- ArrayList<String> importComments = new ArrayList<String>(); ! FastStringBuffer alias = new FastStringBuffer(); ! FastStringBuffer comments = new FastStringBuffer(); for(int i=0;i<importedStr.length();i++){ char c = importedStr.charAt(i); if(c == '#'){ ! comments = comments.clear(); i = ParsingUtils.eatComments(importedStr, comments, i); addImportAlias(lst, importComments, alias, comments.toString()); ! alias = alias.clear(); }else if(c == ',' || c == '\r' || c == '\n'){ addImportAlias(lst, importComments, alias, ""); ! alias = alias.clear(); }else if(c == '(' || c == ')' || c == '\\'){ *************** *** 180,184 **** * @param importComment the comment related to the import */ ! private void addImportAlias(ArrayList<String> lst, ArrayList<String> importComments, StringBuffer alias, String importComment) { --- 182,186 ---- * @param importComment the comment related to the import */ ! private void addImportAlias(ArrayList<String> lst, ArrayList<String> importComments, FastStringBuffer alias, String importComment) { *************** *** 332,336 **** boolean startedInMiddle = false; ! StringBuffer imp = new StringBuffer(); for(int i=0;i<importFound.length();i++){ char c = importFound.charAt(i); --- 334,338 ---- boolean startedInMiddle = false; ! FastStringBuffer imp = new FastStringBuffer(); for(int i=0;i<importFound.length();i++){ char c = importFound.charAt(i); *************** *** 348,352 **** //that's ok, not a valid import (at least, we couldn't parse it) } ! imp = new StringBuffer(); startedInMiddle = true; }else{ --- 350,354 ---- //that's ok, not a valid import (at least, we couldn't parse it) } ! imp = imp.clear(); startedInMiddle = true; }else{ Index: WordUtils.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils/WordUtils.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WordUtils.java 11 Jun 2006 18:29:06 -0000 1.5 --- WordUtils.java 15 Jun 2008 16:45:20 -0000 1.6 *************** *** 1,4 **** --- 1,6 ---- package org.python.pydev.core.docutils; + import org.python.pydev.core.structure.FastStringBuffer; + *************** *** 521,524 **** --- 523,536 ---- } + public static boolean endsWith(FastStringBuffer str, char c) { + if(str.length() == 0){ + return false; + } + if(str.charAt(str.length()-1) == c){ + return true; + } + return false; + } + } |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:45:14
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/structure In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1941/src/org/python/pydev/core/structure Modified Files: FastStringBuffer.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: FastStringBuffer.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/structure/FastStringBuffer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FastStringBuffer.java 15 Jun 2008 13:15:04 -0000 1.3 --- FastStringBuffer.java 15 Jun 2008 16:45:20 -0000 1.4 *************** *** 14,18 **** * @author Fabio */ ! public final class FastStringBuffer { /** --- 14,18 ---- * @author Fabio */ ! public final class FastStringBuffer{ /** *************** *** 89,93 **** return this; } ! /** * Appends a char to the buffer. --- 89,93 ---- return this; } ! /** * Appends a char to the buffer. *************** *** 98,102 **** } value[count] = n; ! count ++; return this; } --- 98,102 ---- } value[count] = n; ! count++; return this; } *************** *** 117,121 **** return this; } ! /** * Appends an array of chars to the buffer. --- 117,121 ---- return this; } ! /** * Appends an array of chars to the buffer. *************** *** 152,156 **** } - /** * Reverses the contents on this buffer --- 152,155 ---- *************** *** 166,175 **** } - /** * Clears this buffer. */ ! public void clear() { this.count = 0; } --- 165,174 ---- } /** * Clears this buffer. */ ! public FastStringBuffer clear() { this.count = 0; + return this; } *************** *** 211,223 **** int len = str.length(); int newCount = count + len; ! if (newCount > value.length){ resizeForMinimum(newCount); } System.arraycopy(value, offset, value, offset + len, count - offset); ! str.getChars(0, str.length(), value, offset); count = newCount; return this; } ! /** * Inserts a char at a given position in the buffer. --- 210,222 ---- int len = str.length(); int newCount = count + len; ! if (newCount > value.length) { resizeForMinimum(newCount); } System.arraycopy(value, offset, value, offset + len, count - offset); ! str.getChars(0, len, value, offset); count = newCount; return this; } ! /** * Inserts a char at a given position in the buffer. *************** *** 225,229 **** public FastStringBuffer insert(int offset, char c) { int newCount = count + 1; ! if (newCount > value.length){ resizeForMinimum(newCount); } --- 224,228 ---- public FastStringBuffer insert(int offset, char c) { int newCount = count + 1; ! if (newCount > value.length) { resizeForMinimum(newCount); } *************** *** 238,242 **** */ public FastStringBuffer appendObject(Object object) { ! return append(object != null?object.toString():"null"); } --- 237,241 ---- */ public FastStringBuffer appendObject(Object object) { ! return append(object != null ? object.toString() : "null"); } *************** *** 248,250 **** --- 247,315 ---- } + public FastStringBuffer delete(int start, int end) { + if (start < 0) + throw new StringIndexOutOfBoundsException(start); + if (end > count) + end = count; + if (start > end) + throw new StringIndexOutOfBoundsException(); + int len = end - start; + if (len > 0) { + System.arraycopy(value, start + len, value, start, count - end); + count -= len; + } + return this; + } + + public FastStringBuffer replace(int start, int end, String str) { + if (start < 0) + throw new StringIndexOutOfBoundsException(start); + if (start > count) + throw new StringIndexOutOfBoundsException("start > length()"); + if (start > end) + throw new StringIndexOutOfBoundsException("start > end"); + if (end > count) + end = count; + + if (end > count) + end = count; + int len = str.length(); + int newCount = count + len - (end - start); + if (newCount > value.length) { + resizeForMinimum(newCount); + } + + System.arraycopy(value, end, value, start + len, count - end); + str.getChars(0, len, value, start); + count = newCount; + return this; + } + + public FastStringBuffer deleteCharAt(int index) { + if ((index < 0) || (index >= count)) { + throw new StringIndexOutOfBoundsException(index); + } + System.arraycopy(value, index + 1, value, index, count - index - 1); + count--; + return this; + } + + public int indexOf(char c) { + for(int i=0;i<this.count;i++){ + if(c == this.value[i]){ + return i; + } + } + return -1; + } + + public char firstChar() { + return this.value[0]; + } + + public char lastChar() { + return this.value[this.count-1]; + } + + } |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:45:14
|
Update of /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/structure In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1941/tests/org/python/pydev/core/structure Modified Files: FastStringBufferTest.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: FastStringBufferTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/structure/FastStringBufferTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FastStringBufferTest.java 15 Jun 2008 13:15:04 -0000 1.2 --- FastStringBufferTest.java 15 Jun 2008 16:45:20 -0000 1.3 *************** *** 34,37 **** --- 34,41 ---- fastString.insert(1, "."); assertEquals("a.22aabbcccdddddddddddddddddddddddddddddd$", fastString.toString()); + fastString.replace(0,1, "xxx"); + assertEquals("xxx.22aabbcccdddddddddddddddddddddddddddddd$", fastString.toString()); + fastString.delete(0,1); + assertEquals("xx.22aabbcccdddddddddddddddddddddddddddddd$", fastString.toString()); } |
From: Fabio Z. <fa...@us...> - 2008-06-15 16:45:14
|
Update of /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/docutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1941/tests/org/python/pydev/core/docutils Modified Files: ParsingUtilsTest.java Log Message: Minors: ParsingUtils accepts null instead of buffer (so, objects that don't need the actual values can just use it to skip comments, parenthesis, etc). Index: ParsingUtilsTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/docutils/ParsingUtilsTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ParsingUtilsTest.java 15 Jul 2007 20:09:46 -0000 1.7 --- ParsingUtilsTest.java 15 Jun 2008 16:45:20 -0000 1.8 *************** *** 9,12 **** --- 9,13 ---- import org.eclipse.jface.text.Document; + import org.python.pydev.core.structure.FastStringBuffer; public class ParsingUtilsTest extends TestCase { *************** *** 16,20 **** ParsingUtilsTest test = new ParsingUtilsTest(); test.setUp(); ! // test.testIterator8(); test.tearDown(); junit.textui.TestRunner.run(ParsingUtilsTest.class); --- 17,21 ---- ParsingUtilsTest test = new ParsingUtilsTest(); test.setUp(); ! test.testMakeParseable(); test.tearDown(); junit.textui.TestRunner.run(ParsingUtilsTest.class); *************** *** 296,300 **** "\na=10\n" + ""; ! assertEquals(expected, ParsingUtils.makePythonParseable(code, "\n", new StringBuffer(" pass"))); } --- 297,301 ---- "\na=10\n" + ""; ! assertEquals(expected, ParsingUtils.makePythonParseable(code, "\n", new FastStringBuffer(" pass", 16))); } |
From: Fabio Z. <fa...@us...> - 2008-06-15 13:15:04
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23162/src/org/python/pydev/editor/actions Modified Files: PyOrganizeImports.java Log Message: Comments / minors. Index: PyOrganizeImports.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyOrganizeImports.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PyOrganizeImports.java 14 Jun 2008 22:14:55 -0000 1.17 --- PyOrganizeImports.java 15 Jun 2008 13:15:10 -0000 1.18 *************** *** 228,232 **** if(breakWithParenthesis){ if(!addedParenForLine){ ! line.insert(lastFromXXXImportWritten.length(), "("); addedParenForLine = true; } --- 228,232 ---- if(breakWithParenthesis){ if(!addedParenForLine){ ! line.insert(lastFromXXXImportWritten.length(), '('); addedParenForLine = true; } *************** *** 234,238 **** line.append(indentStr); }else{ ! line.append("\\"); line.append(endLineDelim); line.append(indentStr); --- 234,238 ---- line.append(indentStr); }else{ ! line.append('\\'); line.append(endLineDelim); line.append(indentStr); *************** *** 247,251 **** if(addedParenForLine && i == importsAndNoComments.size()){ addedParenForLine = false; ! line.append(")"); } --- 247,251 ---- if(addedParenForLine && i == importsAndNoComments.size()){ addedParenForLine = false; ! line.append(')'); } *************** *** 255,261 **** if(addedParenForLine){ addedParenForLine = false; ! line.append(")"); } ! line.append(" "); line.append(tuple.o2); line.append(endLineDelim); --- 255,261 ---- if(addedParenForLine){ addedParenForLine = false; ! line.append(')'); } ! line.append(' '); line.append(tuple.o2); line.append(endLineDelim); *************** *** 270,274 **** if(addedParenForLine){ addedParenForLine = false; ! line.append(")"); } line.append(endLineDelim); --- 270,274 ---- if(addedParenForLine){ addedParenForLine = false; ! line.append(')'); } line.append(endLineDelim); *************** *** 303,307 **** all.append(importedString); if(comment.length() > 0){ ! all.append(" "); all.append(comment); } --- 303,307 ---- all.append(importedString); if(comment.length() > 0){ ! all.append(' '); all.append(comment); } |
From: Fabio Z. <fa...@us...> - 2008-06-15 13:15:04
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23162/src_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration Modified Files: AbstractJavaClassModule.java JavaProjectModulesManager.java Log Message: Comments / minors. Index: AbstractJavaClassModule.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration/AbstractJavaClassModule.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractJavaClassModule.java 14 Jun 2008 22:14:55 -0000 1.7 --- AbstractJavaClassModule.java 15 Jun 2008 13:15:10 -0000 1.8 *************** *** 210,214 **** */ public IToken[] getGlobalTokens(ICompletionState state, ICodeCompletionASTManager manager) { ! String act = name + "." + state.getActivationToken(); return createTokens(act); } --- 210,215 ---- */ public IToken[] getGlobalTokens(ICompletionState state, ICodeCompletionASTManager manager) { ! String actTok = state.getActivationToken(); ! String act = new FastStringBuffer(name, 2+actTok.length()).append('.').append(actTok).toString(); return createTokens(act); } *************** *** 298,302 **** for (int j = i; j < splitted.length; j++) { if (j != i) { ! pathInJavaClass.append("."); } pathInJavaClass.append(splitted[j]); --- 299,303 ---- for (int j = i; j < splitted.length; j++) { if (j != i) { ! pathInJavaClass.append('.'); } pathInJavaClass.append(splitted[j]); Index: JavaProjectModulesManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration/JavaProjectModulesManager.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** JavaProjectModulesManager.java 14 Jun 2008 22:14:55 -0000 1.12 --- JavaProjectModulesManager.java 15 Jun 2008 13:15:10 -0000 1.13 *************** *** 191,195 **** if(packageNameLen > 0){ buffer.append('.'); ! packageNameLen += 1; } --- 191,195 ---- if(packageNameLen > 0){ buffer.append('.'); ! packageNameLen++; } |
From: Fabio Z. <fa...@us...> - 2008-06-15 13:14:57
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/structure In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23038/src/org/python/pydev/core/structure Modified Files: FastStringBuffer.java Log Message: Comments / minors. Index: FastStringBuffer.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/structure/FastStringBuffer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FastStringBuffer.java 15 Jun 2008 12:44:22 -0000 1.2 --- FastStringBuffer.java 15 Jun 2008 13:15:04 -0000 1.3 *************** *** 2,8 **** /** ! * This is a custom string that works around char[] objects to provide minimum allocation/garbage collection overhead. ! * To be used mostly when several small concatenations of strings are used and in local contexts while reusing the ! * same object to create multiple strings. * * @author Fabio --- 2,14 ---- /** ! * This is a custom string buffer optimized for append(), clear() and deleteLast(). ! * ! * Basically it aims at being created once, being used for something, having clear() called and then reused ! * (ultimately providing minimum allocation/garbage collection overhead for that use-case). ! * ! * append() is optimizing by doing less checks (so, exceptions thrown may be uglier on invalid operations ! * and null is not checked for in the common case -- use appendObject if it may be null). ! * ! * clear() and deleteLast() only change the internal count and have almost zero overhead. * * @author Fabio *************** *** 48,52 **** /** ! * Appends a string to the buffer */ public FastStringBuffer append(String string) { --- 54,58 ---- /** ! * Appends a string to the buffer. Passing a null string will throw an exception. */ public FastStringBuffer append(String string) { *************** *** 63,71 **** } private void resizeForMinimum(int minimumCapacity) { int newCapacity = (value.length + 1) * 2; ! if (newCapacity < 0) { ! newCapacity = Integer.MAX_VALUE; ! } else if (minimumCapacity > newCapacity) { newCapacity = minimumCapacity; } --- 69,78 ---- } + /** + * Resizes the internal buffer to have at least the minimum capacity passed (but may be more) + */ private void resizeForMinimum(int minimumCapacity) { int newCapacity = (value.length + 1) * 2; ! if (minimumCapacity > newCapacity) { newCapacity = minimumCapacity; } *************** *** 75,78 **** --- 82,88 ---- } + /** + * Appends an int to the buffer. + */ public final FastStringBuffer append(int n) { append(String.valueOf(n)); *************** *** 80,83 **** --- 90,96 ---- } + /** + * Appends a char to the buffer. + */ public final FastStringBuffer append(char n) { if (count + 1 > value.length) { *************** *** 89,92 **** --- 102,108 ---- } + /** + * Appends a long to the buffer. + */ public final FastStringBuffer append(long n) { append(String.valueOf(n)); *************** *** 94,102 **** } public final FastStringBuffer append(boolean b) { append(String.valueOf(b)); return this; } ! public FastStringBuffer append(char[] chars) { int newCount = count + chars.length; --- 110,124 ---- } + /** + * Appends a boolean to the buffer. + */ public final FastStringBuffer append(boolean b) { append(String.valueOf(b)); return this; } ! ! /** ! * Appends an array of chars to the buffer. ! */ public FastStringBuffer append(char[] chars) { int newCount = count + chars.length; *************** *** 109,112 **** --- 131,137 ---- } + /** + * Appends another buffer to this buffer. + */ public FastStringBuffer append(FastStringBuffer other) { append(other.value, 0, other.count); *************** *** 114,126 **** } public FastStringBuffer append(char[] chars, int offset, int len) { ! if (count + len > value.length) { ! resizeForMinimum(count + len); } System.arraycopy(chars, offset, value, count, len); ! count += len; return this; } public FastStringBuffer reverse() { final int limit = count / 2; --- 139,159 ---- } + /** + * Appends an array of chars to this buffer, starting at the offset passed with the length determined. + */ public FastStringBuffer append(char[] chars, int offset, int len) { ! int newCount = count + len; ! if (newCount > value.length) { ! resizeForMinimum(newCount); } System.arraycopy(chars, offset, value, count, len); ! count = newCount; return this; } + + /** + * Reverses the contents on this buffer + */ public FastStringBuffer reverse() { final int limit = count / 2; *************** *** 133,144 **** --- 166,187 ---- } + + /** + * Clears this buffer. + */ public void clear() { this.count = 0; } + /** + * @return the length of this buffer + */ public int length() { return this.count; } + /** + * @return a new stringt with the contents of this buffer. + */ @Override public String toString() { *************** *** 146,149 **** --- 189,195 ---- } + /** + * Erases the last char in this buffer + */ public void deleteLast() { if (this.count > 0) { *************** *** 152,159 **** --- 198,211 ---- } + /** + * @return the char given at a specific position of the buffer (no bounds check) + */ public char charAt(int i) { return this.value[i]; } + /** + * Inserts a string at a given position in the buffer. + */ public FastStringBuffer insert(int offset, String str) { int len = str.length(); *************** *** 167,175 **** return this; } ! public FastStringBuffer appendObject(Object attribute) { ! return append(attribute != null?attribute.toString():"null"); } public void setCount(int newLen) { this.count = newLen; --- 219,247 ---- return this; } + + /** + * Inserts a char at a given position in the buffer. + */ + public FastStringBuffer insert(int offset, char c) { + int newCount = count + 1; + if (newCount > value.length){ + resizeForMinimum(newCount); + } + System.arraycopy(value, offset, value, offset + 1, count - offset); + value[offset] = c; + count = newCount; + return this; + } ! /** ! * Appends object.toString(). If null, "null" is appended. ! */ ! public FastStringBuffer appendObject(Object object) { ! return append(object != null?object.toString():"null"); } + /** + * Sets the new size of this buffer (warning: use with care: no validation is done of the len passed) + */ public void setCount(int newLen) { this.count = newLen; |
From: Fabio Z. <fa...@us...> - 2008-06-15 13:14:57
|
Update of /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/structure In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23038/tests/org/python/pydev/core/structure Modified Files: FastStringBufferTest.java Log Message: Comments / minors. Index: FastStringBufferTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/structure/FastStringBufferTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FastStringBufferTest.java 14 Jun 2008 22:14:27 -0000 1.1 --- FastStringBufferTest.java 15 Jun 2008 13:15:04 -0000 1.2 *************** *** 32,35 **** --- 32,37 ---- fastString.append('$'); assertEquals("a22aabbcccdddddddddddddddddddddddddddddd$", fastString.toString()); + fastString.insert(1, "."); + assertEquals("a.22aabbcccdddddddddddddddddddddddddddddd$", fastString.toString()); } |
From: Fabio Z. <fa...@us...> - 2008-06-15 12:44:16
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/structure In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7244/src/org/python/pydev/core/structure Modified Files: FastStringBuffer.java Log Message: Minor Index: FastStringBuffer.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/structure/FastStringBuffer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FastStringBuffer.java 14 Jun 2008 22:14:27 -0000 1.1 --- FastStringBuffer.java 15 Jun 2008 12:44:22 -0000 1.2 *************** *** 52,61 **** public FastStringBuffer append(String string) { int strLen = string.length(); ! if (this.count + strLen > this.value.length) { ! resizeForMinimum(this.count + strLen); } string.getChars(0, strLen, value, this.count); ! this.count += strLen; return this; --- 52,62 ---- public FastStringBuffer append(String string) { int strLen = string.length(); + int newCount = count + strLen; ! if (newCount > this.value.length) { ! resizeForMinimum(newCount); } string.getChars(0, strLen, value, this.count); ! this.count = newCount; return this; *************** *** 84,88 **** } value[count] = n; ! count += 1; return this; } --- 85,89 ---- } value[count] = n; ! count ++; return this; } *************** *** 99,107 **** public FastStringBuffer append(char[] chars) { ! if (count + chars.length > value.length) { ! resizeForMinimum(count + chars.length); } System.arraycopy(chars, 0, value, count, chars.length); ! count += chars.length; return this; } --- 100,109 ---- public FastStringBuffer append(char[] chars) { ! int newCount = count + chars.length; ! if (newCount > value.length) { ! resizeForMinimum(newCount); } System.arraycopy(chars, 0, value, count, chars.length); ! count = newCount; return this; } *************** *** 146,150 **** public void deleteLast() { if (this.count > 0) { ! this.count -= 1; } } --- 148,152 ---- public void deleteLast() { if (this.count > 0) { ! this.count--; } } |
From: Fabio Z. <fa...@us...> - 2008-06-15 01:25:28
|
Update of /cvsroot/pydev/org.python.pydev.debug/src_console/org/python/pydev/debug/newconsole/prefs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2965/src_console/org/python/pydev/debug/newconsole/prefs Modified Files: InteractiveConsolePrefs.java Log Message: Using API compatible with eclipse 3.2 to create preferences. Index: InteractiveConsolePrefs.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src_console/org/python/pydev/debug/newconsole/prefs/InteractiveConsolePrefs.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InteractiveConsolePrefs.java 4 Apr 2008 02:54:42 -0000 1.2 --- InteractiveConsolePrefs.java 15 Jun 2008 01:25:35 -0000 1.3 *************** *** 13,16 **** --- 13,20 ---- public class InteractiveConsolePrefs extends FieldEditorPreferencePage implements IWorkbenchPreferencePage{ + public InteractiveConsolePrefs() { + super(FLAT); + } + @Override protected void createFieldEditors() { *************** *** 40,44 **** setDescription("Pydev interactive console preferences."); setPreferenceStore(PydevDebugPlugin.getDefault().getPreferenceStore()); - } --- 44,47 ---- |
From: Fabio Z. <fa...@us...> - 2008-06-15 01:15:11
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31379/src/org/python/pydev/debug/codecoverage Modified Files: PyCodeCoverageView.java Log Message: Minor: when asking for code-coverage location, cancel is handled. Index: PyCodeCoverageView.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/PyCodeCoverageView.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PyCodeCoverageView.java 22 Jun 2006 23:46:17 -0000 1.10 --- PyCodeCoverageView.java 15 Jun 2008 01:15:13 -0000 1.11 *************** *** 23,26 **** --- 23,27 ---- import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.TreeViewer; + import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; *************** *** 249,253 **** public void run() { ContainerSelectionDialog dialog = new ContainerSelectionDialog(getSite().getShell(), null, false, "Test"); ! dialog.open(); Object[] objects = dialog.getResult(); if (objects.length == 1) { //only one folder can be selected --- 250,256 ---- public void run() { ContainerSelectionDialog dialog = new ContainerSelectionDialog(getSite().getShell(), null, false, "Test"); ! if (dialog.open() != Window.OK) { ! return; ! } Object[] objects = dialog.getResult(); if (objects.length == 1) { //only one folder can be selected |
From: Fabio Z. <fa...@us...> - 2008-06-15 01:12:57
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30223 Modified Files: Changes.txt Log Message: Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/Changes.txt,v retrieving revision 1.394 retrieving revision 1.395 diff -C2 -d -r1.394 -r1.395 *** Changes.txt 14 Jun 2008 22:14:57 -0000 1.394 --- Changes.txt 15 Jun 2008 01:13:03 -0000 1.395 *************** *** 14,17 **** --- 14,19 ---- <li><strong>Executing external programs</strong>: Using Runtime.exec(String[] cmdargs) instead of the version accepting only a string.</li> <li><strong>Organize Imports (ctrl+shift+O)</strong>: Imports can be grouped.</li> + <li><strong>Cygwin</strong>: sys.executable in cygwin was not returning '.exe' in the end as it should.</li> + <li><strong>Additional paths for PYTHONPATH</strong>: extension point allows plugins to contribute paths to the PYTHONPATH.</li> </ul> |
From: Fabio Z. <fa...@us...> - 2008-06-15 01:11:03
|
Update of /cvsroot/pydev/org.python.pydev/PySrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29788/PySrc Modified Files: interpreterInfo.py Log Message: Cygwin sys.executable not correct. http://sourceforge.net/tracker/index.php?func=detail&aid=1986733&group_id=85796&atid=577329 Index: interpreterInfo.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/interpreterInfo.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** interpreterInfo.py 12 Apr 2008 13:01:26 -0000 1.24 --- interpreterInfo.py 15 Jun 2008 01:11:09 -0000 1.25 *************** *** 33,36 **** --- 33,37 ---- ctypes.cdll.cygwin1.cygwin_conv_to_win32_path(path, retval) #@UndefinedVariable return retval.value + else: def nativePath(path): *************** *** 54,57 **** --- 55,62 ---- except: executable = sys.executable + + if sys.platform == "cygwin" and not executable.endswith('.exe'): + executable += '.exe' + try: |
From: Fabio Z. <fa...@us...> - 2008-06-15 00:45:49
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/nature In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19863/src/org/python/pydev/plugin/nature Modified Files: PythonPathNature.java Added Files: IPythonPathContributor.java Log Message: Applied patch: pythonpath contribution extension point http://sourceforge.net/tracker/index.php?func=detail&aid=1988084&group_id=85796&atid=577329 --- NEW FILE: IPythonPathContributor.java --- package org.python.pydev.plugin.nature; import org.eclipse.core.resources.IProject; /** * Plugins can contribute one of these if they wish to add implicit entries * to a project's classpath. */ public interface IPythonPathContributor { /** * Returns the additional python path entries (for the given project) * separated by a | character. * * @param aProject */ public String getAdditionalPythonPath(IProject aProject); } Index: PythonPathNature.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/nature/PythonPathNature.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** PythonPathNature.java 14 Jun 2008 22:14:55 -0000 1.27 --- PythonPathNature.java 15 Jun 2008 00:45:56 -0000 1.28 *************** *** 22,25 **** --- 22,26 ---- import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.QualifiedName; + import org.python.pydev.core.ExtensionHelper; import org.python.pydev.core.IModulesManager; import org.python.pydev.core.IPythonPathNature; *************** *** 110,113 **** --- 111,115 ---- String source = getProjectSourcePath(); String external = getProjectExternalSourcePath(); + String contributed = getContributedSourcePath(); if(source == null){ *************** *** 158,162 **** external = ""; } ! return buf.append("|").append(external).toString(); } --- 160,190 ---- external = ""; } ! return buf.append("|").append(external).append("|").append(contributed).toString(); ! } ! ! ! /** ! * Gets the source path contributed by plugins. ! * ! * See: http://sourceforge.net/tracker/index.php?func=detail&aid=1988084&group_id=85796&atid=577329 ! * ! * @throws CoreException ! */ ! private String getContributedSourcePath() throws CoreException { ! FastStringBuffer buff = new FastStringBuffer(); ! synchronized (buff) { ! List contributors = ExtensionHelper.getParticipants("org.python.pydev.pydev_pythonpath_contrib"); ! for (Object contribObj : contributors) { ! IPythonPathContributor contributor = (IPythonPathContributor) contribObj; ! String additionalPythonPath = contributor.getAdditionalPythonPath(project); ! if (additionalPythonPath != null && additionalPythonPath.trim().length() > 0) { ! if (buff.length() > 0){ ! buff.append("|"); ! } ! buff.append(additionalPythonPath.trim()); ! } ! } ! } ! return buff.toString(); } |
From: Fabio Z. <fa...@us...> - 2008-06-15 00:45:49
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19863 Modified Files: plugin.xml Log Message: Applied patch: pythonpath contribution extension point http://sourceforge.net/tracker/index.php?func=detail&aid=1988084&group_id=85796&atid=577329 Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.205 retrieving revision 1.206 diff -C2 -d -r1.205 -r1.206 *** plugin.xml 18 May 2008 20:02:16 -0000 1.205 --- plugin.xml 15 Jun 2008 00:45:56 -0000 1.206 *************** *** 988,991 **** --- 988,992 ---- <extension-point id="pydev_globals_browser" name="Pydev Globals Browser" schema="schema/pydev_globals_browser.exsd"/> <extension-point id="pydev_debug_preferences_page" name="Pydev Debug Preferences Page" schema="schema/pydev_debug_preferences_page.exsd"/> + <extension-point id="pydev_pythonpath_contrib" name="Python Path Contributor" schema="schema/pydev_pythonpath_contrib.exsd"/> <!-- wizards --> <extension point="org.eclipse.ui.newWizards"> |
From: Fabio Z. <fa...@us...> - 2008-06-15 00:45:49
|
Update of /cvsroot/pydev/org.python.pydev/schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19863/schema Added Files: pydev_pythonpath_contrib.exsd Log Message: Applied patch: pythonpath contribution extension point http://sourceforge.net/tracker/index.php?func=detail&aid=1988084&group_id=85796&atid=577329 --- NEW FILE: pydev_pythonpath_contrib.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.python.pydev"> <annotation> <appInfo> <meta.schema plugin="org.python.pydev" id="pydev_pythonpath_contrib" name="Python Path Contributor"/> </appInfo> <documentation> Applied from patch: http://sourceforge.net/tracker/index.php?func=detail&aid=1988084&group_id=85796&atid=577329 Important: these paths will only be available for new projects. For this to work in existing projects, the user must explicitly go to project > properties > PyDev - PYTHONPATH and click 'Force restore internal info' or re-configure the interpreter (which does restore the internal info too). </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="path_contributor" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="path_contributor"> <complexType> <attribute name="class" type="string" use="required"> <annotation> <documentation> </documentation> <appInfo> <meta.attribute kind="java" basedOn=":org.python.pydev.plugin.nature.IPythonPathContributor"/> </appInfo> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="since"/> </appInfo> <documentation> [Enter the first release in which this extension point appears.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> To provide c:\temp to be available in the pythonpath, do: <extension point="org.python.pydev.pydev_pythonpath_contrib"> <path_contributor class="org.MyPathContributor"/> </extension> package org; import org.eclipse.core.resources.IProject; import org.python.pydev.plugin.nature.IPythonPathContributor; public class MyPathContributor implements IPythonPathContributor { public MyPathContributor() { } public String getAdditionalPythonPath(IProject project) { return "c:\\temp"; } } </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> More info can be found at the IPythonPathContributor interface. </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> [Enter information about supplied implementation of this extension point.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> </documentation> </annotation> </schema> |
From: Fabio Z. <fa...@us...> - 2008-06-14 23:58:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1397/pysrc Modified Files: coverage.py Log Message: Fixed LazyImporter issue with coverage.py Index: coverage.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/coverage.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** coverage.py 24 Jan 2008 20:26:30 -0000 1.13 --- coverage.py 14 Jun 2008 23:58:54 -0000 1.14 *************** *** 565,569 **** def morf_filename(self, morf): ! if isinstance(morf, (types.ModuleType, email.LazyImporter)): if not hasattr(morf, '__file__'): raise CoverageException("Module has no __file__ attribute.") --- 565,569 ---- def morf_filename(self, morf): ! if isinstance(morf, types.ModuleType) or (hasattr(email, 'LazyImporter') and isinstance(morf, email.LazyImporter)): if not hasattr(morf, '__file__'): raise CoverageException("Module has no __file__ attribute.") *************** *** 785,789 **** """ Return the name of morf as used in report. """ ! if isinstance(morf, (types.ModuleType, email.LazyImporter)): return morf.__name__ else: --- 785,789 ---- """ Return the name of morf as used in report. """ ! if isinstance(morf, types.ModuleType) or (hasattr(email, 'LazyImporter') and isinstance(morf, email.LazyImporter)): return morf.__name__ else: |
From: Fabio Z. <fa...@us...> - 2008-06-14 23:35:57
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/shell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25682/src_completions/org/python/pydev/editor/codecompletion/shell Modified Files: JythonShell.java Log Message: Fixed problem while creating jython shell. Index: JythonShell.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/shell/JythonShell.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JythonShell.java 21 May 2008 01:38:08 -0000 1.4 --- JythonShell.java 14 Jun 2008 23:36:04 -0000 1.5 *************** *** 25,31 **** @Override protected synchronized String createServerProcess(int pWrite, int pRead) throws IOException, JDTNotAvailableException { - String args = pWrite+" "+pRead; String script = REF.getFileAbsolutePath(serverFile); ! String[] executableStr = SimpleJythonRunner.makeExecutableCommandStr(script, "", args); process = SimpleRunner.createProcess(executableStr, serverFile.getParentFile()); --- 25,30 ---- @Override protected synchronized String createServerProcess(int pWrite, int pRead) throws IOException, JDTNotAvailableException { String script = REF.getFileAbsolutePath(serverFile); ! String[] executableStr = SimpleJythonRunner.makeExecutableCommandStr(script, "", String.valueOf(pWrite), String.valueOf(pRead)); process = SimpleRunner.createProcess(executableStr, serverFile.getParentFile()); |
From: Fabio Z. <fa...@us...> - 2008-06-14 23:35:57
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/runners In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25682/src/org/python/pydev/runners Modified Files: SimpleJythonRunner.java Log Message: Fixed problem while creating jython shell. Index: SimpleJythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** SimpleJythonRunner.java 14 Jun 2008 22:14:55 -0000 1.27 --- SimpleJythonRunner.java 14 Jun 2008 23:36:05 -0000 1.28 *************** *** 123,138 **** if(cacheDir != null){ cacheDir = "-Dpython.cachedir="+ cacheDir.trim(); } ! String[] s = new String[]{ ! javaLoc , ! cacheDir, ! "-Dpython.path="+ jythonPath.toString(), ! "-classpath", ! jythonJar+pathSeparator+jythonPath, ! vmArgs, ! "org.python.util.jython", ! script ! }; List<String> asList = new ArrayList<String>(Arrays.asList(s)); --- 123,154 ---- if(cacheDir != null){ cacheDir = "-Dpython.cachedir="+ cacheDir.trim(); + } + + String[] s; + if(cacheDir != null){ + s = new String[]{ + javaLoc , + cacheDir, + "-Dpython.path="+ jythonPath.toString(), + "-classpath", + jythonJar+pathSeparator+jythonPath, + vmArgs, + "org.python.util.jython", + script + }; + }else{ + s = new String[]{ + javaLoc , + //cacheDir, no cache dir if it's not available + "-Dpython.path="+ jythonPath.toString(), + "-classpath", + jythonJar+pathSeparator+jythonPath, + vmArgs, + "org.python.util.jython", + script + }; } ! List<String> asList = new ArrayList<String>(Arrays.asList(s)); |