Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 283586 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java (-2 / +20 lines)
Lines 205-211 Link Here
205
				fViewPaneCanvas.layout();
205
				fViewPaneCanvas.layout();
206
			}
206
			}
207
		} else {	//otherwise, add a new one
207
		} else {	//otherwise, add a new one
208
			fTabFolderForDebugView.put(key, new CTabFolder(fViewPaneCanvas, SWT.NULL));
208
			CTabFolder tabFolder = new CTabFolder(fViewPaneCanvas, SWT.NULL);
209
			if (!fTabFolderForDebugView.containsKey(key)) {
210
					System.out.println("Adding tabFolder " + 
211
							LoggingUtils.toString(tabFolder, true) +
212
							" to table in " +
213
							LoggingUtils.toString(this, true));
214
			}					
215
			
216
			fTabFolderForDebugView.put(key, tabFolder);
209
			setTabFolder((CTabFolder)fTabFolderForDebugView.get(key));
217
			setTabFolder((CTabFolder)fTabFolderForDebugView.get(key));
210
			fViewPaneCanvas.layout();
218
			fViewPaneCanvas.layout();
211
		}
219
		}
Lines 290-297 Link Here
290
							public void run() {
298
							public void run() {
291
								//remove the tab folder , and all contained tab items
299
								//remove the tab folder , and all contained tab items
292
								disposeOfFolder((CTabFolder) folder);
300
								disposeOfFolder((CTabFolder) folder);
293
								if (fTabFolderForDebugView != null)
301
								if (fTabFolderForDebugView != null) {
302
									System.out.println("Removing tabFolder " + 
303
											LoggingUtils.toString(folder, true) +
304
											" from table in " +
305
											LoggingUtils.toString(this, true));
306
									
294
									fTabFolderForDebugView.remove(key);
307
									fTabFolderForDebugView.remove(key);
308
								}
309
									
295
							}
310
							}
296
						});
311
						});
297
					}
312
					}
Lines 323-328 Link Here
323
				}
338
				}
324
				
339
				
325
				// set to null so that clean up is only done once
340
				// set to null so that clean up is only done once
341
				System.out.println("Clearing table in " +
342
						LoggingUtils.toString(this, true));
343
				
326
				fTabFolderForDebugView.clear();
344
				fTabFolderForDebugView.clear();
327
				fTabFolderForDebugView = null;
345
				fTabFolderForDebugView = null;
328
			}
346
			}
(-)ui/org/eclipse/debug/internal/ui/views/memory/LoggingUtils.java (+57 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 Freescale Semiconductor, Inc. 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
 *    Freescale Semiconductor - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.views.memory;
12
13
/**
14
 * Some general purpose functions that can be useful for logging/tracing activities.
15
 */
16
public class LoggingUtils {
17
	/**
18
	 * Return a string that uniquely identifies a Java object reference, in the
19
	 * form "classname@id", where 'classname' is the simple or package qualified
20
	 * name of the object's class, and 'id' is the hash code.
21
	 * 
22
	 * Why not just use obj.toString()? That method is often overriden, and so
23
	 * cannot be relied on for a representation that uniquely identifies the
24
	 * object in the VM space.
25
	 * 
26
	 * @param obj
27
	 *            the object reference to stringify
28
	 * @param simpleClassName
29
	 *            if true, use the class's simple name, otherwise the package
30
	 *            qualified one
31
	 * 
32
	 * @return the stringified representation of the object reference
33
	 */
34
	public static String toString(Object obj, boolean simpleClassName) {
35
		if (obj == null) {
36
			return "null";  //$NON-NLS-1$
37
		}
38
		String className = obj.getClass().getName();
39
		if (simpleClassName) {
40
			int lastDot = className.lastIndexOf('.');
41
			if ((lastDot >= 0) && ((lastDot + 1) < className.length())) {
42
				className = className.substring(lastDot + 1);
43
			}
44
		}
45
46
		String id = Integer.toHexString(System.identityHashCode(obj));
47
	
48
		return className + "@" + id; //$NON-NLS-1$
49
	}
50
	
51
	/**
52
	 * Equivalent to toString(obj, false)
53
	 */
54
	public static String toString(Object obj) {
55
		return toString(obj, true);
56
	}
57
}
(-)ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java (-4 / +48 lines)
Lines 177-184 Link Here
177
					if (retrieve != null)
177
					if (retrieve != null)
178
					{
178
					{
179
						if (fTabFolderForDebugView.contains(tabFolder))
179
						if (fTabFolderForDebugView.contains(tabFolder))
180
						{					
180
						{
181
							fTabFolderForDebugView.remove(MemoryViewUtil.getHashCode(retrieve));
181
							fTabFolderForDebugView.remove(MemoryViewUtil.getHashCode(retrieve));
182
							System.out.println("Removing tabFolder " + 
183
									LoggingUtils.toString(tabFolder, true) +
184
									" from table in " +
185
									LoggingUtils.toString(this, true));
182
						}
186
						}
183
					}
187
					}
184
					
188
					
Lines 606-611 Link Here
606
			// backup current retrieve and tab folder
610
			// backup current retrieve and tab folder
607
			if (currentRetrieve != null && tabFolder != null)
611
			if (currentRetrieve != null && tabFolder != null)
608
			{
612
			{
613
				if (!fTabFolderForDebugView.containsKey(MemoryViewUtil.getHashCode(currentRetrieve))) {
614
					System.out.println("Adding tabFolder " + 
615
							LoggingUtils.toString(tabFolder, true) +
616
							" to table in " +
617
							LoggingUtils.toString(this, true));
618
				}
609
				fTabFolderForDebugView.put(MemoryViewUtil.getHashCode(currentRetrieve), tabFolder);
619
				fTabFolderForDebugView.put(MemoryViewUtil.getHashCode(currentRetrieve), tabFolder);
610
			}
620
			}
611
		}
621
		}
Lines 623-628 Link Here
623
			if (folder != null)
633
			if (folder != null)
624
			{	
634
			{	
625
				setTabFolder(folder);
635
				setTabFolder(folder);
636
				if (!fTabFolderForDebugView.containsKey(key)) {
637
				System.out.println("Adding tabFolder " + 
638
						LoggingUtils.toString(tabFolder, true) +
639
						" to table in " +
640
						LoggingUtils.toString(this, true));
641
				}
642
				
626
				fTabFolderForDebugView.put(key, folder);
643
				fTabFolderForDebugView.put(key, folder);
627
				fViewPaneCanvas.layout();
644
				fViewPaneCanvas.layout();
628
			}
645
			}
Lines 639-644 Link Here
639
				else
656
				else
640
				{	
657
				{	
641
					emptyFolder();
658
					emptyFolder();
659
					if (!fTabFolderForDebugView.containsKey(key)) {
660
						System.out.println("Adding tabFolder " + 
661
								LoggingUtils.toString(fEmptyTabFolder, true) +
662
								" to table in " +
663
								LoggingUtils.toString(this, true));
664
					}
642
					fTabFolderForDebugView.put(key, fEmptyTabFolder);
665
					fTabFolderForDebugView.put(key, fEmptyTabFolder);
643
					fViewPaneCanvas.layout();
666
					fViewPaneCanvas.layout();
644
				}
667
				}
Lines 849-856 Link Here
849
				fMemoryBlockFromTabFolder.put(folder, memoryBlock);
872
				fMemoryBlockFromTabFolder.put(folder, memoryBlock);
850
				setTabFolder((CTabFolder)fTabFolderForMemoryBlock.get(memoryBlock));
873
				setTabFolder((CTabFolder)fTabFolderForMemoryBlock.get(memoryBlock));
851
				IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(memoryBlock);
874
				IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(memoryBlock);
852
				if (retrieval != null)
875
				if (retrieval != null) {
876
					if (!fTabFolderForDebugView.containsKey(MemoryViewUtil.getHashCode(retrieval))) {
877
						System.out.println("Adding tabFolder " + 
878
								LoggingUtils.toString(fTabFolderForMemoryBlock.get(memoryBlock), true) +
879
								" to table in " +
880
								LoggingUtils.toString(this, true));
881
					}
853
					fTabFolderForDebugView.put(MemoryViewUtil.getHashCode(retrieval), fTabFolderForMemoryBlock.get(memoryBlock));
882
					fTabFolderForDebugView.put(MemoryViewUtil.getHashCode(retrieval), fTabFolderForMemoryBlock.get(memoryBlock));
883
				}
854
				else
884
				else
855
					DebugUIPlugin.logErrorMessage("Memory block retrieval for memory block is null."); //$NON-NLS-1$
885
					DebugUIPlugin.logErrorMessage("Memory block retrieval for memory block is null."); //$NON-NLS-1$
856
				
886
				
Lines 870-877 Link Here
870
					setTabFolder(toDisplay);
900
					setTabFolder(toDisplay);
871
					IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(memoryBlock);
901
					IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(memoryBlock);
872
					
902
					
873
					if (retrieval != null)
903
					if (retrieval != null) {
904
						if (!fTabFolderForDebugView.containsKey(MemoryViewUtil.getHashCode(retrieval))) {
905
							System.out.println("Adding tabFolder " + 
906
									LoggingUtils.toString(toDisplay, true) +
907
									" to table in " +
908
									LoggingUtils.toString(this, true));
909
						}
874
						fTabFolderForDebugView.put(MemoryViewUtil.getHashCode(retrieval), toDisplay);
910
						fTabFolderForDebugView.put(MemoryViewUtil.getHashCode(retrieval), toDisplay);
911
						
912
					}
875
					else
913
					else
876
						DebugUIPlugin.logErrorMessage("Memory block retrieval is null for memory block."); //$NON-NLS-1$
914
						DebugUIPlugin.logErrorMessage("Memory block retrieval is null for memory block."); //$NON-NLS-1$
877
					
915
					
Lines 1209-1215 Link Here
1209
			
1247
			
1210
			IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(memory);
1248
			IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(memory);
1211
			if (retrieval != null)
1249
			if (retrieval != null)
1212
			{
1250
			{						
1251
				if (!fTabFolderForDebugView.containsKey(MemoryViewUtil.getHashCode(retrieval))) {
1252
					System.out.println("Adding tabFolder " + 
1253
							LoggingUtils.toString(folder, true) +
1254
							" to table in " +
1255
							LoggingUtils.toString(this, true));
1256
				}
1213
				fTabFolderForDebugView.put(MemoryViewUtil.getHashCode(retrieval), folder);
1257
				fTabFolderForDebugView.put(MemoryViewUtil.getHashCode(retrieval), folder);
1214
			}
1258
			}
1215
			else {
1259
			else {

Return to bug 283586