jEdit Community home jEdit Community Wiki > Main > BeanShell (r1.1 vs. r1.4) jEdit Community Wiki webs:
Main | Plugins | Know | TWiki | Sandbox
Main . { Whats New | Users | Groups | Changes | Index | Search | Go }
 <<O>>  Difference Topic BeanShell (r1.4 - 10 Nov 2003 - Brad Mace)
Changed:
<
<

Bean Shell is dialect of Java used for scripting. jEdit uses a tweaked version of Bean Shell as its macro language. More info about Bean Shell can be found at http://www.beanshell.org.

>
>

Bean Shell is dialect of Java used for scripting. jEdit uses a tweaked version of Bean Shell as its macro language and also for Startup Scripts. More info about Bean Shell can be found at http://www.beanshell.org.


 <<O>>  Difference Topic BeanShell (r1.3 - 15 Aug 2003 - Brad Mace)
Changed:
<
<

void duplicateLine() {

>
>

void duplicateLine() {

Changed:
<
<

if (buffer.isReadOnly()) {

>
>

if (buffer.isReadOnly()) {

Changed:
<
<

if (line == textArea.getLineCount() - 1) {

>
>

if (line == textArea.getLineCount() - 1) {

Changed:
<
<

} else

>
>

} else {

Added:
>
>

}


 <<O>>  Difference Topic BeanShell (r1.2 - 15 Aug 2003 - Brad Mace)
Changed:
<
<

%CODE{"java"}%

>
>

%CODE{"beanshell"}%


 <<O>>  Difference Topic BeanShell (r1.1 - 15 Aug 2003 - Brad Mace)
Added:
>
>

%META:TOPICINFO{author="BradMace" date="1060968840" format="1.0" version="1.1"}%

Bean Shell

Bean Shell is dialect of Java used for scripting. jEdit uses a tweaked version of Bean Shell as its macro language. More info about Bean Shell can be found at http://www.beanshell.org.

Example

The following Bean Shell code duplicates the current line in the current buffer:

void duplicateLine()
{
    /*
    * Guard for readonly files because Buffer.insert()
    * ignores the flag
    *
    */
    if (buffer.isReadOnly())
    {
        Macros.error(view, "This file is read only.");
        return;
    }
    line = textArea.getCaretLine();
    offset = textArea.getLineEndOffset(line);
    // handle last line differently
    if (line == textArea.getLineCount() - 1)
    {
        text = "\n" + textArea.getLineText(line);
        --offset;
    }
    else
    text = textArea.getLineText(line) + "\n";
    buffer.insert(offset, text);
    textArea.goToNextLine(false);
}

duplicateLine();

Topic BeanShell . { View | Diffs | r1.4 | > | r1.3 | > | r1.2 | More }
Revision r1.1 - 15 Aug 2003 - 17:34 GMT - Brad Mace
Revision r1.4 - 10 Nov 2003 - 17:36 GMT - Brad Mace
Copyright © 1999-2004 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding jEdit Community Wiki? Send feedback.