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; }