blob: ea9df2020d291b34f1f0c20bdb30c96af2316846 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/*******************************************************************************
* Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.ui.editor.tabs;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.tcf.internal.debug.ui.commands.MemoryMapWidget;
import org.eclipse.tcf.internal.debug.ui.launch.TCFMemoryMapTab;
import org.eclipse.tcf.internal.debug.ui.model.TCFNode;
import org.eclipse.tcf.te.tcf.launch.ui.editor.AbstractTcfLaunchTabContainerEditorPage;
/**
* Customized TCF memory map launch configuration tab implementation to work better
* inside an configuration editor tab.
*/
public class MemoryMapTab extends TCFMemoryMapTab {
// Reference to the parent editor page
private final AbstractTcfLaunchTabContainerEditorPage parentEditorPage;
/**
* Local memory map widget implementation.
*/
protected static class MyMemoryMapWidget extends MemoryMapWidget {
/**
* Constructor
*
* @param composite The parent composite.
* @param node The TCF node
*/
public MyMemoryMapWidget(Composite composite, TCFNode node) {
super(composite, node);
TableViewer viewer = getViewer();
if (viewer != null) {
Table table = viewer.getTable();
Object layoutData = table.getLayoutData();
if (layoutData instanceof GridData) {
((GridData)layoutData).widthHint = SWT.DEFAULT;
}
TableColumn[] columns = table.getColumns();
for (int i = 0; i < columns.length; i++) {
switch (i) {
case 0:
columns[i].setData("widthHint", Integer.valueOf(37)); //$NON-NLS-1$
break;
case 1:
case 2:
columns[i].setData("widthHint", Integer.valueOf(10)); //$NON-NLS-1$
break;
case 4:
columns[i].setData("widthHint", Integer.valueOf(18)); //$NON-NLS-1$
break;
default:
columns[i].setData("widthHint", Integer.valueOf(7)); //$NON-NLS-1$
break;
}
}
TableUtils.adjustTableColumnWidth(viewer);
}
}
}
/**
* Constructor
*
* @param parentEditorPage The parent editor page. Must not be <code>null</code>.
*/
public MemoryMapTab(AbstractTcfLaunchTabContainerEditorPage parentEditorPage) {
super();
Assert.isNotNull(parentEditorPage);
this.parentEditorPage = parentEditorPage;
}
/**
* Returns the parent editor page.
*
* @return The parent editor page.
*/
public final AbstractTcfLaunchTabContainerEditorPage getParentEditorPage() {
return parentEditorPage;
}
/* (non-Javadoc)
* @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#updateLaunchConfigurationDialog()
*/
@Override
protected void updateLaunchConfigurationDialog() {
super.updateLaunchConfigurationDialog();
performApply(AbstractTcfLaunchTabContainerEditorPage.getLaunchConfig(parentEditorPage.getPeerModel(parentEditorPage.getEditorInput())));
parentEditorPage.checkLaunchConfigDirty();
}
/* (non-Javadoc)
* @see org.eclipse.tcf.internal.debug.ui.launch.TCFMemoryMapTab#createWidget(org.eclipse.swt.widgets.Composite, org.eclipse.tcf.internal.debug.ui.model.TCFNode)
*/
@Override
protected MemoryMapWidget createWidget(Composite composite, TCFNode node) {
return new MyMemoryMapWidget(composite, node);
}
}
|