Commit b3af87da authored by Philip Makedonski's avatar Philip Makedonski
Browse files

* imported reference refinements

parent 1618f5d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ public class FileParser implements Callable<Resource> {
		}	
		
		synchronized (TTCN3GlobalScopeProvider.EXPORTED_OBJECTS) {
			TTCN3GlobalScopeProvider.EXPORTED_OBJECTS.putAll(resource, objects);
			TTCN3GlobalScopeProvider.EXPORTED_OBJECTS.putAll(resource.getURI().toString(), objects);
		}
		
	}
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public class ScopeRebuild extends BuilderParticipant {
			throws org.eclipse.core.runtime.CoreException {
		super.handleChangedContents(delta, context, fileSystemAccess);
		if (!buildSemaphor.get()) {
			//invokeRebuild(delta, context, fileSystemAccess);
			invokeRebuild(delta, context, fileSystemAccess);
		}
	}

@@ -107,6 +107,6 @@ public class ScopeRebuild extends BuilderParticipant {
		}
			
		TTCN3StatisticsProvider.getInstance().setPreAnalyzingCompleted(true);

		buildSemaphor.set(false);
	}
}
 No newline at end of file
+10 −10
Original line number Diff line number Diff line
@@ -27,20 +27,20 @@ public class PreAnalyzer implements Callable<Boolean> {
			if (importedModule != null) {

				synchronized (TTCN3GlobalScopeProvider.IMPORTS) {
					if (TTCN3GlobalScopeProvider.IMPORTS.containsKey(this.resource)) {
						TTCN3GlobalScopeProvider.IMPORTS.get(this.resource)
					if (TTCN3GlobalScopeProvider.IMPORTS.containsKey(this.resource.getURI().toString())) {
						TTCN3GlobalScopeProvider.IMPORTS.get(this.resource.getURI().toString())
								.add(initializeImportedObjects(i, importedModule));
					} else {
						TTCN3GlobalScopeProvider.IMPORTS.put(this.resource,
						TTCN3GlobalScopeProvider.IMPORTS.put(this.resource.getURI().toString(),
								initializeImportedObjects(i, importedModule));
					}
				}

				synchronized (TTCN3GlobalScopeProvider.IMPORTED_RESOURCES) {
					if (TTCN3GlobalScopeProvider.IMPORTED_RESOURCES.containsKey(this.resource)) {
						TTCN3GlobalScopeProvider.IMPORTED_RESOURCES.get(this.resource).add(importedModule.eResource());
					if (TTCN3GlobalScopeProvider.IMPORTED_RESOURCES.containsKey(this.resource.getURI().toString())) {
						TTCN3GlobalScopeProvider.IMPORTED_RESOURCES.get(this.resource.getURI().toString()).add(importedModule.eResource().getURI().toString());
					} else {
						TTCN3GlobalScopeProvider.IMPORTED_RESOURCES.put(this.resource, importedModule.eResource());
						TTCN3GlobalScopeProvider.IMPORTED_RESOURCES.put(this.resource.getURI().toString(), importedModule.eResource().getURI().toString());
					}
				}

@@ -66,11 +66,11 @@ public class PreAnalyzer implements Callable<Boolean> {
				
				if (!isASN) {
					synchronized (TTCN3GlobalScopeProvider.IMPORTS) {
						if (TTCN3GlobalScopeProvider.IMPORTS.containsKey(this.resource)) {
							TTCN3GlobalScopeProvider.IMPORTS.get(this.resource)
						if (TTCN3GlobalScopeProvider.IMPORTS.containsKey(this.resource.getURI().toString())) {
							TTCN3GlobalScopeProvider.IMPORTS.get(this.resource.getURI().toString())
									.add(initializeImportedObjects(i, importedModule));
						} else {
							TTCN3GlobalScopeProvider.IMPORTS.put(this.resource,
							TTCN3GlobalScopeProvider.IMPORTS.put(this.resource.getURI().toString(),
									initializeImportedObjects(i, importedModule));
						}
					}
@@ -85,7 +85,7 @@ public class PreAnalyzer implements Callable<Boolean> {
		ImportData data = new ImportData(def.getName(), def, module);
		
		if (module != null) {
			data.getExportedObjects().addAll(TTCN3GlobalScopeProvider.EXPORTED_OBJECTS.get(module.eResource()));
			data.getExportedObjects().addAll(TTCN3GlobalScopeProvider.EXPORTED_OBJECTS.get(module.eResource().getURI().toString()));
		}
		
		return data;
+10 −10
Original line number Diff line number Diff line
@@ -48,16 +48,16 @@ import de.ugoe.cs.swe.validation.TTCN3StatisticsProvider;
public class TTCN3GlobalScopeProvider extends AbstractGlobalScopeProvider {

	// TODO: do not use this map when using the xtext eclipse editor
	public static final Map<Resource, IScope> STATIC_SCOPE = Collections.synchronizedMap(Maps.<Resource, IScope> newHashMap());
	public static final Map<String, IScope> STATIC_SCOPE = Collections.synchronizedMap(Maps.<String, IScope> newHashMap());

	public static final SetMultimap<Resource, Resource> IMPORTED_RESOURCES = Multimaps
			.synchronizedSetMultimap(HashMultimap.<Resource, Resource> create());
	public static final SetMultimap<Resource, ImportData> IMPORTS = Multimaps
			.synchronizedSetMultimap(HashMultimap.<Resource, ImportData> create());
	public static final SetMultimap<String, String> IMPORTED_RESOURCES = Multimaps
			.synchronizedSetMultimap(HashMultimap.<String, String> create());
	public static final SetMultimap<String, ImportData> IMPORTS = Multimaps
			.synchronizedSetMultimap(HashMultimap.<String, ImportData> create());
	public static final Multimap<TTCN3Module, TTCN3Module> IMPORTED_FROM = Multimaps
			.synchronizedSetMultimap(HashMultimap.<TTCN3Module, TTCN3Module> create());
	public static final SetMultimap<Resource, IEObjectDescription> EXPORTED_OBJECTS = Multimaps
			.synchronizedSetMultimap(HashMultimap.<Resource, IEObjectDescription> create());
	public static final SetMultimap<String, IEObjectDescription> EXPORTED_OBJECTS = Multimaps
			.synchronizedSetMultimap(HashMultimap.<String, IEObjectDescription> create());
	
	public static final List<Resource> RESOURCES = Collections.synchronizedList(Lists.<Resource> newArrayList());
	public static final Map<String, TTCN3Module> NAMED_MODULES = Collections.synchronizedMap(Maps.<String, TTCN3Module> newHashMap());
@@ -97,7 +97,7 @@ public class TTCN3GlobalScopeProvider extends AbstractGlobalScopeProvider {
			
			//TODO: check performance implications, seems to be needed for GUI usage within eclipse
			synchronized (IMPORTS) {
				for (ImportData importData : IMPORTS.get(resource)) {
				for (ImportData importData : IMPORTS.get(resource.getURI().toString())) {
					objects.addAll(importData.getExportedObjects());
				}
			}
@@ -108,7 +108,7 @@ public class TTCN3GlobalScopeProvider extends AbstractGlobalScopeProvider {
			synchronized (STATIC_SCOPE) {
				scope = MultimapBasedScope.createScope(IScope.NULLSCOPE, objects, isIgnoreCase(reference));
				if (TTCN3StatisticsProvider.getInstance().isParsingCompleted()) {
					STATIC_SCOPE.put(resource, scope);
					STATIC_SCOPE.put(resource.getURI().toString(), scope);
				}
			}
			if (LIVE) {
@@ -302,7 +302,7 @@ public class TTCN3GlobalScopeProvider extends AbstractGlobalScopeProvider {
		}	
		
		synchronized (TTCN3GlobalScopeProvider.EXPORTED_OBJECTS) {
			TTCN3GlobalScopeProvider.EXPORTED_OBJECTS.putAll(resource, objects);
			TTCN3GlobalScopeProvider.EXPORTED_OBJECTS.putAll(resource.getURI().toString(), objects);
		}
		
	}
+2 −2
Original line number Diff line number Diff line
@@ -629,8 +629,8 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider {
		}
		var list = <EObject>newArrayList
		synchronized (IMPORTS) {
			if (IMPORTS.containsKey(module.eResource)) {
				val imported = IMPORTS.get(module.eResource)
			if (IMPORTS.containsKey(module.eResource.URI.toString())) {
				val imported = IMPORTS.get(module.eResource.URI.toString())
				for (i : 0 .. imported.size - 1) {
					val d = imported.get(i)
					for (o : d.exportedObjects) {
Loading