diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java | 456 |
1 files changed, 171 insertions, 285 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index a3fafdb48..88fcd82c9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -13,6 +13,7 @@ package org.eclipse.debug.internal.ui.views.launch; import java.util.Iterator; +import org.eclipse.core.commands.util.ListenerList; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceChangeEvent; @@ -24,8 +25,10 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.debug.core.DebugException; @@ -45,20 +48,20 @@ import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.InstructionPointerManager; import org.eclipse.debug.internal.ui.actions.AddToFavoritesAction; import org.eclipse.debug.internal.ui.actions.EditLaunchConfigurationAction; +import org.eclipse.debug.internal.ui.contexts.DebugContextManager; import org.eclipse.debug.internal.ui.sourcelookup.EditSourceLookupPathAction; import org.eclipse.debug.internal.ui.sourcelookup.LookupSourceAction; -import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupResult; -import org.eclipse.debug.internal.ui.views.AbstractDebugEventHandlerView; +import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer; +import org.eclipse.debug.internal.ui.viewers.PresentationContext; +import org.eclipse.debug.internal.ui.viewers.TreePath; +import org.eclipse.debug.internal.ui.viewers.TreeSelection; import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages; -import org.eclipse.debug.internal.ui.views.DebugViewDecoratingLabelProvider; -import org.eclipse.debug.internal.ui.views.DebugViewInterimLabelProvider; -import org.eclipse.debug.internal.ui.views.DebugViewLabelDecorator; -import org.eclipse.debug.internal.ui.views.RemoteTreeViewer; -import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.AbstractDebugView; import org.eclipse.debug.ui.IDebugEditorPresentation; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult; +import org.eclipse.debug.ui.contexts.IDebugContextListener; +import org.eclipse.debug.ui.contexts.IDebugContextProvider; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; @@ -73,16 +76,11 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IMemento; import org.eclipse.ui.IPageLayout; import org.eclipse.ui.IPageListener; @@ -102,10 +100,8 @@ import org.eclipse.ui.part.IShowInSource; import org.eclipse.ui.part.IShowInTarget; import org.eclipse.ui.part.IShowInTargetList; import org.eclipse.ui.part.ShowInContext; -import org.eclipse.ui.progress.IWorkbenchSiteProgressService; -import org.eclipse.ui.progress.UIJob; -public class LaunchView extends AbstractDebugEventHandlerView implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IPropertyChangeListener, IResourceChangeListener, IShowInTarget, IShowInSource, IShowInTargetList, IPartListener2 { +public class LaunchView extends AbstractDebugView implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IPropertyChangeListener, IResourceChangeListener, IShowInTarget, IShowInSource, IShowInTargetList, IPartListener2 { public static final String ID_CONTEXT_ACTIVITY_BINDINGS = "contextActivityBindings"; //$NON-NLS-1$ @@ -114,12 +110,7 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect * for. */ private IStackFrame fStackFrame = null; - - /** - * Result of last source lookup - */ - private ISourceLookupResult fResult = null; - + /** * Whether this view is in the active page of a perspective. */ @@ -139,123 +130,98 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect private AddToFavoritesAction fAddToFavoritesAction = null; private EditSourceLookupPathAction fEditSourceAction = null; private LookupSourceAction fLookupAction = null; - - /** - * Progress service or <code>null</code> - */ - private IWorkbenchSiteProgressService fProgressService = null; - - /** - * Context manager which automatically opens and closes views - * based on debug contexts. - */ - private LaunchViewContextListener fContextListener; - - /** - * A job to perform source lookup on the currently selected stack frame. - */ - class SourceLookupJob extends Job { + class ContextProvider implements IDebugContextProvider { /** - * Constructs a new source lookup job. + * Context listeners + */ + private ListenerList fListeners = new ListenerList(); + + private ISelection fContext = null; + + protected void dispose() { + fContext = null; + fListeners.clear(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#getPart() */ - public SourceLookupJob() { - super(DebugUIViewsMessages.LaunchView_0); - setPriority(Job.INTERACTIVE); - setSystem(true); + public IWorkbenchPart getPart() { + return LaunchView.this; } /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) + * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#addDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener) */ - protected IStatus run(IProgressMonitor monitor) { - if (!monitor.isCanceled()) { - IStackFrame frame = getStackFrame(); - ISourceLookupResult result = null; - if (frame != null) { - result = DebugUITools.lookupSource(frame, null); - } - setSourceLookupResult(result); - scheduleSourceDisplay(); - } - return Status.OK_STATUS; + public void addDebugContextListener(IDebugContextListener listener) { + fListeners.add(listener); } - - } - - /** - * Source lookup job. - */ - private Job fSourceLookupJob = null; - - class SourceDisplayJob extends UIJob { - /** - * Constructs a new source display job + /* (non-Javadoc) + * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#removeDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener) */ - public SourceDisplayJob() { - super(DebugUIViewsMessages.LaunchView_1); - setSystem(true); - setPriority(Job.INTERACTIVE); + public void removeDebugContextListener(IDebugContextListener listener) { + fListeners.remove(listener); } /* (non-Javadoc) - * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) + * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#getActiveContext() */ - public IStatus runInUIThread(IProgressMonitor monitor) { - if (!monitor.isCanceled()) { - ISourceLookupResult result = getSourceLookupResult(); - if (result != null) { - DebugUITools.displaySource(result, getSite().getPage()); + public synchronized ISelection getActiveContext() { + return fContext; + } + + protected synchronized void activate(ISelection selection) { + fContext = selection; + Object[] listeners = fListeners.getListeners(); + for (int i = 0; i < listeners.length; i++) { + final IDebugContextListener listener = (IDebugContextListener) listeners[i]; + Platform.run(new ISafeRunnable() { + public void run() throws Exception { + listener.contextActivated(fContext, ContextProvider.this.getPart()); + } + public void handleException(Throwable exception) { + DebugUIPlugin.log(exception); + } + }); + + } + } + + protected synchronized void possibleContextChange(Object element) { + if (fContext instanceof IStructuredSelection) { + IStructuredSelection ss = (IStructuredSelection) fContext; + if (ss.size() == 1 && ss.getFirstElement().equals(element)) { + Object[] listeners = fListeners.getListeners(); + for (int i = 0; i < listeners.length; i++) { + final IDebugContextListener listener = (IDebugContextListener) listeners[i]; + Platform.run(new ISafeRunnable() { + public void run() throws Exception { + listener.contextChanged(fContext, ContextProvider.this.getPart()); + } + public void handleException(Throwable exception) { + DebugUIPlugin.log(exception); + } + }); + + } } } - return Status.OK_STATUS; } } - + /** - * Label provider for the launch view which renders pending launches - * with italic font. + * Context provider */ - private class LaunchViewLabelProvider extends DebugViewDecoratingLabelProvider { - - // The cached italic font used for pending launches - private Font fItalicFont= null; - - public LaunchViewLabelProvider(StructuredViewer viewer, IDebugModelPresentation presentation) { - super(viewer, new DebugViewInterimLabelProvider(presentation), new DebugViewLabelDecorator(presentation)); - } - - public Font getFont(Object element) { - if (element instanceof DebugUIPlugin.PendingLaunch) { - if (fItalicFont == null) { - Control control = getViewer().getControl(); - Font originalFont = control.getFont(); - FontData fontData[] = originalFont.getFontData(); - // Add the italic attribute - for (int i = 0; i < fontData.length; i++) { - fontData[i].setStyle(fontData[i].getStyle() | SWT.ITALIC); - } - fItalicFont= new Font(control.getDisplay(), fontData); - } - return fItalicFont; - } - return super.getFont(element); - } - - public void dispose() { - if (fItalicFont != null) { - fItalicFont.dispose(); - } - super.dispose(); - } - } + private ContextProvider fProvider = new ContextProvider(); /** - * Job used for source display. + * Context manager which automatically opens and closes views + * based on debug contexts. */ - private Job fSourceDisplayJob = null; + private LaunchViewContextListener fContextListener; /** * Creates a launch view and an instruction pointer marker for the view @@ -299,24 +265,26 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite) */ protected Viewer createViewer(Composite parent) { - LaunchViewer lv = new LaunchViewer(parent); - lv.addPostSelectionChangedListener(this); - lv.getControl().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent event) { - if (event.character == SWT.DEL && event.stateMask == 0) { - handleDeleteKeyPressed(); - } - } - }); - lv.setContentProvider(new DebugViewContentProvider(lv, getSite())); - final DelegatingModelPresentation presentation = new DelegatingModelPresentation(); - lv.setLabelProvider(new LaunchViewLabelProvider(lv, presentation)); - fEditorPresentation = presentation; - // add my viewer as a selection provider, so selective re-launch works - getSite().setSelectionProvider(lv); - lv.setInput(DebugPlugin.getDefault().getLaunchManager()); - setEventHandler(new LaunchViewEventHandler(this)); - return lv; + AsynchronousTreeViewer viewer = new LaunchViewer(parent, this); + viewer.setContext(new PresentationContext(this)); + viewer.setInput(DebugPlugin.getDefault().getLaunchManager()); + + viewer.addSelectionChangedListener(this); + viewer.getControl().addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent event) { + if (event.character == SWT.DEL && event.stateMask == 0) { + handleDeleteKeyPressed(); + } + } + }); + final DelegatingModelPresentation presentation = new DelegatingModelPresentation(); + fEditorPresentation = presentation; + // add my viewer as a selection provider, so selective re-launch works + getSite().setSelectionProvider(viewer); + viewer.setInput(DebugPlugin.getDefault().getLaunchManager()); + //setEventHandler(new LaunchViewEventHandler(this)); + DebugContextManager.getDefault().addDebugContextProvider(fProvider); + return viewer; } private void handleDeleteKeyPressed() { @@ -337,7 +305,7 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect } if (itemsToTerminate) { // Prompt the user to proceed with termination - if (!MessageDialog.openQuestion(getSite().getShell(), DebugUIViewsMessages.LaunchView_Terminate_and_Remove_1, DebugUIViewsMessages.LaunchView_Terminate_and_remove_selected__2)) { // + if (!MessageDialog.openQuestion(getSite().getShell(), DebugUIViewsMessages.LaunchView_Terminate_and_Remove_1, DebugUIViewsMessages.LaunchView_Terminate_and_remove_selected__2)) { return; } } @@ -353,7 +321,7 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect if (!status.isOK()) { IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow(); if (window != null) { - DebugUIPlugin.errorDialog(window.getShell(), DebugUIViewsMessages.LaunchView_Terminate_and_Remove_4, DebugUIViewsMessages.LaunchView_Terminate_and_remove_failed_5, status); // + DebugUIPlugin.errorDialog(window.getShell(), DebugUIViewsMessages.LaunchView_Terminate_and_Remove_4, DebugUIViewsMessages.LaunchView_Terminate_and_remove_failed_5, status); } else { DebugUIPlugin.log(status); } @@ -406,27 +374,36 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect if (!isAvailable()) { return; } - TreeViewer tv = (TreeViewer)getViewer(); - tv.expandToLevel(2); - final Object[] elements = tv.getExpandedElements(); + // traverse debug model in non UI thread Job initJob = new Job(DebugUIViewsMessages.LaunchView_2) { /* (non-Javadoc) * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor) */ protected IStatus run(IProgressMonitor monitor) { - for (int i = 0; i < elements.length; i++) { - if (elements[i] instanceof ILaunch) { - final IStackFrame frame = findFrame((ILaunch)elements[i]); - if (frame != null) { - Runnable runnable = new Runnable() { - public void run() { - autoExpand(frame, true); - } - }; - asyncExec(runnable); + ILaunchManager launchManager = (ILaunchManager) getViewer().getInput(); + ILaunch[] launches = launchManager.getLaunches(); + for (int i = 0; i < launches.length; i++) { + ILaunch launch = launches[i]; + final IStackFrame frame = findFrame(launch); + if (frame != null) { + Runnable runnable = new Runnable() { + public void run() { + autoExpand(frame, true); + } + }; + asyncExec(runnable); + } + } + // forces the delegates to update enablement + // TODO: would it be better to contribute toolbar/context actions in code? + if (launches.length == 0) { + Runnable runnable = new Runnable() { + public void run() { + getViewer().setSelection(new StructuredSelection()); } - } + }; + asyncExec(runnable); } return Status.OK_STATUS; } @@ -471,7 +448,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect site.getPage().addPartListener((IPartListener2) this); site.getWorkbenchWindow().addPageListener(this); site.getWorkbenchWindow().addPerspectiveListener(this); - fProgressService = (IWorkbenchSiteProgressService) site.getAdapter(IWorkbenchSiteProgressService.class); } /* (non-Javadoc) @@ -507,10 +483,15 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect * @see org.eclipse.ui.IWorkbenchPart#dispose() */ public void dispose() { - RemoteTreeViewer viewer = (RemoteTreeViewer) getViewer(); + DebugContextManager.getDefault().removeDebugContextProvider(fProvider); + fProvider.dispose(); + Viewer viewer = getViewer(); if (viewer != null) { viewer.removeSelectionChangedListener(this); - viewer.cancelJobs(); + if (viewer instanceof AsynchronousTreeViewer) { + AsynchronousTreeViewer asyncTreeViewer = (AsynchronousTreeViewer) viewer; + asyncTreeViewer.dispose(); + } } if (fContextListener != null) { fContextListener.dispose(); @@ -532,18 +513,9 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect * Disposes of cached information */ protected void cleanup() { - setSourceLookupResult(null); setStackFrame(null); } - - private void setSourceLookupResult(ISourceLookupResult result) { - fResult = result; - } - - private ISourceLookupResult getSourceLookupResult() { - return fResult; - } - + /** * The selection has changed in the viewer. Show the * associated source code if it is a stack frame. @@ -551,12 +523,19 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ public void selectionChanged(SelectionChangedEvent event) { - clearStatusLine(); + fProvider.activate(event.getSelection()); updateObjects(); - showEditorForCurrentSelection(); + +// TODO: replace view conetxt stuff based on debug context if (isActive()) { - fContextListener.updateForSelection(((IStructuredSelection) getViewer().getSelection()).getFirstElement()); + Object element = ((IStructuredSelection)event.getSelection()).getFirstElement(); + fContextListener.updateForSelection(element); } + + } + + protected void possibleContextChange(Object element) { + fProvider.possibleContextChange(element); } /** @@ -584,7 +563,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect ILaunch launch = launches[i]; if (launch.equals(frameLaunch)) { setStackFrame(null); - setSourceLookupResult(null); } } } @@ -603,9 +581,8 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect if (o == null || o instanceof IStackFrame) { return; } - TreeViewer tViewer= (TreeViewer)getViewer(); - boolean expanded= tViewer.getExpandedState(o); - tViewer.setExpandedState(o, !expanded); + StructuredViewer viewer = (StructuredViewer) getViewer(); + viewer.refresh(o); } /* (non-Javadoc) @@ -614,7 +591,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { setActive(page.findView(getSite().getId()) != null); updateObjects(); - showEditorForCurrentSelection(); fContextListener.clearLastEnabledContexts(); if (isActive()) { fContextListener.updateForSelection(((IStructuredSelection) getViewer().getSelection()).getFirstElement()); @@ -647,7 +623,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect if (getSite().getPage().equals(page)) { setActive(true); updateObjects(); - showEditorForCurrentSelection(); if (fContextListener != null) { fContextListener.loadTrackViews(); } @@ -666,102 +641,13 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect public void pageOpened(IWorkbenchPage page) { } - /** - * Opens an editor for the current selection if it is a stack frame. - * Otherwise, nothing will happen. - */ - protected void showEditorForCurrentSelection() { - // ensure this view is visible in the active page - if (!isActive()) { - return; - } - ISelection selection= getViewer().getSelection(); - Object obj= null; - if (selection instanceof IStructuredSelection) { - obj= ((IStructuredSelection) selection).getFirstElement(); - } - if (!(obj instanceof IStackFrame)) { - return; - } - openEditorForStackFrame((IStackFrame) obj); - } - /* (non-Javadoc) * @see org.eclipse.debug.ui.IDebugView#getPresentation(java.lang.String) */ public IDebugModelPresentation getPresentation(String id) { return ((DelegatingModelPresentation)fEditorPresentation).getPresentation(id); } - - /** - * Get the active window and open/bring to the front an editor on the stack - * frame. Selection is based on the line number OR the char start and end. - */ - protected void openEditorForStackFrame(IStackFrame stackFrame) { - if (!stackFrame.isSuspended()) { - return; - } - if (!stackFrame.equals(getStackFrame()) || (getEditorInput() == null || getEditorId() == null)) { - setStackFrame(stackFrame); - scheduleSourceLookup(); - } else { - setStackFrame(stackFrame); - SourceLookupResult result = (SourceLookupResult) fResult; - if (result != null) { - result.updateArtifact(stackFrame); - } - scheduleSourceDisplay(); - } - } - - /** - * Schedules a source lookup job. - */ - private void scheduleSourceLookup() { - if (fSourceLookupJob == null) { - fSourceLookupJob = new SourceLookupJob(); - } - setSourceLookupResult(null); - schedule(fSourceLookupJob); - } - - /** - * Schedules a source display job. - */ - private void scheduleSourceDisplay() { - if (fSourceDisplayJob == null) { - fSourceDisplayJob = new SourceDisplayJob(); - } - schedule(fSourceDisplayJob); - } - - /** - * Schedules a job with this part's progress service, if available. - * - * @param job job to schedule - */ - private void schedule(Job job) { - if (fProgressService == null) { - job.schedule(); - } else { - fProgressService.schedule(job); - } - } - - private IEditorInput getEditorInput() { - if (fResult != null) { - return fResult.getEditorInput(); - } - return null; - } - - private String getEditorId() { - if (fResult != null) { - return fResult.getEditorId(); - } - return null; - } - + /** * Deselects any source decorations associated with the given thread or * debug target. @@ -834,29 +720,27 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect * @param selectNeeded whether the element should be selected */ public void autoExpand(Object element, boolean selectNeeded) { - LaunchViewer launchViewer = (LaunchViewer)getViewer(); - launchViewer.deferExpansion(element); - if (selectNeeded) { - IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection(); - // if a frame is selected in a different thread, do not update selection - Iterator iterator = selection.iterator(); - while (iterator.hasNext()) { - Object object = iterator.next(); - if (object instanceof IStackFrame) { - if (element instanceof IStackFrame) { - IThread currThread = ((IStackFrame)object).getThread(); - if (!currThread.equals(((IStackFrame)element).getThread())) { - // a frame in a different thread is selected, don't change - return; - } - } else { - // a frame is selected and the new selection is not a frame - // do not change the selection - return; - } + AsynchronousTreeViewer viewer = (AsynchronousTreeViewer) getViewer(); + TreePath[] treePaths = viewer.getTreePaths(element); + if (element instanceof IStackFrame) { + IStackFrame frame = (IStackFrame) element; + if (treePaths != null) { + viewer.expand(new TreeSelection(treePaths)); + if (selectNeeded) { + viewer.setSelection(new TreeSelection(treePaths)); + } + } else { + ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); + ILaunch launch = frame.getLaunch(); + IDebugTarget debugTarget = frame.getDebugTarget(); + IThread thread = frame.getThread(); + + TreePath treePath = new TreePath(new Object[] {launchManager, launch, debugTarget, thread, frame}); + viewer.expand(new TreeSelection(new TreePath[] {treePath})); + if (selectNeeded) { + viewer.setSelection(new TreeSelection(new TreePath[] {treePath})); } } - launchViewer.deferSelection(new StructuredSelection(element)); } } @@ -1015,13 +899,14 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect * @see org.eclipse.ui.part.IShowInSource#getShowInContext() */ public ShowInContext getShowInContext() { + // TODO: fix this if (isActive()) { IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection(); if (!selection.isEmpty()) { Object sourceElement = null; - if (fResult != null) { - sourceElement = fResult.getSourceElement(); - } +// if (fResult != null) { +// sourceElement = fResult.getSourceElement(); +// } if (sourceElement instanceof IAdaptable) { if (((IAdaptable)sourceElement).getAdapter(IResource.class) != null) { return new ShowInContext(null, new StructuredSelection(sourceElement)); @@ -1102,4 +987,5 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect */ public void partInputChanged(IWorkbenchPartReference partRef) { } + } |