protected IContentType[] getContentTypes() throws CoreException { // TODO Cache this? IProject theProject = getProject(); if (theProject != null) { IContentTypeMatcher matcher = theProject.getContentTypeMatcher(); return matcher.findContentTypesFor(getName()); } IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (ArrayUtil.isEmpty(projects)) { return Platform.getContentTypeManager().findContentTypesFor(getName()); } for (IProject project : projects) { try { IContentType[] type = project.getContentTypeMatcher().findContentTypesFor(getName()); if (type != null) { return type; } } catch (CoreException e) { IdeLog.logError(IndexPlugin.getDefault(), e); } } return NO_CONTENT_TYPES; }
@Override public IContentTypeMatcher getContentTypeMatcher() throws CoreException { throw new UnsupportedOperationException(); }
/** * {@inheritDoc} */ @Override public IContentTypeMatcher getContentTypeMatcher() throws CoreException { return resource().getContentTypeMatcher(); }
@Override public IContentTypeMatcher getContentTypeMatcher() throws CoreException { throw new RuntimeException("Not implemented"); }
/** * Returns this project's content type matcher. This content type matcher takes project specific * preferences and nature-content type associations into account. * * @return the content type matcher for this project * @exception CoreException if this method fails. Reasons include: * <ul> * <li>This project does not exist. * <li>This project is not open. * </ul> * * @see IContentTypeMatcher * @since 3.1 */ public IContentTypeMatcher getContentTypeMatcher() throws CoreException;