use of org.yakindu.sct.model.sgraph.util.ContextElementAdapter in project statecharts by Yakindu.
the class AbstractEditorPropertySection method enableXtext.
protected void enableXtext(Control styledText, Injector injector) {
final StyledTextXtextAdapter xtextAdapter = new StyledTextXtextAdapter(injector);
xtextAdapter.getFakeResourceContext().getFakeResource().eAdapters().add(new ContextElementAdapter(this));
xtextAdapter.adapt((StyledText) styledText);
initContextMenu(styledText);
completionProposalAdapter = new CompletionProposalAdapter(styledText, xtextAdapter.getContentAssistant(), KeyStroke.getInstance(SWT.CTRL, SWT.SPACE), null);
}
use of org.yakindu.sct.model.sgraph.util.ContextElementAdapter in project statecharts by Yakindu.
the class SCTResourceTest method setUp.
@Before
public void setUp() throws Exception {
Injector injector = STextActivator.getInstance().getInjector(STextActivator.ORG_YAKINDU_SCT_MODEL_STEXT_STEXT);
ResourceSet resourceSet = new ResourceSetImpl();
res = new StextResource(URI.createURI("test.test"));
res.eAdapters().add(new ContextElementAdapter(new IContextElementProvider() {
public EObject getContextObject() {
return res.getContents().get(0);
}
}));
resourceSet.getResources().add(res);
injector.injectMembers(res);
}
use of org.yakindu.sct.model.sgraph.util.ContextElementAdapter in project statecharts by Yakindu.
the class StatechartDefinitionSection method getXtextResourceProvider.
protected IEditedResourceProvider getXtextResourceProvider(Injector injector) {
return new IEditedResourceProvider() {
@Override
public XtextResource createResource() {
XtextFakeResourceContext resource = new XtextFakeResourceContext(injector);
xtextResource = resource.getFakeResource();
xtextResource.eAdapters().add(new ContextElementAdapter(StatechartDefinitionSection.this));
return xtextResource;
}
};
}
use of org.yakindu.sct.model.sgraph.util.ContextElementAdapter in project statecharts by Yakindu.
the class STextExpressionParser method getResource.
public StextResource getResource() {
final StextResource resource = new StextResource();
injector.injectMembers(resource);
resource.eAdapters().add(new ContextElementAdapter(new ContextElementAdapter.IContextElementProvider() {
public EObject getContextObject() {
return (EObject) EcoreUtil.getObjectByType(resource.getContents(), SGraphPackage.Literals.STATECHART);
}
}));
ResourceSet set = new ResourceSetImpl();
set.getResources().add(resource);
return resource;
}
Aggregations