|
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 |
} |