pydev-cvs Mailing List for PyDev for Eclipse (Page 6)
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-08-21 20:56:20
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19176/src/org/python/pydev/outline Modified Files: PyOutlinePage.java OutlineLinkWithEditorAction.java Log Message: Minor changes for console / possible race condition on linking with outline page. Index: PyOutlinePage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/PyOutlinePage.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** PyOutlinePage.java 4 Feb 2008 23:39:05 -0000 1.25 --- PyOutlinePage.java 21 Aug 2008 20:56:28 -0000 1.26 *************** *** 259,273 **** unlinkAll(); StructuredSelection sel = (StructuredSelection)event.getSelection(); if(sel.size() == 1) { // only sync the editing view if it is a single-selection ParsedItem firstElement = (ParsedItem) sel.getFirstElement(); ErrorDescription errorDesc = firstElement.getErrorDesc(); if(errorDesc != null && errorDesc.message != null){ int len = errorDesc.errorEnd-errorDesc.errorStart; editorView.setSelection(errorDesc.errorStart, len); ! return; } } ! SimpleNode[] node = model.getSelectionPosition(sel); ! editorView.revealModelNodes(node); }finally{ relinkAll(); --- 259,279 ---- unlinkAll(); StructuredSelection sel = (StructuredSelection)event.getSelection(); + + boolean alreadySelected = false; if(sel.size() == 1) { // only sync the editing view if it is a single-selection ParsedItem firstElement = (ParsedItem) sel.getFirstElement(); ErrorDescription errorDesc = firstElement.getErrorDesc(); + + //select the error if(errorDesc != null && errorDesc.message != null){ int len = errorDesc.errorEnd-errorDesc.errorStart; editorView.setSelection(errorDesc.errorStart, len); ! alreadySelected = true; } } ! if(!alreadySelected){ ! SimpleNode[] node = model.getSelectionPosition(sel); ! editorView.revealModelNodes(node); ! } }finally{ relinkAll(); *************** *** 299,313 **** } void unlinkAll() { ! removeSelectionChangedListener(selectionListener); ! if(linkWithEditor != null){ ! linkWithEditor.unlink(); } } void relinkAll() { ! addSelectionChangedListener(selectionListener); ! if(linkWithEditor != null){ ! linkWithEditor.relink(); } } --- 305,343 ---- } + /** + * Used to hold a link level to know when it should be unlinked or relinked, as calls can be 'cascaded' + */ + private volatile Integer linkLevel = 1; + + /** + * Stops listening to changes (the linkLevel is used so that multiple unlinks can be called and later + * multiple relinks should be used) + */ void unlinkAll() { ! synchronized (linkLevel) { ! linkLevel--; ! if(linkLevel == 0){ ! removeSelectionChangedListener(selectionListener); ! if(linkWithEditor != null){ ! linkWithEditor.unlink(); ! } ! } } } + /** + * Starts listening to changes again if the number of relinks matches the number of unlinks + */ void relinkAll() { ! synchronized (linkLevel) { ! linkLevel++; ! if(linkLevel == 1){ ! addSelectionChangedListener(selectionListener); ! if(linkWithEditor != null){ ! linkWithEditor.relink(); ! } ! }else if(linkLevel > 1){ ! throw new RuntimeException("Error: relinking without unlinking 1st"); ! } } } Index: OutlineLinkWithEditorAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/OutlineLinkWithEditorAction.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OutlineLinkWithEditorAction.java 5 Feb 2008 23:11:12 -0000 1.8 --- OutlineLinkWithEditorAction.java 21 Aug 2008 20:56:28 -0000 1.9 *************** *** 25,28 **** --- 25,34 ---- * editor. * + * Design notes: + * It's linked on the constructor and unlinked in the destructor. + * + * It considers that it's always linked, even if the action is inactive, but before executing it, a + * check is done to see if it's active or not. + * * @author Fabio */ *************** *** 40,43 **** --- 46,52 ---- } + /** + * When called, it STOPS hearing notifications to update the outline when the cursor changes positions. + */ public void unlink() { PyEdit edit = pyEdit.get(); *************** *** 47,50 **** --- 56,62 ---- } + /** + * When called, it STARTS hearing notifications to update the outline when the cursor changes positions. + */ public void relink() { PyEdit edit = pyEdit.get(); *************** *** 158,161 **** --- 170,176 ---- + /** + * @return The parsed item that should be selected given the startLine passed. + */ private ParsedItem findSel(ParsedItem r, int startLine) { ParsedItem prev = null; |
From: Fabio Z. <fa...@us...> - 2008-08-21 18:25:10
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/autoedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22203/src/org/python/pydev/editor/autoedit Modified Files: PyAutoIndentStrategy.java Log Message: Auto-indent prefs fixed (https://sourceforge.net/tracker/?func=detail&atid=577329&aid=2064164&group_id=85796) Index: PyAutoIndentStrategy.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/autoedit/PyAutoIndentStrategy.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** PyAutoIndentStrategy.java 9 Jul 2008 19:11:00 -0000 1.71 --- PyAutoIndentStrategy.java 21 Aug 2008 18:25:18 -0000 1.72 *************** *** 576,583 **** */ private void applyDefaultForTab(DocumentCommand command, int lineContentsToCursorLen) { ! int tabWidth = getIndentPrefs().getTabWidth(); - int mod = (lineContentsToCursorLen+tabWidth) % tabWidth; - command.text = DocUtils.createSpaceString(tabWidth-mod); } --- 576,589 ---- */ private void applyDefaultForTab(DocumentCommand command, int lineContentsToCursorLen) { ! IIndentPrefs prefs = getIndentPrefs(); ! if(prefs.getUseSpaces()){ ! int tabWidth = getIndentPrefs().getTabWidth(); ! ! int mod = (lineContentsToCursorLen+tabWidth) % tabWidth; ! command.text = DocUtils.createSpaceString(tabWidth-mod); ! }else{ ! //do nothing (a tab is already a tab) ! } } |
From: Fabio Z. <fa...@us...> - 2008-08-21 18:25:09
|
Update of /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22203/tests/org/python/pydev/editor Modified Files: PyAutoIndentStrategyTest.java Log Message: Auto-indent prefs fixed (https://sourceforge.net/tracker/?func=detail&atid=577329&aid=2064164&group_id=85796) Index: PyAutoIndentStrategyTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/PyAutoIndentStrategyTest.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** PyAutoIndentStrategyTest.java 3 Jul 2008 01:04:04 -0000 1.66 --- PyAutoIndentStrategyTest.java 21 Aug 2008 18:25:18 -0000 1.67 *************** *** 26,30 **** PyAutoIndentStrategyTest s = new PyAutoIndentStrategyTest("testt"); s.setUp(); ! s.testNoIndent(); s.tearDown(); junit.textui.TestRunner.run(PyAutoIndentStrategyTest.class); --- 26,30 ---- PyAutoIndentStrategyTest s = new PyAutoIndentStrategyTest("testt"); s.setUp(); ! s.testTab3(); s.tearDown(); junit.textui.TestRunner.run(PyAutoIndentStrategyTest.class); *************** *** 138,141 **** --- 138,151 ---- } + public void testTab3() { + strategy.setIndentPrefs(new TestIndentPrefs(false, 4)); + String str = "\tprint 'foo'"; + DocCmd docCmd = new DocCmd(1, 0, "\t"); + Document document = new Document(str); + strategy.customizeDocumentCommand(document, docCmd); + assertEquals("\t", docCmd.text); + assertEquals(str, document.get()); //as we already have a selection, nothing should be deleted + } + public void testSpaces() { strategy.setIndentPrefs(new TestIndentPrefs(true, 4)); |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:49
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7013/pysrc Modified Files: pydevd_file_utils.py pydevd.py Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** pydevd.py 13 Aug 2008 21:12:24 -0000 1.97 --- pydevd.py 17 Aug 2008 00:26:56 -0000 1.98 *************** *** 635,639 **** if not sys.platform.startswith("java"): ! print >> sys.stderr, 'pydev debugger: warning: psyco not available for debugger speedups' --- 635,639 ---- if not sys.platform.startswith("java"): ! print >> sys.stderr, "pydev debugger: warning: psyco not available for speedups (the debugger will still work correctly, but a bit slower)" Index: pydevd_file_utils.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd_file_utils.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pydevd_file_utils.py 6 Aug 2008 16:21:41 -0000 1.6 --- pydevd_file_utils.py 17 Aug 2008 00:26:56 -0000 1.7 *************** *** 41,46 **** --- 41,50 ---- import os.path import sys + import traceback + normcase = os.path.normcase basename = os.path.basename + exists = os.path.exists + join = os.path.join try: *************** *** 78,81 **** --- 82,113 ---- NORM_FILENAME_CONTAINER[filename] = r return r + + #Now, let's do a quick test to see if we're working with a version of python that has no problems + #related to the names generated... + try: + if not exists(_NormFile(rPath.func_code.co_filename)): + print >> sys.stderr, '-------------------------------------------------------------------------------' + print >> sys.stderr, 'pydev debugger: CRITICAL WARNING: This version of python seems to be incorrectly compiled (internal generated filenames are not absolute)' + print >> sys.stderr, 'pydev debugger: The debugger may still function, but it will work slower and may miss breakpoints.' + print >> sys.stderr, 'pydev debugger: Related bug: http://bugs.python.org/issue1666807' + print >> sys.stderr, '-------------------------------------------------------------------------------' + + initial_norm_file = _NormFile + def _NormFile(filename): #Let's redefine _NormFile to work with paths that may be incorrect + ret = initial_norm_file(filename) + if not exists(ret): + #We must actually go on and check if we can find it as if it was a relative path for some of the paths in the pythonpath + for path in sys.path: + ret = initial_norm_file(join(path, filename)) + if exists(ret): + break + else: + print >> sys.stderr, 'pydev debugger: Unable to find real location for: %s' % filename + ret = filename + + return ret + except: + #Don't fail if there's something not correct here -- but at least print it to the user so that we can correct that + traceback.print_exc() |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:48
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7013/src/org/python/pydev/debug/model Modified Files: AbstractDebugTarget.java PyDebugTarget.java PySourceLocator.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: AbstractDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/AbstractDebugTarget.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AbstractDebugTarget.java 13 Aug 2008 21:12:24 -0000 1.16 --- AbstractDebugTarget.java 17 Aug 2008 00:26:56 -0000 1.17 *************** *** 48,51 **** --- 48,52 ---- import org.python.pydev.debug.model.remote.ThreadListCommand; import org.python.pydev.debug.model.remote.VersionCommand; + import org.python.pydev.debug.ui.launching.PythonRunnerConfig; import org.python.pydev.plugin.PydevPlugin; *************** *** 60,64 **** * Path pointing to the file that started the debug (e.g.: file with __name__ == '__main__') */ ! protected IPath file; /** --- 61,65 ---- * Path pointing to the file that started the debug (e.g.: file with __name__ == '__main__') */ ! protected IPath[] file; /** *************** *** 127,131 **** public String getName() throws DebugException { if (file != null) ! return file.lastSegment(); else return "unknown"; --- 128,132 ---- public String getName() throws DebugException { if (file != null) ! return PythonRunnerConfig.getRunningName(file); else return "unknown"; *************** *** 619,623 **** // used by Variable ContextManager, and Project:Properties menu item if( file!=null ) { ! IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(file); if (files != null && files.length > 0){ --- 620,624 ---- // used by Variable ContextManager, and Project:Properties menu item if( file!=null ) { ! IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(file[0]); if (files != null && files.length > 0){ Index: PySourceLocator.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PySourceLocator.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PySourceLocator.java 6 Aug 2008 16:23:11 -0000 1.9 --- PySourceLocator.java 17 Aug 2008 00:26:56 -0000 1.10 *************** *** 13,17 **** import org.python.pydev.editor.PyEdit; import org.python.pydev.editorinput.PySourceLocatorBase; - import org.python.pydev.plugin.PydevPlugin; /** --- 13,16 ---- Index: PyDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyDebugTarget.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PyDebugTarget.java 24 Jun 2006 01:45:53 -0000 1.19 --- PyDebugTarget.java 17 Aug 2008 00:26:56 -0000 1.20 *************** *** 24,28 **** private IProcess process; ! public PyDebugTarget(ILaunch launch, IProcess process, IPath file, RemoteDebugger debugger) { this.launch = launch; this.process = process; --- 24,28 ---- private IProcess process; ! public PyDebugTarget(ILaunch launch, IProcess process, IPath[] file, RemoteDebugger debugger) { this.launch = launch; this.process = process; |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:48
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7013/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunnerConfig.java AbstractLaunchShortcut.java PythonRunner.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: PythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunner.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** PythonRunner.java 28 Jun 2008 12:35:43 -0000 1.37 --- PythonRunner.java 17 Aug 2008 00:26:56 -0000 1.38 *************** *** 13,16 **** --- 13,17 ---- import org.eclipse.core.runtime.CoreException; + import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; *************** *** 235,239 **** HashMap<Object, Object> processAttributes = new HashMap<Object, Object>(); processAttributes.put(IProcess.ATTR_CMDLINE, config.getCommandLineAsString()); ! return registerWithDebugPlugin(config.resource.lastSegment(), launch,p, processAttributes); } --- 236,240 ---- HashMap<Object, Object> processAttributes = new HashMap<Object, Object>(); processAttributes.put(IProcess.ATTR_CMDLINE, config.getCommandLineAsString()); ! return registerWithDebugPlugin(config.getRunningName(), launch,p, processAttributes); } Index: PythonRunnerConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** PythonRunnerConfig.java 21 May 2008 01:38:15 -0000 1.66 --- PythonRunnerConfig.java 17 Aug 2008 00:26:56 -0000 1.67 *************** *** 32,35 **** --- 32,36 ---- import org.python.pydev.core.REF; import org.python.pydev.core.docutils.StringUtils; + import org.python.pydev.core.structure.FastStringBuffer; import org.python.pydev.debug.codecoverage.PyCoverage; import org.python.pydev.debug.core.Constants; *************** *** 59,63 **** public IProject project; ! public IPath resource; public IPath interpreter; public String interpreterLocation; --- 60,64 ---- public IProject project; ! public IPath[] resource; public IPath interpreter; public String interpreterLocation; *************** *** 105,119 **** * system */ ! public static IPath getLocation(ILaunchConfiguration configuration) throws CoreException { ! String location = configuration.getAttribute(Constants.ATTR_LOCATION, (String) null); ! if (location == null) { throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unable to get location for run", null)); } else { ! String expandedLocation = getStringVariableManager().performStringSubstitution(location); ! if (expandedLocation == null || expandedLocation.length() == 0) { ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unable to get expanded location for run", null)); ! } else { ! return new Path(expandedLocation); ! } } } --- 106,128 ---- * system */ ! public static IPath[] getLocation(ILaunchConfiguration configuration) throws CoreException { ! String locationsStr = configuration.getAttribute(Constants.ATTR_LOCATION, (String) null); ! ! if (locationsStr == null) { throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unable to get location for run", null)); } else { ! String[] locations = StringUtils.split(locationsStr, '|'); ! Path[] ret = new Path[locations.length]; ! int i=0; ! for(String location:locations){ ! String expandedLocation = getStringVariableManager().performStringSubstitution(location); ! if (expandedLocation == null || expandedLocation.length() == 0) { ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unable to get expanded location for run", null)); ! } else { ! ret[i] = new Path(expandedLocation); ! } ! i++; ! } ! return ret; } } *************** *** 431,436 **** public String getRunningName() { ! return resource.lastSegment(); } --- 440,458 ---- + public static String getRunningName(IPath[] paths) { + FastStringBuffer buf = new FastStringBuffer(20*paths.length); + for(IPath p:paths){ + if(buf.length() > 0){ + buf.append(" - "); + } + buf.append(p.lastSegment()); + } + return buf.toString(); + + } + + public String getRunningName() { ! return getRunningName(resource); } *************** *** 581,585 **** } ! cmdArgs.add(resource.toOSString()); String runArguments[] = null; --- 603,609 ---- } ! for(IPath p:resource){ ! cmdArgs.add(p.toOSString()); ! } String runArguments[] = null; Index: AbstractLaunchShortcut.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/AbstractLaunchShortcut.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AbstractLaunchShortcut.java 12 Apr 2008 19:51:14 -0000 1.17 --- AbstractLaunchShortcut.java 17 Aug 2008 00:26:56 -0000 1.18 *************** *** 39,42 **** --- 39,43 ---- import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.python.pydev.core.IInterpreterManager; + import org.python.pydev.core.structure.FastStringBuffer; import org.python.pydev.debug.core.Constants; import org.python.pydev.debug.core.PydevDebugPlugin; *************** *** 339,346 **** private static String makeFileRelativeToWorkspace(IResource[] resource, IStringVariableManager varManager) { ! String moduleFile; ! moduleFile = resource[0].getFullPath().makeRelative().toString(); ! moduleFile = varManager.generateVariableExpression("workspace_loc", moduleFile); ! return moduleFile; } --- 340,353 ---- private static String makeFileRelativeToWorkspace(IResource[] resource, IStringVariableManager varManager) { ! FastStringBuffer moduleFile = new FastStringBuffer(80*resource.length); ! for(IResource r:resource){ ! String m = r.getFullPath().makeRelative().toString(); ! m = varManager.generateVariableExpression("workspace_loc", m); ! if(moduleFile.length() > 0){ ! moduleFile.append("|"); ! } ! moduleFile.append(m); ! } ! return moduleFile.toString(); } |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:48
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7013 Modified Files: plugin.xml Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** plugin.xml 12 Apr 2008 19:51:14 -0000 1.75 --- plugin.xml 17 Aug 2008 00:26:56 -0000 1.76 *************** *** 232,236 **** <enablement> <with variable="selection"> - <count value="1"/> <iterate> <or> --- 232,235 ---- |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/blocks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7013/src/org/python/pydev/debug/ui/blocks Modified Files: MainModuleBlock.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: MainModuleBlock.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/blocks/MainModuleBlock.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MainModuleBlock.java 12 Apr 2008 19:51:13 -0000 1.3 --- MainModuleBlock.java 17 Aug 2008 00:26:56 -0000 1.4 *************** *** 30,33 **** --- 30,34 ---- import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Widget; + import org.python.pydev.core.docutils.StringUtils; import org.python.pydev.debug.core.Constants; import org.python.pydev.plugin.nature.PythonNature; *************** *** 245,258 **** String location = fMainModuleText.getText(); try { ! String expandedLocation = stringVariableManager.performStringSubstitution(location); ! File file = new File(expandedLocation); ! if(!file.exists()){ ! setErrorMessage("The file in the location does not exist."); ! result = false; ! } ! else if(!file.isFile()) { ! setErrorMessage("The file in the location is not actually a file."); ! result = false; } } catch (CoreException e) { setErrorMessage("Unable to resolve location"); --- 246,279 ---- String location = fMainModuleText.getText(); try { ! ! String identifier = launchConfig.getType().getIdentifier(); ! if(identifier.equals(Constants.ID_PYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE) || ! identifier.equals(Constants.ID_JYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE) || ! identifier.equals(Constants.ID_PYTHON_COVERAGE_LAUNCH_CONFIGURATION_TYPE)){ ! ! //may have multiple files selected for the run for unitest and code-coverage ! for(String loc:StringUtils.split(location, '|')){ ! String expandedLocation = stringVariableManager.performStringSubstitution(loc); ! File file = new File(expandedLocation); ! if(!file.exists()){ ! setErrorMessage(StringUtils.format("The file \"%s\" does not exist.", file)); ! result = false; ! break; ! } ! ! } ! }else{ ! String expandedLocation = stringVariableManager.performStringSubstitution(location); ! File file = new File(expandedLocation); ! if(!file.exists()){ ! setErrorMessage(StringUtils.format("The file \"%s\" does not exist.", file)); ! result = false; ! ! }else if(!file.isFile()) { ! setErrorMessage(StringUtils.format("The file \"%s\" does not actually map to a file.", file)); ! result = false; ! } } + } catch (CoreException e) { setErrorMessage("Unable to resolve location"); |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7013/src/org/python/pydev/debug/codecoverage Modified Files: FileNode.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: FileNode.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/FileNode.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FileNode.java 16 Jun 2008 00:55:38 -0000 1.6 --- FileNode.java 17 Aug 2008 00:26:56 -0000 1.7 *************** *** 94,98 **** /** ! * */ public Iterator<Object> notExecutedIterator() { --- 94,98 ---- /** ! * @return an iterator with the lines that were not executed */ public Iterator<Object> notExecutedIterator() { *************** *** 101,108 **** String[] toks = notExecuted.replaceAll(" ", "").split(","); for (int i = 0; i < toks.length; i++) { ! if(toks[i].indexOf("-") == -1){ ! l.add(new Integer(toks[i])); }else{ ! String[] begEnd = toks[i].split("-"); for (int j = Integer.parseInt(begEnd[0]) ; j <= Integer.parseInt(begEnd[1]); j++){ l.add(new Integer(j)); --- 101,112 ---- String[] toks = notExecuted.replaceAll(" ", "").split(","); for (int i = 0; i < toks.length; i++) { ! String tok = toks[i].trim(); ! if(tok.length() == 0){ ! continue; ! } ! if(tok.indexOf("-") == -1){ ! l.add(new Integer(tok)); }else{ ! String[] begEnd = tok.split("-"); for (int j = Integer.parseInt(begEnd[0]) ; j <= Integer.parseInt(begEnd[1]); j++){ l.add(new Integer(j)); |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/src_console/org/python/pydev/debug/newconsole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7013/src_console/org/python/pydev/debug/newconsole Modified Files: PydevConsole.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: PydevConsole.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src_console/org/python/pydev/debug/newconsole/PydevConsole.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PydevConsole.java 28 Jun 2008 12:35:43 -0000 1.8 --- PydevConsole.java 17 Aug 2008 00:26:56 -0000 1.9 *************** *** 12,15 **** --- 12,16 ---- import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; + import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextHover; *************** *** 18,21 **** --- 19,23 ---- import org.eclipse.ui.console.IHyperlink; import org.eclipse.ui.console.IOConsoleOutputStream; + import org.eclipse.ui.console.IPatternMatchListener; import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.debug.newconsole.prefs.ColorManager; *************** *** 34,38 **** * @author Fabio */ ! public class PydevConsole extends ScriptConsole implements IConsole { public static final String CONSOLE_NAME = "Pydev Console"; --- 36,40 ---- * @author Fabio */ ! public class PydevConsole extends ScriptConsole { public static final String CONSOLE_NAME = "Pydev Console"; *************** *** 138,142 **** List<IConsoleLineTracker> lineTrackers = new ArrayList<IConsoleLineTracker>(); PythonConsoleLineTracker lineTracker = new PythonConsoleLineTracker(); ! lineTracker.init(this); lineTrackers.add(lineTracker); return lineTrackers; --- 140,181 ---- List<IConsoleLineTracker> lineTrackers = new ArrayList<IConsoleLineTracker>(); PythonConsoleLineTracker lineTracker = new PythonConsoleLineTracker(); ! ! //The IConsole we implement in this class is not the same IConsole that's needed in the ! //lineTracker, so, let's create a wrapper for this with the interfaces requested. ! lineTracker.init(new IConsole(){ ! ! //IMPLEMENTATIONS FORWARDED TO OUTER CLASS ! public void addLink(IConsoleHyperlink link, int offset, int length) { ! PydevConsole.this.addLink(link, offset, length); ! } ! public void addLink(IHyperlink link, int offset, int length) { ! PydevConsole.this.addLink(link, offset, length); ! } ! public void addPatternMatchListener( ! IPatternMatchListener matchListener) { ! PydevConsole.this.addPatternMatchListener(matchListener); ! } ! public IDocument getDocument() { ! return PydevConsole.this.getDocument(); ! } ! public IRegion getRegion(IConsoleHyperlink link) { ! return PydevConsole.this.getRegion(link); ! } ! public IRegion getRegion(IHyperlink link) { ! return PydevConsole.this.getRegion(link); ! } ! public void removePatternMatchListener( ! IPatternMatchListener matchListener) { ! PydevConsole.this.removePatternMatchListener(matchListener); ! } ! ! //IMPLEMENTATIONS THAT AREN'T REALLY AVAILABLE IN THE PYDEV CONSOLE ! public void connect(IStreamsProxy streamsProxy) {/**EMPTY**/} ! public void connect(IStreamMonitor streamMonitor, String streamIdentifer) {/**EMPTY**/} ! public IProcess getProcess() {return null;/**EMPTY**/} ! public IOConsoleOutputStream getStream(String streamIdentifier) {return null;/**EMPTY**/} ! }); ! ! lineTrackers.add(lineTracker); return lineTrackers; *************** *** 170,197 **** } - - //required by the IConsole interface -- because of hyperlinks (but not actually used) - public void connect(IStreamsProxy streamsProxy) { - throw new RuntimeException("Not implemented"); - } - //required by the IConsole interface -- because of hyperlinks (but not actually used) - public void connect(IStreamMonitor streamMonitor, String streamIdentifer) { - throw new RuntimeException("Not implemented"); - } - - //required by the IConsole interface -- because of hyperlinks (but not actually used) - public IProcess getProcess() { - throw new RuntimeException("Not implemented"); - } - - //required by the IConsole interface -- because of hyperlinks (but not actually used) - public IRegion getRegion(IConsoleHyperlink link) { - throw new RuntimeException("Not implemented"); - } - - //required by the IConsole interface -- because of hyperlinks (but not actually used) - public IOConsoleOutputStream getStream(String streamIdentifier) { - throw new RuntimeException("Not implemented"); - } } --- 209,212 ---- |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:39
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/visitors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/src_completions/org/python/pydev/editor/codecompletion/revisited/visitors Modified Files: GlobalModelVisitor.java AbstractVisitor.java LocalScope.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: LocalScope.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/visitors/LocalScope.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LocalScope.java 5 Jul 2008 21:52:55 -0000 1.8 --- LocalScope.java 17 Aug 2008 00:26:46 -0000 1.9 *************** *** 156,160 **** try { for (int i = 0; i < body.length; i++) { ! GlobalModelVisitor visitor = new GlobalModelVisitor(GlobalModelVisitor.GLOBAL_TOKENS, ""); stmtType stmt = body[i]; if(stmt == null){ --- 156,160 ---- try { for (int i = 0; i < body.length; i++) { ! GlobalModelVisitor visitor = new GlobalModelVisitor(GlobalModelVisitor.GLOBAL_TOKENS, "", false); stmtType stmt = body[i]; if(stmt == null){ *************** *** 235,239 **** stmtType stmt = f.body[i]; if(stmt != null){ ! importedModules.addAll(GlobalModelVisitor.getTokens(stmt, GlobalModelVisitor.ALIAS_MODULES, moduleName, null)); } } --- 235,239 ---- stmtType stmt = f.body[i]; if(stmt != null){ ! importedModules.addAll(GlobalModelVisitor.getTokens(stmt, GlobalModelVisitor.ALIAS_MODULES, moduleName, null, false)); } } Index: AbstractVisitor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/visitors/AbstractVisitor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractVisitor.java 4 Aug 2007 23:14:59 -0000 1.4 --- AbstractVisitor.java 17 Aug 2008 00:26:46 -0000 1.5 *************** *** 55,62 **** * @param node */ ! protected void addToken(SimpleNode node) { //add the token SourceToken t = makeToken(node, moduleName); this.tokens.add(t); } --- 55,63 ---- * @param node */ ! protected SourceToken addToken(SimpleNode node) { //add the token SourceToken t = makeToken(node, moduleName); this.tokens.add(t); + return t; } *************** *** 230,242 **** * @param state * @param name * @return * @throws Exception */ ! public static List<IToken> getTokens(SimpleNode ast, int which, String moduleName, ICompletionState state) { AbstractVisitor modelVisitor; if(which == INNER_DEFS){ modelVisitor = new InnerModelVisitor(moduleName, state); }else{ ! modelVisitor = new GlobalModelVisitor(which, moduleName); } --- 231,246 ---- * @param state * @param name + * @param onlyAllowTokensIn__all__: only used when checking global tokens: if true, if a token named __all__ is available, + * only the classes that have strings that match in __all__ are available. * @return * @throws Exception */ ! public static List<IToken> getTokens(SimpleNode ast, int which, String moduleName, ICompletionState state, ! boolean onlyAllowTokensIn__all__) { AbstractVisitor modelVisitor; if(which == INNER_DEFS){ modelVisitor = new InnerModelVisitor(moduleName, state); }else{ ! modelVisitor = new GlobalModelVisitor(which, moduleName, onlyAllowTokensIn__all__); } *************** *** 247,250 **** --- 251,255 ---- throw new RuntimeException(e); } + modelVisitor.finishVisit(); return modelVisitor.tokens; }else{ *************** *** 254,257 **** --- 259,271 ---- + /** + * This method is available so that subclasses can do some post-processing before the tokens are actually + * returned. + */ + protected void finishVisit() { + /**Empty**/ + } + + Index: GlobalModelVisitor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/visitors/GlobalModelVisitor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GlobalModelVisitor.java 2 May 2008 13:42:00 -0000 1.3 --- GlobalModelVisitor.java 17 Aug 2008 00:26:46 -0000 1.4 *************** *** 6,9 **** --- 6,13 ---- package org.python.pydev.editor.codecompletion.revisited.visitors; + import java.util.HashSet; + import java.util.Iterator; + + import org.python.pydev.core.IToken; import org.python.pydev.editor.codecompletion.revisited.modules.SourceToken; import org.python.pydev.parser.jython.SimpleNode; *************** *** 13,18 **** --- 17,24 ---- import org.python.pydev.parser.jython.ast.Import; import org.python.pydev.parser.jython.ast.ImportFrom; + import org.python.pydev.parser.jython.ast.List; import org.python.pydev.parser.jython.ast.Name; import org.python.pydev.parser.jython.ast.Str; + import org.python.pydev.parser.jython.ast.exprType; /** *************** *** 24,27 **** --- 30,37 ---- private int visitWhat; + private SourceToken __all__; + private Assign __all__Assign; + private Assign lastAssign; + private boolean onlyAllowTokensIn__all__; /** *************** *** 29,36 **** * @param global_tokens2 */ ! public GlobalModelVisitor(int visitWhat, String moduleName) { this.visitWhat = visitWhat; this.moduleName = moduleName; ! if(moduleName != null && moduleName.endsWith("__init__")){ this.tokens.add(new SourceToken(new Name("__path__", Name.Load), "__path__", "", "", moduleName)); --- 39,46 ---- * @param global_tokens2 */ ! public GlobalModelVisitor(int visitWhat, String moduleName, boolean onlyAllowTokensIn__all__) { this.visitWhat = visitWhat; this.moduleName = moduleName; ! this.onlyAllowTokensIn__all__ = onlyAllowTokensIn__all__; if(moduleName != null && moduleName.endsWith("__init__")){ this.tokens.add(new SourceToken(new Name("__path__", Name.Load), "__path__", "", "", moduleName)); *************** *** 68,71 **** --- 78,82 ---- */ public Object visitAssign(Assign node) throws Exception { + lastAssign = node; node.traverse(this); return null; *************** *** 81,85 **** if ((this.visitWhat & GLOBAL_TOKENS) != 0) { if (node.ctx == Name.Store) { ! addToken(node); } } --- 92,100 ---- if ((this.visitWhat & GLOBAL_TOKENS) != 0) { if (node.ctx == Name.Store) { ! SourceToken added = addToken(node); ! if(onlyAllowTokensIn__all__ && added.getRepresentation().equals("__all__")){ ! __all__ = added; ! __all__Assign = lastAssign; ! } } } *************** *** 125,127 **** --- 140,178 ---- return null; } + + + /** + * Overridden to check __all__ + */ + @Override + protected void finishVisit() { + if(__all__ != null){ + SimpleNode ast = __all__.getAst(); + //just checking it + if(__all__Assign.targets != null && __all__Assign.targets.length == 1 && __all__Assign.targets[0] == ast){ + HashSet<String> validTokensInAll = new HashSet<String>(); + exprType value = __all__Assign.value; + if(value instanceof List){ + List valueList = (List) value; + if(valueList.elts != null){ + for(exprType elt:valueList.elts){ + if(elt instanceof Str){ + Str str = (Str) elt; + validTokensInAll.add(str.s); + } + } + } + } + + if(validTokensInAll.size() > 0){ + for(Iterator<IToken> it = tokens.iterator();it.hasNext();){ + IToken tok = it.next(); + if(!validTokensInAll.contains(tok.getRepresentation())){ + it.remove(); + } + } + } + } + } + } } \ No newline at end of file |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:39
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943 Modified Files: Changes.txt Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/Changes.txt,v retrieving revision 1.414 retrieving revision 1.415 diff -C2 -d -r1.414 -r1.415 *** Changes.txt 13 Aug 2008 21:12:15 -0000 1.414 --- Changes.txt 17 Aug 2008 00:26:46 -0000 1.415 *************** *** 1,4 **** --- 1,10 ---- after 1.3.19 + Pydev Extensions + + <ul> + <li><strong>Code Analysis</strong>: Show error if using token not defined in __all__ in wild import.</li> + </ul> + Pydev <ul> *************** *** 7,13 **** <li><strong>Pydev debugger</strong>: watch working in eclipse 3.4</li> <li><strong>Pydev debugger</strong>: breakpoint properties accept new lines and tabs</li> ! <li><strong>Incremental find</strong>: backspace works correctly</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Launch icons</strong>: Transparent background (thanks to Radim Kubacki)</li> </ul> --- 13,25 ---- <li><strong>Pydev debugger</strong>: watch working in eclipse 3.4</li> <li><strong>Pydev debugger</strong>: breakpoint properties accept new lines and tabs</li> ! <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> ! <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> + <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> + <li><strong>Incremental find</strong>: backspace works correctly</li> <li><strong>Launch icons</strong>: Transparent background (thanks to Radim Kubacki)</li> + <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> + <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> + <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> </ul> |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:39
|
Update of /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/tests/org/python/pydev/editor/actions Modified Files: PyFormatStdTest.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: PyFormatStdTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/actions/PyFormatStdTest.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyFormatStdTest.java 19 Jul 2008 19:53:31 -0000 1.13 --- PyFormatStdTest.java 17 Aug 2008 00:26:46 -0000 1.14 *************** *** 25,29 **** n.setUp(); // DEBUG = true; ! n.testDontDisturbWildImport(); n.tearDown(); --- 25,29 ---- n.setUp(); // DEBUG = true; ! n.testCorrectExponentials(); n.tearDown(); *************** *** 502,505 **** --- 502,530 ---- + public void testCorrectExponentials(){ + std.spaceAfterComma = true; + std.parametersWithSpace = false; + std.operatorsWithSpace = true; + + + String s = "" + + "a = 1e-6\n" + //operators should not have space + "b = 1e+6\n" + + "c = 1e3 + 6\n" + + "d = 1e-3 - 6\n" + + "e = 1+3 - 6\n" + + ""; + + String s1 = "" + + "a = 1e-6\n" + //operators should not have space + "b = 1e+6\n" + + "c = 1e3 + 6\n" + + "d = 1e-3 - 6\n" + + "e = 1 + 3 - 6\n" + + ""; + + checkFormatResults(s, s1); + } + public void testEqualsWithSpace(){ std.spaceAfterComma = true; |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:39
|
Update of /cvsroot/pydev/org.python.pydev/tests_completions/org/python/pydev/editor/codecompletion In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/tests_completions/org/python/pydev/editor/codecompletion Modified Files: PythonCompletionWithoutBuiltinsTest.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: PythonCompletionWithoutBuiltinsTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests_completions/org/python/pydev/editor/codecompletion/PythonCompletionWithoutBuiltinsTest.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PythonCompletionWithoutBuiltinsTest.java 13 Aug 2008 21:12:17 -0000 1.21 --- PythonCompletionWithoutBuiltinsTest.java 17 Aug 2008 00:26:46 -0000 1.22 *************** *** 41,45 **** PythonCompletionWithoutBuiltinsTest test = new PythonCompletionWithoutBuiltinsTest(); test.setUp(); ! test.testClsCompletion(); test.tearDown(); System.out.println("Finished"); --- 41,45 ---- PythonCompletionWithoutBuiltinsTest test = new PythonCompletionWithoutBuiltinsTest(); test.setUp(); ! test.testWildImportWithAll(); test.tearDown(); System.out.println("Finished"); *************** *** 1117,1120 **** --- 1117,1129 ---- + public void testWildImportWithAll() throws Exception { + String s = + "from extendable.all_check import *\n" + + "This"; + + requestCompl(s, new String[] {"ThisGoes", "ThisGoesToo"}); + } + + } |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:38
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/src_completions/org/python/pydev/editor/codecompletion/revisited/modules Modified Files: SourceModule.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: SourceModule.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/modules/SourceModule.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** SourceModule.java 18 May 2008 20:02:16 -0000 1.19 --- SourceModule.java 17 Aug 2008 00:26:47 -0000 1.20 *************** *** 243,247 **** //we request all and put it into the cache (partitioned), because that's faster than making multiple runs through it ! List<IToken> ret = GlobalModelVisitor.getTokens(ast, all, name, state); --- 243,247 ---- //we request all and put it into the cache (partitioned), because that's faster than making multiple runs through it ! List<IToken> ret = GlobalModelVisitor.getTokens(ast, all, name, state, true); *************** *** 483,487 **** */ public List<IToken> getClassToks(ICompletionState initialState, ICodeCompletionASTManager manager, SimpleNode ast) { ! List<IToken> modToks = GlobalModelVisitor.getTokens(ast, GlobalModelVisitor.INNER_DEFS, name, initialState);//name = moduleName try { --- 483,487 ---- */ public List<IToken> getClassToks(ICompletionState initialState, ICodeCompletionASTManager manager, SimpleNode ast) { ! List<IToken> modToks = GlobalModelVisitor.getTokens(ast, GlobalModelVisitor.INNER_DEFS, name, initialState, false);//name = moduleName try { |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:38
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/src/org/python/pydev/editor/actions Modified Files: PyFormatStd.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: PyFormatStd.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyFormatStd.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PyFormatStd.java 19 Jul 2008 19:53:31 -0000 1.20 --- PyFormatStd.java 17 Aug 2008 00:26:46 -0000 1.21 *************** *** 231,234 **** --- 231,267 ---- case '+': case '-': + + if(c == '-' || c == '+'){ // could also be * + + //handle exponentials correctly: e.g.: 1e-6 cannot have a space + FastStringBuffer localBufToCheckNumber = new FastStringBuffer(); + for(int j=buf.length()-1;j>=0;j--){ + char localC = buf.charAt(j); + if(Character.isJavaIdentifierPart(localC)){ + localBufToCheckNumber.append(localC); + }else{ + break; + } + } + boolean isExponential = true;; + String partialNumber = localBufToCheckNumber.reverse().toString(); + int partialLen = partialNumber.length(); + if(partialLen < 2 || !Character.isDigit(partialNumber.charAt(0))){ + //at least 2 chars: the number and the 'e' + isExponential = false; + }else{ + //first char checked... now, if the last is an 'e', we must leave it together no matter what + if(partialNumber.charAt(partialLen-1) != 'e'){ + isExponential = false; + break; + } + } + if(isExponential){ + buf.append(c); + break; + } + //Otherwise, FALLTHROUGH + } + case '/': case '%': |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:38
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/src/org/python/pydev/editor/model Modified Files: ItemPointer.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: ItemPointer.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/model/ItemPointer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ItemPointer.java 16 Sep 2007 17:15:53 -0000 1.7 --- ItemPointer.java 17 Aug 2008 00:26:46 -0000 1.8 *************** *** 6,11 **** package org.python.pydev.editor.model; - import java.io.File; - import org.python.pydev.editor.codecompletion.revisited.visitors.Definition; import org.python.pydev.parser.jython.SimpleNode; --- 6,9 ---- *************** *** 19,28 **** public class ItemPointer { ! public Object file; // IFile or File object ! public Location start; // (first character) ! public Location end; // (last character) ! public Definition definition; //the definition that originated this ItemPointer (it might be null). ! public String zipFilePath; //the path within the zip file for this pointer (null if we're not dealing with a zip file) public ItemPointer(Object file) { this(file, new Location(), new Location()); --- 17,46 ---- public class ItemPointer { ! /** ! * IFile or File object (may be null) ! */ ! public final Object file; + /** + * Position of the 1st character + */ + public final Location start; + + /** + * Position of the last character + */ + public final Location end; + + /** + * The definition that originated this ItemPointer (good chance of being null). + */ + public final Definition definition; + + /** + * The path within the zip file for this pointer (null if we're not dealing with a zip file) + */ + public final String zipFilePath; + + public ItemPointer(Object file) { this(file, new Location(), new Location()); *************** *** 36,49 **** this.start = new Location(line-1, col-1); this.end = new Location(line-1, col-1); } public ItemPointer(Object file, Location start, Location end) { ! this.file = file; ! this.start = start; ! this.end = end; } ! public ItemPointer(File file2, Location location, Location location2, Definition definition, String zipFilePath) { ! this(file2, location, location2); this.definition = definition; this.zipFilePath = zipFilePath; --- 54,69 ---- this.start = new Location(line-1, col-1); this.end = new Location(line-1, col-1); + this.definition = null; + this.zipFilePath = null; } public ItemPointer(Object file, Location start, Location end) { ! this(file, start, end, null, null); } ! public ItemPointer(Object file, Location start, Location end, Definition definition, String zipFilePath) { ! this.file = file; ! this.start = start; ! this.end = end; this.definition = definition; this.zipFilePath = zipFilePath; *************** *** 84,91 **** @Override public int hashCode() { if(this.file != null){ ! return this.file.hashCode() * 17; }else{ ! return (this.end.column+1) * (this.start.line+2) * 9; } } --- 104,112 ---- @Override public int hashCode() { + int colLineBasedHash = (this.end.column + this.start.line + 7) * 3; if(this.file != null){ ! return this.file.hashCode() + colLineBasedHash; }else{ ! return colLineBasedHash; } } |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:37
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/src_completions/org/python/pydev/editor/codecompletion Modified Files: PyContentAssistant.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: PyContentAssistant.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/PyContentAssistant.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyContentAssistant.java 13 Aug 2008 21:12:16 -0000 1.7 --- PyContentAssistant.java 17 Aug 2008 00:26:46 -0000 1.8 *************** *** 17,21 **** import org.python.pydev.editor.PyInformationPresenter; import org.python.pydev.plugin.KeyBindingHelper; - import org.python.pydev.plugin.PydevPlugin; /** --- 17,20 ---- *************** *** 41,45 **** setRepeatedInvocationMode(true); }catch(Exception e){ ! PydevPlugin.log(e); } --- 40,44 ---- setRepeatedInvocationMode(true); }catch(Exception e){ ! //no need to log } *************** *** 47,51 **** setRepeatedInvocationTrigger(KeyBindingHelper.getContentAssistProposalBinding()); }catch(Exception e){ ! PydevPlugin.log(e); } --- 46,50 ---- setRepeatedInvocationTrigger(KeyBindingHelper.getContentAssistProposalBinding()); }catch(Exception e){ ! //no need to log } *************** *** 53,57 **** setStatusLineVisible(true); }catch(Exception e){ ! PydevPlugin.log(e); } } --- 52,56 ---- setStatusLineVisible(true); }catch(Exception e){ ! //no need to log } } |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:37
|
Update of /cvsroot/pydev/org.python.pydev/tests/pysrc/extendable/all_check In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/tests/pysrc/extendable/all_check Added Files: __init__.py Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> --- NEW FILE: __init__.py --- class ThisGoes: pass class ThisGoesToo: pass class ThisDoesnt: pass __all__ = ['ThisGoes', 'ThisGoesToo'] |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:37
|
Update of /cvsroot/pydev/org.python.pydev/tests_navigator/org/python/pydev/navigator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/tests_navigator/org/python/pydev/navigator Modified Files: ProjectStub.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: ProjectStub.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests_navigator/org/python/pydev/navigator/ProjectStub.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ProjectStub.java 28 Jun 2008 13:29:19 -0000 1.6 --- ProjectStub.java 17 Aug 2008 00:26:46 -0000 1.7 *************** *** 622,626 **** ArrayList<Object> ret = new ArrayList<Object>(); for(File file:folder.listFiles()){ ! if(file.getName().toLowerCase().equals("cvs")){ continue; } --- 622,627 ---- ArrayList<Object> ret = new ArrayList<Object>(); for(File file:folder.listFiles()){ ! String lower = file.getName().toLowerCase(); ! if(lower.equals("cvs") || lower.equals(".svn")){ continue; } |
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:24
|
Update of /cvsroot/pydev/org.python.pydev/tests/pysrc/extendable/all_check In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6932/tests/pysrc/extendable/all_check Log Message: Directory /cvsroot/pydev/org.python.pydev/tests/pysrc/extendable/all_check added to the repository |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:20
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8531/src/org/python/pydev/core Modified Files: IModulesManager.java ExtensionHelper.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: IModulesManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/IModulesManager.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** IModulesManager.java 5 May 2008 01:31:03 -0000 1.16 --- IModulesManager.java 13 Aug 2008 21:12:29 -0000 1.17 *************** *** 129,132 **** --- 129,137 ---- /** + * Sets the pythonpath helper related to this modules manager. + */ + public abstract void setPythonPathHelper(Object /*PythonPathHelper*/ pathHelper); + + /** * This method removes some module from this modules manager. * Index: ExtensionHelper.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/ExtensionHelper.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ExtensionHelper.java 25 Mar 2008 20:16:07 -0000 1.16 --- ExtensionHelper.java 13 Aug 2008 21:12:29 -0000 1.17 *************** *** 32,35 **** --- 32,36 ---- public final static String PYDEV_MODULES_OBSERVER = "org.python.pydev.pydev_modules_observer"; public final static String PYDEV_INTERPRETER_OBSERVER = "org.python.pydev.pydev_interpreter_observer"; + public final static String PYDEV_MANAGER_OBSERVER = "org.python.pydev.pydev_manager_observer"; public final static String PYDEV_PARSER_OBSERVER = "org.python.pydev.parser.pydev_parser_observer"; public static final String PYDEV_CTRL_1 = "org.python.pydev.pydev_ctrl_1"; |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:20
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8531/src/org/python/pydev/core/docutils Modified Files: WordUtils.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:17
|
Update of /cvsroot/pydev/org.python.pydev.debug/tests/org/python/pydev/debug/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481/tests/org/python/pydev/debug/ui Added Files: DebuggerTestWorkbench.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger --- NEW FILE: DebuggerTestWorkbench.java --- package org.python.pydev.debug.ui; import java.io.ByteArrayInputStream; import java.util.HashSet; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IThread; import org.eclipse.debug.core.model.IVariable; import org.eclipse.jface.text.source.IVerticalRulerInfo; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.WorkbenchException; import org.python.pydev.debug.model.PyDebugTarget; import org.python.pydev.debug.model.PyVariable; import org.python.pydev.debug.ui.actions.BreakpointRulerAction; import org.python.pydev.debug.ui.launching.JythonLaunchShortcut; import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.codecompletion.revisited.javaintegration.AbstractWorkbenchTestCase; import org.python.pydev.editorinput.PyOpenEditor; import org.python.pydev.plugin.PydevPlugin; import org.python.pydev.utils.ICallback; public class DebuggerTestWorkbench extends AbstractWorkbenchTestCase { /** * File used to debug */ private IFile debugFile; /** * The editor that'll be created on debug */ private PyEdit debugEditor; /** * Maximum number of loops (used with the timeout) */ private final int MAX_LOOPS = 300; /** * Maximum time for each loop in millis */ private final int STEP_TIMEOUT = 100; /** * Number of steps in the tests that will have busy loops until some condition is hit. */ private final int TOTAL_STEPS = 3; /** * Total time in millis that the test has for finishing */ private final int TOTAL_TIME_FOR_TESTS = MAX_LOOPS*STEP_TIMEOUT*(TOTAL_STEPS+1); /** * Used for having wait() */ private Object lock = new Object(); /** * An exception that occurred that was thrown and didn't let the tests finish */ private Throwable failException = null; /** * Only true when the test finishes without exceptions. */ private boolean finished = false; /** * Creates the debug file and editor. */ @Override protected void setUp() throws Exception { super.setUp(); debugFile = initFile.getParent().getFile(new Path("debug_file.py")); String mod1Contents = "from pack1.pack2 import mod1\nprint mod1\nprint 'now'\n"; debugFile.create(new ByteArrayInputStream(mod1Contents.getBytes()), true, null); debugFile.refreshLocal(IResource.DEPTH_ZERO, null); debugEditor = (PyEdit) PyOpenEditor.doOpenEditor(debugFile); } /** * Removes the debug file and closes the debug editor */ @Override protected void tearDown() throws Exception { super.tearDown(); if(debugFile != null){ debugFile.delete(true, null); } if(debugEditor != null){ debugEditor.close(false); } } /** * In this test, a thread is started and then we wait on a busy loop until the thread finishes with the tests. */ public void testDebugger() throws Exception { //start the thread that'll do the test threadTest.start(); //wait on a busy loop until the test is finished or an exception is thrown. goToManual(TOTAL_TIME_FOR_TESTS, new org.python.pydev.core.ICallback<Boolean, Object>(){ public Boolean call(Object arg) { return finished || failException != null; }} ); //Make it fail if we encountered some problem if(failException != null){ failException.printStackTrace(); fail(failException.getMessage()); } if(!finished){ if(failException == null){ fail("The test didn't finish in the available time: "+TOTAL_TIME_FOR_TESTS/1000+ " secs."); } } } /** * This is the thread that'll make the test. */ Thread threadTest = new Thread(){ @Override public void run() { try{ //make a launch for debugging launchEditorInDebug(); //switch to debug perspective, because otherwise, when we hit a breakpoint it'll ask if we want to show it. switchToPerspective("org.eclipse.debug.ui.DebugPerspective"); BreakpointRulerAction createAddBreakPointAction = createAddBreakPointAction(1); createAddBreakPointAction.run(); ILaunch launch = waitForLaunchAvailable(); PyDebugTarget target = (PyDebugTarget) waitForDebugTargetAvailable(launch); IThread suspendedThread = waitForSuspendedThread(target); assertEquals("MainThread", suspendedThread.getName()); IStackFrame topStackFrame = suspendedThread.getTopStackFrame(); assertTrue("Was not expecting: "+topStackFrame.getName(), topStackFrame.getName().indexOf("debug_file.py:2") != 0); IVariable[] variables = topStackFrame.getVariables(); HashSet<String> varNames = new HashSet<String>(); for (IVariable variable : variables) { PyVariable var = (PyVariable) variable; varNames.add(var.getName()); } HashSet<String> expected = new HashSet<String>(); expected.add("Globals"); expected.add("__doc__"); expected.add("__file__"); expected.add("__name__"); expected.add("mod1"); assertEquals(expected, varNames); assertTrue(target.canTerminate()); target.terminate(); finished = true; }catch(Throwable e){ failException = e; } } }; /** * Creates a run in debug mode for the debug editor */ private void launchEditorInDebug() { final IWorkbench workBench = PydevPlugin.getDefault().getWorkbench(); Display display = workBench.getDisplay(); // Make sure to run the UI thread. display.syncExec( new Runnable(){ public void run(){ JythonLaunchShortcut launchShortcut = new JythonLaunchShortcut(); launchShortcut.launch(debugEditor, "debug"); } }); } /** * @return an action that can be run to create a breakpoint in the given line */ private BreakpointRulerAction createAddBreakPointAction(final int line) { BreakpointRulerAction ret = new BreakpointRulerAction(debugEditor, new IVerticalRulerInfo(){ public int getLineOfLastMouseButtonActivity() { return line; } public Control getControl() { throw new RuntimeException("Not Implemented"); } public int getWidth() { throw new RuntimeException("Not Implemented"); } public int toDocumentLineNumber(int y_coordinate) { throw new RuntimeException("Not Implemented"); }}); ret.update(); return ret; } /** * This method can be used to switch to a given perspective * @param perspectiveId the id of the perspective that should be activated. */ protected void switchToPerspective(final String perspectiveId) { final IWorkbench workBench = PydevPlugin.getDefault().getWorkbench(); Display display = workBench.getDisplay(); // Make sure to run the UI thread. display.syncExec( new Runnable(){ public void run(){ IWorkbenchWindow window = workBench.getActiveWorkbenchWindow(); try { workBench.showPerspective(perspectiveId, window); } catch (WorkbenchException e) { failException = e; } } }); } /** * Waits until some thread is suspended. */ protected IThread waitForSuspendedThread(final PyDebugTarget target) throws Throwable { final IThread[] ret = new IThread[1]; waitForCondition(new ICallback(){ public Object call(Object args) throws Exception { IThread[] threads = target.getThreads(); for (IThread thread : threads) { if(thread.isSuspended()){ ret[0] = thread; return true; } } return false; }} ); return ret[0]; } /** * Waits until a launch becomes available * @return the launch that was found */ private ILaunch waitForLaunchAvailable() throws Throwable { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); waitForCondition(new ICallback(){ public Object call(Object args) throws Exception { ILaunch[] launches = launchManager.getLaunches(); return launches.length > 0; }}); return launchManager.getLaunches()[0]; } /** * Waits until a debug target is available in the passed launch * @return the debug target found */ private IDebugTarget waitForDebugTargetAvailable(final ILaunch launch) throws Throwable { waitForCondition(new ICallback(){ public Object call(Object args) throws Exception { return launch.getDebugTarget() != null; }}); return launch.getDebugTarget(); } /** * Keeps on a busy loop with a timeout until the given callback returns true (otherwise, an * exception is thrown when the total time is elapsed). */ private void waitForCondition(ICallback callback) throws Throwable { if(failException != null){ throw failException; } int loops = MAX_LOOPS; for(int i=0;i<loops;i++){ if((Boolean)callback.call(new Object[]{})){ return; } synchronized (lock) { try { Thread.yield(); lock.wait(STEP_TIMEOUT); } catch (InterruptedException e) { } } } fail("Unable to get to condition after "+(loops*STEP_TIMEOUT)/1000+" seconds."); } } |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:17
|
Update of /cvsroot/pydev/org.python.pydev.debug/tests/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481/tests/org/python/pydev/debug/codecoverage Modified Files: CoverageCacheTest.java XmlRpcTest.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: CoverageCacheTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/tests/org/python/pydev/debug/codecoverage/CoverageCacheTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CoverageCacheTest.java 21 Mar 2008 21:57:32 -0000 1.4 --- CoverageCacheTest.java 13 Aug 2008 21:12:24 -0000 1.5 *************** *** 78,83 **** "Name Stmts Exec Cover Missing\n" + "-----------------------------------------------------------------------------\n" + - " c 22 10 45,5% 6-10\n" + " b 20 10 50% 6-10\n" + " d 24 10 41,7% 6-10\n" + " e 26 10 38,5% 6-10\n" + --- 78,83 ---- "Name Stmts Exec Cover Missing\n" + "-----------------------------------------------------------------------------\n" + " b 20 10 50% 6-10\n" + + " c 22 10 45,5% 6-10\n" + " d 24 10 41,7% 6-10\n" + " e 26 10 38,5% 6-10\n" + Index: XmlRpcTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/tests/org/python/pydev/debug/codecoverage/XmlRpcTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XmlRpcTest.java 21 May 2008 01:38:15 -0000 1.3 --- XmlRpcTest.java 13 Aug 2008 21:12:24 -0000 1.4 *************** *** 73,77 **** public static void main(String[] args) throws MalformedURLException, XmlRpcException { ! junit.textui.TestRunner.run(XmlRpcTest.class); } --- 73,85 ---- public static void main(String[] args) throws MalformedURLException, XmlRpcException { ! try{ ! XmlRpcTest xmlRpcTest = new XmlRpcTest(); ! xmlRpcTest.setUp(); ! xmlRpcTest.testXmlRpcServerPython(); ! xmlRpcTest.tearDown(); ! junit.textui.TestRunner.run(XmlRpcTest.class); ! }catch(Throwable e){ ! e.printStackTrace(); ! } } *************** *** 146,149 **** --- 154,163 ---- } + try{ + int exitValue = process.exitValue(); + fail("Already exited with val: "+exitValue); + }catch(IllegalThreadStateException e){ + //that's ok + } try { *************** *** 225,229 **** if(expected.equals("Console already exited with value: 0 while waiting for an answer.|exceptions.SystemExit:0")){ if(found.equals("Console already exited with value: 0 while waiting for an answer.") || ! found.equals("exceptions.SystemExit:0")){ return; } --- 239,244 ---- if(expected.equals("Console already exited with value: 0 while waiting for an answer.|exceptions.SystemExit:0")){ if(found.equals("Console already exited with value: 0 while waiting for an answer.") || ! found.equals("exceptions.SystemExit:0") || ! found.equals("Failed to create input stream: Connection refused")){ return; } |