Search in sources :

Example 1 with ExtensionBasedTextEditor

use of org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor in project linuxtools by eclipse.

the class SpecOutlinePageAdapterFactory method getAdapter.

@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
    if (IContentOutlinePage.class.equals(adapterType)) {
        if (adaptableObject instanceof ExtensionBasedTextEditor || adaptableObject instanceof SpecfileEditor) {
            ITextEditor specEditor = (ITextEditor) adaptableObject;
            IFile editorFile = specEditor.getEditorInput().getAdapter(IFile.class);
            if (editorFile.getLocation().toOSString().endsWith(".spec")) {
                // $NON-NLS-1$
                SpecfileContentOutlinePage page = new SpecfileContentOutlinePage(specEditor);
                page.setInput(specEditor.getEditorInput());
                return (T) page;
            }
        }
    }
    return null;
}
Also used : ITextEditor(org.eclipse.ui.texteditor.ITextEditor) IFile(org.eclipse.core.resources.IFile) SpecfileEditor(org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor) ExtensionBasedTextEditor(org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor)

Aggregations

IFile (org.eclipse.core.resources.IFile)1 SpecfileEditor (org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor)1 ExtensionBasedTextEditor (org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor)1 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)1