Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 02ad3350046760c9d513cdaecaab036472bc1f14 (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
/*******************************************************************************
 * Copyright (c) 2012, 2016 Wind River Systems and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 * 
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.debug.internal.core;

import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICDebugElement;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.core.model.IDebugModelProvider;

/**
 * Debug model provider returns additional model ID to use with 
 * GDB event breakpoints.
 */
public class DebugModelProvider implements IDebugModelProvider, IAdapterFactory {

    private final static Class<?>[] ADAPTER_LIST = new Class[] { IDebugModelProvider.class };
    private final static String GDB_MODEL_ID = "org.eclipse.cdt.gdb"; //$NON-NLS-1$
    private final static String[] MODEL_IDS = new String[] { CDIDebugModel.getPluginIdentifier(), GDB_MODEL_ID }; 
    
    @Override
    public String[] getModelIdentifiers() {
        return MODEL_IDS;
    }
    
    @SuppressWarnings("unchecked")
	@Override
    public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
        if ( adaptableObject instanceof ICDebugElement && IDebugModelProvider.class.equals(adapterType) ) {
            return (T) this;
        }
        return null;
    }
    
    @Override
    public Class<?>[] getAdapterList() {
        return ADAPTER_LIST;
    }
    
}

Back to the top