Re: [Pydev-code] Re: Jython scripting
Brought to you by:
fabioz
From: Fabio Z. <fa...@gm...> - 2006-04-25 23:19:41
|
Actually there is 1 method that does it (but it's the single one, so, you may want to use one of IDocument if it's not what you want): public void addLine(String contents, int afterLine) Cheers, Fabio On 4/25/06, Don Taylor <nos...@gm...> wrote: > > Fabio Zadrozny wrote: > > Hi Don, > > > > I'm forwarding it to the pydev-code list, as I think it might be useful > > to others... > > > > A general question about Jython scripting. > > > > Before 1.0.4 was released I had imagined that I might be able to > write a > > script that could receive a selection from the editor, reformat it > and > > return it to the editor to be pasted over the original selection. = I > > was > > thinking of doing some comment reformatting on demand. > > > > As far as I can tell the current scripting API does not support thi= s > > sort of thing. Is that right? > > > > > > Actually, you can do it, but you have to know a bit from the Eclipse AP= I > > too... A 'simple' way of doing it would be requesting the editor > > document (something like editor.getDocument()) and play with it. It is > > an IDocument, and you can get whatever you want from it and change it a= s > > much as you like. > > > > Also, maybe taking a look at PySelection ( > > > http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev.core/src/org= /python/pydev/core/docutils/PySelection.java?rev=3D1.7&view=3Dmarkup > > < > http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev.core/src/org= /python/pydev/core/docutils/PySelection.java?rev=3D1.7&view=3Dmarkup > >) > > might be worth it... It provides a nicer interface for getting info fro= m > > a document/selection. > > > > You can instantiate it in jython with: > > > > from org.python.pydev.core.docutils import PySelection > > sel =3D PySelection(editor) > > > Hi Fabio: > > As far as I can see there are no methods in PySelection that allow you > to put text back into the editor, is this correct? > > I know that I can do what I want with an IDocument using the replace > method, I just wondered if I am missing something in the PySelection. > > Thanks, > > Don. > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |