blob: 6d9508f9340effad6a06314bb0967f9abbd732d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*******************************************************************************
* Copyright (c) 2004, 2007 QNX Software Systems 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:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.views.signals;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.debug.core.DebugException;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
/**
* Provides content for the signals view.
*
* @since: Mar 8, 2004
*/
public class SignalsViewContentProvider implements IStructuredContentProvider {
/**
* Handler for exceptions as content is retrieved
*/
private IDebugExceptionHandler fExceptionHandler = null;
public SignalsViewContentProvider() {
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements( Object inputElement ) {
if ( inputElement instanceof ICDebugTarget ) {
ICDebugTarget target = (ICDebugTarget)inputElement;
try {
Object[] signals = target.getSignals();
if ( signals != null )
return signals;
}
catch( DebugException e ) {
if ( getExceptionHandler() != null )
getExceptionHandler().handleException( e );
else
CDebugUIPlugin.log( e );
}
}
return new Object[0];
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
}
/**
* Sets an exception handler for this content provider.
*
* @param handler debug exception handler or <code>null</code>
*/
protected void setExceptionHandler(IDebugExceptionHandler handler) {
fExceptionHandler = handler;
}
/**
* Returns the exception handler for this content provider.
*
* @return debug exception handler or <code>null</code>
*/
protected IDebugExceptionHandler getExceptionHandler() {
return fExceptionHandler;
}
}
|