pydev-cvs Mailing List for PyDev for Eclipse (Page 296)
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...> - 2004-10-20 16:52:57
|
Update of /cvsroot/pydev/org.python.pydev.help/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17063/html Removed Files: index.html ed_undocumented.html ed_prefs.html debug.html db_prefs.html editor.html Log Message: --- index.html DELETED --- --- db_prefs.html DELETED --- --- debug.html DELETED --- --- ed_undocumented.html DELETED --- --- editor.html DELETED --- --- ed_prefs.html DELETED --- |
From: Fabio Z. <fa...@us...> - 2004-10-20 16:52:57
|
Update of /cvsroot/pydev/org.python.pydev.help/html/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17063/html/images Removed Files: hyper2.gif db_prefs.gif hyper1.gif debug_menu.gif debug_console.gif ed_prefs.gif debug_dialog.gif hyper.psd debugdialog.jpg debugger.gif hyperanim.gif Log Message: --- debug_console.gif DELETED --- --- debug_dialog.gif DELETED --- --- hyper2.gif DELETED --- --- hyperanim.gif DELETED --- --- debugdialog.jpg DELETED --- --- hyper.psd DELETED --- --- hyper1.gif DELETED --- --- debug_menu.gif DELETED --- --- db_prefs.gif DELETED --- --- ed_prefs.gif DELETED --- --- debugger.gif DELETED --- |
From: Fabio Z. <fa...@us...> - 2004-10-20 16:52:34
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16970/pysrc Added Files: runfiles.py Log Message: --- NEW FILE: runfiles.py --- ''' Usage: runfiles.py <dir> [<dir>...] Run all unit tests found in the current path. An unit test is a file named test_*.py and with TestCase-derived classes. ''' import sys import unittest import optparse import fnmatch import os import os.path import re def MatchMasks( p_FileName, p_Filters ): for filter in p_Filters: if fnmatch.fnmatch( p_FileName, filter ): return 1 return 0 def NotDir( p_FileName ): return not os.path.isdir( p_FileName ) def _FindFiles( p_Path, p_InFilters, p_OutFilters, p_Recursive = True ): import os import fnmatch if not p_Path: p_Path = '.' def AddFile( o_Result, p_DirName, p_FileNames ): p_FileNames = filter( lambda x: MatchMasks( x, p_InFilters ), p_FileNames ) p_FileNames = filter( lambda x: not MatchMasks( x, p_OutFilters ), p_FileNames ) p_FileNames = filter( NotDir, p_FileNames ) p_FileNames = [os.path.join( p_DirName, x ) for x in p_FileNames] o_Result.extend( p_FileNames ) result = [] if (p_Recursive): os.path.walk( p_Path, AddFile, result ) else: result = os.listdir( p_Path ) result = filter( lambda x: MatchMasks( x, p_InFilters ), result ) result = filter( lambda x: not MatchMasks( x, p_OutFilters ), result ) result = filter( NotDir, result ) result = [os.path.join( p_Path, x ) for x in result] return result; def make_list( p_element ): ''' Returns p_element as a list. ''' if isinstance( p_element, list ): return p_element else: return [p_element,] def FindFiles( p_Pathes, p_InFilters=None, p_OutFilters=None, p_Recursive = True ): ''' Find files recursivelly, in one or more directories, matching the given IN and OUT filters. @param p_Patches: One or a list of patches to search. @param p_InFilters: A list of filters (DIR format) to match. Defaults to ['*.*']. @param p_OutFilters A list of filters (DIR format) to ignore. Defaults to []. @param p_Recursive Recursive search? ''' if p_InFilters is None: p_InFilters = ['*.*'] if p_OutFilters is None: p_OutFilters = [] p_Pathes = make_list( p_Pathes ) result = [] for i_path in p_Pathes: files = _FindFiles( i_path, p_InFilters, p_OutFilters, p_Recursive ) result.extend( files ) return result def GrepFiles( p_Pathes, p_Text, p_InFilters, p_OutFilters, p_Recursive = True ): def HasText( p_FileName, p_Text ): if (not os.path.isfile( p_FileName )): return False iss = open( p_FileName ) line = iss.readline() while (line): if (line.find( p_Text ) >= 0): return True line = iss.readline() return False result = FindFiles( p_Pathes, p_InFilters, p_OutFilters, p_Recursive ) return filter( lambda x: HasText( x, p_Text ), result ) def CheckForUpdate( p_source, p_target ): ''' Returns wether the given source needs to be (re)processed to generate the given target. Check the target existence and date. ''' return \ not os.path.isfile( p_target ) or \ os.path.getmtime( p_source ) > os.path.getmtime( p_target ) def CheckType( p_object, p_type ): result = isinstance( p_object, p_type ) if not result: types_ = [str(x.__name__) for x in make_tuple( p_type )] types_ = '" or "'.join( types_ ) raise RuntimeError, 'CheckType: Expecting "%s", got "%s": %s' % \ (types_, p_object.__class__.__name__, repr( p_object ) ) return result def FileNames( p_filename, p_masks ): ''' Returns the given masks substituing variables: - Environmetn variables - Extra varibles: - abs_path - platform - PLATFORM - filename - basename ''' import coilib CheckType( p_filename, str ) abs_path = os.path.abspath( p_filename ) filename = os.path.basename( p_filename ) basename = filename.split('-') basename = basename[0] d = { 'abs_path' : abs_path, 'platform' : sys.platform, 'PLATFORM' : coilib.Platform(), 'filename' : filename, 'basename' : basename, } d.update( os.environ ) return [os.path.normpath( i % d ) for i in p_masks] def FindFileName( p_filenames ): result = None for i_filename in p_filenames: if os.path.isfile( i_filename ): result = i_filename break if (result is None): import coilib.Exceptions raise coilib.Exceptions.EFileNotFound( '\n - '.join( [''] + p_filenames ) ) return result #=============================================================================== # GetShortPathName #=============================================================================== def GetShortPathName(path): '''Returns on windows the short version of the given path. On other platforms, return the path unchanged. ''' if sys.platform == 'win32': import win32api return win32api.GetShortPathName(path) else: return path def parse_cmdline(): usage='usage: %prog directory [other_directory ...]' parser = optparse.OptionParser(usage=usage) options, args = parser.parse_args() if not args: parser.print_help() sys.exit(1) return args def runtests(dirs, verbosity=2): loader = unittest.defaultTestLoader print 'Finding files...',dirs names = [] for dir in dirs: names.extend(FindFiles(dir, ['test_*.py'], '', True)) print 'done.' print 'Importing test modules...', alltests = [] for name in names: dir, fullname = os.path.split(name) modulename = os.path.splitext(fullname)[0] sys.path.append(dir) module = __import__(modulename) tests = loader.loadTestsFromModule(module) alltests.append(tests) print 'done.' runner = unittest.TextTestRunner(sys.stdout, 1, verbosity) runner.run(unittest.TestSuite(alltests)) if __name__ == '__main__': dirs = parse_cmdline() runtests(dirs) |
From: Fabio Z. <fa...@us...> - 2004-10-20 16:52:34
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16970/src/org/python/pydev/debug/codecoverage Modified Files: RunManyDialog.java Log Message: Index: RunManyDialog.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/RunManyDialog.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunManyDialog.java 18 Oct 2004 19:13:12 -0000 1.2 --- RunManyDialog.java 20 Oct 2004 16:52:16 -0000 1.3 *************** *** 6,10 **** --- 6,14 ---- package org.python.pydev.debug.codecoverage; + import java.io.File; + + import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.dialogs.Dialog; + import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; *************** *** 18,21 **** --- 22,26 ---- import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Widget; + import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.plugin.PydevPrefs; *************** *** 184,188 **** layoutData.verticalAlignment = GridData.FILL; labelScript0 = new Label(composite, 0); ! labelScript0.setText("Script location (absolute)"); labelScript0.setLayoutData(layoutData); --- 189,193 ---- layoutData.verticalAlignment = GridData.FILL; labelScript0 = new Label(composite, 0); ! labelScript0.setText("Script location (absolute) - default script executes only files that match test_*.py"); labelScript0.setLayoutData(layoutData); *************** *** 193,197 **** layoutData.verticalAlignment = GridData.FILL; textScriptLocation = new Text(composite, SWT.SINGLE); ! textScriptLocation.setText("X:\\coilib30\\tools\\runtests.py"); textScriptLocation.setLayoutData(layoutData); --- 198,212 ---- layoutData.verticalAlignment = GridData.FILL; textScriptLocation = new Text(composite, SWT.SINGLE); ! try { ! String defaultV = PydevPrefs.getPreferences().getString(PydevPrefs.RUN_MANY_SCRIPT_LOCATION); ! if(defaultV.length() < 1){ ! File file = PydevDebugPlugin.getScriptWithinPySrc("runfiles.py"); ! defaultV = file.getAbsolutePath(); ! PydevPrefs.getPreferences().setValue(PydevPrefs.RUN_MANY_SCRIPT_LOCATION, defaultV); ! } ! textScriptLocation.setText(defaultV); ! } catch (CoreException e) { ! textScriptLocation.setText("Add script that receives dir."); ! } textScriptLocation.setLayoutData(layoutData); *************** *** 235,240 **** scriptLocation = textScriptLocation.getText(); scriptSelected = check.getSelection(); ! // TODO Auto-generated method stub ! super.okPressed(); } --- 250,264 ---- scriptLocation = textScriptLocation.getText(); scriptSelected = check.getSelection(); ! ! if(scriptSelected){ ! if (scriptLocation.length() > 0){ ! PydevPrefs.getPreferences().setValue(PydevPrefs.RUN_MANY_SCRIPT_LOCATION, scriptLocation); ! super.okPressed(); ! }else{ ! MessageDialog.openInformation(this.getShell(), "ERROR: Script not selected", "A script must be specified."); ! } ! }else{ ! super.okPressed(); ! } } |
From: Fabio Z. <fa...@us...> - 2004-10-20 16:52:34
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16970 Modified Files: plugin.xml Log Message: Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** plugin.xml 19 Oct 2004 19:34:12 -0000 1.22 --- plugin.xml 20 Oct 2004 16:52:17 -0000 1.23 *************** *** 4,9 **** id="org.python.pydev.debug" name="Pydev debug" ! version="0.7" ! provider-name="Aleks Totic" class="org.python.pydev.debug.core.PydevDebugPlugin"> --- 4,9 ---- id="org.python.pydev.debug" name="Pydev debug" ! version="0.7.1" ! provider-name="Aleks Totic / Fabio Zadrozny" class="org.python.pydev.debug.core.PydevDebugPlugin"> |
From: Fabio Z. <fa...@us...> - 2004-10-20 16:52:03
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16873 Modified Files: plugin.xml Log Message: Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** plugin.xml 20 Oct 2004 11:37:05 -0000 1.51 --- plugin.xml 20 Oct 2004 16:51:53 -0000 1.52 *************** *** 4,9 **** id="org.python.pydev" name="Pydev - Python Development Environment" ! version="0.7" ! provider-name="AleksTotic / Fabio Zadrozny" class="org.python.pydev.plugin.PydevPlugin"> --- 4,9 ---- id="org.python.pydev" name="Pydev - Python Development Environment" ! version="0.7.1" ! provider-name="Aleks Totic / Fabio Zadrozny" class="org.python.pydev.plugin.PydevPlugin"> |
From: Fabio Z. <fa...@us...> - 2004-10-20 16:52:03
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16873/src/org/python/pydev/plugin Modified Files: PydevPrefs.java Log Message: Index: PydevPrefs.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/PydevPrefs.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PydevPrefs.java 20 Sep 2004 13:18:04 -0000 1.12 --- PydevPrefs.java 20 Oct 2004 16:51:53 -0000 1.13 *************** *** 70,73 **** --- 70,76 ---- public static final int DEFAULT_CONNECT_TIMEOUT = 20000; + public static final String RUN_MANY_SCRIPT_LOCATION = "RUN_MANY_SCRIPT_LOCATION"; + public static final String DEFAULT_RUN_MANY_SCRIPT_LOCATION = ""; + /** * Initializer sets the preference store *************** *** 146,149 **** --- 149,153 ---- prefs.setDefault(BLOCK_COMMENT, DEFAULT_BLOCK_COMMENT_STRING); prefs.setDefault(CONNECT_TIMEOUT, DEFAULT_CONNECT_TIMEOUT); + prefs.setDefault(RUN_MANY_SCRIPT_LOCATION, DEFAULT_RUN_MANY_SCRIPT_LOCATION); } } |
From: Fabio Z. <fa...@us...> - 2004-10-20 11:37:22
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32660 Modified Files: plugin.xml Log Message: Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** plugin.xml 19 Oct 2004 19:34:48 -0000 1.50 --- plugin.xml 20 Oct 2004 11:37:05 -0000 1.51 *************** *** 5,9 **** name="Pydev - Python Development Environment" version="0.7" ! provider-name="AleksTotic" class="org.python.pydev.plugin.PydevPlugin"> --- 5,9 ---- name="Pydev - Python Development Environment" version="0.7" ! provider-name="AleksTotic / Fabio Zadrozny" class="org.python.pydev.plugin.PydevPlugin"> |
From: Fabio Z. <fa...@us...> - 2004-10-19 19:34:59
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv958 Modified Files: plugin.xml Log Message: inline and extract local variable refactorings added. Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** plugin.xml 19 Oct 2004 11:12:30 -0000 1.49 --- plugin.xml 19 Oct 2004 19:34:48 -0000 1.50 *************** *** 4,8 **** id="org.python.pydev" name="Pydev - Python Development Environment" ! version="0.6.2.2" provider-name="AleksTotic" class="org.python.pydev.plugin.PydevPlugin"> --- 4,8 ---- id="org.python.pydev" name="Pydev - Python Development Environment" ! version="0.7" provider-name="AleksTotic" class="org.python.pydev.plugin.PydevPlugin"> *************** *** 274,277 **** --- 274,289 ---- </action> <action + label="Inline Local Variable" + class="org.python.pydev.editor.actions.refactoring.PyInlineLocalVariable" + menubarPath="org.python.pydev.refactoring/refactorings" + id="org.python.pydev.refactoring.inlinelocalvariable"> + </action> + <action + label="Extract Local Variable" + class="org.python.pydev.editor.actions.refactoring.PyExtractLocalVariable" + menubarPath="org.python.pydev.refactoring/refactorings" + id="org.python.pydev.refactoring.extractlocalvariable"> + </action> + <action label="Convert space-tabs to tabs" class="org.python.pydev.editor.actions.PyConvertSpaceToTab" |
From: Fabio Z. <fa...@us...> - 2004-10-19 19:34:59
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/refactoring In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv958/src/org/python/pydev/editor/refactoring Modified Files: PyRefactoring.java Log Message: inline and extract local variable refactorings added. Index: PyRefactoring.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/refactoring/PyRefactoring.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyRefactoring.java 13 Oct 2004 19:52:52 -0000 1.7 --- PyRefactoring.java 19 Oct 2004 19:34:47 -0000 1.8 *************** *** 185,188 **** --- 185,237 ---- } + /** + * @param editorFile + * @param beginLine + * @param beginCol + * @param operation + * @return + */ + public String inlineLocalVariable(File editorFile, int beginLine, int beginCol, Operation operation) { + String s = "@@BIKE"; + s+= "inlineLocalVariable"; + s+= " "+editorFile.getAbsolutePath(); + s+= " "+beginLine; + s+= " "+beginCol; + s+= "END@@"; + // System.out.println("Inline: "+s); + String string = makeAction(s, operation); + + // System.out.println("REFACTOR RESULT:"+string); + communicateRefactorResult(string); + return string; + } + + /** + * @param editorFile + * @param beginLine + * @param beginCol + * @param endLine + * @param endCol + * @param name + * @param operation + * @return + */ + public String extractLocalVariable(File editorFile, int beginLine, int beginCol, int endLine, int endCol, String name, Operation operation) { + String s = "@@BIKE"; + s+= "extractLocalVariable"; + s+= " "+editorFile.getAbsolutePath(); + s+= " "+beginLine; + s+= " "+beginCol; + s+= " "+endLine; + s+= " "+endCol; + s+= " "+name; + s+= "END@@"; + // System.out.println("Extract: "+s); + String string = makeAction(s, operation); + // System.out.println("REFACTOR RESULT:"+string); + + communicateRefactorResult(string); + return string; + } /** *************** *** 255,257 **** --- 304,308 ---- } + + } |
From: Fabio Z. <fa...@us...> - 2004-10-19 19:34:59
|
Update of /cvsroot/pydev/org.python.pydev/PySrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv958/PySrc Modified Files: refactoring.py Log Message: inline and extract local variable refactorings added. Index: refactoring.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/refactoring.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** refactoring.py 8 Oct 2004 16:38:42 -0000 1.7 --- refactoring.py 19 Oct 2004 19:34:48 -0000 1.8 *************** *** 71,74 **** --- 71,75 ---- return str(savedfiles) + def renameByCoordinates(self, filename, line, column, newname): ''' *************** *** 80,84 **** --- 81,108 ---- + def inlineLocalVariable(self, filename, line, column): + ''' + Receives all as a string and changes to correct type. + ''' + self.brmctx.inlineLocalVariable(filename, int(line), int(column)) + savedfiles = self.brmctx.save() + return str(savedfiles) + + + def extractLocalVariable(self,filename, begin_line, begin_col, + end_line, end_col, newname): + ''' + Receives all as a string and changes to correct type. + ''' + self.brmctx.extractLocalVariable(filename, int(begin_line), int(begin_col), + int(end_line), int(end_col), newname) + savedfiles = self.brmctx.save() + return str(savedfiles) + + def findDefinition(self, filename, line, column): + ''' + Receives all as a string and changes to correct type. + ''' defns = self.brmctx.findDefinitionByCoordinates(filename, int(line), int(column)) |
From: Fabio Z. <fa...@us...> - 2004-10-19 19:34:57
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/refactoring In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv958/src/org/python/pydev/editor/actions/refactoring Added Files: PyInlineLocalVariable.java PyExtractLocalVariable.java Log Message: inline and extract local variable refactorings added. --- NEW FILE: PyExtractLocalVariable.java --- /* * Created on Oct 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.actions.refactoring; import java.io.File; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.BadLocationException; import org.python.pydev.editor.refactoring.PyRefactoring; /** * @author Fabio Zadrozny */ public class PyExtractLocalVariable extends PyRefactorAction { /** * we need: * * def extract(self, filename_path, * begin_line, begin_col, * end_line, end_col, * name): * @throws BadLocationException * @throws CoreException */ protected String perform(IAction action, String name, Operation operation) throws BadLocationException, CoreException { File editorFile = getPyEdit().getEditorFile(); //testing first with whole lines. int beginLine = getStartLine(); int beginCol = getStartCol(); int endLine = getEndLine(); int endCol = getEndCol(); String res = ""; if(name.equals("") == false){ res = PyRefactoring.getPyRefactoring().extractLocalVariable(editorFile, beginLine, beginCol, endLine, endCol, name, operation); } return res; } protected String getInputMessage() { return "Please inform the new name."; } } --- NEW FILE: PyInlineLocalVariable.java --- /* * Created on Oct 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.actions.refactoring; import java.io.File; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.BadLocationException; import org.python.pydev.editor.refactoring.PyRefactoring; /** * @author Fabio Zadrozny * */ public class PyInlineLocalVariable extends PyRefactorAction { /** * we need: * * def inlineLocalVariable(self,filename_path, line, col) * * @throws BadLocationException * @throws CoreException */ protected String perform(IAction action, String name, Operation operation) throws BadLocationException, CoreException { File editorFile = getPyEdit().getEditorFile(); //testing first with whole lines. int beginLine = getStartLine(); int beginCol = getStartCol(); int endLine = getEndLine(); int endCol = getEndCol(); return PyRefactoring.getPyRefactoring().inlineLocalVariable(editorFile, beginLine, beginCol, operation); } protected String getInputMessage() { return null; } } |
From: Fabio Z. <fa...@us...> - 2004-10-19 19:34:21
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv808 Modified Files: plugin.xml Log Message: Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** plugin.xml 19 Oct 2004 11:12:18 -0000 1.21 --- plugin.xml 19 Oct 2004 19:34:12 -0000 1.22 *************** *** 4,8 **** id="org.python.pydev.debug" name="Pydev debug" ! version="0.6.2.2" provider-name="Aleks Totic" class="org.python.pydev.debug.core.PydevDebugPlugin"> --- 4,8 ---- id="org.python.pydev.debug" name="Pydev debug" ! version="0.7" provider-name="Aleks Totic" class="org.python.pydev.debug.core.PydevDebugPlugin"> *************** *** 128,132 **** id="org.python.pydev.debug.RunPythonFolder"> <menu ! label="Python (many)" path="additions2" id="org.python.pydev.debug.WorkspaceMenu"> --- 128,132 ---- id="org.python.pydev.debug.RunPythonFolder"> <menu ! label="Python (run subset)" path="additions2" id="org.python.pydev.debug.WorkspaceMenu"> |
From: Fabio Z. <fa...@us...> - 2004-10-19 19:34:21
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv808/src/org/python/pydev/debug/codecoverage Modified Files: FileNode.java Log Message: Index: FileNode.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/FileNode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FileNode.java 19 Oct 2004 11:12:18 -0000 1.3 --- FileNode.java 19 Oct 2004 19:34:11 -0000 1.4 *************** *** 50,54 **** } while (str.length() < 40){ ! str += " "; } return str; --- 50,54 ---- } while (str.length() < 40){ ! str = " "+str; } return str; *************** *** 58,62 **** String str = stmts+""; while (str.length() < 4){ ! str += " "; } return str; --- 58,62 ---- String str = stmts+""; while (str.length() < 4){ ! str = " "+str; } return str; *************** *** 66,70 **** String str = exec+""; while (str.length() < 4){ ! str += " "; } return str; --- 66,70 ---- String str = exec+""; while (str.length() < 4){ ! str = " "+str; } return str; *************** *** 80,84 **** str += "%"; while (str.length() < 5){ ! str += " "; } return str; --- 80,84 ---- str += "%"; while (str.length() < 5){ ! str = " "+str; } return str; |
From: Fabio Z. <fa...@us...> - 2004-10-19 18:58:37
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/correctionassist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24845/src/org/python/pydev/editor/correctionassist Modified Files: PythonCorrectionProcessor.java Added Files: FixCompletionProposal.java Log Message: New proposals on quick fix. Index: PythonCorrectionProcessor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/correctionassist/PythonCorrectionProcessor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PythonCorrectionProcessor.java 8 Oct 2004 16:38:43 -0000 1.5 --- PythonCorrectionProcessor.java 19 Oct 2004 18:58:25 -0000 1.6 *************** *** 83,100 **** PySelection ps = new PySelection(edit, false); ! List results = new ArrayList(); ! try { ! results.addAll(getAssignToResults(ps)); ! } catch (BadLocationException e) { ! } ! try { ! results.addAll(getCreations(ps)); ! } catch (BadLocationException e1) { } return (ICompletionProposal[]) results.toArray(new ICompletionProposal[0]); } /** * @param ps --- 83,189 ---- PySelection ps = new PySelection(edit, false); ! List results = new ArrayList(); ! String sel = getLine(ps); ! ! //at least some text must be selected ! if(ps.textSelection.getLength() > 0){ ! ! try { ! results.addAll(getTryProps(ps)); ! } catch (BadLocationException e) { ! } ! } else if(sel.indexOf("import") == -1){ ! ! try { ! results.addAll(getAssignToResults(ps)); ! } catch (BadLocationException e) { ! } ! ! try { ! results.addAll(getCreations(ps)); ! } catch (BadLocationException e1) { ! } ! }else{ ! ! try { ! results.addAll(getMoveImports(ps)); ! } catch (BadLocationException e1) { ! } } + return (ICompletionProposal[]) results.toArray(new ICompletionProposal[0]); } + + + /** + * @param ps + * @return + */ + private List getTryProps(PySelection ps) throws BadLocationException { + ArrayList l = new ArrayList(); + String indentation = PyBackspace.getStaticIndentationString(); + + int start = ps.startLine.getOffset(); + int end = ps.endLine.getOffset()+ps.endLine.getLength(); + + String string = ps.doc.get(start, end-start); + String delimiter = PyAction.getDelimiter(ps.doc, 0); + + int firstCharPosition = PyAction.getFirstCharRelativePosition(ps.doc, start); + String startIndent = ""; + int i = 0; + while(i < firstCharPosition){ + startIndent += " "; + i++; + } + + int finRelNewPos; + int excRelNewPos; + string = indentation+ string.replaceAll(delimiter, delimiter+indentation); + String except = startIndent+"try:"+delimiter+string+delimiter; + except += startIndent+"except:"+delimiter; + excRelNewPos = except.length() - delimiter.length() -1; + except += startIndent+indentation+"raise"; + + String finall = startIndent+"try:"+delimiter+string+delimiter; + finall += startIndent+"finally:"+delimiter; + finall += startIndent+indentation; + finRelNewPos = finall.length(); + finall += "pass"; + + l.add(new CompletionProposal(except, start, end-start, excRelNewPos, null, + "Surround with try..except", null, null)); + + l.add(new CompletionProposal(finall, start, end-start, finRelNewPos, null, + "Surround with try..finally", null, null)); + + return l; + } + + /** + * @param ps + * @return + */ + private List getMoveImports(PySelection ps) throws BadLocationException { + ArrayList l = new ArrayList(); + String sel = getLine(ps).trim(); + + int i = sel.indexOf("import"); + if(ps.startLineIndex != ps.endLineIndex) + return l; + + + String delimiter = PyAction.getDelimiter(ps.doc, 0); + + if(i != -1){ + l.add(new FixCompletionProposal(sel+delimiter, 0, 0, ps.startLine.getOffset(), null, + "Move import to global scope", null, null, ps.startLineIndex+1)); + } + return l; + } + /** * @param ps *************** *** 104,109 **** private List getCreations(PySelection ps) throws BadLocationException { List l = new ArrayList(); ! if (ps.selection.trim().length() == 0) { return l; } --- 193,200 ---- private List getCreations(PySelection ps) throws BadLocationException { List l = new ArrayList(); + String sel = getLine(ps); ! ! if (sel.trim().length() == 0) { return l; } *************** *** 125,129 **** String delim = PyAction.getDelimiter(ps.doc, 0); ! String cls = "class "+callName+":"+delim+delim; String self = "self"; --- 216,220 ---- String delim = PyAction.getDelimiter(ps.doc, 0); ! String cls = "class "+callName+"(object):"+delim+delim; String self = "self"; *************** *** 143,155 **** if(lineOfOffset > 0){ ! newPos = ps.doc.getLineInformation(lineOfOffset - 1).getOffset(); } ! l.add(new CompletionProposal(cls, newPos, 0, cls.length()+1, null, ! "Create new class (global context)", null, null)); method = method.replaceFirst("%s", ""); ! l.add(new CompletionProposal(method, newPos, 0, method.length()+1, null, ! "Create new method (global context)", null, null)); }else{ //we are in a method or class context --- 234,246 ---- if(lineOfOffset > 0){ ! newPos = ps.doc.getLineInformation(lineOfOffset).getOffset(); } ! l.add(new FixCompletionProposal(cls, newPos, 0, cls.length()+1, null, ! "Make this a new class", null, null, ps.startLineIndex+4)); method = method.replaceFirst("%s", ""); ! l.add(new FixCompletionProposal(method, newPos, 0, method.length()+1, null, ! "Make this a new method", null, null, ps.startLineIndex+2)); }else{ //we are in a method or class context *************** *** 171,175 **** ! if(ps.selection.indexOf("self.") != -1){ //we are going for a class method. if (current instanceof FunctionNode) { //if we are in a class, here we are within a method. --- 262,266 ---- ! if(sel.indexOf("self.") != -1){ //we are going for a class method. if (current instanceof FunctionNode) { //if we are in a class, here we are within a method. *************** *** 200,209 **** }else{ //we are going for a class or a global method. ! //TODO: End this. ! // l.add(new CompletionProposal(callName, 0, 0, 0, null, ! // "Create new class", null, null)); ! // ! // l.add(new CompletionProposal(callName, 0, 0, 0, null, ! // "Create new method", null, null)); } } --- 291,322 ---- }else{ //we are going for a class or a global method. ! ! while (current != null) { ! if(current instanceof ClassNode) { ! break; ! } ! current = ModelUtils.getPreviousNode(current); ! } ! if(current instanceof ClassNode){ ! ClassNode node = (ClassNode) current; ! ! int newPos = 0; ! int lineOfOffset = node.getStart().line; ! ! if(lineOfOffset > 0){ ! newPos = ps.doc.getLineInformation(lineOfOffset).getOffset(); ! } ! method = method+delim; ! ! method = method.replaceFirst("%s", ""); ! ! l.add(new CompletionProposal(method, newPos, 0, method.length(), null, ! "Create new method (in global context)", null, null)); ! ! cls = cls+delim; ! ! l.add(new CompletionProposal(cls, newPos, 0, cls.length(), null, ! "Create new class (in global context)", null, null)); ! } } } *************** *** 213,216 **** --- 326,336 ---- /** + * + */ + private String getLine(PySelection ps) { + return ps.selection.replaceAll("#.*", ""); + } + + /** * @param ps * @throws BadLocationException *************** *** 218,223 **** private List getAssignToResults(PySelection ps) throws BadLocationException { List l = new ArrayList(); ! ! if (ps.selection.trim().length() == 0) { return l; } --- 338,343 ---- private List getAssignToResults(PySelection ps) throws BadLocationException { List l = new ArrayList(); ! String sel = getLine(ps); ! if (sel.trim().length() == 0) { return l; } *************** *** 225,229 **** //first thing: check were we are and check that no single '=' exists. // '==' may happen. ! if (ps.selection.replaceAll("==", "").indexOf("=") == -1) { //second: go on and make the suggestion. --- 345,349 ---- //first thing: check were we are and check that no single '=' exists. // '==' may happen. ! if (sel.replaceAll("==", "").indexOf("=") == -1) { //second: go on and make the suggestion. *************** *** 246,250 **** // self.|result| = 1+1 ! String callName = getBeforeParentesisTok(ps); if(callName.length() > 0){ --- 366,370 ---- // self.|result| = 1+1 ! String callName = getTokToAssign(ps); if(callName.length() > 0){ *************** *** 272,279 **** * @return */ private String getInsideParentesisTok(PySelection ps) { ! int beg = ps.selection.indexOf('(')+1; ! int end = ps.selection.indexOf(')'); ! return ps.selection.substring(beg, end); } --- 392,426 ---- * @return */ + private String getTokToAssign(PySelection ps) { + String beforeParentesisTok = getBeforeParentesisTok(ps); + if(beforeParentesisTok.length() > 0){ + return beforeParentesisTok; + } + //otherwise, try to find . (ignore code after #) + String string = getLine(ps); + String callName = ""; + //get parentesis position and go backwards + + int i; + if ((i = string.lastIndexOf(".")) != -1) { + callName = ""; + + for (int j = i+1; j < string.length() && stillInTok(string, j); j++) { + callName += string.charAt(j); + } + } + return callName; + } + + /** + * @param ps + * @return + */ private String getInsideParentesisTok(PySelection ps) { ! String sel = getLine(ps); ! ! int beg = sel.indexOf('(')+1; ! int end = sel.indexOf(')'); ! return sel.substring(beg, end); } *************** *** 283,292 **** */ private String getBeforeParentesisTok(PySelection ps) { ! String string = ps.selection.replaceAll("\\(.*\\)", "()"); int i; String callName = ""; ! if ((i = string.indexOf("()")) != -1) { callName = ""; --- 430,440 ---- */ private String getBeforeParentesisTok(PySelection ps) { ! String string = getLine(ps); int i; String callName = ""; ! //get parentesis position and go backwards ! if ((i = string.indexOf("(")) != -1) { callName = ""; *************** *** 307,311 **** char c = string.charAt(j); ! return c != '\n' && c != '\r' && c != ' ' && c != '.' && c != '(' && c != ')' && c != ',' && c != ']' && c != '['; } --- 455,459 ---- char c = string.charAt(j); ! return c != '\n' && c != '\r' && c != ' ' && c != '.' && c != '(' && c != ')' && c != ',' && c != ']' && c != '[' && c != '#'; } --- NEW FILE: FixCompletionProposal.java --- /* * Created on Oct 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.correctionassist; import org.eclipse.jface.text.Assert; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; /** * A new Completion proposal because the default is final. * This differs because we can specify a line to be deleted after the completion is processed. * * @author Fabio Zadrozny */ public class FixCompletionProposal implements ICompletionProposal { /** The string to be displayed in the completion proposal popup. */ private String fDisplayString; /** The replacement string. */ private String fReplacementString; /** The replacement offset. */ private int fReplacementOffset; /** The replacement length. */ private int fReplacementLength; /** The cursor position after this proposal has been applied. */ private int fCursorPosition; /** The image to be displayed in the completion proposal popup. */ private Image fImage; /** The context information of this proposal. */ private IContextInformation fContextInformation; /** The additional info of this proposal. */ private String fAdditionalProposalInfo; private int lineToRemove; /** * Creates a new completion proposal based on the provided information. The replacement string is * considered being the display string too. All remaining fields are set to <code>null</code>. * * @param replacementString the actual string to be inserted into the document * @param replacementOffset the offset of the text to be replaced * @param replacementLength the length of the text to be replaced * @param cursorPosition the position of the cursor following the insert relative to replacementOffset */ public FixCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, int lineToRemove) { this(replacementString, replacementOffset, replacementLength, cursorPosition, null, null, null, null, lineToRemove); } /** * Creates a new completion proposal. All fields are initialized based on the provided information. * * @param replacementString the actual string to be inserted into the document * @param replacementOffset the offset of the text to be replaced * @param replacementLength the length of the text to be replaced * @param cursorPosition the position of the cursor following the insert relative to replacementOffset * @param image the image to display for this proposal * @param displayString the string to be displayed for the proposal * @param contextInformation the context information associated with this proposal * @param additionalProposalInfo the additional information associated with this proposal */ public FixCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int lineToRemove) { Assert.isNotNull(replacementString); Assert.isTrue(replacementOffset >= 0); Assert.isTrue(replacementLength >= 0); Assert.isTrue(cursorPosition >= 0); fReplacementString= replacementString; fReplacementOffset= replacementOffset; fReplacementLength= replacementLength; fCursorPosition= cursorPosition; fImage= image; fDisplayString= displayString; fContextInformation= contextInformation; fAdditionalProposalInfo= additionalProposalInfo; this.lineToRemove = lineToRemove; } /* * @see ICompletionProposal#apply(IDocument) */ public void apply(IDocument document) { try { document.replace(fReplacementOffset, fReplacementLength, fReplacementString); if(lineToRemove >=0 && lineToRemove <= document.getNumberOfLines()){ IRegion lineInformation = document.getLineInformation(lineToRemove); document.replace(lineInformation.getOffset(), lineInformation.getLength(), ""); } } catch (BadLocationException x) { // ignore } } /* * @see ICompletionProposal#getSelection(IDocument) */ public Point getSelection(IDocument document) { if(lineToRemove >=0 && lineToRemove <= document.getNumberOfLines()){ try { IRegion lineInformation = document.getLineInformation(lineToRemove); int pos = lineInformation.getOffset(); return new Point(pos, 0); } catch (BadLocationException e) { return new Point(fReplacementOffset + fCursorPosition, 0); } }else{ return new Point(fReplacementOffset + fCursorPosition, 0); } } /* * @see ICompletionProposal#getContextInformation() */ public IContextInformation getContextInformation() { return fContextInformation; } /* * @see ICompletionProposal#getImage() */ public Image getImage() { return fImage; } /* * @see ICompletionProposal#getDisplayString() */ public String getDisplayString() { if (fDisplayString != null) return fDisplayString; return fReplacementString; } /* * @see ICompletionProposal#getAdditionalProposalInfo() */ public String getAdditionalProposalInfo() { return fAdditionalProposalInfo; } } |
From: Fabio Z. <fa...@us...> - 2004-10-19 14:43:12
|
Update of /cvsroot/pydev/org.python.pydev/PySrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18659/PySrc Modified Files: simpleTipper.py pycompletionserver.py Log Message: Index: pycompletionserver.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/pycompletionserver.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pycompletionserver.py 27 Sep 2004 18:27:10 -0000 1.12 --- pycompletionserver.py 19 Oct 2004 14:43:02 -0000 1.13 *************** *** 117,120 **** --- 117,121 ---- #the exit message for the server is @@KILL_SERVER_END@@ conn, addr = s.accept() + time.sleep(0.5) #wait a little before connecting to JAVA server #after being connected, create a socket as a client. Index: simpleTipper.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/simpleTipper.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** simpleTipper.py 21 Sep 2004 17:07:50 -0000 1.7 --- simpleTipper.py 19 Oct 2004 14:43:02 -0000 1.8 *************** *** 4,8 **** import compiler - __eraseThisCurrDirModule = None --- 4,7 ---- *************** *** 35,38 **** --- 34,54 ---- Put in the doc the code so that we get the locals. ''' + getArgsDef = \ + ''' + def __eraseThisGetArgsDef(func): + args, vargs, kwargs, defaults = inspect.getargspec(func) + if len(args) > 0 and args[0] == 'self': + args = args[1:] + + r = '(' + for a in (args): + if len(r) > 1: + r += ', ' + r += str(a) + r += ')' + return r + ''' + + originalDoc = theDoc *************** *** 48,52 **** __eraseThislocs = __eraseThiscopy.copy(__eraseThisf.f_locals) ! for __eraseThisd in __eraseThislocs: if __eraseThisd.startswith('__eraseThis') == False : __eraseThisTips.append([__eraseThisd,None]) --- 64,68 ---- __eraseThislocs = __eraseThiscopy.copy(__eraseThisf.f_locals) ! for __eraseThisd in __eraseThislocs: if __eraseThisd.startswith('__eraseThis') == False : __eraseThisTips.append([__eraseThisd,None]) *************** *** 57,60 **** --- 73,77 ---- else : #just complete for token. + theDoc+= \ ''' *************** *** 62,68 **** import inspect for d in dir(%s): ! __eraseThisTips.append([d,inspect.getdoc(getattr(%s, d))]) ! ''' % (token.replace(' ','.'),token.replace(' ','.')) --- 79,104 ---- import inspect + %s + for d in dir(%s): ! attr = getattr(%s, d) ! func = None ! if inspect.ismethod(attr): ! func = attr.im_func ! elif inspect.isfunction(attr): ! func = attr ! ! if func and inspect.isfunction(func): ! try: ! args = __eraseThisGetArgsDef(func) ! __eraseThisTips.append([d+args,inspect.getdoc(attr)]) ! except: ! __eraseThisTips.append([d,inspect.getdoc(attr)]) ! else: ! __eraseThisTips.append([d,inspect.getdoc(attr)]) ! ''' % ( getArgsDef, token.replace(' ','.'),token.replace(' ','.') ) ! ! ! |
From: Fabio Z. <fa...@us...> - 2004-10-19 14:43:12
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18659/PySrc/tests Modified Files: test_simpleTipper.py Log Message: Index: test_simpleTipper.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/tests/test_simpleTipper.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_simpleTipper.py 8 Oct 2004 16:39:01 -0000 1.1 --- test_simpleTipper.py 19 Oct 2004 14:43:03 -0000 1.2 *************** *** 14,17 **** --- 14,18 ---- import simpleTipper import importsTipper + import inspect class Test(unittest.TestCase): *************** *** 109,121 **** You can print the results to check... ''' ! importsTipper.GenerateTip('inspect.') ! importsTipper.GenerateTip('compiler.') ! importsTipper.GenerateImportsTip(['scbr']) ! importsTipper.GenerateImportsTip([ ] ) ! importsTipper.GenerateImportsTip(['os']) ! importsTipper.GenerateImportsTip(['os','path']) ! importsTipper.GenerateImportsTip(['unittest']) ! importsTipper.GenerateImportsTip(['compiler', 'ast']) ! importsTipper.GenerateImportsTip(['compiler', 'ast', 'Node']) --- 110,122 ---- You can print the results to check... ''' ! # importsTipper.GenerateTip('inspect.') ! # importsTipper.GenerateTip('compiler.') ! # importsTipper.GenerateImportsTip(['compiler']) ! # importsTipper.GenerateImportsTip([ ] ) ! # importsTipper.GenerateImportsTip(['os']) ! # importsTipper.GenerateImportsTip(['os','path']) ! # importsTipper.GenerateImportsTip(['unittest']) ! # importsTipper.GenerateImportsTip(['compiler', 'ast']) ! # importsTipper.GenerateImportsTip(['compiler', 'ast', 'Node']) *************** *** 137,142 **** ! if __name__ == '__main__': unittest.main() --- 138,172 ---- ! def testEnv4(self): ! comps = simpleTipper.GenerateTip(self.getDoc4(), 'C', True) ! print comps ! ! ! def getDoc4(self): ! s= \ ! ''' ! class C(object): ! def metA(self, a, b): ! pass ! ! ''' + return s + + def testInspect(self): + return + + class C(object): + def metA(self, a, b): + pass + + obj = C.metA + if inspect.ismethod (obj): + print obj.im_func + print inspect.getargspec(obj.im_func) + + + + if __name__ == '__main__': unittest.main() |
From: Fabio Z. <fa...@us...> - 2004-10-19 14:42:07
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18360/src/org/python/pydev/editor/codecompletion Modified Files: PyCodeCompletionPreferencesPage.java PythonShell.java PyCodeCompletion.java Log Message: code completion changes Index: PythonShell.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PythonShell.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PythonShell.java 19 Oct 2004 13:29:33 -0000 1.16 --- PythonShell.java 19 Oct 2004 14:41:55 -0000 1.17 *************** *** 30,34 **** public class PythonShell { ! private static final int DEFAULT_SLEEP_BETWEEN_ATTEMPTS = 100; /** * Reference to a 'global python shell' --- 30,34 ---- public class PythonShell { ! private static final int DEFAULT_SLEEP_BETWEEN_ATTEMPTS = 500; /** * Reference to a 'global python shell' Index: PyCodeCompletionPreferencesPage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PyCodeCompletionPreferencesPage.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyCodeCompletionPreferencesPage.java 19 Oct 2004 13:29:33 -0000 1.5 --- PyCodeCompletionPreferencesPage.java 19 Oct 2004 14:41:55 -0000 1.6 *************** *** 57,61 **** Composite p = getFieldEditorParent(); ! String w = "WARNINGS for code completion:\n\n" + "Code completion works on top of a python shell and really \n" + "EXECUTES THE CODE YOU WRITE on the top level on the module.\n\n" --- 57,64 ---- Composite p = getFieldEditorParent(); ! addField(new BooleanFieldEditor( ! USE_CODECOMPLETION, "Use code completion?", p)); ! ! String w = "\nWARNINGS for code completion:\n\n" + "Code completion works on top of a python shell and really \n" + "EXECUTES THE CODE YOU WRITE on the top level on the module.\n\n" *************** *** 67,77 **** + "correctly set, as it creates a shell to make code completion.\n\n" + "Code completion is activated by Ctrl+Space, as are the templates, so,\n" ! + "if you stop using code completion, the templates should still appear."; FieldEditor fe = new LabelFieldEditor("Warning", w, p); addField(fe); - addField(new BooleanFieldEditor( - USE_CODECOMPLETION, "Use code completion?", p)); // addField(new BooleanFieldEditor( --- 70,82 ---- + "correctly set, as it creates a shell to make code completion.\n\n" + "Code completion is activated by Ctrl+Space, as are the templates, so,\n" ! + "if you stop using code completion, the templates should still appear.\n\n" + ! "AUTOCOMPLETION NOTE: autocompletion has been deactivated by default because\n" + ! "sometimes it would seem that the editor hanged, and many times no tips are\n" + ! "gotten, e.g.: Tips on parameters are NEVER gotten.\n\n" + ! "See http://pydev.sourceforge.net/codecompletion.html for more information.\n"; FieldEditor fe = new LabelFieldEditor("Warning", w, p); addField(fe); // addField(new BooleanFieldEditor( Index: PyCodeCompletion.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PyCodeCompletion.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyCodeCompletion.java 13 Oct 2004 19:52:54 -0000 1.14 --- PyCodeCompletion.java 19 Oct 2004 14:41:55 -0000 1.15 *************** *** 175,182 **** } ! if(lineOfOffset!=-1) ! return "\n"+getDocToParseFromLine(doc, lineOfOffset); ! else return ""; } --- 175,187 ---- } ! if(lineOfOffset!=-1){ ! String docToParseFromLine = getDocToParseFromLine(doc, lineOfOffset); ! if(docToParseFromLine != null) ! return "\n"+docToParseFromLine; ! else ! return ""; ! }else{ return ""; + } } *************** *** 210,214 **** } catch (BadLocationException e1) { ! e1.printStackTrace(); } return newDoc; --- 215,221 ---- } catch (BadLocationException e1) { ! //that's ok... ! //e1.printStackTrace(); ! return null; } return newDoc; |
From: Fabio Z. <fa...@us...> - 2004-10-19 14:42:07
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18360/src/org/python/pydev/parser Modified Files: PyParser.java Log Message: code completion changes Index: PyParser.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/parser/PyParser.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PyParser.java 22 Sep 2004 16:32:41 -0000 1.10 --- PyParser.java 19 Oct 2004 14:41:56 -0000 1.11 *************** *** 256,264 **** private void tryReparseChangingLine(int line) { String docToParse = PyCodeCompletion.getDocToParseFromLine(document, line); ! // create a stream with document's data ! StringReader inString = new StringReader(docToParse); ! ReaderCharStream in = new ReaderCharStream(inString); ! reparseDocument(in, false); } } --- 256,266 ---- private void tryReparseChangingLine(int line) { String docToParse = PyCodeCompletion.getDocToParseFromLine(document, line); + if(docToParse != null){ ! // create a stream with document's data ! StringReader inString = new StringReader(docToParse); ! ReaderCharStream in = new ReaderCharStream(inString); ! reparseDocument(in, false); ! } } } |
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32131/src/org/python/pydev/editor/codecompletion Modified Files: PyContentAssistant.java PyCodeCompletionPreferencesPage.java PythonShell.java PythonCompletionProcessor.java Added Files: LabelFieldEditor.java Log Message: Code completion changes. --- NEW FILE: LabelFieldEditor.java --- /* * Created on Oct 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.codecompletion; import org.eclipse.jface.preference.FieldEditor; import org.eclipse.swt.widgets.Composite; class LabelFieldEditor extends FieldEditor { public LabelFieldEditor(String name, String labelText, Composite parent) { init(name, labelText); createControl(parent); } protected void adjustForNumColumns(int numColumns) { } protected void doFillIntoGrid(Composite parent, int numColumns) { getLabelControl(parent); } protected void doLoad() { } protected void doLoadDefault() { } protected void doStore() { } public int getNumberOfControls() { return 1; } } Index: PythonShell.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PythonShell.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PythonShell.java 13 Oct 2004 19:52:53 -0000 1.15 --- PythonShell.java 19 Oct 2004 13:29:33 -0000 1.16 *************** *** 30,33 **** --- 30,34 ---- public class PythonShell { + private static final int DEFAULT_SLEEP_BETWEEN_ATTEMPTS = 100; /** * Reference to a 'global python shell' *************** *** 151,162 **** process = Runtime.getRuntime().exec(execMsg); boolean connected = false; int attempts = 0; ! sleepALittle(200); while(!connected && attempts < 20){ attempts += 1; try { ! socketToWrite = new Socket("127.0.0.1",pWrite); //we should write in this port serverSocket = new ServerSocket(pRead); //and read in this port socketToRead = serverSocket.accept(); --- 152,174 ---- process = Runtime.getRuntime().exec(execMsg); + sleepALittle(200); + if(process == null){ + throw new CoreException(PydevPlugin.makeStatus(IStatus.ERROR, "Error creating python process - got null process("+execMsg+")", new Exception("Error creating python process - got null process."))); + } + try { + int exitVal = process.exitValue(); //should throw exception saying that it still is not terminated... + //if no exception is thrown, we have an error... + throw new CoreException(PydevPlugin.makeStatus(IStatus.ERROR, "Error creating python process - exited before creating sockets - exitValue = ("+exitVal+")("+execMsg+")", new Exception("Error creating python process - exited before creating sockets - exitValue = ("+exitVal+")."))); + } catch (IllegalThreadStateException e2) { //this is ok + } + boolean connected = false; int attempts = 0; ! sleepALittle(300); while(!connected && attempts < 20){ attempts += 1; try { ! socketToWrite = new Socket("127.0.0.1",pWrite); //we should write in this port serverSocket = new ServerSocket(pRead); //and read in this port socketToRead = serverSocket.accept(); *************** *** 165,169 **** PydevPlugin.log(IStatus.ERROR, "Attempt: "+attempts+" of 20 failed, trying again...", e1); } ! sleepALittle(milisSleep); } --- 177,185 ---- PydevPlugin.log(IStatus.ERROR, "Attempt: "+attempts+" of 20 failed, trying again...", e1); } ! ! //if not connected, let's sleep a little for another attempt ! if(!connected){ ! sleepALittle(milisSleep); ! } } *************** *** 171,175 **** //what, after all this trouble we are still not connected????!?!?!?! //let's communicate this to the user... ! throw new CoreException(PydevPlugin.makeStatus(IStatus.ERROR, "Error creating python process ("+execMsg+")", new Exception("Error creating python process."))); } --- 187,191 ---- //what, after all this trouble we are still not connected????!?!?!?! //let's communicate this to the user... ! throw new CoreException(PydevPlugin.makeStatus(IStatus.ERROR, "Error connecting to python process ("+execMsg+")", new Exception("Error connecting to python process."))); } *************** *** 203,207 **** */ public void startIt() throws IOException, CoreException{ ! this.startIt(25); } --- 219,223 ---- */ public void startIt() throws IOException, CoreException{ ! this.startIt(DEFAULT_SLEEP_BETWEEN_ATTEMPTS); } Index: PyCodeCompletionPreferencesPage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PyCodeCompletionPreferencesPage.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyCodeCompletionPreferencesPage.java 21 Sep 2004 13:18:03 -0000 1.4 --- PyCodeCompletionPreferencesPage.java 19 Oct 2004 13:29:33 -0000 1.5 *************** *** 9,15 **** import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.FieldEditorPreferencePage; - import org.eclipse.jface.preference.IntegerFieldEditor; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; --- 9,16 ---- import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; import org.eclipse.jface.preference.BooleanFieldEditor; + import org.eclipse.jface.preference.FieldEditor; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.swt.widgets.Composite; + import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; *************** *** 18,40 **** /** * @author Fabio Zadrozny */ ! public class PyCodeCompletionPreferencesPage extends FieldEditorPreferencePage ! implements IWorkbenchPreferencePage , Preferences.IPropertyChangeListener { ! public static final String AUTOCOMPLETE_ON_DOT = "AUTOCOMPLETE_ON_DOT"; ! public static final boolean DEFAULT_AUTOCOMPLETE_ON_DOT = true; ! ! public static final String USE_AUTOCOMPLETE = "USE_AUTOCOMPLETE"; ! public static final boolean DEFAULT_USE_AUTOCOMPLETE = true; ! ! public static final String AUTOCOMPLETE_DELAY = "AUTOCOMPLETE_DELAY"; ! public static final int DEFAULT_AUTOCOMPLETE_DELAY = 250; ! ! public static final String AUTOCOMPLETE_ON_PAR = "AUTOCOMPLETE_ON_PAR"; ! public static final boolean DEFAULT_AUTOCOMPLETE_ON_PAR = false; ! /** */ public PyCodeCompletionPreferencesPage() { --- 19,46 ---- /** + * The preferences for autocompletion should only be reactivated when the code completion feature gets better (more stable and precise). + * * @author Fabio Zadrozny */ ! public class PyCodeCompletionPreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, ! Preferences.IPropertyChangeListener { + public static final String USE_CODECOMPLETION = "USE_CODECOMPLETION"; + public static final boolean DEFAULT_USE_CODECOMPLETION = false; ! // public static final String AUTOCOMPLETE_ON_DOT = "AUTOCOMPLETE_ON_DOT"; ! // public static final boolean DEFAULT_AUTOCOMPLETE_ON_DOT = true; ! // ! // public static final String USE_AUTOCOMPLETE = "USE_AUTOCOMPLETE"; ! // public static final boolean DEFAULT_USE_AUTOCOMPLETE = true; ! // ! // public static final String AUTOCOMPLETE_DELAY = "AUTOCOMPLETE_DELAY"; ! // public static final int DEFAULT_AUTOCOMPLETE_DELAY = 250; ! // ! // public static final String AUTOCOMPLETE_ON_PAR = "AUTOCOMPLETE_ON_PAR"; ! // public static final boolean DEFAULT_AUTOCOMPLETE_ON_PAR = false; ! private Label labelWarning; ! /** */ public PyCodeCompletionPreferencesPage() { *************** *** 49,65 **** */ protected void createFieldEditors() { ! Composite p = getFieldEditorParent(); ! addField(new BooleanFieldEditor( ! USE_AUTOCOMPLETE, "Use autocompletion?", p)); ! addField(new IntegerFieldEditor( ! AUTOCOMPLETE_DELAY, "Autocompletion delay: ", p)); ! addField(new BooleanFieldEditor( ! AUTOCOMPLETE_ON_DOT, "Autocomplete on '.'?", p)); ! addField(new BooleanFieldEditor( ! AUTOCOMPLETE_ON_PAR, "Autocomplete on '('?", p)); } --- 55,89 ---- */ protected void createFieldEditors() { ! Composite p = getFieldEditorParent(); ! String w = "WARNINGS for code completion:\n\n" ! + "Code completion works on top of a python shell and really \n" ! + "EXECUTES THE CODE YOU WRITE on the top level on the module.\n\n" ! + "So, you should NEVER call code that allocates resources or \n" ! + "make any other dangerous initializations in the global scope of \n" ! + "the module (not only because of code completion, as a simple \n" ! + "import of that code would be dangerous).\n\n" ! + "Code completion might also not work if the interpreter is not \n" ! + "correctly set, as it creates a shell to make code completion.\n\n" ! + "Code completion is activated by Ctrl+Space, as are the templates, so,\n" ! + "if you stop using code completion, the templates should still appear."; ! FieldEditor fe = new LabelFieldEditor("Warning", w, p); ! addField(fe); ! addField(new BooleanFieldEditor( ! USE_CODECOMPLETION, "Use code completion?", p)); ! // addField(new BooleanFieldEditor( ! // USE_AUTOCOMPLETE, "Use autocompletion?", p)); ! // ! // addField(new IntegerFieldEditor( ! // AUTOCOMPLETE_DELAY, "Autocompletion delay: ", p)); ! // ! // addField(new BooleanFieldEditor( ! // AUTOCOMPLETE_ON_DOT, "Autocomplete on '.'?", p)); ! // ! // addField(new BooleanFieldEditor( ! // AUTOCOMPLETE_ON_PAR, "Autocomplete on '('?", p)); } *************** *** 73,113 **** PydevPrefs.getPreferences().addPropertyChangeListener(this); } - /** - * Sets default preference values - */ - public static void initializeDefaultPreferences(Preferences prefs) { - prefs.setDefault(AUTOCOMPLETE_ON_DOT, DEFAULT_AUTOCOMPLETE_ON_DOT); - prefs.setDefault(USE_AUTOCOMPLETE, DEFAULT_USE_AUTOCOMPLETE); - prefs.setDefault(AUTOCOMPLETE_DELAY, DEFAULT_AUTOCOMPLETE_DELAY); - prefs.setDefault(AUTOCOMPLETE_ON_PAR, DEFAULT_AUTOCOMPLETE_ON_PAR); - } - - public static boolean isToAutocompleteOnDot() { - return PydevPrefs.getPreferences().getBoolean(PyCodeCompletionPreferencesPage.AUTOCOMPLETE_ON_DOT); - } ! public static boolean isToAutocompleteOnPar() { ! return PydevPrefs.getPreferences().getBoolean(PyCodeCompletionPreferencesPage.AUTOCOMPLETE_ON_PAR); ! } ! ! public static boolean useAutocomplete() { ! return PydevPrefs.getPreferences().getBoolean(PyCodeCompletionPreferencesPage.USE_AUTOCOMPLETE); } ! public static int getAutocompleteDelay() { ! return PydevPrefs.getPreferences().getInt(PyCodeCompletionPreferencesPage.AUTOCOMPLETE_DELAY); } ! /* (non-Javadoc) * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { ! // System.out.println( event.getProperty() ! // + "\n\told setting: " ! // + event.getOldValue() ! // + "\n\tnew setting: " ! // + event.getNewValue()); ! } --- 97,144 ---- PydevPrefs.getPreferences().addPropertyChangeListener(this); } ! /** ! * Sets default preference values ! */ ! public static void initializeDefaultPreferences(Preferences prefs) { ! prefs.setDefault(USE_CODECOMPLETION, DEFAULT_USE_CODECOMPLETION); ! // prefs.setDefault(AUTOCOMPLETE_ON_DOT, DEFAULT_AUTOCOMPLETE_ON_DOT); ! // prefs.setDefault(USE_AUTOCOMPLETE, DEFAULT_USE_AUTOCOMPLETE); ! // prefs.setDefault(AUTOCOMPLETE_DELAY, DEFAULT_AUTOCOMPLETE_DELAY); ! // prefs.setDefault(AUTOCOMPLETE_ON_PAR, DEFAULT_AUTOCOMPLETE_ON_PAR); } ! public static boolean useCodeCompletion() { ! return PydevPrefs.getPreferences().getBoolean(PyCodeCompletionPreferencesPage.USE_CODECOMPLETION); } + // public static boolean isToAutocompleteOnDot() { + // return PydevPrefs.getPreferences().getBoolean(PyCodeCompletionPreferencesPage.AUTOCOMPLETE_ON_DOT); + // } + // + // public static boolean isToAutocompleteOnPar() { + // return PydevPrefs.getPreferences().getBoolean(PyCodeCompletionPreferencesPage.AUTOCOMPLETE_ON_PAR); + // } + // + // public static boolean useAutocomplete() { + // return PydevPrefs.getPreferences().getBoolean(PyCodeCompletionPreferencesPage.USE_AUTOCOMPLETE); + // } + // + // public static int getAutocompleteDelay() { + // return PydevPrefs.getPreferences().getInt(PyCodeCompletionPreferencesPage.AUTOCOMPLETE_DELAY); + // } ! /* ! * (non-Javadoc) ! * * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { ! // System.out.println( event.getProperty() ! // + "\n\told setting: " ! // + event.getOldValue() ! // + "\n\tnew setting: " ! // + event.getNewValue()); ! } Index: PythonCompletionProcessor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PythonCompletionProcessor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PythonCompletionProcessor.java 13 Oct 2004 19:52:54 -0000 1.10 --- PythonCompletionProcessor.java 19 Oct 2004 13:29:33 -0000 1.11 *************** *** 90,107 **** int qlen = qualifier.length(); - try { - PythonShell.getServerShell(PythonShell.COMPLETION_SHELL).sendGoToDirMsg(edit.getEditorFile()); - } catch (Exception e) { - //if we don't suceed, we don't have to fail... just go on and try - // to complete... - e.printStackTrace(); - } - - List pythonProposals = getPythonProposals(documentOffset, doc, activationToken, qlen); - List templateProposals = getTemplateProposals(viewer, documentOffset, activationToken, qualifier, - pythonProposals); - ArrayList pythonAndTemplateProposals = new ArrayList(); ! pythonAndTemplateProposals.addAll(pythonProposals); pythonAndTemplateProposals.addAll(templateProposals); --- 90,107 ---- int qlen = qualifier.length(); ArrayList pythonAndTemplateProposals = new ArrayList(); ! if(PyCodeCompletionPreferencesPage.useCodeCompletion()){ ! try { ! PythonShell.getServerShell(PythonShell.COMPLETION_SHELL).sendGoToDirMsg(edit.getEditorFile()); ! } catch (Exception e) { ! //if we don't suceed, we don't have to fail... just go on and try ! // to complete... ! e.printStackTrace(); ! } ! ! List pythonProposals = getPythonProposals(documentOffset, doc, activationToken, qlen); ! pythonAndTemplateProposals.addAll(pythonProposals); ! } ! List templateProposals = getTemplateProposals(viewer, documentOffset, activationToken, qualifier); pythonAndTemplateProposals.addAll(templateProposals); *************** *** 153,157 **** */ private List getTemplateProposals(ITextViewer viewer, int documentOffset, String activationToken, ! java.lang.String qualifier, List allProposals) { List propList = new ArrayList(); this.templatesCompletion.addTemplateProposals(viewer, documentOffset, propList); --- 153,157 ---- */ private List getTemplateProposals(ITextViewer viewer, int documentOffset, String activationToken, ! java.lang.String qualifier) { List propList = new ArrayList(); this.templatesCompletion.addTemplateProposals(viewer, documentOffset, propList); *************** *** 176,185 **** public char[] getCompletionProposalAutoActivationCharacters() { char[] c = new char[0]; ! if (PyCodeCompletionPreferencesPage.isToAutocompleteOnDot()) { ! c = addChar(c, '.'); ! } ! if (PyCodeCompletionPreferencesPage.isToAutocompleteOnPar()) { ! c = addChar(c, '('); ! } return c; } --- 176,185 ---- public char[] getCompletionProposalAutoActivationCharacters() { char[] c = new char[0]; ! // if (PyCodeCompletionPreferencesPage.isToAutocompleteOnDot()) { ! // c = addChar(c, '.'); ! // } ! // if (PyCodeCompletionPreferencesPage.isToAutocompleteOnPar()) { ! // c = addChar(c, '('); ! // } return c; } Index: PyContentAssistant.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PyContentAssistant.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyContentAssistant.java 25 Aug 2004 17:25:23 -0000 1.1 --- PyContentAssistant.java 19 Oct 2004 13:29:33 -0000 1.2 *************** *** 18,23 **** public PyContentAssistant(){ PydevPrefs.getPreferences().addPropertyChangeListener(this); ! enableAutoActivation(PyCodeCompletionPreferencesPage.useAutocomplete()); ! setAutoActivationDelay(PyCodeCompletionPreferencesPage.getAutocompleteDelay()); } --- 18,22 ---- public PyContentAssistant(){ PydevPrefs.getPreferences().addPropertyChangeListener(this); ! // enableAutoActivation(PyCodeCompletionPreferencesPage.useAutocomplete()); } *************** *** 26,35 **** */ public void propertyChange(PropertyChangeEvent event) { ! if(event.getProperty().equals(PyCodeCompletionPreferencesPage.USE_AUTOCOMPLETE)){ ! this.enableAutoActivation( ((Boolean)event.getNewValue()).booleanValue() ); ! } ! if(event.getProperty().equals(PyCodeCompletionPreferencesPage.AUTOCOMPLETE_DELAY)){ ! this.setAutoActivationDelay( ((Integer)event.getNewValue()).intValue() ); ! } } } --- 25,31 ---- */ public void propertyChange(PropertyChangeEvent event) { ! // if(event.getProperty().equals(PyCodeCompletionPreferencesPage.USE_AUTOCOMPLETE)){ ! // this.enableAutoActivation( ((Boolean)event.getNewValue()).booleanValue() ); ! // } } } |
From: Fabio Z. <fa...@us...> - 2004-10-19 11:12:42
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28440 Modified Files: plugin.xml Log Message: Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** plugin.xml 18 Oct 2004 19:14:20 -0000 1.48 --- plugin.xml 19 Oct 2004 11:12:30 -0000 1.49 *************** *** 4,8 **** id="org.python.pydev" name="Pydev - Python Development Environment" ! version="0.6.2" provider-name="AleksTotic" class="org.python.pydev.plugin.PydevPlugin"> --- 4,8 ---- id="org.python.pydev" name="Pydev - Python Development Environment" ! version="0.6.2.2" provider-name="AleksTotic" class="org.python.pydev.plugin.PydevPlugin"> |
From: Fabio Z. <fa...@us...> - 2004-10-19 11:12:30
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28341 Modified Files: plugin.xml Log Message: Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** plugin.xml 18 Oct 2004 19:13:15 -0000 1.20 --- plugin.xml 19 Oct 2004 11:12:18 -0000 1.21 *************** *** 4,8 **** id="org.python.pydev.debug" name="Pydev debug" ! version="0.6.2" provider-name="Aleks Totic" class="org.python.pydev.debug.core.PydevDebugPlugin"> --- 4,8 ---- id="org.python.pydev.debug" name="Pydev debug" ! version="0.6.2.2" provider-name="Aleks Totic" class="org.python.pydev.debug.core.PydevDebugPlugin"> |
From: Fabio Z. <fa...@us...> - 2004-10-19 11:12:30
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28341/src/org/python/pydev/debug/codecoverage Modified Files: CoverageCache.java PyCoverage.java FileNode.java Added Files: ErrorFileNode.java Log Message: --- NEW FILE: ErrorFileNode.java --- /* * Created on Oct 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.debug.codecoverage; /** * @author Fabio Zadrozny */ public class ErrorFileNode { public Object node; public String desc; /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if(!(obj instanceof ErrorFileNode)){ return false; } ErrorFileNode f = (ErrorFileNode) obj; return f.node.equals(node) && f.desc == desc; } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { return FileNode.getName(node.toString()) + " " +desc; } } Index: FileNode.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/FileNode.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FileNode.java 15 Oct 2004 19:53:28 -0000 1.2 --- FileNode.java 19 Oct 2004 11:12:18 -0000 1.3 *************** *** 72,76 **** public static String calcCover( int stmts, int exec){ ! double v = ((double)exec) / ((double)stmts) * 100.0; DecimalFormat format = new DecimalFormat("##.#"); String str = format.format(v); --- 72,79 ---- public static String calcCover( int stmts, int exec){ ! double v = 0; ! if(stmts != 0){ ! v = ((double)exec) / ((double)stmts) * 100.0; ! } DecimalFormat format = new DecimalFormat("##.#"); String str = format.format(v); Index: PyCoverage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/PyCoverage.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyCoverage.java 18 Oct 2004 19:13:13 -0000 1.4 --- PyCoverage.java 19 Oct 2004 11:12:18 -0000 1.5 *************** *** 12,20 **** import java.io.InputStreamReader; import java.util.ArrayList; - import java.util.Arrays; import java.util.Iterator; import java.util.List; - import java.util.Properties; - import java.util.Set; import java.util.StringTokenizer; --- 12,17 ---- *************** *** 29,86 **** * This class is used to make the code coverage. * ! * It works in this way: when the user requests the coverage for the execution ! * of a module, we create a python process and execute the module using the code ! * coverage module that is packed with pydev. * ! * Other options are: - Erasing the results obtained; - Getting the results when ! * requested (cached in this class). * * @author Fabio Zadrozny */ public class PyCoverage { ! public CoverageCache cache = new CoverageCache(); ! ! /** ! * This method contacts the python server so that we get the information on ! * the files that are below the directory passed as a parameter and stores the information ! * needed on the cache. * ! * @param file should be the root folder from where we want cache info. */ public void refreshCoverageInfo(File file, IProgressMonitor monitor) { cache.clear(); ! if(file == null){ return; } try { ! if(file.isDirectory() == false){ throw new RuntimeException("We can only get information on a dir."); } ! ! List pyFilesBelow[] = new List[]{new ArrayList(), new ArrayList()}; ! if (file.exists()) { pyFilesBelow = getPyFilesBelow(file, monitor, true); ! } ! if(pyFilesBelow[0].size() == 0){ //no files return; } ! //add the folders to the cache boolean added = false; for (Iterator it = pyFilesBelow[1].iterator(); it.hasNext();) { File f = (File) it.next(); ! if(!added){ cache.addFolder(f); added = true; ! }else{ cache.addFolder(f, f.getParentFile()); } } ! ! //now that we have the file information, we have to get the // coverage information on these files and --- 26,79 ---- * This class is used to make the code coverage. * ! * It works in this way: when the user requests the coverage for the execution of a module, we create a python process and execute the ! * module using the code coverage module that is packed with pydev. * ! * Other options are: - Erasing the results obtained; - Getting the results when requested (cached in this class). * * @author Fabio Zadrozny */ public class PyCoverage { ! public CoverageCache cache = new CoverageCache(); ! /** ! * This method contacts the python server so that we get the information on the files that are below the directory passed as a parameter ! * and stores the information needed on the cache. * ! * @param file ! * should be the root folder from where we want cache info. */ public void refreshCoverageInfo(File file, IProgressMonitor monitor) { cache.clear(); ! if (file == null) { return; } try { ! if (file.isDirectory() == false) { throw new RuntimeException("We can only get information on a dir."); } ! ! List pyFilesBelow[] = new List[] { new ArrayList(), new ArrayList() }; ! if (file.exists()) { pyFilesBelow = getPyFilesBelow(file, monitor, true); ! } ! if (pyFilesBelow[0].size() == 0) { //no files return; } ! //add the folders to the cache boolean added = false; for (Iterator it = pyFilesBelow[1].iterator(); it.hasNext();) { File f = (File) it.next(); ! if (!added) { cache.addFolder(f); added = true; ! } else { cache.addFolder(f, f.getParentFile()); } } ! //now that we have the file information, we have to get the // coverage information on these files and *************** *** 99,113 **** //python coverage.py -r -m files.... ! String[] cmdLine = new String[3]; cmdLine[0] = PydevPrefs.getDefaultInterpreter(); cmdLine[1] = profileScript; ! cmdLine[2] = "-waitfor"; monitor.setTaskName("Starting shell to get info..."); monitor.worked(1); ! Process p=null; ! try { ! p = execute(cmdLine); //we have the process... --- 92,107 ---- //python coverage.py -r -m files.... ! String[] cmdLine = new String[4]; cmdLine[0] = PydevPrefs.getDefaultInterpreter(); cmdLine[1] = profileScript; ! cmdLine[2] = getCoverageFileLocation(); ! cmdLine[3] = "-waitfor"; monitor.setTaskName("Starting shell to get info..."); monitor.worked(1); ! Process p = null; ! try { ! p = execute(cmdLine); //we have the process... *************** *** 116,126 **** String files = ""; ! for (Iterator iter = pyFilesBelow[0].iterator(); iter.hasNext();) { String fStr = iter.next().toString(); ! files += fStr+"|"; } files += "\r"; monitor.setTaskName("Writing to shell..."); monitor.worked(1); p.getOutputStream().write(files.getBytes()); --- 110,123 ---- String files = ""; ! for (Iterator iter = pyFilesBelow[0].iterator(); iter.hasNext();) { String fStr = iter.next().toString(); ! files += fStr + "|"; } files += "\r"; monitor.setTaskName("Writing to shell..."); + + // System.out.println("Writing to shell... " + files); + monitor.worked(1); p.getOutputStream().write(files.getBytes()); *************** *** 131,164 **** monitor.worked(1); while ((str = in.readLine()) != null) { // System.out.println("STDOUT: " + str);//get the data... - StringTokenizer tokenizer = new StringTokenizer(str); - int nTokens = tokenizer.countTokens(); - if(nTokens == 5 || nTokens == 4){ ! String []strings = new String[5]; ! int k = 0; ! while(tokenizer.hasMoreElements()){ ! strings[k] = tokenizer.nextToken(); ! k++; ! } ! ! if(strings[1].equals("Stmts") == false && strings[0].equals("TOTAL") == false){ ! //information in the format: D:\dev_programs\test\test1.py 11 0 0% 1,2,4-23 ! // System.out.println("VALID: " + str);//get the data... ! File f = new File(strings[0]); ! if(nTokens == 4){ ! cache.addFile(f, f.getParentFile(), Integer.parseInt(strings[1]), Integer.parseInt(strings[2]), ""); ! }else{ ! cache.addFile(f, f.getParentFile(), Integer.parseInt(strings[1]), Integer.parseInt(strings[2]), strings[4]); ! } ! String[] strs = f.toString().replaceAll("/", " ").replaceAll("\\\\"," ").split(" "); ! if (strs.length > 1){ ! monitor.setTaskName("Getting coverage info..."+strs[strs.length -1]); ! }else{ ! monitor.setTaskName("Getting coverage info..."+f.toString()); ! } ! monitor.worked(1); ! } ! } } in.close(); --- 128,135 ---- monitor.worked(1); while ((str = in.readLine()) != null) { + // System.out.println("STDOUT: " + str);//get the data... ! analyzeReadLine(monitor, str); } in.close(); *************** *** 168,172 **** monitor.setTaskName("Finished"); } catch (Exception e) { ! if(p!=null){ p.destroy(); } --- 139,143 ---- monitor.setTaskName("Finished"); } catch (Exception e) { ! if (p != null) { p.destroy(); } *************** *** 174,179 **** } - - } catch (Exception e1) { e1.printStackTrace(); --- 145,148 ---- *************** *** 182,188 **** } /** ! * */ public void clearInfo() { --- 151,229 ---- } + /** + * @param monitor + * @param str + */ + private void analyzeReadLine(IProgressMonitor monitor, String str) { + boolean added = false; + StringTokenizer tokenizer = new StringTokenizer(str); + int nTokens = tokenizer.countTokens(); + String[] strings = new String[nTokens]; + + int k = 0; + while (tokenizer.hasMoreElements()) { + strings[k] = tokenizer.nextToken(); + k++; + } + if (nTokens == 5 || nTokens == 4) { + + try { + if (strings[1].equals("Stmts") == false && strings[0].equals("TOTAL") == false) { + //information in the format: D:\dev_programs\test\test1.py 11 0 0% 1,2,4-23 + File f = new File(strings[0]); + if (nTokens == 4) { + cache.addFile(f, f.getParentFile(), Integer.parseInt(strings[1]), Integer.parseInt(strings[2]), ""); + added = true; + } else { + cache.addFile(f, f.getParentFile(), Integer.parseInt(strings[1]), Integer.parseInt(strings[2]), strings[4]); + added = true; + } + String[] strs = f.toString().replaceAll("/", " ").replaceAll("\\\\", " ").split(" "); + if (strs.length > 1) { + monitor.setTaskName("Getting coverage info..." + strs[strs.length - 1]); + } else { + monitor.setTaskName("Getting coverage info..." + f.toString()); + } + monitor.worked(1); + } + } catch (RuntimeException e2) { + //maybe there is something similar, but isn't quite the same, so, parse int could give us some problems... + e2.printStackTrace(); + } + } + + //we may have gotten an error in the following format: + //X:\coilib30\python\coilib\geom\Box3D.py exceptions.IndentationError: unindent does not match any outer indentation level (line + // 97) + //X:\coilib30\python\coilib\x3d\layers\cacherenderer.py exceptions.SyntaxError: invalid syntax (line 95) + // + //that is: file errorClass desc. + if (added == false) { + try { + File f = new File(strings[0]); + if(f.exists() && f.isFile()){ //this is probably an error... + cache.addFile(f, f.getParentFile(), getError(strings)); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + } /** ! * @param strings ! * @return ! */ ! private String getError(String[] strings) { ! StringBuffer ret = new StringBuffer(); ! for (int i = 1; i < strings.length; i++) { ! ret.append(strings[i]+" "); ! } ! return ret.toString(); ! } ! ! /** ! * */ public void clearInfo() { *************** *** 190,206 **** String profileScript; profileScript = PythonRunnerConfig.getProfileScript(); ! String[] cmdLine = new String[3]; ! cmdLine[0] = PydevPrefs.getDefaultInterpreter(); ! cmdLine[1] = profileScript; ! cmdLine[2] = "-e"; ! Process p = execute(cmdLine); ! p.waitFor(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } ! } ! /** * @param cmdLine --- 231,248 ---- String profileScript; profileScript = PythonRunnerConfig.getProfileScript(); ! String[] cmdLine = new String[4]; ! cmdLine[0] = PydevPrefs.getDefaultInterpreter(); ! cmdLine[1] = profileScript; ! cmdLine[2] = getCoverageFileLocation(); ! cmdLine[3] = "-e"; ! Process p = execute(cmdLine); ! p.waitFor(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } ! } ! /** * @param cmdLine *************** *** 210,221 **** private Process execute(String[] cmdLine) throws IOException { Process p; ! ! String [] envp = PyCoverage.setCoverageFileEnviromentVariable(null); ! ! p = Runtime.getRuntime().exec(cmdLine, envp); return p; } - /** * Returns the directories and python files in a list. --- 252,260 ---- private Process execute(String[] cmdLine) throws IOException { Process p; ! ! p = Runtime.getRuntime().exec(cmdLine, null); return p; } /** * Returns the directories and python files in a list. *************** *** 224,229 **** * @return tuple with files in pos 0 and folders in pos 1 */ ! public static List[] getPyFilesBelow(File file , FileFilter filter, IProgressMonitor monitor) { ! if(monitor == null){ monitor = new NullProgressMonitor(); } --- 263,268 ---- * @return tuple with files in pos 0 and folders in pos 1 */ ! public static List[] getPyFilesBelow(File file, FileFilter filter, IProgressMonitor monitor) { ! if (monitor == null) { monitor = new NullProgressMonitor(); } *************** *** 236,246 **** folders.add(file); File[] files = null; ! ! if(filter != null){ files = file.listFiles(filter); ! }else{ files = file.listFiles(); } ! for (int i = 0; i < files.length; i++) { List[] below = getPyFilesBelow(files[i], filter, monitor); --- 275,285 ---- folders.add(file); File[] files = null; ! ! if (filter != null) { files = file.listFiles(filter); ! } else { files = file.listFiles(); } ! for (int i = 0; i < files.length; i++) { List[] below = getPyFilesBelow(files[i], filter, monitor); *************** *** 252,260 **** filesToReturn.add(file); monitor.worked(1); ! monitor.setTaskName("Found:"+file.toString()); } } ! return new List[]{filesToReturn, folders}; ! } --- 291,299 ---- filesToReturn.add(file); monitor.worked(1); ! monitor.setTaskName("Found:" + file.toString()); } } ! return new List[] { filesToReturn, folders }; ! } *************** *** 269,273 **** public boolean accept(File pathname) { ! if(includeDirs) return pathname.isDirectory() || pathname.toString().endsWith(".py"); else --- 308,312 ---- public boolean accept(File pathname) { ! if (includeDirs) return pathname.isDirectory() || pathname.toString().endsWith(".py"); else *************** *** 294,298 **** try { File pySrcPath = PydevDebugPlugin.getPySrcPath(); ! return pySrcPath.getAbsolutePath() + "/.coverage"; } catch (CoreException e) { throw new RuntimeException(e); --- 333,337 ---- try { File pySrcPath = PydevDebugPlugin.getPySrcPath(); ! return "\"" + pySrcPath.getAbsolutePath() + "/.coverage" + "\""; } catch (CoreException e) { throw new RuntimeException(e); *************** *** 300,340 **** } - /** - * @param envp - * @return - */ - public static String[] setCoverageFileEnviromentVariable(String[] envp) { - if(envp == null){ - Properties properties = System.getProperties(); - Set set = properties.keySet(); - - envp = new String [set.size()]; - int j = 0; - for (Iterator iter = set.iterator(); iter.hasNext();) { - Object element = (Object) iter.next(); - envp[j] = element+"="+properties.getProperty(element.toString()).toString(); - j++; - } - - } - - boolean added = false; - - for (int i = 0; i < envp.length; i++) { - - if (envp[i].startsWith("COVERAGE_FILE")) { - envp[i] = "COVERAGE_FILE=" + getCoverageFileLocation(); - added = true; - } - - } - if (!added) { - List list = new ArrayList(Arrays.asList(envp)); - list.add("COVERAGE_FILE=" + getCoverageFileLocation()); - envp = (String[]) list.toArray(new String[0]); - } - return envp; - } - - } \ No newline at end of file --- 339,341 ---- Index: CoverageCache.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/CoverageCache.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CoverageCache.java 18 Oct 2004 19:13:13 -0000 1.3 --- CoverageCache.java 19 Oct 2004 11:12:18 -0000 1.4 *************** *** 106,114 **** files.put(node, fileNode); } public List getFiles(Object node) throws NodeNotFoudException{ FolderNode folderNode = (FolderNode) getFolder(node); if (folderNode == null){ ! FileNode fileNode = (FileNode) getFile(node); if (fileNode == null){ throw new NodeNotFoudException("The node has not been found: "+node.toString()); --- 106,137 ---- files.put(node, fileNode); } + + /** + * + * @param node + * @param parent + * @param stmts + * @param exec + * @param notExecuted + */ + public void addFile(Object node, Object parent, String desc) { + FolderNode folderNode = (FolderNode) getFolder(parent); + + if (folderNode == null){ + throw new RuntimeException("A file node ("+node.toString()+")MUST have a related folder node."); + } + + ErrorFileNode fileNode = new ErrorFileNode(); + fileNode.node = node; + fileNode.desc = desc; + + folderNode.files.put(node, fileNode); + files.put(node, fileNode); + } public List getFiles(Object node) throws NodeNotFoudException{ FolderNode folderNode = (FolderNode) getFolder(node); if (folderNode == null){ ! Object fileNode = getFile(node); if (fileNode == null){ throw new NodeNotFoudException("The node has not been found: "+node.toString()); *************** *** 172,179 **** for (Iterator it = list.iterator(); it.hasNext();) { ! FileNode element = (FileNode) it.next(); buffer.append(element.toString()+"\n"); ! totalExecuted += element.exec; ! totalStmts += element.stmts; } --- 195,204 ---- for (Iterator it = list.iterator(); it.hasNext();) { ! Object element = it.next(); buffer.append(element.toString()+"\n"); ! if(element instanceof FileNode){ //it may have been an error node... ! totalExecuted += ((FileNode)element).exec; ! totalStmts += ((FileNode)element).stmts; ! } } |
From: Fabio Z. <fa...@us...> - 2004-10-19 11:12:29
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28341/pysrc Modified Files: coverage.py Log Message: Index: coverage.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/coverage.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** coverage.py 18 Oct 2004 19:13:13 -0000 1.4 --- coverage.py 19 Oct 2004 11:12:17 -0000 1.5 *************** *** 88,92 **** return t ! the_coverage = None class coverage: --- 88,95 ---- return t ! ! def getCoverageLoc(self): ! global cache_location ! return cache_location class coverage: *************** *** 112,120 **** canonical_filename_cache = {} def __init__(self): global the_coverage ! if the_coverage: ! raise self.error, "Only one coverage object allowed." ! self.cache = os.environ.get(self.cache_env, self.cache_default) self.restore() self.analysis_cache = {} --- 115,127 ---- canonical_filename_cache = {} + def __init__(self): global the_coverage ! try: ! if the_coverage: ! raise self.error, "Only one coverage object allowed." ! except NameError:#that's ok, it is still not defined... ! pass ! self.cache = getCoverageLoc(self) self.restore() self.analysis_cache = {} *************** *** 517,522 **** - # Singleton object. - the_coverage = coverage() # Module functions call methods in the singleton object. --- 524,527 ---- *************** *** 527,538 **** def report(*args): return apply(the_coverage.report, args) - # Save coverage data when Python exits. (The atexit module wasn't - # introduced until Python 2.0, so use sys.exitfunc when it's not - # available.) - try: - import atexit - atexit.register(the_coverage.save) - except ImportError: - sys.exitfunc = the_coverage.save # Command-line interface. --- 532,535 ---- *************** *** 541,549 **** --- 538,568 ---- # goes to a raw_input() and waits for the files that should be executed... + + global cache_location #let's set the cache location now... + cache_location = sys.argv[1] #first parameter is the cache location. + sys.argv.remove(cache_location) + print cache_location + + global the_coverage + # Singleton object. + the_coverage = coverage() + + # Save coverage data when Python exits. (The atexit module wasn't + # introduced until Python 2.0, so use sys.exitfunc when it's not + # available.) + try: + import atexit + atexit.register(the_coverage.save) + except ImportError: + sys.exitfunc = the_coverage.save + if len(sys.argv) == 2: + if '-waitfor' == sys.argv[1]: sys.argv.remove('-waitfor') sys.argv.append('-r') sys.argv.append('-m') + + #second gets the files to be executed s = raw_input() s = s.replace('\r', '') |
From: Fabio Z. <fa...@us...> - 2004-10-19 11:12:27
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28341/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunner.java PythonRunnerConfig.java Log Message: Index: PythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunner.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PythonRunner.java 18 Oct 2004 19:13:12 -0000 1.11 --- PythonRunner.java 19 Oct 2004 11:12:16 -0000 1.12 *************** *** 8,12 **** import java.io.File; import java.io.IOException; ! import java.net.*; import java.util.HashMap; --- 8,12 ---- import java.io.File; import java.io.IOException; ! import java.net.SocketTimeoutException; import java.util.HashMap; *************** *** 19,23 **** import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IProcess; - import org.python.pydev.debug.codecoverage.PyCoverage; import org.python.pydev.debug.core.Constants; import org.python.pydev.debug.core.PydevDebugPlugin; --- 19,22 ---- *************** *** 43,51 **** runDebug(config, launch, monitor); - }else if (config.isProfile){ - String[] envp = config.envp; - envp = PyCoverage.setCoverageFileEnviromentVariable(envp); - doIt(monitor, envp, config.getCommandLine(), config.workingDirectory, launch); - }else{ //default doIt(monitor, config.envp, config.getCommandLine(), config.workingDirectory, launch); --- 42,45 ---- Index: PythonRunnerConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PythonRunnerConfig.java 18 Oct 2004 19:13:12 -0000 1.12 --- PythonRunnerConfig.java 19 Oct 2004 11:12:17 -0000 1.13 *************** *** 16,19 **** --- 16,20 ---- import org.eclipse.debug.core.ILaunchManager; import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; + import org.python.pydev.debug.codecoverage.PyCoverage; import org.python.pydev.debug.core.Constants; import org.python.pydev.debug.core.PydevDebugPlugin; *************** *** 150,153 **** --- 151,155 ---- if(isProfile){ cmdArgs.add(profileScript); + cmdArgs.add(PyCoverage.getCoverageFileLocation()); cmdArgs.add("-x"); } *************** *** 161,184 **** } - public String[] getProfileResultsCommandLine(){ - Vector cmdArgs = new Vector(10); - cmdArgs.add(interpreter); - // Next option is for unbuffered stdout, otherwise Eclipse will not see any output until done - cmdArgs.add(org.python.pydev.ui.InterpreterEditor.isJython(interpreter) ? "-i" : "-u"); - - if(isProfile){ - cmdArgs.add(profileScript); - cmdArgs.add("-r"); - cmdArgs.add("-m"); - }else{ - throw new RuntimeException("Can only get profile script in profile mode."); - } - - cmdArgs.add(file.toOSString()); - - String[] retVal = new String[cmdArgs.size()]; - cmdArgs.toArray(retVal); - return retVal; - } public String getCommandLineAsString() { --- 163,166 ---- |