debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/SymbianExceptionsTab.java
author wpaul
Mon, 16 Nov 2009 16:40:03 -0600
changeset 584 ad687ad402fb
permissions -rw-r--r--
merged changes from the 2_4 branch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
584
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     1
package com.nokia.cdt.internal.debug.launch.ui;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     2
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     3
import org.eclipse.core.runtime.CoreException;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     4
import org.eclipse.debug.core.ILaunchConfiguration;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     5
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     6
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     7
import org.eclipse.jface.dialogs.Dialog;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     8
import org.eclipse.swt.SWT;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
     9
import org.eclipse.swt.events.SelectionAdapter;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    10
import org.eclipse.swt.events.SelectionEvent;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    11
import org.eclipse.swt.graphics.Image;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    12
import org.eclipse.swt.layout.GridLayout;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    13
import org.eclipse.swt.widgets.Button;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    14
import org.eclipse.swt.widgets.Combo;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    15
import org.eclipse.swt.widgets.Composite;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    16
import org.eclipse.swt.widgets.Event;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    17
import org.eclipse.swt.widgets.Listener;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    18
import org.eclipse.ui.PlatformUI;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    19
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    20
import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    21
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    22
import cwdbg.PreferenceConstants;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    23
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    24
public class SymbianExceptionsTab extends AbstractLaunchConfigurationTab {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    25
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    26
	private Button panicCheckbox;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    27
	private Combo panicCombo;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    28
	private Button swExcCheckbox;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    29
	private Combo swExcCombo;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    30
	private Button hwExcCheckbox;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    31
	private Combo hwExcCombo;
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    32
	
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    33
	public void createControl(Composite parent) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    34
		Composite comp = new Composite(parent, SWT.NONE);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    35
		setControl(comp);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    36
		
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    37
		GridLayout layout = new GridLayout(2, true);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    38
		comp.setLayout(layout);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    39
		
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    40
		panicCheckbox = new Button(comp, SWT.CHECK);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    41
		panicCheckbox.setText(Messages.getString("SymbianExceptionsTab.Panic")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    42
		panicCheckbox.setToolTipText(Messages.getString("SymbianExceptionsTab.PanicToolTip")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    43
		panicCheckbox.addSelectionListener(new SelectionAdapter() {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    44
			public void widgetSelected(SelectionEvent e) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    45
				if (panicCombo != null) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    46
					panicCombo.setEnabled(panicCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    47
					updateLaunchConfigurationDialog();
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    48
				}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    49
			}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    50
		});
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    51
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    52
		panicCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    53
		panicCombo.add(Messages.getString("SymbianExceptionsTab.DebugThreads")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    54
		panicCombo.add(Messages.getString("SymbianExceptionsTab.AnyThread")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    55
		panicCombo.select(0);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    56
		panicCombo.addListener(SWT.Selection, new Listener() {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    57
			public void handleEvent(Event e) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    58
				updateLaunchConfigurationDialog();
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    59
			}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    60
		});
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    61
		
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    62
		swExcCheckbox = new Button(comp, SWT.CHECK);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    63
		swExcCheckbox.setText(Messages.getString("SymbianExceptionsTab.SwExc")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    64
		swExcCheckbox.setToolTipText(Messages.getString("SymbianExceptionsTab.SwExcToolTip")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    65
		swExcCheckbox.addSelectionListener(new SelectionAdapter() {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    66
			public void widgetSelected(SelectionEvent e) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    67
				if (swExcCombo != null) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    68
					swExcCombo.setEnabled(swExcCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    69
					updateLaunchConfigurationDialog();
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    70
				}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    71
			}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    72
		});
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    73
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    74
		swExcCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    75
		swExcCombo.add(Messages.getString("SymbianExceptionsTab.DebugThreads")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    76
		swExcCombo.add(Messages.getString("SymbianExceptionsTab.AnyThread")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    77
		swExcCombo.select(0);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    78
		swExcCombo.addListener(SWT.Selection, new Listener() {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    79
			public void handleEvent(Event e) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    80
				updateLaunchConfigurationDialog();
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    81
			}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    82
		});
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    83
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    84
		hwExcCheckbox = new Button(comp, SWT.CHECK);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    85
		hwExcCheckbox.setText(Messages.getString("SymbianExceptionsTab.HwExc")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    86
		hwExcCheckbox.setToolTipText(Messages.getString("SymbianExceptionsTab.HwExcToolTip")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    87
		hwExcCheckbox.addSelectionListener(new SelectionAdapter() {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    88
			public void widgetSelected(SelectionEvent e) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    89
				if (hwExcCombo != null) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    90
					hwExcCombo.setEnabled(hwExcCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    91
					updateLaunchConfigurationDialog();
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    92
				}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    93
			}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    94
		});
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    95
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    96
		hwExcCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    97
		hwExcCombo.add(Messages.getString("SymbianExceptionsTab.DebugThreads")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    98
		hwExcCombo.add(Messages.getString("SymbianExceptionsTab.AnyThread")); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
    99
		hwExcCombo.select(0);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   100
		hwExcCombo.addListener(SWT.Selection, new Listener() {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   101
			public void handleEvent(Event e) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   102
				updateLaunchConfigurationDialog();
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   103
			}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   104
		});
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   105
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   106
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), LaunchTabHelpIds.STOP_MODE_EXCEPTIONS);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   107
		Dialog.applyDialogFont(parent);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   108
	}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   109
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   110
	public void initializeFrom(ILaunchConfiguration configuration) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   111
		try {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   112
			panicCheckbox.setSelection(configuration.getAttribute(PreferenceConstants.J_PN_StopModeEnablePanics, true));
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   113
			panicCombo.select(configuration.getAttribute(PreferenceConstants.J_PN_StopModeEnablePanicsForDebugThreadsOnly, true) ? 0 : 1);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   114
			panicCombo.setEnabled(panicCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   115
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   116
			swExcCheckbox.setSelection(configuration.getAttribute(PreferenceConstants.J_PN_StopModeEnableSwExcs, true));
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   117
			swExcCombo.select(configuration.getAttribute(PreferenceConstants.J_PN_StopModeEnableSwExcsForDebugThreadsOnly, true) ? 0 : 1);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   118
			swExcCombo.setEnabled(swExcCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   119
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   120
			hwExcCheckbox.setSelection(configuration.getAttribute(PreferenceConstants.J_PN_StopModeEnableHwExcs, true));
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   121
			hwExcCombo.select(configuration.getAttribute(PreferenceConstants.J_PN_StopModeEnableHwExcsForDebugThreadsOnly, true) ? 0 : 1);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   122
			hwExcCombo.setEnabled(hwExcCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   123
		} catch (CoreException e) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   124
			LaunchPlugin.log(e);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   125
		}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   126
	}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   127
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   128
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   129
		configuration.setAttribute(PreferenceConstants.J_PN_StopModeEnablePanics, panicCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   130
		configuration.setAttribute(PreferenceConstants.J_PN_StopModeEnablePanicsForDebugThreadsOnly, panicCombo.getSelectionIndex() == 0);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   131
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   132
		configuration.setAttribute(PreferenceConstants.J_PN_StopModeEnableSwExcs, swExcCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   133
		configuration.setAttribute(PreferenceConstants.J_PN_StopModeEnableSwExcsForDebugThreadsOnly, swExcCombo.getSelectionIndex() == 0);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   134
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   135
		configuration.setAttribute(PreferenceConstants.J_PN_StopModeEnableHwExcs, hwExcCheckbox.getSelection());
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   136
		configuration.setAttribute(PreferenceConstants.J_PN_StopModeEnableHwExcsForDebugThreadsOnly, hwExcCombo.getSelectionIndex() == 0);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   137
	}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   138
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   139
	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   140
	}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   141
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   142
	public String getName() {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   143
		return Messages.getString("SymbianExceptionsTab.name"); //$NON-NLS-1$
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   144
	}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   145
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   146
	public Image getImage() {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   147
		return LaunchImages.get(LaunchImages.IMG_VIEW_EXCEPTIONS_TAB);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   148
	}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   149
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   150
	@Override
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   151
	public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   152
		super.activated(workingCopy);
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   153
		
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   154
		// forces page to get focus so that help works without having to select some control first.
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   155
		getControl().setFocus();
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   156
	}
ad687ad402fb merged changes from the 2_4 branch.
wpaul
parents:
diff changeset
   157
}