/* man2html search * * Copyright (C) 2003 Stefan Kost * Copyright (C) 2001 Tom Gutwin * */ void _infoView(View view, String urlStr) { // first, check if the plugin is installed. boolean version1 = false; //With version 1.0 of the plugin ... the name changed to //infoviewer.InfoViewerPlugin if(jEdit.getPlugin("InfoViewerPlugin",true) == null) { if(jEdit.getPlugin("infoviewer.InfoViewerPlugin",true) == null) { Macros.error(view,"You must install the InfoViewerPlugin" + " to use this macro."); return; } version1 = true; } try { // API change with version 1.0 of the InfoViewer if (version1) jEdit.getPlugin("infoviewer.InfoViewerPlugin"). openURL(view, urlStr);// version 1.0 else jEdit.getPlugin("InfoViewerPlugin"). sendURL(new URL(urlStr), view); // pre 1.0 } catch (MalformedURLException mu) { Macros.error(view,"Cannot find the url " + urlStr); } } // get current selection topic=textArea.getSelectedText(); if((topic==null) || (topic.length()==0)) { // as there is no current selection, grab word under cursor cpos=textArea.getCaretPosition(); textArea.selectWord(); topic=textArea.getSelectedText(); textArea.removeFromSelection(cpos); textArea.setCaretPosition(cpos); } if((topic!=null) && (topic.length()>0)) { // if we have a topic invoke InfoViewer strURL="http://krishna/cgi-bin/man.cgi?section=all&topic="+topic; _infoView(view,strURL); }