use of org.yakindu.sct.model.stext.stext.InternalScope in project statecharts by Yakindu.
the class STextProposalProvider method completeKeyword.
/**
* Validates if a keyword should be viewed by the proposal view.
*
* Builds dependent on the ContentAssistContext a list with keywords which
* shouldn't be displayed by the proposal view.
*/
@Override
public void completeKeyword(Keyword keyword, ContentAssistContext contentAssistContext, ICompletionProposalAcceptor acceptor) {
List<Keyword> suppressKeywords = new ArrayList<Keyword>();
EObject rootModel = contentAssistContext.getRootModel();
if (rootModel instanceof TransitionSpecification) {
suppressKeywords(suppressKeywords, (TransitionSpecification) rootModel);
} else if (rootModel instanceof SimpleScope) {
suppressKeywords(suppressKeywords, (SimpleScope) rootModel);
} else if (rootModel instanceof StatechartSpecification) {
suppressKeywords(suppressKeywords, (StatechartSpecification) rootModel);
}
EObject currentModel = contentAssistContext.getCurrentModel();
if (currentModel instanceof InterfaceScope) {
suppressKeywords(suppressKeywords, (InterfaceScope) currentModel);
}
if (currentModel instanceof FeatureCall) {
suppressKeywords(suppressKeywords, (FeatureCall) currentModel);
}
if (currentModel instanceof ElementReferenceExpression) {
suppressKeywords(suppressKeywords, (ElementReferenceExpression) currentModel);
}
if (currentModel instanceof InternalScope) {
suppressKeywords(suppressKeywords, (InternalScope) currentModel);
}
if (!suppressKeywords.contains(keyword)) {
super.completeKeyword(keyword, contentAssistContext, new AcceptorDelegate(acceptor));
}
}
use of org.yakindu.sct.model.stext.stext.InternalScope in project statecharts by Yakindu.
the class ModelSequencertDeclarationsTest method testMapEmptyInternalScope.
/**
* An InternalScope must be mapped to an InternalScope.
*/
@Test
public void testMapEmptyInternalScope() {
InternalScope scope = _createInternalScope(null);
Scope _scope = structureMapping.mapScope(scope);
assertTrue(_scope instanceof InternalScope);
}
use of org.yakindu.sct.model.stext.stext.InternalScope in project statecharts by Yakindu.
the class StatechartObjectViewerFilter method select.
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof DomainNavigatorItem) {
DomainNavigatorItem navigatorItem = (DomainNavigatorItem) element;
EObject modelElement = navigatorItem.getEObject();
if (modelElement instanceof Diagram) {
return false;
}
if (modelElement instanceof Trigger) {
return false;
}
if (modelElement instanceof InternalScope || modelElement instanceof InterfaceScope) {
return true;
}
if (modelElement instanceof Scope) {
return false;
}
if (modelElement instanceof LocalReaction) {
return false;
}
if (modelElement instanceof ReactionEffect) {
return false;
}
if (modelElement instanceof Expression) {
return false;
}
}
return true;
}
use of org.yakindu.sct.model.stext.stext.InternalScope in project statecharts by Yakindu.
the class SCTResourceTest method testStatechartParsing.
@Test
public void testStatechartParsing() {
Statechart statechart = createStatechart("internal: event Event1");
assertEquals(0, statechart.getScopes().size());
res.getContents().add(statechart);
assertEquals(1, statechart.getScopes().size());
Scope scope = statechart.getScopes().get(0);
assertTrue(scope instanceof InternalScope);
EList<Declaration> declarations = ((InternalScope) scope).getDeclarations();
Declaration declaration = declarations.get(0);
assertTrue(declaration instanceof EventDefinition);
assertEquals("" + res.getSyntaxDiagnostics(), 0, res.getSyntaxDiagnostics().size());
}
use of org.yakindu.sct.model.stext.stext.InternalScope in project statecharts by Yakindu.
the class SCTResourceTest method testStatechartSerializing1.
@Test
public void testStatechartSerializing1() throws Exception {
res.setSerializerEnabled(true);
Statechart statechart = createStatechart("internal: event Event1");
res.getContents().add(statechart);
Scope internalScope = (InternalScope) statechart.getScopes().get(0);
Event event = internalScope.getEvents().get(0);
event.setName("Event2");
assertEquals("internal: event Event2", statechart.getSpecification().trim());
assertEquals("" + res.getSyntaxDiagnostics(), 0, res.getSyntaxDiagnostics().size());
}
Aggregations