~ubuntu-branches/ubuntu/utopic/eclipse-linuxtools/utopic

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TraceAdapterFactory.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2014-05-12 18:11:40 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140512181140-w237r3vsah1tmybz
Tags: 2.2.1-1
* New upstream release.
* Refreshed d/patches.
* Removed eclipse-cdt-valgrind-remote package, all its functionality
  is now provided by eclipse-cdt-profiling-framework-remote.
* Added remove-license-feature.patch.
* Bump Standards-Version to 3.9.5.
* Enable eclipse-changelog package.
* Enable eclipse-rpm-editor package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 * Copyright (c) 2011 Ericsson
3
 
 * 
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
8
 
 * 
9
 
 * Contributors:
10
 
 *   Polytechnique Montréal - Initial API and implementation
11
 
 *   Bernd Hufmann - Productification, enhancements and fixes
12
 
 *   
13
 
 *******************************************************************************/
14
 
package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model;
15
 
 
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;
23
 
 
24
 
/**
25
 
 * <b><u>TargetResourceAdapter</u></b>
26
 
 * <p>
27
 
 * This factory maps requests for an adapter object from a given remote object.
28
 
 * </p>
29
 
 */
30
 
public class TraceAdapterFactory extends AbstractSystemRemoteAdapterFactory implements IAdapterFactory {
31
 
 
32
 
    // ------------------------------------------------------------------------
33
 
    // Attributes
34
 
    // ------------------------------------------------------------------------
35
 
 
36
 
    private ProviderResourceAdapter providerAdapter = new ProviderResourceAdapter();
37
 
    private TargetResourceAdapter targetAdapter = new TargetResourceAdapter();
38
 
    private TraceResourceAdapter traceAdapter = new TraceResourceAdapter();
39
 
 
40
 
    // ------------------------------------------------------------------------
41
 
    // Constructors
42
 
    // ------------------------------------------------------------------------
43
 
 
44
 
    /**
45
 
     * Constructor for TraceAdapterFactory.
46
 
     */
47
 
    public TraceAdapterFactory() {
48
 
        super();
49
 
    }
50
 
 
51
 
    // ------------------------------------------------------------------------
52
 
    // Operations
53
 
    // ------------------------------------------------------------------------
54
 
 
55
 
    /*
56
 
     * (non-Javadoc)
57
 
     * @see org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
58
 
     */
59
 
    @SuppressWarnings("rawtypes")
60
 
    @Override
61
 
    public Object getAdapter(Object adaptableObject, Class adapterType) {
62
 
        ISystemViewElementAdapter adapter = null;
63
 
        if (adaptableObject instanceof ProviderResource) {
64
 
            adapter = providerAdapter;
65
 
        }
66
 
        else if (adaptableObject instanceof TargetResource) {
67
 
            adapter = targetAdapter;
68
 
        }
69
 
        else if (adaptableObject instanceof TraceResource) {
70
 
            adapter = traceAdapter;
71
 
        }
72
 
        // these lines are very important!
73
 
        if ((adapter != null) && (adapterType == IPropertySource.class)) {
74
 
            adapter.setPropertySourceInput(adaptableObject);
75
 
        }
76
 
        return adapter;
77
 
    }
78
 
}