Search in sources :

Example 1 with CEditor

use of org.eclipse.cdt.internal.ui.editor.CEditor in project linuxtools by eclipse.

the class ContentAssistTests method getResults.

protected ICompletionProposal[] getResults(IFile file, int offset) throws Exception {
    disableContributions();
    // call the ContentAssistProcessor
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    FileEditorInput editorInput = new FileEditorInput(file);
    IEditorPart editorPart = page.openEditor(editorInput, "org.eclipse.cdt.ui.editor.CEditor");
    CEditor editor = (CEditor) editorPart;
    @SuppressWarnings("unused") IAction completionAction = editor.getAction("ContentAssistProposal");
    String contentType = editor.getViewer().getDocument().getContentType(offset);
    ContentAssistant assistant = new ContentAssistant();
    CContentAssistProcessor processor = new CContentAssistProcessor(editor, assistant, contentType);
    return processor.computeCompletionProposals(editor.getViewer(), offset);
}
Also used : CEditor(org.eclipse.cdt.internal.ui.editor.CEditor) IAction(org.eclipse.jface.action.IAction) CContentAssistProcessor(org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistProcessor) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) ContentAssistant(org.eclipse.jface.text.contentassist.ContentAssistant)

Aggregations

CEditor (org.eclipse.cdt.internal.ui.editor.CEditor)1 CContentAssistProcessor (org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistProcessor)1 IAction (org.eclipse.jface.action.IAction)1 ContentAssistant (org.eclipse.jface.text.contentassist.ContentAssistant)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 FileEditorInput (org.eclipse.ui.part.FileEditorInput)1