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 (-8 / +9 lines)
Lines 40-46 import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension; Link Here
40
import org.eclipse.debug.core.model.ISourceLocator;
40
import org.eclipse.debug.core.model.ISourceLocator;
41
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
41
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
42
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
42
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
43
import org.eclipse.debug.internal.ui.viewers.model.provisional.ITreeModelViewer;
44
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
43
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
45
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
44
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
46
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation;
45
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation;
Lines 58-63 import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactor Link Here
58
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicy;
57
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicy;
59
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
58
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
60
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
59
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
60
import org.eclipse.debug.internal.ui.viewers.model.provisional.ITreeModelViewer;
61
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider;
61
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider;
62
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
62
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
63
import org.eclipse.debug.ui.DebugUITools;
63
import org.eclipse.debug.ui.DebugUITools;
Lines 86-93 import org.eclipse.swt.widgets.MessageBox; Link Here
86
import org.eclipse.swt.widgets.Shell;
86
import org.eclipse.swt.widgets.Shell;
87
import org.eclipse.tcf.core.Command;
87
import org.eclipse.tcf.core.Command;
88
import org.eclipse.tcf.debug.ui.ITCFModel;
88
import org.eclipse.tcf.debug.ui.ITCFModel;
89
import org.eclipse.tcf.debug.ui.ITCFSourceDisplay;
90
import org.eclipse.tcf.debug.ui.ITCFPresentationProvider;
89
import org.eclipse.tcf.debug.ui.ITCFPresentationProvider;
90
import org.eclipse.tcf.debug.ui.ITCFSourceDisplay;
91
import org.eclipse.tcf.internal.debug.actions.TCFAction;
91
import org.eclipse.tcf.internal.debug.actions.TCFAction;
92
import org.eclipse.tcf.internal.debug.launch.TCFSourceLookupDirector;
92
import org.eclipse.tcf.internal.debug.launch.TCFSourceLookupDirector;
93
import org.eclipse.tcf.internal.debug.launch.TCFSourceLookupParticipant;
93
import org.eclipse.tcf.internal.debug.launch.TCFSourceLookupParticipant;
Lines 158-164 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
    /**
161
   /**
162
     * A dummy editor input to open the disassembly view as editor.
162
     * A dummy editor input to open the disassembly view as editor.
163
     */
163
     */
164
    public static class DisassemblyEditorInput implements IEditorInput {
164
    public static class DisassemblyEditorInput implements IEditorInput {
Lines 295-302 public class TCFModel implements ITCFModel, IElementContentProvider, IElementLab Link Here
295
295
296
    private final Map<String,Object> context_map = new HashMap<String,Object>();
296
    private final Map<String,Object> context_map = new HashMap<String,Object>();
297
297
298
    private final Set<String> expanded_nodes = new HashSet<String>();
299
300
    private final Map<IWorkbenchPart,TCFNode> pins = new HashMap<IWorkbenchPart,TCFNode>();
298
    private final Map<IWorkbenchPart,TCFNode> pins = new HashMap<IWorkbenchPart,TCFNode>();
301
    private final Map<IWorkbenchPart,TCFSnapshot> locks = new HashMap<IWorkbenchPart,TCFSnapshot>();
299
    private final Map<IWorkbenchPart,TCFSnapshot> locks = new HashMap<IWorkbenchPart,TCFSnapshot>();
302
    private final Map<IWorkbenchPart,Integer> lock_policy = new HashMap<IWorkbenchPart,Integer>();
300
    private final Map<IWorkbenchPart,Integer> lock_policy = new HashMap<IWorkbenchPart,Integer>();
Lines 914-920 public class TCFModel implements ITCFModel, IElementContentProvider, IElementLab Link Here
914
            action_results.remove(id);
912
            action_results.remove(id);
915
            Object o = context_map.remove(id);
913
            Object o = context_map.remove(id);
916
            if (o instanceof CreateNodeRunnable) ((CreateNodeRunnable)o).onContextRemoved();
914
            if (o instanceof CreateNodeRunnable) ((CreateNodeRunnable)o).onContextRemoved();
917
            expanded_nodes.remove(id);
915
            for (TCFModelProxy proxy : model_proxies.values()) {
916
                proxy.clearAutoExpandStack(id);
917
            }
918
            
918
            if (mem_blocks_update != null) mem_blocks_update.changeset.remove(id);
919
            if (mem_blocks_update != null) mem_blocks_update.changeset.remove(id);
919
        }
920
        }
920
921
Lines 1529-1542 public class TCFModel implements ITCFModel, IElementContentProvider, IElementLab Link Here
1529
        if (node.isDisposed()) return;
1530
        if (node.isDisposed()) return;
1530
        runSuspendTrigger(node);
1531
        runSuspendTrigger(node);
1531
        if (reason == null) return;
1532
        if (reason == null) return;
1532
        if (reason.equals(IRunControl.REASON_USER_REQUEST)) return;
1533
        for (TCFModelProxy proxy : model_proxies.values()) {
1533
        for (TCFModelProxy proxy : model_proxies.values()) {
1534
            if (proxy.getPresentationContext().getId().equals(IDebugUIConstants.ID_DEBUG_VIEW)) {
1534
            if (proxy.getPresentationContext().getId().equals(IDebugUIConstants.ID_DEBUG_VIEW)) {
1535
                if (proxy.getAutoExpandNode(node.id, reason.equals(IRunControl.REASON_USER_REQUEST))) proxy.expand(node);
1536
                if (reason.equals(IRunControl.REASON_USER_REQUEST)) continue;
1535
                proxy.setSelection(node);
1537
                proxy.setSelection(node);
1536
                if (reason.equals(IRunControl.REASON_STEP)) continue;
1538
                if (reason.equals(IRunControl.REASON_STEP)) continue;
1537
                if (reason.equals(IRunControl.REASON_CONTAINER)) continue;
1539
                if (reason.equals(IRunControl.REASON_CONTAINER)) continue;
1538
                if (delay_stack_update_until_last_step && launch.getContextActionsCount(node.id) != 0) continue;
1540
                if (delay_stack_update_until_last_step && launch.getContextActionsCount(node.id) != 0) continue;
1539
                if (expanded_nodes.add(node.id)) proxy.expand(node);
1540
            }
1541
            }
1541
            if (reason.equals(IRunControl.REASON_BREAKPOINT)) {
1542
            if (reason.equals(IRunControl.REASON_BREAKPOINT)) {
1542
                IWorkbenchPart part = proxy.getPresentationContext().getPart();
1543
                IWorkbenchPart part = proxy.getPresentationContext().getPart();
(-)a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelProxy.java (-15 / +82 lines)
Lines 11-26 Link Here
11
package org.eclipse.tcf.internal.debug.ui.model;
11
package org.eclipse.tcf.internal.debug.ui.model;
12
12
13
import java.util.Arrays;
13
import java.util.Arrays;
14
import java.util.Collections;
14
import java.util.Comparator;
15
import java.util.Comparator;
15
import java.util.HashMap;
16
import java.util.HashMap;
16
import java.util.HashSet;
17
import java.util.HashSet;
17
import java.util.LinkedList;
18
import java.util.LinkedList;
18
import java.util.Map;
19
import java.util.Map;
19
import java.util.Set;
20
import java.util.Set;
21
import java.util.TreeMap;
20
22
21
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer;
24
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
23
import org.eclipse.debug.internal.ui.viewers.model.InternalVirtualTreeModelViewer;
24
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
25
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
25
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
26
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
26
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
27
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
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;
33
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
33
import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
34
import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
34
import org.eclipse.debug.ui.IDebugUIConstants;
35
import org.eclipse.debug.ui.IDebugUIConstants;
36
import org.eclipse.jface.viewers.ITreeViewerListener;
37
import org.eclipse.jface.viewers.TreeExpansionEvent;
35
import org.eclipse.jface.viewers.TreePath;
38
import org.eclipse.jface.viewers.TreePath;
39
import org.eclipse.jface.viewers.TreeViewer;
36
import org.eclipse.swt.graphics.Device;
40
import org.eclipse.swt.graphics.Device;
37
import org.eclipse.swt.widgets.Display;
41
import org.eclipse.swt.widgets.Display;
38
import org.eclipse.tcf.internal.debug.model.TCFLaunch;
42
import org.eclipse.tcf.internal.debug.model.TCFLaunch;
Lines 44-53 import org.eclipse.tcf.protocol.Protocol; Link Here
44
 * Model proxy listeners are debuggers views.
48
 * Model proxy listeners are debuggers views.
45
 */
49
 */
46
@SuppressWarnings("restriction")
50
@SuppressWarnings("restriction")
47
public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Runnable {
51
public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Runnable, ITreeViewerListener {
48
52
49
    private static final TCFNode[] EMPTY_NODE_ARRAY = new TCFNode[0];
53
    private static final TCFNode[] EMPTY_NODE_ARRAY = new TCFNode[0];
50
54
    private static boolean is_linux = "Linux".equals(System.getProperty("os.name"));
51
    private final TCFModel model;
55
    private final TCFModel model;
52
    private final TCFLaunch launch;
56
    private final TCFLaunch launch;
53
    private final Display display;
57
    private final Display display;
Lines 57-62 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
57
    private final Set<ModelDelta> content_deltas = new HashSet<ModelDelta>();
61
    private final Set<ModelDelta> content_deltas = new HashSet<ModelDelta>();
58
    private final LinkedList<TCFNode> selection = new LinkedList<TCFNode>();
62
    private final LinkedList<TCFNode> selection = new LinkedList<TCFNode>();
59
    private final Set<String> auto_expand_set = new HashSet<String>();
63
    private final Set<String> auto_expand_set = new HashSet<String>();
64
    private Map<String, Boolean> expanded_nodes = Collections.synchronizedMap(new TreeMap<String, Boolean>());
60
65
61
    private ITreeModelViewer viewer;
66
    private ITreeModelViewer viewer;
62
    private boolean posted;
67
    private boolean posted;
Lines 200-207 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
200
        super.initialize(viewer);
205
        super.initialize(viewer);
201
        enable_auto_expand =
206
        enable_auto_expand =
202
                IDebugUIConstants.ID_DEBUG_VIEW.equals(getPresentationContext().getId()) &&
207
                IDebugUIConstants.ID_DEBUG_VIEW.equals(getPresentationContext().getId()) &&
203
                viewer instanceof InternalTreeModelViewer;
208
                viewer instanceof IInternalTreeModelViewer;
204
        viewer.addViewerUpdateListener(update_listener);
209
        if (is_linux) {
210
            viewer.addViewerUpdateListener(update_listener);
211
        }
212
        if (viewer instanceof TreeViewer) {
213
            ((TreeViewer)viewer).addTreeListener(this);
214
        }
205
        Protocol.invokeAndWait(new Runnable() {
215
        Protocol.invokeAndWait(new Runnable() {
206
            public void run() {
216
            public void run() {
207
                assert !installed;
217
                assert !installed;
Lines 225-231 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
225
                disposed = true;
235
                disposed = true;
226
            }
236
            }
227
        });
237
        });
228
        viewer.removeViewerUpdateListener(update_listener);
238
        if (is_linux) {
239
            viewer.removeViewerUpdateListener(update_listener);
240
        }
241
        if (viewer instanceof TreeViewer) {
242
            ((TreeViewer)viewer).removeTreeListener(this);
243
        }
229
        super.dispose();
244
        super.dispose();
230
    }
245
    }
231
246
Lines 281-286 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
281
    }
296
    }
282
297
283
    /**
298
    /**
299
     * Returns true if node should be be expanded upon the first suspended event.  
300
     * If the given context ID is seen for the first time, the node should be
301
     * expanded unless the event was caused by user request.  In the latter case
302
     * the node should not be expanded.
303
     * <p>
304
     * Note: As a workaround for bug 208939 on Linux, the auto-expansion is
305
     * enabled even after the first suspend event.  User collapse/expand actions
306
     * are tracked to determine whether a given node should be expanded.
307
     * </p>
308
     * @param id Id of execution node to check.
309
     * @param user_request Flag whether the state is requested in response 
310
     * to a user-requested suspend event.
311
     */
312
    boolean getAutoExpandNode(String id, boolean user_request) {
313
        Boolean expand = null;
314
        synchronized(expanded_nodes) {
315
            expand = expanded_nodes.get(id);
316
            if (expand == null) {
317
                if (user_request) {
318
                    expand = Boolean.FALSE;
319
                } else {
320
                    expand = Boolean.TRUE;
321
                    expanded_nodes.put(id, is_linux);
322
                }
323
            }
324
        }
325
        return expand;
326
    }
327
    
328
    /**
329
     * Returns true if stack trace should be expanded upon a suspended event.
330
     */
331
    void clearAutoExpandStack(String id) {
332
        expanded_nodes.remove(id) ;
333
    }
334
    
335
    /**
284
     * Get current value of the view input.
336
     * Get current value of the view input.
285
     * @return view input object.
337
     * @return view input object.
286
     */
338
     */
Lines 438-445 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
438
            asyncExec(new Runnable() {
490
            asyncExec(new Runnable() {
439
                public void run() {
491
                public void run() {
440
                    if (save_expand_state != null && save_expand_state.size() > 0) {
492
                    if (save_expand_state != null && save_expand_state.size() > 0) {
441
                        if (viewer instanceof InternalTreeModelViewer) {
493
                        if (viewer instanceof IInternalTreeModelViewer) {
442
                            InternalTreeModelViewer tree_viwer = (InternalTreeModelViewer)viewer;
494
                            IInternalTreeModelViewer tree_viwer = (IInternalTreeModelViewer)viewer;
443
                            final Set<String> expanded = new HashSet<String>();
495
                            final Set<String> expanded = new HashSet<String>();
444
                            for (TCFNode node : save_expand_state) {
496
                            for (TCFNode node : save_expand_state) {
445
                                if (tree_viwer.getExpandedState(node)) expanded.add(node.id);
497
                                if (tree_viwer.getExpandedState(node)) expanded.add(node.id);
Lines 471-481 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
471
                asyncExec(new Runnable() {
523
                asyncExec(new Runnable() {
472
                    boolean found;
524
                    boolean found;
473
                    public void run() {
525
                    public void run() {
474
                        if (viewer instanceof InternalTreeModelViewer) {
526
                        if (viewer instanceof IInternalTreeModelViewer) {
475
                            found = ((InternalTreeModelViewer)viewer).findElementIndex(TreePath.EMPTY, launch) >= 0;
527
                            found = ((IInternalTreeModelViewer)viewer).findElementIndex(TreePath.EMPTY, launch) >= 0;
476
                        }
477
                        else if (viewer instanceof InternalVirtualTreeModelViewer) {
478
                            found = ((InternalVirtualTreeModelViewer)viewer).findElementIndex(TreePath.EMPTY, launch) >= 0;
479
                        }
528
                        }
480
                        Protocol.invokeLater(new Runnable() {
529
                        Protocol.invokeLater(new Runnable() {
481
                            public void run() {
530
                            public void run() {
Lines 566-569 public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru Link Here
566
            launch.removePendingClient(this);
615
            launch.removePendingClient(this);
567
        }
616
        }
568
    }
617
    }
618
    
619
    @Override
620
    public void treeCollapsed(TreeExpansionEvent event) {
621
        updateExpandStack(event, false);
622
    }
623
    
624
    @Override
625
    public void treeExpanded(TreeExpansionEvent event) {
626
        updateExpandStack(event, true);
627
    }
628
    
629
    private void updateExpandStack(TreeExpansionEvent event, final boolean expand) {
630
        if (event.getElement() instanceof TCFNodeExecContext) {
631
            TCFNodeExecContext node = (TCFNodeExecContext)event.getElement();
632
            if ( model == node.getModel() ) {
633
                expanded_nodes.put(node.id, expand);
634
            };
635
        }
636
    }
569
}
637
}
570
- 

Return to bug 389197