[Pydev-cvs] org.python.pydev.debug/src/org/python/pydev/debug/ui/actions WatchExpressionAction.jav
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-27 20:02:01
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20604/src/org/python/pydev/debug/ui/actions Modified Files: WatchExpressionAction.java AbstractBreakpointRulerAction.java PythonTestActionDelegate.java PythonBreakpointPropertiesRulerActionDelegate.java RunEditorAsPython.java RunEditorAsJython.java ManageBreakpointRulerActionDelegate.java EnableDisableBreakpointRulerActionDelegate.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: PythonBreakpointPropertiesRulerActionDelegate.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/PythonBreakpointPropertiesRulerActionDelegate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PythonBreakpointPropertiesRulerActionDelegate.java 17 Dec 2005 12:58:44 -0000 1.1 --- PythonBreakpointPropertiesRulerActionDelegate.java 27 Sep 2008 19:59:07 -0000 1.2 *************** *** 14,27 **** */ public class PythonBreakpointPropertiesRulerActionDelegate extends ! AbstractRulerActionDelegate { ! /* (non-Javadoc) ! * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.source.IVerticalRulerInfo) ! */ ! @Override ! protected IAction createAction(ITextEditor editor, ! IVerticalRulerInfo rulerInfo) { ! return new PythonBreakpointPropertiesRulerAction(editor, rulerInfo); ! } } --- 14,27 ---- */ public class PythonBreakpointPropertiesRulerActionDelegate extends ! AbstractRulerActionDelegate { ! /* (non-Javadoc) ! * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.source.IVerticalRulerInfo) ! */ ! @Override ! protected IAction createAction(ITextEditor editor, ! IVerticalRulerInfo rulerInfo) { ! return new PythonBreakpointPropertiesRulerAction(editor, rulerInfo); ! } } Index: PythonTestActionDelegate.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/PythonTestActionDelegate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PythonTestActionDelegate.java 21 Mar 2005 16:40:23 -0000 1.3 --- PythonTestActionDelegate.java 27 Sep 2008 19:59:07 -0000 1.4 *************** *** 28,162 **** */ public class PythonTestActionDelegate extends ActionDelegate ! implements IObjectActionDelegate { ! /** ! * @author ggheorg ! * ! * TODO To change the template for this generated type comment go to ! * Window - Preferences - Java - Code Style - Code Templates ! */ ! public static class Listener implements ITestRunListener { ! private boolean passed = true; ! public void testsStarted(int testCount) { ! System.out.println("STARTING TEST RUN: " + String.valueOf(testCount) + " tests"); ! } ! public void testsFinished() { ! String message = passed ? "PASS": "FAIL"; ! System.out.println("END TEST RUN"); ! String messageLong = "TEST RUN STATUS: " + message; ! System.out.println(messageLong); ! //MessageDialog.openInformation(null, "Test Results", messageLong); ! } ! public void testStarted(String klass, String method) { ! } ! public void testFailed(String klass, String method, String trace) { ! System.out.println("TEST FAILED!"); ! System.out.println(klass + " " + method); ! System.out.println(trace); ! passed = false; ! } ! } ! private IFile selectedFile; ! private IWorkbenchPart part; ! public void run(IAction action) { ! if (part != null && selectedFile != null) { ! try { ! // get the location of the workspace root ! /* ! IWorkspace workspace = ResourcesPlugin.getWorkspace(); ! IPath wsRootPath = workspace.getRoot().getLocation(); ! String wsRootDir = wsRootPath.toString(); ! */ ! // get the full physical path for the selected file ! IPath fullPath = selectedFile.getLocation(); ! int segmentCount = fullPath.segmentCount(); ! // get the test module name and path so that we can import it in Python ! IPath noextPath = fullPath.removeFileExtension(); ! String moduleName = noextPath.lastSegment(); ! IPath modulePath = fullPath.uptoSegment(segmentCount-1); ! String moduleDir = modulePath.toString(); ! // get the project the file belongs to ! IProject selectedProject = selectedFile.getProject(); ! ITestRunListener listener = new Listener(); ! PydevPlugin.getDefault().addTestListener(listener); ! try { ! PydevPlugin.getDefault().runTests(moduleDir, moduleName, selectedProject); ! } catch (CoreException e1) { ! // TODO Auto-generated catch block ! e1.printStackTrace(); ! } ! PydevPlugin.getDefault().removeTestListener(listener); ! ! /* Process p = Runtime.getRuntime().exec(new String[]{"python"}); ! ! //we have the process... ! OutputStreamWriter writer = new OutputStreamWriter(p.getOutputStream()); ! int bufsize = 64; // small bufsize so that we can see the progress ! BufferedReader in = new BufferedReader(new InputStreamReader(p ! .getInputStream()), bufsize); ! BufferedReader eIn = new BufferedReader(new InputStreamReader( ! p.getErrorStream()), bufsize); ! writer.write("import sys, os, unittest\n"); ! writer.write("os.chdir('" + wsRootDir + moduleDir + "')\n"); ! String arg = "sys.path.append('" + wsRootDir + moduleDir + "')\n"; ! writer.write(arg); ! arg = "unittest.TestProgram('" + moduleName + "', argv=['" + moduleName + "', '--verbose'])\n"; ! //arg = "unittest.TestProgram('" + moduleName + "')\n"; ! writer.write(arg); ! writer.flush(); ! writer.close(); ! ! String str; ! ArrayList testResults = new ArrayList(); ! while ((str = eIn.readLine()) != null) { ! //System.out.println("STDERR: " + str); ! //System.out.println(str); ! testResults.add(str); ! } ! eIn.close(); ! while ((str = in.readLine()) != null) { ! //System.out.println("STDOUT: " + str); ! System.out.println(str); ! } ! in.close(); ! p.waitFor(); ! System.out.println("testResults list:"); ! Iterator it = testResults.iterator(); ! while (it.hasNext()) { ! String line = it.next().toString(); ! ! System.out.println(line); ! } ! */ } catch (IOException e) { ! e.printStackTrace(); ! } ! } ! } ! ! public void selectionChanged(IAction action, ISelection selection) { ! selectedFile = null; ! if (selection instanceof IStructuredSelection) { ! if (((IStructuredSelection) selection).size() == 1) { ! Object selectedResource = ((IStructuredSelection) selection).getFirstElement(); ! if (selectedResource instanceof IFile) ! selectedFile = (IFile) selectedResource; ! } ! } ! } ! public void setActivePart(IAction action, IWorkbenchPart targetPart) { ! this.part = targetPart; ! } } --- 28,162 ---- */ public class PythonTestActionDelegate extends ActionDelegate ! implements IObjectActionDelegate { ! /** ! * @author ggheorg ! * ! * TODO To change the template for this generated type comment go to ! * Window - Preferences - Java - Code Style - Code Templates ! */ ! public static class Listener implements ITestRunListener { ! private boolean passed = true; ! public void testsStarted(int testCount) { ! System.out.println("STARTING TEST RUN: " + String.valueOf(testCount) + " tests"); ! } ! public void testsFinished() { ! String message = passed ? "PASS": "FAIL"; ! System.out.println("END TEST RUN"); ! String messageLong = "TEST RUN STATUS: " + message; ! System.out.println(messageLong); ! //MessageDialog.openInformation(null, "Test Results", messageLong); ! } ! public void testStarted(String klass, String method) { ! } ! public void testFailed(String klass, String method, String trace) { ! System.out.println("TEST FAILED!"); ! System.out.println(klass + " " + method); ! System.out.println(trace); ! passed = false; ! } ! } ! private IFile selectedFile; ! private IWorkbenchPart part; ! public void run(IAction action) { ! if (part != null && selectedFile != null) { ! try { ! // get the location of the workspace root ! /* ! IWorkspace workspace = ResourcesPlugin.getWorkspace(); ! IPath wsRootPath = workspace.getRoot().getLocation(); ! String wsRootDir = wsRootPath.toString(); ! */ ! // get the full physical path for the selected file ! IPath fullPath = selectedFile.getLocation(); ! int segmentCount = fullPath.segmentCount(); ! // get the test module name and path so that we can import it in Python ! IPath noextPath = fullPath.removeFileExtension(); ! String moduleName = noextPath.lastSegment(); ! IPath modulePath = fullPath.uptoSegment(segmentCount-1); ! String moduleDir = modulePath.toString(); ! // get the project the file belongs to ! IProject selectedProject = selectedFile.getProject(); ! ITestRunListener listener = new Listener(); ! PydevPlugin.getDefault().addTestListener(listener); ! try { ! PydevPlugin.getDefault().runTests(moduleDir, moduleName, selectedProject); ! } catch (CoreException e1) { ! // TODO Auto-generated catch block ! e1.printStackTrace(); ! } ! PydevPlugin.getDefault().removeTestListener(listener); ! ! /* Process p = Runtime.getRuntime().exec(new String[]{"python"}); ! ! //we have the process... ! OutputStreamWriter writer = new OutputStreamWriter(p.getOutputStream()); ! int bufsize = 64; // small bufsize so that we can see the progress ! BufferedReader in = new BufferedReader(new InputStreamReader(p ! .getInputStream()), bufsize); ! BufferedReader eIn = new BufferedReader(new InputStreamReader( ! p.getErrorStream()), bufsize); ! writer.write("import sys, os, unittest\n"); ! writer.write("os.chdir('" + wsRootDir + moduleDir + "')\n"); ! String arg = "sys.path.append('" + wsRootDir + moduleDir + "')\n"; ! writer.write(arg); ! arg = "unittest.TestProgram('" + moduleName + "', argv=['" + moduleName + "', '--verbose'])\n"; ! //arg = "unittest.TestProgram('" + moduleName + "')\n"; ! writer.write(arg); ! writer.flush(); ! writer.close(); ! ! String str; ! ArrayList testResults = new ArrayList(); ! while ((str = eIn.readLine()) != null) { ! //System.out.println("STDERR: " + str); ! //System.out.println(str); ! testResults.add(str); ! } ! eIn.close(); ! while ((str = in.readLine()) != null) { ! //System.out.println("STDOUT: " + str); ! System.out.println(str); ! } ! in.close(); ! p.waitFor(); ! System.out.println("testResults list:"); ! Iterator it = testResults.iterator(); ! while (it.hasNext()) { ! String line = it.next().toString(); ! ! System.out.println(line); ! } ! */ } catch (IOException e) { ! e.printStackTrace(); ! } ! } ! } ! ! public void selectionChanged(IAction action, ISelection selection) { ! selectedFile = null; ! if (selection instanceof IStructuredSelection) { ! if (((IStructuredSelection) selection).size() == 1) { ! Object selectedResource = ((IStructuredSelection) selection).getFirstElement(); ! if (selectedResource instanceof IFile) ! selectedFile = (IFile) selectedResource; ! } ! } ! } ! public void setActivePart(IAction action, IWorkbenchPart targetPart) { ! this.part = targetPart; ! } } Index: EnableDisableBreakpointRulerActionDelegate.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/EnableDisableBreakpointRulerActionDelegate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EnableDisableBreakpointRulerActionDelegate.java 17 Dec 2005 12:58:44 -0000 1.1 --- EnableDisableBreakpointRulerActionDelegate.java 27 Sep 2008 19:59:07 -0000 1.2 *************** *** 7,16 **** public class EnableDisableBreakpointRulerActionDelegate extends ! AbstractRulerActionDelegate { ! @Override ! protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { ! return new EnableDisableBreakpointRulerAction(editor, rulerInfo); ! } } --- 7,16 ---- public class EnableDisableBreakpointRulerActionDelegate extends ! AbstractRulerActionDelegate { ! @Override ! protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { ! return new EnableDisableBreakpointRulerAction(editor, rulerInfo); ! } } Index: AbstractBreakpointRulerAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/AbstractBreakpointRulerAction.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractBreakpointRulerAction.java 16 Sep 2007 17:15:20 -0000 1.8 --- AbstractBreakpointRulerAction.java 27 Sep 2008 19:59:07 -0000 1.9 *************** *** 37,86 **** public abstract class AbstractBreakpointRulerAction extends Action implements IUpdate { ! protected IVerticalRulerInfo fInfo; ! protected ITextEditor fTextEditor; ! private IBreakpoint fBreakpoint; ! protected IBreakpoint getBreakpoint() { ! return fBreakpoint; ! } ! protected void setBreakpoint(IBreakpoint breakpoint) { ! fBreakpoint = breakpoint; ! } ! protected ITextEditor getTextEditor() { ! return fTextEditor; ! } ! protected void setTextEditor(ITextEditor textEditor) { ! fTextEditor = textEditor; ! } ! protected IVerticalRulerInfo getInfo() { ! return fInfo; ! } ! protected void setInfo(IVerticalRulerInfo info) { ! fInfo = info; ! } ! protected IBreakpoint determineBreakpoint() { ! IBreakpoint[] breakpoints= DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PyDebugModelPresentation.PY_DEBUG_MODEL_ID); ! for (int i= 0; i < breakpoints.length; i++) { ! IBreakpoint breakpoint= breakpoints[i]; ! if (breakpoint instanceof PyBreakpoint ) { ! PyBreakpoint pyBreakpoint= (PyBreakpoint)breakpoint; ! try { ! if (breakpointAtRulerLine(pyBreakpoint, getPydevFileEditorInput())) { ! return pyBreakpoint; ! } ! } catch (CoreException ce) { ! PydevDebugPlugin.log(IStatus.ERROR,ce.getLocalizedMessage(),ce); ! continue; ! } ! } ! } ! return null; ! } /** --- 37,86 ---- public abstract class AbstractBreakpointRulerAction extends Action implements IUpdate { ! protected IVerticalRulerInfo fInfo; ! protected ITextEditor fTextEditor; ! private IBreakpoint fBreakpoint; ! protected IBreakpoint getBreakpoint() { ! return fBreakpoint; ! } ! protected void setBreakpoint(IBreakpoint breakpoint) { ! fBreakpoint = breakpoint; ! } ! protected ITextEditor getTextEditor() { ! return fTextEditor; ! } ! protected void setTextEditor(ITextEditor textEditor) { ! fTextEditor = textEditor; ! } ! protected IVerticalRulerInfo getInfo() { ! return fInfo; ! } ! protected void setInfo(IVerticalRulerInfo info) { ! fInfo = info; ! } ! protected IBreakpoint determineBreakpoint() { ! IBreakpoint[] breakpoints= DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PyDebugModelPresentation.PY_DEBUG_MODEL_ID); ! for (int i= 0; i < breakpoints.length; i++) { ! IBreakpoint breakpoint= breakpoints[i]; ! if (breakpoint instanceof PyBreakpoint ) { ! PyBreakpoint pyBreakpoint= (PyBreakpoint)breakpoint; ! try { ! if (breakpointAtRulerLine(pyBreakpoint, getPydevFileEditorInput())) { ! return pyBreakpoint; ! } ! } catch (CoreException ce) { ! PydevDebugPlugin.log(IStatus.ERROR,ce.getLocalizedMessage(),ce); ! continue; ! } ! } ! } ! return null; ! } /** *************** *** 92,102 **** } ! protected boolean breakpointAtRulerLine(PyBreakpoint pyBreakpoint, PydevFileEditorInput pydevFileEditorInput) throws CoreException { IDocument doc = getDocument(); ! IMarker marker = pyBreakpoint.getMarker(); Position position= getMarkerPosition(doc, marker); ! if (position != null) { ! try { ! int markerLineNumber= doc.getLineOfOffset(position.getOffset()); if(getResourceForDebugMarkers() instanceof IFile){ //workspace file --- 92,102 ---- } ! protected boolean breakpointAtRulerLine(PyBreakpoint pyBreakpoint, PydevFileEditorInput pydevFileEditorInput) throws CoreException { IDocument doc = getDocument(); ! IMarker marker = pyBreakpoint.getMarker(); Position position= getMarkerPosition(doc, marker); ! if (position != null) { ! try { ! int markerLineNumber= doc.getLineOfOffset(position.getOffset()); if(getResourceForDebugMarkers() instanceof IFile){ //workspace file *************** *** 111,131 **** return true; } ! } catch (BadLocationException x) { ! } ! } ! ! return false; ! } ! ! protected IResource getResourceForDebugMarkers() { ! return getResourceForDebugMarkers(fTextEditor); ! } ! public boolean isExternalFileEditor() { ! return isExternalFileEditor(fTextEditor); ! } ! public PydevFileEditorInput getPydevFileEditorInput() { ! return getPydevFileEditorInput(fTextEditor); } --- 111,131 ---- return true; } ! } catch (BadLocationException x) { ! } ! } ! ! return false; ! } ! ! protected IResource getResourceForDebugMarkers() { ! return getResourceForDebugMarkers(fTextEditor); ! } ! public boolean isExternalFileEditor() { ! return isExternalFileEditor(fTextEditor); ! } ! public PydevFileEditorInput getPydevFileEditorInput() { ! return getPydevFileEditorInput(fTextEditor); } *************** *** 136,169 **** // utilities ------------------------------------------------------------------------------------------------------- ! ! /** ! * @return whether we're in an external editor or not. ! */ ! public static boolean isExternalFileEditor(ITextEditor editor) { ! PydevFileEditorInput pydevFileEditorInput = getPydevFileEditorInput(editor); ! if(pydevFileEditorInput != null){ ! return true; ! } ! return false; ! } ! ! ! ! /** ! * @return the PydevFileEditorInput if we're dealing with an external file (or null otherwise) ! */ ! public static PydevFileEditorInput getPydevFileEditorInput(ITextEditor editor) { ! IEditorInput input = editor.getEditorInput(); ! PydevFileEditorInput pydevFileEditorInput = null; ! //only return not null if it's an external file (FileEditorInput marks a workspace file) if(input instanceof FileEditorInput){ return null; } ! if (input instanceof PydevFileEditorInput) { ! pydevFileEditorInput = (PydevFileEditorInput) input; ! } else { if(input instanceof IPathEditorInput && !(input instanceof FileEditorInput)){ IPathEditorInput pathEditorInput = (IPathEditorInput) input; --- 136,169 ---- // utilities ------------------------------------------------------------------------------------------------------- ! ! /** ! * @return whether we're in an external editor or not. ! */ ! public static boolean isExternalFileEditor(ITextEditor editor) { ! PydevFileEditorInput pydevFileEditorInput = getPydevFileEditorInput(editor); ! if(pydevFileEditorInput != null){ ! return true; ! } ! return false; ! } ! ! ! ! /** ! * @return the PydevFileEditorInput if we're dealing with an external file (or null otherwise) ! */ ! public static PydevFileEditorInput getPydevFileEditorInput(ITextEditor editor) { ! IEditorInput input = editor.getEditorInput(); ! PydevFileEditorInput pydevFileEditorInput = null; ! //only return not null if it's an external file (FileEditorInput marks a workspace file) if(input instanceof FileEditorInput){ return null; } ! if (input instanceof PydevFileEditorInput) { ! pydevFileEditorInput = (PydevFileEditorInput) input; ! } else { if(input instanceof IPathEditorInput && !(input instanceof FileEditorInput)){ IPathEditorInput pathEditorInput = (IPathEditorInput) input; *************** *** 174,180 **** } } ! } ! return pydevFileEditorInput; ! } --- 174,180 ---- } } ! } ! return pydevFileEditorInput; ! } *************** *** 184,202 **** */ protected static boolean isInSameExternalEditor(IMarker marker, PydevFileEditorInput pydevFileEditorInput) throws CoreException { ! if(marker == null || pydevFileEditorInput == null){ ! return false; ! } ! String attribute = (String) marker.getAttribute(PyBreakpoint.PY_BREAK_EXTERNAL_PATH_ID); if(attribute != null){ File file = pydevFileEditorInput.getFile(); if(file == null){ ! return false; } ! if(attribute.equals(REF.getFileAbsolutePath(file))){ return true; } } ! return false; } --- 184,202 ---- */ protected static boolean isInSameExternalEditor(IMarker marker, PydevFileEditorInput pydevFileEditorInput) throws CoreException { ! if(marker == null || pydevFileEditorInput == null){ ! return false; ! } ! String attribute = (String) marker.getAttribute(PyBreakpoint.PY_BREAK_EXTERNAL_PATH_ID); if(attribute != null){ File file = pydevFileEditorInput.getFile(); if(file == null){ ! return false; } ! if(attribute.equals(REF.getFileAbsolutePath(file))){ return true; } } ! return false; } *************** *** 234,254 **** ! /** ! * @return the resource for which to create the marker or <code>null</code> * * If the editor maps to a workspace file, it will return that file. Otherwise, it will return the * workspace root (so, markers from external files will be created in the workspace root). ! */ ! public static IResource getResourceForDebugMarkers(ITextEditor textEditor) { ! IEditorInput input= textEditor.getEditorInput(); ! IResource resource= (IResource) input.getAdapter(IFile.class); ! if (resource == null) { ! resource= (IResource) input.getAdapter(IResource.class); ! } if(resource == null){ resource = ResourcesPlugin.getWorkspace().getRoot(); } ! return resource; ! } --- 234,254 ---- ! /** ! * @return the resource for which to create the marker or <code>null</code> * * If the editor maps to a workspace file, it will return that file. Otherwise, it will return the * workspace root (so, markers from external files will be created in the workspace root). ! */ ! public static IResource getResourceForDebugMarkers(ITextEditor textEditor) { ! IEditorInput input= textEditor.getEditorInput(); ! IResource resource= (IResource) input.getAdapter(IFile.class); ! if (resource == null) { ! resource= (IResource) input.getAdapter(IResource.class); ! } if(resource == null){ resource = ResourcesPlugin.getWorkspace().getRoot(); } ! return resource; ! } *************** *** 309,315 **** IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); for (IMarker marker : markers) { ! if(marker == null){ ! continue; ! } IBreakpoint breakpoint = breakpointManager.getBreakpoint(marker); if (breakpoint != null && breakpointManager.isRegistered(breakpoint)) { --- 309,315 ---- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); for (IMarker marker : markers) { ! if(marker == null){ ! continue; ! } IBreakpoint breakpoint = breakpointManager.getBreakpoint(marker); if (breakpoint != null && breakpointManager.isRegistered(breakpoint)) { Index: WatchExpressionAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/WatchExpressionAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WatchExpressionAction.java 5 Oct 2005 19:47:11 -0000 1.1 --- WatchExpressionAction.java 27 Sep 2008 19:59:07 -0000 1.2 *************** *** 19,69 **** public class WatchExpressionAction implements IEditorActionDelegate { ! private ITextSelection fSelection; ! public void setActiveEditor(IAction action, IEditorPart targetEditor) { ! } ! public void run(IAction action) { ! if (fSelection == null) { ! return; ! } ! String text = fSelection.getText(); ! createExpression(text); ! } ! public void selectionChanged(IAction action, ISelection selection) { ! fSelection = null; if (selection instanceof ITextSelection ) { fSelection = (ITextSelection) selection; } ! } ! ! private void showExpressionsView() { ! IWorkbenchPage page = PydevDebugPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); ! IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW); ! if (part == null) { ! try { ! page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW); ! } catch (PartInitException e) { ! } ! } else { ! page.bringToTop(part); ! } ! } ! private void createExpression(String variable) { ! IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(variable); ! ! DebugPlugin.getDefault().getExpressionManager().addExpression(expression); ! IAdaptable object = DebugUITools.getDebugContext(); ! IDebugElement context = null; ! if (object instanceof IDebugElement) { ! context = (IDebugElement) object; ! } else if (object instanceof ILaunch) { ! context = ((ILaunch) object).getDebugTarget(); ! } ! expression.setExpressionContext(context); ! showExpressionsView(); ! } } --- 19,69 ---- public class WatchExpressionAction implements IEditorActionDelegate { ! private ITextSelection fSelection; ! public void setActiveEditor(IAction action, IEditorPart targetEditor) { ! } ! public void run(IAction action) { ! if (fSelection == null) { ! return; ! } ! String text = fSelection.getText(); ! createExpression(text); ! } ! public void selectionChanged(IAction action, ISelection selection) { ! fSelection = null; if (selection instanceof ITextSelection ) { fSelection = (ITextSelection) selection; } ! } ! ! private void showExpressionsView() { ! IWorkbenchPage page = PydevDebugPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); ! IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW); ! if (part == null) { ! try { ! page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW); ! } catch (PartInitException e) { ! } ! } else { ! page.bringToTop(part); ! } ! } ! private void createExpression(String variable) { ! IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(variable); ! ! DebugPlugin.getDefault().getExpressionManager().addExpression(expression); ! IAdaptable object = DebugUITools.getDebugContext(); ! IDebugElement context = null; ! if (object instanceof IDebugElement) { ! context = (IDebugElement) object; ! } else if (object instanceof ILaunch) { ! context = ((ILaunch) object).getDebugTarget(); ! } ! expression.setExpressionContext(context); ! showExpressionsView(); ! } } Index: RunEditorAsPython.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/RunEditorAsPython.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunEditorAsPython.java 3 Feb 2006 11:52:02 -0000 1.1 --- RunEditorAsPython.java 27 Sep 2008 19:59:07 -0000 1.2 *************** *** 7,14 **** public class RunEditorAsPython extends PyAction{ ! public void run(IAction action) { ! LaunchShortcut shortcut = new LaunchShortcut(); ! shortcut.launch(getPyEdit(), "run"); ! } } --- 7,14 ---- public class RunEditorAsPython extends PyAction{ ! public void run(IAction action) { ! LaunchShortcut shortcut = new LaunchShortcut(); ! shortcut.launch(getPyEdit(), "run"); ! } } Index: ManageBreakpointRulerActionDelegate.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/ManageBreakpointRulerActionDelegate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ManageBreakpointRulerActionDelegate.java 7 May 2004 02:03:05 -0000 1.1 --- ManageBreakpointRulerActionDelegate.java 27 Sep 2008 19:59:07 -0000 1.2 *************** *** 15,22 **** */ public class ManageBreakpointRulerActionDelegate ! extends AbstractRulerActionDelegate { ! protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { ! return new BreakpointRulerAction(editor, rulerInfo); ! } } --- 15,22 ---- */ public class ManageBreakpointRulerActionDelegate ! extends AbstractRulerActionDelegate { ! protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { ! return new BreakpointRulerAction(editor, rulerInfo); ! } } Index: RunEditorAsJython.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions/RunEditorAsJython.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunEditorAsJython.java 3 Feb 2006 11:52:02 -0000 1.1 --- RunEditorAsJython.java 27 Sep 2008 19:59:07 -0000 1.2 *************** *** 7,14 **** public class RunEditorAsJython extends PyAction{ ! public void run(IAction action) { ! JythonLaunchShortcut shortcut = new JythonLaunchShortcut(); ! shortcut.launch(getPyEdit(), "run"); ! } } --- 7,14 ---- public class RunEditorAsJython extends PyAction{ ! public void run(IAction action) { ! JythonLaunchShortcut shortcut = new JythonLaunchShortcut(); ! shortcut.launch(getPyEdit(), "run"); ! } } |