/* * HyperSearch_Results_to_Buffer.bsh - a Beanshell macro * for jEdit text that writes HyperSearch results * matches to a new buffer in the format: * * :: * * Copyright (C) 2002, 2003 Ollie Rutherfurd * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id: HyperSearch_Results_to_Buffer.bsh 62 2003-11-10 19:52:38Z oliver $ */ writeHypersearchResultsToBuffer(View view){ hs = view.getDockableWindowManager().getDockableWindow("hypersearch-results"); if (hs == null) { Macros.error(view, "The 'HyperSearch Results' window is not open."); return; } root = hs.getTreeModel().getRoot(); if(root == null) { Macros.error(view, "No HyperSearch matches."); return; } node = root.getFirstChild(); while(node.getNextSibling() != null) { node = node.getNextSibling(); } node = node.getFirstChild(); results = new StringBuffer(); while(node != null) { path = node.getUserObject().toString(); match = node.getFirstChild(); while(match != null) { text = match.getUserObject().str; results.append(path + " :" + text + "\n"); match = match.getNextSibling(); } node = node.getNextSibling(); } text = results.toString(); if(text.length() > 0) { jEdit.newFile(view); view.getTextArea().setText(text); } } writeHypersearchResultsToBuffer(view); /* Macro index data (in DocBook format) HyperSearch_Results_to_Buffer.bsh Writes HyperSeach results to a new buffer. */ // :wrap=none:collapseFolds=0:noTabs=false:lineSeparator=\n:maxLineLen=80:indentSize=4:deepIndent=false:folding=none: