use of org.eclipse.ui.texteditor.ITextEditor 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;
}
use of org.eclipse.ui.texteditor.ITextEditor in project linuxtools by eclipse.
the class DoubleClickTest method testDoubleClickLine.
@Test
public void testDoubleClickLine() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testDoubleClickLine");
doDoubleClick();
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
assertTrue("editor should be ITextEditor", editor instanceof ITextEditor);
ITextEditor textEditor = (ITextEditor) editor;
ISelection selection = textEditor.getSelectionProvider().getSelection();
assertTrue("selection must be TextSelection", selection instanceof TextSelection);
TextSelection textSelection = (TextSelection) selection;
// zero-indexed
int line = textSelection.getStartLine() + 1;
assertEquals(frame.getLine(), line);
}
Aggregations