Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: cd29a3588229bf04daf1e139b0a6ba9628c041a3 (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
/*******************************************************************************
 * Copyright (c) 2011, 2012 Wind River Systems, Inc. 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.tcf.internal.cdt.ui.breakpoints;

import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.tcf.internal.debug.model.TCFLaunch;

public class ToggleTCFBreakpointTester extends PropertyTester {
    /*
     * (non-Javadoc)
     * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
     */
    public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
        if ( "isTCFBreakpointSupported".equals(property) ) { //$NON-NLS-1$
            ILaunch launch = getAttributeLaunch();
            if (launch != null && launch instanceof TCFLaunch) {
                return true;
            }
        }
        return false;
    }

    protected ILaunch getAttributeLaunch() {
        ILaunch launch = null;
        IAdaptable dbgContext = DebugUITools.getDebugContext();
        if (dbgContext != null) {
            launch = (ILaunch)dbgContext.getAdapter(ILaunch.class);
        }
        return launch;
    }
}

Back to the top