Преглед на файлове

disabled enumerations to scope
#159

Andreas Muelder преди 9 години
родител
ревизия
8e540778bf
променени са 1 файла, в които са добавени 16 реда и са изтрити 15 реда
  1. 16 15
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java

+ 16 - 15
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java

@@ -37,7 +37,6 @@ import org.yakindu.base.expressions.expressions.FeatureCall;
 import org.yakindu.base.types.ComplexType;
 import org.yakindu.base.types.Declaration;
 import org.yakindu.base.types.EnumerationType;
-import org.yakindu.base.types.TypesPackage;
 import org.yakindu.base.xtext.utils.jface.viewers.ContextElementAdapter;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Scope;
@@ -118,16 +117,18 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		IScope unnamedScope = getUnnamedTopLevelScope(context, reference);
 		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
 		unnamedScope = new FilteringScope(unnamedScope, predicate);
-		// add enum types
-		IScope enumerations = new FilteringScope(getDelegate().getScope(context, reference),
-				new Predicate<IEObjectDescription>() {
-					@Override
-					public boolean apply(IEObjectDescription input) {
-						return input.getEClass() == TypesPackage.Literals.ENUMERATION_TYPE;
-					}
-				});
-		return new SimpleScope(Iterables.concat(namdScope.getAllElements(), unnamedScope.getAllElements(),
-				enumerations.getAllElements()));
+		// TODO: Performance problem -> fix this in context of Add Support for
+		// Enumerations #165
+		// // add enum types
+		// IScope enumerations = new
+		// FilteringScope(getDelegate().getScope(context, reference),
+		// new Predicate<IEObjectDescription>() {
+		// @Override
+		// public boolean apply(IEObjectDescription input) {
+		// return input.getEClass() == TypesPackage.Literals.ENUMERATION_TYPE;
+		// }
+		// });
+		return new SimpleScope(Iterables.concat(namdScope.getAllElements(), unnamedScope.getAllElements()));
 	}
 
 	public IScope scope_FeatureCall_feature(final FeatureCall context, EReference reference) {
@@ -214,8 +215,8 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		if (importedNamespace == null || importedNamespace.getSegmentCount() < 1) {
 			return null;
 		}
-		boolean hasWildCard = ignoreCase ? importedNamespace.getLastSegment().equalsIgnoreCase("*") : importedNamespace
-				.getLastSegment().equals("*");
+		boolean hasWildCard = ignoreCase ? importedNamespace.getLastSegment().equalsIgnoreCase("*")
+				: importedNamespace.getLastSegment().equals("*");
 		if (hasWildCard) {
 			if (importedNamespace.getSegmentCount() <= 1)
 				return null;
@@ -271,8 +272,8 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 	 * Returns the {@link Statechart} for a context element
 	 */
 	protected Statechart getStatechart(EObject context) {
-		final ContextElementAdapter provider = (ContextElementAdapter) EcoreUtil.getExistingAdapter(
-				context.eResource(), ContextElementAdapter.class);
+		final ContextElementAdapter provider = (ContextElementAdapter) EcoreUtil.getExistingAdapter(context.eResource(),
+				ContextElementAdapter.class);
 
 		if (provider == null) {
 			return EcoreUtil2.getContainerOfType(context, Statechart.class);