Search in sources :

Example 1 with IShowInTarget

use of org.eclipse.ui.part.IShowInTarget in project KaiZen-OpenAPI-Editor by RepreZen.

the class DocumentUtils method openAndReveal.

/**
     * Opens the editor for the file located at the given path and reveal the selection.
     * 
     * @param path
     * @param selection
     */
public static void openAndReveal(IPath path, ISelection selection) {
    final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    final IFile file = root.getFile(path);
    final IEditorPart editor = openEditor(file);
    if (editor instanceof IShowInTarget) {
        IShowInTarget showIn = (IShowInTarget) editor;
        showIn.show(new ShowInContext(null, selection));
    }
}
Also used : IShowInTarget(org.eclipse.ui.part.IShowInTarget) IFile(org.eclipse.core.resources.IFile) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) ShowInContext(org.eclipse.ui.part.ShowInContext) IEditorPart(org.eclipse.ui.IEditorPart)

Aggregations

IFile (org.eclipse.core.resources.IFile)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IShowInTarget (org.eclipse.ui.part.IShowInTarget)1 ShowInContext (org.eclipse.ui.part.ShowInContext)1