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 262266 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java (+1 lines)
Lines 76-81 Link Here
76
    public static final String DEBUG_VIEW_MODE_COMPACT_ACTION = PREFIX + "debug_view_mode_compact_action_context"; //$NON-NLS-1$
76
    public static final String DEBUG_VIEW_MODE_COMPACT_ACTION = PREFIX + "debug_view_mode_compact_action_context"; //$NON-NLS-1$
77
    public static final String NEXT_THREAD_NAVIGATE_ACTION = PREFIX + "next_thread_navigate_action_context"; //$NON-NLS-1$
77
    public static final String NEXT_THREAD_NAVIGATE_ACTION = PREFIX + "next_thread_navigate_action_context"; //$NON-NLS-1$
78
    public static final String PREVIOUS_THREAD_NAVIGATE_ACTION = PREFIX + "previous_thread_navigate_action_context"; //$NON-NLS-1$
78
    public static final String PREVIOUS_THREAD_NAVIGATE_ACTION = PREFIX + "previous_thread_navigate_action_context"; //$NON-NLS-1$
79
    public static final String DEBUG_VIEW_DROP_DOWN_AUTOEXPAND_ACTION = PREFIX + "debug_view_drop_down_autoexpand_action_context"; //$NON-NLS-1$
79
80
80
	// Views
81
	// Views
81
	public static final String DEBUG_VIEW = PREFIX + "debug_view_context"; //$NON-NLS-1$
82
	public static final String DEBUG_VIEW = PREFIX + "debug_view_context"; //$NON-NLS-1$
(-)ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java (-1 / +5 lines)
Lines 30-36 Link Here
30
    public static String DebugViewModeAction_Compact_label;
30
    public static String DebugViewModeAction_Compact_label;
31
    public static String DebugViewModeAction_Compact_tooltip;
31
    public static String DebugViewModeAction_Compact_tooltip;
32
    public static String DebugViewModeAction_Compact_description;
32
    public static String DebugViewModeAction_Compact_description;
33
    
33
34
    public static String BreadcrumbDropDownAutoExpandAction_label;
35
    public static String BreadcrumbDropDownAutoExpandAction_tooltip;
36
    public static String BreadcrumbDropDownAutoExpandAction_description;
37
34
	static {
38
	static {
35
		// load message values from bundle file
39
		// load message values from bundle file
36
		NLS.initializeMessages(BUNDLE_NAME, LaunchViewMessages.class);
40
		NLS.initializeMessages(BUNDLE_NAME, LaunchViewMessages.class);
(-)ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties (+4 lines)
Lines 24-26 Link Here
24
DebugViewModeAction_Compact_label=Compact
24
DebugViewModeAction_Compact_label=Compact
25
DebugViewModeAction_Compact_tooltip=Compact
25
DebugViewModeAction_Compact_tooltip=Compact
26
DebugViewModeAction_Compact_description=Always show the compact viewer
26
DebugViewModeAction_Compact_description=Always show the compact viewer
27
28
BreadcrumbDropDownAutoExpandAction_label=Auto-Expand Compact Selector
29
BreadcrumbDropDownAutoExpandAction_tooltip=Auto-Expand Compact Selector
30
BreadcrumbDropDownAutoExpandAction_description=In the compact mode selection viewer, automatically expand elements to reveal full selection in view.
(-)ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java (-1 / +51 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.views.launch;
11
package org.eclipse.debug.internal.ui.views.launch;
12
12
13
import java.util.ArrayList;
14
13
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IProgressMonitor;
14
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Status;
17
import org.eclipse.core.runtime.Status;
Lines 370-375 Link Here
370
                
372
                
371
                ModelDelta delta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
373
                ModelDelta delta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
372
                fTreeViewer.saveElementState(TreePath.EMPTY, delta);
374
                fTreeViewer.saveElementState(TreePath.EMPTY, delta);
375
                
376
                // If we do not want to expand the elements in the drop-down.
377
                // Prune the delta to only select the element in the 
378
                // top-most list.
379
                if (!fView.getBreadcrumbDropDownAutoExpand()) {
380
                    final ModelDelta prunedDelta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
381
                    delta.accept(new IModelDeltaVisitor() {
382
                        ModelDelta copy = prunedDelta;
383
                        public boolean visit(IModelDelta delta, int depth) {
384
                            TreePath deltaPath = getViewerTreePath(delta);
385
                            if (deltaPath.getSegmentCount() == 0) {
386
                                // skip copying the root element, only copy it's child count
387
                                copy.setChildCount(delta.getChildCount());
388
                                return true;
389
                            } else if (deltaPath.getSegmentCount() != 0 && path.startsWith(deltaPath, null) ) {
390
                                copy = copy.addNode(
391
                                    delta.getElement(), delta.getIndex(), delta.getFlags(), delta.getChildCount());
392
                                return true;
393
                            } else if (deltaPath.startsWith(path, null)) {
394
                                if ( (delta.getFlags() & IModelDelta.SELECT) != 0) {
395
                                    copy.setFlags(IModelDelta.SELECT);
396
                                    return false;
397
                                }
398
                            }
399
                            return true;
400
                        }
401
                        
402
                        private TreePath getViewerTreePath(IModelDelta node) {
403
                            ArrayList list = new ArrayList();
404
                            IModelDelta parentDelta = node.getParentDelta();
405
                            while (parentDelta != null) {
406
                                list.add(0, node.getElement());
407
                                node = parentDelta;
408
                                parentDelta = node.getParentDelta();
409
                            }
410
                            return new TreePath(list.toArray());
411
                        }
412
                    });
413
                    delta = prunedDelta;
414
                }
415
                
373
                fDropDownViewer.updateViewer(delta);
416
                fDropDownViewer.updateViewer(delta);
374
                
417
                
375
                fDropDownViewer.addLabelUpdateListener(new ILabelUpdateListener() {
418
                fDropDownViewer.addLabelUpdateListener(new ILabelUpdateListener() {
Lines 429-436 Link Here
429
                            return true;
472
                            return true;
430
                        }
473
                        }
431
                    });
474
                    });
475
476
                    // If elements in the drop-down were auto-expanded, then collapse the drop-down's sub tree in the 
477
                    // full viewer.  After the drop-down's full expansion state is saved out to the tree viewer, the
478
                    // tree viewer will accurately reflect the state changes made by the user. 
479
                    if (fView.getBreadcrumbDropDownAutoExpand()) {
480
                        fTreeViewer.collapseToLevel(rootPath, TreeViewer.ALL_LEVELS);
481
                    }                    
432
                    
482
                    
433
                    // Save the state of the drop-down into the tree viewer.
483
                    // Save the state of the drop-down out into the tree viewer.
434
                    fTreeViewer.updateViewer(rootDelta);
484
                    fTreeViewer.updateViewer(rootDelta);
435
                    fViewer.setSelection(StructuredSelection.EMPTY);
485
                    fViewer.setSelection(StructuredSelection.EMPTY);
436
                    site.close();
486
                    site.close();
(-)ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java (-1 / +132 lines)
Lines 13-18 Link Here
13
package org.eclipse.debug.internal.ui.views.launch;
13
package org.eclipse.debug.internal.ui.views.launch;
14
14
15
15
16
import java.io.ByteArrayInputStream;
17
import java.io.ByteArrayOutputStream;
18
import java.io.IOException;
19
import java.io.InputStreamReader;
20
import java.io.OutputStreamWriter;
16
import java.util.ArrayList;
21
import java.util.ArrayList;
17
import java.util.Iterator;
22
import java.util.Iterator;
18
23
Lines 109-114 Link Here
109
import org.eclipse.ui.IWorkbenchPartReference;
114
import org.eclipse.ui.IWorkbenchPartReference;
110
import org.eclipse.ui.IWorkbenchWindow;
115
import org.eclipse.ui.IWorkbenchWindow;
111
import org.eclipse.ui.PartInitException;
116
import org.eclipse.ui.PartInitException;
117
import org.eclipse.ui.WorkbenchException;
118
import org.eclipse.ui.XMLMemento;
112
import org.eclipse.ui.actions.ActionFactory;
119
import org.eclipse.ui.actions.ActionFactory;
113
import org.eclipse.ui.actions.SelectionListenerAction;
120
import org.eclipse.ui.actions.SelectionListenerAction;
114
import org.eclipse.ui.dialogs.PropertyDialogAction;
121
import org.eclipse.ui.dialogs.PropertyDialogAction;
Lines 183-192 Link Here
183
     */
190
     */
184
    private DebugViewModeAction[] fDebugViewModeActions;
191
    private DebugViewModeAction[] fDebugViewModeActions;
185
192
193
    /**
194
     * Action that controls the breadcrumb drop-down auto-expand behavior.
195
     * 
196
     * @since 3.5
197
     */
198
    private BreadcrumbDropDownAutoExpandAction fBreadcrumbDropDownAutoExpandAction;
199
    
200
    /**
201
     * Preference name for the view's memento.
202
     * 
203
     * @since 3.5
204
     */
205
    private String PREF_STATE_MEMENTO = "pref_state_memento."; //$NON-NLS-1$
186
206
207
    /**
208
     * Key for a view preference for whether the elements in breadcrumb's
209
     * drop-down viewer should be automatically expanded.
210
     * 
211
     * @since 3.5
212
     */
213
    private static final String BREADCRUMB_DROPDOWN_AUTO_EXPAND = DebugUIPlugin.getUniqueIdentifier() + ".BREADCRUMB_DROPDOWN_AUTO_EXPAND"; //$NON-NLS-1$
214
    
215
    /**
216
     * Preference for whether the elements in breadcrumb's
217
     * drop-down viewer should be automatically expanded.
218
     * 
219
     * @since 3.5
220
     */
221
    private boolean fBreadcrumbDropDownAutoExpand = false;
222
    
187
	/**
223
	/**
188
	 * Page-book page for the breadcrumb viewer.  This page is activated in 
224
	 * Page-book page for the breadcrumb viewer.  This page is activated in 
189
	 * Debug view when the height of the view is reduced to just one line. 
225
	 * Debug view when the height of the view is reduced to just one line. 
226
     * 
227
     * @since 3.5
190
	 */
228
	 */
191
	private class BreadcrumbPage extends Page {
229
	private class BreadcrumbPage extends Page {
192
230
Lines 621-632 Link Here
621
        fDebugViewModeActions[0] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO, parent);
659
        fDebugViewModeActions[0] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO, parent);
622
        fDebugViewModeActions[1] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL, parent);
660
        fDebugViewModeActions[1] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL, parent);
623
        fDebugViewModeActions[2] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_COMPACT, parent);
661
        fDebugViewModeActions[2] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_COMPACT, parent);
662
        fBreadcrumbDropDownAutoExpandAction = new BreadcrumbDropDownAutoExpandAction(this);
663
        
624
        viewMenu.add(new Separator());
664
        viewMenu.add(new Separator());
625
        final MenuManager modeSubmenu = new MenuManager(LaunchViewMessages.LaunchView_ViewModeMenu_label);
665
        final MenuManager modeSubmenu = new MenuManager(LaunchViewMessages.LaunchView_ViewModeMenu_label);
626
        modeSubmenu.setRemoveAllWhenShown(true);
666
        modeSubmenu.setRemoveAllWhenShown(true);
627
        modeSubmenu.add(fDebugViewModeActions[0]);
667
        modeSubmenu.add(fDebugViewModeActions[0]);
628
        modeSubmenu.add(fDebugViewModeActions[1]);
668
        modeSubmenu.add(fDebugViewModeActions[1]);
629
        modeSubmenu.add(fDebugViewModeActions[2]);
669
        modeSubmenu.add(fDebugViewModeActions[2]);
670
        modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
630
        viewMenu.add(modeSubmenu);
671
        viewMenu.add(modeSubmenu);
631
        viewMenu.add(new Separator());
672
        viewMenu.add(new Separator());
632
        
673
        
Lines 635-642 Link Here
635
                modeSubmenu.add(fDebugViewModeActions[0]);
676
                modeSubmenu.add(fDebugViewModeActions[0]);
636
                modeSubmenu.add(fDebugViewModeActions[1]);
677
                modeSubmenu.add(fDebugViewModeActions[1]);
637
                modeSubmenu.add(fDebugViewModeActions[2]);
678
                modeSubmenu.add(fDebugViewModeActions[2]);
679
                modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
638
           }
680
           }
639
        });
681
        });
682
        
640
    }
683
    }
641
684
642
 
685
 
Lines 825-836 Link Here
825
		site.getWorkbenchWindow().addPerspectiveListener(this);
868
		site.getWorkbenchWindow().addPerspectiveListener(this);
826
	}
869
	}
827
	
870
	
871
	private void preferenceInit(IViewSite site) {
872
        PREF_STATE_MEMENTO = PREF_STATE_MEMENTO + site.getId();
873
        IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
874
        String string = store.getString(PREF_STATE_MEMENTO);
875
        if(string.length() > 0) {
876
            ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes());
877
            InputStreamReader reader = new InputStreamReader(bin);
878
            try {
879
                XMLMemento stateMemento = XMLMemento.createReadRoot(reader);
880
                setMemento(stateMemento);
881
            } catch (WorkbenchException e) {
882
            } finally {
883
                try {
884
                    reader.close();
885
                    bin.close();
886
                } catch (IOException e){}
887
            }
888
        }
889
        IMemento mem = getMemento();
890
891
        if (mem != null) {
892
            Boolean auto = mem.getBoolean(BREADCRUMB_DROPDOWN_AUTO_EXPAND);
893
            if(auto != null) {
894
                setBreadcrumbDropDownAutoExpand(auto.booleanValue());
895
            } 
896
        }
897
	}
898
	
828
	/* (non-Javadoc)
899
	/* (non-Javadoc)
829
	 * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite)
900
	 * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite)
830
	 */
901
	 */
831
	public void init(IViewSite site) throws PartInitException {
902
	public void init(IViewSite site) throws PartInitException {
832
		super.init(site);
903
		super.init(site);
833
		commonInit(site);
904
		commonInit(site);
905
		preferenceInit(site);
834
	}
906
	}
835
907
836
	/* (non-Javadoc)
908
	/* (non-Javadoc)
Lines 839-846 Link Here
839
	public void init(IViewSite site, IMemento memento) throws PartInitException {
911
	public void init(IViewSite site, IMemento memento) throws PartInitException {
840
		super.init(site, memento);
912
		super.init(site, memento);
841
		commonInit(site);
913
		commonInit(site);
914
        preferenceInit(site);
842
	}
915
	}
843
		
916
917
    /* (non-Javadoc)
918
     * @see org.eclipse.ui.part.PageBookView#partDeactivated(org.eclipse.ui.IWorkbenchPart)
919
     */
920
    public void partDeactivated(IWorkbenchPart part) {
921
        String id = part.getSite().getId();
922
        if (id.equals(getSite().getId())) {
923
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
924
            OutputStreamWriter writer = new OutputStreamWriter(bout);
925
926
            try {
927
                XMLMemento memento = XMLMemento.createWriteRoot("DebugViewMemento"); //$NON-NLS-1$
928
                saveViewerState(memento);
929
                memento.save(writer);
930
931
                IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
932
                String xmlString = bout.toString();
933
                store.putValue(PREF_STATE_MEMENTO, xmlString);
934
            } catch (IOException e) {
935
            } finally {
936
                try {
937
                    writer.close();
938
                    bout.close();
939
                } catch (IOException e) {
940
                }
941
            }
942
        }
943
        super.partDeactivated(part);
944
    }
945
946
    /**
947
     * Saves the current state of the viewer
948
     * @param memento the memento to write the viewer state into
949
     */
950
    public void saveViewerState(IMemento memento) {
951
        memento.putBoolean(BREADCRUMB_DROPDOWN_AUTO_EXPAND, getBreadcrumbDropDownAutoExpand());
952
    }
953
	
844
	/* (non-Javadoc)
954
	/* (non-Javadoc)
845
	 * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
955
	 * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
846
	 */
956
	 */
Lines 1260-1263 Link Here
1260
    boolean isBreadcrumbVisible() {
1370
    boolean isBreadcrumbVisible() {
1261
        return fBreadcrumbPage.equals(getCurrentPage());
1371
        return fBreadcrumbPage.equals(getCurrentPage());
1262
    }
1372
    }
1373
    
1374
    /**
1375
     * Returns whether the elements in breadcrumb's drop-down viewer should be 
1376
     * automatically expanded.
1377
     * 
1378
     * @since 3.5
1379
     */
1380
    boolean getBreadcrumbDropDownAutoExpand() {
1381
        return fBreadcrumbDropDownAutoExpand;
1382
    }
1383
    
1384
    /**
1385
     * Sets whether the elements in breadcrumb's drop-down viewer should be 
1386
     * automatically expanded.
1387
     * 
1388
     * @since 3.5
1389
     */
1390
    void setBreadcrumbDropDownAutoExpand(boolean expand) {
1391
        fBreadcrumbDropDownAutoExpand = expand;
1392
    }
1393
1263
}
1394
}
(-)ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java (+9 lines)
Lines 272-282 Link Here
272
272
273
    /**
273
    /**
274
     * The layout mode in Debug view.
274
     * The layout mode in Debug view.
275
     * 
276
     * @since 3.5
275
     */
277
     */
276
    public static final String DEBUG_VIEW_MODE = "org.eclispe.debug.ui.Debug_view.mode"; //$NON-NLS-1$
278
    public static final String DEBUG_VIEW_MODE = "org.eclispe.debug.ui.Debug_view.mode"; //$NON-NLS-1$
277
    public static final String DEBUG_VIEW_MODE_AUTO = "Debug_view.mode.auto"; //$NON-NLS-1$
279
    public static final String DEBUG_VIEW_MODE_AUTO = "Debug_view.mode.auto"; //$NON-NLS-1$
278
    public static final String DEBUG_VIEW_MODE_COMPACT = "Debug_view.mode.compact"; //$NON-NLS-1$
280
    public static final String DEBUG_VIEW_MODE_COMPACT = "Debug_view.mode.compact"; //$NON-NLS-1$
279
    public static final String DEBUG_VIEW_MODE_FULL = "Debug_view.mode.full"; //$NON-NLS-1$
281
    public static final String DEBUG_VIEW_MODE_FULL = "Debug_view.mode.full"; //$NON-NLS-1$
282
    
283
    /**
284
     * Preference whether to auto-expand in the breadcrumb drop-down viewers. 
285
     * 
286
     * @since 3.5
287
     */
288
    public static final String DEBUG_VIEW_BREADCRUMB_AUTO_EXPAND_DROP_DOWN = "org.eclispe.debug.ui.Debug_view.Breadcrumb.dropDownAutoexpand"; //$NON-NLS-1$
280
}
289
}
281
290
282
291
(-)ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java (+55 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.views.launch;
12
13
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
14
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
15
import org.eclipse.jface.action.Action;
16
import org.eclipse.ui.PlatformUI;
17
18
/**
19
 * Action that controls the preference for whether elements should be 
20
 * automatically expanded in the breadcrumb drop down viewers.
21
 * 
22
 * @since 3.5
23
 */
24
class BreadcrumbDropDownAutoExpandAction extends Action {
25
26
	private final LaunchView fLaunchView;
27
28
	/**
29
	 * Creates a new action to set the debug view mode.
30
	 * 
31
	 * @param view Reference to the debug view.
32
	 * @param mode The mode to be set by this action.
33
	 * @param parent The view's parent control used to calculate view size
34
     * in auto mode.
35
	 */
36
	public BreadcrumbDropDownAutoExpandAction(LaunchView view) {
37
		super(IInternalDebugCoreConstants.EMPTY_STRING, AS_CHECK_BOX);
38
		fLaunchView = view;
39
				
40
		setText(LaunchViewMessages.BreadcrumbDropDownAutoExpandAction_label);
41
		setToolTipText(LaunchViewMessages.BreadcrumbDropDownAutoExpandAction_tooltip);  
42
		setDescription(LaunchViewMessages.BreadcrumbDropDownAutoExpandAction_description);  
43
		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_VIEW_DROP_DOWN_AUTOEXPAND_ACTION);
44
		
45
		setChecked(fLaunchView.getBreadcrumbDropDownAutoExpand());
46
	}
47
48
	/* (non-Javadoc)
49
	 * @see org.eclipse.jface.action.IAction#run()
50
	 */
51
	public void run() {
52
		fLaunchView.setBreadcrumbDropDownAutoExpand(isChecked()); 
53
	}	
54
}
55

Return to bug 262266