use of org.yakindu.sct.model.sgraph.Statechart in project statecharts by Yakindu.
the class DiagramPartitioningUtil method openEditor.
/**
* Opens a subdiagram for a given {@link Diagram}
*/
public static IEditorPart openEditor(Diagram diagramToOpen) {
IFile file = WorkspaceSynchronizer.getFile(diagramToOpen.eResource());
try {
IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
final IWorkbenchPage wbPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (diagramToOpen.getElement() instanceof Statechart) {
return wbPage.openEditor(new FileEditorInput(file), desc.getId());
} else if (diagramToOpen.getElement() instanceof State) {
return wbPage.openEditor(new DiagramEditorInput(diagramToOpen), desc.getId());
}
} catch (PartInitException e) {
e.printStackTrace();
}
return null;
}
use of org.yakindu.sct.model.sgraph.Statechart in project statecharts by Yakindu.
the class JavaGeneratorModule method configureForExecutionStyle.
public void configureForExecutionStyle(GeneratorEntry entry, Binder binder) {
Statechart statechart = (Statechart) entry.getElementRef();
Annotation eventDrivenAnnotation = statechart.getAnnotationOfType(EVENT_DRIVEN_ANNOTATION);
if (eventDrivenAnnotation != null) {
binder.bind(Statemachine.class).to(EventDrivenStatemachine.class);
}
}
use of org.yakindu.sct.model.sgraph.Statechart in project statecharts by Yakindu.
the class CppCodeGeneratorModule method bindEventDrivenClasses.
protected void bindEventDrivenClasses(GeneratorEntry entry, Binder binder) {
Statechart statechart = (Statechart) entry.getElementRef();
Annotation eventDrivenAnnotation = statechart.getAnnotationOfType(EVENT_DRIVEN_ANNOTATION);
if (eventDrivenAnnotation != null) {
binder.bind(StatemachineHeader.class).to(EventDrivenStatemachineHeader.class);
binder.bind(StatemachineImplementation.class).to(EventDrivenStatemachineImplementation.class);
binder.bind(CppExpressionsGenerator.class).to(EventDrivenExpressionCode.class);
binder.bind(EventCode.class).to(EventDrivenEventCode.class);
binder.bind(StandardCppIncludeProvider.class).to(EventDrivenCppIncludeProvider.class);
}
}
use of org.yakindu.sct.model.sgraph.Statechart in project statecharts by Yakindu.
the class SCTUnitTestModels method loadAllStatecharts.
public List<Statechart> loadAllStatecharts() throws Exception {
List<Statechart> result = new ArrayList<>();
Field[] fields = getClass().getFields();
for (Field field : fields) {
String value = (String) field.get(this);
if (value.endsWith(".sct")) {
result.add(loadStatechartFromResource(value));
}
}
return result;
}
use of org.yakindu.sct.model.sgraph.Statechart in project statecharts by Yakindu.
the class CPPDefaultFeatureValueProvider method setDefaultValue.
@Override
protected void setDefaultValue(FeatureType featureType, FeatureParameterValue parameterValue, EObject contextElement) {
GeneratorEntry entry = (GeneratorEntry) contextElement;
Statechart statechart = (Statechart) entry.getElementRef();
if (parameterValue.getParameter().getName().equals(ICFeatureConstants.PARAMETER_NAMING_MODULE_NAME)) {
parameterValue.setValue(asIdentifier(statechart.getName(), "_"));
} else if (parameterValue.getParameter().getName().equals(ICFeatureConstants.PARAMETER_NAMING_STATEMACHINE_PREFIX)) {
parameterValue.setValue(StringExtensions.toFirstLower(asIdentifier(statechart.getName(), "_")));
} else if (parameterValue.getParameter().getName().equals(ICFeatureConstants.PARAMETER_NAMING_MAX_IDENTIFIER_LENGTH)) {
parameterValue.setValue("31");
} else if (parameterValue.getParameter().getName().equals(ICFeatureConstants.PARAMETER_NAMING_SEPARATOR)) {
parameterValue.setValue("_");
} else if (parameterValue.getParameter().getName().equals(CPPFeatureConstants.PARAMETER_INNER_FUNCTION_VISIBILITY)) {
parameterValue.setValue(Visibility.PRIVATE.toString().toLowerCase());
} else if (parameterValue.getParameter().getName().equals(CPPFeatureConstants.PARAMETER_STATIC_OPC)) {
parameterValue.setValue(false);
} else if (parameterValue.getParameter().getName().equals(CPPFeatureConstants.PARAMETER_INCLUDES_USE_RELATIVE_PATHS)) {
parameterValue.setValue(true);
} else if (parameterValue.getParameter().getName().equals(CPPFeatureConstants.PARAMETER_API_CHECK_UNIMPLEMENTED_OCBS)) {
parameterValue.setValue(true);
}
}
Aggregations