use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class STextScopeProvider method getNamedTopLevelScope.
/**
* Returns the toplevel scope
*/
protected IScope getNamedTopLevelScope(final EObject context, EReference reference) {
List<EObject> scopeCandidates = Lists.newArrayList();
Statechart statechart = getStatechart(context);
if (statechart == null)
return IScope.NULLSCOPE;
EList<Scope> scopes = statechart.getScopes();
for (Scope scope : scopes) {
if (scope instanceof InterfaceScope) {
String name = ((InterfaceScope) scope).getName();
if (name != null && name.trim().length() > 0) {
scopeCandidates.add(scope);
}
}
}
return Scopes.scopeFor(scopeCandidates);
}
use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class STextScopeProvider method getUnnamedTopLevelScope.
/**
* Returns a scope with all toplevel declarations of unnamed scope
*/
protected IScope getUnnamedTopLevelScope(final EObject context, EReference reference) {
List<EObject> scopeCandidates = Lists.newArrayList();
Statechart statechart = getStatechart(context);
if (statechart == null)
return IScope.NULLSCOPE;
EList<Scope> scopes = statechart.getScopes();
for (Scope scope : scopes) {
if (scope instanceof InterfaceScope) {
String name = ((InterfaceScope) scope).getName();
if (name == null || name.trim().length() == 0) {
scopeCandidates.addAll(scope.getDeclarations());
}
} else if (scope instanceof InternalScope) {
scopeCandidates.addAll(scope.getDeclarations());
}
}
// Add import scope
IScope scope = getDelegate().getScope(context, reference);
return Scopes.scopeFor(scopeCandidates, scope);
}
use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class StateSpecificationImpl method basicSetScope.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetScope(Scope newScope, NotificationChain msgs) {
Scope oldScope = scope;
scope = newScope;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StextPackage.STATE_SPECIFICATION__SCOPE, oldScope, newScope);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class StextResource method serializeState.
protected void serializeState(State state) {
if (state.getScopes().size() != 1)
return;
Scope scope = state.getScopes().get(0);
EList<Reaction> reactions = scope.getReactions();
StringBuilder builder = new StringBuilder();
for (Reaction reaction : reactions) {
if (builder.length() > 0)
builder.append(NEW_LINE);
builder.append(serializeReaction(reaction));
}
state.setSpecification(builder.toString());
}
use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class StatechartImpl method getLocalReactions.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
public EList<Reaction> getLocalReactions() {
EList<Reaction> result = new BasicInternalEList<Reaction>(Reaction.class);
EList<Scope> scopes = getScopes();
for (Scope scope : scopes) {
result.addAll(scope.getReactions());
}
return result;
}
Aggregations