Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c66b2b04b9b0d5107e4dae60261f1dcfbfc8180d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*****************************************************************
 * Copyright (c) 2010 Texas Instruments 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:
 *     Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
 *     Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
 *****************************************************************/
package org.eclipse.cdt.debug.ui;

import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle;
import org.eclipse.core.runtime.PlatformObject;

/**
 * A class that encapsulates the pin element handle and implements <code>IPinHandleLableProvider</code>.
 * 
 * @since 7.1
 */
public class PinElementHandle extends PlatformObject implements IPinElementHandle {
	private Object fDebugContext;
	private String fLabel;
	private IPinElementColorDescriptor fColorDescriptor;
	
	public PinElementHandle(Object debugContext, String label, IPinElementColorDescriptor colorDescriptor) {
		fDebugContext = debugContext;
		fLabel = label;
		fColorDescriptor = colorDescriptor;
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle#getDebugContext()
	 */
	@Override
	public synchronized Object getDebugContext() {
		return fDebugContext;
	}	
	
	/**
	 * Sets the debug context.
	 * 
	 * @param debugContext the new debug context
	 */
	public synchronized void setDebugContext(Object debugContext) {
		fDebugContext = debugContext;
	}
	
	/*
	 * (non-Javadoc)
	 * @see org.eclipse.cdt.debug.core.IPinProvider.IHandleLabelProvider#getLabel()
	 */
	@Override
	public String getLabel() {
		return fLabel;
	}
	
	/*
	 * (non-Javadoc)
	 * @see org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle#getPinElementColorDescriptor()
	 */
	@Override
	public IPinElementColorDescriptor getPinElementColorDescriptor() {
		return fColorDescriptor;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof PinElementHandle) {
			if (fDebugContext == null)
				return ((PinElementHandle) obj).getDebugContext() == null;
			else
				return fDebugContext.equals(((PinElementHandle) obj).getDebugContext());
		}
		return false;
	}
}

Back to the top