1 11 package org.eclipse.update.standalone; 12 13 import org.eclipse.core.runtime.*; 14 import org.eclipse.osgi.util.NLS; 15 import org.eclipse.update.internal.core.*; 16 17 27 public class StandaloneUpdateApplication implements IPlatformRunnable { 28 29 public final static Integer EXIT_ERROR = new Integer (1); 30 private static boolean loggedException = false; 31 32 35 public Object run(Object args) throws Exception { 36 if (args == null) 37 return EXIT_ERROR; 38 if (args instanceof String []) { 39 String [] params = (String []) args; 40 CmdLineArgs cmdLineArgs = new CmdLineArgs(params); 41 ScriptedCommand cmd = cmdLineArgs.getCommand(); 42 if (cmd == null) { 43 System.out.println(NLS.bind(Messages.Standalone_cmdFailed, (new String [] { Platform.getLogFileLocation().toOSString() }))); 44 return EXIT_ERROR; 45 } 46 loggedException = false; 47 boolean result = cmd.run(); 48 if (result) { 49 if (loggedException) { 50 System.out.println(NLS.bind(Messages.Standalone_cmdCompleteWithErrors, (new String [] { Platform.getLogFileLocation().toOSString() }))); 51 } else { 52 System.out.println(Messages.Standalone_cmdOK); 53 } 54 return IPlatformRunnable.EXIT_OK; 55 } else { 56 if (loggedException) { 57 System.out.println(NLS.bind(Messages.Standalone_cmdFailed, (new String [] { Platform.getLogFileLocation().toOSString() }))); 58 } else { 59 System.out.println(Messages.Standalone_cmdFailedNoLog); 60 } 61 return EXIT_ERROR; 62 } 63 } 64 return EXIT_ERROR; 65 } 66 public static void exceptionLogged() { 67 loggedException = true; 68 } 69 70 } 71 | Popular Tags |