1 11 package org.eclipse.help.internal.standalone; 12 13 import java.util.List ; 14 15 import org.eclipse.help.internal.base.*; 16 17 32 public class StandaloneHelp extends EclipseController { 33 private static final String HELP_APPLICATION_ID = HelpBasePlugin.PLUGIN_ID 35 + ".helpApplication"; 37 47 public StandaloneHelp(String [] args) { 48 super(HELP_APPLICATION_ID, args); 49 } 50 51 54 public static void main(String [] args) { 55 try { 56 StandaloneHelp help = new StandaloneHelp(args); 57 58 List helpCommand = Options.getHelpCommand(); 59 60 if (help.executeCommand(helpCommand)) { 61 return; 62 } 63 printMainUsage(); 64 } catch (Exception e) { 65 e.printStackTrace(); 66 } 67 } 68 69 72 public void displayContext(String contextId, int x, int y) { 73 } 74 75 78 public void displayContextInfopop(String contextId, int x, int y) { 79 } 80 81 84 public void displayHelp() throws Exception { 85 sendHelpCommand("displayHelp", new String [0]); } 87 88 91 public void displayHelp(String href) throws Exception { 92 sendHelpCommand("displayHelp", new String []{"href=" + href}); } 94 95 98 private boolean executeCommand(List helpCommands) throws Exception { 99 100 if (helpCommands.size() <= 0) { 101 return false; 102 } 103 String command = (String ) helpCommands.get(0); 104 105 if ("start".equalsIgnoreCase(command)) { start(); 107 return true; 108 } else if ("shutdown".equalsIgnoreCase(command)) { shutdown(); 110 return true; 111 } else if ("displayHelp".equalsIgnoreCase(command)) { if (helpCommands.size() >= 2) { 113 displayHelp((String ) helpCommands.get(1)); 114 } else { 115 displayHelp(); 116 } 117 return true; 118 } else if (CMD_INSTALL.equalsIgnoreCase(command) 119 || CMD_ENABLE.equalsIgnoreCase(command) 120 || CMD_DISABLE.equalsIgnoreCase(command) 121 || CMD_UNINSTALL.equalsIgnoreCase(command) 122 || CMD_UPDATE.equalsIgnoreCase(command) 123 || CMD_SEARCH.equalsIgnoreCase(command) 124 || CMD_LIST.equalsIgnoreCase(command) 125 || CMD_ADDSITE.equalsIgnoreCase(command) 126 || CMD_REMOVESITE.equalsIgnoreCase(command) 127 || CMD_APPLY.equalsIgnoreCase(command)) { 128 return executeUpdateCommand(command); 129 } else if ("displayContext".equalsIgnoreCase(command)) { if (helpCommands.size() >= 4) { 131 displayContext((String ) helpCommands.get(1), Integer 132 .parseInt((String ) helpCommands.get(2)), Integer 133 .parseInt((String ) helpCommands.get(3))); 134 135 return true; 136 } 137 } else if ("displayContextInfopop".equalsIgnoreCase(command)) { if (helpCommands.size() >= 4) { 139 displayContextInfopop((String ) helpCommands.get(1), Integer 140 .parseInt((String ) helpCommands.get(2)), Integer 141 .parseInt((String ) helpCommands.get(3))); 142 return true; 143 } 144 } 145 146 return false; 147 } 148 149 152 private static void printMainUsage() { 153 System.out.println("Parameters syntax:"); System.out.println(); 155 System.out 156 .println("-command start | shutdown | (displayHelp [href]) [-eclipsehome eclipseInstallPath] [-host helpServerHost] [-port helpServerPort] [platform options] [-vmargs [Java VM arguments]]"); System.out.println(); 158 System.out.println("where:"); System.out.println(" href is the URL of the help resource to display,"); System.out 161 .println(" eclipseInstallPath specifies Eclipse installation directory; this directory is a parent to \"plugins\" directory and eclipse executable; the option must be provided, when current directory from which infocenter is launched, is not the same as Eclipse installation directory,"); System.out 163 .println(" helpServerHost specifies host name of the interface that help server will use,"); System.out 165 .println(" helpServerPort specifies port number that help server will use,"); System.out 167 .println(" platform options are other options that are supported by Eclipse Executable."); } 169 } 170 | Popular Tags |