org.eclipse.core.runtime.content.IContentTypeMatcher Java Examples

The following examples show how to use org.eclipse.core.runtime.content.IContentTypeMatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectAssert.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Verifies that the actual IProject's contentTypeMatcher is equal to the given one.
 *
 * @param contentTypeMatcher the given contentTypeMatcher to compare the actual IProject's contentTypeMatcher to.
 * @return this assertion object.
 * @throws CoreException
 * @throws AssertionError - if the actual IProject's contentTypeMatcher is not equal to the given one.
 */
public ProjectAssert hasContentTypeMatcher(final IContentTypeMatcher contentTypeMatcher) throws CoreException {
    // check that actual IProject we want to make assertions on is not null.
    isNotNull();

    // we overrides the default error message with a more explicit one
    final String errorMessage = format("\nExpected <%s> contentTypeMatcher to be:\n  <%s>\n but was:\n  <%s>", actual, contentTypeMatcher,
            actual.getContentTypeMatcher());

    // check
    if (!actual.getContentTypeMatcher().equals(contentTypeMatcher)) {
        throw new AssertionError(errorMessage);
    }

    // return the current assertion for method chaining
    return this;
}
 
Example #2
Source File: BuildContext.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: AbstractIProjectStub.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IContentTypeMatcher getContentTypeMatcher() throws CoreException {
    throw new RuntimeException("Not implemented");
}