From: Peter G. <pe...@ar...> - 2002-10-02 19:19:18
|
This morning's 0.17.0+ development snapshot is up: http://armedbear.org/j.zip (source and documentation) http://armedbear.org/j-jar.zip (just j.jar) This snapshot introduces (1) custom toolbars and (2) the new command shellCommand. 1. For the moment, as a proof of concept, custom toolbars are only supported for Java mode. I'll extend this functionality to the other modes later today or tomorrow. To customize your Java mode toolbar, create an XML file that looks something like this: <?xml version="1.0"?> <toolbar> <button label="New" icon="stock_new.png" command="newBuffer"/> <button label="Open" icon="stock_open.png" command="openFile"/> <button label="Save" icon="stock_save.png" command="save"/> <button label="Close" icon="stock_cancel.png" command="killBuffer"/> <separator/> <button label="Undo" icon="stock_undo.png" command="undo"/> <button label="Redo" icon="stock_redo.png" command="redo"/> <separator/> <button label="Cut" icon="stock_cut.png" command="killRegion"/> <button label="Copy" icon="stock_copy.png" command="copyRegion"/> <button label="Paste" icon="stock_paste.png" command="paste"/> <separator/> <button label="Find" icon="stock_search.png" command="find"/> <button label="Replace" icon="stock_search_and_replace.png" command="replace"/> <separator/> <button label="Directory" icon="stock_index.png" command="dir"/> <button label="Home" icon="stock_home.png" command="dirHomeDir"/> <button label="Inbox" icon="mail.png" command="inbox"/> <separator/> <button label="Compile" icon="stock_refresh.png" command="compile javac here"/> <separator/> <button label="Exit" icon="stock_exit.png" command="quit"/> </toolbar> You can give this file any filename you want. For the purposes of this example, let's say it's "/home/peter/tb.xml". Then add a line like this to ~/.j/prefs: JavaMode.toolBar = /home/peter/tb.xml And you're done. Compared to the default Java mode toolbar, the custom toolbar defined in the sample XML has one additional button for "Compile". This button invokes j's "compile" command with the argument(s) "javac here" to compile the file that's open in the current buffer ("here" being a dynamic alias for the current file). If the icon filename is a relative path (or a simple filename with no directory prefix at all), it's assumed to be relative to (or in) src/org/armedbear/j/images. You can also specify an absolute pathname for the icon, so you don't have to keep the icons for your custom toolbar in j's source tree. 2. The command shellCommand, not mapped by default but available via Alt X, prompts for a command and then executes that command using /bin/sh or cmd.exe. The output of the command (if any) is presented in a transient output buffer. So, for example, you can do Alt X, "shellCommand ls -l" to get a directory listing of the current directory, or Alt X, "p4 opened" to see what files you have checked out from Perforce. Note that you can append the shell command itself to the string you feed to Alt X, as in Alt X, "shellCommand ls -l". If you just do Alt X, "shellCommand", by itself, j will prompt you for the command to run. The shell command you specify is executed in the editor's current directory, which is normally the parent directory of the file that's open in the current buffer, or the user's home directory if the current file is remote or if there is no file associated with the current buffer. You can do real damage with an errant shellCommand, so caution is advised. It's much safer to perform delicate operations in a shell buffer (or even a real xterm) where the light is better and you can see what you're doing. Thanks for your support. -Peter |