[Pydev-cvs] org.python.pydev.jython/jysrc pyedit_example.py,NONE,1.1 pyedit_next_problem.py,1.2,1.3
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2006-03-21 23:20:11
|
Update of /cvsroot/pydev/org.python.pydev.jython/jysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8013/jysrc Modified Files: pyedit_next_problem.py Added Files: pyedit_example.py Log Message: Index: pyedit_next_problem.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.jython/jysrc/pyedit_next_problem.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pyedit_next_problem.py 21 Mar 2006 20:01:42 -0000 1.2 --- pyedit_next_problem.py 21 Mar 2006 23:20:05 -0000 1.3 *************** *** 16,24 **** NOTE2: This code is 'compiled' at runtime, and the file timestamp will be cached with the code, so, if it changes, ! it will be automatically reloaded Java-Side inner workings: ! - Refer to: org.python.pydev.editor.scripting.PyEditScripting ! - and to: org.python.pydev.jython.JythonPlugin Some IMPORTANT implementation notes: --- 16,24 ---- NOTE2: This code is 'compiled' at runtime, and the file timestamp will be cached with the code, so, if it changes, ! it will be automatically reloaded (no need to restart eclipse for that). Java-Side inner workings: ! - Refer to: org.python.pydev.editor.scripting.PyEditScripting (this is the class that binds any script that starts with pyedit to the PyEdit editor) ! - and to: org.python.pydev.jython.JythonPlugin (this is the class that makes the actual call to the jython code). Some IMPORTANT implementation notes: *************** *** 26,30 **** ''' ! #--------------------------------------------------------------- REQUIRED LOCALS #interface: String indicating which command will be executed --- 26,34 ---- ''' ! if False: ! from org.python.pydev.editor import PyEdit #@UnresolvedImport ! cmd = 'command string' ! editor = PyEdit ! #--------------------------------------------------------------- REQUIRED LOCALS #interface: String indicating which command will be executed *************** *** 38,47 **** #--------------------------------------------------------------- ACTION DEFINITION if cmd == 'onCreateActions': ! from org.eclipse.swt import SWT ! from org.eclipse.jface.action import Action ! from org.python.pydev.core.docutils import PySelection ! from java.lang import String ! from org.eclipse.core.resources import IMarker ! from org.eclipse.core.resources import IResource FIND_NEXT_PROBLEM_ACTION_ID = "org.python.pydev.core.script.pyedit_find_next_problem" --- 42,50 ---- #--------------------------------------------------------------- ACTION DEFINITION if cmd == 'onCreateActions': ! from org.eclipse.swt import SWT #@UnresolvedImport ! from org.eclipse.jface.action import Action #@UnresolvedImport ! from org.python.pydev.core.docutils import PySelection #@UnresolvedImport ! from org.eclipse.core.resources import IMarker #@UnresolvedImport ! from org.eclipse.core.resources import IResource #@UnresolvedImport FIND_NEXT_PROBLEM_ACTION_ID = "org.python.pydev.core.script.pyedit_find_next_problem" --- NEW FILE: pyedit_example.py --- if False: from org.python.pydev.editor import PyEdit #@UnresolvedImport cmd = 'command string' editor = PyEdit #--------------------------------------------------------------- REQUIRED LOCALS #interface: String indicating which command will be executed #As this script will be watching the PyEdit (that is the actual editor in Pydev), and this script #will be listening to it, this string can indicate any of the methods of org.python.pydev.editor.IPyEditListener assert cmd is not None #interface: PyEdit object: this is the actual editor that we will act upon assert editor is not None #---- Uncomment the line below to see the outputs received #print 'ok, we just received the command:', cmd, ' from the editor with the file:', editor.getIFile().getName() |