/* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchPart#dispose() */ public void dispose() { viewer.removeCheckStateListener(this); super.dispose(); if (getEventHandler() != null) { getEventHandler().dispose(); } }
protected void becomesVisible() { super.becomesVisible(); ISelection selection = DebugUITools.getDebugContextManager() .getContextService(getSite().getWorkbenchWindow()) .getActiveContext(); contextActivated(selection); }
/** * Attempts to find an appropriate view to emulate, this will either be the variables view or * the expressions view. * * @return a view to emulate or <code>null</code> */ private AbstractDebugView getViewToEmulate() { IWorkbenchPage page = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); AbstractDebugView expressionsView = (AbstractDebugView) page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW); if (expressionsView != null && expressionsView.isVisible()) { return expressionsView; } AbstractDebugView variablesView = (AbstractDebugView) page.findView(IDebugUIConstants.ID_VARIABLE_VIEW); if (variablesView != null && variablesView.isVisible()) { return variablesView; } if (expressionsView != null) { return expressionsView; } return variablesView; }
@Override protected void becomesHidden() { setViewerInput(null); super.becomesHidden(); }
@Override protected void createContent(Composite parent) { fSashForm = new SashForm(parent, parent.getStyle()); fSashForm.setOrientation(SWT.VERTICAL); // update presentation context AbstractDebugView view = getViewToEmulate(); fContext = new PresentationContext(TCFModel.ID_EXPRESSION_HOVER); if (view != null) { // copy over properties IPresentationContext copy = ((TreeModelViewer) view.getViewer()).getPresentationContext(); try { String[] properties = copy.getProperties(); for (int i = 0; i < properties.length; i++) { String key = properties[i]; fContext.setProperty(key, copy.getProperty(key)); } } catch (NoSuchMethodError e) { // ignore } } fViewer = new TreeModelViewer(fSashForm, SWT.MULTI | SWT.VIRTUAL | SWT.FULL_SELECTION, fContext); fViewer.setAutoExpandLevel(fExpansionLevel); if (view != null) { // copy over filters StructuredViewer structuredViewer = (StructuredViewer) view.getViewer(); if (structuredViewer != null) { ViewerFilter[] filters = structuredViewer.getFilters(); for (int i = 0; i < filters.length; i++) { fViewer.addFilter(filters[i]); } } } fInputService = new ViewerInputService(fViewer, this); fTree = fViewer.getTree(); if (fShowDetailPane) { fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH); Layout layout = fDetailPaneComposite.getLayout(); if (layout instanceof GridLayout) { GridLayout gl = (GridLayout) layout; gl.marginHeight = 0; gl.marginWidth = 0; } fDetailPane = new DetailPaneProxy(new DetailPaneContainer()); fDetailPane.display(null); // Bring up the default pane so the // user doesn't see an empty // composite fTree.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { fDetailPane.display((IStructuredSelection) fViewer.getSelection()); } public void widgetDefaultSelected(SelectionEvent e) {} }); } initSashWeights(); // add update listener to auto-select and display details of root // expression fViewer.addViewerUpdateListener( new IViewerUpdateListener() { public void viewerUpdatesComplete() { fViewer .getDisplay() .timerExec( 100, new Runnable() { public void run() { if (fViewer.getControl().isDisposed()) return; TreeSelection selection = (TreeSelection) fViewer.getSelection(); if (selection.isEmpty()) selection = new TreeSelection(fViewer.getTopElementPath()); fViewer.setSelection(selection); if (fDetailPane != null) fDetailPane.display(selection); } }); } public void viewerUpdatesBegin() {} public void updateStarted(IViewerUpdate update) {} public void updateComplete(IViewerUpdate update) {} }); setBackgroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); }
protected void becomesHidden() { super.becomesHidden(); }
/** This is a callback that will allow us to clean up when the viewer is closed. */ public void dispose() { DebugUITools.getDebugContextManager() .getContextService(getSite().getWorkbenchWindow()) .removeDebugContextListener(this); super.dispose(); }