pydev-cvs Mailing List for PyDev for Eclipse (Page 298)
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-13 19:53:32
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/refactoring In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8966/src/org/python/pydev/editor/refactoring Modified Files: PyRefactoring.java Log Message: Index: PyRefactoring.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/refactoring/PyRefactoring.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyRefactoring.java 8 Oct 2004 16:38:43 -0000 1.6 --- PyRefactoring.java 13 Oct 2004 19:52:52 -0000 1.7 *************** *** 34,42 **** public class PyRefactoring { ! /** ! * Reference to a 'global python shell' ! */ ! private static PythonShell pytonShell; ! /** * Instead of making all static, let's use a singleton... it may be useful... --- 34,38 ---- public class PyRefactoring { ! /** * Instead of making all static, let's use a singleton... it may be useful... *************** *** 60,64 **** private PyRefactoring(){ try { ! getServerShell(); //when we initialize, initialize the server. } catch (Exception e) { e.printStackTrace(); --- 56,60 ---- private PyRefactoring(){ try { ! PythonShell.getServerShell(PythonShell.OTHERS_SHELL); //when we initialize, initialize the server. } catch (Exception e) { e.printStackTrace(); *************** *** 66,82 **** } - /** - * @return - * @throws CoreException - * @throws IOException - * - */ - private synchronized PythonShell getServerShell() throws IOException, CoreException { - if(pytonShell == null){ - pytonShell = new PythonShell(); - pytonShell.startIt(); - } - return pytonShell; - } public void addPropertyListener(IPropertyListener l) { --- 62,65 ---- *************** *** 94,98 **** PythonShell pytonShell; try { ! pytonShell = getServerShell(); try { pytonShell.write(str); --- 77,81 ---- PythonShell pytonShell; try { ! pytonShell = PythonShell.getServerShell(PythonShell.OTHERS_SHELL); try { pytonShell.write(str); *************** *** 250,254 **** public void restartShell() { try { ! getServerShell().restartShell(); } catch (IOException e) { e.printStackTrace(); --- 233,237 ---- public void restartShell() { try { ! PythonShell.getServerShell(PythonShell.OTHERS_SHELL).restartShell(); } catch (IOException e) { e.printStackTrace(); |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:53:32
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8966/src/org/python/pydev/outline Modified Files: PyOutlinePage.java Log Message: Index: PyOutlinePage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/PyOutlinePage.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PyOutlinePage.java 2 Jul 2004 02:50:39 -0000 1.9 --- PyOutlinePage.java 13 Oct 2004 19:52:53 -0000 1.10 *************** *** 7,14 **** import java.net.MalformedURLException; - import java.net.URL; - import org.eclipse.core.runtime.Path; - import org.eclipse.core.runtime.Platform; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; --- 7,11 ---- *************** *** 27,31 **** import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.views.contentoutline.ContentOutlinePage; - import org.osgi.framework.Bundle; import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.model.AbstractNode; --- 24,27 ---- *************** *** 64,69 **** super(); this.editorView = editorView; - Bundle bundle = PydevPlugin.getDefault().getBundle(); - URL bundleURL = Platform.find( bundle, new Path("/")); imageCache = new ImageCache(PydevPlugin.getDefault().getBundle().getEntry("/")); } --- 60,63 ---- |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:53:07
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8966/src/org/python/pydev/ui Modified Files: UIConstants.java Log Message: Index: UIConstants.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui/UIConstants.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UIConstants.java 17 Aug 2003 04:44:22 -0000 1.1 --- UIConstants.java 13 Oct 2004 19:52:55 -0000 1.2 *************** *** 21,23 **** --- 21,30 ---- public static final String ALPHA_SORT = "icons/alphab_sort_co.gif"; public static final String COLLAPSE_ALL = "icons/collapseall.gif"; + + //file content + public static final String FILE_ICON = "icons/file.gif"; + public static final String FOLDER_ICON = "icons/folder.gif"; + public static final String COPY_ICON = "icons/copy.gif"; + public static final String CLOSE_ICON = "icons/close.gif"; + } |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:53:07
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8966/src/org/python/pydev/editor/actions Modified Files: PyReloadCodeCompletionModules.java Log Message: Index: PyReloadCodeCompletionModules.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyReloadCodeCompletionModules.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyReloadCodeCompletionModules.java 14 Sep 2004 17:42:16 -0000 1.1 --- PyReloadCodeCompletionModules.java 13 Oct 2004 19:52:54 -0000 1.2 *************** *** 22,26 **** public void run(IAction action) { try { ! PythonShell.getServerShell().sendReloadModulesMsg(); } catch (IOException e) { // TODO Auto-generated catch block --- 22,26 ---- public void run(IAction action) { try { ! PythonShell.getServerShell(PythonShell.COMPLETION_SHELL).sendReloadModulesMsg(); } catch (IOException e) { // TODO Auto-generated catch block |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:53:07
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8966/src/org/python/pydev/editor Modified Files: PyEdit.java Log Message: Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** PyEdit.java 23 Sep 2004 18:00:00 -0000 1.24 --- PyEdit.java 13 Oct 2004 19:52:54 -0000 1.25 *************** *** 51,55 **** import org.python.pydev.editor.model.Location; import org.python.pydev.editor.model.ModelMaker; - import org.python.pydev.editor.refactoring.PyRefactoring; import org.python.pydev.outline.PyOutlinePage; import org.python.pydev.parser.PyParser; --- 51,54 ---- *************** *** 139,147 **** try { try { ! PyRefactoring.getPyRefactoring(); } catch (RuntimeException e1) { } try { ! PythonShell.getServerShell(); } catch (RuntimeException e1) { } --- 138,146 ---- try { try { ! PythonShell.getServerShell(PythonShell.OTHERS_SHELL); } catch (RuntimeException e1) { } try { ! PythonShell.getServerShell(PythonShell.COMPLETION_SHELL); } catch (RuntimeException e1) { } |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:53:06
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8966/src/org/python/pydev/editor/codecompletion Modified Files: PythonShell.java PythonCompletionProcessor.java PyCodeCompletion.java Log Message: Index: PythonShell.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PythonShell.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PythonShell.java 8 Oct 2004 16:38:41 -0000 1.14 --- PythonShell.java 13 Oct 2004 19:52:53 -0000 1.15 *************** *** 13,17 **** --- 13,19 ---- import java.net.URLEncoder; import java.util.ArrayList; + import java.util.HashMap; import java.util.List; + import java.util.Map; import java.util.StringTokenizer; *************** *** 31,35 **** * Reference to a 'global python shell' */ ! private static PythonShell pytonShell; --- 33,40 ---- * Reference to a 'global python shell' */ ! private static Map shells = new HashMap(); ! ! public static final int COMPLETION_SHELL = 1; ! public static final int OTHERS_SHELL = 2; *************** *** 40,46 **** * */ ! public synchronized static PythonShell getServerShell() throws IOException, CoreException { if(pytonShell == null){ pytonShell = new PythonShell(); pytonShell.startIt(); } --- 45,54 ---- * */ ! public synchronized static PythonShell getServerShell(int id) throws IOException, CoreException { ! PythonShell pytonShell = (PythonShell) shells.get(new Integer(id)); ! if(pytonShell == null){ pytonShell = new PythonShell(); + shells.put(new Integer(id), pytonShell); pytonShell.startIt(); } Index: PyCodeCompletion.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PyCodeCompletion.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyCodeCompletion.java 8 Oct 2004 16:38:42 -0000 1.13 --- PyCodeCompletion.java 13 Oct 2004 19:52:54 -0000 1.14 *************** *** 29,34 **** int docBoundary = -1; // the document prior to the activation token - private PythonShell pytonShell; - /** * @param theDoc: --- 29,32 ---- *************** *** 65,69 **** PythonShell serverShell = null; try { ! serverShell = PythonShell.getServerShell(); } catch (Exception e) { throw new RuntimeException(e); --- 63,67 ---- PythonShell serverShell = null; try { ! serverShell = PythonShell.getServerShell(PythonShell.COMPLETION_SHELL); } catch (Exception e) { throw new RuntimeException(e); Index: PythonCompletionProcessor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PythonCompletionProcessor.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PythonCompletionProcessor.java 24 Sep 2004 16:41:21 -0000 1.9 --- PythonCompletionProcessor.java 13 Oct 2004 19:52:54 -0000 1.10 *************** *** 39,42 **** --- 39,43 ---- private ProposalsComparator proposalsComparator = new ProposalsComparator(); + /** * @param edit *************** *** 90,94 **** try { ! PythonShell.getServerShell().sendGoToDirMsg(edit.getEditorFile()); } catch (Exception e) { //if we don't suceed, we don't have to fail... just go on and try --- 91,95 ---- 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 |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:53:04
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/tree In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8966/src/org/python/pydev/tree Added Files: FileTreePyFilesProvider.java FileTreeLabelProvider.java AllowOnlyFoldersFilter.java FileTreeContentProvider.java Util.java AllowValidPathsFilter.java FileSorter.java Log Message: --- NEW FILE: FileSorter.java --- package org.python.pydev.tree; import java.io.*; import org.eclipse.jface.viewers.*; public class FileSorter extends ViewerSorter { public int category(Object element) { return ((File) element).isDirectory() ? 0 : 1; } } --- NEW FILE: FileTreeLabelProvider.java --- package org.python.pydev.tree; import java.io.*; import org.eclipse.jface.viewers.*; import org.eclipse.swt.graphics.*; import org.python.pydev.plugin.PydevPlugin; import org.python.pydev.ui.ImageCache; import org.python.pydev.ui.UIConstants; public class FileTreeLabelProvider extends LabelProvider { ImageCache imageCache; /** * */ public FileTreeLabelProvider() { imageCache = new ImageCache(PydevPlugin.getDefault().getBundle().getEntry("/")); } public String getText(Object element) { return ((File) element).getName(); } public Image getImage(Object element) { if (((File) element).isDirectory()) { return imageCache.get(UIConstants.FOLDER_ICON); } else { return imageCache.get(UIConstants.FILE_ICON); } } } --- NEW FILE: Util.java --- package org.python.pydev.tree; import java.net.*; import org.eclipse.jface.resource.*; import org.eclipse.swt.dnd.*; import org.eclipse.swt.widgets.*; public class Util { private static ImageRegistry image_registry; private static Clipboard clipboard; public static URL newURL(String url_name) { try { return new URL(url_name); } catch (MalformedURLException e) { throw new RuntimeException("Malformed URL " + url_name, e); } } public static ImageRegistry getImageRegistry() { if (image_registry == null) { image_registry = new ImageRegistry(); image_registry.put("folder", ImageDescriptor.createFromURL(newURL("file:icons/folder.gif"))); image_registry.put("file", ImageDescriptor.createFromURL(newURL("file:icons/file.gif"))); } return image_registry; } public static Clipboard getClipboard() { if (clipboard == null) { clipboard = new Clipboard(Display.getCurrent()); } return clipboard; } } --- NEW FILE: FileTreePyFilesProvider.java --- /* * Created on Oct 13, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.tree; import java.io.File; import java.io.FileFilter; /** * @author Fabio Zadrozny */ public class FileTreePyFilesProvider extends FileTreeContentProvider { public Object[] getChildren(Object element) { Object[] kids = ((File) element).listFiles(new FileFilter(){ public boolean accept(File pathname) { return pathname.isDirectory() || pathname.toString().endsWith(".py"); } }); return kids == null ? new Object[0] : kids; } } --- NEW FILE: FileTreeContentProvider.java --- package org.python.pydev.tree; import java.io.File; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; public class FileTreeContentProvider implements ITreeContentProvider { public Object[] getChildren(Object element) { Object[] kids = ((File) element).listFiles(); return kids == null ? new Object[0] : kids; } public Object[] getElements(Object element) { return getChildren(element); } public boolean hasChildren(Object element) { return getChildren(element).length > 0; } public Object getParent(Object element) { if (element == null) { return null; } if (element instanceof File) { ((File) element).getParent(); } System.out.println("element not instance of File: " + element.getClass().getName() + " " + element.toString()); return null; } public void dispose() { } public void inputChanged(Viewer viewer, Object old_input, Object new_input) { } } --- NEW FILE: AllowOnlyFoldersFilter.java --- package org.python.pydev.tree; import java.io.*; import org.eclipse.jface.viewers.*; public class AllowOnlyFoldersFilter extends ViewerFilter { public boolean select(Viewer viewer, Object parent, Object element) { return ((File) element).isDirectory(); } } --- NEW FILE: AllowValidPathsFilter.java --- /* * Created on Oct 13, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.tree; import java.io.File; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; /** * @author Fabio Zadrozny */ public class AllowValidPathsFilter extends ViewerFilter { /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return ((File) element).exists(); } } |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:53:02
|
Update of /cvsroot/pydev/org.python.pydev/icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8966/icons Added Files: copy.gif file.gif folder.gif close.gif Log Message: --- NEW FILE: close.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: folder.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: file.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: copy.gif --- (This appears to be a binary file; contents omitted.) |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:52:45
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/tree In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8912/src/org/python/pydev/tree Log Message: Directory /cvsroot/pydev/org.python.pydev/src/org/python/pydev/tree added to the repository |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:49:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8185/src/org/python/pydev/debug/codecoverage Modified Files: PyCodeCoverageView.java PyCoverage.java Log Message: Index: PyCodeCoverageView.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/PyCodeCoverageView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyCodeCoverageView.java 8 Oct 2004 16:44:41 -0000 1.1 --- PyCodeCoverageView.java 13 Oct 2004 19:49:38 -0000 1.2 *************** *** 7,20 **** import org.eclipse.jface.action.Action; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; ! import org.eclipse.jface.viewers.ITreeContentProvider; ! import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; - import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; --- 7,20 ---- import org.eclipse.jface.action.Action; + import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; + import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; ! import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; *************** *** 28,35 **** import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.part.ViewPart; - import org.python.pydev.editor.actions.PyOpenAction; - import org.python.pydev.editor.model.ItemPointer; - import org.python.pydev.editor.model.Location; import org.python.pydev.editor.refactoring.PyRefactoring; /** --- 28,35 ---- import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.part.ViewPart; import org.python.pydev.editor.refactoring.PyRefactoring; + import org.python.pydev.tree.AllowValidPathsFilter; + import org.python.pydev.tree.FileTreeLabelProvider; + import org.python.pydev.tree.FileTreePyFilesProvider; /** *************** *** 48,139 **** */ ! public class PyCodeCoverageView extends ViewPart implements IPropertyListener, ! IStructuredContentProvider{ private TreeViewer viewer; - private Action doubleClickAction; - private Action chooseAction; - protected Action clearAction; - private Button clearButton; - private List elements = new ArrayList(); - private Button chooseButton; - private Composite rComposite; - private Text text; - protected String currentDir; - - /* - * The content provider class is responsible for providing objects to the - * view. It can wrap existing objects in adapters or simply return objects - * as-is. These objects may be sensitive to the current input of the view, - * or ignore it and always show the same content (like Task List, for - * example). - */ - - class ViewLabelProvider extends LabelProvider implements - ITreeContentProvider{ - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - */ - public Object[] getChildren(Object parentElement) { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) - */ - public Object getParent(Object element) { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) - */ - public boolean hasChildren(Object element) { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - public Object[] getElements(Object inputElement) { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // TODO Auto-generated method stub - - } - } - - class NameSorter extends ViewerSorter { - } - /** * The constructor. --- 48,73 ---- */ ! public class PyCodeCoverageView extends ViewPart implements IPropertyListener, IStructuredContentProvider { private TreeViewer viewer; private Action doubleClickAction; private Action chooseAction; protected Action clearAction; private Button clearButton; private List elements = new ArrayList(); private Button chooseButton; private Composite rComposite; private Text text; protected String currentDir; /** * The constructor. *************** *** 147,151 **** } - /** * This is a callback that will allow us to create the viewer and initialize --- 81,84 ---- *************** *** 153,196 **** */ public void createPartControl(Composite parent) { ! GridLayout layout = new GridLayout(); ! layout.numColumns = 2; ! layout.verticalSpacing = 2; ! layout.marginWidth = 0; ! layout.marginHeight = 2; ! parent.setLayout(layout); ! rComposite = new Composite(parent,SWT.MULTI); ! layout = new GridLayout(); ! layout.numColumns = 1; ! layout.verticalSpacing = 2; ! layout.marginWidth = 0; ! layout.marginHeight = 2; ! GridData layoutData = new GridData(); ! layoutData.grabExcessHorizontalSpace = true; ! layoutData.grabExcessVerticalSpace = true; ! layoutData.horizontalAlignment = GridData.FILL; ! layoutData.verticalAlignment = GridData.FILL; ! rComposite.setLayoutData(layoutData); ! rComposite.setLayout(layout); ! ! text = new Text(parent,SWT.MULTI); ! layoutData = new GridData(); ! layoutData.grabExcessHorizontalSpace = true; ! layoutData.grabExcessVerticalSpace = true; ! layoutData.horizontalAlignment = GridData.FILL; ! layoutData.verticalAlignment = GridData.FILL; ! text.setLayoutData(layoutData); ! text.setEditable(false); ! ! parent = rComposite; ! //choose button chooseButton = new Button(parent, SWT.PUSH); ! chooseAction = new Action() { public void run() { DirectoryDialog dialog = new DirectoryDialog(getSite().getShell()); String string = dialog.open(); ! if (string!=null){ ! text.setText("Chosen dir:"+string); notifyDirChanged(string); } --- 86,129 ---- */ public void createPartControl(Composite parent) { ! GridLayout layout = new GridLayout(); ! layout.numColumns = 2; ! layout.verticalSpacing = 2; ! layout.marginWidth = 0; ! layout.marginHeight = 2; ! parent.setLayout(layout); ! rComposite = new Composite(parent, SWT.MULTI); ! layout = new GridLayout(); ! layout.numColumns = 1; ! layout.verticalSpacing = 2; ! layout.marginWidth = 0; ! layout.marginHeight = 2; ! GridData layoutData = new GridData(); ! layoutData.grabExcessHorizontalSpace = true; ! layoutData.grabExcessVerticalSpace = true; ! layoutData.horizontalAlignment = GridData.FILL; ! layoutData.verticalAlignment = GridData.FILL; ! rComposite.setLayoutData(layoutData); ! rComposite.setLayout(layout); ! text = new Text(parent, SWT.MULTI); ! layoutData = new GridData(); ! layoutData.grabExcessHorizontalSpace = true; ! layoutData.grabExcessVerticalSpace = true; ! layoutData.horizontalAlignment = GridData.FILL; ! layoutData.verticalAlignment = GridData.FILL; ! text.setLayoutData(layoutData); ! text.setEditable(false); ! ! parent = rComposite; ! ! //choose button chooseButton = new Button(parent, SWT.PUSH); ! chooseAction = new Action() { public void run() { DirectoryDialog dialog = new DirectoryDialog(getSite().getShell()); String string = dialog.open(); ! if (string != null) { ! text.setText("Chosen dir:" + string); notifyDirChanged(string); } *************** *** 199,229 **** createButton(parent, chooseButton, "Choose dir!", chooseAction); //end choose button - - - - viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL - | SWT.V_SCROLL); - viewer.setContentProvider(this); - // viewer.setLabelProvider(new ViewLabelProvider()); - // viewer.setSorter(new NameSorter()); - // viewer.setInput(getViewSite()); ! // hookDoubleClickAction(); ! layoutData = new GridData(); ! layoutData.grabExcessHorizontalSpace = true; ! layoutData.grabExcessVerticalSpace = true; ! layoutData.horizontalAlignment = GridData.FILL; ! layoutData.verticalAlignment = GridData.FILL; ! viewer.getControl().setLayoutData(layoutData); ! ! ! ! //clear results button clearButton = new Button(parent, SWT.PUSH); ! clearAction = new Action() { public void run() { ! text.setText("Clear action"); } }; --- 132,175 ---- createButton(parent, chooseButton, "Choose dir!", chooseAction); //end choose button ! viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); ! viewer.setContentProvider(new FileTreePyFilesProvider()); ! viewer.setLabelProvider(new FileTreeLabelProvider()); ! viewer.addFilter(new AllowValidPathsFilter()); ! doubleClickAction = new Action() { ! public void run() { ! ISelection selection = viewer.getSelection(); ! Object obj = ((IStructuredSelection) selection).getFirstElement(); ! File realFile = new File(obj.toString()); ! if (realFile.exists()) { ! System.out.println("opening file:" + obj.toString()); ! // ItemPointer p = new ItemPointer(realFile, new ! // Location(-1, -1), null); ! // new PyOpenAction().run(p); ! } ! } ! }; ! hookViewerActions(); ! ! layoutData = new GridData(); ! layoutData.grabExcessHorizontalSpace = true; ! layoutData.grabExcessVerticalSpace = true; ! layoutData.horizontalAlignment = GridData.FILL; ! layoutData.verticalAlignment = GridData.FILL; ! viewer.getControl().setLayoutData(layoutData); ! ! //clear results button clearButton = new Button(parent, SWT.PUSH); ! clearAction = new Action() { public void run() { ! ! PyCoverage.getPyCoverage().clearInfo(); ! ! MessageDialog.openInformation(getSite().getShell(), "Cleared", ! "All the coverage data has been cleared!"); ! ! text.setText(""); } }; *************** *** 231,255 **** //end choose button - this.refresh(); - } - - - - - - - - - /** * @param string */ ! protected void notifyDirChanged(String string) { ! // TODO Auto-generated method stub ! } --- 177,192 ---- //end choose button this.refresh(); } /** * @param string */ ! protected void notifyDirChanged(String newDir) { ! File file = new File(newDir); ! PyCoverage.getPyCoverage().refreshCoverageInfo(file); ! viewer.setInput(file); ! } *************** *** 262,266 **** GridData layoutData; button.setText(txt); ! button.addSelectionListener(new SelectionListener(){ public void widgetSelected(SelectionEvent e) { --- 199,203 ---- GridData layoutData; button.setText(txt); ! button.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { *************** *** 270,296 **** public void widgetDefaultSelected(SelectionEvent e) { } ! }); ! layoutData = new GridData(); ! layoutData.grabExcessHorizontalSpace = true; ! layoutData.horizontalAlignment = GridData.FILL; ! button.setLayoutData(layoutData); } ! private void hookDoubleClickAction() { ! doubleClickAction = new Action() { ! public void run() { ! ISelection selection = viewer.getSelection(); ! Object obj = ((IStructuredSelection) selection) ! .getFirstElement(); ! ! File realFile = new File(obj.toString()); ! if (realFile.exists()) { ! ItemPointer p = new ItemPointer(realFile, new Location(-1, -1), null); ! new PyOpenAction().run(p); ! } ! } ! }; viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { --- 207,220 ---- public void widgetDefaultSelected(SelectionEvent e) { } ! }); ! layoutData = new GridData(); ! layoutData.grabExcessHorizontalSpace = true; ! layoutData.horizontalAlignment = GridData.FILL; ! button.setLayoutData(layoutData); } ! private void hookViewerActions() { viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { *************** *** 298,301 **** --- 222,237 ---- } }); + + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + + Object selected_file = selection.getFirstElement(); + System.out.println("Number of items selected is " + selection.size()); + System.out.println("selected_file = " + selected_file); + } + + }); } *************** *** 308,324 **** public void propertyChanged(Object source, int propId) { ! if (source == null){ return; } ! Object[] sources = (Object[]) source; ! ! if(sources[0]== null || sources[1]== null){ return; } ! ! if (sources[0] == PyRefactoring.getPyRefactoring() ! && propId == PyRefactoring.REFACTOR_RESULT) { ! elements.clear(); elements.addAll((Collection) sources[1]); --- 244,259 ---- public void propertyChanged(Object source, int propId) { ! if (source == null) { return; } ! Object[] sources = (Object[]) source; ! ! if (sources[0] == null || sources[1] == null) { return; } ! ! if (sources[0] == PyRefactoring.getPyRefactoring() && propId == PyRefactoring.REFACTOR_RESULT) { ! elements.clear(); elements.addAll((Collection) sources[1]); *************** *** 333,336 **** } - } \ No newline at end of file --- 268,270 ---- Index: PyCoverage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/PyCoverage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyCoverage.java 8 Oct 2004 16:44:41 -0000 1.1 --- PyCoverage.java 13 Oct 2004 19:49:38 -0000 1.2 *************** *** 6,41 **** package org.python.pydev.debug.codecoverage; import java.io.File; import java.util.Arrays; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.python.pydev.debug.core.PydevDebugPlugin; /** * 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 { ! ! private PyCoverage(){ } ! private static PyCoverage pyCoverage; ! /** * @return Returns the pyCoverage. */ public static PyCoverage getPyCoverage() { ! if(pyCoverage == null){ pyCoverage = new PyCoverage(); } --- 6,200 ---- package org.python.pydev.debug.codecoverage; + import java.io.BufferedReader; import java.io.File; + import java.io.FileFilter; + import java.io.IOException; + 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; import org.eclipse.core.runtime.CoreException; import org.python.pydev.debug.core.PydevDebugPlugin; + import org.python.pydev.debug.ui.launching.PythonRunnerConfig; + import org.python.pydev.plugin.PydevPrefs; /** * 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 { ! ! /** ! * This method contacts the python server so that we get the information on ! * the files that are below the directory passed as a parameter ! * ! * @param file2 ! */ ! public void refreshCoverageInfo(File file) { ! try { ! List pyFilesBelow = null; ! if (file.exists()) { ! pyFilesBelow = getPyFilesBelow(file); ! } else { ! pyFilesBelow = new ArrayList(); ! } ! ! if(pyFilesBelow.size() == 0){ ! return; ! } ! ! //now that we have the file information, we have to get the ! // coverage information on these files and ! //structure them so that we can get the coverage information in an ! // easy and hierarchical way. ! ! String profileScript = PythonRunnerConfig.getProfileScript(); ! ! //we have to make a process to execute the script. it should look ! // like: ! //coverage.py -r [-m] FILE1 FILE2 ... ! //Report on the statement coverage for the given files. With the -m ! //option, show line numbers of the statements that weren't ! // executed. ! ! //python coverage.py -r -m files.... ! ! String[] cmdLine = new String[4+ pyFilesBelow.size()]; ! cmdLine[0] = PydevPrefs.getDefaultInterpreter(); ! cmdLine[1] = profileScript; ! cmdLine[2] = "-r"; ! cmdLine[3] = "-m"; ! int i = 4; ! for (Iterator iter = pyFilesBelow.iterator(); iter.hasNext();) { ! cmdLine[i] = iter.next().toString(); ! i++; ! } ! ! Process p=null; ! ! try { ! ! p = execute(cmdLine); ! //we have the process... ! int bufsize = 64; // small bufsize so that we can see the progress ! BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()), bufsize); ! BufferedReader eIn = new BufferedReader(new InputStreamReader(p.getErrorStream()), bufsize); ! ! ! p.getOutputStream().close(); ! String str = ""; ! while ((str = eIn.readLine()) != null) { ! System.out.println("STDERR: " + str); //ignore this... ! } ! eIn.close(); ! while ((str = in.readLine()) != null) { ! System.out.println("STDOUT: " + str);//get the data... ! StringTokenizer tokenizer = new StringTokenizer(str); ! if(tokenizer.countTokens() ==5){ ! ! String []strings = new String[5]; ! int k = 0; ! while(tokenizer.hasMoreElements()){ ! strings[k] = tokenizer.nextToken(); ! k++; ! } ! ! if(strings[1].equals("Stmts") == 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... ! ! } ! } ! } ! in.close(); ! System.out.println("waiting"); ! p.waitFor(); ! } catch (Exception e) { ! if(p!=null){ ! p.destroy(); ! } ! e.printStackTrace(); ! } ! ! ! ! } catch (Exception e1) { ! e1.printStackTrace(); ! throw new RuntimeException(e1); ! } ! } ! ! /** ! * @param cmdLine ! * @return ! * @throws IOException ! */ ! private Process execute(String[] cmdLine) throws IOException { ! Process p; ! Properties properties = System.getProperties(); ! Set set = properties.keySet(); ! ! String []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++; ! } ! envp = PyCoverage.setCoverageFileEnviromentVariable(envp); + p = Runtime.getRuntime().exec(cmdLine, envp); + return p; } ! ! ! ! /** ! * ! * @param file ! */ ! private List getPyFilesBelow(File file) { ! List filesToReturn = new ArrayList(); ! ! if (file.exists() == true) { ! ! if (file.isDirectory()) { ! File[] files = file.listFiles(new FileFilter() { ! ! public boolean accept(File pathname) { ! return pathname.isDirectory() || pathname.toString().endsWith(".py"); ! } ! ! }); ! for (int i = 0; i < files.length; i++) { ! filesToReturn.addAll(getPyFilesBelow(files[i])); ! } ! } else if (file.isFile()) { ! filesToReturn.add(file); ! } ! } ! return filesToReturn; ! } ! private static PyCoverage pyCoverage; ! /** * @return Returns the pyCoverage. */ public static PyCoverage getPyCoverage() { ! if (pyCoverage == null) { pyCoverage = new PyCoverage(); } *************** *** 43,51 **** } ! ! public static String getCoverageFileLocation(){ try { File pySrcPath = PydevDebugPlugin.getPySrcPath(); ! return pySrcPath.getAbsolutePath()+"/.coverage"; } catch (CoreException e) { throw new RuntimeException(e); --- 202,209 ---- } ! public static String getCoverageFileLocation() { try { File pySrcPath = PydevDebugPlugin.getPySrcPath(); ! return pySrcPath.getAbsolutePath() + "/.coverage"; } catch (CoreException e) { throw new RuntimeException(e); *************** *** 59,74 **** public static String[] setCoverageFileEnviromentVariable(String[] envp) { 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 = Arrays.asList(envp); ! list.add("COVERAGE_FILE="+getCoverageFileLocation()); envp = (String[]) list.toArray(new String[0]); } --- 217,232 ---- public static String[] setCoverageFileEnviromentVariable(String[] envp) { 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]); } *************** *** 76,83 **** } ! ! ! ! ! } --- 234,256 ---- } + /** + * + */ + public void clearInfo() { + try { + 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); + } + + } ! } \ No newline at end of file |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:49:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8185/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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** coverage.py 8 Oct 2004 16:44:40 -0000 1.1 --- coverage.py 13 Oct 2004 19:49:37 -0000 1.2 *************** *** 369,373 **** return "%d-%d" % (start, end) import string ! return string.join(map(stringify, pairs), ", ") def analysis(self, morf): --- 369,373 ---- return "%d-%d" % (start, end) import string ! return string.join(map(stringify, pairs), ",") def analysis(self, morf): *************** *** 430,435 **** else: pc = 100.0 ! args = (name, n, m, pc) ! ret.append( (name, n, m, pc, readable)) if show_missing: args = args + (readable,) --- 430,435 ---- else: pc = 100.0 ! args = (morf, n, m, pc) ! ret.append( (morf, n, m, pc, readable)) if show_missing: args = args + (readable,) *************** *** 442,446 **** if not ignore_errors: type, msg = sys.exc_info()[0:2] ! print >> out, fmt_err % (name, type, msg) if len(morfs) > 1: print >> out, "-" * len(header) --- 442,446 ---- if not ignore_errors: type, msg = sys.exc_info()[0:2] ! print >> out, fmt_err % (morf, type, msg) if len(morfs) > 1: print >> out, "-" * len(header) |
From: Fabio Z. <fa...@us...> - 2004-10-13 19:49:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8185/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.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PythonRunner.java 8 Oct 2004 16:44:40 -0000 1.9 --- PythonRunner.java 13 Oct 2004 19:49:37 -0000 1.10 *************** *** 6,9 **** --- 6,10 ---- package org.python.pydev.debug.ui.launching; + import java.io.File; import java.io.IOException; import java.net.*; *************** *** 43,50 **** }else if (config.isProfile){ ! runProfile(config, launch, monitor); }else{ //default ! runDefault(config, launch, monitor); } } --- 44,53 ---- }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); } } *************** *** 98,135 **** } ! ! /** ! * @param config ! * @param launch ! * @param monitor ! * @throws CoreException ! */ ! protected void runDefault(PythonRunnerConfig config, ILaunch launch, IProgressMonitor monitor) throws CoreException { ! if (monitor == null) ! monitor = new NullProgressMonitor(); ! IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5); ! subMonitor.beginTask("Launching python", 1); ! ! // Launch & connect to the debugger ! subMonitor.subTask("Constructing command_line..."); ! String[] cmdLine = config.getCommandLine(); ! ! subMonitor.subTask("Exec..."); ! Process p = DebugPlugin.exec(cmdLine, config.workingDirectory, config.envp); ! if (p == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); ! ! // Register the process with the debug plugin ! subMonitor.subTask("Done"); ! registerWithDebugPlugin(config, launch, p); ! } ! ! /** ! * @param config ! * @param launch ! * @param monitor ! * @throws CoreException ! */ ! private void runProfile(PythonRunnerConfig config, ILaunch launch, IProgressMonitor monitor) throws CoreException { if (monitor == null) monitor = new NullProgressMonitor(); --- 101,105 ---- } ! public static void doIt(IProgressMonitor monitor, String [] envp, String[] cmdLine, File workingDirectory, ILaunch launch) throws CoreException{ if (monitor == null) monitor = new NullProgressMonitor(); *************** *** 140,149 **** subMonitor.subTask("Constructing command_line..."); ! subMonitor.subTask("Exec..."); ! String[] envp = config.envp; ! ! envp = PyCoverage.setCoverageFileEnviromentVariable(envp); ! Process p = DebugPlugin.exec(config.getCommandLine(), config.workingDirectory, envp); if (p == null) throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); --- 110,116 ---- subMonitor.subTask("Constructing command_line..."); ! subMonitor.subTask("Exec..."); ! Process p = DebugPlugin.exec(cmdLine, workingDirectory, envp); if (p == null) throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); *************** *** 151,175 **** // Register the process with the debug plugin subMonitor.subTask("Done"); ! registerWithDebugPlugin(config, launch, p); ! ! ! // try { ! // p.waitFor(); ! // } catch (InterruptedException e) { ! // e.printStackTrace(); ! // } ! // ! // Process p1 = DebugPlugin.exec(config.getProfileResultsCommandLine(), config.workingDirectory, config.envp); ! // if (p1 == null) ! // throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); ! // registerWithDebugPlugin(config, launch, p1); } /** * The debug plugin needs to be notified about our process. * It'll then display the appropriate UI. */ ! private IProcess registerWithDebugPlugin(PythonRunnerConfig config, ILaunch launch, Process p) { HashMap processAttributes = new HashMap(); processAttributes.put(IProcess.ATTR_PROCESS_TYPE, Constants.PROCESS_TYPE); --- 118,131 ---- // Register the process with the debug plugin subMonitor.subTask("Done"); ! registerWithDebugPlugin(PythonRunnerConfig.getCommandLineAsString(cmdLine), cmdLine[cmdLine.length-1], launch, p); } + /** * The debug plugin needs to be notified about our process. * It'll then display the appropriate UI. */ ! public static IProcess registerWithDebugPlugin(PythonRunnerConfig config, ILaunch launch, Process p) { HashMap processAttributes = new HashMap(); processAttributes.put(IProcess.ATTR_PROCESS_TYPE, Constants.PROCESS_TYPE); *************** *** 177,179 **** --- 133,146 ---- return DebugPlugin.newProcess(launch,p, config.file.lastSegment(), processAttributes); } + + /** + * The debug plugin needs to be notified about our process. + * It'll then display the appropriate UI. + */ + public static IProcess registerWithDebugPlugin(String cmdLine, String label, ILaunch launch, Process p) { + HashMap processAttributes = new HashMap(); + processAttributes.put(IProcess.ATTR_PROCESS_TYPE, Constants.PROCESS_TYPE); + processAttributes.put(IProcess.ATTR_CMDLINE, cmdLine); + return DebugPlugin.newProcess(launch,p, label, processAttributes); + } } Index: PythonRunnerConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PythonRunnerConfig.java 8 Oct 2004 16:44:40 -0000 1.10 --- PythonRunnerConfig.java 13 Oct 2004 19:49:37 -0000 1.11 *************** *** 183,187 **** public String getCommandLineAsString() { String[] args = getCommandLine(); ! StringBuffer s = new StringBuffer(); for (int i=0; i< args.length; i++) { s.append(args[i]); --- 183,196 ---- public String getCommandLineAsString() { String[] args = getCommandLine(); ! return getCommandLineAsString(args); ! } ! ! ! /** ! * @param args ! * @return ! */ ! public static String getCommandLineAsString(String[] args) { ! StringBuffer s = new StringBuffer(); for (int i=0; i< args.length; i++) { s.append(args[i]); *************** *** 189,192 **** } return s.toString(); ! } } --- 198,201 ---- } return s.toString(); ! } } |
From: Fabio Z. <fa...@us...> - 2004-10-13 13:39:11
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10590/pydev.sf.net Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- Download.html Faq.html Features.html Roadmap.html codecompletion.html contentassist.html index.html refactoring.html Credits.html |
From: Fabio Z. <fa...@us...> - 2004-10-13 13:14:18
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4921/pydev.sf.net Modified Files: _template.html build.py _index.contents.html Added Files: stylesheet.css Log Message: Index: _template.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/_template.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _template.html 8 Oct 2004 16:47:10 -0000 1.1 --- _template.html 13 Oct 2004 13:13:52 -0000 1.2 *************** *** 18,21 **** --- 18,22 ---- <li><a href="Roadmap.html">Roadmap</a></li> <li><a href="Download.html">Download</a></li> + <li><a href="Credits.html">Credits</a></li> </ul> </div> Index: _index.contents.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/_index.contents.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _index.contents.html 8 Oct 2004 16:58:34 -0000 1.2 --- _index.contents.html 13 Oct 2004 13:13:52 -0000 1.3 *************** *** 1,18 **** ! <p>Pydev is a complete <a target="_blank" href="http://www.python.org">python</a> development ! environment for <a target="_blank" href="http://www.eclipse.org">eclipse</a>.</p> ! <P>Pydev has been created by <B>Aleks Totic</B> as a "getting to know Eclipse ! project" and is currently maintained by <B>Fabio Zadrozny</B> ! . ! <P>Other developers that helped (or still are helping) in the development ! of pydev are: ! <LI> <!--StartFragment --> Dana Moore <LI> ! William Wright <LI> ! Grig Gheorghiu <LI> ! Parhaum Toofanian ! </LI> ! <P><STRONG>More information on the pydev plugin can be found at: </STRONG></P> <LI> <A href="http://sourceforge.net/mailarchive/forum.php?forum_id=39082">pydev-code</A>: --- 1,27 ---- ! <p><STRONG>Pydev </STRONG>is a complete <a target="_blank" href="http://www.python.org"> ! python</a> development environment for <a target="_blank" href="http://www.eclipse.org"> ! eclipse</a>.</p> ! <P>It has been created by <B>Aleks Totic</B> as a "getting to know Eclipse project" ! and is currently maintained by <B>Fabio Zadrozny</B> . ! </P> ! <P><STRONG>Quick Summary </STRONG> ! <P>Pydev has still not reached 1.0, but it is already stable enough for ! python editing, with features such as:</P> <LI> ! Code completion <LI> ! Code Folding <LI> ! Outline ! <LI> ! Go to definition ! <LI> ! Refactoring (Bicycle Repair Man) ! <LI> ! Debug ! <LI> ! Etc. (more details can be found at the <a href="Features.html">features</a> page) ! <P><STRONG>More information on the pydev plugin can be found at: </STRONG> ! </P> <LI> <A href="http://sourceforge.net/mailarchive/forum.php?forum_id=39082">pydev-code</A>: *************** *** 27,35 **** <LI> <A href="http://pydev.blogspot.com/">Pydev Adventures weblog</A>: Weblog ! maintained by Fabio Zadrozny with notes about his experiences ! with the pydev development. ! </LI> ! ! <P><STRONG>Mentions in the press:</STRONG></P> <LI> <A href="http://www-106.ibm.com/developerworks/library/os-ecant/?ca=drs-tp2604">Python --- 36,42 ---- <LI> <A href="http://pydev.blogspot.com/">Pydev Adventures weblog</A>: Weblog ! maintained by Fabio Zadrozny with notes about his experiences with the pydev ! development. ! <P><STRONG>Mentions in the press:</STRONG></P> <LI> <A href="http://www-106.ibm.com/developerworks/library/os-ecant/?ca=drs-tp2604">Python *************** *** 38,40 **** --- 45,54 ---- <A href="http://conferences.oreillynet.com/presentations/os2004/moore_python.pdf">Pydev at OsCon</A> + <br> + <FONT size="2"></FONT> </LI> + <P><FONT size="2">Hosted by</FONT> + </P> + <p><A href="http://sourceforge.net"> <IMG src="http://sourceforge.net/sflogo.php?group_id=85796&type=5" width="210" height="62" + border="0" alt="SourceForge.net Logo"> </A> + </p> --- NEW FILE: stylesheet.css --- body { font-family: Arial, Helvetica, sans-serif font-size: 12px; } h1 { font-family: Arial, Helvetica, sans-serif; } div.sidebar { position:static; float: left; width: 180px; height: 150%; background-color: lightyellow; color: white; } .sidebar li { margin-left: 0px; margin-top: 3px; padding: 0px; } div.contents { width: 100%; padding-left: 15px; } li { margin-left: 5px; } a { color: blue; text-decoration: none; } a:hover { text-decoration: underline; } .sidebar a { font-size: medium; } Index: build.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/build.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build.py 8 Oct 2004 16:47:10 -0000 1.1 --- build.py 13 Oct 2004 13:13:52 -0000 1.2 *************** *** 26,29 **** --- 26,30 ---- Template( '_template.html', 'refactoring' ) Template( '_template.html', 'Faq' ) + Template( '_template.html', 'Credits' ) |
From: Fabio Z. <fa...@us...> - 2004-10-13 13:14:09
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4874/pydev.sf.net Added Files: _credits.contents.html Log Message: --- NEW FILE: _credits.contents.html --- <!--StartFragment --> <P><STRONG>Pydev</STRONG> has been created by <B>Aleks Totic</B> as a "getting to know Eclipse project" and is currently maintained by <B>Fabio Zadrozny</B> . </P> <P> Other developers that helped (or still are helping) in the development of pydev are: </P> <LI> <!--StartFragment --> Dana Moore <LI> William Wright <LI> Grig Gheorghiu </LI> <LI> Parhaum Toofanian</LI> |
From: Aleksandar T. <at...@us...> - 2004-10-11 16:35:20
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32517/src/org/python/pydev/debug/model Modified Files: PyDebugTarget.java Log Message: seza's patch for this bug: Pydev debugger cannot start if file is in the folder link. Eclipse doc says that getFilesForLocation() returns null if file is in linked folder. Index: PyDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyDebugTarget.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PyDebugTarget.java 24 Sep 2004 00:39:05 -0000 1.9 --- PyDebugTarget.java 11 Oct 2004 16:34:50 -0000 1.10 *************** *** 79,97 **** // now, register all the breakpoints in our project ! IFile launched = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(file); ! IProject project = launched.getProject(); ! try { ! IMarker[] markers = project.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE); ! IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); ! for (int i= 0; i < markers.length; i++) { ! PyBreakpoint brk = (PyBreakpoint)breakpointManager.getBreakpoint(markers[i]); ! if (brk.isEnabled()) { ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, brk.getFile(), brk.getLine()); ! debugger.postCommand(cmd); } ! } ! } catch (Throwable t) { ! PydevDebugPlugin.errorDialog("Error setting breakpoints", t); } // Send the run command, and we are off RunCommand run = new RunCommand(debugger); --- 79,108 ---- // now, register all the breakpoints in our project ! IFile launched[]; ! IFile temp = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(file); ! if(temp != null) { ! launched = new IFile[1]; ! launched[0] = temp; ! } ! else { ! launched = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(file); ! } ! for(int ii = 0; ii != launched.length; ++ii) { ! IProject project = launched[ii].getProject(); ! try { ! IMarker[] markers = project.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE); ! IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); ! for (int i= 0; i < markers.length; i++) { ! PyBreakpoint brk = (PyBreakpoint)breakpointManager.getBreakpoint(markers[i]); ! if (brk.isEnabled()) { ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, brk.getFile(), brk.getLine()); ! debugger.postCommand(cmd); ! } } ! } catch (Throwable t) { ! PydevDebugPlugin.errorDialog("Error setting breakpoints", t); ! } } + // Send the run command, and we are off RunCommand run = new RunCommand(debugger); |
From: Fabio Z. <fa...@us...> - 2004-10-08 17:04:07
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17716/pydev.sf.net Removed Files: main.css index.html snap.gif Log Message: --- snap.gif DELETED --- --- index.html DELETED --- --- main.css DELETED --- |
From: Fabio Z. <fa...@us...> - 2004-10-08 16:58:50
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16214/pydev.sf.net Modified Files: _Features.contents.html _index.contents.html _Roadmap.contents.html _Download.contents.html Log Message: Index: _Features.contents.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/_Features.contents.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _Features.contents.html 8 Oct 2004 16:47:10 -0000 1.1 --- _Features.contents.html 8 Oct 2004 16:58:34 -0000 1.2 *************** *** 2,61 **** <p>The pydev is composed of three plug-ins:</p> <h3>Editor (org.python.pydev):</h3> ! <UL> ! <li> ! Syntax highlighting ! <li> ! Parser errors marked in the task list ! <li> ! Outline view with imports/functions/classes ! <li> ! Tabs or spaces preference ! <LI> ! Smart indentation ! <li> ! Navigation: keyboard shortcuts to previous or next ! function. <EM>Default: (Ctrl+Shift+Up ! and Ctrl+Shift+Down) </EM> ! <li> ! Comment and uncomment commands (on the popup menu) and ! keybindings. <EM>Default: (Ctrl+3 and Ctrl+Shift+3) </EM> ! <li> ! hyperlinks over functions//import statements ! <li> ! Code folding ! <LI> ! <a href="refactoring.html">Refactoring</a> with <A href="http://bicyclerepair.sourceforge.net/"> ! bicycle repair man</A>. ! <LI> ! <a href="codecompletion.html">Code Completion</a> ! <EM>(Ctrl+Space) </EM> ! <LI> ! Templates Completion <EM>(Ctrl+Space Too) </EM> ! <LI> ! Go to definition with <EM>F3</EM> (powered by <A href="http://bicyclerepair.sourceforge.net/"> ! bicycle repair man</A>) ! <LI> ! <a href="contentassist.html">Content Assistant</a> ! <EM>(Ctrl+F1)</EM></LI></UL> <h3>Debugger (org.python.pydev.debug)</h3> ! <UL> ! <li> ! breakpoints ! <li> ! step in/out/over ! <li> ! multiple threads ! <li> ! variable display ! <li> ! file hyperlinks in the console output (you can click on stack traces) ! </li> ! </UL> <H3>Help (org.python.pydev.help)</H3> ! <UL> ! <LI> ! Brief documentation in Eclipse format. ! </LI> ! </UL> <H3>Note on code completion</H3> <P>Code completion works on top of a python shell and really <STRONG>executes the code --- 2,56 ---- <p>The pydev is composed of three plug-ins:</p> <h3>Editor (org.python.pydev):</h3> ! <li> ! Syntax highlighting ! <li> ! Parser errors marked in the task list ! <li> ! Outline view with imports/functions/classes ! <li> ! Tabs or spaces preference ! <LI> ! Smart indentation ! <li> ! Navigation: keyboard shortcuts to previous or next ! function. <EM>Default: (Ctrl+Shift+Up ! and Ctrl+Shift+Down) </EM> ! <li> ! Comment and uncomment commands (on the popup menu) and ! keybindings. <EM>Default: (Ctrl+3 and Ctrl+Shift+3) </EM> ! <li> ! hyperlinks over functions//import statements ! <li> ! Code folding ! <LI> ! <a href="refactoring.html">Refactoring</a> with <A href="http://bicyclerepair.sourceforge.net/"> ! bicycle repair man</A>. ! <LI> ! <a href="codecompletion.html">Code Completion</a> ! <EM>(Ctrl+Space) </EM> ! <LI> ! Templates Completion <EM>(Ctrl+Space Too) </EM> ! <LI> ! Go to definition with <EM>F3</EM> (powered by <A href="http://bicyclerepair.sourceforge.net/"> ! bicycle repair man</A>) ! <LI> ! <a href="contentassist.html">Content Assistant</a> ! <EM>(Ctrl+F1)</EM></LI> <h3>Debugger (org.python.pydev.debug)</h3> ! <li> ! breakpoints ! <li> ! step in/out/over ! <li> ! multiple threads ! <li> ! variable display ! <li> ! file hyperlinks in the console output (you can click on stack traces) ! </li> <H3>Help (org.python.pydev.help)</H3> ! <LI> ! Brief documentation in Eclipse format. ! </LI> <H3>Note on code completion</H3> <P>Code completion works on top of a python shell and really <STRONG>executes the code Index: _Download.contents.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/_Download.contents.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _Download.contents.html 8 Oct 2004 16:47:10 -0000 1.1 --- _Download.contents.html 8 Oct 2004 16:58:34 -0000 1.2 *************** *** 1,16 **** <h2>Download:</h2> <p>The current release is <b>0.6.1</b> and can be obtained from the sites: ! <ul> ! <li> ! Download from <a target="_blank" href='http://www.sourceforge.net/projects/pydev/'>SourceForge</a>. ! <li> ! Download from <a target="_blank" href="http://pydev.sf.net/updates/">Eclipse ! updates</a></li> ! </ul> <h4>Requirements:</h4> ! <ul> ! <li> ! <a href="">Eclipse 3.0</a></li> ! </ul> <h4>Installation Instructions:</h4> <p class="TODO">Fast install: just go to the eclipse update manager and add --- 1,12 ---- <h2>Download:</h2> <p>The current release is <b>0.6.1</b> and can be obtained from the sites: ! <li> ! Download from <a target="_blank" href='http://www.sourceforge.net/projects/pydev/'>SourceForge</a>. ! <li> ! Download from <a target="_blank" href="http://pydev.sf.net/updates/">Eclipse ! updates</a></li> <h4>Requirements:</h4> ! <li> ! <a href="">Eclipse 3.0</a></li> <h4>Installation Instructions:</h4> <p class="TODO">Fast install: just go to the eclipse update manager and add Index: _index.contents.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/_index.contents.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _index.contents.html 8 Oct 2004 16:47:10 -0000 1.1 --- _index.contents.html 8 Oct 2004 16:58:34 -0000 1.2 *************** *** 6,33 **** <P>Other developers that helped (or still are helping) in the development of pydev are: ! <UL> ! <LI> <!--StartFragment --> Dana Moore ! <LI> ! William Wright ! <LI> ! Grig Gheorghiu ! <LI> ! Parhaum Toofanian</LI></UL> <P><STRONG>More information on the pydev plugin can be found at: </STRONG></P> ! <UL> ! <LI> ! <A href="http://sourceforge.net/mailarchive/forum.php?forum_id=39082">pydev-code</A>: ! Developers issues mailing list. ! <LI> ! <A href="http://sourceforge.net/forum/forum.php?forum_id=293649">users</A>: ! Users bulleting board. ! <LI> ! <A href="http://blogs.osafoundation.org/atotic/cat_work_log.html">Aleks Totic ! weblog</A>: Author personal web-log where sometimes tidbits about the ! development progress are posted. ! <LI> ! <A href="http://pydev.blogspot.com/">Pydev Adventures weblog</A>: Weblog ! maintained by Fabio Zadrozny with notes about his experiences ! with the pydev development.<!--StartFragment --></LI></UL> <P><STRONG>Mentions in the press:</STRONG></P> <LI> --- 6,34 ---- <P>Other developers that helped (or still are helping) in the development of pydev are: ! <LI> <!--StartFragment --> Dana Moore ! <LI> ! William Wright ! <LI> ! Grig Gheorghiu ! <LI> ! Parhaum Toofanian ! </LI> <P><STRONG>More information on the pydev plugin can be found at: </STRONG></P> ! <LI> ! <A href="http://sourceforge.net/mailarchive/forum.php?forum_id=39082">pydev-code</A>: ! Developers issues mailing list. ! <LI> ! <A href="http://sourceforge.net/forum/forum.php?forum_id=293649">users</A>: ! Users bulleting board. ! <LI> ! <A href="http://blogs.osafoundation.org/atotic/cat_work_log.html">Aleks Totic ! weblog</A>: Author personal web-log where sometimes tidbits about the ! development progress are posted. ! <LI> ! <A href="http://pydev.blogspot.com/">Pydev Adventures weblog</A>: Weblog ! maintained by Fabio Zadrozny with notes about his experiences ! with the pydev development. ! </LI> ! <P><STRONG>Mentions in the press:</STRONG></P> <LI> Index: _Roadmap.contents.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/_Roadmap.contents.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _Roadmap.contents.html 8 Oct 2004 16:47:10 -0000 1.1 --- _Roadmap.contents.html 8 Oct 2004 16:58:34 -0000 1.2 *************** *** 4,27 **** those (or others), feel free... (features already implemented are not here again).</P> ! <UL> ! <LI> ! Make a nicer code completion - not executing code and with a better cache ! system.</LI> ! <LI> ! Make the content assistant better</LI> ! <LI> ! Code coverage</LI> ! <LI> ! Quick outline (like java does)</LI> ! <LI> ! Package explorer</LI> ! <LI> ! Todo-list</LI> ! <LI> ! Unit-test</LI> ! <LI> ! Interactive shell</LI> ! <LI> ! Wizards (create class / module)</LI></UL> <P> </P> <H3>You'd like to give it a try?</H3> --- 4,26 ---- those (or others), feel free... (features already implemented are not here again).</P> ! <LI> ! Make a nicer code completion - not executing code and with a better cache ! system.</LI> ! <LI> ! Make the content assistant better</LI> ! <LI> ! Code coverage</LI> ! <LI> ! Quick outline (like java does)</LI> ! <LI> ! Package explorer</LI> ! <LI> ! Todo-list</LI> ! <LI> ! Unit-test</LI> ! <LI> ! Interactive shell</LI> ! <LI> ! Wizards (create class / module)</LI> <P> </P> <H3>You'd like to give it a try?</H3> |
From: Fabio Z. <fa...@us...> - 2004-10-08 16:47:24
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13297/pydev.sf.net Added Files: _contentassist.contents.html _template.html build.py _codecompletion.contents.html _Faq.contents.html _Features.contents.html _index.contents.html _Roadmap.contents.html _Download.contents.html _refactoring.contents.html Log Message: Execute build.py to get the formatted page. --- NEW FILE: _template.html --- <html> <head> <title>%(title)s</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <link rel="stylesheet" href="stylesheet.css" type="text/css"/> </head> <body bgcolor="#FFFFFF" text="#000000"> <div class="header"> <h1>PyDev</h1> </div> <div class="sidebar"> <ul> <li><a href="index.html">Home</a></li> <li><a href="Features.html">Features</a></li> <li><a href="Roadmap.html">Roadmap</a></li> <li><a href="Download.html">Download</a></li> </ul> </div> <div class="contents"> %(contents)s </div> </body> </html> --- NEW FILE: _Features.contents.html --- <h2>Features (release 0.6.1):</h2> <p>The pydev is composed of three plug-ins:</p> <h3>Editor (org.python.pydev):</h3> <UL> <li> Syntax highlighting <li> Parser errors marked in the task list <li> Outline view with imports/functions/classes <li> Tabs or spaces preference <LI> Smart indentation <li> Navigation: keyboard shortcuts to previous or next function. <EM>Default: (Ctrl+Shift+Up and Ctrl+Shift+Down) </EM> <li> Comment and uncomment commands (on the popup menu) and keybindings. <EM>Default: (Ctrl+3 and Ctrl+Shift+3) </EM> <li> hyperlinks over functions//import statements <li> Code folding <LI> <a href="refactoring.html">Refactoring</a> with <A href="http://bicyclerepair.sourceforge.net/"> bicycle repair man</A>. <LI> <a href="codecompletion.html">Code Completion</a> <EM>(Ctrl+Space) </EM> <LI> Templates Completion <EM>(Ctrl+Space Too) </EM> <LI> Go to definition with <EM>F3</EM> (powered by <A href="http://bicyclerepair.sourceforge.net/"> bicycle repair man</A>) <LI> <a href="contentassist.html">Content Assistant</a> <EM>(Ctrl+F1)</EM></LI></UL> <h3>Debugger (org.python.pydev.debug)</h3> <UL> <li> breakpoints <li> step in/out/over <li> multiple threads <li> variable display <li> file hyperlinks in the console output (you can click on stack traces) </li> </UL> <H3>Help (org.python.pydev.help)</H3> <UL> <LI> Brief documentation in Eclipse format. </LI> </UL> <H3>Note on code completion</H3> <P>Code completion works on top of a python shell and really <STRONG>executes the code you write on the top level on the module</STRONG> , so, beware of what is written in this case (as a rule, you should never initialize a variable to something other that None. You should init it to None and then call a function to make the real initialization after an <EM>if __name__ == '__main__'</EM> statement or inside some other scope, but never in the global scope of the module (not only because of code completion, as a simple import of that code would do it).</P> <H3>Note on text completion</H3> <P> We do not provide text completion ourselves in the plugin, as other plugins already provide this. A good suggestion is using the <A href="http://sourceforge.net/projects/lunar-eclipse/"> lunar eclipse</A> editor-enhancements plugin. It does not only provide text completion, but other very useful enhancements.</P> <P> </P> <P> </P> --- NEW FILE: _codecompletion.contents.html --- <H3>Code Completion</H3> <P>This feature is already usable, but still has to be used with care, as it <STRONG>executes the current editor code to get it's completions</STRONG>. That means that one should be very careful on what is put in the global context when using code completion.</P> <P>So, that means that if you put sys.exec("rm -r *") in the top level of any module, it would probably would really delete all you have... Not good hummm... But if you did it, you would never be able to import that module from python from anywhere, because it would do the same thing...(so, that makes me feel not so guilty :-) ). </P> <P>Aside from that, code completion works on imports, on the current class and on the global context - it uses the current pythonpath in order to do that, so, if you go in python and</P> <P><FONT face="Courier New" size="2">import sys<BR> print sys.path - those are the locations searched to get the imports tips.<BR> </FONT>Directories if they contain an __init__.py<BR> Files: .py, .py, .pyo, .pyd, .dll<BR> <BR> <STRONG>So, if you go: (| Marks Ctrl+Space)<BR> </STRONG><FONT face="Courier New" size="2">import | a list of the imports that can be gotten should appear.<BR> import comp| completes imports that start with comp<BR> import compiler.| completes with compiler sub-modules and classes<BR> import compiler.ast.| completes with compiler.ast sub-modules and classes<BR> from compiler import | completes with compiler sub-modules and classes<BR> from compiler import ast.| completes with compiler.ast sub-modules and classes</FONT> <BR> <BR> Now for other completions:<BR> <BR> <STRONG>If you have a file<BR> </STRONG> <BR> <FONT face="Courier New" size="2">from compiler import *</FONT> <BR> <BR> And just Ctrl+Space, it should appear all the globals, in this case all compiler submodules and classes.<BR> <BR> <STRONG>If you had just <BR> </STRONG> <BR> <FONT face="Courier New" size="2">Import compiler <BR> </FONT> <BR> Ctrl+Space would bring you '__builtins__' and 'compiler' suggestions<BR> <BR> <BR> <STRONG>For class code completion:<BR> </STRONG> <BR> <FONT face="Courier New" size="2">import compiler<BR> </FONT><FONT face="Courier New" size="2">class C(compiler.visitor.ASTVisitor):<BR> ....def __init__(self):<BR> ........self.| would bring you all the code available from this class.<BR> <BR> <BR> compiler.| would bring all that is contained within the compiler module<BR> </FONT> </P> <P><FONT><STRONG>Note on code completion:</STRONG></FONT></P> <P><FONT face="Courier New" size="2"><FONT face="Times New Roman" size="3">Currently code completion does not work on methods after '(' and on any variable that is passed in as a parameter == actually it works only on 'self', on the imports and on global variables ==</FONT></P> </FONT> --- NEW FILE: _index.contents.html --- <p>Pydev is a complete <a target="_blank" href="http://www.python.org">python</a> development environment for <a target="_blank" href="http://www.eclipse.org">eclipse</a>.</p> <P>Pydev has been created by <B>Aleks Totic</B> as a "getting to know Eclipse project" and is currently maintained by <B>Fabio Zadrozny</B> . <P>Other developers that helped (or still are helping) in the development of pydev are: <UL> <LI> <!--StartFragment --> Dana Moore <LI> William Wright <LI> Grig Gheorghiu <LI> Parhaum Toofanian</LI></UL> <P><STRONG>More information on the pydev plugin can be found at: </STRONG></P> <UL> <LI> <A href="http://sourceforge.net/mailarchive/forum.php?forum_id=39082">pydev-code</A>: Developers issues mailing list. <LI> <A href="http://sourceforge.net/forum/forum.php?forum_id=293649">users</A>: Users bulleting board. <LI> <A href="http://blogs.osafoundation.org/atotic/cat_work_log.html">Aleks Totic weblog</A>: Author personal web-log where sometimes tidbits about the development progress are posted. <LI> <A href="http://pydev.blogspot.com/">Pydev Adventures weblog</A>: Weblog maintained by Fabio Zadrozny with notes about his experiences with the pydev development.<!--StartFragment --></LI></UL> <P><STRONG>Mentions in the press:</STRONG></P> <LI> <A href="http://www-106.ibm.com/developerworks/library/os-ecant/?ca=drs-tp2604">Python development with Eclipse and Ant</A> <LI> <A href="http://conferences.oreillynet.com/presentations/os2004/moore_python.pdf">Pydev at OsCon</A> </LI> --- NEW FILE: _Roadmap.contents.html --- <H3>This are the features I would like to have... (One can wish right?)</H3> <P>The roadmap is still not traced... but if you want to come along and do any of those (or others), feel free... (features already implemented are not here again).</P> <UL> <LI> Make a nicer code completion - not executing code and with a better cache system.</LI> <LI> Make the content assistant better</LI> <LI> Code coverage</LI> <LI> Quick outline (like java does)</LI> <LI> Package explorer</LI> <LI> Todo-list</LI> <LI> Unit-test</LI> <LI> Interactive shell</LI> <LI> Wizards (create class / module)</LI></UL> <P> </P> <H3>You'd like to give it a try?</H3> <P><STRONG></STRONG><FONT face="Times New Roman">You can download the latest source from sourceforge. </FONT> </P> <P><FONT face="Times New Roman">To compile, you need to setthe following preferences:</FONT></P> <P><FONT face="Times New Roman">'Plug-In Development:Java Build Path Control:Use classpath containers' to true</FONT></P> <P><FONT face="Times New Roman">'Plug-In Development:Target Platform' select "this application" and enable all plugins.</FONT></P> <P><FONT face="Times New Roman">Most of the code is well-documented in javadoc. I try to cc every answer to a codingquestion to pydev-code, so you can look there for hints too. That's it. If you have not developed Eclipse plugins before, I recommend reading the online documentation and trying out a sample plugin. Doing some prep work before jumping in will really pay off.</FONT></P> <P><FONT face="Times New Roman"><STRONG>Then, it is all up to you.</STRONG></FONT><STRONG> </STRONG> </P> --- NEW FILE: _contentassist.contents.html --- <H3>Content Assistant</H3> <P>This is still on development, but it can already be useful. Current status is:</P> <P> If you have a call in the main module, let's say:<BR> <BR> C()| Ctrl+1 - bring a list of suggestions for assistants (it's still not very complete, but it has already proved very usable for me)<BR> <BR> Or if you have:<BR> <BR> <FONT face="Courier New" size="2">Class C:<BR> <BR> ....def a(self):<BR> ........self.newMethod()| Ctrl+1 also brings some interesting assistants. </FONT> </P> <P><FONT face="Courier New" size="2">Whishes:</FONT></P> <P><FONT face="Courier New" size="2"></FONT> </P> <FONT face="Courier New" size="2">class A: pass<br> <br> class C:<br> <br> ....def __init__(self, param): <br> ........self.newMethod()<- create new method on class C (with params if needed)<br> ........................<- assign result to new local variable <br> ........................<- assign result to new field <br> <br> ........a = A()<br> ........a.newMethod() <- create new method on class A <br> ........................<- assign result to new local variable <br> ........................<- assign result to new field<br> <br> ........param.b() <- don't show anything.<br> <br> ........self.a1 = A() <br> ........self.a1.newMethod() <- create new method on class A (difficult part is discovering class)<br> ............................<- assign result to new local variable <br> ............................<- assign result to new field<br> <br> ........def m(self): <br> ............self.a1.newMethod() <- create new method on class A <br> ................................<- assign result to new local variable <br> ................................<- assign result to new field<br> <br> ............importcompiler<- move import to global context<br> ............NewClass() <- Create class NewClass (Depends on new class wizard)<br> </FONT> --- NEW FILE: _Download.contents.html --- <h2>Download:</h2> <p>The current release is <b>0.6.1</b> and can be obtained from the sites: <ul> <li> Download from <a target="_blank" href='http://www.sourceforge.net/projects/pydev/'>SourceForge</a>. <li> Download from <a target="_blank" href="http://pydev.sf.net/updates/">Eclipse updates</a></li> </ul> <h4>Requirements:</h4> <ul> <li> <a href="">Eclipse 3.0</a></li> </ul> <h4>Installation Instructions:</h4> <p class="TODO">Fast install: just go to the eclipse update manager and add update site: <A href="http://pydev.sf.net/updates/">http://pydev.sf.net/updates/</A> (eclipse should do the rest)</p> <P class="TODO">An alternative is just downloading the zip file and extracting it yourself in eclipse. If you choose to do it, just make sure the plugins folder is extracted on top of the eclipse plugins folder.</P> <P class="TODO"> </P> <P class="TODO"> </P> --- NEW FILE: _refactoring.contents.html --- <H3>Refactoring - powered by: <A href="http://bicyclerepair.sourceforge.net/">bicycle repair man</A> </H3> <P>Refactor Examples (activates on right mouse click - there is usually a keyboard key that emulates that):<BR> <BR> On:<BR> <BR> class C:<BR> ....def a(self):<BR> ........a = 2<BR> ........b = 3<BR> ........c = a+b #this should be refactored.<BR> ........return c<BR> c = C()<BR> <BR> Marking 'a+b' and making an extract method refactor for a method called 'plusMet' should give you:<BR> <BR> class C:<BR> ....def a(self):<BR> ........a = 2<BR> ........b = 3<BR> ........c = self.plusMet(a, b) #this should be refactored.<BR> ........return c<BR> <BR> ....def plusMet(self, a, b):<BR> ........return a+b<BR> c = C()<BR> <BR> <BR> <BR> And with the same class, marking C (it must be the class definition) should give you:<BR> class G:<BR> ....def a(self):<BR> ........a = 2<BR> ........b = 3<BR> ........c = a+b #this should be refactored.<BR> ........return c<BR> c = G()<BR> <BR> Until now, extract method has given me no problems, but rename does not always work... It has to scan all the PYTHONPATH and does not always find all the references (and sometimes may have problems parsing some files too...)<BR> <BR> Methods or variables can be renamed too.<BR> <BR> And as a helper, a Refactor Results View has been contributed. After any refactoring it should show which files were changed. <BR> </P> --- NEW FILE: _Faq.contents.html --- --- NEW FILE: build.py --- def Template( p_template, p_name ): contents_file = '_%s.contents.html' % p_name target_file = '%s.html' % p_name d = { 'title' : p_name, 'contents' : file( contents_file, 'r' ).read(), } contents = file( p_template, 'r' ).read() contents = contents % d file( target_file, 'w' ).write( contents ) def Main(): Template( '_template.html', 'index' ) Template( '_template.html', 'Features' ) Template( '_template.html', 'Download' ) Template( '_template.html', 'Roadmap' ) Template( '_template.html', 'codecompletion' ) Template( '_template.html', 'contentassist' ) Template( '_template.html', 'refactoring' ) Template( '_template.html', 'Faq' ) Main() |
From: Fabio Z. <fa...@us...> - 2004-10-08 16:47:23
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13297/pydev.sf.net/images Removed Files: debugger.gif Log Message: Execute build.py to get the formatted page. --- debugger.gif DELETED --- |
From: Fabio Z. <fa...@us...> - 2004-10-08 16:44:54
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12619/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunner.java PythonRunnerConfig.java LaunchShortcut.java Log Message: Making code coverage. Index: PythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunner.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PythonRunner.java 21 Jul 2004 18:08:10 -0000 1.8 --- PythonRunner.java 8 Oct 2004 16:44:40 -0000 1.9 *************** *** 18,21 **** --- 18,22 ---- 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; *************** *** 32,35 **** --- 33,52 ---- public class PythonRunner { + /** + * Launches the configuration + * + * The code is modeled after Ant launching example. + */ + public void run(PythonRunnerConfig config, ILaunch launch, IProgressMonitor monitor) throws CoreException, IOException { + if (config.isDebug) { + runDebug(config, launch, monitor); + + }else if (config.isProfile){ + runProfile(config, launch, monitor); + + }else{ //default + runDefault(config, launch, monitor); + } + } /** *************** *** 81,114 **** } /** ! * Launches the configuration ! * ! * The code is modeled after Ant launching example. ! */ ! public void run(PythonRunnerConfig config, ILaunch launch, IProgressMonitor monitor) throws CoreException, IOException { ! if (config.isDebug) { ! runDebug(config, launch, monitor); ! return; ! } ! if (monitor == null) ! monitor = new NullProgressMonitor(); ! IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5); ! subMonitor.beginTask("Launching python", 1); ! ! // Launch & connect to the debugger ! subMonitor.subTask("Constructing command_line..."); ! String[] cmdLine = config.getCommandLine(); ! ! subMonitor.subTask("Exec..."); ! Process p = DebugPlugin.exec(cmdLine, config.workingDirectory, config.envp); ! if (p == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); ! // Register the process with the debug plugin ! subMonitor.subTask("Done"); ! registerWithDebugPlugin(config, launch, p); ! } ! /** * The debug plugin needs to be notified about our process. * It'll then display the appropriate UI. --- 98,171 ---- } + /** ! * @param config ! * @param launch ! * @param monitor ! * @throws CoreException ! */ ! protected void runDefault(PythonRunnerConfig config, ILaunch launch, IProgressMonitor monitor) throws CoreException { ! if (monitor == null) ! monitor = new NullProgressMonitor(); ! IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5); ! subMonitor.beginTask("Launching python", 1); ! ! // Launch & connect to the debugger ! subMonitor.subTask("Constructing command_line..."); ! String[] cmdLine = config.getCommandLine(); ! ! subMonitor.subTask("Exec..."); ! Process p = DebugPlugin.exec(cmdLine, config.workingDirectory, config.envp); ! if (p == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); ! // Register the process with the debug plugin ! subMonitor.subTask("Done"); ! registerWithDebugPlugin(config, launch, p); ! } ! /** ! * @param config ! * @param launch ! * @param monitor ! * @throws CoreException ! */ ! private void runProfile(PythonRunnerConfig config, ILaunch launch, IProgressMonitor monitor) throws CoreException { ! if (monitor == null) ! monitor = new NullProgressMonitor(); ! IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5); ! subMonitor.beginTask("Launching python", 1); ! ! // Launch & connect to the debugger ! subMonitor.subTask("Constructing command_line..."); ! ! subMonitor.subTask("Exec..."); ! String[] envp = config.envp; ! ! envp = PyCoverage.setCoverageFileEnviromentVariable(envp); ! ! Process p = DebugPlugin.exec(config.getCommandLine(), config.workingDirectory, envp); ! if (p == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); ! ! // Register the process with the debug plugin ! subMonitor.subTask("Done"); ! registerWithDebugPlugin(config, launch, p); ! ! ! // try { ! // p.waitFor(); ! // } catch (InterruptedException e) { ! // e.printStackTrace(); ! // } ! // ! // Process p1 = DebugPlugin.exec(config.getProfileResultsCommandLine(), config.workingDirectory, config.envp); ! // if (p1 == null) ! // throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); ! // registerWithDebugPlugin(config, launch, p1); ! ! } ! ! /** * The debug plugin needs to be notified about our process. * It'll then display the appropriate UI. Index: PythonRunnerConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PythonRunnerConfig.java 14 Sep 2004 17:41:27 -0000 1.9 --- PythonRunnerConfig.java 8 Oct 2004 16:44:40 -0000 1.10 *************** *** 7,12 **** import java.io.File; - import java.io.IOException; - import java.net.URL; import java.util.Vector; --- 7,10 ---- *************** *** 14,24 **** import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; - import org.eclipse.core.runtime.Path; - import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; - import org.osgi.framework.Bundle; import org.python.pydev.debug.core.Constants; import org.python.pydev.debug.core.PydevDebugPlugin; --- 12,19 ---- *************** *** 40,48 **** // debugging public boolean isDebug; private int debugPort = 0; // use getDebugPort - public String debugScript; public int acceptTimeout = 5000; // miliseconds public String[] envp = null; /** * Sets defaults. --- 35,46 ---- // debugging public boolean isDebug; + public boolean isProfile; private int debugPort = 0; // use getDebugPort public int acceptTimeout = 5000; // miliseconds public String[] envp = null; + public String debugScript; + public String profileScript; + /** * Sets defaults. *************** *** 51,54 **** --- 49,54 ---- public PythonRunnerConfig(ILaunchConfiguration conf, String mode) throws CoreException { isDebug = mode.equals(ILaunchManager.DEBUG_MODE); + isProfile = mode.equals(ILaunchManager.PROFILE_MODE); + file = ExternalToolsUtil.getLocation(conf); interpreter = conf.getAttribute(Constants.ATTR_INTERPRETER, "python"); *************** *** 59,67 **** if (isDebug) { debugScript = getDebugScript(); } envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(conf); } ! public int getDebugPort() throws CoreException { if (debugPort == 0) { debugPort= SocketUtil.findUnusedLocalPort("", 5000, 15000); //$NON-NLS-1$ --- 59,70 ---- if (isDebug) { debugScript = getDebugScript(); + }else if(isProfile){ + profileScript = getProfileScript(); } envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(conf); } ! ! public int getDebugPort() throws CoreException { if (debugPort == 0) { debugPort= SocketUtil.findUnusedLocalPort("", 5000, 15000); //$NON-NLS-1$ *************** *** 91,111 **** } ! /** * gets location of jpydaemon.py */ public static String getDebugScript() throws CoreException { ! IPath relative = new Path("pysrc").addTrailingSeparator().append("pydevd.py"); // IPath relative = new Path("pysrc").addTrailingSeparator().append("jpydaemon.py"); // IPath relative = new Path("pysrc").addTrailingSeparator().append("rpdb.py"); ! Bundle bundle = PydevDebugPlugin.getDefault().getBundle(); ! URL bundleURL = Platform.find( bundle, relative); ! URL fileURL; ! try { ! fileURL = Platform.asLocalURL( bundleURL); ! String filePath = new File(fileURL.getPath()).getAbsolutePath(); ! return filePath; ! } catch (IOException e) { ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Can't find python debug script", null)); ! } } --- 94,124 ---- } ! /** ! * @return ! * @throws CoreException ! */ ! public static String getProfileScript() throws CoreException { ! return PydevDebugPlugin.getScriptWithinPySrc("coverage.py").getAbsolutePath(); ! } ! ! /** * gets location of jpydaemon.py */ public static String getDebugScript() throws CoreException { ! return PydevDebugPlugin.getScriptWithinPySrc("pydevd.py").getAbsolutePath(); ! ! // IPath relative = new Path("pysrc").addTrailingSeparator().append("pydevd.py"); // IPath relative = new Path("pysrc").addTrailingSeparator().append("jpydaemon.py"); // IPath relative = new Path("pysrc").addTrailingSeparator().append("rpdb.py"); ! // Bundle bundle = PydevDebugPlugin.getDefault().getBundle(); ! // URL bundleURL = Platform.find( bundle, relative); ! // URL fileURL; ! // try { ! // fileURL = Platform.asLocalURL( bundleURL); ! // String filePath = new File(fileURL.getPath()).getAbsolutePath(); ! // return filePath; ! // } catch (IOException e) { ! // throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Can't find python debug script", null)); ! // } } *************** *** 133,136 **** --- 146,155 ---- cmdArgs.add("--file"); } + + if(isProfile){ + cmdArgs.add(profileScript); + cmdArgs.add("-x"); + } + cmdArgs.add(file.toOSString()); for (int i=0; arguments != null && i<arguments.length; i++) *************** *** 141,144 **** --- 160,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() { String[] args = getCommandLine(); Index: LaunchShortcut.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/LaunchShortcut.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LaunchShortcut.java 20 Sep 2004 13:19:42 -0000 1.6 --- LaunchShortcut.java 8 Oct 2004 16:44:40 -0000 1.7 *************** *** 77,81 **** protected boolean verifyMode(String mode) { boolean ok = mode.equals(ILaunchManager.RUN_MODE) || ! mode.equals(ILaunchManager.DEBUG_MODE); if (!ok) reportError("Unknown launch mode: " + mode, null); --- 77,82 ---- protected boolean verifyMode(String mode) { boolean ok = mode.equals(ILaunchManager.RUN_MODE) || ! mode.equals(ILaunchManager.DEBUG_MODE) || ! mode.equals(ILaunchManager.PROFILE_MODE); if (!ok) reportError("Unknown launch mode: " + mode, null); *************** *** 223,227 **** if (fShowDialog) { IStatus status = new Status(IStatus.INFO, Constants.PLUGIN_ID, 0, "Hmm", null); //$NON-NLS-1$ ! String groupID = mode.equals("run") ? Constants.PYTHON_RUN_LAUNCH_GROUP : Constants.PYTHON_DEBUG_LAUNCH_GROUP; DebugUITools.openLaunchConfigurationDialog(PydevDebugPlugin.getActiveWorkbenchWindow().getShell(), conf, groupID, null); } else { --- 224,237 ---- if (fShowDialog) { IStatus status = new Status(IStatus.INFO, Constants.PLUGIN_ID, 0, "Hmm", null); //$NON-NLS-1$ ! String groupID = ""; ! ! if(mode.equals("run")) { ! groupID = Constants.PYTHON_RUN_LAUNCH_GROUP; ! }else if (mode.equals("debug")){ ! groupID = Constants.PYTHON_DEBUG_LAUNCH_GROUP; ! }else if (mode.equals("profile")){ ! groupID = Constants.PYTHON_COVERAGE_LAUNCH_GROUP; ! } ! DebugUITools.openLaunchConfigurationDialog(PydevDebugPlugin.getActiveWorkbenchWindow().getShell(), conf, groupID, null); } else { |
From: Fabio Z. <fa...@us...> - 2004-10-08 16:44:54
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12619/src/org/python/pydev/debug/codecoverage Added Files: PyCodeCoverageView.java PyCoverage.java Log Message: Making code coverage. --- NEW FILE: PyCodeCoverageView.java --- package org.python.pydev.debug.codecoverage; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.eclipse.jface.action.Action; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.DirectoryDialog; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.part.ViewPart; import org.python.pydev.editor.actions.PyOpenAction; import org.python.pydev.editor.model.ItemPointer; import org.python.pydev.editor.model.Location; import org.python.pydev.editor.refactoring.PyRefactoring; /** * This sample class demonstrates how to plug-in a new workbench view. The view * shows data obtained from the model. The sample creates a dummy model on the * fly, but a real implementation would connect to the model available either in * this or another plug-in (e.g. the workspace). The view is connected to the * model using a content provider. * <p> * The view uses a label provider to define how model objects should be * presented in the view. Each view can present the same model objects using * different labels and icons, if needed. Alternatively, a single label provider * can be shared between views in order to ensure that objects of the same type * are presented in the same way everywhere. * <p> */ public class PyCodeCoverageView extends ViewPart implements IPropertyListener, IStructuredContentProvider{ private TreeViewer viewer; private Action doubleClickAction; private Action chooseAction; protected Action clearAction; private Button clearButton; private List elements = new ArrayList(); private Button chooseButton; private Composite rComposite; private Text text; protected String currentDir; /* * The content provider class is responsible for providing objects to the * view. It can wrap existing objects in adapters or simply return objects * as-is. These objects may be sensitive to the current input of the view, * or ignore it and always show the same content (like Task List, for * example). */ class ViewLabelProvider extends LabelProvider implements ITreeContentProvider{ /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) */ public Object[] getChildren(Object parentElement) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) */ public Object getParent(Object element) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) */ public boolean hasChildren(Object element) { // TODO Auto-generated method stub return false; } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ public Object[] getElements(Object inputElement) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // TODO Auto-generated method stub } } class NameSorter extends ViewerSorter { } /** * The constructor. */ public PyCodeCoverageView() { } public void refresh() { viewer.refresh(); getSite().getPage().bringToTop(this); } /** * This is a callback that will allow us to create the viewer and initialize * it. */ public void createPartControl(Composite parent) { GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.verticalSpacing = 2; layout.marginWidth = 0; layout.marginHeight = 2; parent.setLayout(layout); rComposite = new Composite(parent,SWT.MULTI); layout = new GridLayout(); layout.numColumns = 1; layout.verticalSpacing = 2; layout.marginWidth = 0; layout.marginHeight = 2; GridData layoutData = new GridData(); layoutData.grabExcessHorizontalSpace = true; layoutData.grabExcessVerticalSpace = true; layoutData.horizontalAlignment = GridData.FILL; layoutData.verticalAlignment = GridData.FILL; rComposite.setLayoutData(layoutData); rComposite.setLayout(layout); text = new Text(parent,SWT.MULTI); layoutData = new GridData(); layoutData.grabExcessHorizontalSpace = true; layoutData.grabExcessVerticalSpace = true; layoutData.horizontalAlignment = GridData.FILL; layoutData.verticalAlignment = GridData.FILL; text.setLayoutData(layoutData); text.setEditable(false); parent = rComposite; //choose button chooseButton = new Button(parent, SWT.PUSH); chooseAction = new Action() { public void run() { DirectoryDialog dialog = new DirectoryDialog(getSite().getShell()); String string = dialog.open(); if (string!=null){ text.setText("Chosen dir:"+string); notifyDirChanged(string); } } }; createButton(parent, chooseButton, "Choose dir!", chooseAction); //end choose button viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(this); // viewer.setLabelProvider(new ViewLabelProvider()); // viewer.setSorter(new NameSorter()); // viewer.setInput(getViewSite()); // hookDoubleClickAction(); layoutData = new GridData(); layoutData.grabExcessHorizontalSpace = true; layoutData.grabExcessVerticalSpace = true; layoutData.horizontalAlignment = GridData.FILL; layoutData.verticalAlignment = GridData.FILL; viewer.getControl().setLayoutData(layoutData); //clear results button clearButton = new Button(parent, SWT.PUSH); clearAction = new Action() { public void run() { text.setText("Clear action"); } }; createButton(parent, clearButton, "Clear coverage information!", clearAction); //end choose button this.refresh(); } /** * @param string */ protected void notifyDirChanged(String string) { // TODO Auto-generated method stub } /** * @param parent * @param button * @param string */ private void createButton(Composite parent, Button button, String txt, final Action action) { GridData layoutData; button.setText(txt); button.addSelectionListener(new SelectionListener(){ public void widgetSelected(SelectionEvent e) { action.run(); } public void widgetDefaultSelected(SelectionEvent e) { } }); layoutData = new GridData(); layoutData.grabExcessHorizontalSpace = true; layoutData.horizontalAlignment = GridData.FILL; button.setLayoutData(layoutData); } private void hookDoubleClickAction() { doubleClickAction = new Action() { public void run() { ISelection selection = viewer.getSelection(); Object obj = ((IStructuredSelection) selection) .getFirstElement(); File realFile = new File(obj.toString()); if (realFile.exists()) { ItemPointer p = new ItemPointer(realFile, new Location(-1, -1), null); new PyOpenAction().run(p); } } }; viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { doubleClickAction.run(); } }); } /** * Passing the focus request to the viewer's control. */ public void setFocus() { viewer.getControl().setFocus(); } public void propertyChanged(Object source, int propId) { if (source == null){ return; } Object[] sources = (Object[]) source; if(sources[0]== null || sources[1]== null){ return; } if (sources[0] == PyRefactoring.getPyRefactoring() && propId == PyRefactoring.REFACTOR_RESULT) { elements.clear(); elements.addAll((Collection) sources[1]); } } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public Object[] getElements(Object parent) { return elements.toArray(); } } --- NEW FILE: PyCoverage.java --- /* * Created on Oct 7, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.debug.codecoverage; import java.io.File; import java.util.Arrays; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.python.pydev.debug.core.PydevDebugPlugin; /** * 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 { private PyCoverage(){ } private static PyCoverage pyCoverage; /** * @return Returns the pyCoverage. */ public static PyCoverage getPyCoverage() { if(pyCoverage == null){ pyCoverage = new PyCoverage(); } return pyCoverage; } public static String getCoverageFileLocation(){ try { File pySrcPath = PydevDebugPlugin.getPySrcPath(); return pySrcPath.getAbsolutePath()+"/.coverage"; } catch (CoreException e) { throw new RuntimeException(e); } } /** * @param envp * @return */ public static String[] setCoverageFileEnviromentVariable(String[] envp) { 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 = Arrays.asList(envp); list.add("COVERAGE_FILE="+getCoverageFileLocation()); envp = (String[]) list.toArray(new String[0]); } return envp; } } |
From: Fabio Z. <fa...@us...> - 2004-10-08 16:44:53
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12619/pysrc Added Files: coverage.py Log Message: Making code coverage. --- NEW FILE: coverage.py --- #!/usr/bin/python # # Perforce Defect Tracking Integration Project # <http://www.ravenbrook.com/project/p4dti/> # # COVERAGE.PY -- COVERAGE TESTING # # Gareth Rees, Ravenbrook Limited, 2001-12-04 # # # 1. INTRODUCTION # # This module provides coverage testing for Python code. # # The intended readership is all Python developers. # # This document is not confidential. # # See [GDR 2001-12-04a] for the command-line interface, programmatic # interface and limitations. See [GDR 2001-12-04b] for requirements and # design. """Usage: coverage.py -x MODULE.py [ARG1 ARG2 ...] Execute module, passing the given command-line arguments, collecting coverage data. coverage.py -e Erase collected coverage data. coverage.py -r [-m] FILE1 FILE2 ... Report on the statement coverage for the given files. With the -m option, show line numbers of the statements that weren't executed. coverage.py -a [-d dir] FILE1 FILE2 ... Make annotated copies of the given files, marking statements that are executed with > and statements that are missed with !. With the -d option, make the copies in that directory. Without the -d option, make each copy in the same directory as the original. Coverage data is saved in the file .coverage by default. Set the COVERAGE_FILE environment variable to save it somewhere else.""" import os import re import string import sys import types # 2. IMPLEMENTATION # # This uses the "singleton" pattern. # # The word "morf" means a module object (from which the source file can # be deduced by suitable manipulation of the __file__ attribute) or a # filename. # # When we generate a coverage report we have to canonicalize every # filename in the coverage dictionary just in case it refers to the # module we are reporting on. It seems a shame to throw away this # information so the data in the coverage dictionary is transferred to # the 'cexecuted' dictionary under the canonical filenames. # # The coverage dictionary is called "c" and the trace function "t". The # reason for these short names is that Python looks up variables by name # at runtime and so execution time depends on the length of variables! # In the bottleneck of this application it's appropriate to abbreviate # names to increase speed. # A dictionary with an entry for (Python source file name, line number # in that file) if that line has been executed. c = {} # t(f, x, y). This method is passed to sys.settrace as a trace # function. See [van Rossum 2001-07-20b, 9.2] for an explanation of # sys.settrace and the arguments and return value of the trace function. # See [van Rossum 2001-07-20a, 3.2] for a description of frame and code # objects. def t(f, x, y): c[(f.f_code.co_filename, f.f_lineno)] = 1 return t the_coverage = None class coverage: error = "coverage error" # Name of the cache file (unless environment variable is set). cache_default = ".coverage" # Environment variable naming the cache file. cache_env = "COVERAGE_FILE" # A map from canonical Python source file name to a dictionary in # which there's an entry for each line number that has been # executed. cexecuted = {} # Cache of results of calling the analysis() method, so that you can # specify both -r and -a without doing double work. analysis_cache = {} # Cache of results of calling the canonical_filename() method, to # avoid duplicating work. 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 = {} def help(self, error=None): if error: print error print print __doc__ sys.exit(1) def command_line(self): import getopt settings = {} optmap = { '-a': 'annotate', '-d:': 'directory=', '-e': 'erase', '-h': 'help', '-i': 'ignore-errors', '-m': 'show-missing', '-r': 'report', '-x': 'execute', } short_opts = string.join(map(lambda o: o[1:], optmap.keys()), '') long_opts = optmap.values() options, args = getopt.getopt(sys.argv[1:], short_opts, long_opts) for o, a in options: if optmap.has_key(o): settings[optmap[o]] = 1 elif optmap.has_key(o + ':'): settings[optmap[o + ':']] = a elif o[2:] in long_opts: settings[o[2:]] = 1 elif o[2:] + '=' in long_opts: settings[o[2:]] = a else: self.help("Unknown option: '%s'." % o) if settings.get('help'): self.help() for i in ['erase', 'execute']: for j in ['annotate', 'report']: if settings.get(i) and settings.get(j): self.help("You can't specify the '%s' and '%s' " "options at the same time." % (i, j)) args_needed = (settings.get('execute') or settings.get('annotate') or settings.get('report')) action = settings.get('erase') or args_needed if not action: self.help("You must specify at least one of -e, -x, -r, " "or -a.") if not args_needed and args: self.help("Unexpected arguments %s." % args) if settings.get('erase'): self.erase() if settings.get('execute'): if not args: self.help("Nothing to do.") sys.argv = args self.start() import __main__ sys.path[0] = os.path.dirname(sys.argv[0]) execfile(sys.argv[0], __main__.__dict__) if not args: args = self.cexecuted.keys() ignore_errors = settings.get('ignore-errors') show_missing = settings.get('show-missing') directory = settings.get('directory=') if settings.get('report'): self.report(args, show_missing, ignore_errors) if settings.get('annotate'): self.annotate(args, directory, ignore_errors) def start(self): sys.settrace(t) def stop(self): sys.settrace(None) def erase(self): global c c = {} self.analysis_cache = {} self.cexecuted = {} if os.path.exists(self.cache): os.remove(self.cache) # save(). Save coverage data to the coverage cache. def save(self): self.canonicalize_filenames() cache = open(self.cache, 'wb') import marshal marshal.dump(self.cexecuted, cache) cache.close() # restore(). Restore coverage data from the coverage cache (if it # exists). def restore(self): global c c = {} self.cexecuted = {} if not os.path.exists(self.cache): return try: cache = open(self.cache, 'rb') import marshal cexecuted = marshal.load(cache) cache.close() if isinstance(cexecuted, types.DictType): self.cexecuted = cexecuted except: pass # canonical_filename(filename). Return a canonical filename for the # file (that is, an absolute path with no redundant components and # normalized case). See [GDR 2001-12-04b, 3.3]. def canonical_filename(self, filename): if not self.canonical_filename_cache.has_key(filename): f = filename if os.path.isabs(f) and not os.path.exists(f): f = os.path.basename(f) if not os.path.isabs(f): for path in [os.curdir] + sys.path: g = os.path.join(path, f) if os.path.exists(g): f = g break cf = os.path.normcase(os.path.abspath(f)) self.canonical_filename_cache[filename] = cf return self.canonical_filename_cache[filename] # canonicalize_filenames(). Copy results from "executed" to # "cexecuted", canonicalizing filenames on the way. Clear the # "executed" map. def canonicalize_filenames(self): global c for filename, lineno in c.keys(): f = self.canonical_filename(filename) if not self.cexecuted.has_key(f): self.cexecuted[f] = {} self.cexecuted[f][lineno] = 1 c = {} # morf_filename(morf). Return the filename for a module or file. def morf_filename(self, morf): if isinstance(morf, types.ModuleType): if not hasattr(morf, '__file__'): raise self.error, "Module has no __file__ attribute." file = morf.__file__ else: file = morf return self.canonical_filename(file) # analyze_morf(morf). Analyze the module or filename passed as # the argument. If the source code can't be found, raise an error. # Otherwise, return a pair of (1) the canonical filename of the # source code for the module, and (2) a list of lines of statements # in the source code. def analyze_morf(self, morf): if self.analysis_cache.has_key(morf): return self.analysis_cache[morf] filename = self.morf_filename(morf) ext = os.path.splitext(filename)[1] if ext == '.pyc': if not os.path.exists(filename[0:-1]): raise self.error, ("No source for compiled code '%s'." % filename) filename = filename[0:-1] elif ext != '.py': raise self.error, "File '%s' not Python source." % filename source = open(filename, 'r') import parser tree = parser.suite(source.read()).totuple(1) source.close() statements = {} self.find_statements(tree, statements) lines = statements.keys() lines.sort() result = filename, lines self.analysis_cache[morf] = result return result # find_statements(tree, dict). Find each statement in the parse # tree and record the line on which the statement starts in the # dictionary (by assigning it to 1). # # It works by walking the whole tree depth-first. Every time it # comes across a statement (symbol.stmt -- this includes compound # statements like 'if' and 'while') it calls find_statement, which # descends the tree below the statement to find the first terminal # token in that statement and record the lines on which that token # was found. # # This algorithm may find some lines several times (because of the # grammar production statement -> compound statement -> statement), # but that doesn't matter because we record lines as the keys of the # dictionary. # # See also [GDR 2001-12-04b, 3.2]. def find_statements(self, tree, dict): import symbol, token if token.ISNONTERMINAL(tree[0]): for t in tree[1:]: self.find_statements(t, dict) if tree[0] == symbol.stmt: self.find_statement(tree[1], dict) elif (tree[0] == token.NAME and tree[1] in ['elif', 'except', 'finally']): dict[tree[2]] = 1 def find_statement(self, tree, dict): import token while token.ISNONTERMINAL(tree[0]): tree = tree[1] dict[tree[2]] = 1 # format_lines(statements, lines). Format a list of line numbers # for printing by coalescing groups of lines as long as the lines # represent consecutive statements. This will coalesce even if # there are gaps between statements, so if statements = # [1,2,3,4,5,10,11,12,13,14] and lines = [1,2,5,10,11,13,14] then # format_lines will return "1-2, 5-11, 13-14". def format_lines(self, statements, lines): pairs = [] i = 0 j = 0 start = None pairs = [] while i < len(statements) and j < len(lines): if statements[i] == lines[j]: if start == None: start = lines[j] end = lines[j] j = j + 1 elif start: pairs.append((start, end)) start = None i = i + 1 if start: pairs.append((start, end)) def stringify(pair): start, end = pair if start == end: return "%d" % start else: return "%d-%d" % (start, end) import string return string.join(map(stringify, pairs), ", ") def analysis(self, morf): filename, statements = self.analyze_morf(morf) self.canonicalize_filenames() if not self.cexecuted.has_key(filename): self.cexecuted[filename] = {} missing = [] for line in statements: if not self.cexecuted[filename].has_key(line): missing.append(line) return (filename, statements, missing, self.format_lines(statements, missing)) def morf_name(self, morf): if isinstance(morf, types.ModuleType): return morf.__name__ else: return os.path.splitext(os.path.basename(morf))[0] def report(self, morfs, show_missing=1, ignore_errors=0, out=None): ''' @param morfs: list of files that we want to get information from The report is created in the following format: Name Stmts Exec Cover Missing --------------------------------------------- file_to_test 7 6 85% 8 file_to_test2 13 9 69% 12-14, 17 --------------------------------------------- TOTAL 20 15 75% @returns a list of tuples in the format ('file_to_test2', 13, 9, 69.230769230769226, '12-14, 17') ''' if out is None: out = sys.stdout ret = [] if not isinstance(morfs, types.ListType): morfs = [morfs] max_name = max([5,] + map(len, map(self.morf_name, morfs))) fmt_name = "%%- %ds " % max_name fmt_err = fmt_name + "%s: %s" header = fmt_name % "Name" + " Stmts Exec Cover" fmt_coverage = fmt_name + "% 6d % 6d % 5d%%" if show_missing: header = header + " Missing" fmt_coverage = fmt_coverage + " %s" print >> out, header print >> out, "-" * len(header) total_statements = 0 total_executed = 0 for morf in morfs: name = self.morf_name(morf) try: _, statements, missing, readable = self.analysis(morf) n = len(statements) m = n - len(missing) if n > 0: pc = 100.0 * m / n else: pc = 100.0 args = (name, n, m, pc) ret.append( (name, n, m, pc, readable)) if show_missing: args = args + (readable,) print >> out, fmt_coverage % args total_statements = total_statements + n total_executed = total_executed + m except KeyboardInterrupt: raise except: if not ignore_errors: type, msg = sys.exc_info()[0:2] print >> out, fmt_err % (name, type, msg) if len(morfs) > 1: print >> out, "-" * len(header) if total_statements > 0: pc = 100.0 * total_executed / total_statements else: pc = 100.0 args = ("TOTAL", total_statements, total_executed, pc) if show_missing: args = args + ("",) print >> out, fmt_coverage % args # annotate(morfs, ignore_errors). blank_re = re.compile("\\s*(#|$)") else_re = re.compile("\\s*else\\s*:\\s*(#|$)") def annotate(self, morfs, directory=None, ignore_errors=0): for morf in morfs: try: filename, statements, missing, _ = self.analysis(morf) source = open(filename, 'r') if directory: dest_file = os.path.join(directory, os.path.basename(filename) + ',cover') else: dest_file = filename + ',cover' dest = open(dest_file, 'w') lineno = 0 i = 0 j = 0 covered = 1 while 1: line = source.readline() if line == '': break lineno = lineno + 1 while i < len(statements) and statements[i] < lineno: i = i + 1 while j < len(missing) and missing[j] < lineno: j = j + 1 if i < len(statements) and statements[i] == lineno: covered = j >= len(missing) or missing[j] > lineno if self.blank_re.match(line): dest.write(' ') elif self.else_re.match(line): # Special logic for lines containing only # 'else:'. See [GDR 2001-12-04b, 3.2]. if i >= len(statements) and j >= len(missing): dest.write('! ') elif i >= len(statements) or j >= len(missing): dest.write('> ') elif statements[i] == missing[j]: dest.write('! ') else: dest.write('> ') elif covered: dest.write('> ') else: dest.write('! ') dest.write(line) source.close() dest.close() except KeyboardInterrupt: raise except: if not ignore_errors: raise # Singleton object. the_coverage = coverage() # Module functions call methods in the singleton object. def start(*args): return apply(the_coverage.start, args) def stop(*args): return apply(the_coverage.stop, args) def erase(*args): return apply(the_coverage.erase, args) def analysis(*args): return apply(the_coverage.analysis, args) 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. if __name__ == '__main__': the_coverage.command_line() # A. REFERENCES # # [GDR 2001-12-04a] "Statement coverage for Python"; Gareth Rees; # Ravenbrook Limited; 2001-12-04; # <http://www.garethrees.org/2001/12/04/python-coverage/>. # # [GDR 2001-12-04b] "Statement coverage for Python: design and # analysis"; Gareth Rees; Ravenbrook Limited; 2001-12-04; # <http://www.garethrees.org/2001/12/04/python-coverage/design.html>. # # [van Rossum 2001-07-20a] "Python Reference Manual (releae 2.1.1)"; # Guide van Rossum; 2001-07-20; # <http://www.python.org/doc/2.1.1/ref/ref.html>. # # [van Rossum 2001-07-20b] "Python Library Reference"; Guido van Rossum; # 2001-07-20; <http://www.python.org/doc/2.1.1/lib/lib.html>. # # # B. DOCUMENT HISTORY # # 2001-12-04 GDR Created. # # 2001-12-06 GDR Added command-line interface and source code # annotation. # # 2001-12-09 GDR Moved design and interface to separate documents. # # 2001-12-10 GDR Open cache file as binary on Windows. Allow # simultaneous -e and -x, or -a and -r. # # 2001-12-12 GDR Added command-line help. Cache analysis so that it # only needs to be done once when you specify -a and -r. # # 2001-12-13 GDR Improved speed while recording. Portable between # Python 1.5.2 and 2.1.1. # # 2002-01-03 GDR Module-level functions work correctly. # # 2002-01-07 GDR Update sys.path when running a file with the -x option, # so that it matches the value the program would get if it were run on # its own. # # # C. COPYRIGHT AND LICENCE # # Copyright 2001 Gareth Rees. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the # distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. # # # # $Id: coverage.py,v 1.1 2004/10/08 16:44:40 fabioz Exp $ |
From: Fabio Z. <fa...@us...> - 2004-10-08 16:44:53
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12619/src/org/python/pydev/debug/ui/actions Modified Files: PythonRunActionDelegate.java Log Message: Making code coverage. Index: PythonRunActionDelegate.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/PythonRunActionDelegate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PythonRunActionDelegate.java 5 May 2004 02:02:00 -0000 1.1 --- PythonRunActionDelegate.java 8 Oct 2004 16:44:41 -0000 1.2 *************** *** 32,37 **** if (part != null && selectedFile != null) { // figure out run or debug mode ! String runMode = action.getId().endsWith("RunPythonAction") ? ! ILaunchManager.RUN_MODE : ILaunchManager.DEBUG_MODE; LaunchShortcut shortcut = new LaunchShortcut(); shortcut.setShowDialog(true); --- 32,49 ---- if (part != null && selectedFile != null) { // figure out run or debug mode ! String runMode = ""; ! if(action.getId().endsWith("RunPythonAction")){ ! runMode = ILaunchManager.RUN_MODE; ! ! }else if(action.getId().endsWith("DebugPythonAction")){ ! runMode = ILaunchManager.DEBUG_MODE; ! ! } else if(action.getId().endsWith("CoveragePythonAction")){ ! runMode = ILaunchManager.PROFILE_MODE; ! ! } else{ ! throw new RuntimeException("Unknown "); ! } ! LaunchShortcut shortcut = new LaunchShortcut(); shortcut.setShowDialog(true); |
From: Fabio Z. <fa...@us...> - 2004-10-08 16:44:52
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12619/src/org/python/pydev/debug/core Modified Files: Constants.java Log Message: Making code coverage. Index: Constants.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core/Constants.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Constants.java 15 Apr 2004 23:24:50 -0000 1.2 --- Constants.java 8 Oct 2004 16:44:41 -0000 1.3 *************** *** 18,21 **** --- 18,22 ---- static final String PYTHON_DEBUG_LAUNCH_GROUP = "org.python.pydev.debug.debug"; static final String PYTHON_RUN_LAUNCH_GROUP = "org.python.pydev.debug.run"; + static final String PYTHON_COVERAGE_LAUNCH_GROUP = "org.python.pydev.debug.coverage"; static final String ID_PYTHON_LAUNCH_CONFIGURATION_TYPE = "org.python.pydev.debug.launchConfigurationType"; static final String PROCESS_TYPE = "PYDEV.PYTHON"; |