| package org.eclipse.epf.publishing.services.index; |
| |
| import org.eclipse.core.runtime.IProgressMonitor; |
| import org.eclipse.core.runtime.NullProgressMonitor; |
| import org.eclipse.epf.publishing.PublishingResources; |
| |
| /** |
| * Test class for Bookmark index |
| * |
| * @author Jinhua Xi |
| * |
| */ |
| class IndexTest { |
| |
| /** |
| * @param args |
| */ |
| public static void main(String[] args) { |
| |
| test(); |
| } |
| |
| static void test() { |
| |
| try { |
| |
| //Shell s = new Shell(); |
| IProgressMonitor monitor = new NullProgressMonitor(); |
| |
| String publishDir = |
| "C:\\Documents and Settings\\jxi\\EPF\\Publish\\0926.71lib_classic rup"; |
| |
| // String publishDir = |
| // "C:\\Documents and Settings\\jxi\\EPF\\Publish\\RUP_ALL"; |
| |
| |
| String title = "RUP"; |
| String deffile = "D:\\EPF Workspaces\\epf-head\\org.eclipse.epf.publishing\\keywordindexdef.txt"; |
| |
| // URL url = new URL(PublishingPlugin.getDefault().getInstallURL(), |
| // PublishManager.KEYWORD_DEF_FILE); |
| // if (url == null) { |
| // System.out.println("Unable to get index definition file "); //$NON-NLS-1$ |
| // return; |
| // } |
| |
| // String deffile = Platform.resolve(url).getPath(); |
| |
| |
| String charSet = "utf-8"; //$NON-NLS-1$ |
| String helpFile = null; |
| KeyWordIndexHelper indexHelper = new KeyWordIndexHelper(deffile, |
| charSet, helpFile); |
| DefinitionObject defObj = indexHelper.loadDefinition(publishDir); |
| if (defObj != null) { |
| defObj.setwwwRoot(publishDir); |
| defObj |
| .setIndexTitle(PublishingResources.indexLabel_text + " - " + title); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| |
| indexHelper.execute(monitor); |
| } catch (Exception e) { |
| e.printStackTrace(); |
| } |
| } |
| |
| } |