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 <nospamformeSVP@gmail.com> 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 this
>     sort of thing.  Is that right?
>
>
> Actually, you can do it, but you have to know a bit from the Eclipse API
> 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 as
> 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=1.7&view=markup
> < http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils/PySelection.java?rev=1.7&view=markup>)
> might be worth it... It provides a nicer interface for getting info from
> a document/selection.
>
> You can instantiate it in jython with:
>
> from org.python.pydev.core.docutils import PySelection
> sel = 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 Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
pydev-code mailing list
pydev-code@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-code