protected IClasspathEntry createContextClasspathEntry(String context) {
    IClasspathEntry entry = null;

    IFile serviceJar = ProjectUtil.findServiceJarForContext(context);

    if (serviceJar.exists()) {
      IFolder docroot = CoreUtil.getDocroot(serviceJar.getProject());
      IFolder serviceFolder = docroot.getFolder("WEB-INF/service");

      entry =
          createClasspathEntry(
              serviceJar.getLocation(),
              serviceFolder.exists() ? serviceFolder.getLocation() : null);
    }

    if (entry == null) {
      IProject project = this.javaProject.getProject();

      SDK sdk = SDKUtil.getSDK(project);

      IPath sdkLocation = sdk.getLocation();

      String type =
          ProjectUtil.isPortletProject(project)
              ? "portlets"
              : ProjectUtil.isHookProject(project)
                  ? "hooks"
                  : ProjectUtil.isExtProject(project) ? "ext" : "";

      IPath serviceJarPath =
          sdkLocation
              .append(type)
              .append(context)
              .append("docroot/WEB-INF/lib")
              .append(context + "-service.jar");

      if (serviceJarPath.toFile().exists()) {
        IPath servicePath = serviceJarPath.removeLastSegments(2).append("service");

        entry =
            createClasspathEntry(
                serviceJarPath, servicePath.toFile().exists() ? servicePath : null);
      }
    }

    return entry;
  }