blob: cade55663bfefc41810e070bc8d3702c7aae5e91 (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/*******************************************************************************
* Copyright (c) 2000, 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core;
import java.util.Observable;
import org.eclipse.cdt.debug.core.ICUpdateManager;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIManager;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugTarget;
/**
* Enter type comment.
*
* @since Mar 31, 2003
*/
public abstract class CUpdateManager extends Observable implements ICUpdateManager, IAdaptable
{
private CDebugTarget fDebugTarget = null;
/**
*
*/
public CUpdateManager( CDebugTarget target )
{
fDebugTarget = target;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICUpdateManager#setAutoModeEnabled(boolean)
*/
public void setAutoModeEnabled( boolean enable )
{
if ( getCDIManager() != null )
{
getCDIManager().setAutoUpdate( enable );
setChanged();
notifyObservers();
clearChanged();
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICUpdateManager#getAutoModeEnabled()
*/
public boolean getAutoModeEnabled()
{
if ( getCDIManager() != null )
{
return getCDIManager().isAutoUpdate();
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICUpdateManager#update()
*/
public void update() throws DebugException
{
if ( getCDIManager() != null )
{
try
{
getCDIManager().update();
}
catch( CDIException e )
{
getDebugTarget().targetRequestFailed( e.getMessage(), null );
}
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICUpdateManager#canUpdate()
*/
public boolean canUpdate()
{
if ( getDebugTarget() != null )
{
return getDebugTarget().isSuspended();
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter( Class adapter )
{
if ( ICUpdateManager.class.equals( adapter ) )
return this;
if ( IDebugTarget.class.equals( adapter ) )
return getDebugTarget();
if ( ICDebugTarget.class.equals( adapter ) )
return getDebugTarget();
if ( Observable.class.equals( adapter ) )
return this;
return null;
}
public CDebugTarget getDebugTarget()
{
return fDebugTarget;
}
public void dispose() {
deleteObservers();
}
abstract protected ICDIManager getCDIManager();
}
|