[ jEdit-devel ] making a macro configurable

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[ jEdit-devel ] making a macro configurable

Jarekczek
Administrator
Hi Shlomy

W dniu 2012-08-30 07:37, Shlomy Reinstein pisze:
> How do you make it configurable?
> There are two ways that I've been using for configuring macros:
> 1. Create GUI for configuration in the macro

I made a note in docs: invoking the macro on an empty line displays
configuration dialog. So it's a trick that could not be applied to all
macros. Something more general would be handy.

Jarek

> 2. Use jEdit properties without GUI, and then use the BeanShell
> Console to set these properties
> I'm interested to know other ways (is it better to open a new thread
> on this?).
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [ jEdit-devel ] making a macro configurable

Shlomy Reinstein
I use a similar technique in one of my macros, which searches for all references to a local variable (or parameter) in the current function.
- If some text is selected in the buffer, the macro searches for it
- If no text is selected, but the caret is placed on some identifier, the macro searches for this identifier
- Otherwise (i.e. no text is selected and the caret is not on an identifier), the macro opens a dialog to ask the user what to search for

Some of the functionality of this macro (mainly the first two parts, looking for "what to search") is common to lots of actions - I use similar code in some of my plugins. I think this functionality should be extracted to some utility class in jEdit that macros can use.

Thanks,
Shlomy

On Thu, Aug 30, 2012 at 8:56 AM, Jarek Czekalski <[hidden email]> wrote:
Hi Shlomy

W dniu 2012-08-30 07:37, Shlomy Reinstein pisze:
> How do you make it configurable?
> There are two ways that I've been using for configuring macros:
> 1. Create GUI for configuration in the macro

I made a note in docs: invoking the macro on an empty line displays
configuration dialog. So it's a trick that could not be applied to all
macros. Something more general would be handy.

Jarek

> 2. Use jEdit properties without GUI, and then use the BeanShell
> Console to set these properties
> I'm interested to know other ways (is it better to open a new thread
> on this?).
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [ jEdit-devel ] making a macro configurable

Jarekczek
Administrator
Jedit api lacks convenient dialog window class for single pane option dialog.

EnhancedDialog has no ok, cancel buttons. Using it would mean much copy and pasting of code, unjustified code duplication. I tried to use OptionDialog, but it's incompatible with beanshell. A similar implementation targetted for single panes would be welcome.

Meeting these obstacles I decided not to create a configuration pane at all. Maybe in the future. For current need I'll go with a non-configurable safe and simple behaviour.

Jarek

W dniu 08/30/2012 08:16 AM, Shlomy Reinstein pisze:
I use a similar technique in one of my macros, which searches for all references to a local variable (or parameter) in the current function.
- If some text is selected in the buffer, the macro searches for it
- If no text is selected, but the caret is placed on some identifier, the macro searches for this identifier
- Otherwise (i.e. no text is selected and the caret is not on an identifier), the macro opens a dialog to ask the user what to search for

Some of the functionality of this macro (mainly the first two parts, looking for "what to search") is common to lots of actions - I use similar code in some of my plugins. I think this functionality should be extracted to some utility class in jEdit that macros can use.

Thanks,
Shlomy

On Thu, Aug 30, 2012 at 8:56 AM, Jarek Czekalski <[hidden email]> wrote:
Hi Shlomy

W dniu 2012-08-30 07:37, Shlomy Reinstein pisze:
> How do you make it configurable?
> There are two ways that I've been using for configuring macros:
> 1. Create GUI for configuration in the macro

I made a note in docs: invoking the macro on an empty line displays
configuration dialog. So it's a trick that could not be applied to all
macros. Something more general would be handy.

Jarek

> 2. Use jEdit properties without GUI, and then use the BeanShell
> Console to set these properties
> I'm interested to know other ways (is it better to open a new thread
> on this?).
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [ jEdit-devel ] making a macro configurable

Shlomy Reinstein
Console has a wonderful feature named Commando - which provides an elegant interface for simple GUI (using XML files as far as I recall). Maybe this part can be moved from Console to the core? It is based on BeanShell - you name the GUI elements and can then access the names from BeanShell. Then, a macro can either refer to an XML file (distributed together with the macro) or include the XML inline and use Commando to create the GUI from it. Thoughts?

Thanks,
Shlomy

On Thu, Aug 30, 2012 at 9:28 PM, Jarek Czekalski <[hidden email]> wrote:
Jedit api lacks convenient dialog window class for single pane option dialog.

EnhancedDialog has no ok, cancel buttons. Using it would mean much copy and pasting of code, unjustified code duplication. I tried to use OptionDialog, but it's incompatible with beanshell. A similar implementation targetted for single panes would be welcome.

Meeting these obstacles I decided not to create a configuration pane at all. Maybe in the future. For current need I'll go with a non-configurable safe and simple behaviour.

Jarek

W dniu 08/30/2012 08:16 AM, Shlomy Reinstein pisze:
I use a similar technique in one of my macros, which searches for all references to a local variable (or parameter) in the current function.
- If some text is selected in the buffer, the macro searches for it
- If no text is selected, but the caret is placed on some identifier, the macro searches for this identifier
- Otherwise (i.e. no text is selected and the caret is not on an identifier), the macro opens a dialog to ask the user what to search for

Some of the functionality of this macro (mainly the first two parts, looking for "what to search") is common to lots of actions - I use similar code in some of my plugins. I think this functionality should be extracted to some utility class in jEdit that macros can use.

Thanks,
Shlomy

On Thu, Aug 30, 2012 at 8:56 AM, Jarek Czekalski <[hidden email]> wrote:
Hi Shlomy

W dniu 2012-08-30 07:37, Shlomy Reinstein pisze:
> How do you make it configurable?
> There are two ways that I've been using for configuring macros:
> 1. Create GUI for configuration in the macro

I made a note in docs: invoking the macro on an empty line displays
configuration dialog. So it's a trick that could not be applied to all
macros. Something more general would be handy.

Jarek

> 2. Use jEdit properties without GUI, and then use the BeanShell
> Console to set these properties
> I'm interested to know other ways (is it better to open a new thread
> on this?).
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel