Skip to content

Instantly share code, notes, and snippets.

grammar io.typefox.examples.theia.states.States with org.eclipse.xtext.common.Terminals
generate states "http://www.typefox.io/examples/theia/states/States"
StateMachine:
'statemachine' name=ID
(states+=State | events+=Event)*;
State:
'state' name=ID transitions+=Transition*;
grammar io.typefox.examples.theia.states.States with org.eclipse.xtext.common.Terminals
generate states "http://www.typefox.io/examples/theia/states/States"
StateMachine:
'statemachine' name=ID
(states+=State | events+=Event)*;
State:
'state' name=ID transitions+=Transition*;
Thread [JavaFX Application Thread] (Suspended (exception ArrayIndexOutOfBoundsException))
ArrayList<E>.elementData(int) line: 418
ArrayList<E>.get(int) line: 431
Parent$1(ObservableListWrapper<E>).get(int) line: 89
Parent$2(VetoableListDecorator<E>).get(int) line: 306
6 RectangleBorderPane(Parent).updateCachedBounds(List<Node>, int) line: 1579
6 RectangleBorderPane(Parent).recomputeBounds() line: 1523
6 RectangleBorderPane(Parent).impl_computeGeomBounds(BaseBounds, BaseTransform) line: 1374
6 RectangleBorderPane(Region).impl_computeGeomBounds(BaseBounds, BaseTransform) line: 3022
6 RectangleBorderPane(Node).updateGeomBounds() line: 3552 [local variables unavailable]
@JanKoehnlein
JanKoehnlein / Opener.xtend
Last active August 29, 2015 14:05
An example selection listener to open an Xtext element in the editor given its URI
@Inject IURIEditorOpener editorOpener
...
selectionListener = [ event |
val selection = event.selection as IStructuredSelection
if(selection.size == 1) {
val selectedElement = selection.firstElement
if(selectedElement instanceof URI)
editorOpener.open(selectedElement, true)
}
]
@JanKoehnlein
JanKoehnlein / Handler.xtend
Last active August 29, 2015 14:05
An example handler to open an Xtext element in a graphical view
class ShowInViewHandler extends AbstractHandler {
@Inject EObjectAtOffsetHelper eObjectAtOffsetHelper
override Object execute(ExecutionEvent event)
throws ExecutionException {
val editor = EditorUtils.getActiveXtextEditor(event)
if (editor != null) {
val selection = editor.selectionProvider.selection
as ITextSelection