List of usage examples for org.eclipse.jdt.core IPackageFragment isOpen
boolean isOpen();
From source file:edu.brown.cs.bubbles.bedrock.BedrockProject.java
License:Open Source License
IPackageFragment findPackageFragment(String proj, String pkg) throws BedrockException { IProject ip = findProject(proj);//from ww w. ja v a 2 s . c om IJavaProject ijp = JavaCore.create(ip); if (ijp == null) return null; try { for (IPackageFragmentRoot pfr : ijp.getAllPackageFragmentRoots()) { try { if (!pfr.isExternal() && !pfr.isArchive() && pfr.getKind() == IPackageFragmentRoot.K_SOURCE) { IPackageFragment ipf = pfr.getPackageFragment(pkg); if (ipf != null && ipf.isOpen()) { File f = BedrockUtil.getFileForPath(ipf.getPath(), ip); if (f.exists()) return ipf; BedrockPlugin.logE("Fragment path doesn't exist: " + f); } } } catch (JavaModelException e) { } } } catch (JavaModelException e) { e.printStackTrace(); throw new BedrockException("Problem finding package roots: " + e, e); } return null; }
From source file:org.eclipse.jst.jsp.ui.tests.contentassist.BeanInfoProviderTest.java
License:Open Source License
private void openPath(IJavaProject javaProj) { try {// w w w . ja v a 2 s . co m if (javaProj.exists() && !javaProj.isOpen()) { javaProj.open(null); } IPackageFragmentRoot root = javaProj.getPackageFragmentRoot(fResource.getProject()); if (!root.isOpen()) root.open(null); IPackageFragment frag = getPackageFragment(root, "BEAN_TESTS"); openAll(frag); frag = getPackageFragment(root, "org"); if (frag != null && !frag.isOpen()) openAll(frag); frag = getPackageFragment(root, "org.eclipse"); if (frag != null && !frag.isOpen()) openAll(frag); frag = getPackageFragment(root, "org.eclipse.jst"); if (frag != null && !frag.isOpen()) openAll(frag); frag = getPackageFragment(root, "org.eclipse.jst.jsp"); if (frag != null && !frag.isOpen()) openAll(frag); frag = getPackageFragment(root, "org.eclipse.jst.jsp.ui"); if (frag != null && !frag.isOpen()) openAll(frag); frag = getPackageFragment(root, "org.eclipse.jst.jsp.ui.tests"); if (frag != null && !frag.isOpen()) openAll(frag); } catch (JavaModelException e) { e.printStackTrace(); } }