// perltidy.bsh /* * :mode=beanshell:encoding=ISO-8859-1: * :maxLine:Len=80:indentSize=4: * * jEdit-macro that invokes `perltidy` on the current buffer, * the results and errors being displayed in a new buffer * 2005, Andreas Pürzer, */ void perltidy() { import console.Shell; import console.BufferOutput; // Open the console if it isn't already open view.getDockableWindowManager().addDockableWindow("console"); // Obtain the console instance console = view.getDockableWindowManager().getDockable("console"); // Be sure to use the System's shell Shell _shell = Shell.getShell("System"); console.setShell(_shell); // Check buffer String source = buffer.getPath(); String mode = buffer.getMode().getName(); if(!mode.equals("perl")) { Macros.error(view, "This buffer doesn't look like perl."); return; } // Prepare command String command = "perltidy -st -se " + '"' + source + '"'; // Run command console.run(_shell, null, new BufferOutput(console, mode), null, command); } perltidy();