Skip to main content
summaryrefslogtreecommitdiffstats
blob: fd4510cae9d7cd9ff5b73bf481a086a71319fe53 (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
package org.eclipse.osbp.ecview.dsl.imports;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.osbp.xtext.oxtype.imports.DefaultShouldImportProvider;
import org.eclipse.xtext.common.types.JvmType;

public class ShouldImportProvider extends DefaultShouldImportProvider {

	@Override
	public boolean shouldImport(EObject toImport, EReference eRef,
			EObject context) {

		// in this case, we also need to import JvmTypes
		// The JvmTypeOrganizeImport stuff will not do so, since
		// UiBeanSlot#jvmType has no parent context based on JvmType hence no
		// inferrer
		if (toImport instanceof JvmType) {
			return true;
		}

		boolean result = toImport.eResource() != context.eResource();

		if (result == true) {
			return doShouldImport(toImport, eRef, context);
		} else {
			return false;
		}
	}

	protected boolean doShouldImport(EObject toImport, EReference eRef,
			EObject context) {
		return false;
	}
}

Back to the top