Search in sources :

Example 11 with SpecfileEditor

use of org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor 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

SpecfileEditor (org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor)11 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)4 SpecfileCompletionProcessor (org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileCompletionProcessor)4 Test (org.junit.Test)3 BadLocationException (org.eclipse.jface.text.BadLocationException)2 IDocument (org.eclipse.jface.text.IDocument)2 SpecfileParser (org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser)2 StringTokenizer (com.ibm.icu.util.StringTokenizer)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 IFile (org.eclipse.core.resources.IFile)1 BadPositionCategoryException (org.eclipse.jface.text.BadPositionCategoryException)1 IRegion (org.eclipse.jface.text.IRegion)1 ITypedRegion (org.eclipse.jface.text.ITypedRegion)1 Position (org.eclipse.jface.text.Position)1 IHyperlink (org.eclipse.jface.text.hyperlink.IHyperlink)1 URLHyperlink (org.eclipse.jface.text.hyperlink.URLHyperlink)1 SourceViewer (org.eclipse.jface.text.source.SourceViewer)1 SpecfileConfiguration (org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileConfiguration)1 SpecfileSource (org.eclipse.linuxtools.internal.rpm.ui.editor.parser.SpecfileSource)1