Search in sources :

Example 1 with IDebugView

use of org.eclipse.debug.ui.IDebugView in project webtools.servertools by eclipse.

the class ShowInDebugAction method selectProcess.

protected void selectProcess(IProcess process) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
        IWorkbenchPage page = window.getActivePage();
        if (page != null) {
            IWorkbenchPart part = page.findView(IDebugUIConstants.ID_DEBUG_VIEW);
            if (part == null) {
                try {
                    part = page.showView(IDebugUIConstants.ID_DEBUG_VIEW);
                } catch (PartInitException e) {
                    if (Trace.SEVERE) {
                        Trace.trace(Trace.STRING_SEVERE, "Could not open debug view");
                    }
                }
            }
            if (part != null) {
                IDebugView view = (IDebugView) part.getAdapter(IDebugView.class);
                if (view != null) {
                    page.activate(part);
                    view.setFocus();
                    Viewer viewer = view.getViewer();
                    if (viewer != null) {
                        viewer.setSelection(new StructuredSelection(process));
                    }
                }
            }
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) Viewer(org.eclipse.jface.viewers.Viewer) PartInitException(org.eclipse.ui.PartInitException) IDebugView(org.eclipse.debug.ui.IDebugView)

Aggregations

IDebugView (org.eclipse.debug.ui.IDebugView)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 Viewer (org.eclipse.jface.viewers.Viewer)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1