pydev-cvs Mailing List for PyDev for Eclipse (Page 7)
Brought to you by:
fabioz
You can subscribe to this list here.
2004 |
Jan
|
Feb
(4) |
Mar
(48) |
Apr
(56) |
May
(64) |
Jun
(27) |
Jul
(66) |
Aug
(81) |
Sep
(148) |
Oct
(194) |
Nov
(78) |
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(125) |
Feb
(126) |
Mar
(163) |
Apr
(133) |
May
(115) |
Jun
(307) |
Jul
(387) |
Aug
(417) |
Sep
(283) |
Oct
(148) |
Nov
(45) |
Dec
(53) |
2006 |
Jan
(240) |
Feb
(200) |
Mar
(267) |
Apr
(231) |
May
(245) |
Jun
(361) |
Jul
(142) |
Aug
(12) |
Sep
(210) |
Oct
(99) |
Nov
(7) |
Dec
(30) |
2007 |
Jan
(161) |
Feb
(511) |
Mar
(265) |
Apr
(74) |
May
(147) |
Jun
(151) |
Jul
(94) |
Aug
(68) |
Sep
(98) |
Oct
(144) |
Nov
(26) |
Dec
(36) |
2008 |
Jan
(98) |
Feb
(107) |
Mar
(199) |
Apr
(113) |
May
(119) |
Jun
(112) |
Jul
(92) |
Aug
(71) |
Sep
(101) |
Oct
(16) |
Nov
|
Dec
|
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:17
|
Update of /cvsroot/pydev/org.python.pydev.debug/src_console/org/python/pydev/debug/newconsole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481/src_console/org/python/pydev/debug/newconsole Modified Files: PydevConsoleCommunication.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: PydevConsoleCommunication.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src_console/org/python/pydev/debug/newconsole/PydevConsoleCommunication.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PydevConsoleCommunication.java 15 Jun 2008 19:01:31 -0000 1.10 --- PydevConsoleCommunication.java 13 Aug 2008 21:12:25 -0000 1.11 *************** *** 251,255 **** //executed.o1 is not null only if we had an error ! if(executed.o1 != null && executed.o1.indexOf("Connection refused: connect") != -1){ if(firstCommWorked){ break; --- 251,257 ---- //executed.o1 is not null only if we had an error ! if(executed.o1 != null && ( ! executed.o1.indexOf("Connection refused: connect") != -1 || ! executed.o1.indexOf("Failed to read servers response: Connection refused") != -1)){ if(firstCommWorked){ break; *************** *** 257,263 **** if(commAttempts < maximumAttempts){ commAttempts += 1; continue; }else{ ! break; } } --- 259,266 ---- if(commAttempts < maximumAttempts){ commAttempts += 1; + executed.o1 = stdErrReader.getAndClearContents(); continue; }else{ ! break; } } |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:17
|
Update of /cvsroot/pydev/org.python.pydev.debug/icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481/icons Modified Files: python_unit.gif jython_unit.gif jython.gif python.gif python_coverage.gif Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: python_unit.gif =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/icons/python_unit.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsjg7VLF and /tmp/cvsLZyIOk differ Index: python_coverage.gif =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/icons/python_coverage.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsJ13aRH and /tmp/cvsPf6pXm differ Index: jython_unit.gif =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/icons/jython_unit.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsCr3GoK and /tmp/cvs8o8Eyp differ Index: python.gif =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/icons/python.gif,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvs5FNloQ and /tmp/cvsiBLmEv differ Index: jython.gif =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/icons/jython.gif,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsfkEYBR and /tmp/cvs2YSWXw differ |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:16
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481/src/org/python/pydev/debug/model Modified Files: AbstractDebugTarget.java PyVariable.java Added Files: PyVariableContentProviderHack.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: AbstractDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/AbstractDebugTarget.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AbstractDebugTarget.java 9 May 2008 22:00:58 -0000 1.15 --- AbstractDebugTarget.java 13 Aug 2008 21:12:24 -0000 1.16 *************** *** 36,39 **** --- 36,40 ---- import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter; import org.python.pydev.core.ExtensionHelper; + import org.python.pydev.core.docutils.StringUtils; import org.python.pydev.core.log.Log; import org.python.pydev.debug.core.IConsoleInputListener; *************** *** 207,211 **** PyBreakpoint b = (PyBreakpoint)breakpoint; if (b.isEnabled() && !shouldSkipBreakpoints()) { ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, b.getFile(), b.getLine(), b.getCondition(), b.getFunctionName()); debugger.postCommand(cmd); } --- 208,217 ---- PyBreakpoint b = (PyBreakpoint)breakpoint; if (b.isEnabled() && !shouldSkipBreakpoints()) { ! String condition = b.getCondition(); ! if(condition != null){ ! condition = StringUtils.replaceAll(condition, "\n", "@_@NEW_LINE_CHAR@_@"); ! condition = StringUtils.replaceAll(condition, "\t", "@_@TAB_CHAR@_@"); ! } ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, b.getFile(), b.getLine(), condition, b.getFunctionName()); debugger.postCommand(cmd); } --- NEW FILE: PyVariableContentProviderHack.java --- package org.python.pydev.debug.model; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.model.IVariable; import org.eclipse.debug.core.model.IWatchExpression; import org.eclipse.debug.internal.ui.model.elements.VariableContentProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; /** * This class was created to bypass bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=238878 * * It should be removed when it's actually fixed. * @author Fabio */ public class PyVariableContentProviderHack extends VariableContentProvider{ protected boolean hasChildren(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException { if(element instanceof IWatchExpression){ IWatchExpression watchExpression = (IWatchExpression) element; return super.hasChildren(watchExpression.getValue(), context, monitor); } if(element instanceof PyVariableCollection){ PyVariableCollection pyVariableCollection = (PyVariableCollection) element; return pyVariableCollection.hasVariables(); } return super.hasChildren(element, context, monitor); } @Override protected Object[] getAllChildren(Object parent, IPresentationContext context) throws CoreException { if(parent instanceof IWatchExpression){ IWatchExpression watchExpression = (IWatchExpression) parent; return super.getAllChildren(watchExpression.getValue(), context); } if(parent instanceof PyVariableCollection){ PyVariableCollection pyVariableCollection = (PyVariableCollection) parent; return pyVariableCollection.getVariables(); } return super.getAllChildren(parent, context); } } Index: PyVariable.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariable.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyVariable.java 10 Apr 2008 16:15:59 -0000 1.14 --- PyVariable.java 13 Aug 2008 21:12:24 -0000 1.15 *************** *** 14,17 **** --- 14,18 ---- import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IVariable; + import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; import org.eclipse.ui.progress.IDeferredWorkbenchAdapter; import org.eclipse.ui.views.properties.IPropertySource; *************** *** 149,152 **** --- 150,159 ---- return new DeferredWorkbenchAdapter(this); } + + //cannot check for the actual interface because it may not be available on eclipse 3.2 (it's only available + //from 3.3 onwards... and this is only a hack for it to work with eclipse 3.4) + if(adapter.toString().endsWith("org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider")){ + return new PyVariableContentProviderHack(); + } AdapterDebug.printDontKnow(this, adapter); return super.getAdapter(adapter); |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:16
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481/src/org/python/pydev/debug/codecoverage Modified Files: CoverageCache.java PyCoverage.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: CoverageCache.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/CoverageCache.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CoverageCache.java 16 Jun 2008 00:55:38 -0000 1.6 --- CoverageCache.java 13 Aug 2008 21:12:24 -0000 1.7 *************** *** 7,10 **** --- 7,13 ---- import java.util.ArrayList; + import java.util.Collection; + import java.util.Collections; + import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; *************** *** 156,170 **** */ private void recursivelyFillList(FolderNode folderNode, ArrayList<Object> list) { ! //add its files ! for (Iterator<Object> it = folderNode.files.values().iterator(); it.hasNext();) { ! list.add(it.next()); ! } //get its sub folders ! for (Iterator<Object> it = folderNode.subFolders.values().iterator(); it.hasNext();) { recursivelyFillList((FolderNode) it.next(), list); } } /** --- 159,181 ---- */ private void recursivelyFillList(FolderNode folderNode, ArrayList<Object> list) { ! list.addAll(sortCollectionWithToString(folderNode.files.values())); //get its sub folders ! for (Iterator<Object> it = sortCollectionWithToString(folderNode.subFolders.values()).iterator(); it.hasNext();) { recursivelyFillList((FolderNode) it.next(), list); } } + private List<Object> sortCollectionWithToString(Collection<Object> collection) { + List<Object> vals = new ArrayList<Object>(collection); + Collections.sort(vals, new Comparator<Object>(){ + + public int compare(Object o1, Object o2) { + return o1.toString().compareTo(o2.toString()); + }} + ); + return vals; + } + /** *************** *** 196,201 **** int totalStmts = 0; ! for (Iterator<Object> it = list.iterator(); it.hasNext();) { ! Object element = it.next(); buffer.append(element.toString()).append("\n"); if(element instanceof FileNode){ //it may have been an error node... --- 207,211 ---- int totalStmts = 0; ! for (Object element:list) { buffer.append(element.toString()).append("\n"); if(element instanceof FileNode){ //it may have been an error node... Index: PyCoverage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/codecoverage/PyCoverage.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** PyCoverage.java 31 Jul 2008 23:48:22 -0000 1.22 --- PyCoverage.java 13 Aug 2008 21:12:24 -0000 1.23 *************** *** 21,25 **** import org.python.pydev.runners.SimpleRunner; import org.python.pydev.utils.PyFileListing; ! import org.python.pydev.utils.PyFileListing.PyFileListingInfo; /** --- 21,25 ---- import org.python.pydev.runners.SimpleRunner; import org.python.pydev.utils.PyFileListing; ! import org.python.pydev.utils.PyFileListing.PyFileInfo; /** *************** *** 50,58 **** } try { ! if (file.isDirectory() == false) { throw new RuntimeException("We can only get information on a dir."); } ! PyFileListingInfo pyFilesBelow = new PyFileListingInfo(); if (file.exists()) { --- 50,58 ---- } try { ! if (!file.isDirectory()) { throw new RuntimeException("We can only get information on a dir."); } ! PyFileListing pyFilesBelow = new PyFileListing(); if (file.exists()) { *************** *** 60,64 **** } ! if (pyFilesBelow.filesFound.size() == 0) { //no files return; } --- 60,64 ---- } ! if (pyFilesBelow.getFoundPyFileInfos().size() == 0) { //no files return; } *************** *** 66,70 **** //add the folders to the cache boolean added = false; ! for (Iterator<File> it = pyFilesBelow.foldersFound.iterator(); it.hasNext();) { File f = it.next(); if (!added) { --- 66,70 ---- //add the folders to the cache boolean added = false; ! for (Iterator<File> it = pyFilesBelow.getFoundFolders().iterator(); it.hasNext();) { File f = it.next(); if (!added) { *************** *** 117,122 **** String files = ""; ! for (Iterator<File> iter = pyFilesBelow.filesFound.iterator(); iter.hasNext();) { ! String fStr = iter.next().toString(); files += fStr + "|"; } --- 117,122 ---- String files = ""; ! for (Iterator<PyFileInfo> iter = pyFilesBelow.getFoundPyFileInfos().iterator(); iter.hasNext();) { ! String fStr = iter.next().getFile().toString(); files += fStr + "|"; } *************** *** 220,229 **** /** * @param strings ! * @return */ private String getError(String[] strings) { StringBuffer ret = new StringBuffer(); for (int i = 1; i < strings.length; i++) { ! ret.append(strings[i]+" "); } return ret.toString(); --- 220,230 ---- /** * @param strings ! * @return string concatenating all but first elements from passed argument ! * separated by space */ private String getError(String[] strings) { StringBuffer ret = new StringBuffer(); for (int i = 1; i < strings.length; i++) { ! ret.append(strings[i]).append(' '); } return ret.toString(); |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:15
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481/pysrc Modified Files: pydevd.py Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** pydevd.py 10 May 2008 16:30:03 -0000 1.96 --- pydevd.py 13 Aug 2008 21:12:24 -0000 1.97 *************** *** 404,407 **** --- 404,413 ---- if condition.startswith('**FUNC**'): func_name, condition = condition.split('\t', 1) + + #We must restore new lines and tabs as done in + #AbstractDebugTarget.breakpointAdded + condition = condition.replace("@_@NEW_LINE_CHAR@_@", '\n').\ + replace("@_@TAB_CHAR@_@", '\t').strip() + func_name = func_name[8:] else: |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:13
|
Update of /cvsroot/pydev/org.python.pydev/tests_completions/org/python/pydev/editor/codecompletion In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/tests_completions/org/python/pydev/editor/codecompletion Modified Files: PythonCompletionWithoutBuiltinsTest.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: PythonCompletionWithoutBuiltinsTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests_completions/org/python/pydev/editor/codecompletion/PythonCompletionWithoutBuiltinsTest.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PythonCompletionWithoutBuiltinsTest.java 10 May 2008 00:45:30 -0000 1.20 --- PythonCompletionWithoutBuiltinsTest.java 13 Aug 2008 21:12:17 -0000 1.21 *************** *** 41,45 **** PythonCompletionWithoutBuiltinsTest test = new PythonCompletionWithoutBuiltinsTest(); test.setUp(); ! test.testRelativeImportWithSubclass(); test.tearDown(); System.out.println("Finished"); --- 41,45 ---- PythonCompletionWithoutBuiltinsTest test = new PythonCompletionWithoutBuiltinsTest(); test.setUp(); ! test.testClsCompletion(); test.tearDown(); System.out.println("Finished"); *************** *** 1084,1089 **** " pass\n" + " F"; //request at the Bar context ! ! requestCompl(s, new String[] {"Foo"}); } --- 1084,1092 ---- " pass\n" + " F"; //request at the Bar context ! try{ ! requestCompl(s, new String[] {"Foo"}); ! }catch(Throwable e){ ! fail("Expected to fail!"); ! } } *************** *** 1102,1105 **** --- 1105,1120 ---- + public void testClsCompletion() throws Exception { + String s = + "class myclass(object):\n" + + " def mymethod(self, hello):\n" + + " print hello\n" + + "cls = myclass()\n" + + "cls.m"; + + requestCompl(s, new String[] {"mymethod(hello)"}); + } + + } |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:08
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/copiedfromeclipsesrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src/org/python/copiedfromeclipsesrc Modified Files: CopiedWorkbenchLabelProvider.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: CopiedWorkbenchLabelProvider.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/copiedfromeclipsesrc/CopiedWorkbenchLabelProvider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CopiedWorkbenchLabelProvider.java 28 Jun 2008 13:29:19 -0000 1.3 --- CopiedWorkbenchLabelProvider.java 13 Aug 2008 21:12:16 -0000 1.4 *************** *** 12,15 **** --- 12,19 ---- *******************************************************************************/ + import org.eclipse.core.runtime.Assert; + import org.eclipse.core.runtime.IAdaptable; + import org.eclipse.core.runtime.Platform; + import org.eclipse.core.runtime.PlatformObject; import org.eclipse.jface.resource.ColorDescriptor; import org.eclipse.jface.resource.FontDescriptor; *************** *** 32,38 **** import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.PlatformUI; - import org.eclipse.ui.internal.util.Util; import org.eclipse.ui.model.IWorkbenchAdapter; import org.eclipse.ui.model.IWorkbenchAdapter2; /** --- 36,42 ---- import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.model.IWorkbenchAdapter; import org.eclipse.ui.model.IWorkbenchAdapter2; + import org.python.pydev.plugin.PydevPlugin; /** *************** *** 126,129 **** --- 130,188 ---- } + + /** + * Copied from Util.getAdapter (from eclipse 3.3: not available in eclipse 3.2) + * + * If it is possible to adapt the given object to the given type, this + * returns the adapter. Performs the following checks: + * + * <ol> + * <li>Returns <code>sourceObject</code> if it is an instance of the + * adapter type.</li> + * <li>If sourceObject implements IAdaptable, it is queried for adapters.</li> + * <li>If sourceObject is not an instance of PlatformObject (which would have + * already done so), the adapter manager is queried for adapters</li> + * </ol> + * + * Otherwise returns null. + * + * @param sourceObject + * object to adapt, or null + * @param adapterType + * type to adapt to + * @return a representation of sourceObject that is assignable to the + * adapter type, or null if no such representation exists + */ + public static Object utilGetAdapter(Object sourceObject, Class adapterType) { + Assert.isNotNull(adapterType); + if (sourceObject == null) { + return null; + } + if (adapterType.isInstance(sourceObject)) { + return sourceObject; + } + + if (sourceObject instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) sourceObject; + + Object result = adaptable.getAdapter(adapterType); + if (result != null) { + // Sanity-check + Assert.isTrue(adapterType.isInstance(result)); + return result; + } + } + + if (!(sourceObject instanceof PlatformObject)) { + Object result = Platform.getAdapterManager().getAdapter(sourceObject, adapterType); + if (result != null) { + return result; + } + } + + return null; + } + + /** * Returns the implementation of IWorkbenchAdapter for the given *************** *** 134,138 **** */ protected final IWorkbenchAdapter getAdapter(Object o) { ! return (IWorkbenchAdapter)Util.getAdapter(o, IWorkbenchAdapter.class); } --- 193,197 ---- */ protected final IWorkbenchAdapter getAdapter(Object o) { ! return (IWorkbenchAdapter)utilGetAdapter(o, IWorkbenchAdapter.class); } *************** *** 145,149 **** */ protected final IWorkbenchAdapter2 getAdapter2(Object o) { ! return (IWorkbenchAdapter2)Util.getAdapter(o, IWorkbenchAdapter2.class); } --- 204,208 ---- */ protected final IWorkbenchAdapter2 getAdapter2(Object o) { ! return (IWorkbenchAdapter2)utilGetAdapter(o, IWorkbenchAdapter2.class); } *************** *** 165,169 **** descriptor = decorateImage(descriptor, element); ! return resourceManager.createImage(descriptor); } --- 224,233 ---- descriptor = decorateImage(descriptor, element); ! try { ! return resourceManager.createImage(descriptor); ! } catch (Exception e) { ! PydevPlugin.log(e); ! return null; ! } } *************** *** 211,215 **** } ! return resourceManager.createFont(FontDescriptor.createFrom(descriptor)); } --- 275,285 ---- } ! try{ ! return resourceManager.createFont(FontDescriptor.createFrom(descriptor)); ! } catch (Exception e) { ! PydevPlugin.log(e); ! return null; ! } ! } *************** *** 225,229 **** } ! return resourceManager.createColor(ColorDescriptor.createFrom(descriptor)); } } --- 295,305 ---- } ! try{ ! return resourceManager.createColor(ColorDescriptor.createFrom(descriptor)); ! } catch (Exception e) { ! PydevPlugin.log(e); ! return null; ! } ! } } |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:08
|
Update of /cvsroot/pydev/org.python.pydev/tests_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/tests_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration Modified Files: JavaClassModuleTestWorkbench.java Added Files: AbstractWorkbenchTestCase.java Removed Files: AbstractJavaIntegrationTestWorkbench.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: JavaClassModuleTestWorkbench.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration/JavaClassModuleTestWorkbench.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** JavaClassModuleTestWorkbench.java 10 Jan 2008 21:13:09 -0000 1.10 --- JavaClassModuleTestWorkbench.java 13 Aug 2008 21:12:15 -0000 1.11 *************** *** 10,14 **** * @author Fabio */ ! public class JavaClassModuleTestWorkbench extends AbstractJavaIntegrationTestWorkbench { --- 10,14 ---- * @author Fabio */ ! public class JavaClassModuleTestWorkbench extends AbstractWorkbenchTestCase { --- AbstractJavaIntegrationTestWorkbench.java DELETED --- --- NEW FILE: AbstractWorkbenchTestCase.java --- package org.python.pydev.editor.codecompletion.revisited.javaintegration; import java.io.ByteArrayInputStream; import java.io.File; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import junit.framework.TestCase; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.launching.JavaRuntime; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.IContentAssistant; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IViewReference; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.python.pydev.core.ICallback; import org.python.pydev.core.IInterpreterManager; import org.python.pydev.core.REF; import org.python.pydev.core.TestDependent; import org.python.pydev.core.Tuple; import org.python.pydev.core.docutils.StringUtils; import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.codecompletion.revisited.ProjectModulesManager; import org.python.pydev.editor.simpleassist.SimpleAssistProcessor; import org.python.pydev.editorinput.PyOpenEditor; import org.python.pydev.plugin.PydevPlugin; import org.python.pydev.plugin.nature.PythonNature; import org.python.pydev.ui.filetypes.FileTypesPreferencesPage; import org.python.pydev.ui.interpreters.JythonInterpreterManager; import org.python.pydev.ui.pythonpathconf.InterpreterInfo; /** * This is a base class for doing test cases that require the workbench to be 'alive' and that want to test the integration * with jython/java. * * @author Fabio */ public class AbstractWorkbenchTestCase extends TestCase{ /** * This is the module that's opened in a PyEdit editor. */ protected static IFile mod1; /** * This is the editor where the file-contents are opened. */ protected static PyEdit editor; /** * Init file under pack1.pack2.__init__.py */ protected static IFile initFile; /** * Create a project with the structure: * * /pydev_unit_test_project * junit.jar <-- set in pythonpath * /src <-- set in pythonpath * /pack1 * __init__.py * /pack2 * __init__.py * mod1.py * * /java_unit_test_project * /src <-- set in classpath * JavaDefault.java (default package) * /javamod1/JavaClass.java * /javamod2/JavaClass.java * * Note: the initialization of the structure will happen only once and will be re-used in all the tests after it. */ @Override protected void setUp() throws Exception { closeWelcomeView(); String mod1Contents = "import java.lang.Class\njava.lang.Class"; if(editor == null){ InterpreterInfo.configurePathsCallback = new ICallback<Boolean, Tuple<List<String>, List<String>>>(){ public Boolean call(Tuple<List<String>, List<String>> arg) { return Boolean.TRUE; } }; PydevPlugin.setJythonInterpreterManager(new JythonInterpreterManager(PydevPlugin.getDefault().getPluginPreferences())); ProjectModulesManager.IN_TESTS = true; NullProgressMonitor monitor = new NullProgressMonitor(); createJythonInterpreterManager(monitor); IProject project = createProject(monitor, "pydev_unit_test_project"); IJavaProject javaProject = configureAsJavaProject(createProject(monitor, "java_unit_test_project"), monitor); setProjectReference(monitor, project, javaProject); createJunitJar(monitor, project); IFolder sourceFolder = createSourceFolder(monitor, project); initFile = createPackageStructure(sourceFolder, "pack1.pack2", monitor); mod1 = initFile.getParent().getFile(new Path("mod1.py")); //OK, structure created, now, let's open mod1.py with a PyEdit so that the tests can begin... //create the contents and open the editor mod1.create(new ByteArrayInputStream(mod1Contents.getBytes()), true, monitor); PythonNature nature = PythonNature.getPythonNature(project); //Let's give it some time to run the jobs that restore the nature long finishAt = System.currentTimeMillis()+5000; //5 secs is the max time Display display = Display.getCurrent(); if(display == null){ display = Display.getDefault(); } Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); while (!shell.isDisposed()) { if (!display.readAndDispatch()){ display.sleep(); } if(finishAt<System.currentTimeMillis()){ break; } if(nature != null){ if(nature.getAstManager() != null){ break; } } } assertTrue(nature != null); assertTrue(nature.getAstManager() != null); editor = (PyEdit) PyOpenEditor.doOpenEditor(mod1); }else{ setFileContents(mod1Contents);//just make sure that the contents of mod1 are correct. } } /** * Prints the display strings for the passed proposals. */ protected void printProps(ICompletionProposal[] props) { System.out.println("START Printing proposals -----------------------------"); for (ICompletionProposal prop : props) { System.out.println(prop.getDisplayString()); } System.out.println("END Printing proposals -----------------------------"); } protected void goToManual() { goToManual(-1); } protected void goToManual(long millis) { goToManual(millis, null); } /** * Goes to 'manual' mode to allow the interaction with the opened eclipse instance. */ protected void goToManual(long millis, ICallback<Boolean, Object> condition) { long finishAt = System.currentTimeMillis()+millis; System.out.println("going to manual..."); Display display = Display.getCurrent(); if(display == null){ display = Display.getDefault(); } Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); while (!shell.isDisposed()) { if (!display.readAndDispatch()){ display.sleep(); } if(millis > 0 && finishAt<System.currentTimeMillis()){ break; } if(condition != null && condition.call(null)){ break; } } System.out.println("finishing..."); } /** * Creates a package structure below a source folder. */ protected IFile createPackageStructure(IContainer sourceFolder, String packageName, IProgressMonitor monitor) throws CoreException { IFile lastFile = null; if(sourceFolder == null){ return null; } IContainer parent = sourceFolder; String[] packageParts = StringUtils.dotSplit(packageName); for (String packagePart : packageParts) { IFolder folder = parent.getFolder(new Path(packagePart)); if(!folder.exists()){ folder.create(true, true, monitor); } parent = folder; IFile file = parent.getFile(new Path("__init__"+FileTypesPreferencesPage.getDefaultDottedPythonExtension())); if(!file.exists()){ file.create(new ByteArrayInputStream(new byte[0]), true, monitor); } lastFile = file; } return lastFile; } /** * Sets the contents of the mod1.py -- which has the PyEdit opened. */ protected void setFileContents(String mod1Contents) throws CoreException { NullProgressMonitor monitor = new NullProgressMonitor(); mod1.setContents(new ByteArrayInputStream(mod1Contents.getBytes()), 0, monitor); mod1.refreshLocal(IResource.DEPTH_INFINITE, monitor); } /** * Sets the referenced projects for project as being the javaProject passed. */ protected void setProjectReference(IProgressMonitor monitor, IProject project, IJavaProject javaProject) throws CoreException { IProjectDescription description = project.getDescription(); description.setReferencedProjects(new IProject[]{javaProject.getProject()}); project.setDescription(description, monitor); } /** * Adds the java nature to a given project * @return the java project (nature) that has been set. */ protected IJavaProject configureAsJavaProject(IProject project, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); String[] newNatures = new String[natures.length + 1]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = JavaCore.NATURE_ID; description.setNatureIds(newNatures); project.setDescription(description, monitor); IFolder srcFolder = project.getFolder(new Path("src")); srcFolder.create(false, true, monitor); IJavaProject javaProject = JavaCore.create(project); javaProject.setRawClasspath(new IClasspathEntry[]{JavaCore.newSourceEntry(srcFolder.getFullPath())}, monitor); Set<IClasspathEntry> entries = new HashSet<IClasspathEntry>(); entries.addAll(Arrays.asList(javaProject.getRawClasspath())); entries.add(JavaRuntime.getDefaultJREContainerEntry()); javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), monitor); //create src/javamod1/javamod2 IFolder javaMod1Folder = srcFolder.getFolder("javamod1"); javaMod1Folder.create(true, true, monitor); IFolder javaMod2Folder = javaMod1Folder.getFolder("javamod2"); javaMod2Folder.create(true, true, monitor); //create src/JavaDefault.java IFile javaClassFile = srcFolder.getFile("JavaDefault.java"); String javaClassContents = "public class JavaDefault {\n"+ //default package " private int testJavaDefault(String[] args) {\n"+ " return 0;\n"+ " }\n"+ "}\n"; javaClassFile.create(new ByteArrayInputStream(javaClassContents.getBytes()), true, monitor); //create src/javamod1/JavaClass.java javaClassFile = javaMod1Folder.getFile("JavaClass.java"); javaClassContents = "package javamod1;\n"+ "public class JavaClass {\n"+ " \n"+ " public static int JAVA_CLASS_CONSTANT = 1;\n"+ " \n"+ " public static void main(String[] args) {\n"+ " new JavaClass().testJavaClass(new int[0]);\n"+ " }\n"+ " private int testJavaClass(int[] args) {\n"+ " return 0;\n"+ " }\n"+ "}\n"; javaClassFile.create(new ByteArrayInputStream(javaClassContents.getBytes()), true, monitor); //create src/javamod1/javamod2/JavaClass2.java javaClassFile = javaMod2Folder.getFile("JavaClass2.java"); javaClassContents = "package javamod1.javamod2;\n"+ "public class JavaClass2 {\n"+ " \n"+ " public static int JAVA_CLASS_CONSTANT_2 = 1;\n"+ " \n"+ " public JavaClass2(int i){};\n"+ " \n"+ " public static void main(String[] args) {\n"+ " new JavaClass2(1).testJavaClass2(new int[0]);\n"+ " }\n"+ " private int testJavaClass2(int[] args) {\n"+ " return 0;\n"+ " }\n"+ "}\n"; javaClassFile.create(new ByteArrayInputStream(javaClassContents.getBytes()), true, monitor); project.refreshLocal(IResource.DEPTH_INFINITE, monitor); return javaProject; } /** * Creates a source folder and configures the project to use it and the junit.jar */ protected IFolder createSourceFolder(IProgressMonitor monitor, IProject project) throws CoreException { return createSourceFolder(monitor, project, true); } /** * Creates a source folder and configures the project to use it and the junit.jar * * @param addNature if false, no nature will be initially added to the project (if true, the nature will be added) */ protected IFolder createSourceFolder(IProgressMonitor monitor, IProject project, boolean addNature) throws CoreException { IFolder sourceFolder = project.getFolder(new Path("src")); if(!sourceFolder.exists()){ sourceFolder.create(true, true, monitor); } if(addNature){ PythonNature.addNature(project, monitor, PythonNature.JYTHON_VERSION_2_1, "/pydev_unit_test_project/src|/pydev_unit_test_project/junit.jar"); } return sourceFolder; } /** * Creates the jython interpreter manager with the default jython jar location. */ protected void createJythonInterpreterManager(NullProgressMonitor monitor) { IInterpreterManager iMan = PydevPlugin.getJythonInterpreterManager(true); iMan.addInterpreter(TestDependent.JYTHON_JAR_LOCATION, monitor); iMan.restorePythopathFor(TestDependent.JYTHON_JAR_LOCATION, monitor); iMan.setPersistedString(iMan.getStringToPersist(new String[]{TestDependent.JYTHON_JAR_LOCATION})); iMan.saveInterpretersInfoModulesManager(); } /** * Creates a junit.jar file in the project. */ protected void createJunitJar(NullProgressMonitor monitor, IProject project) throws CoreException { String junitJarLocatioon = project.getLocation().toOSString()+"/junit.jar"; File junitJarFile = new File(junitJarLocatioon); if(!junitJarFile.exists()){ REF.copyFile(TestDependent.TEST_PYDEV_PLUGIN_LOC+"tests_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration/junit.jar", junitJarLocatioon); } project.refreshLocal(IResource.DEPTH_INFINITE, monitor); } /** * Creates a pydev_unit_test_project to be used in the tests */ protected IProject createProject(IProgressMonitor monitor, String projectName) throws CoreException { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if(project.exists()){ project.delete(true, monitor); } project.create(monitor); project.open(monitor); return project; } /** * Requests proposals in the last location of the given editor. */ protected ICompletionProposal[] requestProposals(String mod1Contents, PyEdit editor) { IContentAssistant contentAssistant = editor.getEditConfiguration().getContentAssistant(editor.getPySourceViewer()); SimpleAssistProcessor processor = (SimpleAssistProcessor) contentAssistant.getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE); processor.doCycle(); //we want to show the default completions in this case (not the simple ones) ICompletionProposal[] props = processor.computeCompletionProposals(editor.getPySourceViewer(), mod1Contents.length()); return props; } /** * Closes the welcome view (if being shown) */ public void closeWelcomeView() { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IViewReference[] viewReferences = workbenchWindow.getActivePage().getViewReferences(); for(IViewReference ref:viewReferences){ if(ref.getPartName().equals("Welcome")){ workbenchWindow.getActivePage().hideView(ref); } } } } |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:08
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src_completions/org/python/pydev/editor/codecompletion Modified Files: PyCodeCompletion.java PyContentAssistant.java Added Files: IASTManagerObserver.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: PyCodeCompletion.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/PyCodeCompletion.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyCodeCompletion.java 31 Jul 2008 01:47:37 -0000 1.6 --- PyCodeCompletion.java 13 Aug 2008 21:12:16 -0000 1.7 *************** *** 35,38 **** --- 35,39 ---- import org.python.pydev.core.log.Log; import org.python.pydev.core.structure.CompletionRecursionException; + import org.python.pydev.core.structure.FastStack; import org.python.pydev.editor.codecompletion.revisited.ASTManager; import org.python.pydev.editor.codecompletion.revisited.AssignAnalysis; *************** *** 45,48 **** --- 46,50 ---- import org.python.pydev.parser.jython.SimpleNode; import org.python.pydev.parser.jython.ast.ClassDef; + import org.python.pydev.parser.jython.ast.FunctionDef; import org.python.pydev.parser.jython.ast.Name; import org.python.pydev.parser.jython.ast.NameTok; *************** *** 275,288 **** char[] toks = new char[]{'.', ' '}; List<Object> completions = new ArrayList<Object>(); if (trimmed.equals("self") || FullRepIterable.getFirstPart(trimmed, toks).equals("self")) { ! state.setLookingFor(ICompletionState.LOOKING_FOR_INSTANCED_VARIABLE); ! getSelfOrClsCompletions(request, tokensList, state, false); }else if (trimmed.equals("cls") || FullRepIterable.getFirstPart(trimmed, toks).equals("cls")) { ! state.setLookingFor(ICompletionState.LOOKING_FOR_CLASSMETHOD_VARIABLE); ! getSelfOrClsCompletions(request, tokensList, state, false); ! ! } else { state.setActivationToken(request.activationToken); --- 277,292 ---- char[] toks = new char[]{'.', ' '}; List<Object> completions = new ArrayList<Object>(); + + boolean lookInGlobals = true; + if (trimmed.equals("self") || FullRepIterable.getFirstPart(trimmed, toks).equals("self")) { ! lookInGlobals = !getSelfOrClsCompletions(request, tokensList, state, false, true, "self"); }else if (trimmed.equals("cls") || FullRepIterable.getFirstPart(trimmed, toks).equals("cls")) { ! lookInGlobals = !getSelfOrClsCompletions(request, tokensList, state, false, true, "cls"); + } + + if(lookInGlobals){ state.setActivationToken(request.activationToken); *************** *** 360,382 **** * @param theList OUT - returned completions are added here. (IToken instances) * @param getOnlySupers whether we should only get things from super classes (in this case, we won't get things from the current class) ! * @return the same tokens added in theList */ ! public static void getSelfOrClsCompletions(CompletionRequest request, List theList, ICompletionState state, boolean getOnlySupers) { SimpleNode s = PyParser.reparseDocument(new PyParser.ParserInfo(request.doc, true, request.nature, state.getLine())).o1; - getSelfOrClsCompletions(request, theList, state, getOnlySupers, s); - } - - public static void getSelfOrClsCompletions(CompletionRequest request, List theList, ICompletionState state, boolean getOnlySupers, SimpleNode s) { if(s != null){ ! FindScopeVisitor visitor = new FindScopeVisitor(state.getLine(), 0); ! try { ! s.accept(visitor); ! getSelfOrClsCompletions(visitor.scope, request, theList, state, getOnlySupers); ! } catch (Exception e1) { ! e1.printStackTrace(); ! } ! } } ! /** * Get self completions when you already have a scope --- 364,415 ---- * @param theList OUT - returned completions are added here. (IToken instances) * @param getOnlySupers whether we should only get things from super classes (in this case, we won't get things from the current class) ! * @param checkIfInCorrectScope if true, we'll first check if we're in a scope that actually has a method with 'self' or 'cls' ! * ! * @return true if we actually tried to get the completions for self or cls. */ ! @SuppressWarnings("unchecked") ! public static boolean getSelfOrClsCompletions(CompletionRequest request, List theList, ICompletionState state, ! boolean getOnlySupers, boolean checkIfInCorrectScope, String lookForRep) { ! SimpleNode s = PyParser.reparseDocument(new PyParser.ParserInfo(request.doc, true, request.nature, state.getLine())).o1; if(s != null){ ! FindScopeVisitor visitor = new FindScopeVisitor(state.getLine(), 0); ! try { ! s.accept(visitor); ! if(checkIfInCorrectScope){ ! boolean scopeCorrect = false; ! ! FastStack<SimpleNode> scopeStack = visitor.scope.getScopeStack(); ! for(Iterator<SimpleNode> it=scopeStack.topDownIterator();scopeCorrect == false && it.hasNext();){ ! SimpleNode node = it.next(); ! if (node instanceof FunctionDef) { ! FunctionDef funcDef = (FunctionDef) node; ! if(funcDef.args != null && funcDef.args.args != null || funcDef.args.args.length > 0){ ! //ok, we have some arg, let's check for self or cls ! String rep = NodeUtils.getRepresentationString(funcDef.args.args[0]); ! if(rep != null && (rep.equals("self") || rep.equals("cls"))){ ! scopeCorrect = true; ! } ! } ! } ! } ! if(!scopeCorrect){ ! return false; ! } ! } ! if(lookForRep.equals("self")){ ! state.setLookingFor(ICompletionState.LOOKING_FOR_INSTANCED_VARIABLE); ! }else{ ! state.setLookingFor(ICompletionState.LOOKING_FOR_CLASSMETHOD_VARIABLE); ! } ! getSelfOrClsCompletions(visitor.scope, request, theList, state, getOnlySupers); ! } catch (Exception e1) { ! PydevPlugin.log(e1); ! } ! return true; ! } ! return false; } ! /** * Get self completions when you already have a scope --- NEW FILE: IASTManagerObserver.java --- package org.python.pydev.editor.codecompletion; import org.python.pydev.core.ICodeCompletionASTManager; /** * An extension point notified when ASTManager is created and assigned to * a project. * * @author ra...@ku... (Radim Kubacki) */ public interface IASTManagerObserver { /** * Called when AST manager is created and associated with a project. * * @param manager */ void notifyASTManagerAttached(ICodeCompletionASTManager manager); } Index: PyContentAssistant.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/PyContentAssistant.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyContentAssistant.java 12 Apr 2008 13:04:08 -0000 1.6 --- PyContentAssistant.java 13 Aug 2008 21:12:16 -0000 1.7 *************** *** 44,48 **** } ! setRepeatedInvocationTrigger(KeyBindingHelper.getContentAssistProposalBinding()); try{ --- 44,52 ---- } ! try{ ! setRepeatedInvocationTrigger(KeyBindingHelper.getContentAssistProposalBinding()); ! }catch(Exception e){ ! PydevPlugin.log(e); ! } try{ |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:08
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui/interpreters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src/org/python/pydev/ui/interpreters Modified Files: IInterpreterObserver.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: IInterpreterObserver.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui/interpreters/IInterpreterObserver.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IInterpreterObserver.java 22 Feb 2006 00:26:16 -0000 1.8 --- IInterpreterObserver.java 13 Aug 2008 21:12:16 -0000 1.9 *************** *** 23,27 **** * Notifies observers that the given interpreter manager has just been recreated (this is due to restarting the plugin) * ! * @param manager the manager that has just been recreated */ void notifyInterpreterManagerRecreated(IInterpreterManager interpreterManager); --- 23,27 ---- * Notifies observers that the given interpreter manager has just been recreated (this is due to restarting the plugin) * ! * @param interpreterManager the manager that has just been recreated */ void notifyInterpreterManagerRecreated(IInterpreterManager interpreterManager); |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:08
|
Update of /cvsroot/pydev/org.python.pydev/tests/pysrc/extendable/noerr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/tests/pysrc/extendable/noerr Modified Files: importer.py Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: importer.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/pysrc/extendable/noerr/importer.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** importer.py 2 Feb 2008 22:29:30 -0000 1.4 --- importer.py 13 Aug 2008 21:12:16 -0000 1.5 *************** *** 32,35 **** --- 32,42 ---- def __init__(self, **entries): self.__dict__.update(entries) + + + class StructSub(Struct): + '''@DynamicAttrs + ''' + pass #Subclass of one with Dynamic attrs also must define it + globals_struct = Struct(answer=42, linelen = 80, font='courier') |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:07
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061 Modified Files: Changes.txt plugin.xml Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/Changes.txt,v retrieving revision 1.413 retrieving revision 1.414 diff -C2 -d -r1.413 -r1.414 *** Changes.txt 6 Aug 2008 16:23:19 -0000 1.413 --- Changes.txt 13 Aug 2008 21:12:15 -0000 1.414 *************** *** 5,8 **** --- 5,13 ---- <li><strong>Pydev Package Explorer</strong>: Editor-link does not remove focus from current editor if it's already a match (bug when compare editor was opened)</li> <li><strong>Pydev debugger</strong>: showing set and frozenset contents</li> + <li><strong>Pydev debugger</strong>: watch working in eclipse 3.4</li> + <li><strong>Pydev debugger</strong>: breakpoint properties accept new lines and tabs</li> + <li><strong>Incremental find</strong>: backspace works correctly</li> + <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> + <li><strong>Launch icons</strong>: Transparent background (thanks to Radim Kubacki)</li> </ul> Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.208 retrieving revision 1.209 diff -C2 -d -r1.208 -r1.209 *** plugin.xml 30 Jun 2008 00:29:06 -0000 1.208 --- plugin.xml 13 Aug 2008 21:12:15 -0000 1.209 *************** *** 296,299 **** --- 296,300 ---- id="org.python.pydev.editor.actions.firstChar"> </action> + <!-- Backspace now handled in VerifyKey (incremental find integration) <action definitionId="org.python.pydev.editor.actions.pybackspace" *************** *** 303,306 **** --- 304,308 ---- id="org.python.pydev.editor.actions.pybackspace"> </action> + --> <action definitionId="org.python.pydev.editor.actions.convertSpaceToTab" *************** *** 556,559 **** --- 558,562 ---- </command> <!-- command: backspace considering indentation--> + <!-- Backspace now handled in VerifyKey (incremental find integration) <command description="Backspace considering indentation for Python." *************** *** 562,566 **** name="Python Backspace (with indentation)"> </command> ! <!-- command: next method / class--> <command --- 565,569 ---- name="Python Backspace (with indentation)"> </command> ! --> <!-- command: next method / class--> <command *************** *** 746,749 **** --- 749,753 ---- </key> <!--TODO: guessing at name "BACKSPACE, needs verification --> + <!-- Backspace now handled in VerifyKey (incremental find integration) <key sequence="BACKSPACE" *************** *** 752,755 **** --- 756,760 ---- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"> </key> + --> <key sequence="Ctrl+Shift+Arrow_Up" *************** *** 1003,1006 **** --- 1008,1012 ---- <extension-point id="pydev_debug_preferences_page" name="Pydev Debug Preferences Page" schema="schema/pydev_debug_preferences_page.exsd"/> <extension-point id="pydev_pythonpath_contrib" name="Python Path Contributor" schema="schema/pydev_pythonpath_contrib.exsd"/> + <extension-point id="pydev_manager_observer" name="Pydev code completion manager observer" schema="schema/pydev_manager_observer.exsd"/> <!-- wizards --> <extension point="org.eclipse.ui.newWizards"> |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:07
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration Modified Files: JavaProjectModulesManager.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: JavaProjectModulesManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/javaintegration/JavaProjectModulesManager.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** JavaProjectModulesManager.java 31 Jul 2008 01:47:37 -0000 1.14 --- JavaProjectModulesManager.java 13 Aug 2008 21:12:16 -0000 1.15 *************** *** 240,243 **** --- 240,247 ---- } + public void setPythonPathHelper(Object helper) { + return; // noop + } + public IModule getRelativeModule(String name, IPythonNature nature) { return this.getModuleInDirectManager(name, nature, true); |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:07
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src/org/python/pydev/utils Modified Files: PyFileListing.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: PyFileListing.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/utils/PyFileListing.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyFileListing.java 14 Jun 2008 22:14:57 -0000 1.3 --- PyFileListing.java 13 Aug 2008 21:12:15 -0000 1.4 *************** *** 4,7 **** --- 4,8 ---- import java.io.FileFilter; import java.util.ArrayList; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; *************** *** 25,75 **** public class PyFileListing { ! /** ! * Class containing the information we discovered when searching for valid files beneath some folder. ! * ! * @author Fabio ! */ ! public static class PyFileListingInfo{ ! ! /** ! * The files we found as being valid for the given filter ! */ ! public List<File> filesFound = new ArrayList<File>(); ! ! /** ! * The folders we found as being valid for the given filter ! */ ! public List<File> foldersFound = new ArrayList<File>(); ! ! /** ! * The relative path (composed with the parent folder names) where the file was found ! * (from the root passed) -- we should be able to determine the name of the module ! * of the corresponding file in the filesFound from this info. ! * ! * For each file found a string should be added in this list (so, the same path will be added ! * multiple times for different files). ! */ ! public List<String> fileParentPathNamesRelativeToRoot = new ArrayList<String>(); ! ! /** ! * Add the info from the passed listing to this one. ! */ ! public void extendWith(PyFileListingInfo other) { ! filesFound.addAll(other.filesFound); ! foldersFound.addAll(other.foldersFound); ! ! fileParentPathNamesRelativeToRoot.addAll(other.fileParentPathNamesRelativeToRoot); ! }; ! } /** ! * Returns the directories and python files in a list. ! * ! * @param file ! * @param addSubFolders: indicates if sub-folders should be added ! * @return tuple with files in pos 0 and folders in pos 1 ! */ @SuppressWarnings("unchecked") ! public static PyFileListingInfo getPyFilesBelow(File file, FileFilter filter, IProgressMonitor monitor, boolean addSubFolders, int level, boolean checkHasInit, String currModuleRep) { --- 26,64 ---- public class PyFileListing { ! /** ! * Information about a python file found (the actual file and the way it was resolved as a python module) ! */ ! public static final class PyFileInfo { ! ! private final String relPath; ! ! private final File file; ! ! public PyFileInfo(File file, String relPath) { ! this.file = file; ! this.relPath = relPath; ! } ! ! /** File object. */ ! public File getFile() { ! return file; ! } ! ! /** Returns fully qualified name of module. */ ! public String getModuleName() { ! return relPath; ! } ! } /** ! * Returns the directories and python files in a list. ! * ! * @param file ! * @param addSubFolders ! * indicates if sub-folders should be added ! * @return tuple with files in pos 0 and folders in pos 1 ! */ @SuppressWarnings("unchecked") ! private static PyFileListing getPyFilesBelow(File file, FileFilter filter, IProgressMonitor monitor, boolean addSubFolders, int level, boolean checkHasInit, String currModuleRep) { *************** *** 79,83 **** } ! PyFileListingInfo ret = new PyFileListingInfo(); if (file != null && file.exists()) { --- 68,72 ---- } ! PyFileListing ret = new PyFileListing(); if (file != null && file.exists()) { *************** *** 110,115 **** if(file2.isFile()){ ! ret.filesFound.add(file2); ! ret.fileParentPathNamesRelativeToRoot.add(currModuleRep); monitor.worked(1); --- 99,103 ---- if(file2.isFile()){ ! ret.addPyFileInfo(new PyFileInfo(file2, currModuleRep)); monitor.worked(1); *************** *** 145,150 **** } else if (file.isFile()) { ! ret.fileParentPathNamesRelativeToRoot.add(currModuleRep); ! ret.filesFound.add(file); } else{ --- 133,137 ---- } else if (file.isFile()) { ! ret.addPyFileInfo(new PyFileInfo(file, currModuleRep)); } else{ *************** *** 156,164 **** } ! public static PyFileListingInfo getPyFilesBelow(File file, FileFilter filter, IProgressMonitor monitor, boolean addSubFolders, boolean checkHasInit) { return getPyFilesBelow(file, filter, monitor, addSubFolders, 0, checkHasInit, ""); } ! public static PyFileListingInfo getPyFilesBelow(File file, FileFilter filter, IProgressMonitor monitor, boolean checkHasInit) { return getPyFilesBelow(file, filter, monitor, true, checkHasInit); } --- 143,151 ---- } ! private static PyFileListing getPyFilesBelow(File file, FileFilter filter, IProgressMonitor monitor, boolean addSubFolders, boolean checkHasInit) { return getPyFilesBelow(file, filter, monitor, addSubFolders, 0, checkHasInit, ""); } ! public static PyFileListing getPyFilesBelow(File file, FileFilter filter, IProgressMonitor monitor, boolean checkHasInit) { return getPyFilesBelow(file, filter, monitor, true, checkHasInit); } *************** *** 200,204 **** * @return tuple with files in pos 0 and folders in pos 1 */ ! public static PyFileListingInfo getPyFilesBelow(File file, IProgressMonitor monitor, final boolean includeDirs, boolean checkHasInit) { FileFilter filter = getPyFilesFileFilter(includeDirs); return getPyFilesBelow(file, filter, monitor, true, checkHasInit); --- 187,191 ---- * @return tuple with files in pos 0 and folders in pos 1 */ ! public static PyFileListing getPyFilesBelow(File file, IProgressMonitor monitor, final boolean includeDirs, boolean checkHasInit) { FileFilter filter = getPyFilesFileFilter(includeDirs); return getPyFilesBelow(file, filter, monitor, true, checkHasInit); *************** *** 228,230 **** --- 215,249 ---- } + /** + * The files we found as being valid for the given filter + */ + private final List<PyFileInfo> pyFileInfos = new ArrayList<PyFileInfo>(); + + /** + * The folders we found as being valid for the given filter + */ + private List<File> foldersFound = new ArrayList<File>(); + + public PyFileListing() { + } + + public Collection<PyFileInfo> getFoundPyFileInfos() { + return pyFileInfos; + } + + public Collection<File> getFoundFolders() { + return foldersFound; + } + + private void addPyFileInfo(PyFileInfo info) { + pyFileInfos.add(info); + } + + /** + * Add the info from the passed listing to this one. + */ + private void extendWith(PyFileListing other) { + pyFileInfos.addAll(other.pyFileInfos); + foldersFound.addAll(other.foldersFound); + } } |
Update of /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/plugin/nature In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/tests/org/python/pydev/plugin/nature Modified Files: SaveFileWithoutNatureTestWorkbench.java PythonNatureStoreTest.java ProjectImportedHasAstManagerTestWorkbench.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: SaveFileWithoutNatureTestWorkbench.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/plugin/nature/SaveFileWithoutNatureTestWorkbench.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SaveFileWithoutNatureTestWorkbench.java 6 Aug 2008 16:23:19 -0000 1.2 --- SaveFileWithoutNatureTestWorkbench.java 13 Aug 2008 21:12:15 -0000 1.3 *************** *** 9,19 **** import org.python.pydev.core.REF; import org.python.pydev.editor.PyEdit; ! import org.python.pydev.editor.codecompletion.revisited.javaintegration.AbstractJavaIntegrationTestWorkbench; import org.python.pydev.editorinput.PyOpenEditor; ! public class SaveFileWithoutNatureTestWorkbench extends AbstractJavaIntegrationTestWorkbench{ protected void setUp() throws Exception { //no setup (because we won't have the nature in this test) } --- 9,20 ---- import org.python.pydev.core.REF; import org.python.pydev.editor.PyEdit; ! import org.python.pydev.editor.codecompletion.revisited.javaintegration.AbstractWorkbenchTestCase; import org.python.pydev.editorinput.PyOpenEditor; ! public class SaveFileWithoutNatureTestWorkbench extends AbstractWorkbenchTestCase{ protected void setUp() throws Exception { //no setup (because we won't have the nature in this test) + closeWelcomeView(); } Index: PythonNatureStoreTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/plugin/nature/PythonNatureStoreTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PythonNatureStoreTest.java 8 Aug 2007 00:31:09 -0000 1.5 --- PythonNatureStoreTest.java 13 Aug 2008 21:12:15 -0000 1.6 *************** *** 62,66 **** public void testLoad() throws Exception { ! IPythonNatureStore store = new PythonNatureStore(); ProjectStub2 projectStub2 = new ProjectStub2("test"); --- 62,66 ---- public void testLoad() throws Exception { ! PythonNatureStore store = new PythonNatureStore(); ProjectStub2 projectStub2 = new ProjectStub2("test"); *************** *** 69,74 **** //check the contents ! assertEquals(true, projectStub2.fileStub.created); ! String strContents = projectStub2.fileStub.getStrContents(); PySelectionTest.checkStrEquals(contents1, strContents.replaceFirst(" standalone=\"no\"", "")); //depending on the java version, standalone="no" may be generated --- 69,73 ---- //check the contents ! String strContents = store.getLastLoadedContents(); PySelectionTest.checkStrEquals(contents1, strContents.replaceFirst(" standalone=\"no\"", "")); //depending on the java version, standalone="no" may be generated *************** *** 78,82 **** assertEquals("/test/foo|/bar/kkk", store.getPathProperty(PythonPathNature.getProjectSourcePathQualifiedName())); ! strContents = projectStub2.fileStub.getStrContents(); PySelectionTest.checkStrEquals(contents2, strContents.replaceFirst(" standalone=\"no\"", "")); //depending on the java version, standalone="no" may be generated assertEquals("", store.getPathProperty(PythonPathNature.getProjectExternalSourcePathQualifiedName())); --- 77,81 ---- assertEquals("/test/foo|/bar/kkk", store.getPathProperty(PythonPathNature.getProjectSourcePathQualifiedName())); ! strContents = store.getLastLoadedContents(); PySelectionTest.checkStrEquals(contents2, strContents.replaceFirst(" standalone=\"no\"", "")); //depending on the java version, standalone="no" may be generated assertEquals("", store.getPathProperty(PythonPathNature.getProjectExternalSourcePathQualifiedName())); Index: ProjectImportedHasAstManagerTestWorkbench.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/plugin/nature/ProjectImportedHasAstManagerTestWorkbench.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProjectImportedHasAstManagerTestWorkbench.java 31 Jul 2008 01:47:36 -0000 1.1 --- ProjectImportedHasAstManagerTestWorkbench.java 13 Aug 2008 21:12:15 -0000 1.2 *************** *** 18,27 **** import org.python.pydev.core.REF; import org.python.pydev.editor.codecompletion.revisited.PythonPathHelper; ! import org.python.pydev.editor.codecompletion.revisited.javaintegration.AbstractJavaIntegrationTestWorkbench; ! public class ProjectImportedHasAstManagerTestWorkbench extends AbstractJavaIntegrationTestWorkbench{ protected void setUp() throws Exception { //no setup (because we won't have the nature in this test) } --- 18,28 ---- import org.python.pydev.core.REF; import org.python.pydev.editor.codecompletion.revisited.PythonPathHelper; ! import org.python.pydev.editor.codecompletion.revisited.javaintegration.AbstractWorkbenchTestCase; ! public class ProjectImportedHasAstManagerTestWorkbench extends AbstractWorkbenchTestCase{ protected void setUp() throws Exception { //no setup (because we won't have the nature in this test) + closeWelcomeView(); } |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:07
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/correctionassist/heuristics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src/org/python/pydev/editor/correctionassist/heuristics Modified Files: AssistOverride.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: AssistOverride.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/correctionassist/heuristics/AssistOverride.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AssistOverride.java 14 Jun 2008 22:14:56 -0000 1.21 --- AssistOverride.java 13 Aug 2008 21:12:15 -0000 1.22 *************** *** 55,59 **** CompletionRequest request = new CompletionRequest(file, nature, ps.getDoc(), "self", ps.getAbsoluteCursorOffset(), 0, new PyCodeCompletion(), ""); List<IToken> selfCompletions = new ArrayList<IToken>(); ! PyCodeCompletion.getSelfOrClsCompletions(request, selfCompletions, state, true); --- 55,59 ---- CompletionRequest request = new CompletionRequest(file, nature, ps.getDoc(), "self", ps.getAbsoluteCursorOffset(), 0, new PyCodeCompletion(), ""); List<IToken> selfCompletions = new ArrayList<IToken>(); ! PyCodeCompletion.getSelfOrClsCompletions(request, selfCompletions, state, true, false, "self"); |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:07
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src/org/python/pydev/editor Modified Files: PyEdit.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** PyEdit.java 31 Jul 2008 01:47:36 -0000 1.132 --- PyEdit.java 13 Aug 2008 21:12:15 -0000 1.133 *************** *** 37,44 **** --- 37,46 ---- import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; + import org.eclipse.swt.custom.VerifyKeyListener; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseListener; + import org.eclipse.swt.events.VerifyEvent; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; *************** *** 70,73 **** --- 72,76 ---- import org.python.pydev.editor.actions.OfflineActionTarget; import org.python.pydev.editor.actions.PyAction; + import org.python.pydev.editor.actions.PyBackspace; import org.python.pydev.editor.actions.PyOpenAction; import org.python.pydev.editor.autoedit.DefaultIndentPrefs; *************** *** 77,80 **** --- 80,84 ---- import org.python.pydev.editor.codefolding.CodeFoldingSetter; import org.python.pydev.editor.codefolding.PyEditProjection; + import org.python.pydev.editor.codefolding.PySourceViewer; import org.python.pydev.editor.model.IModelListener; import org.python.pydev.editor.scripting.PyEditScripting; *************** *** 279,287 **** /** ! * Overriden so that we can set up the cursor listener (notifies changes in the cursor position) */ @Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ! ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles); //add a cursor listener StyledText textWidget = viewer.getTextWidget(); --- 283,295 ---- /** ! * Overridden so that we can: ! * - Set up the cursor listener (notifies changes in the cursor position) ! * - Make the backspace handling in a way that the incremental find works (note: having the listener in the ! * textWidget does not work for that, as the event used in the IncrementalFindTarget is not the same event ! * that goes to the textWidget). */ @Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ! PySourceViewer viewer = (PySourceViewer) super.createSourceViewer(parent, ruler, styles); //add a cursor listener StyledText textWidget = viewer.getTextWidget(); *************** *** 290,293 **** --- 298,315 ---- textWidget.addKeyListener(cursorListener); + VerifyKeyListener verifyKeyListener = new VerifyKeyListener(){ + + public void verifyKey(VerifyEvent event) { + if((event.doit && event.character == SWT.BS && event.stateMask == 0)){ //isBackspace + PyBackspace pyBackspace = new PyBackspace(); + pyBackspace.setEditor(PyEdit.this); + pyBackspace.perform(new PySelection(PyEdit.this)); + event.doit = false; + } + } + }; + + viewer.appendVerifyKeyListener(verifyKeyListener); + return viewer; } |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:07
|
Update of /cvsroot/pydev/org.python.pydev/schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/schema Added Files: pydev_manager_observer.exsd Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger --- NEW FILE: pydev_manager_observer.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.python.pydev"> <annotation> <appInfo> <meta.schema plugin="org.python.pydev" id="pydev_manager_observer" name="org.python.pydev.pydev_manager_observer"/> </appInfo> <documentation> Extension point to notify that code completion manager was created and attached to a project </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="manager_observer" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> a fully qualified identifier of the target extension point </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> an optional identifier of the extension instance </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> an optional name of the extension instance </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="manager_observer"> <complexType> <attribute name="class" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="since"/> </appInfo> <documentation> [Enter the first release in which this extension point appears.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> [Enter extension point usage example here.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> [Enter API information here.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> [Enter information about supplied implementation of this extension point.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> </documentation> </annotation> </schema> |
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src_completions/org/python/pydev/editor/codecompletion/revisited Modified Files: ASTManager.java ModulesManager.java ProjectModulesManager.java PythonPathHelper.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger Index: PythonPathHelper.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/PythonPathHelper.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PythonPathHelper.java 14 Jun 2008 22:14:55 -0000 1.11 --- PythonPathHelper.java 13 Aug 2008 21:12:15 -0000 1.12 *************** *** 25,30 **** --- 25,32 ---- import org.python.pydev.editor.codecompletion.revisited.ModulesFoundStructure.ZipContents; import org.python.pydev.plugin.PydevPlugin; + import org.python.pydev.plugin.nature.IPythonPathHelper; import org.python.pydev.ui.filetypes.FileTypesPreferencesPage; import org.python.pydev.utils.PyFileListing; + import org.python.pydev.utils.PyFileListing.PyFileInfo; /** *************** *** 34,38 **** * @author Fabio Zadrozny */ ! public class PythonPathHelper implements Serializable { private static final long serialVersionUID = 1L; --- 36,40 ---- * @author Fabio Zadrozny */ ! public class PythonPathHelper implements IPythonPathHelper, Serializable { private static final long serialVersionUID = 1L; *************** *** 57,60 **** --- 59,64 ---- } + public PythonPathHelper() {} + /** * This method returns all modules that can be obtained from a root File. *************** *** 63,67 **** * May return null if the passed file does not exist or is not a directory (e.g.: zip file) */ ! public PyFileListing.PyFileListingInfo getModulesBelow(File root, IProgressMonitor monitor) { if (!root.exists()) { return null; --- 67,71 ---- * May return null if the passed file does not exist or is not a directory (e.g.: zip file) */ ! public PyFileListing getModulesBelow(File root, IProgressMonitor monitor) { if (!root.exists()) { return null; *************** *** 93,97 **** * @return a list with the name of the found modules in the jar */ ! private static ModulesFoundStructure.ZipContents getFromJar(File root, IProgressMonitor monitor) { String fileName = root.getName(); --- 97,101 ---- * @return a list with the name of the found modules in the jar */ ! protected static ModulesFoundStructure.ZipContents getFromJar(File root, IProgressMonitor monitor) { String fileName = root.getName(); *************** *** 234,242 **** final File moduleFile = new File(fullPath); ! if (requireFileToExist) { ! if (moduleFile.exists() == false) { return null; } - } boolean isFile = moduleFile.isFile(); --- 238,244 ---- final File moduleFile = new File(fullPath); ! if (requireFileToExist && !moduleFile.exists()) { return null; } boolean isFile = moduleFile.isFile(); *************** *** 333,337 **** //ok, it was not found in any existing way, so, if we don't require the file to exist, let's just do some simpler search and get the //first match (if any)... this is useful if the file we are looking for has just been deleted ! if (requireFileToExist == false) { //we have to remove the last part (.py, .pyc, .pyw) for (String element : pythonpath) { --- 335,339 ---- //ok, it was not found in any existing way, so, if we don't require the file to exist, let's just do some simpler search and get the //first match (if any)... this is useful if the file we are looking for has just been deleted ! if (!requireFileToExist) { //we have to remove the last part (.py, .pyc, .pyw) for (String element : pythonpath) { *************** *** 371,375 **** * @return true if it is a folder with an __init__ python file */ ! private boolean isFileOrFolderWithInit(File root) { //check for an __init__ in a dir (we do not check if it is a file, becase if it is, it should return null) String[] items = root.list(new FilenameFilter() { --- 373,377 ---- * @return true if it is a folder with an __init__ python file */ ! protected boolean isFileOrFolderWithInit(File root) { //check for an __init__ in a dir (we do not check if it is a file, becase if it is, it should return null) String[] items = root.list(new FilenameFilter() { *************** *** 402,406 **** * @return */ ! private boolean isValidModule(String s) { return s.indexOf("-") == -1 && s.indexOf(" ") == -1 && s.indexOf(".") == -1; } --- 404,408 ---- * @return */ ! protected static boolean isValidModule(String s) { return s.indexOf("-") == -1 && s.indexOf(" ") == -1 && s.indexOf(".") == -1; } *************** *** 410,418 **** * @return */ ! public List<String> setPythonPath(String string) { synchronized (pythonpath) { pythonpath.clear(); ! getPythonPathFromStr(string, pythonpath); ! return new ArrayList<String>(pythonpath); } } --- 412,419 ---- * @return */ ! public void setPythonPath(String string) { synchronized (pythonpath) { pythonpath.clear(); ! parsePythonPathFromStr(string, pythonpath); } } *************** *** 422,426 **** * @param lPath OUT: this list is filled with the pythonpath. */ ! public static void getPythonPathFromStr(String string, List<String> lPath) { String[] strings = string.split("\\|"); for (int i = 0; i < strings.length; i++) { --- 423,427 ---- * @param lPath OUT: this list is filled with the pythonpath. */ ! private static void parsePythonPathFromStr(String string, List<String> lPath) { String[] strings = string.split("\\|"); for (int i = 0; i < strings.length; i++) { *************** *** 438,442 **** public List<String> getPythonpath() { ! return new ArrayList<String>(this.pythonpath); } --- 439,445 ---- public List<String> getPythonpath() { ! synchronized (pythonpath) { ! return new ArrayList<String>(pythonpath); ! } } *************** *** 445,473 **** * about the files that are related to python modules. */ ! public ModulesFoundStructure getModulesFoundStructure(List<String> pythonpathList, IProgressMonitor monitor) { ModulesFoundStructure ret = new ModulesFoundStructure(); ! for (Iterator<String> iter = pythonpathList.iterator(); iter.hasNext() && monitor.isCanceled() == false;) { String element = iter.next(); //the slow part is getting the files... not much we can do (I think). File root = new File(element); ! PyFileListing.PyFileListingInfo below = getModulesBelow(root, monitor); if (below != null) { ! Iterator<File> e1 = below.filesFound.iterator(); ! Iterator<String> e2 = below.fileParentPathNamesRelativeToRoot.iterator(); ! //both must have the same size... so, just check hasNext in one of those while (e1.hasNext()) { ! File o1 = e1.next(); ! String o2 = e2.next(); String modName; ! if (o2.length() != 0) { ! modName = new StringBuffer(o2).append(".").append(stripExtension(o1.getName())).toString(); } else { ! modName = stripExtension(o1.getName()); } ! ret.regularModules.put(o1, modName); } --- 448,481 ---- * about the files that are related to python modules. */ ! public ModulesFoundStructure getModulesFoundStructure(IProgressMonitor monitor) { ! List<String> pythonpathList = getPythonpath(); ! ModulesFoundStructure ret = new ModulesFoundStructure(); ! for (Iterator<String> iter = pythonpathList.iterator(); iter.hasNext();) { String element = iter.next(); + if (monitor.isCanceled()) { + break; + } + //the slow part is getting the files... not much we can do (I think). File root = new File(element); ! PyFileListing below = getModulesBelow(root, monitor); if (below != null) { ! Iterator<PyFileInfo> e1 = below.getFoundPyFileInfos().iterator(); while (e1.hasNext()) { ! PyFileInfo pyFileInfo = e1.next(); ! File file = pyFileInfo.getFile(); ! String scannedModuleName = pyFileInfo.getModuleName(); String modName; ! if (scannedModuleName.length() != 0) { ! modName = new StringBuffer(scannedModuleName).append('.').append(stripExtension(file.getName())).toString(); } else { ! modName = stripExtension(file.getName()); } ! ret.regularModules.put(file, modName); } Index: ASTManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/ASTManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ASTManager.java 31 Jul 2008 01:47:36 -0000 1.3 --- ASTManager.java 13 Aug 2008 21:12:15 -0000 1.4 *************** *** 11,22 **** --- 11,28 ---- import java.io.ObjectInputStream; import java.io.Serializable; + import java.util.List; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.text.IDocument; + import org.python.pydev.core.ExtensionHelper; import org.python.pydev.core.ICodeCompletionASTManager; import org.python.pydev.core.IModulesManager; import org.python.pydev.core.IProjectModulesManager; import org.python.pydev.core.IPythonNature; + import org.python.pydev.editor.codecompletion.IASTManagerObserver; + import org.python.pydev.plugin.PydevPlugin; + import org.python.pydev.plugin.nature.PythonNature; + import org.python.pydev.ui.interpreters.IInterpreterObserver; *************** *** 39,42 **** --- 45,50 ---- protected static final long serialVersionUID = 10L; + public ASTManager() {} + /** * Set the project this ast manager works with. *************** *** 44,47 **** --- 52,64 ---- public void setProject(IProject project, IPythonNature nature, boolean restoreDeltas){ getProjectModulesManager().setProject(project, nature, restoreDeltas); + List<IASTManagerObserver> participants = ExtensionHelper.getParticipants(ExtensionHelper.PYDEV_MANAGER_OBSERVER); + for (IASTManagerObserver observer : participants) { + try { + observer.notifyASTManagerAttached(this); + } catch (Exception e) { + //let's keep it safe + PydevPlugin.log(e); + } + } } Index: ProjectModulesManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/ProjectModulesManager.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ProjectModulesManager.java 31 Jul 2008 01:47:36 -0000 1.17 --- ProjectModulesManager.java 13 Aug 2008 21:12:15 -0000 1.18 *************** *** 69,72 **** --- 69,74 ---- private transient DeltaSaver<ModulesKey> deltaSaver; + public ProjectModulesManager() {} + /** * @see org.python.pydev.core.IProjectModulesManager#setProject(org.eclipse.core.resources.IProject, boolean) *************** *** 363,373 **** /** - * @see org.python.pydev.core.IProjectModulesManager#changePythonPath(java.lang.String, org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IProgressMonitor) - */ - public void changePythonPath(String pythonpath, IProject project, IProgressMonitor monitor, String defaultSelectedInterpreter) { - super.changePythonPath(pythonpath, project, monitor, defaultSelectedInterpreter); - } - - /** * @see org.python.pydev.core.IProjectModulesManager#getSize(boolean) */ --- 365,368 ---- Index: ModulesManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/ModulesManager.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ModulesManager.java 14 Jun 2008 22:14:55 -0000 1.23 --- ModulesManager.java 13 Aug 2008 21:12:15 -0000 1.24 *************** *** 148,151 **** --- 148,158 ---- } + public void setPythonPathHelper(Object pathHelper) { + if (!(pathHelper instanceof PythonPathHelper)) { + throw new IllegalArgumentException(); + } + pythonPathHelper = (PythonPathHelper)pathHelper; + } + /** * The version for deserialization *************** *** 222,227 **** */ public void changePythonPath(String pythonpath, final IProject project, IProgressMonitor monitor, String defaultSelectedInterpreter) { ! List<String> pythonpathList = pythonPathHelper.setPythonPath(pythonpath); ! ModulesFoundStructure modulesFound = pythonPathHelper.getModulesFoundStructure(pythonpathList, monitor); //now, on to actually filling the module keys --- 229,234 ---- */ public void changePythonPath(String pythonpath, final IProject project, IProgressMonitor monitor, String defaultSelectedInterpreter) { ! pythonPathHelper.setPythonPath(pythonpath); ! ModulesFoundStructure modulesFound = pythonPathHelper.getModulesFoundStructure(monitor); //now, on to actually filling the module keys |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:12:06
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/nature In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8061/src/org/python/pydev/plugin/nature Modified Files: PythonNatureStore.java Added Files: IPythonPathHelper.java Log Message: Synching from mercurial: - Pydev debugger watch working in eclipse 3.4 - Pydev debugger breakpoint properties accept new lines and tabs - Incremental find backspace works correctly - Interactive console Fixed problem when more attempts to connect were needed - Launch icons: Transparent background (thanks to Radim Kubacki) - Creating workbench test for debugger --- NEW FILE: IPythonPathHelper.java --- package org.python.pydev.plugin.nature; import org.eclipse.core.runtime.IProgressMonitor; import org.python.pydev.editor.codecompletion.revisited.ModulesFoundStructure; import java.io.Serializable; import java.util.List; /** * @author ra...@ku... (Radim Kubacki) */ public interface IPythonPathHelper extends Serializable { /** * * @param fullPath this is the full path of the module. Only for directories or py,pyd,dll,pyo files. * @return a String with the module that the file or folder should represent. E.g.: compiler.ast */ public String resolveModule(String fullPath); /** * Sets the python path to operate on. * * @param string with paths separated by {@code |} */ public void setPythonPath(String string); /** * Getter for Python path. * @return list of Python path entries. */ public List<String> getPythonpath(); /** * This method should traverse the pythonpath passed and return a structure with the info that could be collected * about the files that are related to python modules. */ public ModulesFoundStructure getModulesFoundStructure(IProgressMonitor monitor); } Index: PythonNatureStore.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/nature/PythonNatureStore.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PythonNatureStore.java 31 Jul 2008 01:47:36 -0000 1.21 --- PythonNatureStore.java 13 Aug 2008 21:12:15 -0000 1.22 *************** *** 97,100 **** --- 97,104 ---- private volatile boolean inInit; + public String getLastLoadedContents(){ + return lastLoadedContents; + } + private void traceFunc(String func, Object ... args){ if(TRACE_PYTHON_NATURE_STORE){ *************** *** 742,756 **** File file = getRawXmlFileLocation(); ! if(file == null){ ! //that's ok... in tests ! return Status.OK_STATUS; ! } try { //Ok, we may receive multiple requests at once (e.g.: when updating the version and the pythonpath together), but //as the file is pretty small, there should be no problems in writing it directly (if that proves a problem later on, we //could have a *very* simple mechanism for saving it after some millis) - String str = new String(serializeDocument(document)); lastLoadedContents = str; if(TRACE_PYTHON_NATURE_STORE){ System.out.println("Writing to file: "+file+" "+str); --- 746,765 ---- File file = getRawXmlFileLocation(); ! try { //Ok, we may receive multiple requests at once (e.g.: when updating the version and the pythonpath together), but //as the file is pretty small, there should be no problems in writing it directly (if that proves a problem later on, we //could have a *very* simple mechanism for saving it after some millis) String str = new String(serializeDocument(document)); lastLoadedContents = str; + + if(file == null){ + if (!ProjectModulesManager.IN_TESTS) { + //if we're not in tests, let's log this, as it'd be an error. + PydevPlugin.log("Error: xml file should only be null in tests (when no workspace is available)"); + } + return Status.OK_STATUS; + } + if(TRACE_PYTHON_NATURE_STORE){ System.out.println("Writing to file: "+file+" "+str); |
From: Fabio Z. <fa...@us...> - 2008-08-13 21:11:46
|
Update of /cvsroot/pydev/org.python.pydev.debug/tests/org/python/pydev/debug/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8009/tests/org/python/pydev/debug/ui Log Message: Directory /cvsroot/pydev/org.python.pydev.debug/tests/org/python/pydev/debug/ui added to the repository |
From: Fabio Z. <fa...@us...> - 2008-08-06 16:23:11
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26629 Modified Files: Changes.txt Log Message: - Refactoring the source locator - Linxing working with compare editor both ways Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/Changes.txt,v retrieving revision 1.412 retrieving revision 1.413 diff -C2 -d -r1.412 -r1.413 *** Changes.txt 1 Aug 2008 01:42:22 -0000 1.412 --- Changes.txt 6 Aug 2008 16:23:19 -0000 1.413 *************** *** 1,2 **** --- 1,11 ---- + after 1.3.19 + + Pydev + <ul> + <li><strong>Pydev Package Explorer</strong>: Editor-link does not remove focus from current editor if it's already a match (bug when compare editor was opened)</li> + <li><strong>Pydev debugger</strong>: showing set and frozenset contents</li> + </ul> + + after 1.3.18 |
From: Fabio Z. <fa...@us...> - 2008-08-06 16:23:11
|
Update of /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26629/src_completions/org/python/pydev/editor/codecompletion/revisited Modified Files: SourceModuleProposal.java Log Message: - Refactoring the source locator - Linxing working with compare editor both ways Index: SourceModuleProposal.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_completions/org/python/pydev/editor/codecompletion/revisited/SourceModuleProposal.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SourceModuleProposal.java 25 Mar 2007 16:09:03 -0000 1.1 --- SourceModuleProposal.java 6 Aug 2008 16:23:19 -0000 1.2 *************** *** 21,25 **** import org.python.pydev.editor.codecompletion.revisited.modules.SourceModule; import org.python.pydev.editor.codecompletion.revisited.visitors.Definition; ! import org.python.pydev.plugin.PydevPlugin; /** --- 21,25 ---- import org.python.pydev.editor.codecompletion.revisited.modules.SourceModule; import org.python.pydev.editor.codecompletion.revisited.visitors.Definition; ! import org.python.pydev.editorinput.PyOpenEditor; /** *************** *** 69,73 **** }else{//another IPath path = new Path(REF.getFileAbsolutePath(module.getFile())); ! IEditorPart part = PydevPlugin.doOpenEditor(path, true); if(part instanceof PyEdit){ --- 69,73 ---- }else{//another IPath path = new Path(REF.getFileAbsolutePath(module.getFile())); ! IEditorPart part = PyOpenEditor.doOpenEditor(path); if(part instanceof PyEdit){ |
From: Fabio Z. <fa...@us...> - 2008-08-06 16:23:11
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26629/src/org/python/pydev/plugin Modified Files: PydevPlugin.java Log Message: - Refactoring the source locator - Linxing working with compare editor both ways Index: PydevPlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/PydevPlugin.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** PydevPlugin.java 31 Jul 2008 01:47:36 -0000 1.89 --- PydevPlugin.java 6 Aug 2008 16:23:19 -0000 1.90 *************** *** 13,18 **** import java.util.ResourceBundle; - import org.eclipse.core.resources.IContainer; - import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectNature; --- 13,16 ---- *************** *** 22,26 **** import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; - import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; --- 20,23 ---- *************** *** 28,32 **** import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Status; - import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.ImageDescriptor; --- 25,28 ---- *************** *** 34,54 **** import org.eclipse.jface.text.templates.ContextTypeRegistry; import org.eclipse.jface.text.templates.persistence.TemplateStore; - import org.eclipse.jface.window.Window; - import org.eclipse.swt.widgets.Display; - import org.eclipse.swt.widgets.FileDialog; - import org.eclipse.swt.widgets.Shell; - import org.eclipse.ui.IEditorInput; - import org.eclipse.ui.IEditorPart; - import org.eclipse.ui.IWorkbench; - import org.eclipse.ui.IWorkbenchPage; - import org.eclipse.ui.IWorkbenchWindow; - import org.eclipse.ui.PartInitException; - import org.eclipse.ui.PlatformUI; - import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry; import org.eclipse.ui.editors.text.templates.ContributionTemplateStore; - import org.eclipse.ui.ide.IDE; - import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.texteditor.ChainedPreferenceStore; --- 30,36 ---- *************** *** 63,80 **** import org.python.pydev.core.bundle.IBundleInfo; import org.python.pydev.core.bundle.ImageCache; - import org.python.pydev.core.log.Log; import org.python.pydev.dltk.console.ui.ScriptConsoleUIConstants; - import org.python.pydev.editor.PyEdit; - import org.python.pydev.editor.codecompletion.revisited.PythonPathHelper; import org.python.pydev.editor.codecompletion.shell.AbstractShell; import org.python.pydev.editor.templates.PyContextType; - import org.python.pydev.editorinput.PydevFileEditorInput; - import org.python.pydev.editorinput.PydevZipFileEditorInput; - import org.python.pydev.editorinput.PydevZipFileStorage; import org.python.pydev.plugin.nature.PythonNature; import org.python.pydev.plugin.nature.SystemPythonNature; import org.python.pydev.pyunit.ITestRunListener; import org.python.pydev.pyunit.PyUnitTestRunner; - import org.python.pydev.ui.filetypes.FileTypesPreferencesPage; import org.python.pydev.ui.interpreters.JythonInterpreterManager; import org.python.pydev.ui.interpreters.PythonInterpreterManager; --- 45,55 ---- *************** *** 375,661 **** } - public static IEditorPart doOpenEditor(IFile f, boolean activate) { - if (f == null) - return null; - - try { - FileEditorInput file = new FileEditorInput(f); - return openEditorInput(file); - - } catch (Exception e) { - log(IStatus.ERROR, "Unexpected error opening path " + f.toString(), e); - return null; - } - } - - /** - * Utility function that opens an editor on a given path within a zip file. - * - * @return part that is the editor - */ - public static IEditorPart doOpenEditor(File zipFile, String zipFilePath, boolean activate) { - if (zipFile == null || zipFilePath == null){ - return null; - } - - try { - IEditorInput file = new PydevZipFileEditorInput(new PydevZipFileStorage(zipFile, zipFilePath)); - return openEditorInput(file); - - } catch (Exception e) { - log(IStatus.ERROR, "Unexpected error opening zip file " + zipFile.getAbsolutePath()+ " - "+zipFilePath, e); - return null; - } - } - - /** - * Utility function that opens an editor on a given path. - * - * @return part that is the editor - */ - public static IEditorPart doOpenEditor(IPath path, boolean activate) { - if (path == null){ - return null; - } - - try { - IEditorInput file = createEditorInput(path); - return openEditorInput(file); - - } catch (Exception e) { - log(IStatus.ERROR, "Unexpected error opening path " + path.toString(), e); - return null; - } - } - - - private static IEditorPart openEditorInput(IEditorInput file) throws PartInitException { - final IWorkbench workbench = plugin.getWorkbench(); - if(workbench == null){ - throw new RuntimeException("workbench cannot be null"); - } - - IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); - if(activeWorkbenchWindow == null){ - throw new RuntimeException("activeWorkbenchWindow cannot be null (we have to be in a ui thread for this to work)"); - } - - IWorkbenchPage wp = activeWorkbenchWindow.getActivePage(); - - // File is inside the workspace - return IDE.openEditor(wp, file, PyEdit.EDITOR_ID); - } - - - - - - // ===================== - // ===================== ALL BELOW IS COPIED FROM org.eclipse.ui.internal.editors.text.OpenExternalFileAction - // ===================== - - public static IEditorInput createEditorInput(IPath path) { - return createEditorInput(path, true); - } - /** - * @param path - * @return - */ - private static IEditorInput createEditorInput(IPath path, boolean askIfDoesNotExist) { - IEditorInput edInput = null; - IWorkspace w = ResourcesPlugin.getWorkspace(); - - //let's start with the 'easy' way - IFile fileForLocation = w.getRoot().getFileForLocation(path); - if(fileForLocation != null){ - return new FileEditorInput(fileForLocation); - } - - - - IFile files[] = w.getRoot().findFilesForLocation(path); - if (files == null || files.length == 0 || !files[0].exists()){ - //it is probably an external file - File systemFile = path.toFile(); - if(systemFile.exists()){ - edInput = createEditorInput(systemFile); - - }else if(askIfDoesNotExist){ - //this is the last resort... First we'll try to check for a 'good' match, - //and if there's more than one we'll ask it to the user - List<IFile> likelyFiles = getLikelyFiles(path, w); - IFile iFile = selectWorkspaceFile(likelyFiles.toArray(new IFile[0])); - if(iFile != null){ - return new FileEditorInput(iFile); - } - - //ok, ask the user for any file in the computer - IEditorInput input = selectFilesystemFileForPath(path); - if(input != null){ - return input; - } - } - }else{ //file exists - edInput = doFileEditorInput(selectWorkspaceFile(files)); - } - return edInput; - } - - private static IEditorInput doFileEditorInput(IFile file) { - if(file == null){ - return null; - } - return new FileEditorInput(file); - } - /** - * This is the last resort... pointing to some filesystem file to get the editor for some path. - */ - private static IEditorInput selectFilesystemFileForPath(final IPath path) { - final List<String> l = new ArrayList<String>(); - Runnable r = new Runnable(){ - - public void run() { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - FileDialog dialog = new FileDialog(shell); - dialog.setText(path+" - select correspondent filesystem file."); - dialog.setFilterExtensions(FileTypesPreferencesPage.getWildcardValidSourceFiles()); - String string = dialog.open(); - if(string != null){ - l.add(string); - } - } - }; - if(Display.getCurrent() == null){ //not ui-thread - Display.getDefault().syncExec(r); - }else{ - r.run(); - } - if(l.size() > 0){ - String fileAbsolutePath = REF.getFileAbsolutePath(l.get(0)); - return new PydevFileEditorInput(new File(fileAbsolutePath)); - } - return null; - } - - /** - * This method will pass all the files in the workspace and check if there's a file that might - * be a match to some path (use only as an almost 'last-resort'). - */ - private static List<IFile> getLikelyFiles(IPath path, IWorkspace w) { - List<IFile> ret = new ArrayList<IFile>(); - try { - IResource[] resources = w.getRoot().members(); - getLikelyFiles(path, ret, resources); - } catch (CoreException e) { - Log.log(e); - } - return ret; - } - - /** - * Used to recursively get the likely files given the first set of containers - */ - private static void getLikelyFiles(IPath path, List<IFile> ret, IResource[] resources) throws CoreException { - String strPath = path.removeFileExtension().lastSegment().toLowerCase(); //this will return something as 'foo' - - for (IResource resource : resources) { - if(resource instanceof IFile){ - IFile f = (IFile) resource; - - if(PythonPathHelper.isValidSourceFile(f)){ - if(resource.getFullPath().removeFileExtension().lastSegment().toLowerCase().equals(strPath)){ - ret.add((IFile) resource); - } - } - }else if(resource instanceof IContainer){ - getLikelyFiles(path, ret, ((IContainer)resource).members()); - } - } - } - - private static IEditorInput createEditorInput(File file) { - IFile[] workspaceFile= getWorkspaceFiles(file); - if (workspaceFile != null && workspaceFile.length > 0){ - IFile file2 = selectWorkspaceFile(workspaceFile); - if(file2 != null){ - return new FileEditorInput(file2); - }else{ - return new FileEditorInput(workspaceFile[0]); - } - } - return new PydevFileEditorInput(file); - } - - - public static IFile getWorkspaceFile(File file) { - IFile[] files = getWorkspaceFiles(file); - return selectWorkspaceFile(files); - } - - public static IFile[] getWorkspaceFiles(File file) { - IWorkspace workspace= ResourcesPlugin.getWorkspace(); - IPath location= Path.fromOSString(file.getAbsolutePath()); - IFile[] files= workspace.getRoot().findFilesForLocation(location); - files= filterNonExistentFiles(files); - if (files == null || files.length == 0){ - return null; - } - - return files; - } - - - private static IFile[] filterNonExistentFiles(IFile[] files){ - if (files == null) - return null; - - int length= files.length; - ArrayList<IFile> existentFiles= new ArrayList<IFile>(length); - for (int i= 0; i < length; i++) { - if (files[i].exists()) - existentFiles.add(files[i]); - } - return (IFile[])existentFiles.toArray(new IFile[existentFiles.size()]); - } - - private static IFile selectWorkspaceFile(final IFile[] files) { - if(files == null || files.length == 0){ - return null; - } - if(files.length == 1){ - return files[0]; - } - final List<IFile> selected = new ArrayList<IFile>(); - - Runnable r = new Runnable(){ - public void run() { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - ElementListSelectionDialog dialog= new ElementListSelectionDialog(shell, new PyFileLabelProvider()); - dialog.setElements(files); - dialog.setTitle("Select Workspace File"); - dialog.setMessage("File may be matched to multiple files in the workspace."); - if (dialog.open() == Window.OK){ - selected.add((IFile) dialog.getFirstResult()); - } - } - - }; - if(Display.getCurrent() == null){ //not ui-thread - Display.getDefault().syncExec(r); - }else{ - r.run(); - } - if(selected.size() > 0){ - return selected.get(0); - } - return null; - } - - - // ===================== - // ===================== END COPY FROM org.eclipse.ui.internal.editors.text.OpenExternalFileAction - // ===================== - - /** * Returns this plug-in's template store. --- 350,353 ---- |
From: Fabio Z. <fa...@us...> - 2008-08-06 16:23:11
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26629/src/org/python/pydev/editor/actions Modified Files: PyOpenAction.java Log Message: - Refactoring the source locator - Linxing working with compare editor both ways Index: PyOpenAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyOpenAction.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PyOpenAction.java 16 Sep 2007 17:15:53 -0000 1.19 --- PyOpenAction.java 6 Aug 2008 16:23:19 -0000 1.20 *************** *** 22,25 **** --- 22,26 ---- import org.python.pydev.editor.model.ItemPointer; import org.python.pydev.editor.model.Location; + import org.python.pydev.editorinput.PyOpenEditor; import org.python.pydev.plugin.PydevPlugin; *************** *** 61,78 **** if(zipFilePath != null){ //currently, only open zip file ! editor = PydevPlugin.doOpenEditor((File)file, zipFilePath, true); } else if (file instanceof IFile) { IFile f = (IFile) file; ! editor = PydevPlugin.doOpenEditor(f, true); } else if (file instanceof IPath) { IPath path = (IPath) file; ! editor = PydevPlugin.doOpenEditor(path, true); } else if (file instanceof File) { String absPath = REF.getFileAbsolutePath((File) file); IPath path = Path.fromOSString(absPath); ! editor = PydevPlugin.doOpenEditor(path, true); } --- 62,79 ---- if(zipFilePath != null){ //currently, only open zip file ! editor = PyOpenEditor.doOpenEditor((File)file, zipFilePath); } else if (file instanceof IFile) { IFile f = (IFile) file; ! editor = PyOpenEditor.doOpenEditor(f); } else if (file instanceof IPath) { IPath path = (IPath) file; ! editor = PyOpenEditor.doOpenEditor(path); } else if (file instanceof File) { String absPath = REF.getFileAbsolutePath((File) file); IPath path = Path.fromOSString(absPath); ! editor = PyOpenEditor.doOpenEditor(path); } |