Search in sources :

Example 1 with AbstractContextStructureBridge

use of org.eclipse.mylyn.context.core.AbstractContextStructureBridge in project mylyn.docs by eclipse.

the class WikiTextContextUiBridge method open.

@Override
public void open(IInteractionElement element) {
    AbstractContextStructureBridge structureBridge = ContextCore.getStructureBridge(WikiTextContextStructureBridge.CONTENT_TYPE);
    if (structureBridge instanceof WikiTextContextStructureBridge) {
        Object object = structureBridge.getObjectForHandle(element.getHandleIdentifier());
        OutlineItem item = null;
        if (object instanceof OutlineItem) {
            item = (OutlineItem) object;
            object = ((WikiTextContextStructureBridge) structureBridge).getFile(item);
        }
        if (object instanceof IFile) {
            FileEditorInput editorInput = new FileEditorInput((IFile) object);
            try {
                IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, // $NON-NLS-1$
                "org.eclipse.mylyn.wikitext.ui.editor.markupEditor");
                if (item != null && editor instanceof IShowInTarget) {
                    ((IShowInTarget) editor).show(new ShowInContext(editorInput, new StructuredSelection(item)));
                }
            } catch (PartInitException e) {
                WikiTextContextUiPlugin.getDefault().log(e);
            }
        }
    }
}
Also used : IShowInTarget(org.eclipse.ui.part.IShowInTarget) AbstractContextStructureBridge(org.eclipse.mylyn.context.core.AbstractContextStructureBridge) IFile(org.eclipse.core.resources.IFile) ShowInContext(org.eclipse.ui.part.ShowInContext) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IFileEditorInput(org.eclipse.ui.IFileEditorInput) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

Aggregations

IFile (org.eclipse.core.resources.IFile)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 AbstractContextStructureBridge (org.eclipse.mylyn.context.core.AbstractContextStructureBridge)1 OutlineItem (org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IFileEditorInput (org.eclipse.ui.IFileEditorInput)1 PartInitException (org.eclipse.ui.PartInitException)1 FileEditorInput (org.eclipse.ui.part.FileEditorInput)1 IShowInTarget (org.eclipse.ui.part.IShowInTarget)1 ShowInContext (org.eclipse.ui.part.ShowInContext)1