diff options
author | 2021-08-03 18:42:39 +0900 | |
---|---|---|
committer | 2021-08-06 19:32:38 +0900 | |
commit | be4f78978faba3d3ceb88df02a7f93a2e09ff1e0 (patch) | |
tree | 1f3f1a96251ac4f655c8a96fc33d5d4ee779cd06 /rba.tool.editor/src/rba/tool/editor/formatting2 | |
parent | 71ca7c6cab863767ef30c8bd05b2bbfda8731cb5 (diff) |
Initial commit
Bug-AGL: SPEC-4033
Signed-off-by: Kenji Hosokawa <khosokawa@jp.adit-jv.com>
Diffstat (limited to 'rba.tool.editor/src/rba/tool/editor/formatting2')
-rw-r--r-- | rba.tool.editor/src/rba/tool/editor/formatting2/RBAModelFormatter.xtend | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/rba.tool.editor/src/rba/tool/editor/formatting2/RBAModelFormatter.xtend b/rba.tool.editor/src/rba/tool/editor/formatting2/RBAModelFormatter.xtend new file mode 100644 index 0000000..1a79638 --- /dev/null +++ b/rba.tool.editor/src/rba/tool/editor/formatting2/RBAModelFormatter.xtend @@ -0,0 +1,132 @@ +/* + * generated by Xtext 2.13.0 + */ +package rba.tool.editor.formatting2 + +import com.google.inject.Inject +import org.eclipse.xtext.formatting2.AbstractFormatter2 +import org.eclipse.xtext.formatting2.IFormattableDocument +import rba.core.Content +import rba.core.ContentSet +import rba.core.ContentState +import rba.core.PackagableElement +import rba.core.Package +import rba.core.Scene +import rba.core.State +import rba.tool.editor.rbaEditorModel.TopLevel +import rba.tool.editor.services.RBAModelGrammarAccess +import rba.view.Area +import rba.view.AreaSet +import rba.view.CompositeArea +import rba.view.Display +import rba.view.FixedPositionLayout +import rba.view.HorizontalLayout +import rba.view.PositionContainer +import rba.view.Size +import rba.view.VerticalLayout +import rba.view.ViewContent + +class RBAModelFormatter extends AbstractFormatter2 { + + @Inject RBAModelGrammarAccess grammarAccess; + + def dispatch void format(TopLevel topLevel, extension IFormattableDocument document) { + System.out.println("---------------------------------"); + System.out.println(document.class.simpleName); + System.out.println("---------------------------------"); + + for (Package _package : topLevel.getPackages()) { + _package.format; + } + } + + def dispatch void format(Package _package, extension IFormattableDocument document) { + for (PackagableElement _packagableElement : _package.packagableelement) { + _packagableElement.format; + } + } + + def dispatch void format(Display _display, extension IFormattableDocument document) { + if (_display.size !== null) { + _display.size.format + } + if (_display.root !== null) { + _display.root.format + } + } + + def dispatch void format(CompositeArea _compositeArea, extension IFormattableDocument document) { + if (_compositeArea.layout !== null) { + _compositeArea.layout.format + } + } + + def dispatch void format(FixedPositionLayout _fixedPositionLayout, extension IFormattableDocument document) { + for (subAreaPosition : _fixedPositionLayout.subAreaPosition) { + subAreaPosition.format + } + } + + def dispatch void format(VerticalLayout _verticalLayout, extension IFormattableDocument document) { + for (subarea : _verticalLayout.subarea) { + // TODO -> ('subarea:' '[' (subarea+=[rba::AbstractArea|QualifiedName] ("," subarea+=[rba::AbstractArea|QualifiedName])*)? ']')? + } + } + + def dispatch void format(HorizontalLayout _horizontalLayout, extension IFormattableDocument document) { + for (subarea : _horizontalLayout.subarea) { + // TODO -> ('subarea:' '[' (subarea+=[rba::AbstractArea|QualifiedName] ("," subarea+=[rba::AbstractArea|QualifiedName])*)? ']')? + } + } + + def dispatch void format(PositionContainer _positionContainer, extension IFormattableDocument document) { + // TODO -> ('areaReference:' area=[rba::AbstractArea|QualifiedName])? + // TODO -> x & y + } + + def dispatch void format(ContentSet _contentSet, extension IFormattableDocument document) { + for (target : _contentSet.target) { + // TODO -> ('target:' '[' (target+=[rba::AbstractContent|QualifiedName] ("," target+=[rba::AbstractContent|QualifiedName])*)? ']')? + } + } + + def dispatch void format(Content _content, extension IFormattableDocument document) { + for (allocatable : _content.allocatable) { + // TODO -> ('allocatable:' '[' (allocatable+=[rba::Allocatable|QualifiedName] ("," allocatable+=[rba::Allocatable|QualifiedName])*)? ']')? & + } + for (state : _content.states) { + state.format + } + if (_content instanceof ViewContent) { + for (size : (_content as ViewContent).size) { + size.format + } + } + } + + def dispatch void format(AreaSet _areaSet, extension IFormattableDocument document) { + for (target : _areaSet.target) { + // TODO -> ('target:' '[' (target+=[rba::AbstractArea|QualifiedName] ("," target+=[rba::AbstractArea|QualifiedName])*)? ']')? + } + } + + def dispatch void format(Area _area, extension IFormattableDocument document) { + for (size : _area.size) { + size.format + } + // TODO -> visibility[ref Area] + // TODO -> zorder[ref Area] + } + + def dispatch void format(Size _size, extension IFormattableDocument document) { + // TODO -> width & height + } + + def dispatch void format(ContentState _contentState, extension IFormattableDocument document) { + // TODO -> priority[ref ContentState] + } + + def dispatch void format(Scene _scene, extension IFormattableDocument document) { + } + +} |