/** * Return if the project has the given nature. * * @param project * @param natureId * @return <code>true</code> if project has given nature * @since 1.0.0 */ public static boolean hasRuntime(IProject project, String natureId) { if (project == null || !project.isAccessible()) return false; try { return project.hasNature(natureId); } catch (CoreException e) { return false; } }
/** * Return a list of nature ids based on the natures that have been configured for this project. * * @return list of configured nature ids. * @param project */ public static List getRegisteredRuntimeIDs(IProject project) { List result = null; String natureID = null; if (project != null && project.isAccessible()) { Iterator it = EMFNatureRegistry.singleton().REGISTERED_NATURE_IDS.iterator(); while (it.hasNext()) { natureID = (String) it.next(); try { if (project.hasNature(natureID)) { if (result == null) result = new ArrayList(2); result.add(natureID); } } catch (CoreException e) { } } } return result == null ? Collections.EMPTY_LIST : result; }