1
/*******************************************************************************
2
* Copyright (c) 2011 Ericsson
4
* All rights reserved. This program and the accompanying materials are
5
* made available under the terms of the Eclipse Public License v1.0 which
6
* accompanies this distribution, and is available at
7
* http://www.eclipse.org/legal/epl-v10.html
10
* Polytechnique Montréal - Initial API and implementation
11
* Bernd Hufmann - Productification, enhancements and fixes
13
*******************************************************************************/
14
package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model;
16
import org.eclipse.core.runtime.IAdapterFactory;
17
import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
18
import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
19
import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
20
import org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory;
21
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
22
import org.eclipse.ui.views.properties.IPropertySource;
25
* <b><u>TargetResourceAdapter</u></b>
27
* This factory maps requests for an adapter object from a given remote object.
30
public class TraceAdapterFactory extends AbstractSystemRemoteAdapterFactory implements IAdapterFactory {
32
// ------------------------------------------------------------------------
34
// ------------------------------------------------------------------------
36
private ProviderResourceAdapter providerAdapter = new ProviderResourceAdapter();
37
private TargetResourceAdapter targetAdapter = new TargetResourceAdapter();
38
private TraceResourceAdapter traceAdapter = new TraceResourceAdapter();
40
// ------------------------------------------------------------------------
42
// ------------------------------------------------------------------------
45
* Constructor for TraceAdapterFactory.
47
public TraceAdapterFactory() {
51
// ------------------------------------------------------------------------
53
// ------------------------------------------------------------------------
57
* @see org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
59
@SuppressWarnings("rawtypes")
61
public Object getAdapter(Object adaptableObject, Class adapterType) {
62
ISystemViewElementAdapter adapter = null;
63
if (adaptableObject instanceof ProviderResource) {
64
adapter = providerAdapter;
66
else if (adaptableObject instanceof TargetResource) {
67
adapter = targetAdapter;
69
else if (adaptableObject instanceof TraceResource) {
70
adapter = traceAdapter;
72
// these lines are very important!
73
if ((adapter != null) && (adapterType == IPropertySource.class)) {
74
adapter.setPropertySourceInput(adaptableObject);