Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e68c86ffc5b0541316e2f2f47c427fa8403a8895 (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
/*****************************************************************************
 * Copyright (c) 2011, 2016 Atos Origin Integration, Christian W. Damus, 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:
 *  Tristan Faure (Atos Origin Integration) tristan.faure@atosorigin.com - Initial API and implementation
 *  Christian W. Damus - bug 485220
 *  
 *****************************************************************************/
package org.eclipse.papyrus.infra.onefile.internal.ui.model.adapters;

import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.papyrus.infra.onefile.model.ISubResourceFile;
import org.eclipse.ui.IContributorResourceAdapter;

/**
 * Adapter Factory for {@link ISubResourceFile}
 *
 * @author tristan.faure@atosorigin.com
 *
 */
public class SubResourceAdapterFactory implements IAdapterFactory {

	public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
		if (IContributorResourceAdapter.class.equals(adapterType)) {
			if (adaptableObject instanceof ISubResourceFile) {
				return adapterType.cast(new PapyrusModelContributorResourceAdapter());
			}
		}
		return null;
	}

	public Class<?>[] getAdapterList() {
		return new Class[] { IContributorResourceAdapter.class };
	}

}

Back to the top