<extension point="org.eclipse.ui.editors">
<editor class="com.b.ui.BExecutableExtensionFactory:org.eclipse.xtext.ui.editor.XtextEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
default="true"
id="com.b.B"
name="B Editor">
<contentTypeBinding
contentTypeId="com.b.contentType">
</contentTypeBinding>
</editor>
</extension>
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.text"
file-extensions="common"
id="com.b.contentType"
name="B"
priority="normal">
</content-type>
</extension>
class BContentHandler extends PlatformContentHandlerImpl {
public static final String B_FILE_CONTENT_TYPE = "com.b";
override public boolean canHandle(URI uri) {
return Arrays.contains(uri.segments, "b")
}
override public Map<String, Object> contentDescription(URI uri, InputStream inputStream, Map<?, ?> options, Map<Object, Object> context) throws IOException {
val Map<String, Object> description = super.contentDescription(uri, inputStream, options, context);
if (canHandle(uri)) {
description.put(VALIDITY_PROPERTY, VALID);
description.put(CONTENT_TYPE_PROPERTY, B_FILE_CONTENT_TYPE);
}
return description;
}
}