blob: ceca0c11291b03224ac9b1d85ea39be7031601f5 (
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
|
/*******************************************************************************
* Copyright (c) 2014 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.debug.ui.adapters;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.core.model.IDebugModelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
import org.eclipse.debug.ui.contexts.ISuspendTrigger;
import org.eclipse.tcf.internal.debug.model.TCFLaunch;
import org.eclipse.tcf.internal.debug.ui.model.TCFModel;
import org.eclipse.tcf.internal.debug.ui.model.TCFModelManager;
import org.eclipse.ui.views.properties.IPropertySource;
public class TCFLaunchAdapterFactory implements IAdapterFactory {
private static final Class<?>[] adapter_list = {
IElementLabelProvider.class,
IElementContentProvider.class,
IModelSelectionPolicyFactory.class,
IModelProxyFactory.class,
ISuspendTrigger.class,
IPropertySource.class,
IDebugModelProvider.class,
};
private static final IElementLabelProvider launch_label_provider = new TCFLaunchLabelProvider();
@SuppressWarnings("rawtypes")
public Object getAdapter(final Object from, final Class to) {
if (from instanceof TCFLaunch) {
if (to == IElementLabelProvider.class) return launch_label_provider;
TCFModel model = TCFModelManager.getModelSync((TCFLaunch)from);
if (model != null) {
if (to.isInstance(model)) return model;
if (to == IPropertySource.class) return new TCFNodePropertySource(model.getRootNode());
if (to == IDebugModelProvider.class) return model.getAdapter(to, model.getRootNode());
if (to == IModelSelectionPolicyFactory.class) return model.getAdapter(to, model.getRootNode());
}
return null;
}
return null;
}
@SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
return adapter_list;
}
}
|