View | Details | Raw Unified | Return to bug 74559 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (-1 / +1 lines)
Lines 328-335 Link Here
328
BreakpointWorkingSet.name=Breakpoint
328
BreakpointWorkingSet.name=Breakpoint
329
329
330
memoryRenderingsExtensionPointName = Memory Renderings
330
memoryRenderingsExtensionPointName = Memory Renderings
331
SetDefaultColumnSizeActionName =Set Default Column Size ...
332
SetPaddedStrActionName = Set Padded String ...
331
SetPaddedStrActionName = Set Padded String ...
332
TableRenderingPrefActionName = Table Renderings Preferences...
333
333
334
DropToFrameAction.label=Drop to Frame
334
DropToFrameAction.label=Drop to Frame
335
DropToFrameAction.tooltip=Drop to Frame
335
DropToFrameAction.tooltip=Drop to Frame
(-)plugin.xml (-8 / +8 lines)
Lines 883-888 Link Here
883
               style="toggle"
883
               style="toggle"
884
               id="org.eclipse.debug.ui.linkrenderingpanes"/>
884
               id="org.eclipse.debug.ui.linkrenderingpanes"/>
885
         <action
885
         <action
886
               class="org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingPrefAction"
887
               helpContextId="TableRenderingPrefAction_context"
888
               id="org.eclipse.debug.ui.tablerendering.preferencesaction"
889
               label="%TableRenderingPrefActionName"
890
               menubarPath="additions"
891
               style="push"
892
               tooltip="%TableRenderingPrefActionName"/>
893
         <action
886
               disabledIcon="icons/full/dlcl16/det_pane_right.gif"
894
               disabledIcon="icons/full/dlcl16/det_pane_right.gif"
887
               hoverIcon="icons/full/elcl16/det_pane_right.gif"
895
               hoverIcon="icons/full/elcl16/det_pane_right.gif"
888
               toolbarPath="RenderingPanesGroup"
896
               toolbarPath="RenderingPanesGroup"
Lines 893-906 Link Here
893
               style="toggle"
901
               style="toggle"
894
               id="org.eclipse.debug.ui.togglesplitpane"/>
902
               id="org.eclipse.debug.ui.togglesplitpane"/>
895
         <action
903
         <action
896
               helpContextId="DefaultColumnSizePrefAction_context"
897
               label="%SetDefaultColumnSizeActionName"
898
               class="org.eclipse.debug.internal.ui.views.memory.renderings.SetDefaultColumnSizePrefAction"
899
               tooltip="%SetDefaultColumnSizeActionName"
900
               style="push"
901
               menubarPath="additions"
902
               id="org.eclipse.debug.ui.setDefaultColumnSize"/>
903
         <action
904
               helpContextId="SetPaddedStrAction_context"
904
               helpContextId="SetPaddedStrAction_context"
905
               label="%SetPaddedStrActionName"
905
               label="%SetPaddedStrActionName"
906
               class="org.eclipse.debug.internal.ui.views.memory.renderings.SetPaddedStringAction"
906
               class="org.eclipse.debug.internal.ui.views.memory.renderings.SetPaddedStringAction"
(-)ui/org/eclipse/debug/internal/ui/DebugUIMessages.java (-2 / +9 lines)
Lines 98-105 Link Here
98
	public static String MonitorMemoryBlockDialog_NumberOfBytes;
98
	public static String MonitorMemoryBlockDialog_NumberOfBytes;
99
	public static String GoToAddressDialog_Address;
99
	public static String GoToAddressDialog_Address;
100
	public static String GoToAddressDialog_GoToAddress;
100
	public static String GoToAddressDialog_GoToAddress;
101
	public static String DefaultColumnSizeDialog_DefaultColumnSize;
102
	public static String DefaultColumnSizeDialog_ColumnSize;
103
	public static String CodePagesPrefDialog_1;
101
	public static String CodePagesPrefDialog_1;
104
	public static String CodePagesPrefDialog_2;
102
	public static String CodePagesPrefDialog_2;
105
	public static String CodePagesPrefDialog_3;
103
	public static String CodePagesPrefDialog_3;
Lines 161-167 Link Here
161
	public static String AbstractTableRendering_1;
159
	public static String AbstractTableRendering_1;
162
	public static String AbstractTableRendering_2;
160
	public static String AbstractTableRendering_2;
163
	public static String AbstractTableRendering_3;
161
	public static String AbstractTableRendering_3;
162
	public static String AbstractTableRendering_4;
164
	public static String AbstractTableRendering_5;
163
	public static String AbstractTableRendering_5;
164
	public static String AbstractTableRendering_6;
165
	public static String AbstractTableRendering_8;
165
	public static String AbstractTableRendering_8;
166
	public static String AbstractTableRendering_9;
166
	public static String AbstractTableRendering_9;
167
	public static String AbstractTableRendering_10;
167
	public static String AbstractTableRendering_10;
Lines 198-203 Link Here
198
	public static String TableRenderingPropertiesPage_23;
198
	public static String TableRenderingPropertiesPage_23;
199
	public static String TableRenderingPropertiesPage_25;
199
	public static String TableRenderingPropertiesPage_25;
200
	public static String TableRenderingPropertiesPage_26;
200
	public static String TableRenderingPropertiesPage_26;
201
	public static String TableRenderingPrefAction_0;
202
	public static String TableRenderingPreferencePage_0;
203
	public static String TableRenderingPreferencePage_1;
204
	public static String TableRenderingPreferencePage_2;
205
	public static String TableRenderingPreferencePage_3;
206
	public static String TableRenderingPreferencePage_4;
201
	
207
	
202
	static {
208
	static {
203
		// load message values from bundle file
209
		// load message values from bundle file
Lines 205-208 Link Here
205
	}
211
	}
206
212
207
213
214
208
}
215
}
(-)ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties (-2 / +8 lines)
Lines 93-100 Link Here
93
MonitorMemoryBlockDialog_NumberOfBytes = Number of bytes:
93
MonitorMemoryBlockDialog_NumberOfBytes = Number of bytes:
94
GoToAddressDialog_Address = Address:
94
GoToAddressDialog_Address = Address:
95
GoToAddressDialog_GoToAddress = Go To Address...
95
GoToAddressDialog_GoToAddress = Go To Address...
96
DefaultColumnSizeDialog_DefaultColumnSize = Default Column Size
97
DefaultColumnSizeDialog_ColumnSize = &Column Size:
98
CodePagesPrefDialog_1=Select Codepages
96
CodePagesPrefDialog_1=Select Codepages
99
CodePagesPrefDialog_2=Codepage for rendering memory to ASCII strings:
97
CodePagesPrefDialog_2=Codepage for rendering memory to ASCII strings:
100
CodePagesPrefDialog_3=Change...
98
CodePagesPrefDialog_3=Change...
Lines 159-164 Link Here
159
AbstractTableRendering_5=Column Size
157
AbstractTableRendering_5=Column Size
160
AbstractTableRendering_8=Unknown
158
AbstractTableRendering_8=Unknown
161
AbstractTableRendering_9=Unknown
159
AbstractTableRendering_9=Unknown
160
AbstractTableRendering_4=Next Page
161
AbstractTableRendering_6=Previous Page
162
AbstractTableRendering_10=Unable to get base address.
162
AbstractTableRendering_10=Unable to get base address.
163
AbstractTableRendering_11=Address is out of range.
163
AbstractTableRendering_11=Address is out of range.
164
AbstractTableRendering_12=Reset Failed.
164
AbstractTableRendering_12=Reset Failed.
Lines 191-193 Link Here
191
TableRenderingPropertiesPage_23=Writable:
191
TableRenderingPropertiesPage_23=Writable:
192
TableRenderingPropertiesPage_25=Line Address:
192
TableRenderingPropertiesPage_25=Line Address:
193
TableRenderingPropertiesPage_26=Units Per Line:
193
TableRenderingPropertiesPage_26=Units Per Line:
194
TableRenderingPreferencePage_0=&Column Size:
195
TableRenderingPreferencePage_1=Automatically load next page of memory when scrolled to end of buffer
196
TableRenderingPreferencePage_2=Number of Lines per Page:
197
TableRenderingPreferencePage_3=Page size cannot be less than 1.
198
TableRenderingPreferencePage_4=Page size is invalid.
199
TableRenderingPrefAction_0=Table Renderings
(-)ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java (+8 lines)
Lines 12-17 Link Here
12
12
13
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
13
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
14
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
14
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
15
import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil;
15
import org.eclipse.debug.ui.IDebugUIConstants;
16
import org.eclipse.debug.ui.IDebugUIConstants;
16
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
17
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
17
import org.eclipse.jface.preference.IPreferenceStore;
18
import org.eclipse.jface.preference.IPreferenceStore;
Lines 102-106 Link Here
102
				IDebugPreferenceConstants.DEFAULT_ASCII_CP);
103
				IDebugPreferenceConstants.DEFAULT_ASCII_CP);
103
		prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, 
104
		prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, 
104
				IDebugPreferenceConstants.DEFAULT_EBCDIC_CP);
105
				IDebugPreferenceConstants.DEFAULT_EBCDIC_CP);
106
		
107
		if (MemoryViewUtil.isLinuxGTK())
108
			prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, false);
109
		else
110
			prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, true);
111
		
112
		prefs.setDefault(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE, IDebugPreferenceConstants.DEFAULT_PAGE_SIZE);
105
	}
113
	}
106
}
114
}
(-)ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java (+7 lines)
Lines 274-277 Link Here
274
     * @since 3.1
274
     * @since 3.1
275
     */
275
     */
276
	public static final String ID_BREAKPOINT_WORKINGSET = "org.eclipse.debug.ui.breakpointWorkingSet"; //$NON-NLS-1$
276
	public static final String ID_BREAKPOINT_WORKINGSET = "org.eclipse.debug.ui.breakpointWorkingSet"; //$NON-NLS-1$
277
	
278
	
279
	/**
280
	 * Address at the beginning of a page in a table rendering.
281
	 * @since 3.1
282
	 */
283
	public static final String PROPERTY_PAGE_START_ADDRESS = "pageStart"; //$NON-NLS-1$
277
}
284
}
(-)ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java (+24 lines)
Lines 162-167 Link Here
162
	 * @since 3.1
162
	 * @since 3.1
163
	 */
163
	 */
164
	public static final String DEFAULT_EBCDIC_CP = "CP037"; //$NON-NLS-1$
164
	public static final String DEFAULT_EBCDIC_CP = "CP037"; //$NON-NLS-1$
165
	
166
	/**
167
	 * Preference to determine if table rendering should dynamically load
168
	 * memory as the user scrolls
169
	 * 
170
	 * @since 3.1
171
	 */
172
	public static final String PREF_DYNAMIC_LOAD_MEM = "org.eclpise.debug.ui.memory.dynamicLoad"; //$NON-NLS-1$
173
	
174
	
175
	/**
176
	 * Size of buffer in a table rendering when dynamic loading mode is off.
177
	 * 
178
	 * @since 3.1
179
	 */
180
	public static final String PREF_TABLE_RENDERING_PAGE_SIZE = "org.eclispe.debug.ui.memory.pageSize"; //$NON-NLS-1$
181
	
182
	/**
183
	 * Default page size when dynamic loading mode is off.  This preference is stored
184
	 * in number of lines.
185
	 * 
186
	 * @since 3.1
187
	 */
188
	public static final int DEFAULT_PAGE_SIZE = 20;
165
}
189
}
166
190
167
191
(-)ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java (-15 / +15 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.views.memory;
11
package org.eclipse.debug.internal.ui.views.memory;
12
12
13
import java.math.BigInteger;
14
13
import org.eclipse.core.runtime.Platform;
15
import org.eclipse.core.runtime.Platform;
14
import org.eclipse.debug.core.DebugPlugin;
16
import org.eclipse.debug.core.DebugPlugin;
15
import org.eclipse.debug.core.IMemoryBlockManager;
17
import org.eclipse.debug.core.IMemoryBlockManager;
Lines 22-28 Link Here
22
import org.eclipse.jface.viewers.IStructuredSelection;
24
import org.eclipse.jface.viewers.IStructuredSelection;
23
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.swt.widgets.Shell;
25
import org.eclipse.swt.widgets.Table;
26
27
27
/**
28
/**
28
 * Util class for Memory View
29
 * Util class for Memory View
Lines 140-161 Link Here
140
	{
141
	{
141
		return DebugPlugin.getDefault().getMemoryBlockManager();
142
		return DebugPlugin.getDefault().getMemoryBlockManager();
142
	}
143
	}
143
144
145
	static public void linuxWorkAround(Table table)
146
	{
147
		if (table == null)
148
			return;
149
		
150
		if (table.isDisposed())
151
			return;
152
		
153
		if(isLinuxGTK())
154
			while(table.getDisplay().readAndDispatch()){}
155
	}
156
	
144
	
157
	static public boolean isLinuxGTK()
145
	static public boolean isLinuxGTK()
158
	{
146
	{	
159
		String ws = Platform.getWS();
147
		String ws = Platform.getWS();
160
		return ws.equals(Platform.WS_GTK);
148
		return ws.equals(Platform.WS_GTK);
161
	}
149
	}
Lines 174-177 Link Here
174
		return true;
162
		return true;
175
	}
163
	}
176
	
164
	
165
	public static BigInteger alignDoubleWordBoundary(BigInteger integer)
166
	{
167
		String str =integer.toString(16);
168
		if (!str.endsWith("0")) //$NON-NLS-1$
169
		{
170
			str = str.substring(0, str.length() - 1);
171
			str += "0"; //$NON-NLS-1$
172
			integer = new BigInteger(str, 16);
173
		}		
174
		
175
		return integer;
176
	}
177
}
177
}
(-)ui/org/eclipse/debug/internal/ui/views/memory/renderings/DefaultColumnSizeDialog.java (-107 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2005 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
12
package org.eclipse.debug.internal.ui.views.memory.renderings;
13
14
import org.eclipse.debug.internal.ui.DebugUIMessages;
15
import org.eclipse.debug.internal.ui.DebugUIPlugin;
16
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
17
import org.eclipse.debug.ui.IDebugUIConstants;
18
import org.eclipse.jface.dialogs.Dialog;
19
import org.eclipse.jface.preference.IPreferenceStore;
20
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.layout.GridData;
22
import org.eclipse.swt.layout.GridLayout;
23
import org.eclipse.swt.widgets.Combo;
24
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Label;
27
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.ui.PlatformUI;
29
30
/**
31
 * Dialog for setting default column size in Memory View
32
 * @since 3.0
33
 */
34
public class DefaultColumnSizeDialog extends Dialog {
35
36
	IPreferenceStore fPrefStore;
37
	Combo fColumnSize;
38
	
39
	private int[] fColumnSizes = new int[] {1, 2, 4, 8, 16};
40
	
41
	/**
42
	 * @param parentShell
43
	 */
44
	protected DefaultColumnSizeDialog(Shell parentShell) {
45
		super(parentShell);
46
		setShellStyle(getShellStyle() | SWT.RESIZE);
47
		fPrefStore = DebugUIPlugin.getDefault().getPreferenceStore();
48
	}
49
	
50
	/* (non-Javadoc)
51
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
52
	 */
53
	protected Control createDialogArea(Composite parent) {
54
		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugUIConstants.PLUGIN_ID + ".DefaultColumnSizeDialog_context"); //$NON-NLS-1$
55
		
56
		getShell().setText(DebugUIMessages.DefaultColumnSizeDialog_DefaultColumnSize);
57
		
58
		Composite content = (Composite) super.createDialogArea(parent);
59
		GridLayout layout = new GridLayout();
60
		layout.numColumns = 2;
61
		content.setLayout(layout);
62
		
63
		Label textLabel = new Label(content, SWT.NONE);
64
		textLabel.setText(DebugUIMessages.DefaultColumnSizeDialog_ColumnSize);
65
		
66
		GridData textLayout = new GridData();
67
		textLabel.setLayoutData(textLayout);
68
		
69
		fColumnSize = new Combo(content, SWT.BORDER|SWT.READ_ONLY);
70
71
		GridData columnLayout= new GridData();	
72
		fColumnSize.setLayoutData(columnLayout);
73
		
74
		for (int i=0; i<fColumnSizes.length; i++)
75
		{
76
			fColumnSize.add(String.valueOf(fColumnSizes[i]));
77
		}
78
		
79
		int colSize = fPrefStore.getInt(IDebugPreferenceConstants.PREF_COLUMN_SIZE);
80
		int idx = 0;
81
		
82
		for (int i=0; i<fColumnSizes.length; i++)
83
		{
84
			if (fColumnSizes[i] == colSize)
85
			{
86
				idx = i;
87
				break;
88
			}
89
		}
90
		
91
		fColumnSize.select(idx);				
92
		
93
		return content;
94
	}
95
	
96
	/* (non-Javadoc)
97
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
98
	 */
99
	protected void okPressed() {
100
		int idx = fColumnSize.getSelectionIndex();
101
		int colSize = fColumnSizes[idx];
102
		
103
		fPrefStore.setValue(IDebugPreferenceConstants.PREF_COLUMN_SIZE, colSize);	
104
		
105
		super.okPressed();
106
	}
107
}
(-)ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetDefaultColumnSizePrefAction.java (-50 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2005 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.memory.renderings;
12
13
import org.eclipse.debug.internal.ui.DebugUIPlugin;
14
import org.eclipse.jface.action.IAction;
15
import org.eclipse.jface.viewers.ISelection;
16
import org.eclipse.swt.widgets.Shell;
17
import org.eclipse.ui.IViewActionDelegate;
18
import org.eclipse.ui.IViewPart;
19
20
21
/**
22
 * Action for setting default column size in a table rendering
23
 * @since 3.0
24
 *
25
 */
26
public class SetDefaultColumnSizePrefAction implements IViewActionDelegate {
27
28
	/* (non-Javadoc)
29
	 * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
30
	 */
31
	public void init(IViewPart view) {
32
		
33
	}
34
35
	/* (non-Javadoc)
36
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
37
	 */
38
	public void run(IAction action) {
39
		Shell shell = DebugUIPlugin.getShell();
40
		DefaultColumnSizeDialog dialog = new DefaultColumnSizeDialog(shell);
41
		dialog.open();
42
		
43
	}
44
45
	/* (non-Javadoc)
46
	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
47
	 */
48
	public void selectionChanged(IAction action, ISelection selection) {
49
	}
50
}
(-)ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentInput.java (-5 / +13 lines)
Lines 29-35 Link Here
29
	private int fPostBuffer;				// number of lines after thes last visible line
29
	private int fPostBuffer;				// number of lines after thes last visible line
30
	private int fDefaultBufferSize;
30
	private int fDefaultBufferSize;
31
	private BigInteger fLoadAddress;		// Top address to load at the table
31
	private BigInteger fLoadAddress;		// Top address to load at the table
32
	private int fNumVisibleLines;			// number of visible lines
32
	private int fNumLines;			// number of visible lines
33
	private boolean fUpdateDelta;			// should the content provider calculate delta info
33
	private boolean fUpdateDelta;			// should the content provider calculate delta info
34
	private BigInteger fMemoryBlockBaseAddress;		// base address of the memory block when this input is set
34
	private BigInteger fMemoryBlockBaseAddress;		// base address of the memory block when this input is set
35
	private BigInteger fStartAddress;
35
	private BigInteger fStartAddress;
Lines 41-47 Link Here
41
		fPreBuffer = preBuffer;
41
		fPreBuffer = preBuffer;
42
		fPostBuffer = postBuffer;
42
		fPostBuffer = postBuffer;
43
		fLoadAddress = loadAddress;
43
		fLoadAddress = loadAddress;
44
		fNumVisibleLines = numOfLines;
44
		fNumLines = numOfLines;
45
		fDefaultBufferSize = defaultBufferSize;
45
		fDefaultBufferSize = defaultBufferSize;
46
		fUpdateDelta = updateDelta;
46
		fUpdateDelta = updateDelta;
47
47
Lines 52-60 Link Here
52
			DebugUIPlugin.log(e);
52
			DebugUIPlugin.log(e);
53
		}
53
		}
54
	}
54
	}
55
	public int getNumVisibleLines() {
55
56
		return fNumVisibleLines;
57
	}
58
	public int getPostBuffer() {
56
	public int getPostBuffer() {
59
		return fPostBuffer;
57
		return fPostBuffer;
60
	}
58
	}
Lines 176-179 Link Here
176
		}
174
		}
177
		return fEndAddress;
175
		return fEndAddress;
178
	}
176
	}
177
	
178
	public int getNumLines()
179
	{
180
		return fNumLines;
181
	}
182
	
183
	public void setNumLines(int numLines)
184
	{
185
		fNumLines = numLines;
186
	}
179
}
187
}
(-)ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java (-20 / +100 lines)
Lines 28-33 Link Here
28
import org.eclipse.debug.internal.ui.DebugUIMessages;
28
import org.eclipse.debug.internal.ui.DebugUIMessages;
29
import org.eclipse.debug.internal.ui.DebugUIPlugin;
29
import org.eclipse.debug.internal.ui.DebugUIPlugin;
30
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
30
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
31
import org.eclipse.debug.internal.ui.memory.IMemoryRenderingUpdater;
32
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
31
import org.eclipse.debug.ui.IDebugUIConstants;
33
import org.eclipse.debug.ui.IDebugUIConstants;
32
import org.eclipse.jface.viewers.StructuredViewer;
34
import org.eclipse.jface.viewers.StructuredViewer;
33
import org.eclipse.jface.viewers.Viewer;
35
import org.eclipse.jface.viewers.Viewer;
Lines 51-56 Link Here
51
	private TableRenderingContentInput fInput;
53
	private TableRenderingContentInput fInput;
52
	private BigInteger fBufferEndAddress;
54
	private BigInteger fBufferEndAddress;
53
	
55
	
56
	private boolean fDynamicLoad;
57
	
54
	/**
58
	/**
55
	 * @param memoryBlock
59
	 * @param memoryBlock
56
	 * @param newTab
60
	 * @param newTab
Lines 59-64 Link Here
59
	{
63
	{
60
		lineCache = new Vector();
64
		lineCache = new Vector();
61
		contentCache = new Hashtable();
65
		contentCache = new Hashtable();
66
		initializeDynamicLoad();
62
			
67
			
63
		DebugPlugin.getDefault().addDebugEventListener(this);
68
		DebugPlugin.getDefault().addDebugEventListener(this);
64
	}
69
	}
Lines 93-103 Link Here
93
	}
98
	}
94
99
95
	public void dispose() {
100
	public void dispose() {
96
97
		// fTabItem disposed by view tab
98
		
99
		DebugPlugin.getDefault().removeDebugEventListener(this);		
101
		DebugPlugin.getDefault().removeDebugEventListener(this);		
100
		
101
		super.dispose();
102
		super.dispose();
102
	}
103
	}
103
104
Lines 133-139 Link Here
133
	/**
134
	/**
134
	 * @throws DebugException
135
	 * @throws DebugException
135
	 */
136
	 */
136
	private void loadContentForSimpleMemoryBlock() throws DebugException {
137
	public void loadContentForSimpleMemoryBlock() throws DebugException {
137
		// get as much memory as the memory block can handle
138
		// get as much memory as the memory block can handle
138
		fInput.setPreBuffer(0);
139
		fInput.setPreBuffer(0);
139
		fInput.setPostBuffer(0);
140
		fInput.setPostBuffer(0);
Lines 148-154 Link Here
148
	/**
149
	/**
149
	 * @throws DebugException
150
	 * @throws DebugException
150
	 */
151
	 */
151
	private void loadContentForExtendedMemoryBlock() throws DebugException {
152
	public void loadContentForExtendedMemoryBlock() throws DebugException {
153
		
152
		// calculate top buffered address
154
		// calculate top buffered address
153
		BigInteger loadAddress = fInput.getLoadAddress();
155
		BigInteger loadAddress = fInput.getLoadAddress();
154
		if (loadAddress == null)
156
		if (loadAddress == null)
Lines 162-178 Link Here
162
		int addressableUnitsPerLine = fInput.getMemoryRendering().getAddressableUnitPerLine();
164
		int addressableUnitsPerLine = fInput.getMemoryRendering().getAddressableUnitPerLine();
163
		BigInteger bufferStart = loadAddress.subtract(BigInteger.valueOf(fInput.getPreBuffer()*addressableUnitsPerLine));
165
		BigInteger bufferStart = loadAddress.subtract(BigInteger.valueOf(fInput.getPreBuffer()*addressableUnitsPerLine));
164
		BigInteger bufferEnd = loadAddress.add(BigInteger.valueOf(fInput.getPostBuffer()*addressableUnitsPerLine));
166
		BigInteger bufferEnd = loadAddress.add(BigInteger.valueOf(fInput.getPostBuffer()*addressableUnitsPerLine));
165
		bufferEnd = bufferEnd.add(BigInteger.valueOf(fInput.getNumVisibleLines()*addressableUnitsPerLine));
167
		bufferEnd = bufferEnd.add(BigInteger.valueOf(fInput.getNumLines()*addressableUnitsPerLine));
166
		
167
		if (bufferStart.compareTo(mbStart) < 0)
168
			bufferStart = mbStart;
169
		
170
		if (bufferEnd.compareTo(mbEnd) > 0)
171
			bufferEnd = mbEnd;
172
		
168
		
173
		int numLines = bufferEnd.subtract(bufferStart).divide(BigInteger.valueOf(addressableUnitsPerLine)).intValue()+1;		
169
		if (isDynamicLoad())
174
		// get stoarage to fit the memory view tab size
170
		{
175
		getMemoryToFitTable(bufferStart, numLines, fInput.isUpdateDelta());
171
			if (bufferStart.compareTo(mbStart) < 0)
172
				bufferStart = mbStart;
173
			
174
			if (bufferEnd.compareTo(mbEnd) > 0)
175
				bufferEnd = mbEnd;
176
			
177
			int numLines = bufferEnd.subtract(bufferStart).divide(BigInteger.valueOf(addressableUnitsPerLine)).intValue()+1;		
178
			// get stoarage to fit the memory view tab size
179
			getMemoryToFitTable(bufferStart, numLines, fInput.isUpdateDelta());
180
		}
181
		else
182
		{
183
			if (bufferStart.compareTo(mbStart) < 0)
184
				bufferStart = mbStart;
185
			
186
			if (bufferEnd.compareTo(mbEnd) > 0)
187
			{
188
				bufferStart = mbEnd.subtract(BigInteger.valueOf((fInput.getNumLines()-1)*addressableUnitsPerLine));
189
			}
190
			
191
			int numLines = fInput.getNumLines();	
192
			// get stoarage to fit the memory view tab size
193
			getMemoryToFitTable(bufferStart, numLines, fInput.isUpdateDelta());
194
		}
176
	}
195
	}
177
	
196
	
178
	/**
197
	/**
Lines 523-528 Link Here
523
	 */
542
	 */
524
	protected void doHandleDebugEvent(DebugEvent event) {
543
	protected void doHandleDebugEvent(DebugEvent event) {
525
		
544
		
545
		if (fInput.getMemoryRendering().isVisible())
546
		{
547
			// only do this if it's visible
548
			// still need to clear content cache if the rendering
549
			// is not visible
550
			if (isUpdateManagedByMB())
551
				return;
552
		}
553
		
526
		// do nothing if the debug event did not come from a debug element comes from non-debug element
554
		// do nothing if the debug event did not come from a debug element comes from non-debug element
527
		if (!(event.getSource() instanceof IDebugElement))
555
		if (!(event.getSource() instanceof IDebugElement))
528
			return;
556
			return;
Lines 546-552 Link Here
546
			}
574
			}
547
		}
575
		}
548
		
576
		
549
		// if the suspend evnet happens from the debug target that the blocked
577
		// if the suspend evnet happens from the debug target that the 
550
		// memory block belongs to
578
		// memory block belongs to
551
		if (event.getKind() == DebugEvent.SUSPEND && src.getDebugTarget() == fInput.getMemoryBlock().getDebugTarget())
579
		if (event.getKind() == DebugEvent.SUSPEND && src.getDebugTarget() == fInput.getMemoryBlock().getDebugTarget())
552
		{	
580
		{	
Lines 559-565 Link Here
559
	 * Update content of the view tab if the content of the memory block has changed
587
	 * Update content of the view tab if the content of the memory block has changed
560
	 * or if its base address has changed
588
	 * or if its base address has changed
561
	 * Update will not be performed if the memory block has not been changed or
589
	 * Update will not be performed if the memory block has not been changed or
562
	 * if the view tab is disabled.
590
	 * if the rendering is not visible
563
	 */
591
	 */
564
	public void updateContent()
592
	public void updateContent()
565
	{
593
	{
Lines 571-576 Link Here
571
			return;
599
			return;
572
		}
600
		}
573
		
601
		
602
		takeContentSnapshot();
603
		
604
		//do not handle event if the rendering is not visible
605
		if (!fInput.getMemoryRendering().isVisible())
606
			 return;
607
		
608
		fInput.getMemoryRendering().refresh();
609
		
610
	}
611
	
612
	/**
613
	 *  Take a snapshot on the content, marking the lines as monitored
614
	 */
615
	public void takeContentSnapshot()
616
	{
574
		// cache content before getting new ones
617
		// cache content before getting new ones
575
		TableRenderingLine[] lines =(TableRenderingLine[]) lineCache.toArray(new TableRenderingLine[lineCache.size()]);
618
		TableRenderingLine[] lines =(TableRenderingLine[]) lineCache.toArray(new TableRenderingLine[lineCache.size()]);
576
		if (contentCache != null)
619
		if (contentCache != null)
Lines 598-605 Link Here
598
		// This will ensure that changes will be recomputed when user scrolls
641
		// This will ensure that changes will be recomputed when user scrolls
599
		// up or down the memory view.		
642
		// up or down the memory view.		
600
		resetDeltas();
643
		resetDeltas();
601
		fInput.getMemoryRendering().refresh();
602
		
603
	}
644
	}
604
645
605
	/**
646
	/**
Lines 703-706 Link Here
703
	{
744
	{
704
		contentCache.clear();
745
		contentCache.clear();
705
	}
746
	}
747
	
748
	/**
749
	 * @return if the memory block would manage its own update.
750
	 */
751
	private boolean isUpdateManagedByMB()
752
	{
753
		IMemoryBlock memoryBlock = getMemoryBlock();
754
		
755
		IMemoryRenderingUpdater managedMB = null;
756
		if (memoryBlock instanceof IMemoryRenderingUpdater)
757
		{
758
			managedMB = (IMemoryRenderingUpdater)memoryBlock;
759
		}
760
		
761
		if (managedMB == null)
762
			managedMB = (IMemoryRenderingUpdater)memoryBlock.getAdapter(IMemoryRenderingUpdater.class);
763
		
764
		// do not handle event if if the memory block wants to do its
765
		// own update
766
		if (managedMB != null && managedMB.supportsManagedUpdate(fInput.getMemoryRendering()))
767
			return true;
768
		
769
		return false;
770
	}
771
	
772
	public boolean isDynamicLoad()
773
	{
774
		return fDynamicLoad;
775
	}
776
	
777
	private void initializeDynamicLoad()
778
	{
779
		fDynamicLoad = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM);
780
	}
781
	
782
	public void setDynamicLoad(boolean dynamicLoad)
783
	{
784
		fDynamicLoad = dynamicLoad;
785
	}
706
}
786
}
(-)ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPropertiesPage.java (-3 / +3 lines)
Lines 19-25 Link Here
19
import org.eclipse.swt.layout.GridLayout;
19
import org.eclipse.swt.layout.GridLayout;
20
import org.eclipse.swt.widgets.Composite;
20
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.swt.widgets.Control;
21
import org.eclipse.swt.widgets.Control;
22
import org.eclipse.swt.widgets.Text;
22
import org.eclipse.swt.widgets.Label;
23
import org.eclipse.ui.IWorkbenchPropertyPage;
23
import org.eclipse.ui.IWorkbenchPropertyPage;
24
import org.eclipse.ui.dialogs.PropertyPage;
24
import org.eclipse.ui.dialogs.PropertyPage;
25
25
Lines 161-169 Link Here
161
	
161
	
162
	private void addProperty(Composite composite, String labelStr, String contentStr)
162
	private void addProperty(Composite composite, String labelStr, String contentStr)
163
	{
163
	{
164
		Text label = new Text(composite, SWT.READ_ONLY);
164
		Label label = new Label(composite, SWT.NONE);
165
		label.setText(labelStr);
165
		label.setText(labelStr);
166
		Text text = new Text(composite, SWT.READ_ONLY | SWT.WRAP );
166
		Label text = new Label(composite, SWT.WRAP );
167
		text.setText(contentStr);
167
		text.setText(contentStr);
168
	}
168
	}
169
169
(-)ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java (+6 lines)
Lines 79-84 Link Here
79
	 */
79
	 */
80
	public void dispose()
80
	public void dispose()
81
	{
81
	{
82
		// disconnect from memory block when rendering is disposed
83
		if (fMemoryBlock instanceof IMemoryBlockExtension)
84
		{
85
			((IMemoryBlockExtension)fMemoryBlock).disconnect(this);
86
		}
87
		
82
		if (fPropertyListeners != null)
88
		if (fPropertyListeners != null)
83
			fPropertyListeners.clear();
89
			fPropertyListeners.clear();
84
	}
90
	}
(-)ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java (-76 / +485 lines)
Lines 22-27 Link Here
22
import org.eclipse.debug.internal.ui.DebugUIMessages;
22
import org.eclipse.debug.internal.ui.DebugUIMessages;
23
import org.eclipse.debug.internal.ui.DebugUIPlugin;
23
import org.eclipse.debug.internal.ui.DebugUIPlugin;
24
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
24
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
25
import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection;
25
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
26
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
26
import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil;
27
import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil;
27
import org.eclipse.debug.internal.ui.views.memory.renderings.CopyTableRenderingToClipboardAction;
28
import org.eclipse.debug.internal.ui.views.memory.renderings.CopyTableRenderingToClipboardAction;
Lines 183-194 Link Here
183
	private KeyAdapter fEditorKeyListener;
184
	private KeyAdapter fEditorKeyListener;
184
	private SelectionAdapter fCursorSelectionListener;
185
	private SelectionAdapter fCursorSelectionListener;
185
	private IWorkbenchAdapter fWorkbenchAdapter;
186
	private IWorkbenchAdapter fWorkbenchAdapter;
187
	private IMemoryBlockConnection fConnection;
186
	
188
	
187
	private boolean fIsShowAddressColumn = true;
189
	private boolean fIsShowAddressColumn = true;
188
	private SelectionAdapter fScrollbarSelectionListener;
190
	private SelectionAdapter fScrollbarSelectionListener;
189
191
190
	private PropertyDialogAction fPropertiesAction;
192
	private PropertyDialogAction fPropertiesAction;
191
	
193
	
194
	private int fPageSize;
195
	private NextPageAction fNextAction;
196
	private PrevPageAction fPrevAction;
197
	
192
	private class EventHandleLock
198
	private class EventHandleLock
193
	{
199
	{
194
		Object fOwner;
200
		Object fOwner;
Lines 252-257 Link Here
252
		}
258
		}
253
	}
259
	}
254
	
260
	
261
	
262
	private class NextPageAction extends Action
263
	{
264
		private NextPageAction()
265
		{
266
			super();
267
			setText(DebugUIMessages.AbstractTableRendering_4);
268
			PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".NextPageAction_context"); //$NON-NLS-1$ 
269
		}
270
271
		public void run() {
272
			BigInteger address = fContentInput.getLoadAddress();
273
			address = address.add(BigInteger.valueOf(getPageSizeInUnits()));
274
			handlePageStartAddressChanged(address);
275
		}
276
	}
277
	
278
	private class PrevPageAction extends Action
279
	{
280
		private PrevPageAction()
281
		{
282
			super();
283
			setText(DebugUIMessages.AbstractTableRendering_6);
284
			PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".PrevPageAction_context"); //$NON-NLS-1$
285
		}
286
287
		public void run() {
288
			BigInteger address = fContentInput.getLoadAddress();
289
			address = address.subtract(BigInteger.valueOf(getPageSizeInUnits()));
290
			handlePageStartAddressChanged(address);
291
		}
292
	}
293
	
255
	/**
294
	/**
256
	 * Constructs a new table rendering of the specified type.
295
	 * Constructs a new table rendering of the specified type.
257
	 * 
296
	 * 
Lines 288-293 Link Here
288
		
327
		
289
		Object evtSrc = event.getSource();
328
		Object evtSrc = event.getSource();
290
		
329
		
330
		if (event.getProperty().equals(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE)) {
331
			// always update page size, only refresh if the table is visible
332
			getPageSizeFromPreference();
333
		}
334
		
291
		// do not handle event if the rendering is displaying an error
335
		// do not handle event if the rendering is displaying an error
292
		if (isDisplayingError())
336
		if (isDisplayingError())
293
			return;
337
			return;
Lines 296-301 Link Here
296
		if (!isVisible())
340
		if (!isVisible())
297
			return;
341
			return;
298
		
342
		
343
		if (event.getProperty().equals(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM)) {
344
			handleDyanicLoadChanged();
345
			return;
346
		}
347
		
348
		if (event.getProperty().equals(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE)) {
349
			if (!isDynamicLoad())
350
			{
351
				// only refresh if in non-autoload mode
352
				refresh();
353
			}
354
			return;
355
		}
356
		
299
		if (evtSrc == this)
357
		if (evtSrc == this)
300
			return;
358
			return;
301
		
359
		
Lines 324-333 Link Here
324
		{
382
		{
325
			if (needMoreLines())
383
			if (needMoreLines())
326
			{
384
			{
327
				reloadTable(getTopVisibleAddress(), false);
385
				if (isDynamicLoad())
386
					reloadTable(getTopVisibleAddress(), false);
328
			}
387
			}
329
			topVisibleAddressChanged((BigInteger)value);
388
			topVisibleAddressChanged((BigInteger)value);
330
		}
389
		}
390
		else if (propertyName.equals(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS) && value instanceof BigInteger)
391
		{
392
			handlePageStartAddressChanged((BigInteger)value);
393
		}
394
	}
395
396
	private void handleDyanicLoadChanged() {
397
		
398
		// if currently in dynamic load mode, update page
399
		// start address
400
		updateSyncPageStartAddress();
401
		
402
		updateDynamicLoadProperty();
403
		if (isDynamicLoad())
404
		{
405
			refresh();
406
		}
407
		else
408
		{
409
			BigInteger pageStart = (BigInteger)getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS);
410
			if (pageStart == null)
411
				pageStart = fTopRowAddress;
412
			handlePageStartAddressChanged(pageStart);
413
		}
414
	}
415
416
	private void updateDynamicLoadProperty() {
417
		
418
		boolean value = DebugUIPlugin
419
				.getDefault()
420
				.getPreferenceStore()
421
				.getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM);
422
		
423
		if (value != isDynamicLoad())
424
		{
425
			fContentProvider.setDynamicLoad(value);
426
		
427
			if (!fIsDisposed) {
428
				if (isDynamicLoad()) {
429
					fContentInput.setPostBuffer(20);
430
					fContentInput.setPreBuffer(20);
431
					fContentInput.setDefaultBufferSize(20);
432
					fContentInput.setNumLines(getNumberOfVisibleLines());
433
	
434
				} else {
435
					fContentInput.setPostBuffer(0);
436
					fContentInput.setPreBuffer(0);
437
					fContentInput.setDefaultBufferSize(0);
438
					fContentInput.setNumLines(fPageSize);
439
				}	
440
			}
441
		}
331
	}
442
	}
332
443
333
	/**
444
	/**
Lines 339-344 Link Here
339
		// do not handle event if view tab is disabled
450
		// do not handle event if view tab is disabled
340
		if (!isVisible())
451
		if (!isVisible())
341
			return;
452
			return;
453
		
454
		// do not handle event if the base address of the memory
455
		// block has changed, wait for debug event to update to
456
		// new location
457
		if (isBaseAddressChanged())
458
			return;
342
	
459
	
343
		if (!address.equals(fTopRowAddress))
460
		if (!address.equals(fTopRowAddress))
344
		{
461
		{
Lines 406-417 Link Here
406
					}
523
					}
407
					else
524
					else
408
					{
525
					{
409
						reloadTable(address, false);
526
						if (isDynamicLoad())
527
							reloadTable(address, false);
528
						else
529
							setTopIndex(table, index);
410
					}
530
					}
411
				}
531
				}
412
				else if ((numInBuffer-(index+getNumberOfVisibleLines())) < 3)
532
				else if ((numInBuffer-(index+getNumberOfVisibleLines())) < 3)
413
				{
533
				{
414
					if (!isAtBottomLimit())
534
					if (!isAtBottomLimit() && isDynamicLoad())
415
						reloadTable(address, false);
535
						reloadTable(address, false);
416
					else
536
					else
417
						setTopIndex(table, index);
537
						setTopIndex(table, index);
Lines 440-451 Link Here
440
	 */
560
	 */
441
	private void selectedAddressChanged(BigInteger value) {
561
	private void selectedAddressChanged(BigInteger value) {
442
		
562
		
563
		// do not handle event if the base address of the memory
564
		// block has changed, wait for debug event to update to
565
		// new location
566
		if (isBaseAddressChanged())
567
			return;
568
		
443
		try {
569
		try {
444
			goToAddress(value);
570
			// do not handle event if the event is out of range and the 
571
			// rendering is in non-dynamic-load mode, otherwise, will
572
			// cause rendering to continue to scroll when it shouldn't
573
			if (isDynamicLoad())
574
				goToAddress(value);
575
			else if (!isAddressOutOfRange(value))
576
				goToAddress(value);
445
		} catch (DebugException e) {
577
		} catch (DebugException e) {
446
			// do nothing
578
			// do nothing
447
		}
579
		}
448
	}
580
	}
581
	
582
	private void handlePageStartAddressChanged(BigInteger address)
583
	{
584
		// do not handle if in dynamic mode
585
		if (isDynamicLoad())
586
			return;
587
		
588
		if (fContentInput == null)
589
			return;
590
		
591
		if (!(getMemoryBlock() instanceof IMemoryBlockExtension))
592
			return;
593
		
594
		// do not handle event if the base address of the memory
595
		// block has changed, wait for debug event to update to
596
		// new location
597
		if (isBaseAddressChanged())
598
			return;
599
		
600
		if(fContentProvider.getBufferTopAddress().equals(address))
601
			return;
602
	
603
		BigInteger start = fContentInput.getStartAddress();
604
		BigInteger end = fContentInput.getEndAddress();
605
		
606
		// smaller than start address, load at start address
607
		if (address.compareTo(start) < 0)
608
		{
609
			if (isAtTopLimit())
610
				return;
611
			
612
			address = start;
613
		}
614
		
615
		// bigger than end address, no need to load, alread at top
616
		if (address.compareTo(end) > 0)
617
		{
618
			if (isAtBottomLimit())
619
				return;
620
			
621
			address = end.subtract(BigInteger.valueOf(getPageSizeInUnits()));
622
		}
623
		
624
		fContentInput.setLoadAddress(address);
625
		refresh();
626
		updateSyncPageStartAddress();
627
		setTopIndex(fTableViewer.getTable(), 0);
628
		fTopRowAddress = address;
629
		updateSyncTopAddress();
630
		
631
		BigInteger selectedAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS);
632
		if (selectedAddress != null)
633
		{
634
			fSelectedAddress = selectedAddress;
635
			if (!isAddressOutOfRange(fSelectedAddress))
636
			{
637
				setCursorAtAddress(fSelectedAddress);
638
				fTableCursor.setVisible(true);
639
			}
640
			else
641
			{
642
				fTableCursor.setVisible(false);
643
			}
644
		}
645
	}
449
646
450
	/* (non-Javadoc)
647
	/* (non-Javadoc)
451
	 * @see org.eclipse.debug.ui.memory.IMemoryRendering#createControl(org.eclipse.swt.widgets.Composite)
648
	 * @see org.eclipse.debug.ui.memory.IMemoryRendering#createControl(org.eclipse.swt.widgets.Composite)
Lines 480-485 Link Here
480
		fTableViewer.setLabelProvider(labelProvider);
677
		fTableViewer.setLabelProvider(labelProvider);
481
		
678
		
482
		fContentProvider = new TableRenderingContentProvider();
679
		fContentProvider = new TableRenderingContentProvider();
680
		fContentProvider.setDynamicLoad(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM));
681
		
483
		fTableViewer.setContentProvider(fContentProvider);		
682
		fTableViewer.setContentProvider(fContentProvider);		
484
		fContentProvider.setViewer(fTableViewer);
683
		fContentProvider.setViewer(fTableViewer);
485
		
684
		
Lines 557-563 Link Here
557
				selectedAddress = BigInteger.valueOf(address);
756
				selectedAddress = BigInteger.valueOf(address);
558
			}
757
			}
559
		}
758
		}
560
		fSelectedAddress = selectedAddress;
759
		setSelectedAddress(selectedAddress);
561
		// figure out top visible address
760
		// figure out top visible address
562
		BigInteger topVisibleAddress = (BigInteger) getSynchronizedProperty(AbstractTableRendering.PROPERTY_TOP_ADDRESS);
761
		BigInteger topVisibleAddress = (BigInteger) getSynchronizedProperty(AbstractTableRendering.PROPERTY_TOP_ADDRESS);
563
		if (topVisibleAddress == null)
762
		if (topVisibleAddress == null)
Lines 575-581 Link Here
575
				topVisibleAddress = BigInteger.valueOf(getMemoryBlock().getStartAddress());
774
				topVisibleAddress = BigInteger.valueOf(getMemoryBlock().getStartAddress());
576
			}
775
			}
577
		}
776
		}
578
		fContentInput = new TableRenderingContentInput(this, 20, 20, 20, topVisibleAddress, getNumberOfVisibleLines(), false);
777
		
778
		getPageSizeFromPreference();
779
		if (isDynamicLoad())
780
			fContentInput = new TableRenderingContentInput(this, 20, 20, 20, topVisibleAddress, getNumberOfVisibleLines(), false);
781
		else
782
		{
783
			BigInteger addressToLoad = topVisibleAddress;
784
			
785
			// check synchronization service to see if we need to sync with another rendering
786
			Object obj = getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS);
787
			if (obj != null && obj instanceof BigInteger)
788
			{
789
				addressToLoad = (BigInteger)obj;
790
			}
791
			fContentInput = new TableRenderingContentInput(this, 0, 0, 0, addressToLoad, fPageSize, false);
792
		}
793
		
579
		fTableViewer.setInput(fContentInput);
794
		fTableViewer.setInput(fContentInput);
580
		fCellModifier = new TableRenderingCellModifier(this);
795
		fCellModifier = new TableRenderingCellModifier(this);
581
		fTableViewer.setCellModifier(fCellModifier);
796
		fTableViewer.setCellModifier(fCellModifier);
Lines 637-642 Link Here
637
		DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
852
		DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
638
	}
853
	}
639
	
854
	
855
	private void getPageSizeFromPreference()
856
	{
857
		fPageSize = DebugUIPlugin.getDefault().getPreferenceStore().getInt(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE);
858
	}
859
	
640
	private void createCursor(Table table, BigInteger address)
860
	private void createCursor(Table table, BigInteger address)
641
	{
861
	{
642
		fTableCursor = new TableCursor(table, SWT.NONE);
862
		fTableCursor = new TableCursor(table, SWT.NONE);
Lines 758-764 Link Here
758
		// when the cursor is moved, the selected address is changed
978
		// when the cursor is moved, the selected address is changed
759
		if (selectedAddress != null && !selectedAddress.equals(fSelectedAddress))
979
		if (selectedAddress != null && !selectedAddress.equals(fSelectedAddress))
760
		{
980
		{
761
			fSelectedAddress = selectedAddress;
981
			setSelectedAddress(selectedAddress);
762
			updateSyncSelectedAddress();
982
			updateSyncSelectedAddress();
763
		}
983
		}
764
		
984
		
Lines 773-793 Link Here
773
			
993
			
774
			if (row < 3)
994
			if (row < 3)
775
			{
995
			{
776
				
777
				if (!isAtTopLimit())
996
				if (!isAtTopLimit())
778
				{
997
				{
779
					refresh();
998
					if (isDynamicLoad())
780
					setCursorAtAddress(fSelectedAddress);
999
					{
1000
						refresh();
1001
						setCursorAtAddress(fSelectedAddress);
1002
					}
781
				}
1003
				}
782
			}
1004
			}
783
			else if (row >= fTableViewer.getTable().getItemCount() - 3)
1005
			else if (row >= fTableViewer.getTable().getItemCount() - 3)
784
			{
1006
			{
785
				if (!isAtBottomLimit())
1007
				if (!isAtBottomLimit())
786
				{
1008
				{
787
					refresh();
1009
					if (isDynamicLoad())
788
					setCursorAtAddress(fSelectedAddress);
1010
					{
1011
						refresh();
1012
						setCursorAtAddress(fSelectedAddress);
1013
					}
789
				}
1014
				}
790
	
791
			}
1015
			}
792
		}
1016
		}
793
		
1017
		
Lines 1190-1196 Link Here
1190
	
1414
	
1191
	private static void  setTopIndex(Table table, int index)
1415
	private static void  setTopIndex(Table table, int index)
1192
	{
1416
	{
1193
		MemoryViewUtil.linuxWorkAround(table);
1194
		table.setTopIndex(index);
1417
		table.setTopIndex(index);
1195
	}
1418
	}
1196
1419
Lines 1213-1218 Link Here
1213
			Object size =getSynchronizedProperty( AbstractTableRendering.PROPERTY_COL_SIZE);
1436
			Object size =getSynchronizedProperty( AbstractTableRendering.PROPERTY_COL_SIZE);
1214
			Object topAddress =getSynchronizedProperty( AbstractTableRendering.PROPERTY_TOP_ADDRESS);
1437
			Object topAddress =getSynchronizedProperty( AbstractTableRendering.PROPERTY_TOP_ADDRESS);
1215
			
1438
			
1439
			if (!isDynamicLoad())
1440
			{
1441
				Object pageStartAddress = getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS);
1442
				if (pageStartAddress == null)
1443
					updateSyncPageStartAddress();
1444
			}
1445
			
1216
			// if info is available, some other view tab has already been
1446
			// if info is available, some other view tab has already been
1217
			// created
1447
			// created
1218
			// do not overwirte info int he synchronizer if that's the case
1448
			// do not overwirte info int he synchronizer if that's the case
Lines 1233-1239 Link Here
1233
	 * Get properties from synchronizer and synchronize settings
1463
	 * Get properties from synchronizer and synchronize settings
1234
	 */
1464
	 */
1235
	private void synchronize()
1465
	private void synchronize()
1236
	{	
1466
	{			
1467
		if (!isDynamicLoad())
1468
		{
1469
			BigInteger pageStart = (BigInteger)getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS);
1470
			if (pageStart != null && fContentInput != null && fContentInput.getLoadAddress() != null)
1471
			{
1472
				if (!fContentInput.getLoadAddress().equals(pageStart))
1473
					handlePageStartAddressChanged(pageStart);
1474
			}
1475
			else if (pageStart != null)
1476
			{
1477
				handlePageStartAddressChanged(pageStart);
1478
			}
1479
		}
1480
		
1237
		Integer columnSize = (Integer) getSynchronizedProperty(AbstractTableRendering.PROPERTY_COL_SIZE);
1481
		Integer columnSize = (Integer) getSynchronizedProperty(AbstractTableRendering.PROPERTY_COL_SIZE);
1238
		BigInteger selectedAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS);
1482
		BigInteger selectedAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS);
1239
		BigInteger topAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_TOP_ADDRESS);
1483
		BigInteger topAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_TOP_ADDRESS);
Lines 1315-1320 Link Here
1315
		firePropertyChangedEvent(event);
1559
		firePropertyChangedEvent(event);
1316
	}
1560
	}
1317
	
1561
	
1562
	private void updateSyncPageStartAddress() {
1563
	
1564
		if (!fIsCreated)
1565
			return;
1566
		
1567
		if (isBaseAddressChanged())
1568
			return;
1569
		
1570
		BigInteger pageStart;
1571
		if (isDynamicLoad())
1572
		{
1573
			// if dynamic loading, the page address should be the top
1574
			// row address
1575
			pageStart = fTopRowAddress;
1576
		}
1577
		else
1578
		{
1579
			// otherwise, the address is the buffer's start address
1580
			pageStart = fContentProvider.getBufferTopAddress();
1581
		}
1582
		
1583
		PropertyChangeEvent event = new PropertyChangeEvent(this, IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS, null, pageStart);
1584
		firePropertyChangedEvent(event);
1585
	}
1586
	
1318
	/**
1587
	/**
1319
	 * Fills the context menu for this rendering
1588
	 * Fills the context menu for this rendering
1320
	 * 
1589
	 * 
Lines 1354-1359 Link Here
1354
				}
1623
				}
1355
			}
1624
			}
1356
		}
1625
		}
1626
		if (!isDynamicLoad())
1627
		{		
1628
			menu.add(new Separator());
1629
			menu.add(fPrevAction);
1630
			menu.add(fNextAction);
1631
		}
1357
		
1632
		
1358
		menu.add(new Separator());
1633
		menu.add(new Separator());
1359
		menu.add(fReformatAction);
1634
		menu.add(fReformatAction);
Lines 1366-1371 Link Here
1366
			menu.add(new Separator());
1641
			menu.add(new Separator());
1367
			menu.add(fPropertiesAction);
1642
			menu.add(fPropertiesAction);
1368
		}
1643
		}
1644
		
1369
	}
1645
	}
1370
	
1646
	
1371
	/**
1647
	/**
Lines 1539-1549 Link Here
1539
				if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0)
1815
				if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0)
1540
				{
1816
				{
1541
					// get to new address
1817
					// get to new address
1542
					fSelectedAddress = address;
1818
					setSelectedAddress(address);
1543
					updateSyncSelectedAddress();
1819
					updateSyncSelectedAddress();
1820
					
1544
					reloadTable(address, true);
1821
					reloadTable(address, true);
1545
					
1822
					
1546
					fTopRowAddress = address;
1823
					if (!isDynamicLoad())
1824
					{
1825
						updateSyncPageStartAddress();
1826
						setTopIndex(fTableViewer.getTable(), 0);
1827
					}
1828
					
1829
					fTopRowAddress = getTopVisibleAddress();
1547
					updateSyncTopAddress();
1830
					updateSyncTopAddress();
1548
					
1831
					
1549
					fContentInput.updateContentBaseAddress();
1832
					fContentInput.updateContentBaseAddress();
Lines 1551-1557 Link Here
1551
				else
1834
				else
1552
				{
1835
				{
1553
					// reload at top of table
1836
					// reload at top of table
1554
					address = getTopVisibleAddress();
1837
					if (isDynamicLoad())
1838
						address = getTopVisibleAddress();
1839
					else
1840
						address = fContentInput.getLoadAddress();
1555
					reloadTable(address, true);
1841
					reloadTable(address, true);
1556
				}
1842
				}
1557
			} catch (DebugException e) {
1843
			} catch (DebugException e) {
Lines 1575-1599 Link Here
1575
		{
1861
		{
1576
			Table table = (Table)fTableViewer.getControl();	
1862
			Table table = (Table)fTableViewer.getControl();	
1577
			
1863
			
1578
			TableRenderingContentInput input = new TableRenderingContentInput(this, fContentInput.getPreBuffer(), fContentInput.getPostBuffer(), fContentInput.getDefaultBufferSize(), topAddress, getNumberOfVisibleLines(), updateDelta);
1864
			TableRenderingContentInput input;
1865
			if (isDynamicLoad())
1866
				input = new TableRenderingContentInput(this, fContentInput.getPreBuffer(), fContentInput.getPostBuffer(), fContentInput.getDefaultBufferSize(), topAddress, getNumberOfVisibleLines(), updateDelta);
1867
			else
1868
				input = new TableRenderingContentInput(this, fContentInput.getPreBuffer(), fContentInput.getPostBuffer(), fContentInput.getDefaultBufferSize(), topAddress, fPageSize, updateDelta);
1869
			
1579
			fContentInput = input;
1870
			fContentInput = input;
1580
			fTableViewer.setInput(fContentInput);
1871
			fTableViewer.setInput(fContentInput);
1581
	
1872
	
1582
			if (getMemoryBlock() instanceof IMemoryBlockExtension)
1873
			if (isDynamicLoad())
1583
			{
1874
			{
1584
				int topIdx = findAddressIndex(topAddress);
1875
				if (getMemoryBlock() instanceof IMemoryBlockExtension)
1876
				{
1877
					int topIdx = findAddressIndex(topAddress);
1878
					
1879
					if (topIdx != -1)
1880
					{
1881
						setTopIndex(table, topIdx);
1882
					}
1883
				}
1585
				
1884
				
1586
				if (topIdx != -1)
1885
				// cursor needs to be refreshed after reload
1886
				if (isAddressVisible(fSelectedAddress))
1887
					setCursorAtAddress(fSelectedAddress);
1888
			}
1889
			else
1890
			{
1891
				if (!isAddressOutOfRange(fSelectedAddress))
1892
				{
1893
					setCursorAtAddress(fSelectedAddress);
1894
					fTableCursor.setVisible(true);
1895
				}
1896
				else
1587
				{
1897
				{
1588
					setTopIndex(table, topIdx);
1898
					fTableCursor.setVisible(false);
1589
				}
1899
				}
1590
			}
1900
			}
1591
			
1592
			// cursor needs to be refreshed after reload
1593
			if (isAddressVisible(fSelectedAddress))
1594
				setCursorAtAddress(fSelectedAddress);
1595
			
1596
			MemoryViewUtil.linuxWorkAround(fTableViewer.getTable());
1597
		}
1901
		}
1598
		finally
1902
		finally
1599
		{
1903
		{
Lines 1657-1671 Link Here
1657
	
1961
	
1658
	private static int getTopVisibleIndex(Table table)
1962
	private static int getTopVisibleIndex(Table table)
1659
	{
1963
	{
1660
		MemoryViewUtil.linuxWorkAround(table);
1661
		int index = table.getTopIndex();
1964
		int index = table.getTopIndex();
1662
		
1965
		
1663
		TableItem item = table.getItem(index);
1966
		TableItem item = table.getItem(index);
1967
		int cnt = table.getItemCount();
1664
		
1968
		
1665
		MemoryViewUtil.linuxWorkAround(table);
1666
		while (item.getBounds(0).y < 0)
1969
		while (item.getBounds(0).y < 0)
1667
		{
1970
		{
1668
			index++;
1971
			index++;
1972
			if (index >= cnt)
1973
			{
1974
				index--;
1975
				break;
1976
			}
1669
			item = table.getItem(index);
1977
			item = table.getItem(index);
1670
		}
1978
		}
1671
		
1979
		
Lines 1778-1784 Link Here
1778
			// if address is within the range, highlight			
2086
			// if address is within the range, highlight			
1779
			if (!isAddressOutOfRange(address))
2087
			if (!isAddressOutOfRange(address))
1780
			{
2088
			{
1781
				fSelectedAddress = address;
2089
				setSelectedAddress(address);
1782
				updateSyncSelectedAddress();
2090
				updateSyncSelectedAddress();
1783
				setCursorAtAddress(fSelectedAddress);
2091
				setCursorAtAddress(fSelectedAddress);
1784
				
2092
				
Lines 1817-1827 Link Here
1817
					throw e;
2125
					throw e;
1818
				}
2126
				}
1819
				
2127
				
1820
				fSelectedAddress = address;
2128
				setSelectedAddress(address);
1821
				updateSyncSelectedAddress();
2129
				updateSyncSelectedAddress();
1822
				
2130
				
1823
				//otherwise, reload at the address
2131
				reloadTable(address, false);
1824
				reloadTable(address,false);
2132
				
2133
				if (!isDynamicLoad())
2134
				{						
2135
					updateSyncPageStartAddress();
2136
				}
1825
				
2137
				
1826
				// if the table is reloaded, the top address is chagned in this case
2138
				// if the table is reloaded, the top address is chagned in this case
1827
				fTopRowAddress = address;
2139
				fTopRowAddress = address;
Lines 1900-1905 Link Here
1900
		{
2212
		{
1901
			fPropertiesAction = new PropertyDialogAction(site.getSite(),site.getSite().getSelectionProvider()); 
2213
			fPropertiesAction = new PropertyDialogAction(site.getSite(),site.getSite().getSelectionProvider()); 
1902
		}
2214
		}
2215
		
2216
		fNextAction = new NextPageAction();
2217
		fPrevAction = new PrevPageAction();
1903
	}
2218
	}
1904
	
2219
	
1905
	/**
2220
	/**
Lines 1927-1959 Link Here
1927
			
2242
			
1928
			if (getMemoryBlock() instanceof IMemoryBlockExtension)
2243
			if (getMemoryBlock() instanceof IMemoryBlockExtension)
1929
			{
2244
			{
1930
				if (!isAddressOutOfRange(address))
2245
2246
				if (isDynamicLoad())
1931
				{
2247
				{
1932
					Table table = fTableViewer.getTable();
2248
					if (!isAddressOutOfRange(address))
1933
					int numInBuffer = table.getItemCount();
1934
					int index = findAddressIndex(address);
1935
					if (index < 3)
1936
					{
2249
					{
1937
						if (isAtTopLimit())
2250
						Table table = fTableViewer.getTable();
2251
						int numInBuffer = table.getItemCount();
2252
						int index = findAddressIndex(address);
2253
						if (index < 3)
1938
						{
2254
						{
1939
							setTopIndex(table, index);
2255
							if (isAtTopLimit())
2256
							{
2257
								setTopIndex(table, index);
2258
							}
2259
							else
2260
							{
2261
								reloadTable(address, false);
2262
							}
1940
						}
2263
						}
1941
						else
2264
						else if ((numInBuffer-(index+getNumberOfVisibleLines())) < 3)
1942
						{
2265
						{
1943
							reloadTable(address, false);
2266
							if (!isAtBottomLimit())
2267
								reloadTable(address, false);
1944
						}
2268
						}
1945
					}
2269
					}
1946
					else if ((numInBuffer-(index+getNumberOfVisibleLines())) < 3)
2270
					else
1947
					{
2271
					{	
1948
						if (!isAtBottomLimit())
2272
						// approaching limit, reload table
1949
							reloadTable(address, false);
2273
						reloadTable(address, false);
1950
					}
2274
					}
1951
				}
2275
				}
1952
				else
1953
				{	
1954
					// approaching limit, reload table
1955
					reloadTable(address, false);
1956
				}
1957
				
2276
				
1958
				if (isAddressVisible(fSelectedAddress))
2277
				if (isAddressVisible(fSelectedAddress))
1959
					fTableCursor.setVisible(true);
2278
					fTableCursor.setVisible(true);
Lines 1971-1980 Link Here
1971
	private boolean isAtTopLimit()
2290
	private boolean isAtTopLimit()
1972
	{	
2291
	{	
1973
		BigInteger startAddress = fContentInput.getStartAddress();
2292
		BigInteger startAddress = fContentInput.getStartAddress();
1974
		startAddress = alignDoubleWordBoundary(startAddress);
2293
		startAddress = MemoryViewUtil.alignDoubleWordBoundary(startAddress);
1975
		
2294
		
1976
		BigInteger startBufferAddress = fContentProvider.getBufferTopAddress();
2295
		BigInteger startBufferAddress = fContentProvider.getBufferTopAddress();
1977
		startBufferAddress = alignDoubleWordBoundary(startBufferAddress);
2296
		startBufferAddress = MemoryViewUtil.alignDoubleWordBoundary(startBufferAddress);
1978
		
2297
		
1979
		if (startAddress.compareTo(startBufferAddress) == 0)
2298
		if (startAddress.compareTo(startBufferAddress) == 0)
1980
			return true;
2299
			return true;
Lines 1985-1994 Link Here
1985
	private boolean isAtBottomLimit()
2304
	private boolean isAtBottomLimit()
1986
	{
2305
	{
1987
		BigInteger endAddress = fContentInput.getEndAddress();
2306
		BigInteger endAddress = fContentInput.getEndAddress();
1988
		endAddress = alignDoubleWordBoundary(endAddress);
2307
		endAddress = MemoryViewUtil.alignDoubleWordBoundary(endAddress);
1989
		
2308
		
1990
		BigInteger endBufferAddress = fContentProvider.getBufferEndAddress();
2309
		BigInteger endBufferAddress = fContentProvider.getBufferEndAddress();
1991
		endBufferAddress = alignDoubleWordBoundary(endBufferAddress);
2310
		endBufferAddress = MemoryViewUtil.alignDoubleWordBoundary(endBufferAddress);
1992
		
2311
		
1993
		if (endAddress.compareTo(endBufferAddress) == 0)
2312
		if (endAddress.compareTo(endBufferAddress) == 0)
1994
			return true;
2313
			return true;
Lines 1996-2014 Link Here
1996
		return false;		
2315
		return false;		
1997
	}
2316
	}
1998
	
2317
	
1999
	private BigInteger alignDoubleWordBoundary(BigInteger integer)
2000
	{
2001
		String str =integer.toString(16);
2002
		if (!str.endsWith("0")) //$NON-NLS-1$
2003
		{
2004
			str = str.substring(0, str.length() - 1);
2005
			str += "0"; //$NON-NLS-1$
2006
			integer = new BigInteger(str, 16);
2007
		}		
2008
		
2009
		return integer;
2010
	}
2011
	
2012
	private boolean needMoreLines()
2318
	private boolean needMoreLines()
2013
	{
2319
	{
2014
		if (getMemoryBlock() instanceof IMemoryBlockExtension)
2320
		if (getMemoryBlock() instanceof IMemoryBlockExtension)
Lines 2501-2510 Link Here
2501
		}
2807
		}
2502
		
2808
		
2503
		super.becomesVisible();
2809
		super.becomesVisible();
2504
2505
		refresh();
2506
		synchronize();
2507
		
2810
		
2811
		boolean value = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM);
2812
		if (value != isDynamicLoad())
2813
			// this call will cause a reload
2814
			handleDyanicLoadChanged();
2815
		else
2816
			refresh();
2817
		
2818
		synchronize();
2508
		updateRenderingLabel(true);
2819
		updateRenderingLabel(true);
2509
	}
2820
	}
2510
	
2821
	
Lines 2674-2688 Link Here
2674
					public Object[] getChildren(Object o) {
2985
					public Object[] getChildren(Object o) {
2675
						return new Object[0];
2986
						return new Object[0];
2676
					}
2987
					}
2677
2988
	
2678
					public ImageDescriptor getImageDescriptor(Object object) {
2989
					public ImageDescriptor getImageDescriptor(Object object) {
2679
						return null;
2990
						return null;
2680
					}
2991
					}
2681
2992
	
2682
					public String getLabel(Object o) {
2993
					public String getLabel(Object o) {
2683
						return getInstance().getLabel();
2994
						return getInstance().getLabel();
2684
					}
2995
					}
2685
2996
	
2686
					public Object getParent(Object o) {
2997
					public Object getParent(Object o) {
2687
						return null;
2998
						return null;
2688
					}
2999
					}
Lines 2691-2696 Link Here
2691
			return fWorkbenchAdapter;
3002
			return fWorkbenchAdapter;
2692
		}
3003
		}
2693
		
3004
		
3005
		if (adapter == IMemoryBlockConnection.class) {
3006
			if (fConnection == null) {
3007
				fConnection = new IMemoryBlockConnection() {
3008
					public void update() {
3009
						try {
3010
							fContentProvider.takeContentSnapshot();
3011
							if (getMemoryBlock() instanceof IMemoryBlockExtension)
3012
							{
3013
								BigInteger address = ((IMemoryBlockExtension)getMemoryBlock()).getBigBaseAddress();
3014
								if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0)
3015
								{
3016
									// get to new address
3017
									setSelectedAddress(address);
3018
									updateSyncSelectedAddress();
3019
									fTopRowAddress = address;
3020
									fContentInput.updateContentBaseAddress();
3021
									fContentInput.setLoadAddress(address);
3022
								}
3023
								fContentProvider.loadContentForExtendedMemoryBlock();
3024
							}
3025
							else
3026
								fContentProvider.loadContentForSimpleMemoryBlock();
3027
	
3028
							// update UI asynchrounously
3029
							Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay();
3030
							display.asyncExec(new Runnable() {
3031
								public void run() {
3032
									updateLabels();
3033
									
3034
									if (getMemoryBlock() instanceof IMemoryBlockExtension) {
3035
										int topIdx = findAddressIndex(fTopRowAddress);
3036
										if (topIdx != -1) {
3037
											setTopIndex(fTableViewer.getTable(),topIdx);
3038
										}
3039
									}
3040
									
3041
									// cursor needs to be refreshed after reload
3042
									if (isAddressVisible(fSelectedAddress))
3043
									{
3044
										setCursorAtAddress(fSelectedAddress);
3045
										fTableCursor.setVisible(true);
3046
										fTableCursor.redraw();
3047
									}
3048
									else
3049
									{
3050
										fTableCursor.setVisible(false);
3051
									}
3052
									
3053
									if (!isDynamicLoad())
3054
										updateSyncPageStartAddress();
3055
									
3056
									updateSyncTopAddress();
3057
								}
3058
							});
3059
						} catch (DebugException e) {
3060
							displayError(e);
3061
						}
3062
					}
3063
				};
3064
			}
3065
			return fConnection;
3066
		}	
3067
		
2694
		return super.getAdapter(adapter);
3068
		return super.getAdapter(adapter);
2695
	}
3069
	}
2696
	
3070
	
Lines 2708-2713 Link Here
2708
		return true;
3082
		return true;
2709
	}
3083
	}
2710
	
3084
	
3085
	private boolean isBaseAddressChanged()
3086
	{
3087
		try {
3088
			IMemoryBlock mb = getMemoryBlock();
3089
			if (mb instanceof IMemoryBlockExtension)
3090
			{
3091
				BigInteger baseAddress = ((IMemoryBlockExtension)mb).getBigBaseAddress();
3092
				if (baseAddress != null)
3093
				{
3094
					if (!baseAddress.equals(fContentInput.getContentBaseAddress()))
3095
						return true;
3096
				}
3097
			}
3098
		} catch (DebugException e1) {
3099
			return false;
3100
		}
3101
		return false;
3102
	}
3103
	
2711
	/**
3104
	/**
2712
	 * Returns the color provider for this rendering's memory block or
3105
	 * Returns the color provider for this rendering's memory block or
2713
	 * <code>null</code> if none.
3106
	 * <code>null</code> if none.
Lines 2774-2779 Link Here
2774
		return (IMemoryBlockTablePresentation)getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class);
3167
		return (IMemoryBlockTablePresentation)getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class);
2775
	}
3168
	}
2776
	
3169
	
3170
	private boolean isDynamicLoad()
3171
	{
3172
		return fContentProvider.isDynamicLoad();
3173
	}
3174
	
3175
	private int getPageSizeInUnits()
3176
	{
3177
		return fPageSize * getAddressableUnitPerLine();
3178
	}
3179
	
3180
	private void setSelectedAddress(BigInteger address)
3181
	{
3182
		fSelectedAddress = address;
3183
	}
3184
3185
	
2777
	/**
3186
	/**
2778
	 * Returns text for the given memory bytes at the specified address for the specified
3187
	 * Returns text for the given memory bytes at the specified address for the specified
2779
	 * rendering type. This is called by the label provider for.
3188
	 * rendering type. This is called by the label provider for.
(-)ui/org/eclipse/debug/internal/ui/memory/IMemoryBlockConnection.java (+27 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 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.memory;
12
13
/**
14
 * Represents a connection to a memory block.  An IMemoryRenderingUpdater can call
15
 * a connection to update instead of relying on a rendering to listen
16
 * for CHANGE / SUSPEND debug event to trigger an update.
17
 * 
18
 * This interface is EXPERIMENTAL.
19
 *
20
 */
21
public interface IMemoryBlockConnection {
22
	
23
	/**
24
	 * Update the content of a memory block in a connection.
25
	 */
26
	public void update();
27
}
(-)ui/org/eclipse/debug/internal/ui/memory/IMemoryRenderingUpdater.java (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 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
12
package org.eclipse.debug.internal.ui.memory;
13
14
import org.eclipse.debug.core.model.IMemoryBlockExtension;
15
import org.eclipse.debug.ui.memory.IMemoryRendering;
16
17
18
/**
19
 * Represents an object that will manage the update of an IMemoryRendering
20
 * based on connections.  If the memory block implements this interface or returns
21
 * an object of this type when getAdapter(...) is called, a rendering would
22
 * call #supportsManagedUpdate to determine if it should handle and refresh
23
 * upon a debug event.  
24
 * 
25
 * If the client wants to manage its own update, it would return true when
26
 * #supportsManagedUpdate is called.  The rendering will not get refreshed
27
 * upon any debug events.  Instead, the rendering will update when 
28
 * <code>IMemoryBlockConnection.update</code> is called.
29
 * 
30
 * This interface is EXPERIMENTAL.
31
 *
32
 */
33
public interface IMemoryRenderingUpdater extends IMemoryBlockExtension {
34
	
35
	/**
36
	 * @return true if the updater will manage the update of a rendering
37
	 */
38
	public boolean supportsManagedUpdate(IMemoryRendering rendering);
39
40
}
(-)ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPrefAction.java (+60 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 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
12
package org.eclipse.debug.internal.ui.views.memory.renderings;
13
14
import org.eclipse.debug.internal.ui.DebugUIMessages;
15
import org.eclipse.debug.internal.ui.DebugUIPlugin;
16
import org.eclipse.jface.action.IAction;
17
import org.eclipse.jface.preference.IPreferenceNode;
18
import org.eclipse.jface.preference.IPreferencePage;
19
import org.eclipse.jface.preference.PreferenceDialog;
20
import org.eclipse.jface.preference.PreferenceManager;
21
import org.eclipse.jface.preference.PreferenceNode;
22
import org.eclipse.jface.window.Window;
23
import org.eclipse.swt.custom.BusyIndicator;
24
import org.eclipse.ui.IViewActionDelegate;
25
import org.eclipse.ui.IViewPart;
26
import org.eclipse.ui.actions.ActionDelegate;
27
28
public class TableRenderingPrefAction extends ActionDelegate implements IViewActionDelegate {
29
30
	/* (non-Javadoc)
31
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
32
	 */
33
	public void run(IAction action) {
34
		IPreferencePage page = new TableRenderingPreferencePage(DebugUIMessages.TableRenderingPrefAction_0);
35
		showPreferencePage("org.eclipse.debug.ui.tableRenderingPreferencepage", page);	 //$NON-NLS-1$
36
	}
37
38
	/* (non-Javadoc)
39
	 * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
40
	 */
41
	public void init(IViewPart view) {
42
	}
43
	
44
	protected void showPreferencePage(String id, IPreferencePage page) {
45
		final IPreferenceNode targetNode = new PreferenceNode(id, page);
46
		
47
		PreferenceManager manager = new PreferenceManager();
48
		manager.addToRoot(targetNode);
49
		final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), manager);
50
		final boolean [] result = new boolean[] { false };
51
		BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() {
52
			public void run() {
53
				dialog.create();
54
				dialog.setMessage(targetNode.getLabelText());
55
				result[0]= (dialog.open() == Window.OK);
56
			}
57
		});		
58
	}
59
60
}
(-)ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPreferencePage.java (+221 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 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
12
package org.eclipse.debug.internal.ui.views.memory.renderings;
13
14
import org.eclipse.debug.internal.ui.DebugUIMessages;
15
import org.eclipse.debug.internal.ui.DebugUIPlugin;
16
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
17
import org.eclipse.debug.ui.IDebugUIConstants;
18
import org.eclipse.jface.preference.BooleanFieldEditor;
19
import org.eclipse.jface.preference.FieldEditor;
20
import org.eclipse.jface.preference.IPreferenceStore;
21
import org.eclipse.jface.preference.IntegerFieldEditor;
22
import org.eclipse.jface.preference.PreferencePage;
23
import org.eclipse.jface.util.IPropertyChangeListener;
24
import org.eclipse.jface.util.PropertyChangeEvent;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.layout.GridData;
27
import org.eclipse.swt.layout.GridLayout;
28
import org.eclipse.swt.widgets.Combo;
29
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Control;
31
import org.eclipse.swt.widgets.Label;
32
import org.eclipse.ui.PlatformUI;
33
34
public class TableRenderingPreferencePage extends PreferencePage implements
35
	IPropertyChangeListener{
36
	
37
	Combo fColumnSize;
38
	private int[] fColumnSizes = new int[] {1, 2, 4, 8, 16};
39
	private BooleanFieldEditor fAutoLoadPref;
40
	private IntegerFieldEditor fPageSizePref;
41
	private Composite fBufferComposite;
42
	
43
	public TableRenderingPreferencePage(String title)
44
	{
45
		super(title);
46
	}
47
	
48
	/* (non-Javadoc)
49
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
50
	 */
51
	protected Control createContents(Composite parent) {
52
		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugUIConstants.PLUGIN_ID + ".table_renderings_preference_page_context"); //$NON-NLS-1$
53
		
54
		Composite composite = new Composite(parent, SWT.NONE);
55
		
56
		Composite columnSizeComposite = new Composite(composite, SWT.NONE);
57
		GridLayout layout = new GridLayout();
58
		layout.numColumns = 2;
59
		columnSizeComposite.setLayout(layout);
60
		GridData data = new GridData();
61
		data.horizontalAlignment = SWT.FILL;
62
		columnSizeComposite.setLayoutData(data);
63
		
64
		Label textLabel = new Label(columnSizeComposite, SWT.NONE);
65
		textLabel.setText(DebugUIMessages.TableRenderingPreferencePage_0);
66
		
67
		fColumnSize = new Combo(columnSizeComposite, SWT.BORDER|SWT.READ_ONLY);
68
69
		GridData columnLayout= new GridData();	
70
		fColumnSize.setLayoutData(columnLayout);
71
		
72
		for (int i=0; i<fColumnSizes.length; i++)
73
		{
74
			fColumnSize.add(String.valueOf(fColumnSizes[i]));
75
		}
76
		
77
		int colSize = getPreferenceStore().getInt(IDebugPreferenceConstants.PREF_COLUMN_SIZE);
78
		int idx = 0;
79
		
80
		for (int i=0; i<fColumnSizes.length; i++)
81
		{
82
			if (fColumnSizes[i] == colSize)
83
			{
84
				idx = i;
85
				break;
86
			}
87
		}
88
		
89
		fColumnSize.select(idx);				
90
		
91
		createSpacer(composite);
92
        
93
		fAutoLoadPref = new BooleanFieldEditor(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, DebugUIMessages.TableRenderingPreferencePage_1,  composite);
94
		fAutoLoadPref.setPreferenceStore(getPreferenceStore());
95
		fAutoLoadPref.load();
96
		
97
		fBufferComposite = new Composite(composite, SWT.NONE);
98
		data = new GridData();
99
		data.horizontalAlignment = SWT.FILL;
100
		fBufferComposite.setLayoutData(data);
101
		
102
		fPageSizePref = new IntegerFieldEditor(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE, DebugUIMessages.TableRenderingPreferencePage_2, fBufferComposite);
103
		fPageSizePref.setPreferenceStore(getPreferenceStore());
104
		fPageSizePref.load();
105
		
106
		boolean autoLoad = getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM);
107
		if (autoLoad)
108
			fPageSizePref.setEnabled(false, fBufferComposite);
109
		else
110
			fPageSizePref.setEnabled(true, fBufferComposite);
111
		
112
		fAutoLoadPref.setPropertyChangeListener(this);
113
		fPageSizePref.setPropertyChangeListener(this);
114
		fPageSizePref.setValidRange(1, Integer.MAX_VALUE);
115
		
116
		return composite;
117
	}
118
119
	
120
	public boolean performOk() {
121
		int idx = fColumnSize.getSelectionIndex();
122
		int colSize = fColumnSizes[idx];
123
		getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_COLUMN_SIZE, colSize);
124
		fAutoLoadPref.store();
125
		fPageSizePref.store();
126
		return super.performOk();
127
	}
128
129
	protected void performDefaults() {
130
		int colSize = IDebugPreferenceConstants.PREF_COLUMN_SIZE_DEFAULT;
131
		getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_COLUMN_SIZE, colSize);
132
		int idx = -1;
133
		for (int i=0; i<fColumnSizes.length; i++)
134
		{
135
			if (colSize == fColumnSizes[i])
136
			{
137
				idx = i;
138
				break;
139
			}
140
		}
141
		if (idx > 0)
142
			fColumnSize.select(idx);
143
		fAutoLoadPref.loadDefault();
144
		fPageSizePref.loadDefault();
145
		super.performDefaults();
146
	}
147
148
	protected IPreferenceStore doGetPreferenceStore() {
149
		return DebugUIPlugin.getDefault().getPreferenceStore();
150
	}
151
152
    /**
153
     * Adds in a spacer.
154
     * 
155
     * @param composite the parent composite
156
     */
157
    private void createSpacer(Composite composite) {
158
        Label spacer = new Label(composite, SWT.NONE);
159
        GridData spacerData = new GridData();
160
        spacerData.horizontalSpan = 1;
161
        spacer.setLayoutData(spacerData);
162
    }
163
164
	public void propertyChange(PropertyChangeEvent event) {
165
		if (event.getProperty().equals(FieldEditor.VALUE))
166
		{
167
			if (event.getSource().equals(fAutoLoadPref))
168
			{
169
				boolean autoLoad = fAutoLoadPref.getBooleanValue();
170
				if (autoLoad)
171
				{
172
					fPageSizePref.setEnabled(false, fBufferComposite);
173
				}
174
				else
175
				{
176
					fPageSizePref.setEnabled(true, fBufferComposite);
177
				}
178
				validatePageSize();
179
			}
180
		}
181
		if (event.getProperty().equals(FieldEditor.VALUE))
182
		{
183
			if (event.getSource().equals(fPageSizePref))
184
			{
185
				validatePageSize();
186
			}
187
		}
188
	}
189
190
	private void validatePageSize() {
191
		boolean autoLoad = fAutoLoadPref.getBooleanValue();
192
		try {
193
			int bufferSize = fPageSizePref.getIntValue();
194
			if (!autoLoad && bufferSize < 1)
195
			{
196
				setValid(false);
197
				setErrorMessage(DebugUIMessages.TableRenderingPreferencePage_3);
198
			}
199
			else
200
			{
201
				setValid(true);
202
				setErrorMessage(null);
203
				
204
			}
205
		} catch (NumberFormatException e) {
206
			if (!autoLoad)
207
			{
208
				setValid(false);
209
				setErrorMessage(DebugUIMessages.TableRenderingPreferencePage_4);
210
			}
211
		}
212
	}
213
214
	public void dispose() {
215
216
		fAutoLoadPref.setPropertyChangeListener(null);
217
		fPageSizePref.setPropertyChangeListener(null);
218
		super.dispose();
219
	}
220
221
}

Return to bug 74559