Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 20c25b9b74a25ab28276714dfc41be1d63b430b5 (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
/**
 * Copyright (c) 2012 itemis AG 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:
 * 	itemis AG - initial API and implementation
 * 
 */
package org.eclipse.papyrus.uml.xtext.integration.core;

import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;

/**
 * The {@link ContextElementAdapter} is added to the FakeResource to get access
 * to the context element for scoping/validation.
 * 
 * @author andreas muelder - Initial contribution and API
 * 
 */

public class ContextElementAdapter extends AdapterImpl {

	public interface IContextElementProvider {
		public EObject getContextObject();
	}

	private final IContextElementProvider provider;

	public ContextElementAdapter(IContextElementProvider provider) {
		this.provider = provider;
	}

	@Override
	public boolean isAdapterForType(Object type) {
		return type == ContextElementAdapter.class;
	}

	public EObject getElement() {
		return provider.getContextObject();
	}
}

Back to the top