Re: Error in beanshell macro

Jim <[email protected]>
Newsgroups gmane.editors.jedit.user
Message-ID <[email protected]>
On 08/27/2017 09:54 PM, Dale Anson wrote:
> Another option:
> 
> insertSpaces(numberOfSpaces)
> {
>    caretPosition = textArea.getCaretPosition();
>    for (i = 0; i < numberOfSpaces; i++)
>    {
>      buffer.insert(caretPosition, " ");
>    }
> }
> 
> 
> I can't seem to reproduce your original problem, so I don't have any advice
> there.
> 
> Dale
> 

OK, I'll keep that in mind in case my current solution starts failing.

Regards,  Jim

> 
> On Sun, Aug 27, 2017 at 7:46 PM, Jim <[email protected]> wrote:
> 
>> On 08/27/2017 03:14 PM, Alan Ezust wrote:
>>
>>> First of all, after disabling all plugins, you might want to try
>>> restarting
>>> jEdit.
>>> It is possible that unloading certain plugins will break jEdit.
>>>
>>> If you can determine which plugin is causing the problem, that would be
>>> useful info.
>>>
>>
>> One of the many things I tried was disabling all pulgins and I have
>> restarted jEdit many times without solving the problem.
>>
>> Finally, you might want to try installing Oracle JDK if you still have the
>>> same issue.
>>>
>>
>> I have jEdit on 4 partitions, 2 on my desktop and 2 on my labtop. The
>> macro runs fine on my ubuntu 16.04 partition with Oracle JDK. I installed
>> OpenJDK and it still ran with no error. On the other 3 partitions  running
>> the same version of jEdit and OpenJDK the macro generated the error.
>>
>> The method not found is a very commonly used method that has been in the
>>> jEdit API for ages, so I suspect you either have a broken process (should
>>> be fixed after a jEdit restart) or a JDK with something missing from it.
>>>
>>>
>>
>> I don't know java but I thought that it must be available. It must be some
>> kind of configuration problem.  I had the macro located in macros/MyMacros
>> on my home folder, so I moved it to the jEdit macros folder but that still
>> didn't solve the problem.
>>
>> I finally got the macro running by substituting another method.
>>
>> insertSpaces(numberOfSpaces)
>> {
>>    for (i = 0; i < numberOfSpaces; i++)
>>    {
>>      //textArea.insert(" ", false);
>>      textArea.userInput(' ');
>>    }
>> }
>>
>> If I get some time I will switch back to the insert method and see if I
>> can run down the problem, but I don't know if I can find it. I tried about
>> everything I could think of before I discovered the userInput method.
>>
>> Regards,  Jim
>>
>>
>> On Wed, Aug 23, 2017 at 5:35 PM, Jim <[email protected]> wrote:
>>>
>>> On 08/21/2017 09:52 PM, Jim wrote:
>>>>
>>>> On 08/19/2017 02:12 PM, Alan Ezust wrote:
>>>>>
>>>>> Oh I remember having a similar (but slightly different) problem with
>>>>>> Java
>>>>>> on Linux, where concatenation of double-quoted string literals caused a
>>>>>> weird runtime exception related to StringConcatFactory.
>>>>>>
>>>>>> I had to apt-get install libatk-wrapper-java before I could get string
>>>>>> concatenation to work.
>>>>>>
>>>>>>
>>>>>> I just installed that package and I still get this error:
>>>>>
>>>>> Sourced file: /home/jfb/.jedit/macros/MyMacros/Columnize_Code.bsh :
>>>>> Error in method invocation: Method insert( java.lang.String, boolean )
>>>>> not
>>>>> found in class'org.gjt.sp.jedit.textarea.JEditTextArea' : at Line: 7 :
>>>>>     in file: /home/jfb/.jedit/macros/MyMacros/Columnize_Code.bsh
>>>>>     : textArea .insert ( " " , false )
>>>>>
>>>>> I am running the same version if jEdit (5.4.0) on both ubuntu 16.04 and
>>>>> mint 18. It works on ubuntu 16.04 but not on mint 18. on ubuntu 16.04 I
>>>>> am
>>>>> running Oracle java version 1.8.0_121 and on mint 18 I am running
>>>>> openjdk
>>>>> version 1.8.0_131. I would like to avoid the hassle of installing Oracle
>>>>> java on my mint 18 partition without any assurances that it will solve
>>>>> the
>>>>> problem if I can.
>>>>>
>>>>> Anyone have any other ideas? I am sort of stuck here as I don't know
>>>>> java
>>>>> or beanshell for that matter. It took a lot of searching and trial and
>>>>> error for me to write it.
>>>>>
>>>>> Regards,  Jim
>>>>>
>>>>>
>>>>> I booted to my ubuntu 16.04 partition and installed openjkd.  I used the
>>>> macro and it worked fine with no errors.  I tried disabling all plugins
>>>> and
>>>> still get the error.
>>>>
>>>> I checked the docs and the method is supposed to be in that class. Not
>>>> knowing Java I don't know how to check and see if it is actually present
>>>> on
>>>> my hard drive.  Is there a way to copy over the file that would contain
>>>> that class from my working 16.04 install to my Mint 18 install?
>>>>
>>>> thanks,  Jim
>>>>
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>> --
>>>> -----------------------------------------------
>>>> jEdit Users' List
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/jedit-users
>>>>
>>>>
>>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> --
>> -----------------------------------------------
>> jEdit Users' List
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jedit-users
>>
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
-- 
-----------------------------------------------
jEdit Users' List
[email protected]
https://lists.sourceforge.net/lists/listinfo/jedit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.