private IProject findAppEngineProject(IProject project) {
   if (project != null && project.isAccessible()) {
     try {
       return AppEngineConnectedNature.getAppEngineProject(project);
     } catch (CoreException e) {
       AppEngineRPCPlugin.log(e);
     }
   }
   return null;
 }
 private void refreshEntityViewer() {
   IJavaProject javaProject = getJavaProject();
   if (javaProject != null) {
     try {
       entityViewer.setInput(javaProject.getProject());
       entityViewer.setContentProvider(
           RequestFactoryUtils.createEntityListContentProvider(getJavaProject()));
       entityViewer.refresh();
       entityViewer.setAllChecked(true);
       handleEntitySelectionChanged();
     } catch (JavaModelException e) {
       AppEngineRPCPlugin.log(e);
     }
   }
 }
 private void initializeContainerText(Text targetText) {
   String text = ""; // $NON-NLS-1$
   if (project != null && project.isAccessible()) {
     IJavaProject javaProject = JavaCore.create(project);
     if (javaProject != null) {
       try {
         IPackageFragmentRoot srcPackage = JavaUtils.getSourcePackageFragmentRoot(javaProject);
         if (srcPackage != null) {
           text = javaProject.getElementName() + "/" + srcPackage.getElementName(); // $NON-NLS-1$
         }
       } catch (JavaModelException e) {
         AppEngineRPCPlugin.log(e);
       }
     }
   }
   targetText.setText(text);
 }
  private boolean inferContainerFromWorkbenchSelection() {

    project = findAppEngineProject(project);

    if (project != null && project.isAccessible()) {
      IJavaProject javaProject = JavaCore.create(project);
      if (javaProject != null) {
        try {
          containerRoot = JavaUtils.getSourcePackageFragmentRoot(javaProject);
          return true;
        } catch (JavaModelException e) {
          AppEngineRPCPlugin.log(e);
        }
      }
    }
    return false;
  }
  public void createControl(Composite parent) {

    Composite composite = createMainComposite(parent);

    if (!inferContainerFromWorkbenchSelection()) {
      createContainerSelector(composite);
    }

    // createPackageSelector(composite);
    createTypeNameField(composite);

    createSeparator(composite);

    try {
      createEntityViewer(composite);
    } catch (JavaModelException e) {
      AppEngineRPCPlugin.getLogger().logError(e);
    }

    createDetailsLabel(composite);
  }