Search in sources :

Example 1 with RulerColumnTarget

use of org.eclipse.ui.internal.texteditor.rulers.RulerColumnTarget in project eclipse.platform.text by eclipse.

the class RulerColumnDescriptor method matchesEditor.

/**
 * Returns <code>true</code> if this contribution matches the passed editor, <code>false</code> if not.
 *
 * @param editor the editor to check
 * @return <code>true</code> if this contribution targets the passed editor
 */
public boolean matchesEditor(ITextEditor editor) {
    Assert.isLegal(editor != null);
    RulerColumnTarget target = getTarget();
    IWorkbenchPartSite site = editor.getSite();
    if (site != null && target.matchesEditorId(site.getId()))
        return true;
    if (target.matchesClass(editor.getClass()))
        return true;
    IContentType contentType = getContentType(editor);
    return contentType != null && target.matchesContentType(contentType);
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) RulerColumnTarget(org.eclipse.ui.internal.texteditor.rulers.RulerColumnTarget) IContentType(org.eclipse.core.runtime.content.IContentType)

Aggregations

IContentType (org.eclipse.core.runtime.content.IContentType)1 IWorkbenchPartSite (org.eclipse.ui.IWorkbenchPartSite)1 RulerColumnTarget (org.eclipse.ui.internal.texteditor.rulers.RulerColumnTarget)1