blob: a2f1824acb8c0152bcaa69192a9adbfcf79896e3 (
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
|
/*******************************************************************************
* Copyright (c) 2012 Wind River 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:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.breakpoints;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
/**
*
*/
public class CreateBreakpointTester extends PropertyTester {
private final static String PROP_CREATE_BREAKPOINT_ADAPT = "createBreakpointAdapt"; //$NON-NLS-1$
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (PROP_CREATE_BREAKPOINT_ADAPT.equals(property) &&
receiver instanceof ICBreakpointContext &&
expectedValue instanceof String)
{
try {
Class<?> expectedClass = Class.forName((String)expectedValue);
return expectedClass.isAssignableFrom(
((ICBreakpointContext)receiver).getBreakpoint().getClass());
} catch (ClassNotFoundException e) {
CDebugUIPlugin.log(new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Unable to create class: " + expectedValue, e)); //$NON-NLS-1$
}
}
return false;
}
}
|