Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/formatting2/BaseFormatter.xtend3
-rw-r--r--plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.xtend22
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting2/RoomFormatter.xtend8
3 files changed, 21 insertions, 12 deletions
diff --git a/plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/formatting2/BaseFormatter.xtend b/plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/formatting2/BaseFormatter.xtend
index 10708c01e..448b10312 100644
--- a/plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/formatting2/BaseFormatter.xtend
+++ b/plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/formatting2/BaseFormatter.xtend
@@ -57,17 +57,20 @@ class BaseFormatter extends AbstractFormatter2 {
def dispatch void format(Import it, extension IFormattableDocument document) {
regionFor.keywords(importAccess.importKeyword_0, importAccess.modelKeyword_1_1).forEach[append[oneSpace]]
regionFor.keyword(importAccess.fromKeyword_1_0_1).surround[oneSpace]
+ eContents.forEach[format] // format children
}
def dispatch void format(AnnotationType it, extension IFormattableDocument document) {
regionFor.keyword(annotationTypeAccess.annotationTypeKeyword_0).append[oneSpace]
regionFor.keyword(annotationTypeAccess.targetKeyword_4).prepend[newLine]
attributes.forEach[prepend[newLine]]
+ eContents.forEach[format] // format children
}
def dispatch void format(Annotation it, extension IFormattableDocument document) {
regionFor.keyword(annotationAccess.commercialAtKeyword_0).append[noSpace]
attributes.forEach[prepend[newLine]]
+ eContents.forEach[format] // format children
}
}
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.xtend b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.xtend
index ccf6ccd9a..9066c5a65 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.xtend
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.xtend
@@ -27,6 +27,8 @@ import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition
import org.eclipse.etrice.core.fsm.services.FSMGrammarAccess
import org.eclipse.xtext.formatting2.IFormattableDocument
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion
+import org.eclipse.etrice.core.fsm.fSM.RefinedTransition
+import org.eclipse.etrice.core.fsm.fSM.TransitionBase
class FSMFormatter extends BaseFormatter {
@@ -48,29 +50,31 @@ class FSMFormatter extends BaseFormatter {
def dispatch void format(StateGraph it, extension IFormattableDocument document) {
eContents.forEach[prependDefaultNewLines(document)]
+ eContents.forEach[format] // format children
}
def dispatch void format(State it, extension IFormattableDocument document) {
regionFor.keywords('entry', 'exit', 'do', 'subgraph').forEach[prependDefaultNewLines(document) append[oneSpace]]
+ eContents.forEach[format] // format children
}
- def dispatch void format(Transition it, extension IFormattableDocument document) {
- regionFor.keywords('action', 'guard', 'cond').forEach[prependDefaultNewLines(document) append[oneSpace]]
- }
-
- def dispatch void format(TriggeredTransition it, extension IFormattableDocument document) {
- regionFor.keywords('action', 'guard', 'cond', 'triggers').forEach[prependDefaultNewLines(document) append[oneSpace]]
-
- triggers.head.prepend[newLine]
- triggers.tail.forEach[prepend[oneSpace]]
+ def dispatch void format(TransitionBase it, extension IFormattableDocument document) {
+ regionFor.keywords('action', 'guard', 'cond', 'triggers').forEach[prependDefaultNewLines(document) append[oneSpace]]
+ if(it instanceof TriggeredTransition) {
+ triggers.head.prepend[newLine]
+ triggers.tail.forEach[prepend[oneSpace]]
+ }
+ eContents.forEach[format] // format children
}
def dispatch void format(Trigger it, extension IFormattableDocument document) {
regionFor.keywordPairs('<', '>').forEach[interior[noSpace]]
+ eContents.forEach[format] // format children
}
def dispatch void format(ProtocolSemantics it, extension IFormattableDocument document) {
rules.forEach[prependDefaultNewLines(document)]
+ eContents.forEach[format] // format children
}
@Inject
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting2/RoomFormatter.xtend b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting2/RoomFormatter.xtend
index 8a4149e87..6c408ff2c 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting2/RoomFormatter.xtend
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting2/RoomFormatter.xtend
@@ -63,22 +63,23 @@ class RoomFormatter extends FSMFormatter {
eContents.tail.filter(EnumerationType).forEach[prependDefaultNewLines(document)]
eContents.tail.filter(ExternalType).forEach[prependDefaultNewLines(document)]
- eAllContents.forEach[
- format // recursive
- ]
+ eContents.forEach[format] // format children
}
def dispatch void format(RoomClass it, extension IFormattableDocument document) {
eContents.filter[!(it instanceof DetailCode || it instanceof Documentation)].forEach[prependDefaultNewLines(document)]
regionFor.keywords('usercode1', 'usercode2', 'usercode3', 'incoming', 'outgoing', 'regular', 'conjugated', 'Interface', 'Structure', 'Behavior').forEach[prependDefaultNewLines(document)]
+ eContents.forEach[format] // format children
}
def dispatch void format(PortClass it, extension IFormattableDocument document) {
eContents.filter[!(it instanceof DetailCode || it instanceof Documentation)].forEach[prependDefaultNewLines(document)]
+ eContents.forEach[format] // format children
}
def dispatch void format(Operation it, extension IFormattableDocument document) {
arguments.forEach[append[noSpace]]
+ eContents.forEach[format] // format children
}
def dispatch void format(Attribute it, extension IFormattableDocument document) {
@@ -86,5 +87,6 @@ class RoomFormatter extends FSMFormatter {
key.prepend[oneSpace]
interior[noSpace]
]
+ eContents.forEach[format] // format children
}
}

Back to the top