[TxMt Plugins] Dialog API improvements
chris at cjack.com
Thu Sep 20 16:34:22 UTC 2007
On Sep 20, 2007, at 11:26 AM, Allan Odgaard wrote:
> On 20/09/2007, at 16:45, Allan Odgaard wrote:
>> The restructuring I am envisioning is to move to a command based
>> system so that the basic syntax is:
>> tm_dialog «command» [«options»]
> I should mention that another candidate is to use an object oriented
> approach, so we would have:
> tm_dialog create (window|menu|…)
> And later that object could be manipulated with other commands.
> Though given how only few of the commands follow the ‘create,
> manipulate, dispose’-cycle, it is probably not a good interface.
Reverse the order and it can be done without forcing other commands to
conform: "tm_dialog (window|menu) create". That's probably the most
But, it might be better to use the former approach with different
verbs: "show" for synchronous and "create" for asynchronous.
"tm_dialog show menu", for example, makes perfect sense and allows the
"create" verb to be added later if there's ever a reason to manipulate
a menu asynchronously.
The implementation in the Dialog plugin would use the second argument
as a key for the command subclass, and then dispatch the command line
to the subclass. This has the side effect of possibly slightly
simplifying the implementation of "tm_dialog help <noun>".
More information about the textmate-plugins