Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 389197 | Differences between
and this patch

Collapse All | Expand All

(-)a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java (-3 / +6 lines)
Lines 158-163 public class TCFModel implements ITCFModel, IElementContentProvider, IElementLab Link Here
158
        UPDATE_POLICY_MANUAL     = 1,
158
        UPDATE_POLICY_MANUAL     = 1,
159
        UPDATE_POLICY_BREAKPOINT = 2;
159
        UPDATE_POLICY_BREAKPOINT = 2;
160
160
161
    /** View property indicating whether to expand a stack trace on suspend. */
162
    public static final String PROP_EXPAND_ON_SUSPEND = Activator.PLUGIN_ID + ".PROP_EXPAND_ON_SUSPEND";
163
    
161
    /**
164
    /**
162
     * A dummy editor input to open the disassembly view as editor.
165
     * A dummy editor input to open the disassembly view as editor.
163
     */
166
     */
Lines 1529-1542 public class TCFModel implements ITCFModel, IElementContentProvider, IElementLab Link Here
1529
        if (node.isDisposed()) return;
1532
        if (node.isDisposed()) return;
1530
        runSuspendTrigger(node);
1533
        runSuspendTrigger(node);
1531
        if (reason == null) return;
1534
        if (reason == null) return;
1532
        if (reason.equals(IRunControl.REASON_USER_REQUEST)) return;
1533
        for (TCFModelProxy proxy : model_proxies.values()) {
1535
        for (TCFModelProxy proxy : model_proxies.values()) {
1534
            if (proxy.getPresentationContext().getId().equals(IDebugUIConstants.ID_DEBUG_VIEW)) {
1536
            if (proxy.getPresentationContext().getId().equals(IDebugUIConstants.ID_DEBUG_VIEW)) {
1535
                proxy.setSelection(node);
1537
                proxy.setSelection(node);
1536
                if (reason.equals(IRunControl.REASON_STEP)) continue;
1537
                if (reason.equals(IRunControl.REASON_CONTAINER)) continue;
1538
                if (reason.equals(IRunControl.REASON_CONTAINER)) continue;
1539
                if (expanded_nodes.add(node.id) || proxy.getExpandStack()) proxy.expand(node);
1540
                if (reason.equals(IRunControl.REASON_USER_REQUEST)) continue;
1541
                if (reason.equals(IRunControl.REASON_STEP)) continue;
1538
                if (delay_stack_update_until_last_step && launch.getContextActionsCount(node.id) != 0) continue;
1542
                if (delay_stack_update_until_last_step && launch.getContextActionsCount(node.id) != 0) continue;
1539
                if (expanded_nodes.add(node.id)) proxy.expand(node);
1540
            }
1543
            }
1541
            if (reason.equals(IRunControl.REASON_BREAKPOINT)) {
1544
            if (reason.equals(IRunControl.REASON_BREAKPOINT)) {
1542
                IWorkbenchPart part = proxy.getPresentationContext().getPart();
1545
                IWorkbenchPart part = proxy.getPresentationContext().getPart();
(-)a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelProxy.java (-2 / +51 lines)
Lines 32-38 import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateList Link Here
32
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
32
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
33
import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
33
import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
34
import org.eclipse.debug.ui.IDebugUIConstants;
34
import org.eclipse.debug.ui.IDebugUIConstants;
35
import org.eclipse.jface.viewers.ITreeViewerListener;
36
import org.eclipse.jface.viewers.TreeExpansionEvent;
35
import org.eclipse.jface.viewers.TreePath;
37
import org.eclipse.jface.viewers.TreePath;
38
import org.eclipse.jface.viewers.TreeViewer;
36
import org.eclipse.swt.graphics.Device;
39
import org.eclipse.swt.graphics.Device;
37
import org.eclipse.swt.widgets.Display;
40
import org.eclipse.swt.widgets.Display;
38
import org.eclipse.tcf.internal.debug.model.TCFLaunch;
41
import org.eclipse.tcf.internal.debug.model.TCFLaunch;
Lines 44-50 import org.eclipse.tcf.protocol.Protocol; Link Here
44
 * Model proxy listeners are debuggers views.
47
 * Model proxy listeners are debuggers views.
45
 */
48
 */
46
@SuppressWarnings("restriction")
49
@SuppressWarnings("restriction")
47
public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Runnable {
50
public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Runnable, ITreeViewerListener {
48
51
49
    private static final TCFNode[] EMPTY_NODE_ARRAY = new TCFNode[0];
52
    private static final TCFNode[] EMPTY_NODE_ARRAY = new TCFNode[0];
50
53
Lines 67-72 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
67
    private boolean enable_auto_expand;
70
    private boolean enable_auto_expand;
68
    private Set<TCFNode> auto_expand_removed_nodes;
71
    private Set<TCFNode> auto_expand_removed_nodes;
69
    private Set<TCFNode> auto_expand_created_nodes;
72
    private Set<TCFNode> auto_expand_created_nodes;
73
    private boolean expand_stack;
70
74
71
    private final Runnable timer = new Runnable() {
75
    private final Runnable timer = new Runnable() {
72
76
Lines 202-207 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
202
                IDebugUIConstants.ID_DEBUG_VIEW.equals(getPresentationContext().getId()) &&
206
                IDebugUIConstants.ID_DEBUG_VIEW.equals(getPresentationContext().getId()) &&
203
                viewer instanceof InternalTreeModelViewer;
207
                viewer instanceof InternalTreeModelViewer;
204
        viewer.addViewerUpdateListener(update_listener);
208
        viewer.addViewerUpdateListener(update_listener);
209
        if (viewer instanceof TreeViewer) {
210
            ((TreeViewer)viewer).addTreeListener(this);
211
        }
212
        expand_stack = Boolean.TRUE.equals( getPresentationContext().getProperty(TCFModel.PROP_EXPAND_ON_SUSPEND) );
205
        Protocol.invokeAndWait(new Runnable() {
213
        Protocol.invokeAndWait(new Runnable() {
206
            public void run() {
214
            public void run() {
207
                assert !installed;
215
                assert !installed;
Lines 226-231 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
226
            }
234
            }
227
        });
235
        });
228
        viewer.removeViewerUpdateListener(update_listener);
236
        viewer.removeViewerUpdateListener(update_listener);
237
        if (viewer instanceof TreeViewer) {
238
            ((TreeViewer)viewer).removeTreeListener(this);
239
        }
229
        super.dispose();
240
        super.dispose();
230
    }
241
    }
231
242
Lines 281-286 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
281
    }
292
    }
282
293
283
    /**
294
    /**
295
     * Returns true if stack trace should be expanded upon a suspended event.
296
     */
297
    boolean getExpandStack() {
298
        return expand_stack;
299
    }
300
    
301
    /**
284
     * Get current value of the view input.
302
     * Get current value of the view input.
285
     * @return view input object.
303
     * @return view input object.
286
     */
304
     */
Lines 566-569 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
566
            launch.removePendingClient(this);
584
            launch.removePendingClient(this);
567
        }
585
        }
568
    }
586
    }
587
    
588
    @Override
589
    public void treeCollapsed(TreeExpansionEvent event) {
590
        updateExpandStack(event, false);
591
    }
592
    
593
    @Override
594
    public void treeExpanded(TreeExpansionEvent event) {
595
        updateExpandStack(event, true);
596
    }
597
    
598
    private void updateExpandStack(TreeExpansionEvent event, final boolean expand) {
599
        if (event.getElement() instanceof TCFNodeExecContext) {
600
            final TCFNodeExecContext node = (TCFNodeExecContext)event.getElement();
601
            if ( !model.equals(node.getModel()) ) return;
602
            Protocol.invokeLater(new Runnable() {
603
                @Override
604
                public void run() {
605
                    Boolean hasStack = node.getStackTrace().checkHasChildren(this);
606
                    if (hasStack == null) return;
607
                    if (hasStack && expand_stack != expand) {
608
                        expand_stack = expand;
609
                        viewer.getDisplay().asyncExec(new Runnable() {
610
                            public void run() {
611
                                getPresentationContext().setProperty(TCFModel.PROP_EXPAND_ON_SUSPEND, expand_stack);
612
                            }
613
                        });
614
                    }
615
                }
616
            });
617
        }
618
    }
569
}
619
}
570
- 

Return to bug 389197