Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 96b5118b8fc9caf77b2e22e489b9d357568afc56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*******************************************************************************
 * Copyright (c) 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.debug.internal.ui.viewers.update;

import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.internal.ui.viewers.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.provisional.ModelDelta;

public class MemoryBlockProxy extends EventHandlerModelProxy  {
	
	private IMemoryBlock fMemoryBlock;
	private DebugEventHandler fDebugEventHandler = new DebugEventHandler(this)  {

		protected boolean handlesEvent(DebugEvent event) {
			if (event.getKind() == DebugEvent.CHANGE && event.getSource() == fMemoryBlock)
				return true;
			
			Object src = event.getSource();
			if (src instanceof IDebugElement)
			{
				if (event.getKind() == DebugEvent.SUSPEND && ((IDebugElement)src).getDebugTarget() == fMemoryBlock.getDebugTarget())
					return true;
			}
			return false;
		}

		protected void handleChange(DebugEvent event) {
			if (event.getDetail() == DebugEvent.STATE)
			{	
				ModelDelta delta = new ModelDelta(fMemoryBlock, IModelDelta.STATE);
				fireModelChanged(delta);
			}
			else
			{
				ModelDelta delta = new ModelDelta(fMemoryBlock, IModelDelta.CONTENT);
				fireModelChanged(delta);
			}
		}

		protected void handleSuspend(DebugEvent event) {
			ModelDelta delta = new ModelDelta(fMemoryBlock, IModelDelta.CONTENT);
			fireModelChanged(delta);
		}

		public synchronized void dispose() {
			super.dispose();
		}};
	
	public MemoryBlockProxy(IMemoryBlock mb)
	{
		fMemoryBlock = mb;
	}


	protected DebugEventHandler[] createEventHandlers() {
		return new DebugEventHandler[]{fDebugEventHandler};
	}


}

Back to the top