/*
  * Do a look-up and return the OSGi install area if it is set.
  */
 public static URL getOSGiInstallArea() {
   Location location =
       (Location)
           ServiceHelper.getService(
               Activator.getContext(), Location.class.getName(), Location.INSTALL_FILTER);
   if (location == null) return null;
   if (!location.isSet()) return null;
   return location.getURL();
 }
 /*
  * Helper method to return the eclipse.home location. Return
  * null if it is unavailable.
  */
 public static File getEclipseHome() {
   Location eclipseHome =
       (Location)
           ServiceHelper.getService(
               Activator.getContext(), Location.class.getName(), Location.ECLIPSE_HOME_FILTER);
   if (eclipseHome == null || !eclipseHome.isSet()) return null;
   URL url = eclipseHome.getURL();
   if (url == null) return null;
   return URLUtil.toFile(url);
 }
  /** Returns the name of the Eclipse application launcher. */
  private static String getLauncherName(String name, String os, File installFolder) {
    if (os == null) {
      EnvironmentInfo info =
          (EnvironmentInfo)
              ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
      if (info == null) return null;
      os = info.getOS();
    }

    if (os.equals(org.eclipse.osgi.service.environment.Constants.OS_WIN32)) {
      IPath path = new Path(name);
      if ("exe".equals(path.getFileExtension())) // $NON-NLS-1$
      return name;
      return name + ".exe"; // $NON-NLS-1$
    }
    if (os.equals(Constants.MACOSX_BUNDLED)) {
      return "/Contents/MacOS/" + name; // $NON-NLS-1$
    }

    if (os.equals(org.eclipse.osgi.service.environment.Constants.OS_MACOSX)) {
      IPath path = new Path(name);
      if (path.segment(0).endsWith(".app")) // $NON-NLS-1$
      return name;

      String appName = null;
      if (installFolder != null) {
        File appFolder = new File(installFolder, name + ".app"); // $NON-NLS-1$
        if (appFolder.exists()) {
          try {
            appName = appFolder.getCanonicalFile().getName();
          } catch (IOException e) {
            appName = appFolder.getName();
          }
        }
      }

      StringBuffer buffer = new StringBuffer();
      if (appName != null) {
        buffer.append(appName);
      } else {
        buffer.append(name.substring(0, 1).toUpperCase());
        buffer.append(name.substring(1));
        buffer.append(".app"); // $NON-NLS-1$
      }
      buffer.append("/Contents/MacOS/"); // $NON-NLS-1$
      buffer.append(name);
      return buffer.toString();
    }
    return name;
  }