diff options
Diffstat (limited to 'plugins')
106 files changed, 1029 insertions, 6606 deletions
diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting/BaseFormatter.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting/BaseFormatter.java index c8c4dfd35..bdccb7880 100644 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting/BaseFormatter.java +++ b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting/BaseFormatter.java @@ -23,6 +23,7 @@ import org.eclipse.xtext.formatting.impl.FormattingConfig; */ @SuppressWarnings("all") public class BaseFormatter extends AbstractDeclarativeFormatter { + @Override protected void configureFormatting(final FormattingConfig c) { } } diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/generator/BaseGenerator.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/generator/BaseGenerator.java index f6a013a66..c3ecaf691 100644 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/generator/BaseGenerator.java +++ b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/generator/BaseGenerator.java @@ -21,6 +21,7 @@ import org.eclipse.xtext.generator.IGenerator; */ @SuppressWarnings("all") public class BaseGenerator implements IGenerator { + @Override public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { } } diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java index e9be2be5d..0ad1c7187 100644 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java +++ b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java @@ -45,6 +45,7 @@ public class PostprocessingHelpers { public static EAttribute getAttribute(final EClass cls, final String name) { EList<EAttribute> _eAllAttributes = cls.getEAllAttributes(); final Function1<EAttribute, Boolean> _function = new Function1<EAttribute, Boolean>() { + @Override public Boolean apply(final EAttribute a) { String _name = a.getName(); return Boolean.valueOf(_name.equals(name)); @@ -56,6 +57,7 @@ public class PostprocessingHelpers { public static EReference getReference(final EClass cls, final String name) { EList<EReference> _eAllReferences = cls.getEAllReferences(); final Function1<EReference, Boolean> _function = new Function1<EReference, Boolean>() { + @Override public Boolean apply(final EReference a) { String _name = a.getName(); return Boolean.valueOf(_name.equals(name)); diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/validation/ValidationHelpers.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/validation/ValidationHelpers.java index 999f37cd8..94484ece7 100644 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/validation/ValidationHelpers.java +++ b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/validation/ValidationHelpers.java @@ -77,6 +77,7 @@ public class ValidationHelpers { public static class NamedObjectList extends ArrayList<ValidationHelpers.NamedObject> { public void addAll(final List<? extends EObject> items, final EStructuralFeature feature) { final Procedure1<EObject> _function = new Procedure1<EObject>() { + @Override public void apply(final EObject it) { Object _eGet = it.eGet(feature); ValidationHelpers.NamedObject _namedObject = new ValidationHelpers.NamedObject(((String) _eGet), it, feature); @@ -104,6 +105,7 @@ public class ValidationHelpers { } } final Function1<ValidationHelpers.NamedObject, Boolean> _function = new Function1<ValidationHelpers.NamedObject, Boolean>() { + @Override public Boolean apply(final ValidationHelpers.NamedObject i) { String _name = i.getName(); return Boolean.valueOf(duplicateNames.contains(_name)); @@ -116,6 +118,7 @@ public class ValidationHelpers { public static Iterable<ValidationHelpers.NamedObject> inSameResource(final Iterable<ValidationHelpers.NamedObject> items, final Resource resource) { final Function1<ValidationHelpers.NamedObject, Boolean> _function = new Function1<ValidationHelpers.NamedObject, Boolean>() { + @Override public Boolean apply(final ValidationHelpers.NamedObject i) { EObject _obj = i.getObj(); Resource _eResource = _obj.eResource(); diff --git a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/generator/ConfigGenerator.java b/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/generator/ConfigGenerator.java index 823240c6a..9a5cd6ec6 100644 --- a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/generator/ConfigGenerator.java +++ b/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/generator/ConfigGenerator.java @@ -9,6 +9,7 @@ import org.eclipse.xtext.generator.IGenerator; @SuppressWarnings("all") public class ConfigGenerator implements IGenerator { + @Override public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { } } diff --git a/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/generator/ETMapGenerator.java b/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/generator/ETMapGenerator.java index 46ba54861..4239a3a4f 100644 --- a/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/generator/ETMapGenerator.java +++ b/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/generator/ETMapGenerator.java @@ -9,6 +9,7 @@ import org.eclipse.xtext.generator.IGenerator; @SuppressWarnings("all") public class ETMapGenerator implements IGenerator { + @Override public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { } } diff --git a/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/generator/ETPhysGenerator.java b/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/generator/ETPhysGenerator.java index af40fcc88..b0e8640b9 100644 --- a/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/generator/ETPhysGenerator.java +++ b/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/generator/ETPhysGenerator.java @@ -9,6 +9,7 @@ import org.eclipse.xtext.generator.IGenerator; @SuppressWarnings("all") public class ETPhysGenerator implements IGenerator { + @Override public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { } } diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting/FSMFormatter.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting/FSMFormatter.java index afd952bbe..f2ff9c355 100644 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting/FSMFormatter.java +++ b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting/FSMFormatter.java @@ -16,6 +16,7 @@ import org.eclipse.xtext.formatting.impl.FormattingConfig; */ @SuppressWarnings("all") public class FSMFormatter extends AbstractDeclarativeFormatter { + @Override protected void configureFormatting(final FormattingConfig c) { } } diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java index a1d9f2f2d..5c2dbb93f 100644 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java +++ b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java @@ -14,6 +14,7 @@ import org.eclipse.xtext.generator.IGenerator; */ @SuppressWarnings("all") public class FSMGenerator implements IGenerator { + @Override public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { } } diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java index ea1e9d6de..fe823650a 100644 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java +++ b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java @@ -160,27 +160,17 @@ public class FSMScopeProvider extends AbstractDeclarativeScopeProvider { if ((_eContainer instanceof ModelComponent)) { EObject _eContainer_1 = sg.eContainer(); ModelComponent comp = ((ModelComponent) _eContainer_1); - boolean _and = false; - ModelComponent _base = comp.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _isCircularClassHierarchy = this._fSMHelpers.isCircularClassHierarchy(comp); - boolean _not = (!_isCircularClassHierarchy); - _and = _not; - } - if (_and) { - ModelComponent _base_1 = comp.getBase(); - comp = _base_1; + if (((!Objects.equal(comp.getBase(), null)) && (!this._fSMHelpers.isCircularClassHierarchy(comp)))) { + ModelComponent _base = comp.getBase(); + comp = _base; final HashSet<State> covered = CollectionLiterals.<State>newHashSet(); final ArrayList<State> states = CollectionLiterals.<State>newArrayList(); while ((!Objects.equal(comp, null))) { { StateGraph _stateMachine = comp.getStateMachine(); this.recursivelyAddStates(_stateMachine, covered, states); - ModelComponent _base_2 = comp.getBase(); - comp = _base_2; + ModelComponent _base_1 = comp.getBase(); + comp = _base_1; } } for (final State s : states) { @@ -196,8 +186,8 @@ public class FSMScopeProvider extends AbstractDeclarativeScopeProvider { State _target = ((RefinedState) _eContainer_3).getTarget(); StateGraph _subgraph = _target.getSubgraph(); sg = _subgraph; - boolean _notEquals_1 = (!Objects.equal(sg, null)); - if (_notEquals_1) { + boolean _notEquals = (!Objects.equal(sg, null)); + if (_notEquals) { EList<State> _states = sg.getStates(); for (final State s_1 : _states) { String _name = s_1.getName(); @@ -263,26 +253,10 @@ public class FSMScopeProvider extends AbstractDeclarativeScopeProvider { private void recursivelyAddStates(final StateGraph sg, final HashSet<State> covered, final ArrayList<State> states) { EList<State> _states = sg.getStates(); for (final State s : _states) { - boolean _and = false; - if (!(s instanceof SimpleState)) { - _and = false; - } else { - boolean _contains = covered.contains(s); - boolean _not = (!_contains); - _and = _not; - } - if (_and) { + if (((s instanceof SimpleState) && (!covered.contains(s)))) { states.add(s); } else { - boolean _and_1 = false; - if (!(s instanceof RefinedState)) { - _and_1 = false; - } else { - boolean _contains_1 = covered.contains(s); - boolean _not_1 = (!_contains_1); - _and_1 = _not_1; - } - if (_and_1) { + if (((s instanceof RefinedState) && (!covered.contains(s)))) { states.add(s); State _target = ((RefinedState) s).getTarget(); covered.add(_target); diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java index 58ffe981e..aff4dbc9e 100644 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java +++ b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java @@ -25,7 +25,6 @@ import org.eclipse.etrice.core.fsm.fSM.State; import org.eclipse.etrice.core.fsm.fSM.StateGraph; import org.eclipse.etrice.core.fsm.fSM.StateTerminal; import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.TransitionTerminal; import org.eclipse.etrice.core.fsm.fSM.Trigger; import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition; import org.eclipse.etrice.core.fsm.naming.FSMNameProvider; @@ -102,23 +101,16 @@ public class FSMValidationUtilXtend { final ArrayList<FSMValidationUtilXtend.Result> result = CollectionLiterals.<FSMValidationUtilXtend.Result>newArrayList(); EList<Transition> _transitions = parent.getTransitions(); final Function1<Transition, Boolean> _function = new Function1<Transition, Boolean>() { + @Override public Boolean apply(final Transition t) { - boolean _and = false; - if (!((t instanceof TriggeredTransition) && (((TriggeredTransition) t).getFrom() instanceof StateTerminal))) { - _and = false; - } else { - TransitionTerminal _from = ((TriggeredTransition) t).getFrom(); - State _state = ((StateTerminal) _from).getState(); - boolean _equals = Objects.equal(myState, _state); - _and = _equals; - } - return Boolean.valueOf(_and); + return Boolean.valueOf((((t instanceof TriggeredTransition) && (((TriggeredTransition) t).getFrom() instanceof StateTerminal)) && Objects.equal(myState, ((StateTerminal) ((TriggeredTransition) t).getFrom()).getState()))); } }; Iterable<Transition> _filter = IterableExtensions.<Transition>filter(_transitions, _function); for (final Transition t : _filter) { EList<Trigger> _triggers = ((TriggeredTransition) t).getTriggers(); final Function1<Trigger, Boolean> _function_1 = new Function1<Trigger, Boolean>() { + @Override public Boolean apply(final Trigger k) { Guard _guard = k.getGuard(); return Boolean.valueOf(Objects.equal(_guard, null)); diff --git a/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/quickfix/DetailCodeIndentHelper.java b/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/quickfix/DetailCodeIndentHelper.java index 9f1ad9c0e..ecbec4f46 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/quickfix/DetailCodeIndentHelper.java +++ b/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/quickfix/DetailCodeIndentHelper.java @@ -44,6 +44,7 @@ public class DetailCodeIndentHelper { } Iterable<String> _tail = IterableExtensions.<String>tail(editorLines); final Function1<String, Integer> _function = new Function1<String, Integer>() { + @Override public Integer apply(final String it) { return Integer.valueOf(DetailCodeIndentHelper.countIndent(it)); } @@ -53,6 +54,7 @@ public class DetailCodeIndentHelper { final int minIndent = DetailCodeIndentHelper.countIndent(_head); final ArrayList<String> newEditorLines = new ArrayList<String>(); final Procedure2<String, Integer> _function_1 = new Procedure2<String, Integer>() { + @Override public void apply(final String line, final Integer lineCount) { String _xifexpression = null; if (((lineCount).intValue() != 0)) { diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java index b5cb0284e..252b0190a 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java @@ -131,6 +131,7 @@ public class ActorClassGen extends GenericActorClassGenerator { final ActorClass ac = xpac.getActorClass(); List<Port> _allEndPorts = this._roomHelpers.getAllEndPorts(ac); final Function1<Port, Boolean> _function = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port p) { GeneralProtocolClass _protocol = p.getProtocol(); CommunicationType _commType = ((ProtocolClass) _protocol).getCommType(); @@ -140,36 +141,17 @@ public class ActorClassGen extends GenericActorClassGenerator { final Iterable<Port> eventPorts = IterableExtensions.<Port>filter(_allEndPorts, _function); List<Port> _allEndPorts_1 = this._roomHelpers.getAllEndPorts(ac); final Function1<Port, Boolean> _function_1 = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port p) { - boolean _and = false; - GeneralProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = ((ProtocolClass) _protocol).getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - if (!_equals) { - _and = false; - } else { - boolean _isConjugated = p.isConjugated(); - _and = _isConjugated; - } - return Boolean.valueOf(_and); + return Boolean.valueOf((Objects.equal(((ProtocolClass) p.getProtocol()).getCommType(), CommunicationType.DATA_DRIVEN) && p.isConjugated())); } }; final Iterable<Port> sendPorts = IterableExtensions.<Port>filter(_allEndPorts_1, _function_1); List<Port> _allEndPorts_2 = this._roomHelpers.getAllEndPorts(ac); final Function1<Port, Boolean> _function_2 = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port p) { - boolean _and = false; - GeneralProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = ((ProtocolClass) _protocol).getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - if (!_equals) { - _and = false; - } else { - boolean _isConjugated = p.isConjugated(); - boolean _not = (!_isConjugated); - _and = _not; - } - return Boolean.valueOf(_and); + return Boolean.valueOf((Objects.equal(((ProtocolClass) p.getProtocol()).getCommType(), CommunicationType.DATA_DRIVEN) && (!p.isConjugated()))); } }; final Iterable<Port> recvPorts = IterableExtensions.<Port>filter(_allEndPorts_2, _function_2); @@ -177,64 +159,8 @@ public class ActorClassGen extends GenericActorClassGenerator { final boolean dataDriven = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); ComponentCommunicationType _commType_1 = ac.getCommType(); final boolean async = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); - boolean _or = false; - boolean _and = false; - boolean _and_1 = false; - boolean _and_2 = false; - boolean _isEmpty = IterableExtensions.isEmpty(eventPorts); - if (!_isEmpty) { - _and_2 = false; - } else { - boolean _isEmpty_1 = IterableExtensions.isEmpty(recvPorts); - _and_2 = _isEmpty_1; - } - if (!_and_2) { - _and_1 = false; - } else { - List<SAP> _allSAPs = this._roomHelpers.getAllSAPs(ac); - boolean _isEmpty_2 = _allSAPs.isEmpty(); - _and_1 = _isEmpty_2; - } - if (!_and_1) { - _and = false; - } else { - List<ServiceImplementation> _allServiceImplementations = this._roomHelpers.getAllServiceImplementations(ac); - boolean _isEmpty_3 = _allServiceImplementations.isEmpty(); - _and = _isEmpty_3; - } - boolean _not = (!_and); - if (_not) { - _or = true; - } else { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - _or = _isGenerateMSCInstrumentation; - } - final boolean hasConstData = _or; - boolean _and_3 = false; - boolean _and_4 = false; - boolean _and_5 = false; - boolean _isEmpty_4 = IterableExtensions.isEmpty(sendPorts); - if (!_isEmpty_4) { - _and_5 = false; - } else { - List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(ac); - boolean _isEmpty_5 = _allAttributes.isEmpty(); - _and_5 = _isEmpty_5; - } - if (!_and_5) { - _and_4 = false; - } else { - StateGraph _stateMachine = xpac.getStateMachine(); - boolean _isEmpty_6 = this._roomHelpers.isEmpty(_stateMachine); - _and_4 = _isEmpty_6; - } - if (!_and_4) { - _and_3 = false; - } else { - _and_3 = (!hasConstData); - } - final boolean hasVarData = (!_and_3); + final boolean hasConstData = ((!(((IterableExtensions.isEmpty(eventPorts) && IterableExtensions.isEmpty(recvPorts)) && this._roomHelpers.getAllSAPs(ac).isEmpty()) && this._roomHelpers.getAllServiceImplementations(ac).isEmpty())) || Main.getSettings().isGenerateMSCInstrumentation()); + final boolean hasVarData = (!(((IterableExtensions.isEmpty(sendPorts) && this._roomHelpers.getAllAttributes(ac).isEmpty()) && this._roomHelpers.isEmpty(xpac.getStateMachine())) && (!hasConstData))); StringConcatenation _builder = new StringConcatenation(); _builder.append("/**"); _builder.newLine(); @@ -316,9 +242,9 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("_const {"); _builder.newLineIfNotEmpty(); { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { _builder.append("\t"); _builder.append("const char* instName;"); _builder.newLine(); @@ -375,8 +301,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("/* saps */"); _builder.newLine(); { - List<SAP> _allSAPs_1 = this._roomHelpers.getAllSAPs(ac); - for(final SAP sap : _allSAPs_1) { + List<SAP> _allSAPs = this._roomHelpers.getAllSAPs(ac); + for(final SAP sap : _allSAPs) { _builder.append("\t"); _builder.append("const "); String _portClassName_2 = this._roomExtensions.getPortClassName(sap); @@ -414,8 +340,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("/* services */"); _builder.newLine(); { - List<ServiceImplementation> _allServiceImplementations_1 = this._roomHelpers.getAllServiceImplementations(ac); - for(final ServiceImplementation svc : _allServiceImplementations_1) { + List<ServiceImplementation> _allServiceImplementations = this._roomHelpers.getAllServiceImplementations(ac); + for(final ServiceImplementation svc : _allServiceImplementations) { _builder.append("\t"); _builder.append("const etReplPort "); SPP _spp = svc.getSpp(); @@ -437,10 +363,10 @@ public class ActorClassGen extends GenericActorClassGenerator { } _builder.newLine(); { - StateGraph _stateMachine_1 = xpac.getStateMachine(); - boolean _isEmpty_7 = this._roomHelpers.isEmpty(_stateMachine_1); - boolean _not_1 = (!_isEmpty_7); - if (_not_1) { + StateGraph _stateMachine = xpac.getStateMachine(); + boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine); + boolean _not = (!_isEmpty); + if (_not) { _builder.newLine(); CharSequence _genHeaderConstants = this._stateMachineGen.genHeaderConstants(xpac); _builder.append(_genHeaderConstants, ""); @@ -491,16 +417,16 @@ public class ActorClassGen extends GenericActorClassGenerator { } _builder.newLine(); _builder.append("\t"); - List<Attribute> _allAttributes_1 = this._roomHelpers.getAllAttributes(ac); - CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes_1); + List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(ac); + CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes); _builder.append(_attributes, "\t"); _builder.newLineIfNotEmpty(); _builder.newLine(); { - StateGraph _stateMachine_2 = xpac.getStateMachine(); - boolean _isEmpty_8 = this._roomHelpers.isEmpty(_stateMachine_2); - boolean _not_2 = (!_isEmpty_8); - if (_not_2) { + StateGraph _stateMachine_1 = xpac.getStateMachine(); + boolean _isEmpty_1 = this._roomHelpers.isEmpty(_stateMachine_1); + boolean _not_1 = (!_isEmpty_1); + if (_not_1) { _builder.newLine(); _builder.append("\t"); CharSequence _genDataMembers = this._stateMachineGen.genDataMembers(xpac); @@ -552,13 +478,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); _builder.newLine(); { - boolean _or_1 = false; - if (dataDriven) { - _or_1 = true; - } else { - _or_1 = async; - } - if (_or_1) { + if ((dataDriven || async)) { _builder.append("void "); String _name_17 = ac.getName(); _builder.append(_name_17, ""); @@ -599,6 +519,7 @@ public class ActorClassGen extends GenericActorClassGenerator { final ActorClass ac = xpac.getActorClass(); List<Port> _allEndPorts = this._roomHelpers.getAllEndPorts(ac); final Function1<Port, Boolean> _function = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port p) { GeneralProtocolClass _protocol = p.getProtocol(); CommunicationType _commType = ((ProtocolClass) _protocol).getCommType(); @@ -607,6 +528,7 @@ public class ActorClassGen extends GenericActorClassGenerator { }; final Iterable<Port> eventPorts = IterableExtensions.<Port>filter(_allEndPorts, _function); final Function1<Port, Boolean> _function_1 = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port it) { int _multiplicity = it.getMultiplicity(); return Boolean.valueOf((_multiplicity != 1)); @@ -615,71 +537,25 @@ public class ActorClassGen extends GenericActorClassGenerator { final Iterable<Port> replEventPorts = IterableExtensions.<Port>filter(eventPorts, _function_1); List<Port> _allEndPorts_1 = this._roomHelpers.getAllEndPorts(ac); final Function1<Port, Boolean> _function_2 = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port p) { - boolean _and = false; - boolean _and_1 = false; - GeneralProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = ((ProtocolClass) _protocol).getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - if (!_equals) { - _and_1 = false; - } else { - boolean _isConjugated = p.isConjugated(); - _and_1 = _isConjugated; - } - if (!_and_1) { - _and = false; - } else { - int _multiplicity = p.getMultiplicity(); - boolean _equals_1 = (_multiplicity == 1); - _and = _equals_1; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((Objects.equal(((ProtocolClass) p.getProtocol()).getCommType(), CommunicationType.DATA_DRIVEN) && p.isConjugated()) && (p.getMultiplicity() == 1))); } }; final Iterable<Port> sendPorts = IterableExtensions.<Port>filter(_allEndPorts_1, _function_2); List<Port> _allEndPorts_2 = this._roomHelpers.getAllEndPorts(ac); final Function1<Port, Boolean> _function_3 = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port p) { - boolean _and = false; - boolean _and_1 = false; - GeneralProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = ((ProtocolClass) _protocol).getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - if (!_equals) { - _and_1 = false; - } else { - boolean _isConjugated = p.isConjugated(); - boolean _not = (!_isConjugated); - _and_1 = _not; - } - if (!_and_1) { - _and = false; - } else { - int _multiplicity = p.getMultiplicity(); - boolean _equals_1 = (_multiplicity == 1); - _and = _equals_1; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((Objects.equal(((ProtocolClass) p.getProtocol()).getCommType(), CommunicationType.DATA_DRIVEN) && (!p.isConjugated())) && (p.getMultiplicity() == 1))); } }; final Iterable<Port> recvPorts = IterableExtensions.<Port>filter(_allEndPorts_2, _function_3); List<InterfaceItem> _allInterfaceItems = this._roomHelpers.getAllInterfaceItems(ac); final Function1<InterfaceItem, Boolean> _function_4 = new Function1<InterfaceItem, Boolean>() { + @Override public Boolean apply(final InterfaceItem p) { - boolean _and = false; - PortClass _portClass = ActorClassGen.this._roomHelpers.getPortClass(p); - boolean _notEquals = (!Objects.equal(_portClass, null)); - if (!_notEquals) { - _and = false; - } else { - PortClass _portClass_1 = ActorClassGen.this._roomHelpers.getPortClass(p); - EList<PortOperation> _operations = _portClass_1.getOperations(); - int _size = _operations.size(); - boolean _greaterThan = (_size > 0); - _and = _greaterThan; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((!Objects.equal(ActorClassGen.this._roomHelpers.getPortClass(p), null)) && (ActorClassGen.this._roomHelpers.getPortClass(p).getOperations().size() > 0))); } }; final Iterable<InterfaceItem> portsWithOperations = IterableExtensions.<InterfaceItem>filter(_allInterfaceItems, _function_4); @@ -732,6 +608,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); { final Function1<Port, Boolean> _function_5 = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port it) { int _multiplicity = it.getMultiplicity(); return Boolean.valueOf((_multiplicity == 1)); @@ -1215,13 +1092,7 @@ public class ActorClassGen extends GenericActorClassGenerator { final boolean eventDriven = Objects.equal(_commType_1, ComponentCommunicationType.EVENT_DRIVEN); ComponentCommunicationType _commType_2 = ac.getCommType(); final boolean dataDriven = Objects.equal(_commType_2, ComponentCommunicationType.DATA_DRIVEN); - boolean _or = false; - if (async) { - _or = true; - } else { - _or = eventDriven; - } - final boolean handleEvents = _or; + final boolean handleEvents = (async || eventDriven); StringConcatenation _builder = new StringConcatenation(); _builder.append("/**"); _builder.newLine(); @@ -1372,13 +1243,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); _builder.newLine(); { - boolean _or_1 = false; - if (dataDriven) { - _or_1 = true; - } else { - _or_1 = async; - } - if (_or_1) { + if ((dataDriven || async)) { _builder.append("void "); String _name_8 = ac.getName(); _builder.append(_name_8, ""); diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java index a6d329401..17987b6fb 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java @@ -52,6 +52,7 @@ public class CExtensions implements ILanguageExtension { @Extension protected RoomHelpers _roomHelpers; + @Override public String getTypedDataDefinition(final EObject msg) { String _xifexpression = null; if ((msg instanceof Message)) { @@ -64,22 +65,27 @@ public class CExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String accessLevelPrivate() { return "static "; } + @Override public String accessLevelProtected() { return "static "; } + @Override public String accessLevelPublic() { return ""; } + @Override public String memberAccess() { return "self->"; } + @Override public String selfPointer(final String classname, final boolean hasArgs) { String _xifexpression = null; if (hasArgs) { @@ -90,6 +96,7 @@ public class CExtensions implements ILanguageExtension { return (classname + _xifexpression); } + @Override public String selfPointer(final boolean hasArgs) { String _xifexpression = null; if (hasArgs) { @@ -100,18 +107,22 @@ public class CExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String scopeSeparator() { return ""; } + @Override public String operationScope(final String classname, final boolean isDeclaration) { return (classname + "_"); } + @Override public String memberInDeclaration(final String namespace, final String member) { return ((namespace + "_") + member); } + @Override public String memberInUse(final String namespace, final String member) { return ((namespace + "_") + member); } @@ -236,14 +247,17 @@ public class CExtensions implements ILanguageExtension { return _builder; } + @Override public boolean usesInheritance() { return false; } + @Override public boolean usesPointers() { return true; } + @Override public String genEnumeration(final String name, final List<Pair<String, String>> entries) { String _xblockexpression = null; { @@ -280,6 +294,7 @@ public class CExtensions implements ILanguageExtension { return _xblockexpression; } + @Override public String booleanConstant(final boolean b) { String _xifexpression = null; if (b) { @@ -290,18 +305,22 @@ public class CExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String pointerLiteral() { return "*"; } + @Override public String nullPointer() { return "NULL"; } + @Override public String voidPointer() { return "void*"; } + @Override public String arrayType(final String type, final int size, final boolean isRef) { StringConcatenation _builder = new StringConcatenation(); _builder.append(type, ""); @@ -314,6 +333,7 @@ public class CExtensions implements ILanguageExtension { return _builder.toString(); } + @Override public String arrayDeclaration(final String type, final int size, final boolean isRef, final String name) { StringConcatenation _builder = new StringConcatenation(); _builder.append(type, ""); @@ -331,48 +351,30 @@ public class CExtensions implements ILanguageExtension { return _builder.toString(); } + @Override public String superCall(final String baseClassName, final String method, final String args) { return ""; } + @Override public String toValueLiteral(final PrimitiveType type, final String value) { String _switchResult = null; String _targetName = type.getTargetName(); boolean _matched = false; - if (!_matched) { - boolean _and = false; - String _targetName_1 = type.getTargetName(); - boolean _equals = _targetName_1.equals("char"); - if (!_equals) { - _and = false; - } else { - int _length = value.length(); - boolean _equals_1 = (_length == 1); - _and = _equals_1; - } - if (_and) { - _matched=true; - _switchResult = (("\'" + value) + "\'"); - } + if ((type.getTargetName().equals("char") && (value.length() == 1))) { + _matched=true; + _switchResult = (("\'" + value) + "\'"); } if (!_matched) { LiteralType _type = type.getType(); - boolean _equals_2 = Objects.equal(_type, LiteralType.CHAR); - if (_equals_2) { + boolean _equals = Objects.equal(_type, LiteralType.CHAR); + if (_equals) { _matched=true; _switchResult = (("\"" + value) + "\""); } } if (!_matched) { - boolean _or = false; - boolean _contains = value.contains(","); - if (_contains) { - _or = true; - } else { - boolean _contains_1 = value.contains("{"); - _or = _contains_1; - } - if (_or) { + if ((value.contains(",") || value.contains("{"))) { _matched=true; String _xblockexpression = null; { @@ -405,8 +407,8 @@ public class CExtensions implements ILanguageExtension { if (Objects.equal(_targetName, "boolean")) { _matched=true; String _xifexpression = null; - boolean _equals_3 = value.equals("true"); - if (_equals_3) { + boolean _equals_1 = value.equals("true"); + if (_equals_1) { _xifexpression = "ET_TRUE"; } else { _xifexpression = "ET_FALSE"; @@ -420,17 +422,10 @@ public class CExtensions implements ILanguageExtension { return _switchResult; } + @Override public String toEnumLiteral(final EnumerationType type, final String value) { String _xifexpression = null; - boolean _or = false; - boolean _contains = value.contains(","); - if (_contains) { - _or = true; - } else { - boolean _contains_1 = value.contains("{"); - _or = _contains_1; - } - if (_or) { + if ((value.contains(",") || value.contains("{"))) { String _xblockexpression = null; { String _replace = value.replace("{", ""); @@ -487,15 +482,14 @@ public class CExtensions implements ILanguageExtension { return null; } + @Override public String defaultValue(final DataType dt) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (dt instanceof PrimitiveType) { - _matched=true; - String _defaultValueLiteral = ((PrimitiveType)dt).getDefaultValueLiteral(); - _switchResult = this.toValueLiteral(((PrimitiveType)dt), _defaultValueLiteral); - } + if (dt instanceof PrimitiveType) { + _matched=true; + String _defaultValueLiteral = ((PrimitiveType)dt).getDefaultValueLiteral(); + _switchResult = this.toValueLiteral(((PrimitiveType)dt), _defaultValueLiteral); } if (!_matched) { if (dt instanceof EnumerationType) { @@ -567,6 +561,7 @@ public class CExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String initializationWithDefaultValues(final DataType dt, final int size) { String _xblockexpression = null; { @@ -637,20 +632,14 @@ public class CExtensions implements ILanguageExtension { return _xblockexpression; } + @Override public String[] generateArglistAndTypedData(final EObject d) { - boolean _or = false; - boolean _equals = Objects.equal(d, null); - if (_equals) { - _or = true; - } else { - _or = (!(d instanceof VarDecl)); - } - if (_or) { + if ((Objects.equal(d, null) || (!(d instanceof VarDecl)))) { return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList("", "", ""), String.class)); } final VarDecl data = ((VarDecl) d); - boolean _equals_1 = Objects.equal(data, null); - if (_equals_1) { + boolean _equals = Objects.equal(data, null); + if (_equals) { return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList("", "", ""), String.class)); } String _xifexpression = null; @@ -696,16 +685,7 @@ public class CExtensions implements ILanguageExtension { DataType _type_8 = _refType_8.getType(); final String ct = ((PrimitiveType) _type_8).getCastName(); String _xifexpression_4 = null; - boolean _and = false; - boolean _notEquals = (!Objects.equal(ct, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _isEmpty = ct.isEmpty(); - boolean _not = (!_isEmpty); - _and = _not; - } - if (_and) { + if (((!Objects.equal(ct, null)) && (!ct.isEmpty()))) { _xifexpression_4 = ct; } else { _xifexpression_4 = typeName; @@ -731,17 +711,7 @@ public class CExtensions implements ILanguageExtension { String deRef = "*"; RefableType _refType_10 = data.getRefType(); final boolean isRef = _refType_10.isRef(); - boolean _or_1 = false; - RefableType _refType_11 = data.getRefType(); - DataType _type_10 = _refType_11.getType(); - if ((_type_10 instanceof PrimitiveType)) { - _or_1 = true; - } else { - RefableType _refType_12 = data.getRefType(); - DataType _type_11 = _refType_12.getType(); - _or_1 = (_type_11 instanceof EnumerationType); - } - final boolean isPrim = _or_1; + final boolean isPrim = ((data.getRefType().getType() instanceof PrimitiveType) || (data.getRefType().getType() instanceof EnumerationType)); if (isRef) { typeName = (typeName + "*"); castTypeName = (castTypeName + "*"); @@ -776,6 +746,7 @@ public class CExtensions implements ILanguageExtension { return (_plus_2 + "\""); } + @Override public String getTargetType(final EnumerationType type) { String _xifexpression = null; PrimitiveType _primitiveType = type.getPrimitiveType(); @@ -789,6 +760,7 @@ public class CExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String getCastedValue(final EnumLiteral literal) { String _xblockexpression = null; { @@ -812,6 +784,7 @@ public class CExtensions implements ILanguageExtension { return _xblockexpression; } + @Override public String getCastType(final EnumerationType type) { String _xifexpression = null; PrimitiveType _primitiveType = type.getPrimitiveType(); @@ -825,6 +798,7 @@ public class CExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String makeOverridable() { return ""; } diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java index f770b2dff..95373640f 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java @@ -95,35 +95,15 @@ public class Initialization { _builder.append(" */"); String COMMENT = _builder.toString(); String _xifexpression = null; - boolean _or = false; - int _size_2 = a.getSize(); - boolean _equals = (_size_2 == 0); - if (_equals) { - _or = true; - } else { - boolean _and = false; - RefableType _type = a.getType(); - boolean _isRef = _type.isRef(); - boolean _not = (!_isRef); - if (!_not) { - _and = false; - } else { - RefableType _type_1 = a.getType(); - DataType _type_2 = _type_1.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_2); - _and = _isEnumerationOrPrimitive; - } - _or = _and; - } - if (_or) { + if (((a.getSize() == 0) || ((!a.getType().isRef()) && this._typeHelpers.isEnumerationOrPrimitive(a.getType().getType())))) { CharSequence _initAttribute = this.initAttribute(instance, path); _xifexpression = (_initAttribute + COMMENT); } else { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("{ "); { - int _size_3 = a.getSize(); - IntegerRange _upTo = new IntegerRange(1, _size_3); + int _size_2 = a.getSize(); + IntegerRange _upTo = new IntegerRange(1, _size_2); boolean _hasElements = false; for(final Integer i : _upTo) { if (!_hasElements) { @@ -166,31 +146,29 @@ public class Initialization { } CharSequence _switchResult = null; boolean _matched = false; - if (!_matched) { - if (aType instanceof DataClass) { - _matched=true; - StringConcatenation _builder = new StringConcatenation(); - _builder.append("{"); - _builder.newLine(); - { - List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); - boolean _hasElements = false; - for(final Attribute subA : _allAttributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - List<Attribute> _union = this._roomExtensions.<Attribute>union(path, subA); - String _initAttributeArray = this.initAttributeArray(instance, _union); - _builder.append(_initAttributeArray, "\t"); - _builder.newLineIfNotEmpty(); + if (aType instanceof DataClass) { + _matched=true; + StringConcatenation _builder = new StringConcatenation(); + _builder.append("{"); + _builder.newLine(); + { + List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); + boolean _hasElements = false; + for(final Attribute subA : _allAttributes) { + if (!_hasElements) { + _hasElements = true; + } else { + _builder.appendImmediate(",", "\t"); } + _builder.append("\t"); + List<Attribute> _union = this._roomExtensions.<Attribute>union(path, subA); + String _initAttributeArray = this.initAttributeArray(instance, _union); + _builder.append(_initAttributeArray, "\t"); + _builder.newLineIfNotEmpty(); } - _builder.append("}"); - _switchResult = _builder; } + _builder.append("}"); + _switchResult = _builder; } if (!_matched) { if (aType instanceof ExternalType) { @@ -213,31 +191,12 @@ public class Initialization { { String value = this.getPrimitiveValue(instance, path); CharSequence _xifexpression_1 = null; - boolean _and = false; - boolean _and_1 = false; - int _size = a.getSize(); - boolean _greaterThan = (_size > 0); - if (!_greaterThan) { - _and_1 = false; - } else { - boolean _isCharacterType = this._typeHelpers.isCharacterType(((PrimitiveType)aType)); - boolean _not = (!_isCharacterType); - _and_1 = _not; - } - if (!_and_1) { - _and = false; - } else { - String _trim = value.trim(); - boolean _startsWith = _trim.startsWith("{"); - boolean _not_1 = (!_startsWith); - _and = _not_1; - } - if (_and) { + if ((((a.getSize() > 0) && (!this._typeHelpers.isCharacterType(((PrimitiveType)aType)))) && (!value.trim().startsWith("{")))) { StringConcatenation _builder = new StringConcatenation(); _builder.append("{"); { - int _size_1 = a.getSize(); - IntegerRange _upTo = new IntegerRange(1, _size_1); + int _size = a.getSize(); + IntegerRange _upTo = new IntegerRange(1, _size); boolean _hasElements = false; for(final Integer i : _upTo) { if (!_hasElements) { @@ -252,23 +211,7 @@ public class Initialization { _xifexpression_1 = _builder; } else { String _xifexpression_2 = null; - boolean _and_2 = false; - boolean _and_3 = false; - int _size_2 = a.getSize(); - boolean _greaterThan_1 = (_size_2 > 0); - if (!_greaterThan_1) { - _and_3 = false; - } else { - boolean _isCharacterType_1 = this._typeHelpers.isCharacterType(((PrimitiveType)aType)); - _and_3 = _isCharacterType_1; - } - if (!_and_3) { - _and_2 = false; - } else { - boolean _startsWith_1 = value.startsWith("\'"); - _and_2 = _startsWith_1; - } - if (_and_2) { + if ((((a.getSize() > 0) && this._typeHelpers.isCharacterType(((PrimitiveType)aType))) && value.startsWith("\'"))) { _xifexpression_2 = (("{" + value) + "}"); } else { _xifexpression_2 = value; @@ -287,23 +230,12 @@ public class Initialization { { String value = this.getPrimitiveValue(instance, path); CharSequence _xifexpression_1 = null; - boolean _and = false; - int _size = a.getSize(); - boolean _greaterThan = (_size > 0); - if (!_greaterThan) { - _and = false; - } else { - String _trim = value.trim(); - boolean _startsWith = _trim.startsWith("{"); - boolean _not = (!_startsWith); - _and = _not; - } - if (_and) { + if (((a.getSize() > 0) && (!value.trim().startsWith("{")))) { StringConcatenation _builder = new StringConcatenation(); _builder.append("{"); { - int _size_1 = a.getSize(); - IntegerRange _upTo = new IntegerRange(1, _size_1); + int _size = a.getSize(); + IntegerRange _upTo = new IntegerRange(1, _size); boolean _hasElements = false; for(final Integer i : _upTo) { if (!_hasElements) { @@ -335,12 +267,10 @@ public class Initialization { if (_equals) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (instance instanceof ActorInstance) { - _matched=true; - ActorClass _actorClass = ((ActorInstance)instance).getActorClass(); - _switchResult = this._typeHelpers.getAttrClassConfigValue(path, _actorClass, true); - } + if (instance instanceof ActorInstance) { + _matched=true; + ActorClass _actorClass = ((ActorInstance)instance).getActorClass(); + _switchResult = this._typeHelpers.getAttrClassConfigValue(path, _actorClass, true); } if (!_matched) { if (instance instanceof InterfaceItemInstance) { @@ -362,27 +292,11 @@ public class Initialization { RefableType _type = _last_1.getType(); DataType type = _type.getType(); String _xifexpression = null; - boolean _and = false; - boolean _notEquals = (!Objects.equal(value, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _isPrimitive = this._typeHelpers.isPrimitive(type); - _and = _isPrimitive; - } - if (_and) { + if (((!Objects.equal(value, null)) && this._typeHelpers.isPrimitive(type))) { _xifexpression = this.languageExt.toValueLiteral(((PrimitiveType) type), value); } else { String _xifexpression_1 = null; - boolean _and_1 = false; - boolean _notEquals_1 = (!Objects.equal(value, null)); - if (!_notEquals_1) { - _and_1 = false; - } else { - boolean _isEnumeration = this._typeHelpers.isEnumeration(type); - _and_1 = _isEnumeration; - } - if (_and_1) { + if (((!Objects.equal(value, null)) && this._typeHelpers.isEnumeration(type))) { _xifexpression_1 = this.languageExt.toEnumLiteral(((EnumerationType) type), value); } else { _xifexpression_1 = this.languageExt.defaultValue(type); diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java index e89ed1b13..a945d3724 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java @@ -273,22 +273,13 @@ public class NodeGen { NodeClass _type = nr.getType(); EList<PhysicalThread> _threads = _type.getThreads(); final Function1<PhysicalThread, Boolean> _function = new Function1<PhysicalThread, Boolean>() { + @Override public Boolean apply(final PhysicalThread t) { return Boolean.valueOf(usedThreads.contains(t)); } }; final Iterable<PhysicalThread> threads = IterableExtensions.<PhysicalThread>filter(_threads, _function); - boolean _and = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateDataInstrumentation = _settings.isGenerateDataInstrumentation(); - if (!_isGenerateDataInstrumentation) { - _and = false; - } else { - EList<Annotation> _annotations = ssc.getAnnotations(); - boolean _isAnnotationPresent = this._roomHelpers.isAnnotationPresent(_annotations, "DataLogging"); - _and = _isAnnotationPresent; - } - final boolean logData = _and; + final boolean logData = (Main.getSettings().isGenerateDataInstrumentation() && this._roomHelpers.isAnnotationPresent(ssc.getAnnotations(), "DataLogging")); StringConcatenation _builder = new StringConcatenation(); _builder.append("/**"); _builder.newLine(); @@ -423,17 +414,7 @@ public class NodeGen { { for(final PhysicalThread thread : threads) { { - boolean _or = false; - ExecMode _execmode = thread.getExecmode(); - boolean _equals = Objects.equal(_execmode, ExecMode.POLLED); - if (_equals) { - _or = true; - } else { - ExecMode _execmode_1 = thread.getExecmode(); - boolean _equals_1 = Objects.equal(_execmode_1, ExecMode.MIXED); - _or = _equals_1; - } - if (_or) { + if ((Objects.equal(thread.getExecmode(), ExecMode.POLLED) || Objects.equal(thread.getExecmode(), ExecMode.MIXED))) { _builder.append("\t\t"); _builder.append("interval.sec = "); long _time = thread.getTime(); @@ -507,8 +488,8 @@ public class NodeGen { _builder.append("\t\t"); _builder.append("\t"); _builder.append("EXECMODE_"); - ExecMode _execmode_2 = thread.getExecmode(); - String _string = _execmode_2.toString(); + ExecMode _execmode = thread.getExecmode(); + String _string = _execmode.toString(); String _upperCase_2 = _string.toUpperCase(); _builder.append(_upperCase_2, "\t\t\t"); _builder.append(");"); @@ -538,6 +519,7 @@ public class NodeGen { _builder.newLine(); { final Function1<PhysicalThread, Long> _function_1 = new Function1<PhysicalThread, Long>() { + @Override public Long apply(final PhysicalThread it) { return Long.valueOf(it.getPrio()); } @@ -997,6 +979,7 @@ public class NodeGen { NodeClass _type = nr.getType(); EList<PhysicalThread> _threads = _type.getThreads(); final Function1<PhysicalThread, Boolean> _function = new Function1<PhysicalThread, Boolean>() { + @Override public Boolean apply(final PhysicalThread t) { return Boolean.valueOf(usedThreads.contains(t)); } @@ -1168,18 +1151,7 @@ public class NodeGen { _builder.append(" */"); _builder.newLineIfNotEmpty(); { - boolean _and = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - boolean _not = (!_isGenerateMSCInstrumentation); - if (!_not) { - _and = false; - } else { - EList<InterfaceItemInstance> _orderedIfItemInstances_2 = ai_2.getOrderedIfItemInstances(); - boolean _isEmpty_1 = _orderedIfItemInstances_2.isEmpty(); - _and = _isEmpty_1; - } - if (_and) { + if (((!Main.getSettings().isGenerateMSCInstrumentation()) && ai_2.getOrderedIfItemInstances().isEmpty())) { _builder.append("/* no ports/saps/services - nothing to initialize statically */"); _builder.newLine(); } else { @@ -1204,6 +1176,7 @@ public class NodeGen { final ArrayList<InterfaceItemInstance> replEventItems = new ArrayList<InterfaceItemInstance>(); EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances(); final Function1<InterfaceItemInstance, Boolean> _function = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance e) { return Boolean.valueOf(e.isReplicated()); } @@ -1211,6 +1184,7 @@ public class NodeGen { Iterable<InterfaceItemInstance> _filter = IterableExtensions.<InterfaceItemInstance>filter(_orderedIfItemInstances, _function); Iterables.<InterfaceItemInstance>addAll(replEventItems, _filter); final Function1<InterfaceItemInstance, Boolean> _function_1 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance e) { EList<InterfaceItemInstance> _peers = e.getPeers(); boolean _isEmpty = _peers.isEmpty(); @@ -1220,6 +1194,7 @@ public class NodeGen { InterfaceItemInstance _findFirst = IterableExtensions.<InterfaceItemInstance>findFirst(replEventItems, _function_1); final boolean haveReplSubItems = (!Objects.equal(_findFirst, null)); final Function1<InterfaceItemInstance, Boolean> _function_2 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance i) { InterfaceItem _interfaceItem = i.getInterfaceItem(); return Boolean.valueOf((_interfaceItem instanceof Port)); @@ -1227,6 +1202,7 @@ public class NodeGen { }; final Iterable<InterfaceItemInstance> replEventPorts = IterableExtensions.<InterfaceItemInstance>filter(replEventItems, _function_2); final Function1<InterfaceItemInstance, Boolean> _function_3 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance i) { InterfaceItem _interfaceItem = i.getInterfaceItem(); return Boolean.valueOf((_interfaceItem instanceof SPP)); @@ -1235,6 +1211,7 @@ public class NodeGen { final Iterable<InterfaceItemInstance> replEventSPPs = IterableExtensions.<InterfaceItemInstance>filter(replEventItems, _function_3); EList<InterfaceItemInstance> _orderedIfItemInstances_1 = ai.getOrderedIfItemInstances(); final Function1<InterfaceItemInstance, Boolean> _function_4 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance e) { return Boolean.valueOf(e.isSimple()); } @@ -1242,6 +1219,7 @@ public class NodeGen { final Iterable<InterfaceItemInstance> simplePorts = IterableExtensions.<InterfaceItemInstance>filter(_orderedIfItemInstances_1, _function_4); final ArrayList<InterfaceItemInstance> simpleEventItems = new ArrayList<InterfaceItemInstance>(); final Function1<InterfaceItemInstance, Boolean> _function_5 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance p) { ProtocolClass _protocol = p.getProtocol(); CommunicationType _commType = _protocol.getCommType(); @@ -1251,6 +1229,7 @@ public class NodeGen { Iterable<InterfaceItemInstance> _filter_1 = IterableExtensions.<InterfaceItemInstance>filter(simplePorts, _function_5); Iterables.<InterfaceItemInstance>addAll(simpleEventItems, _filter_1); final Function1<InterfaceItemInstance, Boolean> _function_6 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance i) { InterfaceItem _interfaceItem = i.getInterfaceItem(); return Boolean.valueOf((_interfaceItem instanceof Port)); @@ -1258,6 +1237,7 @@ public class NodeGen { }; final Iterable<InterfaceItemInstance> simpleEventPorts = IterableExtensions.<InterfaceItemInstance>filter(simpleEventItems, _function_6); final Function1<InterfaceItemInstance, Boolean> _function_7 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance i) { InterfaceItem _interfaceItem = i.getInterfaceItem(); return Boolean.valueOf((_interfaceItem instanceof SAP)); @@ -1265,6 +1245,7 @@ public class NodeGen { }; final Iterable<InterfaceItemInstance> simpleEventSAPs = IterableExtensions.<InterfaceItemInstance>filter(simpleEventItems, _function_7); final Function1<InterfaceItemInstance, Boolean> _function_8 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance p) { ProtocolClass _protocol = p.getProtocol(); CommunicationType _commType = _protocol.getCommType(); @@ -1273,31 +1254,16 @@ public class NodeGen { }; final Iterable<InterfaceItemInstance> dataPorts = IterableExtensions.<InterfaceItemInstance>filter(simplePorts, _function_8); final Function1<InterfaceItemInstance, Boolean> _function_9 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance p) { - boolean _and = false; - if (!(p instanceof PortInstance)) { - _and = false; - } else { - Port _port = ((PortInstance) p).getPort(); - boolean _isConjugated = _port.isConjugated(); - boolean _not = (!_isConjugated); - _and = _not; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((p instanceof PortInstance) && (!((PortInstance) p).getPort().isConjugated()))); } }; final Iterable<InterfaceItemInstance> recvPorts = IterableExtensions.<InterfaceItemInstance>filter(dataPorts, _function_9); final Function1<InterfaceItemInstance, Boolean> _function_10 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance p) { - boolean _and = false; - if (!(p instanceof PortInstance)) { - _and = false; - } else { - Port _port = ((PortInstance) p).getPort(); - boolean _isConjugated = _port.isConjugated(); - _and = _isConjugated; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((p instanceof PortInstance) && ((PortInstance) p).getPort().isConjugated())); } }; final Iterable<InterfaceItemInstance> sendPorts = IterableExtensions.<InterfaceItemInstance>filter(dataPorts, _function_10); @@ -1319,38 +1285,12 @@ public class NodeGen { _xifexpression = "NULL"; } String replSubPortsArray = _xifexpression; - boolean _or = false; - boolean _or_1 = false; - boolean _or_2 = false; - boolean _isEmpty = simpleEventItems.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _or_2 = true; - } else { - boolean _isEmpty_1 = IterableExtensions.isEmpty(recvPorts); - boolean _not_1 = (!_isEmpty_1); - _or_2 = _not_1; - } - if (_or_2) { - _or_1 = true; - } else { - boolean _isEmpty_2 = replEventItems.isEmpty(); - boolean _not_2 = (!_isEmpty_2); - _or_1 = _not_2; - } - if (_or_1) { - _or = true; - } else { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - _or = _isGenerateMSCInstrumentation; - } - final boolean haveConstData = _or; + final boolean haveConstData = ((((!simpleEventItems.isEmpty()) || (!IterableExtensions.isEmpty(recvPorts))) || (!replEventItems.isEmpty())) || Main.getSettings().isGenerateMSCInstrumentation()); final IntelligentSeparator sep = new IntelligentSeparator(","); String _xifexpression_1 = null; - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { _xifexpression_1 = "/*const*/"; } else { _xifexpression_1 = "const"; @@ -1358,9 +1298,9 @@ public class NodeGen { final String const_ = _xifexpression_1; StringConcatenation _builder = new StringConcatenation(); { - GlobalGeneratorSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { + GlobalGeneratorSettings _settings_1 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_1) { CharSequence _genPeerPortArrays = this.genPeerPortArrays(root, ai); _builder.append(_genPeerPortArrays, ""); _builder.newLineIfNotEmpty(); @@ -1379,6 +1319,7 @@ public class NodeGen { _builder.newLine(); { final Function1<InterfaceItemInstance, Boolean> _function_11 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance e) { EList<InterfaceItemInstance> _peers = e.getPeers(); boolean _isEmpty = _peers.isEmpty(); @@ -1416,9 +1357,9 @@ public class NodeGen { _builder.append("_const = {"); _builder.newLineIfNotEmpty(); { - GlobalGeneratorSettings _settings_3 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_3 = _settings_3.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_3) { + GlobalGeneratorSettings _settings_2 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_2) { _builder.append("\t"); _builder.append(sep, "\t"); _builder.append("\""); @@ -1572,62 +1513,35 @@ public class NodeGen { { EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances(); final Function1<InterfaceItemInstance, Boolean> _function = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance e) { - boolean _and = false; - boolean _isSimple = e.isSimple(); - if (!_isSimple) { - _and = false; - } else { - _and = (e instanceof PortInstance); - } - return Boolean.valueOf(_and); + return Boolean.valueOf((e.isSimple() && (e instanceof PortInstance))); } }; Iterable<InterfaceItemInstance> _filter = IterableExtensions.<InterfaceItemInstance>filter(_orderedIfItemInstances, _function); final Function1<InterfaceItemInstance, PortInstance> _function_1 = new Function1<InterfaceItemInstance, PortInstance>() { + @Override public PortInstance apply(final InterfaceItemInstance inst) { return ((PortInstance) inst); } }; final Iterable<PortInstance> simplePorts = IterableExtensions.<InterfaceItemInstance, PortInstance>map(_filter, _function_1); final Function1<PortInstance, Boolean> _function_2 = new Function1<PortInstance, Boolean>() { + @Override public Boolean apply(final PortInstance p) { - boolean _and = false; - Port _port = p.getPort(); - boolean _isConjugated = _port.isConjugated(); - if (!_isConjugated) { - _and = false; - } else { - ProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = _protocol.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - _and = _equals; - } - return Boolean.valueOf(_and); + return Boolean.valueOf((p.getPort().isConjugated() && Objects.equal(p.getProtocol().getCommType(), CommunicationType.DATA_DRIVEN))); } }; final Iterable<PortInstance> sendPorts = IterableExtensions.<PortInstance>filter(simplePorts, _function_2); final Function1<PortInstance, Boolean> _function_3 = new Function1<PortInstance, Boolean>() { + @Override public Boolean apply(final PortInstance p) { Port _port = p.getPort(); List<Message> _outgoing = NodeGen.this._roomHelpers.getOutgoing(_port); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { - boolean _or = false; - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - boolean _isEnumeration = NodeGen.this._typeHelpers.isEnumeration(_type); - if (_isEnumeration) { - _or = true; - } else { - VarDecl _data_1 = m.getData(); - RefableType _refType_1 = _data_1.getRefType(); - DataType _type_1 = _refType_1.getType(); - boolean _isBoolean = NodeGen.this._typeHelpers.isBoolean(_type_1); - _or = _isBoolean; - } - return Boolean.valueOf(_or); + return Boolean.valueOf((NodeGen.this._typeHelpers.isEnumeration(m.getData().getRefType().getType()) || NodeGen.this._typeHelpers.isBoolean(m.getData().getRefType().getType()))); } }; Iterable<Message> _filter = IterableExtensions.<Message>filter(_outgoing, _function); @@ -1781,6 +1695,7 @@ public class NodeGen { final ProtocolClass pc = ((ProtocolClass) _protocol); List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); return Boolean.valueOf((!Objects.equal(_data, null))); @@ -1788,6 +1703,7 @@ public class NodeGen { }; Iterable<Message> messages = IterableExtensions.<Message>filter(_allIncomingMessages, _function); final Function1<Message, Boolean> _function_1 = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); RefableType _refType = _data.getRefType(); @@ -1797,6 +1713,7 @@ public class NodeGen { }; final Iterable<Message> enumMsgs = IterableExtensions.<Message>filter(messages, _function_1); final Function1<Message, Boolean> _function_2 = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); RefableType _refType = _data.getRefType(); @@ -1805,24 +1722,7 @@ public class NodeGen { } }; final Iterable<Message> boolMsgs = IterableExtensions.<Message>filter(messages, _function_2); - boolean _and = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (!_isGenerateMSCInstrumentation) { - _and = false; - } else { - boolean _and_1 = false; - boolean _isEmpty = IterableExtensions.isEmpty(enumMsgs); - if (!_isEmpty) { - _and_1 = false; - } else { - boolean _isEmpty_1 = IterableExtensions.isEmpty(boolMsgs); - _and_1 = _isEmpty_1; - } - boolean _not = (!_and_1); - _and = _not; - } - final boolean usesMSC = _and; + final boolean usesMSC = (Main.getSettings().isGenerateMSCInstrumentation() && (!(IterableExtensions.isEmpty(enumMsgs) && IterableExtensions.isEmpty(boolMsgs)))); EObject _eContainer = pi.eContainer(); final String instName = ((ActorInstance) _eContainer).getPath(); StringConcatenation _builder = new StringConcatenation(); @@ -1908,6 +1808,7 @@ public class NodeGen { InterfaceItem _interfaceItem = pi.getInterfaceItem(); List<Message> _incoming = this._roomHelpers.getIncoming(_interfaceItem); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); return Boolean.valueOf((!Objects.equal(_data, null))); @@ -1915,6 +1816,7 @@ public class NodeGen { }; Iterable<Message> sentMsgs = IterableExtensions.<Message>filter(_incoming, _function); final Function1<Message, Boolean> _function_1 = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); RefableType _refType = _data.getRefType(); @@ -1924,6 +1826,7 @@ public class NodeGen { }; final Iterable<Message> enumMsgs = IterableExtensions.<Message>filter(sentMsgs, _function_1); final Function1<Message, Boolean> _function_2 = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); RefableType _refType = _data.getRefType(); @@ -1932,24 +1835,7 @@ public class NodeGen { } }; final Iterable<Message> boolMsgs = IterableExtensions.<Message>filter(sentMsgs, _function_2); - boolean _and = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (!_isGenerateMSCInstrumentation) { - _and = false; - } else { - boolean _and_1 = false; - boolean _isEmpty = IterableExtensions.isEmpty(enumMsgs); - if (!_isEmpty) { - _and_1 = false; - } else { - boolean _isEmpty_1 = IterableExtensions.isEmpty(boolMsgs); - _and_1 = _isEmpty_1; - } - boolean _not = (!_and_1); - _and = _not; - } - final boolean usesMSC = _and; + final boolean usesMSC = (Main.getSettings().isGenerateMSCInstrumentation() && (!(IterableExtensions.isEmpty(enumMsgs) && IterableExtensions.isEmpty(boolMsgs)))); String enumVal = ""; if (usesMSC) { String _path = ai.getPath(); @@ -1975,8 +1861,8 @@ public class NodeGen { enumVal = (("\n#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE" + enumVal) + "\n#endif\n"); } EList<InterfaceItemInstance> _peers = pi.getPeers(); - boolean _isEmpty_2 = _peers.isEmpty(); - if (_isEmpty_2) { + boolean _isEmpty = _peers.isEmpty(); + if (_isEmpty) { return (("{NULL" + enumVal) + "}"); } EList<InterfaceItemInstance> _peers_1 = pi.getPeers(); @@ -2081,18 +1967,7 @@ public class NodeGen { CharSequence _xblockexpression = null; { final NodeRef nr = ETMapUtil.getNodeRef(ssi); - boolean _and = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateDataInstrumentation = _settings.isGenerateDataInstrumentation(); - if (!_isGenerateDataInstrumentation) { - _and = false; - } else { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - EList<Annotation> _annotations = _subSystemClass.getAnnotations(); - boolean _isAnnotationPresent = this._roomHelpers.isAnnotationPresent(_annotations, "DataLogging"); - _and = _isAnnotationPresent; - } - final boolean logData = _and; + final boolean logData = (Main.getSettings().isGenerateDataInstrumentation() && this._roomHelpers.isAnnotationPresent(ssi.getSubSystemClass().getAnnotations(), "DataLogging")); ArrayList<PortInstance> _xifexpression = null; if (logData) { _xifexpression = this.loggedPorts(ssi); @@ -2135,6 +2010,7 @@ public class NodeGen { NodeClass _type = nr.getType(); EList<PhysicalThread> _threads = _type.getThreads(); final Function1<PhysicalThread, Boolean> _function = new Function1<PhysicalThread, Boolean>() { + @Override public Boolean apply(final PhysicalThread t) { return Boolean.valueOf(usedThreads.contains(t)); } @@ -2149,6 +2025,7 @@ public class NodeGen { } EList<ActorInstance> _allContainedInstances = ssi.getAllContainedInstances(); final Function1<ActorInstance, Boolean> _function_1 = new Function1<ActorInstance, Boolean>() { + @Override public Boolean apply(final ActorInstance ai) { ETMapUtil.MappedThread _mappedThread = ETMapUtil.getMappedThread(ai); PhysicalThread _thread = _mappedThread.getThread(); @@ -2158,39 +2035,17 @@ public class NodeGen { final Iterable<ActorInstance> instancesOnThread = IterableExtensions.<ActorInstance>filter(_allContainedInstances, _function_1); _builder.newLineIfNotEmpty(); final Function1<ActorInstance, Boolean> _function_2 = new Function1<ActorInstance, Boolean>() { + @Override public Boolean apply(final ActorInstance ai) { - boolean _or = false; - ActorClass _actorClass = ai.getActorClass(); - ComponentCommunicationType _commType = _actorClass.getCommType(); - boolean _equals = Objects.equal(_commType, ComponentCommunicationType.EVENT_DRIVEN); - if (_equals) { - _or = true; - } else { - ActorClass _actorClass_1 = ai.getActorClass(); - ComponentCommunicationType _commType_1 = _actorClass_1.getCommType(); - boolean _equals_1 = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); - _or = _equals_1; - } - return Boolean.valueOf(_or); + return Boolean.valueOf((Objects.equal(ai.getActorClass().getCommType(), ComponentCommunicationType.EVENT_DRIVEN) || Objects.equal(ai.getActorClass().getCommType(), ComponentCommunicationType.ASYNCHRONOUS))); } }; final Iterable<ActorInstance> dispatchedInstances = IterableExtensions.<ActorInstance>filter(instancesOnThread, _function_2); _builder.newLineIfNotEmpty(); final Function1<ActorInstance, Boolean> _function_3 = new Function1<ActorInstance, Boolean>() { + @Override public Boolean apply(final ActorInstance ai) { - boolean _or = false; - ActorClass _actorClass = ai.getActorClass(); - ComponentCommunicationType _commType = _actorClass.getCommType(); - boolean _equals = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); - if (_equals) { - _or = true; - } else { - ActorClass _actorClass_1 = ai.getActorClass(); - ComponentCommunicationType _commType_1 = _actorClass_1.getCommType(); - boolean _equals_1 = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); - _or = _equals_1; - } - return Boolean.valueOf(_or); + return Boolean.valueOf((Objects.equal(ai.getActorClass().getCommType(), ComponentCommunicationType.DATA_DRIVEN) || Objects.equal(ai.getActorClass().getCommType(), ComponentCommunicationType.ASYNCHRONOUS))); } }; final Iterable<ActorInstance> executedInstances = IterableExtensions.<ActorInstance>filter(instancesOnThread, _function_3); @@ -2366,6 +2221,7 @@ public class NodeGen { { EList<InterfaceItemInstance> _orderedIfItemInstances = ai_1.getOrderedIfItemInstances(); final Function1<InterfaceItemInstance, Boolean> _function_4 = new Function1<InterfaceItemInstance, Boolean>() { + @Override public Boolean apply(final InterfaceItemInstance p) { ProtocolClass _protocol = p.getProtocol(); CommunicationType _commType = _protocol.getCommType(); @@ -2492,8 +2348,8 @@ public class NodeGen { _builder.newLine(); } else { { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings_1.isGenerateMSCInstrumentation(); + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); if (_isGenerateMSCInstrumentation) { _builder.append("\t\t"); _builder.append("\t"); @@ -2675,8 +2531,8 @@ public class NodeGen { _builder.newLine(); } else { { - GlobalGeneratorSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_2.isGenerateMSCInstrumentation(); + GlobalGeneratorSettings _settings_1 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); if (_isGenerateMSCInstrumentation_1) { _builder.append("\t\t"); _builder.append("\t"); @@ -2788,20 +2644,9 @@ public class NodeGen { ProtocolClass _protocol = pi.getProtocol(); EList<Message> _incomingMessages = _protocol.getIncomingMessages(); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { - boolean _and = false; - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (!_notEquals) { - _and = false; - } else { - VarDecl _data_1 = m.getData(); - RefableType _refType = _data_1.getRefType(); - DataType _type = _refType.getType(); - boolean _isEnumerationOrPrimitive = NodeGen.this._typeHelpers.isEnumerationOrPrimitive(_type); - _and = _isEnumerationOrPrimitive; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((!Objects.equal(m.getData(), null)) && NodeGen.this._typeHelpers.isEnumerationOrPrimitive(m.getData().getRefType().getType()))); } }; Iterable<Message> _filter = IterableExtensions.<Message>filter(_incomingMessages, _function); @@ -2899,20 +2744,9 @@ public class NodeGen { ProtocolClass _protocol_1 = pi.getProtocol(); EList<Message> _incomingMessages = _protocol_1.getIncomingMessages(); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { - boolean _and = false; - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (!_notEquals) { - _and = false; - } else { - VarDecl _data_1 = m.getData(); - RefableType _refType = _data_1.getRefType(); - DataType _type = _refType.getType(); - boolean _isEnumerationOrPrimitive = NodeGen.this._typeHelpers.isEnumerationOrPrimitive(_type); - _and = _isEnumerationOrPrimitive; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((!Objects.equal(m.getData(), null)) && NodeGen.this._typeHelpers.isEnumerationOrPrimitive(m.getData().getRefType().getType()))); } }; Iterable<Message> _filter = IterableExtensions.<Message>filter(_incomingMessages, _function); diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java index 244121ba3..57ec2e878 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java @@ -16,8 +16,6 @@ import com.google.inject.Inject; import com.google.inject.Singleton; import java.util.Collection; import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.common.base.Annotation; import org.eclipse.etrice.core.common.base.util.BaseHelpers; import org.eclipse.etrice.core.etmap.util.ETMapUtil; import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; @@ -90,18 +88,7 @@ public class NodeRunnerGen { String _plus = (_name + "_"); String _name_1 = ssi.getName(); final String clsname = (_plus + _name_1); - boolean _and = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateDataInstrumentation = _settings.isGenerateDataInstrumentation(); - if (!_isGenerateDataInstrumentation) { - _and = false; - } else { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - EList<Annotation> _annotations = _subSystemClass.getAnnotations(); - boolean _isAnnotationPresent = this._baseHelpers.isAnnotationPresent(_annotations, "DataLogging"); - _and = _isAnnotationPresent; - } - final boolean logData = _and; + final boolean logData = (Main.getSettings().isGenerateDataInstrumentation() && this._baseHelpers.isAnnotationPresent(ssi.getSubSystemClass().getAnnotations(), "DataLogging")); StringConcatenation _builder = new StringConcatenation(); _builder.append("/**"); _builder.newLine(); @@ -155,8 +142,8 @@ public class NodeRunnerGen { _builder.newLine(); _builder.append(" "); _builder.append("* "); - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - String _mainMethodName = _settings_1.getMainMethodName(); + GlobalGeneratorSettings _settings = Main.getSettings(); + String _mainMethodName = _settings.getMainMethodName(); _builder.append(_mainMethodName, " "); _builder.append(" function"); _builder.newLineIfNotEmpty(); @@ -168,8 +155,8 @@ public class NodeRunnerGen { _builder.newLine(); _builder.newLine(); _builder.append("int "); - GlobalGeneratorSettings _settings_2 = Main.getSettings(); - String _mainMethodName_1 = _settings_2.getMainMethodName(); + GlobalGeneratorSettings _settings_1 = Main.getSettings(); + String _mainMethodName_1 = _settings_1.getMainMethodName(); _builder.append(_mainMethodName_1, ""); _builder.append("(int argc, char** argv) {"); _builder.newLineIfNotEmpty(); diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java index b138e26bb..cb54e0a94 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java @@ -560,27 +560,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { String typeName = _xifexpression_1; _builder.newLineIfNotEmpty(); String _xifexpression_2 = null; - boolean _and = false; - if (!hasData) { - _and = false; - } else { - boolean _or = false; - VarDecl _data_2 = message.getData(); - RefableType _refType_1 = _data_2.getRefType(); - DataType _type_1 = _refType_1.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - boolean _not_1 = (!_isEnumerationOrPrimitive); - if (_not_1) { - _or = true; - } else { - VarDecl _data_3 = message.getData(); - RefableType _refType_2 = _data_3.getRefType(); - boolean _isRef = _refType_2.isRef(); - _or = _isRef; - } - _and = _or; - } - if (_and) { + if ((hasData && ((!this._typeHelpers.isEnumerationOrPrimitive(message.getData().getRefType().getType())) || message.getData().getRefType().isRef()))) { _xifexpression_2 = "*"; } else { _xifexpression_2 = ""; @@ -661,6 +641,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { { List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); return Boolean.valueOf((!Objects.equal(_data, null))); @@ -668,6 +649,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { }; Iterable<Message> sentMsgs = IterableExtensions.<Message>filter(_allIncomingMessages, _function); final Function1<Message, Boolean> _function_1 = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); RefableType _refType = _data.getRefType(); @@ -677,6 +659,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { }; final Iterable<Message> enumMsgs = IterableExtensions.<Message>filter(sentMsgs, _function_1); final Function1<Message, Boolean> _function_2 = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); RefableType _refType = _data.getRefType(); @@ -685,24 +668,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { } }; final Iterable<Message> boolMsgs = IterableExtensions.<Message>filter(sentMsgs, _function_2); - boolean _and = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (!_isGenerateMSCInstrumentation) { - _and = false; - } else { - boolean _and_1 = false; - boolean _isEmpty = IterableExtensions.isEmpty(enumMsgs); - if (!_isEmpty) { - _and_1 = false; - } else { - boolean _isEmpty_1 = IterableExtensions.isEmpty(boolMsgs); - _and_1 = _isEmpty_1; - } - boolean _not = (!_and_1); - _and = _not; - } - final boolean usesMSC = _and; + final boolean usesMSC = (Main.getSettings().isGenerateMSCInstrumentation() && (!(IterableExtensions.isEmpty(enumMsgs) && IterableExtensions.isEmpty(boolMsgs)))); StringConcatenation _builder = new StringConcatenation(); _builder.append("/* data driven send port (conjugated) */"); _builder.newLine(); @@ -883,18 +849,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { String typeName_3 = _xifexpression_3; _builder.newLineIfNotEmpty(); String _xifexpression_4 = null; - boolean _and_2 = false; - if (!hasData) { - _and_2 = false; - } else { - VarDecl _data_8 = message.getData(); - RefableType _refType_7 = _data_8.getRefType(); - DataType _type_4 = _refType_7.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_4); - boolean _not_1 = (!_isEnumerationOrPrimitive); - _and_2 = _not_1; - } - if (_and_2) { + if ((hasData && (!this._typeHelpers.isEnumerationOrPrimitive(message.getData().getRefType().getType())))) { _xifexpression_4 = "*"; } else { _xifexpression_4 = ""; @@ -934,6 +889,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { { List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); return Boolean.valueOf((!Objects.equal(_data, null))); @@ -941,6 +897,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { }; Iterable<Message> messages = IterableExtensions.<Message>filter(_allIncomingMessages, _function); final Function1<Message, Boolean> _function_1 = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); RefableType _refType = _data.getRefType(); @@ -950,6 +907,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { }; final Iterable<Message> enumMsgs = IterableExtensions.<Message>filter(messages, _function_1); final Function1<Message, Boolean> _function_2 = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); RefableType _refType = _data.getRefType(); @@ -958,24 +916,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { } }; final Iterable<Message> boolMsgs = IterableExtensions.<Message>filter(messages, _function_2); - boolean _and = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (!_isGenerateMSCInstrumentation) { - _and = false; - } else { - boolean _and_1 = false; - boolean _isEmpty = IterableExtensions.isEmpty(enumMsgs); - if (!_isEmpty) { - _and_1 = false; - } else { - boolean _isEmpty_1 = IterableExtensions.isEmpty(boolMsgs); - _and_1 = _isEmpty_1; - } - boolean _not = (!_and_1); - _and = _not; - } - final boolean usesMSC = _and; + final boolean usesMSC = (Main.getSettings().isGenerateMSCInstrumentation() && (!(IterableExtensions.isEmpty(enumMsgs) && IterableExtensions.isEmpty(boolMsgs)))); StringConcatenation _builder = new StringConcatenation(); { for(final Message message : messages) { @@ -989,8 +930,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { RefableType _refType_1 = _data_1.getRefType(); DataType _type_1 = _refType_1.getType(); boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - boolean _not_1 = (!_isEnumerationOrPrimitive); - if (_not_1) { + boolean _not = (!_isEnumerationOrPrimitive); + if (_not) { _xifexpression = "*"; } else { _xifexpression = ""; @@ -1006,19 +947,12 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(" {"); _builder.newLineIfNotEmpty(); { - boolean _and_2 = false; - if (!usesMSC) { - _and_2 = false; - } else { - final Function1<Message, Boolean> _function_3 = new Function1<Message, Boolean>() { - public Boolean apply(final Message m) { - return Boolean.valueOf(Objects.equal(m, message)); - } - }; - boolean _exists = IterableExtensions.<Message>exists(enumMsgs, _function_3); - _and_2 = _exists; - } - if (_and_2) { + if ((usesMSC && IterableExtensions.<Message>exists(enumMsgs, new Function1<Message, Boolean>() { + @Override + public Boolean apply(final Message m) { + return Boolean.valueOf(Objects.equal(m, message)); + } + }))) { _builder.append("\t"); _builder.append("#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"); _builder.newLine(); @@ -1068,19 +1002,12 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { } } { - boolean _and_3 = false; - if (!usesMSC) { - _and_3 = false; - } else { - final Function1<Message, Boolean> _function_4 = new Function1<Message, Boolean>() { - public Boolean apply(final Message m) { - return Boolean.valueOf(Objects.equal(m, message)); - } - }; - boolean _exists_1 = IterableExtensions.<Message>exists(boolMsgs, _function_4); - _and_3 = _exists_1; - } - if (_and_3) { + if ((usesMSC && IterableExtensions.<Message>exists(boolMsgs, new Function1<Message, Boolean>() { + @Override + public Boolean apply(final Message m) { + return Boolean.valueOf(Objects.equal(m, message)); + } + }))) { _builder.append("\t"); _builder.append("#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"); _builder.newLine(); @@ -1187,16 +1114,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { String typeName = _xifexpression_2; _builder.newLineIfNotEmpty(); String _xifexpression_3 = null; - boolean _and = false; - if (!hasData) { - _and = false; - } else { - VarDecl _data_2 = message.getData(); - RefableType _refType_1 = _data_2.getRefType(); - boolean _isRef = _refType_1.isRef(); - _and = _isRef; - } - if (_and) { + if ((hasData && message.getData().getRefType().isRef())) { _xifexpression_3 = "*"; } else { _xifexpression_3 = ""; @@ -1204,27 +1122,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { String refp = _xifexpression_3; _builder.newLineIfNotEmpty(); String _xifexpression_4 = null; - boolean _and_1 = false; - if (!hasData) { - _and_1 = false; - } else { - boolean _or = false; - VarDecl _data_3 = message.getData(); - RefableType _refType_2 = _data_3.getRefType(); - DataType _type_1 = _refType_2.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - boolean _not = (!_isEnumerationOrPrimitive); - if (_not) { - _or = true; - } else { - VarDecl _data_4 = message.getData(); - RefableType _refType_3 = _data_4.getRefType(); - boolean _isRef_1 = _refType_3.isRef(); - _or = _isRef_1; - } - _and_1 = _or; - } - if (_and_1) { + if ((hasData && ((!this._typeHelpers.isEnumerationOrPrimitive(message.getData().getRefType().getType())) || message.getData().getRefType().isRef()))) { _xifexpression_4 = "*"; } else { _xifexpression_4 = ""; @@ -1232,28 +1130,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { String refpd = _xifexpression_4; _builder.newLineIfNotEmpty(); String _xifexpression_5 = null; - boolean _and_2 = false; - boolean _and_3 = false; - if (!hasData) { - _and_3 = false; - } else { - VarDecl _data_5 = message.getData(); - RefableType _refType_4 = _data_5.getRefType(); - DataType _type_2 = _refType_4.getType(); - boolean _isEnumerationOrPrimitive_1 = this._typeHelpers.isEnumerationOrPrimitive(_type_2); - boolean _not_1 = (!_isEnumerationOrPrimitive_1); - _and_3 = _not_1; - } - if (!_and_3) { - _and_2 = false; - } else { - VarDecl _data_6 = message.getData(); - RefableType _refType_5 = _data_6.getRefType(); - boolean _isRef_2 = _refType_5.isRef(); - boolean _not_2 = (!_isRef_2); - _and_2 = _not_2; - } - if (_and_2) { + if (((hasData && (!this._typeHelpers.isEnumerationOrPrimitive(message.getData().getRefType().getType()))) && (!message.getData().getRefType().isRef()))) { _xifexpression_5 = ""; } else { _xifexpression_5 = "&"; diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java index 4facd625d..4c11af223 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java @@ -117,6 +117,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { /** * @param generateImplementation NOT used */ + @Override public CharSequence genExtra(final ExpandedModelComponent xpmc, final boolean generateImplementation) { CharSequence _xblockexpression = null; { @@ -196,14 +197,17 @@ public class StateMachineGen extends GenericStateMachineGenerator { return _xblockexpression; } + @Override public String stateType() { return "etInt16"; } + @Override public String boolType() { return "etBool"; } + @Override public CharSequence markVariableUsed(final String varname) { StringConcatenation _builder = new StringConcatenation(); _builder.append("((void)trigger__et);\t/* avoids unused warning */"); @@ -211,6 +215,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { return _builder; } + @Override public String unreachableReturn() { return "/* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */"; } diff --git a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java index 4c69d5bed..2821f29ff 100644 --- a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java +++ b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java @@ -61,16 +61,19 @@ public class DataConfiguration implements IDataConfiguration { @Inject protected ImportUriResolver uriResolver; + @Override public void doSetup() { if ((!EMFPlugin.IS_ECLIPSE_RUNNING)) { ConfigStandaloneSetup.doSetup(); } } + @Override public boolean setResources(final ResourceSet resource, final ILogger logger) { return this._dataConfigurationHelper.setConfigModels(resource, logger); } + @Override public String getAttrClassConfigValue(final ActorClass actor, final List<Attribute> path) { AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); ConfigValueArray _value = null; @@ -84,6 +87,7 @@ public class DataConfiguration implements IDataConfiguration { return _stringExpr; } + @Override public String getAttrClassConfigMaxValue(final ActorClass actor, final List<Attribute> path) { AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); NumberLiteral _max = null; @@ -97,6 +101,7 @@ public class DataConfiguration implements IDataConfiguration { return _stringExpr; } + @Override public String getAttrClassConfigMinValue(final ActorClass actor, final List<Attribute> path) { AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); NumberLiteral _min = null; @@ -126,6 +131,7 @@ public class DataConfiguration implements IDataConfiguration { return _xblockexpression; } + @Override public String getAttrClassConfigValue(final ProtocolClass pc, final boolean regular, final List<Attribute> path) { String _xblockexpression = null; { @@ -176,6 +182,7 @@ public class DataConfiguration implements IDataConfiguration { return _builder.toString(); } + @Override public String getAttrInstanceConfigValue(final ActorInstance ai, final List<Attribute> path) { String _xblockexpression = null; { @@ -197,6 +204,7 @@ public class DataConfiguration implements IDataConfiguration { return _xblockexpression; } + @Override public String getAttrInstanceConfigValue(final InterfaceItemInstance item, final List<Attribute> path) { String _path = item.getPath(); String _plus = (_path + "/"); @@ -214,6 +222,7 @@ public class DataConfiguration implements IDataConfiguration { return _stringExpr; } + @Override public long getPollingTimerUser(final SubSystemInstance subsystem) { long _xblockexpression = (long) 0; { @@ -235,6 +244,7 @@ public class DataConfiguration implements IDataConfiguration { return _xblockexpression; } + @Override public String getUserCode1(final SubSystemInstance subsystem) { SubSystemConfig _config = this.getConfig(subsystem); DynamicConfig _dynConfig = null; @@ -260,6 +270,7 @@ public class DataConfiguration implements IDataConfiguration { return _xifexpression; } + @Override public String getUserCode2(final SubSystemInstance subsystem) { SubSystemConfig _config = this.getConfig(subsystem); DynamicConfig _dynConfig = null; @@ -290,12 +301,14 @@ public class DataConfiguration implements IDataConfiguration { return _xifexpression; } + @Override public List<Attribute> getDynConfigReadAttributes(final ActorInstance ai) { final ArrayList<Attribute> result = new ArrayList<Attribute>(); String _path = ai.getPath(); List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorInstanceAttrMap.get(_path); if (configs!=null) { final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() { + @Override public void apply(final AttrInstanceConfig c) { boolean _isReadOnly = c.isReadOnly(); if (_isReadOnly) { @@ -309,12 +322,14 @@ public class DataConfiguration implements IDataConfiguration { return result; } + @Override public List<Attribute> getDynConfigWriteAttributes(final ActorInstance ai) { final ArrayList<Attribute> result = new ArrayList<Attribute>(); String _path = ai.getPath(); List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorInstanceAttrMap.get(_path); if (configs!=null) { final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() { + @Override public void apply(final AttrInstanceConfig c) { boolean _isReadOnly = c.isReadOnly(); boolean _not = (!_isReadOnly); @@ -329,6 +344,7 @@ public class DataConfiguration implements IDataConfiguration { return result; } + @Override public boolean hasVariableService(final SubSystemInstance subsystem) { SubSystemConfig _config = this.getConfig(subsystem); DynamicConfig _dynConfig = null; @@ -359,12 +375,10 @@ public class DataConfiguration implements IDataConfiguration { private String toStringExpr(final ConfigValue configValue) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (configValue instanceof LiteralConfigValue) { - _matched=true; - Literal _value = ((LiteralConfigValue)configValue).getValue(); - _switchResult = this.toStringExpr(_value); - } + if (configValue instanceof LiteralConfigValue) { + _matched=true; + Literal _value = ((LiteralConfigValue)configValue).getValue(); + _switchResult = this.toStringExpr(_value); } if (!_matched) { if (configValue instanceof EnumConfigValue) { @@ -379,12 +393,10 @@ public class DataConfiguration implements IDataConfiguration { private String toStringExpr(final Literal literal) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (literal instanceof BooleanLiteral) { - _matched=true; - boolean _isIsTrue = ((BooleanLiteral)literal).isIsTrue(); - _switchResult = Boolean.valueOf(_isIsTrue).toString(); - } + if (literal instanceof BooleanLiteral) { + _matched=true; + boolean _isIsTrue = ((BooleanLiteral)literal).isIsTrue(); + _switchResult = Boolean.valueOf(_isIsTrue).toString(); } if (!_matched) { if (literal instanceof IntLiteral) { @@ -415,11 +427,13 @@ public class DataConfiguration implements IDataConfiguration { return this._dataConfigurationHelper.subSystemConfigMap.get(_path); } + @Override public List<Attribute> getDynConfigReadAttributes(final ActorClass actor) { final HashSet<Attribute> result = new HashSet<Attribute>(); final List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorClassAttrMap.get(actor); if (configs!=null) { final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() { + @Override public void apply(final AttrInstanceConfig c) { boolean _isReadOnly = c.isReadOnly(); if (_isReadOnly) { @@ -433,11 +447,13 @@ public class DataConfiguration implements IDataConfiguration { return IterableExtensions.<Attribute>toList(result); } + @Override public List<Attribute> getDynConfigWriteAttributes(final ActorClass actor) { final HashSet<Attribute> result = new HashSet<Attribute>(); final List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorClassAttrMap.get(actor); if (configs!=null) { final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() { + @Override public void apply(final AttrInstanceConfig c) { boolean _isReadOnly = c.isReadOnly(); boolean _not = (!_isReadOnly); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java index 42c4a099a..dc626700c 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java @@ -88,6 +88,7 @@ public class ActorClassGen extends GenericActorClassGenerator { EList<WiredStructureClass> _wiredInstances = root.getWiredInstances(); Iterable<WiredActorClass> _filter = Iterables.<WiredActorClass>filter(_wiredInstances, WiredActorClass.class); final Procedure1<WiredActorClass> _function = new Procedure1<WiredActorClass>() { + @Override public void apply(final WiredActorClass it) { ActorClass _actorClass = it.getActorClass(); ac2wired.put(_actorClass, it); @@ -96,6 +97,7 @@ public class ActorClassGen extends GenericActorClassGenerator { IterableExtensions.<WiredActorClass>forEach(_filter, _function); EList<ExpandedActorClass> _xpActorClasses = root.getXpActorClasses(); final Function1<ExpandedActorClass, Boolean> _function_1 = new Function1<ExpandedActorClass, Boolean>() { + @Override public Boolean apply(final ExpandedActorClass cl) { ActorClass _actorClass = cl.getActorClass(); return Boolean.valueOf(ActorClassGen.this._fileSystemHelpers.isValidGenerationLocation(_actorClass)); @@ -424,6 +426,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); List<Port> _endPorts_1 = this._roomHelpers.getEndPorts(ac); final Function1<Port, CharSequence> _function = new Function1<Port, CharSequence>() { + @Override public CharSequence apply(final Port it) { String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(it); String _plus = (_portClassName + "&"); @@ -439,6 +442,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); EList<SAP> _serviceAccessPoints_1 = ac.getServiceAccessPoints(); final Function1<SAP, CharSequence> _function_1 = new Function1<SAP, CharSequence>() { + @Override public CharSequence apply(final SAP it) { String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(it); String _plus = (_portClassName + "&"); @@ -454,6 +458,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); EList<ServiceImplementation> _serviceImplementations_1 = ac.getServiceImplementations(); final Function1<ServiceImplementation, CharSequence> _function_2 = new Function1<ServiceImplementation, CharSequence>() { + @Override public CharSequence apply(final ServiceImplementation it) { String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(it); String _plus = (_portClassName + "&"); @@ -496,17 +501,7 @@ public class ActorClassGen extends GenericActorClassGenerator { } } { - boolean _or = false; - ComponentCommunicationType _commType_1 = ac.getCommType(); - boolean _equals_2 = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_2) { - _or = true; - } else { - ComponentCommunicationType _commType_2 = ac.getCommType(); - boolean _equals_3 = Objects.equal(_commType_2, ComponentCommunicationType.DATA_DRIVEN); - _or = _equals_3; - } - if (_or) { + if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { _builder.append("\t\t"); _builder.append("virtual void receive(const etRuntime::Message* msg);"); _builder.newLine(); @@ -605,6 +600,7 @@ public class ActorClassGen extends GenericActorClassGenerator { initList.add(_builder.toString()); List<Port> _endPorts = this._roomHelpers.getEndPorts(ac); final Function1<Port, String> _function = new Function1<Port, String>() { + @Override public String apply(final Port it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); @@ -623,6 +619,7 @@ public class ActorClassGen extends GenericActorClassGenerator { Iterables.<CharSequence>addAll(initList, _map); EList<ActorRef> _actorRefs = ac.getActorRefs(); final Function1<ActorRef, String> _function_1 = new Function1<ActorRef, String>() { + @Override public String apply(final ActorRef it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); @@ -638,6 +635,7 @@ public class ActorClassGen extends GenericActorClassGenerator { Iterables.<CharSequence>addAll(initList, _map_1); EList<SAP> _serviceAccessPoints = ac.getServiceAccessPoints(); final Function1<SAP, String> _function_2 = new Function1<SAP, String>() { + @Override public String apply(final SAP it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); @@ -656,6 +654,7 @@ public class ActorClassGen extends GenericActorClassGenerator { Iterables.<CharSequence>addAll(initList, _map_2); EList<ServiceImplementation> _serviceImplementations = ac.getServiceImplementations(); final Function1<ServiceImplementation, String> _function_3 = new Function1<ServiceImplementation, String>() { + @Override public String apply(final ServiceImplementation it) { StringConcatenation _builder = new StringConcatenation(); SPP _spp = it.getSpp(); @@ -677,6 +676,7 @@ public class ActorClassGen extends GenericActorClassGenerator { Iterables.<CharSequence>addAll(initList, _map_3); EList<Attribute> _attributes = ac.getAttributes(); final Function1<Attribute, String> _function_4 = new Function1<Attribute, String>() { + @Override public String apply(final Attribute it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); @@ -937,17 +937,7 @@ public class ActorClassGen extends GenericActorClassGenerator { } _builder.newLine(); { - boolean _or = false; - ComponentCommunicationType _commType = ac.getCommType(); - boolean _equals = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals) { - _or = true; - } else { - ComponentCommunicationType _commType_1 = ac.getCommType(); - boolean _equals_1 = Objects.equal(_commType_1, ComponentCommunicationType.DATA_DRIVEN); - _or = _equals_1; - } - if (_or) { + if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { _builder.append("\t"); _builder.append("// activate polling for data-driven communication"); _builder.newLine(); @@ -1095,17 +1085,7 @@ public class ActorClassGen extends GenericActorClassGenerator { } } { - boolean _or_1 = false; - ComponentCommunicationType _commType_2 = ac.getCommType(); - boolean _equals_2 = Objects.equal(_commType_2, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_2) { - _or_1 = true; - } else { - ComponentCommunicationType _commType_3 = ac.getCommType(); - boolean _equals_3 = Objects.equal(_commType_3, ComponentCommunicationType.DATA_DRIVEN); - _or_1 = _equals_3; - } - if (_or_1) { + if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { _builder.append("\t"); _builder.append("RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(getThread())->removePollingMessageReceiver(*this);"); _builder.newLine(); @@ -1131,9 +1111,9 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append(_genStateMachineMethods, ""); _builder.newLineIfNotEmpty(); { - ComponentCommunicationType _commType_4 = ac.getCommType(); - boolean _equals_4 = Objects.equal(_commType_4, ComponentCommunicationType.DATA_DRIVEN); - if (_equals_4) { + ComponentCommunicationType _commType = ac.getCommType(); + boolean _equals = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); + if (_equals) { _builder.append("void "); String _name_19 = ac.getName(); _builder.append(_name_19, ""); @@ -1147,26 +1127,16 @@ public class ActorClassGen extends GenericActorClassGenerator { } } { - boolean _or_2 = false; - ComponentCommunicationType _commType_5 = ac.getCommType(); - boolean _equals_5 = Objects.equal(_commType_5, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_5) { - _or_2 = true; - } else { - ComponentCommunicationType _commType_6 = ac.getCommType(); - boolean _equals_6 = Objects.equal(_commType_6, ComponentCommunicationType.DATA_DRIVEN); - _or_2 = _equals_6; - } - if (_or_2) { + if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { _builder.append("void "); String _name_20 = ac.getName(); _builder.append(_name_20, ""); _builder.append("::receive(const Message* msg) {"); _builder.newLineIfNotEmpty(); { - ComponentCommunicationType _commType_7 = ac.getCommType(); - boolean _equals_7 = Objects.equal(_commType_7, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_7) { + ComponentCommunicationType _commType_1 = ac.getCommType(); + boolean _equals_1 = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); + if (_equals_1) { _builder.append("\t"); _builder.append("receiveEvent(0, -1, 0);"); _builder.newLine(); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.java index dce7f3793..55cd24062 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.java @@ -131,16 +131,7 @@ public class ConfigGenAddon { _xifexpression_1 = _builder.toString(); } else { String _xifexpression_2 = null; - boolean _or = false; - int _size = a.getSize(); - boolean _equals_1 = (_size == 0); - if (_equals_1) { - _or = true; - } else { - boolean _isCharacterType = this.typeHelpers.isCharacterType(aType); - _or = _isCharacterType; - } - if (_or) { + if (((a.getSize() == 0) || this.typeHelpers.isCharacterType(aType))) { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(invokes, ""); _builder_1.append("."); @@ -152,11 +143,11 @@ public class ConfigGenAddon { _xifexpression_2 = _builder_1.toString(); } else { String _xifexpression_3 = null; - int _size_1 = a.getSize(); + int _size = a.getSize(); String[] _split = value.split(","); - int _size_2 = ((List<String>)Conversions.doWrapArray(_split)).size(); - boolean _equals_2 = (_size_1 == _size_2); - if (_equals_2) { + int _size_1 = ((List<String>)Conversions.doWrapArray(_split)).size(); + boolean _equals_1 = (_size == _size_1); + if (_equals_1) { String _xblockexpression_2 = null; { StringConcatenation _builder_2 = new StringConcatenation(); @@ -211,8 +202,8 @@ public class ConfigGenAddon { _builder_2.newLineIfNotEmpty(); _builder_2.append("\t"); _builder_2.append("for (int i=0;i<"); - int _size_3 = a.getSize(); - _builder_2.append(_size_3, "\t"); + int _size_2 = a.getSize(); + _builder_2.append(_size_2, "\t"); _builder_2.append(";i++){"); _builder_2.newLineIfNotEmpty(); _builder_2.append("\t\t"); @@ -511,7 +502,9 @@ public class ConfigGenAddon { PrimitiveType aType = ((PrimitiveType) _type_9); StringConcatenation _builder_1 = new StringConcatenation(); { - boolean _notEquals = (!Objects.equal((temp = this.dataConfigExt.getAttrClassConfigMinValue(ac, path)), null)); + String _attrClassConfigMinValue = this.dataConfigExt.getAttrClassConfigMinValue(ac, path); + String _temp = (temp = _attrClassConfigMinValue); + boolean _notEquals = (!Objects.equal(_temp, null)); if (_notEquals) { _builder_1.append("public static "); String _minMaxType = this.getMinMaxType(aType); @@ -526,7 +519,9 @@ public class ConfigGenAddon { } } { - boolean _notEquals_1 = (!Objects.equal((temp = this.dataConfigExt.getAttrClassConfigMaxValue(ac, path)), null)); + String _attrClassConfigMaxValue = this.dataConfigExt.getAttrClassConfigMaxValue(ac, path); + String _temp_1 = (temp = _attrClassConfigMaxValue); + boolean _notEquals_1 = (!Objects.equal(_temp_1, null)); if (_notEquals_1) { _builder_1.append("public static "); String _minMaxType_1 = this.getMinMaxType(aType); @@ -557,11 +552,9 @@ public class ConfigGenAddon { String _switchResult = null; String _typeName = this.typeHelpers.typeName(type); boolean _matched = false; - if (!_matched) { - if (Objects.equal(_typeName, "byte")) { - _matched=true; - _switchResult = "int"; - } + if (Objects.equal(_typeName, "byte")) { + _matched=true; + _switchResult = "int"; } if (!_matched) { if (Objects.equal(_typeName, "short")) { diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java index cb62b9fda..d884e0753 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java @@ -65,6 +65,7 @@ public class CppExtensions implements ILanguageExtension { @Extension private RoomExtensions _roomExtensions; + @Override public String getTypedDataDefinition(final EObject msg) { VarDecl _data = ((Message) msg).getData(); String[] _generateArglistAndTypedData = this.generateArglistAndTypedData(_data); @@ -99,34 +100,42 @@ public class CppExtensions implements ILanguageExtension { return (_cppClassName + ".cpp"); } + @Override public String accessLevelPrivate() { return ""; } + @Override public String accessLevelProtected() { return ""; } + @Override public String accessLevelPublic() { return ""; } + @Override public String memberAccess() { return "this->"; } + @Override public String selfPointer(final String classname, final boolean hasArgs) { return ""; } + @Override public String selfPointer(final boolean hasArgs) { return ""; } + @Override public String scopeSeparator() { return "::"; } + @Override public String operationScope(final String classname, final boolean isDeclaration) { String _xifexpression = null; if (isDeclaration) { @@ -137,22 +146,27 @@ public class CppExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String memberInDeclaration(final String namespace, final String member) { return member; } + @Override public String memberInUse(final String namespace, final String member) { return ((namespace + ".") + member); } + @Override public boolean usesInheritance() { return true; } + @Override public boolean usesPointers() { return true; } + @Override public String genEnumeration(final String name, final List<Pair<String, String>> entries) { String _xblockexpression = null; { @@ -189,22 +203,27 @@ public class CppExtensions implements ILanguageExtension { return _xblockexpression; } + @Override public String booleanConstant(final boolean b) { return Boolean.valueOf(b).toString(); } + @Override public String pointerLiteral() { return "*"; } + @Override public String nullPointer() { return "0"; } + @Override public String voidPointer() { return "void*"; } + @Override public String arrayType(final String type, final int size, final boolean isRef) { StringConcatenation _builder = new StringConcatenation(); _builder.append("StaticArray<"); @@ -220,6 +239,7 @@ public class CppExtensions implements ILanguageExtension { return _builder.toString(); } + @Override public String arrayDeclaration(final String type, final int size, final boolean isRef, final String name) { String _arrayType = this.arrayType(type, size, isRef); String _plus = (_arrayType + " "); @@ -234,6 +254,7 @@ public class CppExtensions implements ILanguageExtension { String[] _split_1 = appendSegments.split("\\."); Iterable<String> _plus_1 = Iterables.<String>concat(_plus, ((Iterable<? extends String>)Conversions.doWrapArray(_split_1))); final Function1<String, Boolean> _function = new Function1<String, Boolean>() { + @Override public Boolean apply(final String it) { boolean _isEmpty = it.isEmpty(); return Boolean.valueOf((!_isEmpty)); @@ -276,27 +297,29 @@ public class CppExtensions implements ILanguageExtension { return ""; } + @Override public String superCall(final String baseClassName, final String method, final String arguments) { return (((((baseClassName + "::") + method) + "(") + arguments) + ");"); } + @Override public String toValueLiteral(final PrimitiveType type, final String value) { throw new UnsupportedOperationException("TODO Config for Cpp"); } + @Override public String toEnumLiteral(final EnumerationType type, final String value) { throw new UnsupportedOperationException("TODO Config for Cpp"); } + @Override public String defaultValue(final DataType dt) { String _switchResult = null; final DataType it = dt; boolean _matched = false; - if (!_matched) { - if (it instanceof PrimitiveType) { - _matched=true; - _switchResult = ((PrimitiveType)it).getDefaultValueLiteral(); - } + if (it instanceof PrimitiveType) { + _matched=true; + _switchResult = ((PrimitiveType)it).getDefaultValueLiteral(); } if (!_matched) { if (it instanceof EnumerationType) { @@ -332,6 +355,7 @@ public class CppExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String initializationWithDefaultValues(final DataType dt, final int size) { String _xblockexpression = null; { @@ -362,15 +386,9 @@ public class CppExtensions implements ILanguageExtension { return _xblockexpression; } + @Override public String[] generateArglistAndTypedData(final EObject d) { - boolean _or = false; - boolean _equals = Objects.equal(d, null); - if (_equals) { - _or = true; - } else { - _or = (!(d instanceof VarDecl)); - } - if (_or) { + if ((Objects.equal(d, null) || (!(d instanceof VarDecl)))) { return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList("", "", ""), String.class)); } final VarDecl data = ((VarDecl) d); @@ -379,15 +397,13 @@ public class CppExtensions implements ILanguageExtension { DataType _type = _refType.getType(); final DataType it = _type; boolean _matched = false; - if (!_matched) { - if (it instanceof PrimitiveType) { - String _castName = ((PrimitiveType)it).getCastName(); - boolean _isEmpty = Strings.isEmpty(_castName); - boolean _not = (!_isEmpty); - if (_not) { - _matched=true; - _switchResult = ((PrimitiveType)it).getCastName(); - } + if (it instanceof PrimitiveType) { + String _castName = ((PrimitiveType)it).getCastName(); + boolean _isEmpty = Strings.isEmpty(_castName); + boolean _not = (!_isEmpty); + if (_not) { + _matched=true; + _switchResult = ((PrimitiveType)it).getCastName(); } } if (!_matched) { @@ -407,12 +423,10 @@ public class CppExtensions implements ILanguageExtension { RefableType _refType_2 = data.getRefType(); final RefableType it_1 = _refType_2; boolean _matched_1 = false; - if (!_matched_1) { - boolean _isRef = it_1.isRef(); - if (_isRef) { - _matched_1=true; - _switchResult_1 = "*"; - } + boolean _isRef = it_1.isRef(); + if (_isRef) { + _matched_1=true; + _switchResult_1 = "*"; } if (!_matched_1) { DataType _type_2 = it_1.getType(); @@ -462,6 +476,7 @@ public class CppExtensions implements ILanguageExtension { return new String[] { dataArg, typedData, typedArgList }; } + @Override public String getTargetType(final EnumerationType type) { String _xifexpression = null; PrimitiveType _primitiveType = type.getPrimitiveType(); @@ -475,6 +490,7 @@ public class CppExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String getCastedValue(final EnumLiteral literal) { String _xblockexpression = null; { @@ -498,6 +514,7 @@ public class CppExtensions implements ILanguageExtension { return _xblockexpression; } + @Override public String getCastType(final EnumerationType type) { String _xifexpression = null; PrimitiveType _primitiveType = type.getPrimitiveType(); @@ -511,6 +528,7 @@ public class CppExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String makeOverridable() { return "virtual "; } @@ -528,6 +546,7 @@ public class CppExtensions implements ILanguageExtension { _xifexpression = ac.getName(); } else { final Function1<KeyValue, Boolean> _function = new Function1<KeyValue, Boolean>() { + @Override public Boolean apply(final KeyValue it) { String _key = it.getKey(); return Boolean.valueOf(Objects.equal(_key, "fqnClassName")); @@ -563,6 +582,7 @@ public class CppExtensions implements ILanguageExtension { String _xblockexpression_1 = null; { final Function1<KeyValue, Boolean> _function = new Function1<KeyValue, Boolean>() { + @Override public Boolean apply(final KeyValue it) { String _key = it.getKey(); return Boolean.valueOf(Objects.equal(_key, "includePath")); @@ -575,6 +595,7 @@ public class CppExtensions implements ILanguageExtension { String _xblockexpression_2 = null; { final Function1<KeyValue, Boolean> _function_1 = new Function1<KeyValue, Boolean>() { + @Override public Boolean apply(final KeyValue it) { String _key = it.getKey(); return Boolean.valueOf(Objects.equal(_key, "fqnClassName")); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppProcedureHelpers.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppProcedureHelpers.java index e5e137273..9bcf8ee17 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppProcedureHelpers.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppProcedureHelpers.java @@ -2,7 +2,6 @@ package org.eclipse.etrice.generator.cpp.gen; import com.google.common.base.Objects; import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataType; import org.eclipse.etrice.core.room.RefableType; import org.eclipse.etrice.generator.generic.ProcedureHelpers; import org.eclipse.xtext.xbase.lib.Functions.Function1; @@ -10,30 +9,12 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions; @SuppressWarnings("all") public class CppProcedureHelpers extends ProcedureHelpers { + @Override protected CharSequence getterHeader(final Attribute attribute, final String classname) { String _xblockexpression = null; { String _xifexpression = null; - boolean _and = false; - int _size = attribute.getSize(); - boolean _equals = (_size == 0); - if (!_equals) { - _and = false; - } else { - boolean _or = false; - RefableType _type = attribute.getType(); - DataType _type_1 = _type.getType(); - boolean _isPrimitive = this._typeHelpers.isPrimitive(_type_1); - if (_isPrimitive) { - _or = true; - } else { - RefableType _type_2 = attribute.getType(); - boolean _isRef = _type_2.isRef(); - _or = _isRef; - } - _and = _or; - } - if (_and) { + if (((attribute.getSize() == 0) && (this._typeHelpers.isPrimitive(attribute.getType().getType()) || attribute.getType().isRef()))) { _xifexpression = " const"; } else { _xifexpression = ""; @@ -45,17 +26,16 @@ public class CppProcedureHelpers extends ProcedureHelpers { return _xblockexpression; } + @Override public String declarationString(final Attribute attribute) { String _switchResult = null; final Attribute it = attribute; boolean _matched = false; - if (!_matched) { - int _size = it.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _matched=true; - _switchResult = super.declarationString(it); - } + int _size = it.getSize(); + boolean _greaterThan = (_size > 0); + if (_greaterThan) { + _matched=true; + _switchResult = super.declarationString(it); } if (!_matched) { RefableType _type = it.getType(); @@ -67,27 +47,17 @@ public class CppProcedureHelpers extends ProcedureHelpers { return _switchResult; } + @Override public String signatureString(final RefableType type) { String _switchResult = null; final RefableType it = type; boolean _matched = false; - if (!_matched) { - if (Objects.equal(it, null)) { - _matched=true; - _switchResult = "void"; - } + if (Objects.equal(it, null)) { + _matched=true; + _switchResult = "void"; } if (!_matched) { - boolean _or = false; - boolean _isRef = it.isRef(); - if (_isRef) { - _or = true; - } else { - DataType _type = type.getType(); - boolean _isPrimitive = this._typeHelpers.isPrimitive(_type); - _or = _isPrimitive; - } - boolean _not = (!_or); + boolean _not = (!(it.isRef() || this._typeHelpers.isPrimitive(type.getType()))); if (_not) { _matched=true; String _signatureString = super.signatureString(type); @@ -100,18 +70,17 @@ public class CppProcedureHelpers extends ProcedureHelpers { return _switchResult; } + @Override public String signatureString(final Attribute attribute) { String _switchResult = null; final Attribute it = attribute; boolean _matched = false; - if (!_matched) { - int _size = it.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _matched=true; - String _signatureString = super.signatureString(attribute); - _switchResult = (_signatureString + "&"); - } + int _size = it.getSize(); + boolean _greaterThan = (_size > 0); + if (_greaterThan) { + _matched=true; + String _signatureString = super.signatureString(attribute); + _switchResult = (_signatureString + "&"); } if (!_matched) { RefableType _type = it.getType(); @@ -126,6 +95,7 @@ public class CppProcedureHelpers extends ProcedureHelpers { */ public String constArgList(final Iterable<Attribute> attributes) { final Function1<Attribute, String> _function = new Function1<Attribute, String>() { + @Override public String apply(final Attribute it) { String _xifexpression = null; RefableType _type = it.getType(); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java index 40f209678..08eda1542 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java @@ -463,6 +463,7 @@ public class DataClassGen { } EList<Attribute> _attributes = dataClass.getAttributes(); final Function1<Attribute, String> _function = new Function1<Attribute, String>() { + @Override public String apply(final Attribute it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); @@ -497,6 +498,7 @@ public class DataClassGen { } EList<Attribute> _attributes = dataClass.getAttributes(); final Function1<Attribute, String> _function = new Function1<Attribute, String>() { + @Override public String apply(final Attribute it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); @@ -532,6 +534,7 @@ public class DataClassGen { DataClass _base_2 = dataClass.getBase(); List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(_base_2); final Function1<Attribute, String> _function = new Function1<Attribute, String>() { + @Override public String apply(final Attribute it) { return it.getName(); } @@ -544,6 +547,7 @@ public class DataClassGen { } EList<Attribute> _attributes = dataClass.getAttributes(); final Function1<Attribute, String> _function_1 = new Function1<Attribute, String>() { + @Override public String apply(final Attribute it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/Initialization.java index 3d62928ff..610e28d18 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/Initialization.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/Initialization.java @@ -64,26 +64,9 @@ public class Initialization { CharSequence _xblockexpression = null; { final Function1<Attribute, Boolean> _function = new Function1<Attribute, Boolean>() { + @Override public Boolean apply(final Attribute it) { - boolean _and = false; - boolean _and_1 = false; - String _initializerListValue = Initialization.this.getInitializerListValue(it); - boolean _equals = Objects.equal(_initializerListValue, null); - if (!_equals) { - _and_1 = false; - } else { - String _initValue = Initialization.this.getInitValue(it); - boolean _notEquals = (!Objects.equal(_initValue, null)); - _and_1 = _notEquals; - } - if (!_and_1) { - _and = false; - } else { - String _initValue_1 = Initialization.this.getInitValue(it); - boolean _startsWith = _initValue_1.startsWith("{"); - _and = _startsWith; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((Objects.equal(Initialization.this.getInitializerListValue(it), null) && (!Objects.equal(Initialization.this.getInitValue(it), null))) && Initialization.this.getInitValue(it).startsWith("{"))); } }; final Iterable<Attribute> extraInitAttrs = IterableExtensions.<Attribute>filter(attributes, _function); @@ -96,6 +79,7 @@ public class Initialization { _builder.newLine(); { final Function1<Attribute, Boolean> _function_1 = new Function1<Attribute, Boolean>() { + @Override public Boolean apply(final Attribute it) { int _size = it.getSize(); return Boolean.valueOf((_size > 0)); @@ -127,6 +111,7 @@ public class Initialization { } { final Function1<Attribute, Boolean> _function_2 = new Function1<Attribute, Boolean>() { + @Override public Boolean apply(final Attribute it) { int _size = it.getSize(); return Boolean.valueOf((_size == 0)); @@ -161,15 +146,7 @@ public class Initialization { public String getInitializerListValue(final Attribute attribute) { final String initValue = this.getInitValue(attribute); String _xifexpression = null; - boolean _and = false; - boolean _notEquals = (!Objects.equal(initValue, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _startsWith = initValue.startsWith("{"); - _and = _startsWith; - } - if (_and) { + if (((!Objects.equal(initValue, null)) && initValue.startsWith("{"))) { _xifexpression = null; } else { _xifexpression = initValue; @@ -181,13 +158,11 @@ public class Initialization { String _switchResult = null; final Attribute it = attribute; boolean _matched = false; - if (!_matched) { - String _defaultValueLiteral = it.getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - _matched=true; - _switchResult = it.getDefaultValueLiteral(); - } + String _defaultValueLiteral = it.getDefaultValueLiteral(); + boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); + if (_notEquals) { + _matched=true; + _switchResult = it.getDefaultValueLiteral(); } if (!_matched) { RefableType _type = it.getType(); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java index dcf3e7180..ca29407dd 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java @@ -85,6 +85,7 @@ public class NodeGen { EList<WiredStructureClass> _wiredInstances = root.getWiredInstances(); Iterable<WiredSubSystemClass> _filter = Iterables.<WiredSubSystemClass>filter(_wiredInstances, WiredSubSystemClass.class); final Procedure1<WiredSubSystemClass> _function = new Procedure1<WiredSubSystemClass>() { + @Override public void apply(final WiredSubSystemClass it) { SubSystemClass _subSystemClass = it.getSubSystemClass(); sscc2wired.put(_subSystemClass, it); @@ -98,27 +99,18 @@ public class NodeGen { { StructureInstance _instance = root.getInstance(instpath); final SubSystemInstance ssi = ((SubSystemInstance) _instance); - boolean _and = false; - boolean _notEquals = (!Objects.equal(ssi, null)); - if (!_notEquals) { - _and = false; - } else { + if (((!Objects.equal(ssi, null)) && this._fileSystemHelpers.isValidGenerationLocation(ssi.getSubSystemClass()))) { SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - boolean _isValidGenerationLocation = this._fileSystemHelpers.isValidGenerationLocation(_subSystemClass); - _and = _isValidGenerationLocation; - } - if (_and) { + final WiredSubSystemClass wired = sscc2wired.get(_subSystemClass); SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - final WiredSubSystemClass wired = sscc2wired.get(_subSystemClass_1); + String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass_1); SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass_2); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _path = this._roomExtensions.getPath(_subSystemClass_3); + String _path = this._roomExtensions.getPath(_subSystemClass_2); final String path = (_generationTargetPath + _path); + SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); + String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_subSystemClass_3); SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_subSystemClass_4); - SubSystemClass _subSystemClass_5 = ssi.getSubSystemClass(); - String _path_1 = this._roomExtensions.getPath(_subSystemClass_5); + String _path_1 = this._roomExtensions.getPath(_subSystemClass_4); final String infopath = (_generationInfoPath + _path_1); final Set<PhysicalThread> usedThreads = ETMapUtil.getUsedThreads(nr, ssi); String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(nr, ssi); @@ -143,6 +135,7 @@ public class NodeGen { NodeClass _type = nr.getType(); EList<PhysicalThread> _threads = _type.getThreads(); final Function1<PhysicalThread, Boolean> _function = new Function1<PhysicalThread, Boolean>() { + @Override public Boolean apply(final PhysicalThread t) { return Boolean.valueOf(usedThreads.contains(t)); } @@ -359,6 +352,7 @@ public class NodeGen { initList.add(_builder.toString()); EList<ActorRef> _actorRefs = cc.getActorRefs(); final Function1<ActorRef, String> _function = new Function1<ActorRef, String>() { + @Override public String apply(final ActorRef it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); @@ -387,6 +381,7 @@ public class NodeGen { NodeClass _type = nr.getType(); EList<PhysicalThread> _threads = _type.getThreads(); final Function1<PhysicalThread, Boolean> _function = new Function1<PhysicalThread, Boolean>() { + @Override public Boolean apply(final PhysicalThread t) { return Boolean.valueOf(usedThreads.contains(t)); } @@ -547,17 +542,7 @@ public class NodeGen { _builder.append("{"); _builder.newLine(); { - boolean _or = false; - ExecMode _execmode = thread_1.getExecmode(); - boolean _equals = Objects.equal(_execmode, ExecMode.POLLED); - if (_equals) { - _or = true; - } else { - ExecMode _execmode_1 = thread_1.getExecmode(); - boolean _equals_1 = Objects.equal(_execmode_1, ExecMode.MIXED); - _or = _equals_1; - } - if (_or) { + if ((Objects.equal(thread_1.getExecmode(), ExecMode.POLLED) || Objects.equal(thread_1.getExecmode(), ExecMode.MIXED))) { _builder.append("\t"); _builder.append("\t"); _builder.append("etTime interval;"); @@ -582,8 +567,8 @@ public class NodeGen { _builder.append("\t"); _builder.append("\t"); _builder.append("msgService = new MessageService(this, IMessageService::"); - ExecMode _execmode_2 = thread_1.getExecmode(); - String _name_1 = _execmode_2.getName(); + ExecMode _execmode = thread_1.getExecmode(); + String _name_1 = _execmode.getName(); _builder.append(_name_1, "\t\t"); _builder.append(", interval, 0, "); String _threadId_1 = this.getThreadId(thread_1); @@ -600,8 +585,8 @@ public class NodeGen { _builder.append("\t"); _builder.append("\t"); _builder.append("msgService = new MessageService(this, IMessageService::"); - ExecMode _execmode_3 = thread_1.getExecmode(); - String _name_3 = _execmode_3.getName(); + ExecMode _execmode_1 = thread_1.getExecmode(); + String _name_3 = _execmode_1.getName(); _builder.append(_name_3, "\t\t"); _builder.append(", 0, "); String _threadId_2 = this.getThreadId(thread_1); @@ -642,15 +627,7 @@ public class NodeGen { final ETMapUtil.MappedThread mapped = ETMapUtil.getMappedThread(ai); _builder.newLineIfNotEmpty(); { - boolean _or_1 = false; - boolean _isImplicit = mapped.isImplicit(); - if (_isImplicit) { - _or_1 = true; - } else { - boolean _isAsParent = mapped.isAsParent(); - _or_1 = _isAsParent; - } - boolean _not = (!_or_1); + boolean _not = (!(mapped.isImplicit() || mapped.isAsParent())); if (_not) { _builder.append("\t"); _builder.append("addPathToThread(\""); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java index 088bad9a0..8a3c52ab3 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java @@ -58,25 +58,16 @@ public class NodeRunnerGen { { StructureInstance _instance = root.getInstance(instpath); final SubSystemInstance ssi = ((SubSystemInstance) _instance); - boolean _and = false; - boolean _notEquals = (!Objects.equal(ssi, null)); - if (!_notEquals) { - _and = false; - } else { + if (((!Objects.equal(ssi, null)) && this._fileSystemHelpers.isValidGenerationLocation(ssi.getSubSystemClass()))) { SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - boolean _isValidGenerationLocation = this._fileSystemHelpers.isValidGenerationLocation(_subSystemClass); - _and = _isValidGenerationLocation; - } - if (_and) { + String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass); SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass_1); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _path = this.roomExt.getPath(_subSystemClass_2); + String _path = this.roomExt.getPath(_subSystemClass_1); final String filepath = (_generationTargetPath + _path); + SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); + String _generationInfoPath = this.roomExt.getGenerationInfoPath(_subSystemClass_2); SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _generationInfoPath = this.roomExt.getGenerationInfoPath(_subSystemClass_3); - SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); - String _path_1 = this.roomExt.getPath(_subSystemClass_4); + String _path_1 = this.roomExt.getPath(_subSystemClass_3); final String infopath = (_generationInfoPath + _path_1); String _cppClassName = this._cppExtensions.getCppClassName(nr, ssi); String _plus = (_cppClassName + "Runner.h"); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java index 66fc7250f..d50c52d1f 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java @@ -88,6 +88,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { public void doGenerate(final Root root) { EList<ProtocolClass> _usedProtocolClasses = root.getUsedProtocolClasses(); final Function1<ProtocolClass, Boolean> _function = new Function1<ProtocolClass, Boolean>() { + @Override public Boolean apply(final ProtocolClass cl) { return Boolean.valueOf(ProtocolClassGen.this._fileSystemHelpers.isValidGenerationLocation(cl)); } @@ -925,6 +926,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { if (_notEquals) { EList<Attribute> _attributes = pc.getAttributes(); final Function1<Attribute, String> _function = new Function1<Attribute, String>() { + @Override public String apply(final Attribute it) { StringConcatenation _builder = new StringConcatenation(); String _name = it.getName(); @@ -1146,6 +1148,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { { List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); return Boolean.valueOf((!Objects.equal(_data, null))); @@ -1381,6 +1384,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { { List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); return Boolean.valueOf((!Objects.equal(_data, null))); @@ -1545,6 +1549,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return _xblockexpression; } + @Override public String getMessageID(final Message msg, final InterfaceItem item) { if ((item instanceof Port)) { Port p = ((Port) item); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java index a8db021f9..589160981 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java @@ -34,6 +34,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { @Extension private RoomExtensions _roomExtensions; + @Override public CharSequence genExtra(final ExpandedModelComponent xpac, final boolean generateImplementation) { CharSequence _xblockexpression = null; { @@ -54,17 +55,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { if (generateImplementation) { StringConcatenation _builder = new StringConcatenation(); { - boolean _or = false; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _or = true; - } else { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateWithVerboseOutput = _settings_1.isGenerateWithVerboseOutput(); - _or = _isGenerateWithVerboseOutput; - } - if (_or) { + if ((Main.getSettings().isGenerateMSCInstrumentation() || Main.getSettings().isGenerateWithVerboseOutput())) { _builder.append("// state names"); _builder.newLine(); _builder.append("const std::string "); @@ -111,18 +102,18 @@ public class StateMachineGen extends GenericStateMachineGenerator { _builder.append("::setState(int new_state) {"); _builder.newLineIfNotEmpty(); { - GlobalGeneratorSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { _builder.append("\t"); _builder.append("DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state]);"); _builder.newLine(); } } { - GlobalGeneratorSettings _settings_3 = Main.getSettings(); - boolean _isGenerateWithVerboseOutput_1 = _settings_3.isGenerateWithVerboseOutput(); - if (_isGenerateWithVerboseOutput_1) { + GlobalGeneratorSettings _settings_1 = Main.getSettings(); + boolean _isGenerateWithVerboseOutput = _settings_1.isGenerateWithVerboseOutput(); + if (_isGenerateWithVerboseOutput) { _builder.append("\t"); _builder.append("if (s_stateStrings[new_state] != \"Idle\") {"); _builder.newLine(); @@ -144,17 +135,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { } else { StringConcatenation _builder_1 = new StringConcatenation(); { - boolean _or_1 = false; - GlobalGeneratorSettings _settings_4 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_4.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { - _or_1 = true; - } else { - GlobalGeneratorSettings _settings_5 = Main.getSettings(); - boolean _isGenerateWithVerboseOutput_2 = _settings_5.isGenerateWithVerboseOutput(); - _or_1 = _isGenerateWithVerboseOutput_2; - } - if (_or_1) { + if ((Main.getSettings().isGenerateMSCInstrumentation() || Main.getSettings().isGenerateWithVerboseOutput())) { _builder_1.append("static const std::string s_stateStrings[];"); _builder_1.newLine(); } @@ -178,10 +159,12 @@ public class StateMachineGen extends GenericStateMachineGenerator { return _xblockexpression; } + @Override public String stateType() { return "etInt16"; } + @Override public String boolType() { return "etBool"; } diff --git a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java b/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java index 2537e3190..925d0c37a 100644 --- a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java +++ b/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java @@ -26,7 +26,6 @@ import org.eclipse.etrice.core.fsm.fSM.StateGraph; import org.eclipse.etrice.core.genmodel.etricegen.Root; import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; import org.eclipse.etrice.core.room.Attribute; import org.eclipse.etrice.core.room.CompoundProtocolClass; import org.eclipse.etrice.core.room.DataClass; @@ -34,7 +33,6 @@ import org.eclipse.etrice.core.room.DataType; import org.eclipse.etrice.core.room.EnumLiteral; import org.eclipse.etrice.core.room.EnumerationType; import org.eclipse.etrice.core.room.GeneralProtocolClass; -import org.eclipse.etrice.core.room.InterfaceItem; import org.eclipse.etrice.core.room.LogicalSystem; import org.eclipse.etrice.core.room.Message; import org.eclipse.etrice.core.room.Port; @@ -110,6 +108,7 @@ public class DocGen { this.fileAccess.setOutputPath(_plus); EList<LogicalSystem> _systems = model.getSystems(); final Procedure1<LogicalSystem> _function = new Procedure1<LogicalSystem>() { + @Override public void apply(final LogicalSystem it) { CharSequence _generateDoc = DocGen.this.generateDoc(it, ctx); String _docFragmentName = DocGen.this.docFragmentName(it); @@ -119,6 +118,7 @@ public class DocGen { IterableExtensions.<LogicalSystem>forEach(_systems, _function); EList<LogicalSystem> _systems_1 = model.getSystems(); final Procedure1<LogicalSystem> _function_1 = new Procedure1<LogicalSystem>() { + @Override public void apply(final LogicalSystem it) { EList<RoomModel> _referencedModels = root.getReferencedModels(it); referencedModels.addAll(_referencedModels); @@ -127,6 +127,7 @@ public class DocGen { IterableExtensions.<LogicalSystem>forEach(_systems_1, _function_1); EList<SubSystemClass> _subSystemClasses = model.getSubSystemClasses(); final Procedure1<SubSystemClass> _function_2 = new Procedure1<SubSystemClass>() { + @Override public void apply(final SubSystemClass it) { CharSequence _generateDoc = DocGen.this.generateDoc(it, ctx); String _docFragmentName = DocGen.this.docFragmentName(it); @@ -136,6 +137,7 @@ public class DocGen { IterableExtensions.<SubSystemClass>forEach(_subSystemClasses, _function_2); EList<SubSystemClass> _subSystemClasses_1 = model.getSubSystemClasses(); final Procedure1<SubSystemClass> _function_3 = new Procedure1<SubSystemClass>() { + @Override public void apply(final SubSystemClass it) { EList<RoomModel> _referencedModels = root.getReferencedModels(it); referencedModels.addAll(_referencedModels); @@ -144,6 +146,7 @@ public class DocGen { IterableExtensions.<SubSystemClass>forEach(_subSystemClasses_1, _function_3); EList<GeneralProtocolClass> _protocolClasses = model.getProtocolClasses(); final Procedure1<GeneralProtocolClass> _function_4 = new Procedure1<GeneralProtocolClass>() { + @Override public void apply(final GeneralProtocolClass it) { CharSequence _generateDoc = DocGen.this.generateDoc(it, ctx); String _docFragmentName = DocGen.this.docFragmentName(it); @@ -153,6 +156,7 @@ public class DocGen { IterableExtensions.<GeneralProtocolClass>forEach(_protocolClasses, _function_4); EList<GeneralProtocolClass> _protocolClasses_1 = model.getProtocolClasses(); final Procedure1<GeneralProtocolClass> _function_5 = new Procedure1<GeneralProtocolClass>() { + @Override public void apply(final GeneralProtocolClass it) { EList<RoomModel> _referencedModels = root.getReferencedModels(it); referencedModels.addAll(_referencedModels); @@ -161,6 +165,7 @@ public class DocGen { IterableExtensions.<GeneralProtocolClass>forEach(_protocolClasses_1, _function_5); EList<EnumerationType> _enumerationTypes = model.getEnumerationTypes(); final Procedure1<EnumerationType> _function_6 = new Procedure1<EnumerationType>() { + @Override public void apply(final EnumerationType it) { CharSequence _generateDoc = DocGen.this.generateDoc(it, ctx); String _docFragmentName = DocGen.this.docFragmentName(it); @@ -170,6 +175,7 @@ public class DocGen { IterableExtensions.<EnumerationType>forEach(_enumerationTypes, _function_6); EList<EnumerationType> _enumerationTypes_1 = model.getEnumerationTypes(); final Procedure1<EnumerationType> _function_7 = new Procedure1<EnumerationType>() { + @Override public void apply(final EnumerationType it) { EList<RoomModel> _referencedModels = root.getReferencedModels(it); referencedModels.addAll(_referencedModels); @@ -178,6 +184,7 @@ public class DocGen { IterableExtensions.<EnumerationType>forEach(_enumerationTypes_1, _function_7); EList<DataClass> _dataClasses = model.getDataClasses(); final Procedure1<DataClass> _function_8 = new Procedure1<DataClass>() { + @Override public void apply(final DataClass it) { CharSequence _generateDoc = DocGen.this.generateDoc(it, ctx); String _docFragmentName = DocGen.this.docFragmentName(it); @@ -187,6 +194,7 @@ public class DocGen { IterableExtensions.<DataClass>forEach(_dataClasses, _function_8); EList<DataClass> _dataClasses_1 = model.getDataClasses(); final Procedure1<DataClass> _function_9 = new Procedure1<DataClass>() { + @Override public void apply(final DataClass it) { EList<RoomModel> _referencedModels = root.getReferencedModels(it); referencedModels.addAll(_referencedModels); @@ -195,6 +203,7 @@ public class DocGen { IterableExtensions.<DataClass>forEach(_dataClasses_1, _function_9); EList<ActorClass> _actorClasses = model.getActorClasses(); final Procedure1<ActorClass> _function_10 = new Procedure1<ActorClass>() { + @Override public void apply(final ActorClass it) { CharSequence _generateDoc = DocGen.this.generateDoc(it, ctx); String _docFragmentName = DocGen.this.docFragmentName(it); @@ -204,6 +213,7 @@ public class DocGen { IterableExtensions.<ActorClass>forEach(_actorClasses, _function_10); EList<ActorClass> _actorClasses_1 = model.getActorClasses(); final Procedure1<ActorClass> _function_11 = new Procedure1<ActorClass>() { + @Override public void apply(final ActorClass it) { EList<RoomModel> _referencedModels = root.getReferencedModels(it); referencedModels.addAll(_referencedModels); @@ -428,6 +438,7 @@ public class DocGen { _builder.newLine(); { final Function1<RoomModel, String> _function = new Function1<RoomModel, String>() { + @Override public String apply(final RoomModel it) { return it.getName(); } @@ -964,38 +975,17 @@ public class DocGen { _builder.newLineIfNotEmpty(); _builder.newLine(); { - boolean _and = false; - String _imagePath = this.getImagePath(filename); - String _fileExists = this.fileExists(ctx.model, _imagePath); - boolean _equals = _fileExists.equals("true"); - if (!_equals) { - _and = false; - } else { - boolean _or = false; - List<InterfaceItem> _allInterfaceItems = this._roomHelpers.getAllInterfaceItems(ac); - boolean _isEmpty = _allInterfaceItems.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _or = true; - } else { - EList<ActorRef> _actorRefs = ac.getActorRefs(); - boolean _isEmpty_1 = _actorRefs.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - _or = _not_1; - } - _and = _or; - } - if (_and) { + if ((this.fileExists(ctx.model, this.getImagePath(filename)).equals("true") && ((!this._roomHelpers.getAllInterfaceItems(ac).isEmpty()) || (!ac.getActorRefs().isEmpty())))) { _builder.append("\\level{3}{Structure}"); _builder.newLine(); Documentation _structureDocu = ac.getStructureDocu(); CharSequence _generateDocText_1 = this.generateDocText(_structureDocu); _builder.append(_generateDocText_1, ""); _builder.newLineIfNotEmpty(); - String _imagePath_1 = this.getImagePath(filename); + String _imagePath = this.getImagePath(filename); String _name_2 = ac.getName(); String _plus = (_name_2 + " Structure"); - CharSequence _includeGraphics = this.includeGraphics(_imagePath_1, this.IMGWIDTH_DEFAULT, _plus); + CharSequence _includeGraphics = this.includeGraphics(_imagePath, this.IMGWIDTH_DEFAULT, _plus); _builder.append(_includeGraphics, ""); _builder.newLineIfNotEmpty(); } else { @@ -1014,9 +1004,9 @@ public class DocGen { _builder.newLine(); { List<Port> _allPorts = this._roomHelpers.getAllPorts(ac); - boolean _isEmpty_2 = _allPorts.isEmpty(); - boolean _not_2 = (!_isEmpty_2); - if (_not_2) { + boolean _isEmpty = _allPorts.isEmpty(); + boolean _not = (!_isEmpty); + if (_not) { _builder.append("\\level{3}{Ports}"); _builder.newLine(); String _generatePortDoc = this.generatePortDoc(ac); @@ -1068,9 +1058,9 @@ public class DocGen { _builder.newLine(); { EList<Attribute> _attributes = ac.getAttributes(); - boolean _isEmpty_3 = _attributes.isEmpty(); - boolean _not_3 = (!_isEmpty_3); - if (_not_3) { + boolean _isEmpty_1 = _attributes.isEmpty(); + boolean _not_1 = (!_isEmpty_1); + if (_not_1) { _builder.append("\\level{3}{Attributes}"); _builder.newLine(); EList<Attribute> _attributes_1 = ac.getAttributes(); @@ -1082,9 +1072,9 @@ public class DocGen { _builder.newLine(); { EList<StandardOperation> _operations = ac.getOperations(); - boolean _isEmpty_4 = _operations.isEmpty(); - boolean _not_4 = (!_isEmpty_4); - if (_not_4) { + boolean _isEmpty_2 = _operations.isEmpty(); + boolean _not_2 = (!_isEmpty_2); + if (_not_2) { _builder.append("\\level{3}{Operations}"); _builder.newLine(); EList<StandardOperation> _operations_1 = ac.getOperations(); diff --git a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java index 9219333e4..2117b584f 100644 --- a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java +++ b/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java @@ -18,7 +18,6 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem; import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; import org.eclipse.etrice.core.fsm.fSM.GuardedTransition; import org.eclipse.etrice.core.fsm.fSM.MessageFromIf; import org.eclipse.etrice.core.fsm.fSM.ModelComponent; @@ -280,14 +279,7 @@ public abstract class AbstractStateMachineGenerator { List<State> _stateList = this._fSMHelpers.getStateList(_stateMachine); for(final State state : _stateList) { { - boolean _or = false; - if ((!omitBase)) { - _or = true; - } else { - boolean _isOwnObject = xpmc.isOwnObject(state); - _or = _isOwnObject; - } - if (_or) { + if (((!omitBase) || xpmc.isOwnObject(state))) { String _genActionCodeMethods = this.genActionCodeMethods(xpmc, state, generateImplementation); _builder.append(_genActionCodeMethods, ""); _builder.newLineIfNotEmpty(); @@ -327,22 +319,7 @@ public abstract class AbstractStateMachineGenerator { List<Transition> _allTransitionsRecursive = this._fSMHelpers.getAllTransitionsRecursive(_stateMachine); for(final Transition tr : _allTransitionsRecursive) { { - boolean _and = false; - boolean _or = false; - if ((!omitBase)) { - _or = true; - } else { - boolean _isOwnObject = xpmc.isOwnObject(tr); - _or = _isOwnObject; - } - if (!_or) { - _and = false; - } else { - DetailCode _action = tr.getAction(); - boolean _hasDetailCode = this._fSMHelpers.hasDetailCode(_action); - _and = _hasDetailCode; - } - if (_and) { + if ((((!omitBase) || xpmc.isOwnObject(tr)) && this._fSMHelpers.hasDetailCode(tr.getAction()))) { String _genActionCodeMethod = this.genActionCodeMethod(xpmc, tr, generateImplementation); _builder.append(_genActionCodeMethod, ""); _builder.newLineIfNotEmpty(); @@ -364,13 +341,7 @@ public abstract class AbstractStateMachineGenerator { String _interfaceItemType = this.interfaceItemType(); String _pointerLiteral = this.langExt.pointerLiteral(); final String ifItemPtr = (_interfaceItemType + _pointerLiteral); - boolean _or = false; - if (async) { - _or = true; - } else { - _or = eventDriven; - } - final boolean handleEvents = _or; + final boolean handleEvents = (async || eventDriven); String _xifexpression = null; boolean _usesInheritance = this.langExt.usesInheritance(); if (_usesInheritance) { @@ -726,6 +697,7 @@ public abstract class AbstractStateMachineGenerator { _builder.newLineIfNotEmpty(); _builder.append("\t"); final Function1<State, Boolean> _function = new Function1<State, Boolean>() { + @Override public Boolean apply(final State s) { return Boolean.valueOf(AbstractStateMachineGenerator.this._fSMHelpers.hasEntryCode(s, true)); } @@ -1120,13 +1092,7 @@ public abstract class AbstractStateMachineGenerator { } } { - boolean _or_1 = false; - if (async) { - _or_1 = true; - } else { - _or_1 = eventDriven; - } - if (_or_1) { + if ((async || eventDriven)) { _builder.append("\t"); CharSequence _markVariableUsed = this.markVariableUsed("trigger__et"); _builder.append(_markVariableUsed, "\t"); @@ -1505,6 +1471,7 @@ public abstract class AbstractStateMachineGenerator { _builder.newLineIfNotEmpty(); List<Transition> _outgoingTransitionsHierarchical = this._fSMExtensions.getOutgoingTransitionsHierarchical(xpmc, state); final Function1<Transition, Boolean> _function = new Function1<Transition, Boolean>() { + @Override public Boolean apply(final Transition t) { return Boolean.valueOf((t instanceof GuardedTransition)); } @@ -1538,14 +1505,7 @@ public abstract class AbstractStateMachineGenerator { _builder.append(";"); _builder.newLineIfNotEmpty(); { - boolean _and = false; - boolean _isHandler = chain.isHandler(); - if (!_isHandler) { - _and = false; - } else { - _and = usesHdlr; - } - if (_and) { + if ((chain.isHandler() && usesHdlr)) { _builder.append(" "); _builder.append("is_handler__et = TRUE;"); _builder.newLine(); @@ -1650,14 +1610,7 @@ public abstract class AbstractStateMachineGenerator { _builder.append(";"); _builder.newLineIfNotEmpty(); { - boolean _and = false; - boolean _isHandler = chain.isHandler(); - if (!_isHandler) { - _and = false; - } else { - _and = usesHdlr; - } - if (_and) { + if ((chain.isHandler() && usesHdlr)) { _builder.append(" "); _builder.append(" "); _builder.append("is_handler__et = "); @@ -1799,15 +1752,9 @@ public abstract class AbstractStateMachineGenerator { StateGraph _stateMachine_1 = xpmc.getStateMachine(); List<TrPoint> _allTrPointsRecursive = this._fSMHelpers.getAllTrPointsRecursive(_stateMachine_1); final Function1<TrPoint, Boolean> _function = new Function1<TrPoint, Boolean>() { + @Override public Boolean apply(final TrPoint t) { - boolean _and = false; - if (!(t instanceof TransitionPoint)) { - _and = false; - } else { - boolean _isHandler = ((TransitionPoint) t).isHandler(); - _and = _isHandler; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((t instanceof TransitionPoint) && ((TransitionPoint) t).isHandler())); } }; Iterable<TrPoint> _filter = IterableExtensions.<TrPoint>filter(_allTrPointsRecursive, _function); diff --git a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/FSMExtensions.java b/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/FSMExtensions.java index 703743c07..c4c8c242e 100644 --- a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/FSMExtensions.java +++ b/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/FSMExtensions.java @@ -115,12 +115,14 @@ public class FSMExtensions { List<State> _xblockexpression = null; { final Function1<State, Boolean> _function = new Function1<State, Boolean>() { + @Override public Boolean apply(final State s) { return Boolean.valueOf(FSMExtensions.this._fSMHelpers.isLeaf(s)); } }; final Iterable<State> leaf = IterableExtensions.<State>filter(states, _function); final Function1<State, Boolean> _function_1 = new Function1<State, Boolean>() { + @Override public Boolean apply(final State s) { boolean _isLeaf = FSMExtensions.this._fSMHelpers.isLeaf(s); return Boolean.valueOf((!_isLeaf)); @@ -196,11 +198,9 @@ public class FSMExtensions { final EObject parent = dc.eContainer(); boolean _switchResult = false; boolean _matched = false; - if (!_matched) { - if (parent instanceof Guard) { - _matched=true; - _switchResult = true; - } + if (parent instanceof Guard) { + _matched=true; + _switchResult = true; } if (!_matched) { if (parent instanceof CPBranchTransition) { diff --git a/plugins/org.eclipse.etrice.generator.fsmtest/xtend-gen/org/eclipse/etrice/generator/generator/FSMtestGenerator.java b/plugins/org.eclipse.etrice.generator.fsmtest/xtend-gen/org/eclipse/etrice/generator/generator/FSMtestGenerator.java index f82975186..b0a1699f4 100644 --- a/plugins/org.eclipse.etrice.generator.fsmtest/xtend-gen/org/eclipse/etrice/generator/generator/FSMtestGenerator.java +++ b/plugins/org.eclipse.etrice.generator.fsmtest/xtend-gen/org/eclipse/etrice/generator/generator/FSMtestGenerator.java @@ -9,6 +9,7 @@ import org.eclipse.xtext.generator.IGenerator; @SuppressWarnings("all") public class FSMtestGenerator implements IGenerator { + @Override public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { } } diff --git a/plugins/org.eclipse.etrice.generator.gnuplot/xtend-gen/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.java b/plugins/org.eclipse.etrice.generator.gnuplot/xtend-gen/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.java index dcc7b55ed..62b144c05 100644 --- a/plugins/org.eclipse.etrice.generator.gnuplot/xtend-gen/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.java +++ b/plugins/org.eclipse.etrice.generator.gnuplot/xtend-gen/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.java @@ -55,6 +55,7 @@ public class GnuplotScriptGenerator { SubSystemClass _subSystemClass = ssi.getSubSystemClass(); EList<Annotation> _annotations = _subSystemClass.getAnnotations(); final Function1<Annotation, Boolean> _function = new Function1<Annotation, Boolean>() { + @Override public Boolean apply(final Annotation a) { AnnotationType _type = a.getType(); String _name = _type.getName(); @@ -111,6 +112,7 @@ public class GnuplotScriptGenerator { protected KeyValue getAttribute(final Annotation anno, final String name) { EList<KeyValue> _attributes = anno.getAttributes(); final Function1<KeyValue, Boolean> _function = new Function1<KeyValue, Boolean>() { + @Override public Boolean apply(final KeyValue attr) { String _key = attr.getKey(); return Boolean.valueOf(Objects.equal(_key, name)); @@ -170,6 +172,7 @@ public class GnuplotScriptGenerator { SubSystemClass _subSystemClass = ssi.getSubSystemClass(); EList<Annotation> _annotations = _subSystemClass.getAnnotations(); final Function1<Annotation, Boolean> _function = new Function1<Annotation, Boolean>() { + @Override public Boolean apply(final Annotation a) { AnnotationType _type = a.getType(); String _name = _type.getName(); @@ -233,6 +236,7 @@ public class GnuplotScriptGenerator { SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); EList<Annotation> _annotations_1 = _subSystemClass_1.getAnnotations(); final Function1<Annotation, Boolean> _function_1 = new Function1<Annotation, Boolean>() { + @Override public Boolean apply(final Annotation a) { AnnotationType _type = a.getType(); String _name = _type.getName(); diff --git a/plugins/org.eclipse.etrice.generator.java.mvn/pom.xml b/plugins/org.eclipse.etrice.generator.java.mvn/pom.xml index bb54973a3..57a80acd0 100644 --- a/plugins/org.eclipse.etrice.generator.java.mvn/pom.xml +++ b/plugins/org.eclipse.etrice.generator.java.mvn/pom.xml @@ -40,7 +40,7 @@ <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> - <version>1.1.0</version> + <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java index a00107ed8..953079288 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java @@ -60,12 +60,14 @@ public class ActorClassDataGen { final HashMap<ActorClass, WiredActorClass> ac2wired = new HashMap<ActorClass, WiredActorClass>(); EList<WiredStructureClass> _wiredInstances = root.getWiredInstances(); final Function1<WiredStructureClass, Boolean> _function = new Function1<WiredStructureClass, Boolean>() { + @Override public Boolean apply(final WiredStructureClass w) { return Boolean.valueOf((w instanceof WiredActorClass)); } }; Iterable<WiredStructureClass> _filter = IterableExtensions.<WiredStructureClass>filter(_wiredInstances, _function); final Procedure1<WiredStructureClass> _function_1 = new Procedure1<WiredStructureClass>() { + @Override public void apply(final WiredStructureClass w) { ActorClass _actorClass = ((WiredActorClass) w).getActorClass(); ac2wired.put(_actorClass, ((WiredActorClass) w)); @@ -74,6 +76,7 @@ public class ActorClassDataGen { IterableExtensions.<WiredStructureClass>forEach(_filter, _function_1); EList<ExpandedActorClass> _xpActorClasses = root.getXpActorClasses(); final Function1<ExpandedActorClass, Boolean> _function_2 = new Function1<ExpandedActorClass, Boolean>() { + @Override public Boolean apply(final ExpandedActorClass cl) { ActorClass _actorClass = cl.getActorClass(); return Boolean.valueOf(ActorClassDataGen.this._fileSystemHelpers.isValidGenerationLocation(_actorClass)); diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java index 12e802c8b..b2259755b 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java @@ -32,7 +32,6 @@ import org.eclipse.etrice.core.room.EnumerationType; import org.eclipse.etrice.core.room.InterfaceItem; import org.eclipse.etrice.core.room.Message; import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.PrimitiveType; import org.eclipse.etrice.core.room.ProtocolClass; import org.eclipse.etrice.core.room.RefableType; import org.eclipse.etrice.core.room.ReferenceType; @@ -110,12 +109,14 @@ public class ActorClassGen extends GenericActorClassGenerator { final HashMap<ActorClass, WiredActorClass> ac2wired = new HashMap<ActorClass, WiredActorClass>(); EList<WiredStructureClass> _wiredInstances = root.getWiredInstances(); final Function1<WiredStructureClass, Boolean> _function = new Function1<WiredStructureClass, Boolean>() { + @Override public Boolean apply(final WiredStructureClass w) { return Boolean.valueOf((w instanceof WiredActorClass)); } }; Iterable<WiredStructureClass> _filter = IterableExtensions.<WiredStructureClass>filter(_wiredInstances, _function); final Procedure1<WiredStructureClass> _function_1 = new Procedure1<WiredStructureClass>() { + @Override public void apply(final WiredStructureClass w) { ActorClass _actorClass = ((WiredActorClass) w).getActorClass(); ac2wired.put(_actorClass, ((WiredActorClass) w)); @@ -124,6 +125,7 @@ public class ActorClassGen extends GenericActorClassGenerator { IterableExtensions.<WiredStructureClass>forEach(_filter, _function_1); EList<ExpandedActorClass> _xpActorClasses = root.getXpActorClasses(); final Function1<ExpandedActorClass, Boolean> _function_2 = new Function1<ExpandedActorClass, Boolean>() { + @Override public Boolean apply(final ExpandedActorClass cl) { ActorClass _actorClass = cl.getActorClass(); return Boolean.valueOf(ActorClassGen.this._fileSystemHelpers.isValidGenerationLocation(_actorClass)); @@ -281,6 +283,7 @@ public class ActorClassGen extends GenericActorClassGenerator { { EList<ActorRef> _actorRefs = ac.getActorRefs(); final Function1<ActorRef, Boolean> _function = new Function1<ActorRef, Boolean>() { + @Override public Boolean apply(final ActorRef r) { ReferenceType _refType = r.getRefType(); return Boolean.valueOf(Objects.equal(_refType, ReferenceType.OPTIONAL)); @@ -308,14 +311,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); _builder.append("public "); { - boolean _or = false; - if (manualBehavior) { - _or = true; - } else { - boolean _isAbstract = ac.isAbstract(); - _or = _isAbstract; - } - if (_or) { + if ((manualBehavior || ac.isAbstract())) { _builder.append("abstract "); } } @@ -394,6 +390,7 @@ public class ActorClassGen extends GenericActorClassGenerator { { EList<ActorRef> _actorRefs_1 = ac.getActorRefs(); final Function1<ActorRef, Boolean> _function_1 = new Function1<ActorRef, Boolean>() { + @Override public Boolean apply(final ActorRef r) { ReferenceType _refType = r.getRefType(); return Boolean.valueOf(Objects.equal(_refType, ReferenceType.OPTIONAL)); @@ -680,17 +677,7 @@ public class ActorClassGen extends GenericActorClassGenerator { } _builder.newLine(); { - boolean _or_1 = false; - ComponentCommunicationType _commType = ac.getCommType(); - boolean _equals_1 = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_1) { - _or_1 = true; - } else { - ComponentCommunicationType _commType_1 = ac.getCommType(); - boolean _equals_2 = Objects.equal(_commType_1, ComponentCommunicationType.DATA_DRIVEN); - _or_1 = _equals_2; - } - if (_or_1) { + if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { _builder.append("\t\t"); _builder.append("// activate polling for data-driven communication"); _builder.newLine(); @@ -706,22 +693,10 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); _builder.newLine(); { - boolean _or_2 = false; - List<Attribute> _dynConfigReadAttributes_2 = this.dataConfigExt.getDynConfigReadAttributes(ac); - boolean _isEmpty_2 = _dynConfigReadAttributes_2.isEmpty(); - boolean _not_2 = (!_isEmpty_2); - if (_not_2) { - _or_2 = true; - } else { - List<Attribute> _dynConfigWriteAttributes = this.dataConfigExt.getDynConfigWriteAttributes(ac); - boolean _isEmpty_3 = _dynConfigWriteAttributes.isEmpty(); - boolean _not_3 = (!_isEmpty_3); - _or_2 = _not_3; - } - if (_or_2) { + if (((!this.dataConfigExt.getDynConfigReadAttributes(ac).isEmpty()) || (!this.dataConfigExt.getDynConfigWriteAttributes(ac).isEmpty()))) { { - List<Attribute> _dynConfigReadAttributes_3 = this.dataConfigExt.getDynConfigReadAttributes(ac); - for(final Attribute a_1 : _dynConfigReadAttributes_3) { + List<Attribute> _dynConfigReadAttributes_2 = this.dataConfigExt.getDynConfigReadAttributes(ac); + for(final Attribute a_1 : _dynConfigReadAttributes_2) { _builder.append("\t\t"); _builder.append("lock_"); String _name_28 = a_1.getName(); @@ -738,8 +713,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); _builder.append("\t"); EList<Attribute> _attributes_3 = ac.getAttributes(); - List<Attribute> _dynConfigReadAttributes_4 = this.dataConfigExt.getDynConfigReadAttributes(ac); - List<Attribute> _minus = this._roomExtensions.<Attribute>minus(_attributes_3, _dynConfigReadAttributes_4); + List<Attribute> _dynConfigReadAttributes_3 = this.dataConfigExt.getDynConfigReadAttributes(ac); + List<Attribute> _minus = this._roomExtensions.<Attribute>minus(_attributes_3, _dynConfigReadAttributes_3); String _name_29 = ac.getName(); CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_minus, _name_29); _builder.append(_attributeSettersGettersImplementation, "\t"); @@ -796,8 +771,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); { boolean _overridesStop = this._roomExtensions.overridesStop(ac); - boolean _not_4 = (!_overridesStop); - if (_not_4) { + boolean _not_2 = (!_overridesStop); + if (_not_2) { { if (manualBehavior) { _builder.append("\t"); @@ -848,17 +823,7 @@ public class ActorClassGen extends GenericActorClassGenerator { } } { - boolean _or_3 = false; - ComponentCommunicationType _commType_2 = ac.getCommType(); - boolean _equals_3 = Objects.equal(_commType_2, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_3) { - _or_3 = true; - } else { - ComponentCommunicationType _commType_3 = ac.getCommType(); - boolean _equals_4 = Objects.equal(_commType_3, ComponentCommunicationType.DATA_DRIVEN); - _or_3 = _equals_4; - } - if (_or_3) { + if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { _builder.append("\t"); _builder.append("\t"); _builder.append("RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(getThread()).removePollingMessageReceiver(this);"); @@ -1038,9 +1003,9 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append(_genStateMachine, "\t"); _builder.newLineIfNotEmpty(); { - ComponentCommunicationType _commType_4 = ac.getCommType(); - boolean _equals_5 = Objects.equal(_commType_4, ComponentCommunicationType.DATA_DRIVEN); - if (_equals_5) { + ComponentCommunicationType _commType = ac.getCommType(); + boolean _equals_1 = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); + if (_equals_1) { _builder.append("\t"); _builder.append("public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data) {"); _builder.newLine(); @@ -1054,17 +1019,7 @@ public class ActorClassGen extends GenericActorClassGenerator { } } { - boolean _or_4 = false; - ComponentCommunicationType _commType_5 = ac.getCommType(); - boolean _equals_6 = Objects.equal(_commType_5, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_6) { - _or_4 = true; - } else { - ComponentCommunicationType _commType_6 = ac.getCommType(); - boolean _equals_7 = Objects.equal(_commType_6, ComponentCommunicationType.DATA_DRIVEN); - _or_4 = _equals_7; - } - if (_or_4) { + if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { _builder.append("\t"); _builder.append("@Override"); _builder.newLine(); @@ -1072,9 +1027,9 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("public void receive(Message msg) {"); _builder.newLine(); { - ComponentCommunicationType _commType_7 = ac.getCommType(); - boolean _equals_8 = Objects.equal(_commType_7, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_8) { + ComponentCommunicationType _commType_1 = ac.getCommType(); + boolean _equals_2 = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); + if (_equals_2) { _builder.append("\t"); _builder.append("\t"); _builder.append("receiveEvent(null, -1, null);"); @@ -1093,8 +1048,8 @@ public class ActorClassGen extends GenericActorClassGenerator { } } else { StateGraph _stateMachine = xpac.getStateMachine(); - boolean _isEmpty_4 = this._roomHelpers.isEmpty(_stateMachine); - if (_isEmpty_4) { + boolean _isEmpty_2 = this._roomHelpers.isEmpty(_stateMachine); + if (_isEmpty_2) { _builder.append("\t"); _builder.append("//--------------------- no state machine"); _builder.newLine(); @@ -1265,9 +1220,9 @@ public class ActorClassGen extends GenericActorClassGenerator { } { EList<Attribute> _attributes_4 = ac.getAttributes(); - boolean _isEmpty_5 = _attributes_4.isEmpty(); - boolean _not_5 = (!_isEmpty_5); - if (_not_5) { + boolean _isEmpty_3 = _attributes_4.isEmpty(); + boolean _not_3 = (!_isEmpty_3); + if (_not_3) { _builder.newLine(); { EList<Attribute> _attributes_5 = ac.getAttributes(); @@ -1423,9 +1378,9 @@ public class ActorClassGen extends GenericActorClassGenerator { } { EList<Attribute> _attributes_6 = ac.getAttributes(); - boolean _isEmpty_6 = _attributes_6.isEmpty(); - boolean _not_6 = (!_isEmpty_6); - if (_not_6) { + boolean _isEmpty_4 = _attributes_6.isEmpty(); + boolean _not_4 = (!_isEmpty_4); + if (_not_4) { _builder.newLine(); { EList<Attribute> _attributes_7 = ac.getAttributes(); @@ -1699,24 +1654,12 @@ public class ActorClassGen extends GenericActorClassGenerator { String _xblockexpression = null; { String _xifexpression = null; - boolean _and = false; - RefableType _type = att.getType(); - DataType _type_1 = _type.getType(); - if (!(_type_1 instanceof EnumerationType)) { - _and = false; - } else { - RefableType _type_2 = att.getType(); - DataType _type_3 = _type_2.getType(); - PrimitiveType _primitiveType = ((EnumerationType) _type_3).getPrimitiveType(); - boolean _equals = Objects.equal(_primitiveType, null); - _and = _equals; - } - if (_and) { + if (((att.getType().getType() instanceof EnumerationType) && Objects.equal(((EnumerationType) att.getType().getType()).getPrimitiveType(), null))) { _xifexpression = "int"; } else { - RefableType _type_4 = att.getType(); - DataType _type_5 = _type_4.getType(); - _xifexpression = this._typeHelpers.typeName(_type_5); + RefableType _type = att.getType(); + DataType _type_1 = _type.getType(); + _xifexpression = this._typeHelpers.typeName(_type_1); } final String type = _xifexpression; final String method = this.getSaveMethod(type); @@ -1742,11 +1685,9 @@ public class ActorClassGen extends GenericActorClassGenerator { private String getSaveMethod(final String type) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (Objects.equal(type, "boolean")) { - _matched=true; - _switchResult = "writeBoolean"; - } + if (Objects.equal(type, "boolean")) { + _matched=true; + _switchResult = "writeBoolean"; } if (!_matched) { if (Objects.equal(type, "char")) { @@ -1803,24 +1744,12 @@ public class ActorClassGen extends GenericActorClassGenerator { String _xblockexpression = null; { String _xifexpression = null; - boolean _and = false; - RefableType _type = att.getType(); - DataType _type_1 = _type.getType(); - if (!(_type_1 instanceof EnumerationType)) { - _and = false; - } else { - RefableType _type_2 = att.getType(); - DataType _type_3 = _type_2.getType(); - PrimitiveType _primitiveType = ((EnumerationType) _type_3).getPrimitiveType(); - boolean _equals = Objects.equal(_primitiveType, null); - _and = _equals; - } - if (_and) { + if (((att.getType().getType() instanceof EnumerationType) && Objects.equal(((EnumerationType) att.getType().getType()).getPrimitiveType(), null))) { _xifexpression = "int"; } else { - RefableType _type_4 = att.getType(); - DataType _type_5 = _type_4.getType(); - _xifexpression = this._typeHelpers.typeName(_type_5); + RefableType _type = att.getType(); + DataType _type_1 = _type.getType(); + _xifexpression = this._typeHelpers.typeName(_type_1); } final String type = _xifexpression; final String method = this.getLoadMethod(type); @@ -1850,11 +1779,9 @@ public class ActorClassGen extends GenericActorClassGenerator { private String getLoadMethod(final String type) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (Objects.equal(type, "boolean")) { - _matched=true; - _switchResult = "readBoolean"; - } + if (Objects.equal(type, "boolean")) { + _matched=true; + _switchResult = "readBoolean"; } if (!_matched) { if (Objects.equal(type, "char")) { diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java index 324771c98..882669fd4 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java @@ -121,22 +121,20 @@ public class ConfigGenAddon { DataType aType = _type.getType(); CharSequence _switchResult = null; boolean _matched = false; - if (!_matched) { - if (aType instanceof PrimitiveType) { - _matched=true; - CharSequence _xblockexpression_1 = null; - { - String value = this.typeHelpers.getAttrInstanceConfigValue(path, instance); - CharSequence _xifexpression = null; - boolean _notEquals = (!Objects.equal(value, null)); - if (_notEquals) { - String _valueLiteral = this.stdExt.toValueLiteral(((PrimitiveType)aType), value); - _xifexpression = this.initGen.genAttributeInitializer(a, _valueLiteral, invokes); - } - _xblockexpression_1 = _xifexpression; + if (aType instanceof PrimitiveType) { + _matched=true; + CharSequence _xblockexpression_1 = null; + { + String value = this.typeHelpers.getAttrInstanceConfigValue(path, instance); + CharSequence _xifexpression = null; + boolean _notEquals = (!Objects.equal(value, null)); + if (_notEquals) { + String _valueLiteral = this.stdExt.toValueLiteral(((PrimitiveType)aType), value); + _xifexpression = this.initGen.genAttributeInitializer(a, _valueLiteral, invokes); } - _switchResult = _xblockexpression_1; + _xblockexpression_1 = _xifexpression; } + _switchResult = _xblockexpression_1; } if (!_matched) { if (aType instanceof EnumerationType) { @@ -391,23 +389,21 @@ public class ConfigGenAddon { DataType aType = _type.getType(); CharSequence _switchResult = null; boolean _matched = false; - if (!_matched) { - if (aType instanceof DataClass) { - _matched=true; - StringConcatenation _builder = new StringConcatenation(); - { - List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); - for(final Attribute e : _allAttributes) { - String _name = e.getName(); - String _plus = ((varNamePath + "_") + _name); - List<Attribute> _union = this._roomExtensions.<Attribute>union(path, e); - CharSequence _genMinMaxConstantsRec = this.genMinMaxConstantsRec(ac, _plus, _union); - _builder.append(_genMinMaxConstantsRec, ""); - _builder.newLineIfNotEmpty(); - } + if (aType instanceof DataClass) { + _matched=true; + StringConcatenation _builder = new StringConcatenation(); + { + List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); + for(final Attribute e : _allAttributes) { + String _name = e.getName(); + String _plus = ((varNamePath + "_") + _name); + List<Attribute> _union = this._roomExtensions.<Attribute>union(path, e); + CharSequence _genMinMaxConstantsRec = this.genMinMaxConstantsRec(ac, _plus, _union); + _builder.append(_genMinMaxConstantsRec, ""); + _builder.newLineIfNotEmpty(); } - _switchResult = _builder; } + _switchResult = _builder; } if (!_matched) { if (aType instanceof PrimitiveType) { @@ -417,7 +413,9 @@ public class ConfigGenAddon { String temp = ((String) null); StringConcatenation _builder = new StringConcatenation(); { - boolean _notEquals = (!Objects.equal((temp = this.dataConfigExt.getAttrClassConfigMinValue(ac, path)), null)); + String _attrClassConfigMinValue = this.dataConfigExt.getAttrClassConfigMinValue(ac, path); + String _temp = (temp = _attrClassConfigMinValue); + boolean _notEquals = (!Objects.equal(_temp, null)); if (_notEquals) { _builder.append("public static "); String _minMaxType = this.getMinMaxType(((PrimitiveType)aType)); @@ -432,7 +430,9 @@ public class ConfigGenAddon { } } { - boolean _notEquals_1 = (!Objects.equal((temp = this.dataConfigExt.getAttrClassConfigMaxValue(ac, path)), null)); + String _attrClassConfigMaxValue = this.dataConfigExt.getAttrClassConfigMaxValue(ac, path); + String _temp_1 = (temp = _attrClassConfigMaxValue); + boolean _notEquals_1 = (!Objects.equal(_temp_1, null)); if (_notEquals_1) { _builder.append("public static "); String _minMaxType_1 = this.getMinMaxType(((PrimitiveType)aType)); @@ -460,11 +460,9 @@ public class ConfigGenAddon { String _switchResult = null; String _typeName = this.typeHelpers.typeName(type); boolean _matched = false; - if (!_matched) { - if (Objects.equal(_typeName, "byte")) { - _matched=true; - _switchResult = "int"; - } + if (Objects.equal(_typeName, "byte")) { + _matched=true; + _switchResult = "int"; } if (!_matched) { if (Objects.equal(_typeName, "short")) { diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java index fc7dde662..d2451a8db 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java @@ -67,6 +67,7 @@ public class DataClassGen { public void doGenerate(final Root root) { EList<DataClass> _usedDataClasses = root.getUsedDataClasses(); final Function1<DataClass, Boolean> _function = new Function1<DataClass, Boolean>() { + @Override public Boolean apply(final DataClass cl) { return Boolean.valueOf(DataClassGen.this._fileSystemHelpers.isValidGenerationLocation(cl)); } diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.java index a3a5a0c81..83928974c 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.java @@ -47,6 +47,7 @@ public class EnumerationTypeGen { public void doGenerate(final Root root) { EList<EnumerationType> _usedEnumClasses = root.getUsedEnumClasses(); final Function1<EnumerationType, Boolean> _function = new Function1<EnumerationType, Boolean>() { + @Override public Boolean apply(final EnumerationType cl) { return Boolean.valueOf(EnumerationTypeGen.this._fileSystemHelpers.isValidGenerationLocation(cl)); } diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java index 49a734d0e..195ac149c 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java @@ -89,28 +89,26 @@ public class Initialization { DataType aType = _type.getType(); CharSequence _switchResult = null; boolean _matched = false; - if (!_matched) { - RefableType _type_1 = a.getType(); - boolean _isRef = _type_1.isRef(); - if (_isRef) { - _matched=true; - CharSequence _xifexpression = null; - String _defaultValueLiteral = a.getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - String _defaultValueLiteral_1 = a.getDefaultValueLiteral(); - _xifexpression = this.attributeInit(a, _defaultValueLiteral_1); - } else { - CharSequence _xifexpression_1 = null; - boolean _needsInitialization = this.languageExt.needsInitialization(a); - if (_needsInitialization) { - String _nullPointer = this.languageExt.nullPointer(); - _xifexpression_1 = this.attributeInit(a, _nullPointer); - } - _xifexpression = _xifexpression_1; + RefableType _type_1 = a.getType(); + boolean _isRef = _type_1.isRef(); + if (_isRef) { + _matched=true; + CharSequence _xifexpression = null; + String _defaultValueLiteral = a.getDefaultValueLiteral(); + boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); + if (_notEquals) { + String _defaultValueLiteral_1 = a.getDefaultValueLiteral(); + _xifexpression = this.attributeInit(a, _defaultValueLiteral_1); + } else { + CharSequence _xifexpression_1 = null; + boolean _needsInitialization = this.languageExt.needsInitialization(a); + if (_needsInitialization) { + String _nullPointer = this.languageExt.nullPointer(); + _xifexpression_1 = this.attributeInit(a, _nullPointer); } - _switchResult = _xifexpression; + _xifexpression = _xifexpression_1; } + _switchResult = _xifexpression; } if (!_matched) { if (aType instanceof PrimitiveType) { @@ -132,14 +130,8 @@ public class Initialization { _xifexpression_2 = this.attributeInit(a, _valueLiteral); } else { CharSequence _xifexpression_3 = null; - boolean _or = false; - if ((!useClassDefaultsOnly)) { - _or = true; - } else { - boolean _needsInitialization_1 = this.languageExt.needsInitialization(a); - _or = _needsInitialization_1; - } - if (_or) { + if (((!useClassDefaultsOnly) || + this.languageExt.needsInitialization(a))) { String _defaultValue = this.languageExt.defaultValue(aType); _xifexpression_3 = this.attributeInit(a, _defaultValue); } @@ -170,14 +162,8 @@ public class Initialization { _xifexpression_2 = this.attributeInit(a, _enumLiteral); } else { CharSequence _xifexpression_3 = null; - boolean _or = false; - if ((!useClassDefaultsOnly)) { - _or = true; - } else { - boolean _needsInitialization_1 = this.languageExt.needsInitialization(a); - _or = _needsInitialization_1; - } - if (_or) { + if (((!useClassDefaultsOnly) || + this.languageExt.needsInitialization(a))) { String _defaultValue = this.languageExt.defaultValue(aType); _xifexpression_3 = this.attributeInit(a, _defaultValue); } @@ -202,21 +188,19 @@ public class Initialization { RefableType _type = a.getType(); DataType aType = _type.getType(); boolean _matched = false; - if (!_matched) { - if (aType instanceof DataClass) { - _matched=true; - StringConcatenation _builder = new StringConcatenation(); - { - List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); - for(final Attribute e : _allAttributes) { - List<Attribute> _union = this._roomExtensions.<Attribute>union(path, e); - CharSequence _attributeInitPrimitiveRec = this.attributeInitPrimitiveRec(_union, roomClass); - _builder.append(_attributeInitPrimitiveRec, ""); - _builder.newLineIfNotEmpty(); - } + if (aType instanceof DataClass) { + _matched=true; + StringConcatenation _builder = new StringConcatenation(); + { + List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); + for(final Attribute e : _allAttributes) { + List<Attribute> _union = this._roomExtensions.<Attribute>union(path, e); + CharSequence _attributeInitPrimitiveRec = this.attributeInitPrimitiveRec(_union, roomClass); + _builder.append(_attributeInitPrimitiveRec, ""); + _builder.newLineIfNotEmpty(); } - return _builder; } + return _builder; } if (!_matched) { if (aType instanceof PrimitiveType) { @@ -278,33 +262,7 @@ public class Initialization { DataType aType = _type.getType(); StringConcatenation _builder = new StringConcatenation(); { - boolean _or = false; - int _size = a.getSize(); - boolean _equals = (_size == 0); - if (_equals) { - _or = true; - } else { - boolean _and = false; - boolean _and_1 = false; - int _size_1 = a.getSize(); - boolean _greaterThan = (_size_1 > 0); - if (!_greaterThan) { - _and_1 = false; - } else { - String _typeName = this.typeHelpers.typeName(aType); - boolean _equals_1 = "char".equals(_typeName); - _and_1 = _equals_1; - } - if (!_and_1) { - _and = false; - } else { - boolean _matches = value.matches("\'.\'|\\(char\\).*"); - boolean _not = (!_matches); - _and = _not; - } - _or = _and; - } - if (_or) { + if (((a.getSize() == 0) || (((a.getSize() > 0) && "char".equals(this.typeHelpers.typeName(aType))) && (!value.matches("\'.\'|\\(char\\).*"))))) { _builder.append(invokes, ""); _builder.append("."); String _name = a.getName(); @@ -313,47 +271,27 @@ public class Initialization { _builder.append(";"); _builder.newLineIfNotEmpty(); } else { - boolean _or_1 = false; - String _trim = value.trim(); - boolean _startsWith = _trim.startsWith("{"); - boolean _not_1 = (!_startsWith); - if (_not_1) { - _or_1 = true; - } else { - String _typeName_1 = this.typeHelpers.typeName(aType); - boolean _equals_2 = "char".equals(_typeName_1); - _or_1 = _equals_2; - } - if (_or_1) { + if (((!value.trim().startsWith("{")) || "char".equals(this.typeHelpers.typeName(aType)))) { _builder.append("{"); _builder.newLine(); _builder.append("\t"); - String _typeName_2 = this.typeHelpers.typeName(aType); - _builder.append(_typeName_2, "\t"); + String _typeName = this.typeHelpers.typeName(aType); + _builder.append(_typeName, "\t"); _builder.append("[] array = new "); - String _typeName_3 = this.typeHelpers.typeName(aType); - _builder.append(_typeName_3, "\t"); + String _typeName_1 = this.typeHelpers.typeName(aType); + _builder.append(_typeName_1, "\t"); _builder.append("["); - int _size_2 = a.getSize(); - _builder.append(_size_2, "\t"); + int _size = a.getSize(); + _builder.append(_size, "\t"); _builder.append("];"); _builder.newLineIfNotEmpty(); { - boolean _and_2 = false; - RefableType _type_1 = a.getType(); - boolean _isRef = _type_1.isRef(); - if (!_isRef) { - _and_2 = false; - } else { - boolean _isPrimitive = this.typeHelpers.isPrimitive(aType); - _and_2 = _isPrimitive; - } - boolean _not_2 = (!_and_2); - if (_not_2) { + boolean _not = (!(a.getType().isRef() && this.typeHelpers.isPrimitive(aType))); + if (_not) { _builder.append("\t"); _builder.append("for (int i=0;i<"); - int _size_3 = a.getSize(); - _builder.append(_size_3, "\t"); + int _size_1 = a.getSize(); + _builder.append(_size_1, "\t"); _builder.append(";i++){"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -383,8 +321,8 @@ public class Initialization { String _name_2 = a.getName(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("new "); - String _typeName_4 = this.typeHelpers.typeName(aType); - _builder_1.append(_typeName_4, ""); + String _typeName_2 = this.typeHelpers.typeName(aType); + _builder_1.append(_typeName_2, ""); _builder_1.append("[] "); _builder_1.append(value, ""); CharSequence _invokeSetter_2 = this.procedureHelpers.invokeSetter(_name_2, null, _builder_1.toString()); @@ -402,11 +340,9 @@ public class Initialization { private String getDataConfigValue(final List<Attribute> path, final EObject roomClass) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (roomClass instanceof ActorClass) { - _matched=true; - _switchResult = this.typeHelpers.getAttrClassConfigValue(path, ((ActorClass)roomClass), false); - } + if (roomClass instanceof ActorClass) { + _matched=true; + _switchResult = this.typeHelpers.getAttrClassConfigValue(path, ((ActorClass)roomClass), false); } if (!_matched) { if (roomClass instanceof PortClass) { diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java index 71682e14e..cf0adcc41 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java @@ -43,6 +43,7 @@ public class JavaExtensions implements ILanguageExtension { @Inject private TypeHelpers typeHelpers; + @Override public String getTypedDataDefinition(final EObject msg) { String _xifexpression = null; if ((msg instanceof Message)) { @@ -126,11 +127,9 @@ public class JavaExtensions implements ILanguageExtension { public String toWrapper(final String type) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (Objects.equal(type, "int")) { - _matched=true; - _switchResult = "Integer"; - } + if (Objects.equal(type, "int")) { + _matched=true; + _switchResult = "Integer"; } if (!_matched) { if (Objects.equal(type, "char")) { @@ -145,79 +144,70 @@ public class JavaExtensions implements ILanguageExtension { } public boolean needsInitialization(final Attribute a) { - boolean _or = false; - boolean _or_1 = false; - int _size = a.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _or_1 = true; - } else { - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - boolean _isEnumerationOrPrimitive = this.typeHelpers.isEnumerationOrPrimitive(_type_1); - boolean _not = (!_isEnumerationOrPrimitive); - _or_1 = _not; - } - if (_or_1) { - _or = true; - } else { - RefableType _type_2 = a.getType(); - DataType _type_3 = _type_2.getType(); - String _typeName = this.typeHelpers.typeName(_type_3); - boolean _equals = _typeName.equals("String"); - _or = _equals; - } - return _or; + return (((a.getSize() > 0) || (!this.typeHelpers.isEnumerationOrPrimitive(a.getType().getType()))) || this.typeHelpers.typeName(a.getType().getType()).equals("String")); } + @Override public String accessLevelPrivate() { return "private "; } + @Override public String accessLevelProtected() { return "protected "; } + @Override public String accessLevelPublic() { return "public "; } + @Override public String memberAccess() { return "this."; } + @Override public String selfPointer(final String classname, final boolean hasArgs) { return ""; } + @Override public String selfPointer(final boolean hasArgs) { return ""; } + @Override public String operationScope(final String classname, final boolean isDeclaration) { return ""; } + @Override public String scopeSeparator() { return "."; } + @Override public String memberInDeclaration(final String namespace, final String member) { return member; } + @Override public String memberInUse(final String namespace, final String member) { return ((namespace + ".") + member); } + @Override public boolean usesInheritance() { return true; } + @Override public boolean usesPointers() { return false; } + @Override public String genEnumeration(final String name, final List<Pair<String, String>> entries) { StringConcatenation _builder = new StringConcatenation(); { @@ -235,53 +225,45 @@ public class JavaExtensions implements ILanguageExtension { return _builder.toString(); } + @Override public String booleanConstant(final boolean b) { return Boolean.valueOf(b).toString(); } + @Override public String pointerLiteral() { return ""; } + @Override public String nullPointer() { return "null"; } + @Override public String voidPointer() { return "Object"; } + @Override public String arrayType(final String type, final int size, final boolean isRef) { return (type + "[]"); } + @Override public String arrayDeclaration(final String type, final int size, final boolean isRef, final String name) { return (((type + " ") + name) + "[]"); } + @Override public String superCall(final String baseClassName, final String method, final String args) { return (((("super." + method) + "(") + args) + ");"); } + @Override public String toValueLiteral(final PrimitiveType type, final String value) { String _xifexpression = null; - boolean _and = false; - boolean _isCharacterType = this.typeHelpers.isCharacterType(type); - boolean _not = (!_isCharacterType); - if (!_not) { - _and = false; - } else { - boolean _or = false; - boolean _contains = value.contains(","); - if (_contains) { - _or = true; - } else { - boolean _contains_1 = value.contains("{"); - _or = _contains_1; - } - _and = _or; - } - if (_and) { + if (((!this.typeHelpers.isCharacterType(type)) && (value.contains(",") || value.contains("{")))) { String _xblockexpression = null; { String _replace = value.replace("{", ""); @@ -313,17 +295,10 @@ public class JavaExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String toEnumLiteral(final EnumerationType type, final String value) { String _xifexpression = null; - boolean _or = false; - boolean _contains = value.contains(","); - if (_contains) { - _or = true; - } else { - boolean _contains_1 = value.contains("{"); - _or = _contains_1; - } - if (_or) { + if ((value.contains(",") || value.contains("{"))) { String _xblockexpression = null; { String _replace = value.replace("{", ""); @@ -384,11 +359,9 @@ public class JavaExtensions implements ILanguageExtension { String _switchResult = null; String _targetName = type.getTargetName(); boolean _matched = false; - if (!_matched) { - if (Objects.equal(_targetName, "boolean")) { - _matched=true; - _switchResult = value.toLowerCase(); - } + if (Objects.equal(_targetName, "boolean")) { + _matched=true; + _switchResult = value.toLowerCase(); } if (!_matched) { if (Objects.equal(_targetName, "byte")) { @@ -468,15 +441,14 @@ public class JavaExtensions implements ILanguageExtension { return _switchResult; } + @Override public String defaultValue(final DataType dt) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (dt instanceof PrimitiveType) { - _matched=true; - String _defaultValueLiteral = ((PrimitiveType)dt).getDefaultValueLiteral(); - _switchResult = this.toValueLiteral(((PrimitiveType)dt), _defaultValueLiteral); - } + if (dt instanceof PrimitiveType) { + _matched=true; + String _defaultValueLiteral = ((PrimitiveType)dt).getDefaultValueLiteral(); + _switchResult = this.toValueLiteral(((PrimitiveType)dt), _defaultValueLiteral); } if (!_matched) { if (dt instanceof EnumerationType) { @@ -514,6 +486,7 @@ public class JavaExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String initializationWithDefaultValues(final DataType dt, final int size) { String _xblockexpression = null; { @@ -544,15 +517,9 @@ public class JavaExtensions implements ILanguageExtension { return _xblockexpression; } + @Override public String[] generateArglistAndTypedData(final EObject d) { - boolean _or = false; - boolean _equals = Objects.equal(d, null); - if (_equals) { - _or = true; - } else { - _or = (!(d instanceof VarDecl)); - } - if (_or) { + if ((Objects.equal(d, null) || (!(d instanceof VarDecl)))) { return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList("", "", ""), String.class)); } final VarDecl data = ((VarDecl) d); @@ -570,16 +537,7 @@ public class JavaExtensions implements ILanguageExtension { RefableType _refType_3 = data.getRefType(); DataType _type_3 = _refType_3.getType(); final String ct = ((PrimitiveType) _type_3).getCastName(); - boolean _and = false; - boolean _notEquals = (!Objects.equal(ct, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _isEmpty = ct.isEmpty(); - boolean _not = (!_isEmpty); - _and = _not; - } - if (_and) { + if (((!Objects.equal(ct, null)) && (!ct.isEmpty()))) { castTypeName = ct; } } else { @@ -608,6 +566,7 @@ public class JavaExtensions implements ILanguageExtension { return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList(dataArg, typedData, typedArgList), String.class)); } + @Override public String getTargetType(final EnumerationType type) { String _xifexpression = null; PrimitiveType _primitiveType = type.getPrimitiveType(); @@ -621,6 +580,7 @@ public class JavaExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String getCastedValue(final EnumLiteral literal) { String _xblockexpression = null; { @@ -644,6 +604,7 @@ public class JavaExtensions implements ILanguageExtension { return _xblockexpression; } + @Override public String getCastType(final EnumerationType type) { String _xifexpression = null; PrimitiveType _primitiveType = type.getPrimitiveType(); @@ -657,6 +618,7 @@ public class JavaExtensions implements ILanguageExtension { return _xifexpression; } + @Override public String makeOverridable() { return ""; } diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java index 554b404f6..9db9a44e7 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java @@ -112,12 +112,14 @@ public class NodeGen { final HashMap<SubSystemClass, WiredSubSystemClass> sscc2wired = new HashMap<SubSystemClass, WiredSubSystemClass>(); EList<WiredStructureClass> _wiredInstances = root.getWiredInstances(); final Function1<WiredStructureClass, Boolean> _function = new Function1<WiredStructureClass, Boolean>() { + @Override public Boolean apply(final WiredStructureClass w) { return Boolean.valueOf((w instanceof WiredSubSystemClass)); } }; Iterable<WiredStructureClass> _filter = IterableExtensions.<WiredStructureClass>filter(_wiredInstances, _function); final Procedure1<WiredStructureClass> _function_1 = new Procedure1<WiredStructureClass>() { + @Override public void apply(final WiredStructureClass w) { SubSystemClass _subSystemClass = ((WiredSubSystemClass) w).getSubSystemClass(); sscc2wired.put(_subSystemClass, ((WiredSubSystemClass) w)); @@ -131,27 +133,18 @@ public class NodeGen { { StructureInstance _instance = root.getInstance(instpath); final SubSystemInstance ssi = ((SubSystemInstance) _instance); - boolean _and = false; - boolean _notEquals = (!Objects.equal(ssi, null)); - if (!_notEquals) { - _and = false; - } else { + if (((!Objects.equal(ssi, null)) && this._fileSystemHelpers.isValidGenerationLocation(ssi.getSubSystemClass()))) { SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - boolean _isValidGenerationLocation = this._fileSystemHelpers.isValidGenerationLocation(_subSystemClass); - _and = _isValidGenerationLocation; - } - if (_and) { + final WiredSubSystemClass wired = sscc2wired.get(_subSystemClass); SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - final WiredSubSystemClass wired = sscc2wired.get(_subSystemClass_1); + String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass_1); SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass_2); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _path = this._roomExtensions.getPath(_subSystemClass_3); + String _path = this._roomExtensions.getPath(_subSystemClass_2); final String path = (_generationTargetPath + _path); + SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); + String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_subSystemClass_3); SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_subSystemClass_4); - SubSystemClass _subSystemClass_5 = ssi.getSubSystemClass(); - String _path_1 = this._roomExtensions.getPath(_subSystemClass_5); + String _path_1 = this._roomExtensions.getPath(_subSystemClass_4); final String infopath = (_generationInfoPath + _path_1); final String file = this._javaExtensions.getJavaFileName(nr, ssi); this.checkDataPorts(ssi); @@ -174,12 +167,14 @@ public class NodeGen { private HashSet<ActorClass> getOptionalActorClasses(final Root root, final StructureInstance si) { TreeIterator<EObject> _eAllContents = si.eAllContents(); final Function1<EObject, Boolean> _function = new Function1<EObject, Boolean>() { + @Override public Boolean apply(final EObject i) { return Boolean.valueOf((i instanceof ActorInterfaceInstance)); } }; Iterator<EObject> _filter = IteratorExtensions.<EObject>filter(_eAllContents, _function); final Function1<EObject, ActorInterfaceInstance> _function_1 = new Function1<EObject, ActorInterfaceInstance>() { + @Override public ActorInterfaceInstance apply(final EObject aii) { return ((ActorInterfaceInstance) aii); } @@ -187,6 +182,7 @@ public class NodeGen { Iterator<ActorInterfaceInstance> _map = IteratorExtensions.<EObject, ActorInterfaceInstance>map(_filter, _function_1); final ArrayList<ActorInterfaceInstance> aifs = Lists.<ActorInterfaceInstance>newArrayList(_map); final Function1<ActorInterfaceInstance, ActorClass> _function_2 = new Function1<ActorInterfaceInstance, ActorClass>() { + @Override public ActorClass apply(final ActorInterfaceInstance aii) { return ((ActorInterfaceInstance) aii).getActorClass(); } @@ -213,6 +209,7 @@ public class NodeGen { NodeClass _type = nr.getType(); EList<PhysicalThread> _threads = _type.getThreads(); final Function1<PhysicalThread, Boolean> _function = new Function1<PhysicalThread, Boolean>() { + @Override public Boolean apply(final PhysicalThread t) { return Boolean.valueOf(usedThreads.contains(t)); } @@ -336,21 +333,11 @@ public class NodeGen { { for(final PhysicalThread thread_1 : threads) { { - boolean _or = false; - ExecMode _execmode = thread_1.getExecmode(); - boolean _equals = Objects.equal(_execmode, ExecMode.POLLED); - if (_equals) { - _or = true; - } else { - ExecMode _execmode_1 = thread_1.getExecmode(); - boolean _equals_1 = Objects.equal(_execmode_1, ExecMode.MIXED); - _or = _equals_1; - } - if (_or) { + if ((Objects.equal(thread_1.getExecmode(), ExecMode.POLLED) || Objects.equal(thread_1.getExecmode(), ExecMode.MIXED))) { _builder.append("\t\t"); _builder.append("msgService = new MessageService(this, MessageService.ExecMode."); - ExecMode _execmode_2 = thread_1.getExecmode(); - String _name_1 = _execmode_2.getName(); + ExecMode _execmode = thread_1.getExecmode(); + String _name_1 = _execmode.getName(); _builder.append(_name_1, "\t\t"); _builder.append(", "); long _time = thread_1.getTime(); @@ -366,8 +353,8 @@ public class NodeGen { } else { _builder.append("\t\t"); _builder.append("msgService = new MessageService(this, MessageService.ExecMode."); - ExecMode _execmode_3 = thread_1.getExecmode(); - String _name_3 = _execmode_3.getName(); + ExecMode _execmode_1 = thread_1.getExecmode(); + String _name_3 = _execmode_1.getName(); _builder.append(_name_3, "\t\t"); _builder.append(", 0, "); String _threadId_2 = this.getThreadId(thread_1); @@ -405,15 +392,7 @@ public class NodeGen { final ETMapUtil.MappedThread mapped = ETMapUtil.getMappedThread(ai); _builder.newLineIfNotEmpty(); { - boolean _or_1 = false; - boolean _isImplicit = mapped.isImplicit(); - if (_isImplicit) { - _or_1 = true; - } else { - boolean _isAsParent = mapped.isAsParent(); - _or_1 = _isAsParent; - } - boolean _not = (!_or_1); + boolean _not = (!(mapped.isImplicit() || mapped.isAsParent())); if (_not) { _builder.append("\t\t"); _builder.append("addPathToThread(\""); @@ -509,12 +488,14 @@ public class NodeGen { { BasicEList<AbstractInstance> _allSubInstances = this._roomExtensions.getAllSubInstances(comp); final Function1<AbstractInstance, Boolean> _function_1 = new Function1<AbstractInstance, Boolean>() { + @Override public Boolean apply(final AbstractInstance inst) { return Boolean.valueOf((inst instanceof ActorInterfaceInstance)); } }; Iterable<AbstractInstance> _filter = IterableExtensions.<AbstractInstance>filter(_allSubInstances, _function_1); final Function1<AbstractInstance, ActorInterfaceInstance> _function_2 = new Function1<AbstractInstance, ActorInterfaceInstance>() { + @Override public ActorInterfaceInstance apply(final AbstractInstance inst) { return ((ActorInterfaceInstance) inst); } @@ -780,6 +761,7 @@ public class NodeGen { EList<ActorClass> _subClasses = root.getSubClasses(oa); List<ActorClass> _union = this._roomExtensions.<ActorClass>union(_subClasses, oa); final Function1<ActorClass, Boolean> _function_3 = new Function1<ActorClass, Boolean>() { + @Override public Boolean apply(final ActorClass s) { boolean _isAbstract = s.isAbstract(); return Boolean.valueOf((!_isAbstract)); diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.java index b6da29f0a..b8180a1eb 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.java @@ -56,27 +56,18 @@ public class NodeRunnerGen { { StructureInstance _instance = root.getInstance(instpath); final SubSystemInstance ssi = ((SubSystemInstance) _instance); - boolean _and = false; - boolean _notEquals = (!Objects.equal(ssi, null)); - if (!_notEquals) { - _and = false; - } else { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - boolean _isValidGenerationLocation = this._fileSystemHelpers.isValidGenerationLocation(_subSystemClass); - _and = _isValidGenerationLocation; - } - if (_and) { + if (((!Objects.equal(ssi, null)) && this._fileSystemHelpers.isValidGenerationLocation(ssi.getSubSystemClass()))) { String _javaClassName = this._javaExtensions.getJavaClassName(nr, ssi); final String file = (_javaClassName + "Runner.java"); + SubSystemClass _subSystemClass = ssi.getSubSystemClass(); + String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass); SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass_1); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _path = this.roomExt.getPath(_subSystemClass_2); + String _path = this.roomExt.getPath(_subSystemClass_1); final String filepath = (_generationTargetPath + _path); + SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); + String _generationInfoPath = this.roomExt.getGenerationInfoPath(_subSystemClass_2); SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _generationInfoPath = this.roomExt.getGenerationInfoPath(_subSystemClass_3); - SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); - String _path_1 = this.roomExt.getPath(_subSystemClass_4); + String _path_1 = this.roomExt.getPath(_subSystemClass_3); final String infopath = (_generationInfoPath + _path_1); CharSequence _generate = this.generate(root, ssi); this.fileIO.generateFile("generating SubSystemRunner implementation", filepath, infopath, file, _generate); diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java index 20b3223e1..b8cab302d 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java @@ -51,12 +51,14 @@ public class OptionalActorFactoryGen { final HashMap<ActorClass, WiredActorClass> ac2wired = new HashMap<ActorClass, WiredActorClass>(); EList<WiredStructureClass> _wiredInstances = root.getWiredInstances(); final Function1<WiredStructureClass, Boolean> _function = new Function1<WiredStructureClass, Boolean>() { + @Override public Boolean apply(final WiredStructureClass w) { return Boolean.valueOf((w instanceof WiredActorClass)); } }; Iterable<WiredStructureClass> _filter = IterableExtensions.<WiredStructureClass>filter(_wiredInstances, _function); final Procedure1<WiredStructureClass> _function_1 = new Procedure1<WiredStructureClass>() { + @Override public void apply(final WiredStructureClass w) { ActorClass _actorClass = ((WiredActorClass) w).getActorClass(); ac2wired.put(_actorClass, ((WiredActorClass) w)); @@ -65,6 +67,7 @@ public class OptionalActorFactoryGen { IterableExtensions.<WiredStructureClass>forEach(_filter, _function_1); EList<OptionalActorInstance> _optionalInstances = root.getOptionalInstances(); final Function1<OptionalActorInstance, Boolean> _function_2 = new Function1<OptionalActorInstance, Boolean>() { + @Override public Boolean apply(final OptionalActorInstance cl) { ActorClass _actorClass = cl.getActorClass(); return Boolean.valueOf(OptionalActorFactoryGen.this._fileSystemHelpers.isValidGenerationLocation(_actorClass)); @@ -146,6 +149,7 @@ public class OptionalActorFactoryGen { { List<Port> _allEndPorts = this._roomHelpers.getAllEndPorts(ac); final Function1<Port, Boolean> _function = new Function1<Port, Boolean>() { + @Override public Boolean apply(final Port p) { return Boolean.valueOf(OptionalActorFactoryGen.this._roomHelpers.isExternal(p)); } diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java index 6915c618b..c8f833f60 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java @@ -50,6 +50,7 @@ public class OptionalActorInterfaceGen extends GenericActorClassGenerator { public void doGenerate(final Root root) { EList<ActorClass> _optionalActorClasses = root.getOptionalActorClasses(); final Function1<ActorClass, Boolean> _function = new Function1<ActorClass, Boolean>() { + @Override public Boolean apply(final ActorClass cl) { return Boolean.valueOf(OptionalActorInterfaceGen.this._fileSystemHelpers.isValidGenerationLocation(cl)); } diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java index ccc7148b4..8fa0e63ce 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java @@ -86,6 +86,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { public void doGenerate(final Root root) { EList<ProtocolClass> _usedProtocolClasses = root.getUsedProtocolClasses(); final Function1<ProtocolClass, Boolean> _function = new Function1<ProtocolClass, Boolean>() { + @Override public Boolean apply(final ProtocolClass cl) { return Boolean.valueOf(ProtocolClassGen.this._fileSystemHelpers.isValidGenerationLocation(cl)); } @@ -777,22 +778,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { String _name_3 = _data_1.getName(); _builder.append(_name_3, "\t\t"); { - boolean _and = false; - VarDecl _data_2 = m.getData(); - RefableType _refType = _data_2.getRefType(); - boolean _isRef = _refType.isRef(); - boolean _not = (!_isRef); - if (!_not) { - _and = false; - } else { - VarDecl _data_3 = m.getData(); - RefableType _refType_1 = _data_3.getRefType(); - DataType _type = _refType_1.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type); - boolean _not_1 = (!_isEnumerationOrPrimitive); - _and = _not_1; - } - if (_and) { + if (((!m.getData().getRefType().isRef()) && (!this._typeHelpers.isEnumerationOrPrimitive(m.getData().getRefType().getType())))) { _builder.append(".deepCopy()"); } } @@ -805,18 +791,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("}"); _builder.newLine(); { - boolean _and_1 = false; - VarDecl _data_4 = m.getData(); - boolean _notEquals_1 = (!Objects.equal(_data_4, null)); - if (!_notEquals_1) { - _and_1 = false; - } else { - VarDecl _data_5 = m.getData(); - RefableType _refType_2 = _data_5.getRefType(); - DataType _type_1 = _refType_2.getType(); - _and_1 = (_type_1 instanceof DataClass); - } - if (_and_1) { + if (((!Objects.equal(m.getData(), null)) && (m.getData().getRefType().getType() instanceof DataClass))) { CharSequence _messageSignatureExplicit = this.messageSignatureExplicit(m); _builder.append(_messageSignatureExplicit, ""); _builder.append(" {"); @@ -825,16 +800,16 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { String _name_4 = m.getName(); _builder.append(_name_4, "\t"); _builder.append("(new "); - VarDecl _data_6 = m.getData(); - RefableType _refType_3 = _data_6.getRefType(); - DataType _type_2 = _refType_3.getType(); - String _name_5 = _type_2.getName(); + VarDecl _data_2 = m.getData(); + RefableType _refType = _data_2.getRefType(); + DataType _type = _refType.getType(); + String _name_5 = _type.getName(); _builder.append(_name_5, "\t"); _builder.append("("); - VarDecl _data_7 = m.getData(); - RefableType _refType_4 = _data_7.getRefType(); - DataType _type_3 = _refType_4.getType(); - String _paramList = this._dataClassGen.paramList(((DataClass) _type_3)); + VarDecl _data_3 = m.getData(); + RefableType _refType_1 = _data_3.getRefType(); + DataType _type_1 = _refType_1.getType(); + String _paramList = this._dataClassGen.paramList(((DataClass) _type_1)); _builder.append(_paramList, "\t"); _builder.append("));"); _builder.newLineIfNotEmpty(); @@ -852,6 +827,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { { List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + @Override public Boolean apply(final Message m) { VarDecl _data = m.getData(); return Boolean.valueOf((!Objects.equal(_data, null))); diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java index b7118385d..4b802168a 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java @@ -30,6 +30,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { /** * @param generateImplementation NOT used */ + @Override public CharSequence genExtra(final ExpandedModelComponent xpac, final boolean generateImplementation) { CharSequence _xblockexpression = null; { @@ -46,17 +47,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { } StringConcatenation _builder = new StringConcatenation(); { - boolean _or = false; - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _or = true; - } else { - GlobalSettings _settings_1 = Main.getSettings(); - boolean _isGenerateWithVerboseOutput = _settings_1.isGenerateWithVerboseOutput(); - _or = _isGenerateWithVerboseOutput; - } - if (_or) { + if ((Main.getSettings().isGenerateMSCInstrumentation() || Main.getSettings().isGenerateWithVerboseOutput())) { _builder.append("// state names"); _builder.newLine(); _builder.append("protected static final String stateStrings[] = {"); @@ -102,18 +93,18 @@ public class StateMachineGen extends GenericStateMachineGenerator { _builder.append("private void setState(int new_state) {"); _builder.newLine(); { - GlobalSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { + GlobalSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { _builder.append("\t"); _builder.append("DebuggingService.getInstance().addActorState(this,stateStrings[new_state]);"); _builder.newLine(); } } { - GlobalSettings _settings_3 = Main.getSettings(); - boolean _isGenerateWithVerboseOutput_1 = _settings_3.isGenerateWithVerboseOutput(); - if (_isGenerateWithVerboseOutput_1) { + GlobalSettings _settings_1 = Main.getSettings(); + boolean _isGenerateWithVerboseOutput = _settings_1.isGenerateWithVerboseOutput(); + if (_isGenerateWithVerboseOutput) { _builder.append("\t"); _builder.append("if (stateStrings[new_state]!=\"Idle\") {"); _builder.newLine(); @@ -143,6 +134,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { /** * if {@code -storeDataObj} is set then a call to {@code finalAction()} is generated */ + @Override public CharSequence finalAction() { StringConcatenation _builder = new StringConcatenation(); { diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java index 484721872..91d7954e7 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java @@ -105,6 +105,7 @@ public class VariableServiceGen { final HashMap<ActorInstance, List<Attribute>> aisAttrMap = new HashMap<ActorInstance, List<Attribute>>(); EList<ActorInstance> _allContainedInstances = comp.getAllContainedInstances(); final Procedure1<ActorInstance> _function = new Procedure1<ActorInstance>() { + @Override public void apply(final ActorInstance ai) { List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(ai); boolean _isEmpty = _dynConfigReadAttributes.isEmpty(); @@ -563,9 +564,11 @@ public class VariableServiceGen { private HashSet<DataClass> getDynConfigDataClasses(final Iterable<ActorInstance> ais) { final HashSet<DataClass> result = new HashSet<DataClass>(); final Procedure1<ActorInstance> _function = new Procedure1<ActorInstance>() { + @Override public void apply(final ActorInstance ai) { List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(ai); final Procedure1<Attribute> _function = new Procedure1<Attribute>() { + @Override public void apply(final Attribute a) { RefableType _type = a.getType(); DataType _type_1 = _type.getType(); @@ -594,6 +597,7 @@ public class VariableServiceGen { DataClass dc = visit.pop(); List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(dc); final Procedure1<Attribute> _function = new Procedure1<Attribute>() { + @Override public void apply(final Attribute a) { RefableType _type = a.getType(); DataType _type_1 = _type.getType(); @@ -614,6 +618,7 @@ public class VariableServiceGen { private HashSet<RoomModel> getRoomModels(final Collection<ActorInstance> ais) { final HashSet<RoomModel> models = new HashSet<RoomModel>(); final Procedure1<ActorInstance> _function = new Procedure1<ActorInstance>() { + @Override public void apply(final ActorInstance ai) { ActorClass _actorClass = ai.getActorClass(); EObject _eContainer = _actorClass.eContainer(); diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java index f183748e4..509b81d29 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java @@ -124,6 +124,7 @@ public class GenericActorClassGenerator implements IIfItemIdGenerator { return this.langExt.genEnumeration("interface_items", list); } + @Override public String getIfItemId(final AbstractInterfaceItem item) { String _name = item.getName(); return ("IFITEM_" + _name); diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java index 392458c38..8b476a3c3 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java @@ -103,6 +103,7 @@ public class GenericProtocolClassGenerator implements IMessageIdGenerator { * @param mif a {@link MessageFromIf} * @return an identifier for the message */ + @Override public String getMessageID(final MessageFromIf mif) { EObject _message = mif.getMessage(); AbstractInterfaceItem _from = mif.getFrom(); diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java index 6c3aa2b4b..554c06303 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java @@ -117,11 +117,13 @@ public class GenericStateMachineGenerator extends AbstractStateMachineGenerator * @param xpmc an expanded actor class * @return the generated code */ + @Override public String guard(final TriggeredTransition tt, final String trigger, final ExpandedModelComponent mc) { String _xblockexpression = null; { EList<Trigger> _triggers = tt.getTriggers(); final Function1<Trigger, Boolean> _function = new Function1<Trigger, Boolean>() { + @Override public Boolean apply(final Trigger e) { return Boolean.valueOf(mc.isMatching(e, trigger)); } @@ -145,6 +147,7 @@ public class GenericStateMachineGenerator extends AbstractStateMachineGenerator return _xblockexpression; } + @Override public String guard(final GuardedTransition tt, final String trigger, final ExpandedModelComponent mc) { StringConcatenation _builder = new StringConcatenation(); DetailCode _guard = tt.getGuard(); @@ -154,32 +157,17 @@ public class GenericStateMachineGenerator extends AbstractStateMachineGenerator return _builder.toString(); } + @Override public String genActionCodeMethod(final ExpandedModelComponent xpmc, final Transition tr, final boolean generateImplementation) { String _xblockexpression = null; { EList<TransitionChain> chain = xpmc.getChains(tr); - boolean _and = false; - boolean _isEmpty = chain.isEmpty(); - boolean _not = (!_isEmpty); - if (!_not) { - _and = false; - } else { - final Function1<TransitionChain, Boolean> _function = new Function1<TransitionChain, Boolean>() { - public Boolean apply(final TransitionChain it) { - boolean _and = false; - Transition _transition = it.getTransition(); - if (!(_transition instanceof NonInitialTransition)) { - _and = false; - } else { - _and = (!(it.getTransition() instanceof GuardedTransition)); - } - return Boolean.valueOf(_and); - } - }; - boolean _forall = IterableExtensions.<TransitionChain>forall(chain, _function); - _and = _forall; - } - boolean hasArgs = _and; + boolean hasArgs = ((!chain.isEmpty()) && IterableExtensions.<TransitionChain>forall(chain, new Function1<TransitionChain, Boolean>() { + @Override + public Boolean apply(final TransitionChain it) { + return Boolean.valueOf(((it.getTransition() instanceof NonInitialTransition) && (!(it.getTransition() instanceof GuardedTransition)))); + } + })); String _className = this.getClassName(xpmc); final String opScope = this.langExt.operationScope(_className, false); String _xifexpression = null; @@ -269,6 +257,7 @@ public class GenericStateMachineGenerator extends AbstractStateMachineGenerator * @param generateImplementation if only declarations should be generated then <code>false</code> has to be passed * @return the generated code */ + @Override public String genActionCodeMethods(final ExpandedModelComponent xpmc, final State state, final boolean generateImplementation) { String _xblockexpression = null; { diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/PrepareFileSystem.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/PrepareFileSystem.java index a71122ba9..dc314ed5e 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/PrepareFileSystem.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/PrepareFileSystem.java @@ -54,16 +54,7 @@ public class PrepareFileSystem { for (final RoomModel mdl : _usedRoomModels) { { final String tgtpath = this._roomExtensions.getGenerationTargetPath(mdl); - boolean _and = false; - boolean _notEquals = (!Objects.equal(tgtpath, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _isEmpty = tgtpath.isEmpty(); - boolean _not = (!_isEmpty); - _and = _not; - } - if (_and) { + if (((!Objects.equal(tgtpath, null)) && (!tgtpath.isEmpty()))) { pathes.add(tgtpath); } } @@ -82,16 +73,7 @@ public class PrepareFileSystem { for (final RoomModel mdl : _usedRoomModels) { { final String tgtpath = this._roomExtensions.getDocGenerationTargetPath(mdl); - boolean _and = false; - boolean _notEquals = (!Objects.equal(tgtpath, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _isEmpty = tgtpath.isEmpty(); - boolean _not = (!_isEmpty); - _and = _not; - } - if (_and) { + if (((!Objects.equal(tgtpath, null)) && (!tgtpath.isEmpty()))) { pathes.add(tgtpath); } } @@ -127,16 +109,7 @@ public class PrepareFileSystem { if (_isDirectory) { File[] children = f.listFiles(); for (final File child : children) { - boolean _and = false; - boolean _isDirectory_1 = child.isDirectory(); - if (!_isDirectory_1) { - _and = false; - } else { - String _name = child.getName(); - boolean _equals = _name.equals("images"); - _and = _equals; - } - boolean _not = (!_and); + boolean _not = (!(child.isDirectory() && child.getName().equals("images"))); if (_not) { this.eraseContents(child); child.delete(); diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java index 05d267686..0a679b3c8 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java @@ -172,16 +172,7 @@ public class ProcedureHelpers { private CharSequence userCode(final String code) { StringConcatenation _builder = new StringConcatenation(); { - boolean _and = false; - boolean _notEquals = (!Objects.equal(code, null)); - if (!_notEquals) { - _and = false; - } else { - boolean _isEmpty = code.isEmpty(); - boolean _not = (!_isEmpty); - _and = _not; - } - if (_and) { + if (((!Objects.equal(code, null)) && (!code.isEmpty()))) { _builder.append("/*--------------------- begin user code ---------------------*/"); _builder.newLine(); _builder.append(code, ""); @@ -398,6 +389,7 @@ public class ProcedureHelpers { */ public String argList(final Iterable<Attribute> attributes) { final Function1<Attribute, String> _function = new Function1<Attribute, String>() { + @Override public String apply(final Attribute it) { String _signatureString = ProcedureHelpers.this.signatureString(it); String _plus = (_signatureString + " "); @@ -570,6 +562,7 @@ public class ProcedureHelpers { boolean _not = (!_usesInheritance); List<ClassStructor> _structors = this.getStructors(cls, _not); final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { + @Override public Boolean apply(final ClassStructor it) { boolean _isConstructor = it.isConstructor(); return Boolean.valueOf((_isConstructor == ctor)); @@ -611,6 +604,7 @@ public class ProcedureHelpers { boolean _not = (!_usesInheritance); List<ClassStructor> _structors = this.getStructors(cls, _not); final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { + @Override public Boolean apply(final ClassStructor it) { return Boolean.valueOf(it.isConstructor()); } @@ -626,6 +620,7 @@ public class ProcedureHelpers { boolean _not_1 = (!_usesInheritance_1); List<ClassStructor> _structors_1 = this.getStructors(cls, _not_1); final Function1<ClassStructor, Boolean> _function_1 = new Function1<ClassStructor, Boolean>() { + @Override public Boolean apply(final ClassStructor it) { boolean _isConstructor = it.isConstructor(); return Boolean.valueOf((!_isConstructor)); @@ -672,6 +667,7 @@ public class ProcedureHelpers { boolean _not = (!_usesInheritance); List<ClassStructor> _structors = this.getStructors(cls, _not); final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { + @Override public Boolean apply(final ClassStructor it) { boolean _isConstructor = it.isConstructor(); return Boolean.valueOf((_isConstructor == ctor)); @@ -725,6 +721,7 @@ public class ProcedureHelpers { boolean _not = (!_usesInheritance); List<ClassStructor> _structors = this.getStructors(cls, _not); final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { + @Override public Boolean apply(final ClassStructor it) { boolean _isConstructor = it.isConstructor(); return Boolean.valueOf((_isConstructor == ctor)); @@ -732,12 +729,14 @@ public class ProcedureHelpers { }; final Iterable<ClassStructor> implementedStructors = IterableExtensions.<ClassStructor>filter(_structors, _function); final Function1<ClassStructor, DetailCode> _function_1 = new Function1<ClassStructor, DetailCode>() { + @Override public DetailCode apply(final ClassStructor it) { return it.getDetailCode(); } }; Iterable<DetailCode> _map = IterableExtensions.<ClassStructor, DetailCode>map(implementedStructors, _function_1); final Function1<DetailCode, String> _function_2 = new Function1<DetailCode, String>() { + @Override public String apply(final DetailCode it) { AbstractGenerator _instance = AbstractGenerator.getInstance(); return _instance.getTranslatedCode(it); @@ -745,6 +744,7 @@ public class ProcedureHelpers { }; final Iterable<String> translatedCodes = IterableExtensions.<DetailCode, String>map(_map, _function_2); final Function1<String, CharSequence> _function_3 = new Function1<String, CharSequence>() { + @Override public CharSequence apply(final String it) { CharSequence _xifexpression = null; int _size = IterableExtensions.size(translatedCodes); @@ -766,12 +766,10 @@ public class ProcedureHelpers { List<ClassStructor> _switchResult = null; final RoomClass it = cls; boolean _matched = false; - if (!_matched) { - if (it instanceof ActorClass) { - if ((!inherited)) { - _matched=true; - _switchResult = ((ActorClass)it).getStructors(); - } + if (it instanceof ActorClass) { + if ((!inherited)) { + _matched=true; + _switchResult = ((ActorClass)it).getStructors(); } } if (!_matched) { @@ -846,11 +844,9 @@ public class ProcedureHelpers { String _switchResult = null; final RefableType it = type; boolean _matched = false; - if (!_matched) { - if (Objects.equal(it, null)) { - _matched=true; - _switchResult = "void"; - } + if (Objects.equal(it, null)) { + _matched=true; + _switchResult = "void"; } if (!_matched) { boolean _isRef = it.isRef(); @@ -873,19 +869,17 @@ public class ProcedureHelpers { String _switchResult = null; final Attribute it = attribute; boolean _matched = false; - if (!_matched) { - int _size = it.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _matched=true; - RefableType _type = it.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - int _size_1 = it.getSize(); - RefableType _type_2 = it.getType(); - boolean _isRef = _type_2.isRef(); - _switchResult = this.languageExt.arrayType(_typeName, _size_1, _isRef); - } + int _size = it.getSize(); + boolean _greaterThan = (_size > 0); + if (_greaterThan) { + _matched=true; + RefableType _type = it.getType(); + DataType _type_1 = _type.getType(); + String _typeName = this._typeHelpers.typeName(_type_1); + int _size_1 = it.getSize(); + RefableType _type_2 = it.getType(); + boolean _isRef = _type_2.isRef(); + _switchResult = this.languageExt.arrayType(_typeName, _size_1, _isRef); } if (!_matched) { RefableType _type_3 = it.getType(); @@ -902,20 +896,18 @@ public class ProcedureHelpers { String _switchResult = null; final Attribute it = attribute; boolean _matched = false; - if (!_matched) { - int _size = it.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _matched=true; - RefableType _type = it.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - int _size_1 = it.getSize(); - RefableType _type_2 = it.getType(); - boolean _isRef = _type_2.isRef(); - String _name = it.getName(); - _switchResult = this.languageExt.arrayDeclaration(_typeName, _size_1, _isRef, _name); - } + int _size = it.getSize(); + boolean _greaterThan = (_size > 0); + if (_greaterThan) { + _matched=true; + RefableType _type = it.getType(); + DataType _type_1 = _type.getType(); + String _typeName = this._typeHelpers.typeName(_type_1); + int _size_1 = it.getSize(); + RefableType _type_2 = it.getType(); + boolean _isRef = _type_2.isRef(); + String _name = it.getName(); + _switchResult = this.languageExt.arrayDeclaration(_typeName, _size_1, _isRef, _name); } if (!_matched) { RefableType _type_3 = it.getType(); diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java index 775639e84..8157879d2 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java @@ -37,14 +37,12 @@ import org.eclipse.etrice.core.room.MessageHandler; import org.eclipse.etrice.core.room.Port; import org.eclipse.etrice.core.room.PortClass; import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; import org.eclipse.etrice.core.room.RoomClass; import org.eclipse.etrice.core.room.RoomModel; import org.eclipse.etrice.core.room.SAP; import org.eclipse.etrice.core.room.SPP; import org.eclipse.etrice.core.room.ServiceImplementation; import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.core.room.VarDecl; import org.eclipse.etrice.core.room.util.RoomHelpers; import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; import org.eclipse.etrice.generator.fsm.generic.FSMExtensions; @@ -104,6 +102,7 @@ public class RoomExtensions extends FSMExtensions { public List<Port> punion(final Iterable<Port> in1, final Iterable<ExternalPort> in2) { final ArrayList<Port> ret = new ArrayList<Port>(); final Procedure1<ExternalPort> _function = new Procedure1<ExternalPort>() { + @Override public void apply(final ExternalPort e) { Port _interfacePort = e.getInterfacePort(); ret.add(_interfacePort); @@ -482,6 +481,7 @@ public class RoomExtensions extends FSMExtensions { EObject _eContainer = m.eContainer(); List<MessageHandler> _sendHandlers = this.getSendHandlers(((ProtocolClass) _eContainer), conj); final Function1<MessageHandler, Boolean> _function = new Function1<MessageHandler, Boolean>() { + @Override public Boolean apply(final MessageHandler e) { Message _msg = e.getMsg(); return Boolean.valueOf(Objects.equal(_msg, m)); @@ -522,48 +522,12 @@ public class RoomExtensions extends FSMExtensions { * void return type */ public boolean overridesStop(final ActorClass ac) { - boolean _or = false; - EList<StandardOperation> _operations = ac.getOperations(); - final Function1<StandardOperation, Boolean> _function = new Function1<StandardOperation, Boolean>() { + return (IterableExtensions.<StandardOperation>exists(ac.getOperations(), new Function1<StandardOperation, Boolean>() { + @Override public Boolean apply(final StandardOperation e) { - boolean _and = false; - boolean _and_1 = false; - String _name = e.getName(); - boolean _equals = Objects.equal(_name, "stop"); - if (!_equals) { - _and_1 = false; - } else { - EList<VarDecl> _arguments = e.getArguments(); - boolean _isEmpty = _arguments.isEmpty(); - _and_1 = _isEmpty; - } - if (!_and_1) { - _and = false; - } else { - RefableType _returnType = e.getReturnType(); - boolean _equals_1 = Objects.equal(_returnType, null); - _and = _equals_1; - } - return Boolean.valueOf(_and); + return Boolean.valueOf(((Objects.equal(e.getName(), "stop") && e.getArguments().isEmpty()) && Objects.equal(e.getReturnType(), null))); } - }; - boolean _exists = IterableExtensions.<StandardOperation>exists(_operations, _function); - if (_exists) { - _or = true; - } else { - boolean _and = false; - ActorClass _actorBase = ac.getActorBase(); - boolean _notEquals = (!Objects.equal(_actorBase, null)); - if (!_notEquals) { - _and = false; - } else { - ActorClass _actorBase_1 = ac.getActorBase(); - boolean _overridesStop = this.overridesStop(_actorBase_1); - _and = _overridesStop; - } - _or = _and; - } - return _or; + }) || ((!Objects.equal(ac.getActorBase(), null)) && this.overridesStop(ac.getActorBase()))); } public BasicEList<AbstractInstance> getAllSubInstances(final StructureInstance ssi) { diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TestInstanceCreator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TestInstanceCreator.java index 9a823983a..ee89be084 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TestInstanceCreator.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TestInstanceCreator.java @@ -74,17 +74,17 @@ public class TestInstanceCreator { final ArrayList<PhysicalModel> physModels = CollectionLiterals.<PhysicalModel>newArrayList(); EList<Resource> _resources = rs.getResources(); final Procedure1<Resource> _function = new Procedure1<Resource>() { + @Override public void apply(final Resource it) { EList<EObject> _contents = it.getContents(); final Function1<EObject, Boolean> _function = new Function1<EObject, Boolean>() { + @Override public Boolean apply(final EObject it) { boolean _switchResult = false; boolean _matched = false; - if (!_matched) { - if (it instanceof RoomModel) { - _matched=true; - _switchResult = roomModels.add(((RoomModel)it)); - } + if (it instanceof RoomModel) { + _matched=true; + _switchResult = roomModels.add(((RoomModel)it)); } if (!_matched) { if (it instanceof PhysicalModel) { @@ -101,9 +101,11 @@ public class TestInstanceCreator { IterableExtensions.<Resource>forEach(_resources, _function); ArrayList<SubSystemClass> _newArrayList = CollectionLiterals.<SubSystemClass>newArrayList(); final Function2<ArrayList<SubSystemClass>, RoomModel, ArrayList<SubSystemClass>> _function_1 = new Function2<ArrayList<SubSystemClass>, RoomModel, ArrayList<SubSystemClass>>() { + @Override public ArrayList<SubSystemClass> apply(final ArrayList<SubSystemClass> list, final RoomModel model) { EList<SubSystemClass> _subSystemClasses = model.getSubSystemClasses(); final Function1<SubSystemClass, Boolean> _function = new Function1<SubSystemClass, Boolean>() { + @Override public Boolean apply(final SubSystemClass it) { return Boolean.valueOf(TestInstanceCreator.this.hasTestAnnotation(it)); } @@ -118,28 +120,33 @@ public class TestInstanceCreator { { SubSystemClass _createSubSystemClass = this._roomFactory.createSubSystemClass(); final Procedure1<SubSystemClass> _function_2 = new Procedure1<SubSystemClass>() { + @Override public void apply(final SubSystemClass it) { it.setName("DerivedTestSubSystem"); } }; final SubSystemClass derivedSubSystem = ObjectExtensions.<SubSystemClass>operator_doubleArrow(_createSubSystemClass, _function_2); final Procedure1<RoomModel> _function_3 = new Procedure1<RoomModel>() { + @Override public void apply(final RoomModel model) { EList<ActorRef> _actorRefs = derivedSubSystem.getActorRefs(); EList<ActorClass> _actorClasses = model.getActorClasses(); final Function1<ActorClass, Boolean> _function = new Function1<ActorClass, Boolean>() { + @Override public Boolean apply(final ActorClass it) { return Boolean.valueOf(TestInstanceCreator.this.hasTestAnnotation(it)); } }; Iterable<ActorClass> _filter = IterableExtensions.<ActorClass>filter(_actorClasses, _function); final Function1<ActorClass, ActorRef> _function_1 = new Function1<ActorClass, ActorRef>() { + @Override public ActorRef apply(final ActorClass ac) { ActorRef _xblockexpression = null; { allAnnotatedClasses.add(ac); ActorRef _createActorRef = TestInstanceCreator.this._roomFactory.createActorRef(); final Procedure1<ActorRef> _function = new Procedure1<ActorRef>() { + @Override public void apply(final ActorRef it) { String _name = ac.getName(); String _plus = ("ref_" + _name); @@ -172,6 +179,7 @@ public class TestInstanceCreator { boolean _greaterThan = (_size > 1); if (_greaterThan) { final Procedure1<StructureClass> _function_2 = new Procedure1<StructureClass>() { + @Override public void apply(final StructureClass roomCls) { StringConcatenation _builder = new StringConcatenation(); _builder.append("TestInstanceCreator: mapping failed, multiple test instances present"); @@ -183,6 +191,7 @@ public class TestInstanceCreator { } ArrayList<PhysicalSystem> _newArrayList_1 = CollectionLiterals.<PhysicalSystem>newArrayList(); final Function2<ArrayList<PhysicalSystem>, PhysicalModel, ArrayList<PhysicalSystem>> _function_3 = new Function2<ArrayList<PhysicalSystem>, PhysicalModel, ArrayList<PhysicalSystem>>() { + @Override public ArrayList<PhysicalSystem> apply(final ArrayList<PhysicalSystem> list, final PhysicalModel model) { EList<PhysicalSystem> _systems = model.getSystems(); Iterables.<PhysicalSystem>addAll(list, _systems); @@ -216,6 +225,7 @@ public class TestInstanceCreator { final SubSystemClass testSubSystem = IterableExtensions.<SubSystemClass>head(allTestSubSystems); LogicalSystem _createLogicalSystem = this._roomFactory.createLogicalSystem(); final Procedure1<LogicalSystem> _function_4 = new Procedure1<LogicalSystem>() { + @Override public void apply(final LogicalSystem it) { it.setName("DerivedTestSystem"); } @@ -224,6 +234,7 @@ public class TestInstanceCreator { EList<SubSystemRef> _subSystems = testSystem.getSubSystems(); SubSystemRef _createSubSystemRef = this._roomFactory.createSubSystemRef(); final Procedure1<SubSystemRef> _function_5 = new Procedure1<SubSystemRef>() { + @Override public void apply(final SubSystemRef it) { String _name = testSubSystem.getName(); String _plus = ("ref_" + _name); @@ -235,6 +246,7 @@ public class TestInstanceCreator { _subSystems.add(_doubleArrow); RoomModel _createRoomModel = this._roomFactory.createRoomModel(); final Procedure1<RoomModel> _function_6 = new Procedure1<RoomModel>() { + @Override public void apply(final RoomModel it) { it.setName("DerivedTestRoomModel"); EList<LogicalSystem> _systems = it.getSystems(); @@ -246,20 +258,24 @@ public class TestInstanceCreator { final RoomModel testRoomModel = ObjectExtensions.<RoomModel>operator_doubleArrow(_createRoomModel, _function_6); MappingModel _createMappingModel = this._eTMapFactory.createMappingModel(); final Procedure1<MappingModel> _function_7 = new Procedure1<MappingModel>() { + @Override public void apply(final MappingModel it) { it.setName("DerivedTestMappingModel"); EList<Mapping> _mappings = it.getMappings(); Mapping _createMapping = TestInstanceCreator.this._eTMapFactory.createMapping(); final Procedure1<Mapping> _function = new Procedure1<Mapping>() { + @Override public void apply(final Mapping it) { it.setLogicalSys(testSystem); it.setPhysicalSys(physSystem); EList<SubSystemMapping> _subsysMappings = it.getSubsysMappings(); EList<SubSystemRef> _subSystems = testSystem.getSubSystems(); final Function1<SubSystemRef, SubSystemMapping> _function = new Function1<SubSystemRef, SubSystemMapping>() { + @Override public SubSystemMapping apply(final SubSystemRef subSysRef) { SubSystemMapping _createSubSystemMapping = TestInstanceCreator.this._eTMapFactory.createSubSystemMapping(); final Procedure1<SubSystemMapping> _function = new Procedure1<SubSystemMapping>() { + @Override public void apply(final SubSystemMapping it) { it.setLogicalSubSys(subSysRef); EList<NodeRef> _nodeRefs = physSystem.getNodeRefs(); @@ -318,6 +334,7 @@ public class TestInstanceCreator { protected boolean hasTestAnnotation(final StructureClass cls) { EList<Annotation> _annotations = cls.getAnnotations(); final Function1<Annotation, Boolean> _function = new Function1<Annotation, Boolean>() { + @Override public Boolean apply(final Annotation it) { AnnotationType _type = it.getType(); String _name = _type.getName(); diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java index fd03e85ea..e3193f69f 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java @@ -129,16 +129,7 @@ public class TypeHelpers { } public boolean isBoolean(final DataType type) { - boolean _and = false; - boolean _isPrimitive = this.isPrimitive(type); - if (!_isPrimitive) { - _and = false; - } else { - LiteralType _type = ((PrimitiveType) type).getType(); - boolean _equals = Objects.equal(_type, LiteralType.BOOL); - _and = _equals; - } - return _and; + return (this.isPrimitive(type) && Objects.equal(((PrimitiveType) type).getType(), LiteralType.BOOL)); } public boolean isEnumeration(final DataType type) { @@ -146,13 +137,7 @@ public class TypeHelpers { } public boolean isEnumerationOrPrimitive(final DataType type) { - boolean _or = false; - if ((type instanceof EnumerationType)) { - _or = true; - } else { - _or = (type instanceof PrimitiveType); - } - return _or; + return ((type instanceof EnumerationType) || (type instanceof PrimitiveType)); } public boolean isDataClass(final DataType type) { @@ -165,25 +150,15 @@ public class TypeHelpers { } public boolean isCharacterType(final DataType type) { - boolean _and = false; - boolean _isPrimitive = this.isPrimitive(type); - if (!_isPrimitive) { - _and = false; - } else { - boolean _isCharacterType = this.isCharacterType(((PrimitiveType) type)); - _and = _isCharacterType; - } - return _and; + return (this.isPrimitive(type) && this.isCharacterType(((PrimitiveType) type))); } public String getAttrInstanceConfigValue(final List<Attribute> attributePath, final InstanceBase instance) { String _switchResult = null; boolean _matched = false; - if (!_matched) { - if (instance instanceof ActorInstance) { - _matched=true; - _switchResult = this.dataConfigExt.getAttrInstanceConfigValue(((ActorInstance)instance), attributePath); - } + if (instance instanceof ActorInstance) { + _matched=true; + _switchResult = this.dataConfigExt.getAttrInstanceConfigValue(((ActorInstance)instance), attributePath); } if (!_matched) { if (instance instanceof InterfaceItemInstance) { @@ -196,14 +171,7 @@ public class TypeHelpers { public String getAttrClassConfigValue(final List<Attribute> attributePath, final ActorClass actor, final boolean inherite) { String result = this.dataConfigExt.getAttrClassConfigValue(actor, attributePath); - boolean _and = false; - boolean _equals = Objects.equal(result, null); - if (!_equals) { - _and = false; - } else { - _and = inherite; - } - if (_and) { + if ((Objects.equal(result, null) && inherite)) { ActorClass base = actor.getActorBase(); while (((!Objects.equal(base, null)) && Objects.equal(result, null))) { { diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/CustomCompletionProposal.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/CustomCompletionProposal.java index 6cc698f6f..0b3b29f61 100644 --- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/CustomCompletionProposal.java +++ b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/CustomCompletionProposal.java @@ -27,6 +27,7 @@ public class CustomCompletionProposal implements ICompletionProposal { private final Point selection; + @Override public Point getSelection(final IDocument document) { Point _xifexpression = null; boolean _notEquals = (!Objects.equal(this.selection, null)); diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionAssistParser.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionAssistParser.java index 7acb9819c..a82d96e23 100644 --- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionAssistParser.java +++ b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionAssistParser.java @@ -34,10 +34,12 @@ public class DetailExpressionAssistParser { private final IDetailExpressionProvider provider; private final IWordDetector anyIdScanner = new IWordDetector() { + @Override public boolean isWordPart(final char c) { return Character.isJavaIdentifierPart(c); } + @Override public boolean isWordStart(final char c) { return Character.isJavaIdentifierStart(c); } @@ -59,13 +61,11 @@ public class DetailExpressionAssistParser { char _char = this.document.getChar((offset - 1)); String _string = Character.valueOf(_char).toString(); boolean _matched = false; - if (!_matched) { - if (Objects.equal(_string, ")")) { - _matched=true; - postfixResult = IDetailExpressionProvider.ExpressionPostfix.PARENTHESES; - openingChar = '('; - closingChar = ')'; - } + if (Objects.equal(_string, ")")) { + _matched=true; + postfixResult = IDetailExpressionProvider.ExpressionPostfix.PARENTHESES; + openingChar = '('; + closingChar = ')'; } if (!_matched) { if (Objects.equal(_string, "]")) { @@ -88,11 +88,9 @@ public class DetailExpressionAssistParser { start--; char _char_1 = this.document.getChar(start); boolean _matched_1 = false; - if (!_matched_1) { - if (Objects.equal(_char_1, openingChar)) { - _matched_1=true; - counter--; - } + if (Objects.equal(_char_1, openingChar)) { + _matched_1=true; + counter--; } if (!_matched_1) { if (Objects.equal(_char_1, closingChar)) { @@ -174,6 +172,7 @@ public class DetailExpressionAssistParser { final IDetailExpressionProvider.ExpressionFeature firstParseResult = parsedFeatures.pop(); List<IDetailExpressionProvider.ExpressionFeature> _initialFeatures = this.provider.getInitialFeatures(); final Function1<IDetailExpressionProvider.ExpressionFeature, Boolean> _function = new Function1<IDetailExpressionProvider.ExpressionFeature, Boolean>() { + @Override public Boolean apply(final IDetailExpressionProvider.ExpressionFeature it) { return Boolean.valueOf(DetailExpressionAssistParser.this.matches(it, firstParseResult)); } @@ -184,6 +183,7 @@ public class DetailExpressionAssistParser { final IDetailExpressionProvider.ExpressionFeature nextParseResult = parsedFeatures.pop(); List<IDetailExpressionProvider.ExpressionFeature> _contextFeatures = this.provider.getContextFeatures(lastMatch); final Function1<IDetailExpressionProvider.ExpressionFeature, Boolean> _function_1 = new Function1<IDetailExpressionProvider.ExpressionFeature, Boolean>() { + @Override public Boolean apply(final IDetailExpressionProvider.ExpressionFeature it) { return Boolean.valueOf(DetailExpressionAssistParser.this.matches(it, nextParseResult)); } @@ -199,34 +199,11 @@ public class DetailExpressionAssistParser { * non-empty id + not-null suffix */ private boolean isValid(final IDetailExpressionProvider.ExpressionFeature feature) { - boolean _and = false; - String _id = feature.getId(); - boolean _isEmpty = Strings.isEmpty(_id); - boolean _not = (!_isEmpty); - if (!_not) { - _and = false; - } else { - IDetailExpressionProvider.ExpressionPostfix _postfix = feature.getPostfix(); - boolean _notEquals = (!Objects.equal(_postfix, null)); - _and = _notEquals; - } - return _and; + return ((!Strings.isEmpty(feature.getId())) && (!Objects.equal(feature.getPostfix(), null))); } private boolean matches(final IDetailExpressionProvider.ExpressionFeature f1, final IDetailExpressionProvider.ExpressionFeature f2) { - boolean _and = false; - String _id = f1.getId(); - String _id_1 = f2.getId(); - boolean _equals = Objects.equal(_id, _id_1); - if (!_equals) { - _and = false; - } else { - IDetailExpressionProvider.ExpressionPostfix _postfix = f1.getPostfix(); - IDetailExpressionProvider.ExpressionPostfix _postfix_1 = f2.getPostfix(); - boolean _equals_1 = Objects.equal(_postfix, _postfix_1); - _and = _equals_1; - } - return _and; + return (Objects.equal(f1.getId(), f2.getId()) && Objects.equal(f1.getPostfix(), f2.getPostfix())); } public DetailExpressionAssistParser(final IDocument document, final int invocationOffset, final IDetailExpressionProvider provider) { diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionUIProvider.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionUIProvider.java index f52811d5e..d6e852a19 100644 --- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionUIProvider.java +++ b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionUIProvider.java @@ -87,18 +87,17 @@ public class DetailExpressionUIProvider implements IDetailExpressionProvider { Object _data = feature.getData(); final Object data = _data; boolean _matched = false; - if (!_matched) { - if (data instanceof Operation) { - _matched=true; - EList<VarDecl> _arguments = ((Operation)data).getArguments(); - final Function1<VarDecl, String> _function = new Function1<VarDecl, String>() { - public String apply(final VarDecl it) { - return it.getName(); - } - }; - List<String> _map = ListExtensions.<VarDecl, String>map(_arguments, _function); - _switchResult_1 = IterableExtensions.join(_map, ", "); - } + if (data instanceof Operation) { + _matched=true; + EList<VarDecl> _arguments = ((Operation)data).getArguments(); + final Function1<VarDecl, String> _function = new Function1<VarDecl, String>() { + @Override + public String apply(final VarDecl it) { + return it.getName(); + } + }; + List<String> _map = ListExtensions.<VarDecl, String>map(_arguments, _function); + _switchResult_1 = IterableExtensions.join(_map, ", "); } if (!_matched) { if (data instanceof Message) { @@ -173,11 +172,9 @@ public class DetailExpressionUIProvider implements IDetailExpressionProvider { Object _data = feature.getData(); final Object data = _data; boolean _matched = false; - if (!_matched) { - if (data instanceof InterfaceItem) { - _matched=true; - _switchResult = ActionCodeColorManager.INTERFACE_ITEM; - } + if (data instanceof InterfaceItem) { + _matched=true; + _switchResult = ActionCodeColorManager.INTERFACE_ITEM; } if (!_matched) { if (data instanceof Attribute) { @@ -227,14 +224,12 @@ public class DetailExpressionUIProvider implements IDetailExpressionProvider { } String classInfo = _xifexpression; boolean _matched = false; - if (!_matched) { - if (data instanceof Attribute) { - _matched=true; - RefableType _type = ((Attribute)data).getType(); - DataType _type_1 = _type.getType(); - String _name = _type_1.getName(); - typedInfo = _name; - } + if (data instanceof Attribute) { + _matched=true; + RefableType _type = ((Attribute)data).getType(); + DataType _type_1 = _type.getType(); + String _name = _type_1.getName(); + typedInfo = _name; } if (!_matched) { if (data instanceof InterfaceItem) { @@ -279,31 +274,21 @@ public class DetailExpressionUIProvider implements IDetailExpressionProvider { boolean _equals = Objects.equal(_postfix, IDetailExpressionProvider.ExpressionPostfix.NONE); if (_equals) { boolean _matched_1 = false; + if (data instanceof SPP) { + boolean _isEventDriven = ((SPP)data).isEventDriven(); + if (_isEventDriven) { + _matched_1=true; + } + } if (!_matched_1) { - if (data instanceof SPP) { - boolean _isEventDriven = ((SPP)data).isEventDriven(); - if (_isEventDriven) { + if (data instanceof Port) { + if ((((Port)data).isReplicated() && ((Port)data).isEventDriven())) { _matched_1=true; } } - if (!_matched_1) { - if (data instanceof Port) { - boolean _and = false; - boolean _isReplicated = ((Port)data).isReplicated(); - if (!_isReplicated) { - _and = false; - } else { - boolean _isEventDriven = ((Port)data).isEventDriven(); - _and = _isEventDriven; - } - if (_and) { - _matched_1=true; - } - } - } - if (_matched_1) { - completionInfo = (completionInfo + " (broadcast)"); - } + } + if (_matched_1) { + completionInfo = (completionInfo + " (broadcast)"); } } boolean _isEmpty = typedInfo.isEmpty(); @@ -326,12 +311,10 @@ public class DetailExpressionUIProvider implements IDetailExpressionProvider { Image _switchResult = null; Object _data = feature.getData(); boolean _matched = false; - if (!_matched) { - if (_data instanceof EObject) { - _matched=true; - Object _data_1 = feature.getData(); - _switchResult = this.labelProvider.getImage(_data_1); - } + if (_data instanceof EObject) { + _matched=true; + Object _data_1 = feature.getData(); + _switchResult = this.labelProvider.getImage(_data_1); } if (!_matched) { if (_data instanceof RuntimeDetailExpressionProvider.RuntimeMethodExpressionData) { @@ -350,6 +333,7 @@ public class DetailExpressionUIProvider implements IDetailExpressionProvider { public Iterable<IDetailExpressionProvider.ExpressionFeature> getContextFeaturesWithPrefix(final IDetailExpressionProvider.ExpressionFeature ctx, final String prefix) { List<IDetailExpressionProvider.ExpressionFeature> _contextFeatures = this.delegate.getContextFeatures(ctx); final Function1<IDetailExpressionProvider.ExpressionFeature, Boolean> _function = new Function1<IDetailExpressionProvider.ExpressionFeature, Boolean>() { + @Override public Boolean apply(final IDetailExpressionProvider.ExpressionFeature it) { String _id = it.getId(); return Boolean.valueOf(_id.startsWith(prefix)); @@ -364,6 +348,7 @@ public class DetailExpressionUIProvider implements IDetailExpressionProvider { public Iterable<IDetailExpressionProvider.ExpressionFeature> getInitialFeaturesWithPrefix(final String prefix) { List<IDetailExpressionProvider.ExpressionFeature> _initialFeatures = this.delegate.getInitialFeatures(); final Function1<IDetailExpressionProvider.ExpressionFeature, Boolean> _function = new Function1<IDetailExpressionProvider.ExpressionFeature, Boolean>() { + @Override public Boolean apply(final IDetailExpressionProvider.ExpressionFeature it) { String _id = it.getId(); return Boolean.valueOf(_id.startsWith(prefix)); @@ -388,11 +373,11 @@ public class DetailExpressionUIProvider implements IDetailExpressionProvider { this.delegate = delegate; } - public List<IDetailExpressionProvider.ExpressionFeature> getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { - return this.delegate.getContextFeatures(ctx); - } - public List<IDetailExpressionProvider.ExpressionFeature> getInitialFeatures() { return this.delegate.getInitialFeatures(); } + + public List<IDetailExpressionProvider.ExpressionFeature> getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { + return this.delegate.getContextFeatures(ctx); + } } diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/editor/AbstractFSMDiagramBehavior.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/editor/AbstractFSMDiagramBehavior.java index f03eb2c9b..7dc1a9eb2 100644 --- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/editor/AbstractFSMDiagramBehavior.java +++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/editor/AbstractFSMDiagramBehavior.java @@ -39,7 +39,7 @@ public class AbstractFSMDiagramBehavior extends CustomDiagramBehavior { * Add the DiagnosingModelObserver to the diagram business model when enabling adapters */ @Override - protected void enableAdapters() { + public void enableAdapters() { AbstractFSMEditor editor = (AbstractFSMEditor)getDiagramContainer(); DiagnosingModelObserver dmObserver = editor.getDiagnosingModelObserver(); if(dmObserver != null) dmObserver.enable(); @@ -51,7 +51,7 @@ public class AbstractFSMDiagramBehavior extends CustomDiagramBehavior { * disabling adapters */ @Override - protected void disableAdapters() { + public void disableAdapters() { AbstractFSMEditor editor = (AbstractFSMEditor)getDiagramContainer(); DiagnosingModelObserver dmObserver = editor.getDiagnosingModelObserver(); if(dmObserver != null) dmObserver.disable(); diff --git a/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/DefaultDetailExpressionProvider.java b/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/DefaultDetailExpressionProvider.java index de7125f7d..81e83705e 100644 --- a/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/DefaultDetailExpressionProvider.java +++ b/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/DefaultDetailExpressionProvider.java @@ -42,6 +42,7 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; @FinalFieldsConstructor @SuppressWarnings("all") public class DefaultDetailExpressionProvider extends GuardDetailExpressionProvider { + @Override public List<IDetailExpressionProvider.ExpressionFeature> getInitialFeatures() { final List<IDetailExpressionProvider.ExpressionFeature> scope = CollectionLiterals.<IDetailExpressionProvider.ExpressionFeature>newArrayList(); boolean _notEquals = (!Objects.equal(this.transitionEventData, null)); @@ -51,36 +52,27 @@ public class DefaultDetailExpressionProvider extends GuardDetailExpressionProvid } List<InterfaceItem> _allInterfaceItems = this.roomHelpers.getAllInterfaceItems(this.actorClass); final Procedure1<InterfaceItem> _function = new Procedure1<InterfaceItem>() { + @Override public void apply(final InterfaceItem it) { boolean _matched = false; + if (it instanceof SPP) { + boolean _isEventDriven = ((SPP)it).isEventDriven(); + if (_isEventDriven) { + _matched=true; + } + } if (!_matched) { - if (it instanceof SPP) { - boolean _isEventDriven = ((SPP)it).isEventDriven(); - if (_isEventDriven) { + if (it instanceof Port) { + if ((((Port)it).isEventDriven() && ((Port)it).isReplicated())) { _matched=true; } } - if (!_matched) { - if (it instanceof Port) { - boolean _and = false; - boolean _isEventDriven = ((Port)it).isEventDriven(); - if (!_isEventDriven) { - _and = false; - } else { - boolean _isReplicated = ((Port)it).isReplicated(); - _and = _isReplicated; - } - if (_and) { - _matched=true; - } - } - } - if (_matched) { - IDetailExpressionProvider.ExpressionFeature _createExprFeature = DefaultDetailExpressionProvider.this.createExprFeature(it); - scope.add(_createExprFeature); - IDetailExpressionProvider.ExpressionFeature _createExprFeature_1 = DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); - scope.add(_createExprFeature_1); - } + } + if (_matched) { + IDetailExpressionProvider.ExpressionFeature _createExprFeature = DefaultDetailExpressionProvider.this.createExprFeature(it); + scope.add(_createExprFeature); + IDetailExpressionProvider.ExpressionFeature _createExprFeature_1 = DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); + scope.add(_createExprFeature_1); } if (!_matched) { if (it instanceof Port) { @@ -108,6 +100,7 @@ public class DefaultDetailExpressionProvider extends GuardDetailExpressionProvid IterableExtensions.<InterfaceItem>forEach(_allInterfaceItems, _function); List<StandardOperation> _latestOperations = this.roomHelpers.getLatestOperations(this.actorClass); final Function1<StandardOperation, IDetailExpressionProvider.ExpressionFeature> _function_1 = new Function1<StandardOperation, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final StandardOperation it) { return DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); } @@ -116,17 +109,16 @@ public class DefaultDetailExpressionProvider extends GuardDetailExpressionProvid Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map); List<Attribute> _allAttributes = this.roomHelpers.getAllAttributes(this.actorClass); final Function1<Attribute, IDetailExpressionProvider.ExpressionFeature> _function_2 = new Function1<Attribute, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final Attribute it) { IDetailExpressionProvider.ExpressionFeature _switchResult = null; int _size = it.getSize(); boolean _matched = false; - if (!_matched) { - int _size_1 = it.getSize(); - boolean _greaterThan = (_size_1 > 1); - if (_greaterThan) { - _matched=true; - _switchResult = DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); - } + int _size_1 = it.getSize(); + boolean _greaterThan = (_size_1 > 1); + if (_greaterThan) { + _matched=true; + _switchResult = DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); } if (!_matched) { _switchResult = DefaultDetailExpressionProvider.this.createExprFeature(it); @@ -139,87 +131,88 @@ public class DefaultDetailExpressionProvider extends GuardDetailExpressionProvid return scope; } + @Override public List<IDetailExpressionProvider.ExpressionFeature> getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { this.assertNotNull(ctx); final List<IDetailExpressionProvider.ExpressionFeature> scope = CollectionLiterals.<IDetailExpressionProvider.ExpressionFeature>newArrayList(); Object _data = ctx.getData(); final Object obj = _data; boolean _matched = false; + if (obj instanceof Port) { + int _multiplicity = ((Port)obj).getMultiplicity(); + boolean _equals = (_multiplicity == 1); + if (_equals) { + _matched=true; + } + } if (!_matched) { - if (obj instanceof Port) { - int _multiplicity = ((Port)obj).getMultiplicity(); - boolean _equals = (_multiplicity == 1); - if (_equals) { - _matched=true; - } + if (obj instanceof SAP) { + _matched=true; } - if (!_matched) { - if (obj instanceof SAP) { - _matched=true; + } + if (_matched) { + ProtocolClass _protocol = this.roomHelpers.getProtocol(((InterfaceItem)obj)); + boolean _isConjugated = this.roomHelpers.isConjugated(((InterfaceItem)obj)); + boolean _not = (!_isConjugated); + List<PortOperation> _allOperations = this.roomHelpers.getAllOperations(_protocol, _not); + final Function1<PortOperation, IDetailExpressionProvider.ExpressionFeature> _function = new Function1<PortOperation, IDetailExpressionProvider.ExpressionFeature>() { + @Override + public IDetailExpressionProvider.ExpressionFeature apply(final PortOperation it) { + return DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); } - } - if (_matched) { - ProtocolClass _protocol = this.roomHelpers.getProtocol(((InterfaceItem)obj)); - boolean _isConjugated = this.roomHelpers.isConjugated(((InterfaceItem)obj)); - boolean _not = (!_isConjugated); - List<PortOperation> _allOperations = this.roomHelpers.getAllOperations(_protocol, _not); - final Function1<PortOperation, IDetailExpressionProvider.ExpressionFeature> _function = new Function1<PortOperation, IDetailExpressionProvider.ExpressionFeature>() { - public IDetailExpressionProvider.ExpressionFeature apply(final PortOperation it) { - return DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); - } - }; - List<IDetailExpressionProvider.ExpressionFeature> _map = ListExtensions.<PortOperation, IDetailExpressionProvider.ExpressionFeature>map(_allOperations, _function); - Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map); - } + }; + List<IDetailExpressionProvider.ExpressionFeature> _map = ListExtensions.<PortOperation, IDetailExpressionProvider.ExpressionFeature>map(_allOperations, _function); + Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map); } Object _data_1 = ctx.getData(); final Object obj_1 = _data_1; boolean _matched_1 = false; - if (!_matched_1) { - if (obj_1 instanceof InterfaceItem) { - _matched_1=true; - final ProtocolClass pc = this.roomHelpers.getProtocol(((InterfaceItem)obj_1)); - CommunicationType _commType = pc.getCommType(); - if (_commType != null) { - switch (_commType) { - case EVENT_DRIVEN: - boolean _isConjugated_1 = this.roomHelpers.isConjugated(((InterfaceItem)obj_1)); - List<Message> _allMessages = this.roomHelpers.getAllMessages(pc, _isConjugated_1); - final Function1<Message, IDetailExpressionProvider.ExpressionFeature> _function_1 = new Function1<Message, IDetailExpressionProvider.ExpressionFeature>() { + if (obj_1 instanceof InterfaceItem) { + _matched_1=true; + final ProtocolClass pc = this.roomHelpers.getProtocol(((InterfaceItem)obj_1)); + CommunicationType _commType = pc.getCommType(); + if (_commType != null) { + switch (_commType) { + case EVENT_DRIVEN: + boolean _isConjugated_1 = this.roomHelpers.isConjugated(((InterfaceItem)obj_1)); + List<Message> _allMessages = this.roomHelpers.getAllMessages(pc, _isConjugated_1); + final Function1<Message, IDetailExpressionProvider.ExpressionFeature> _function_1 = new Function1<Message, IDetailExpressionProvider.ExpressionFeature>() { + @Override + public IDetailExpressionProvider.ExpressionFeature apply(final Message it) { + return DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); + } + }; + List<IDetailExpressionProvider.ExpressionFeature> _map_1 = ListExtensions.<Message, IDetailExpressionProvider.ExpressionFeature>map(_allMessages, _function_1); + Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map_1); + break; + case DATA_DRIVEN: + boolean _isConjugated_2 = this.roomHelpers.isConjugated(((InterfaceItem)obj_1)); + if (_isConjugated_2) { + List<Message> _allIncomingMessages = this.roomHelpers.getAllIncomingMessages(pc); + final Function1<Message, IDetailExpressionProvider.ExpressionFeature> _function_2 = new Function1<Message, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final Message it) { return DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); } }; - List<IDetailExpressionProvider.ExpressionFeature> _map_1 = ListExtensions.<Message, IDetailExpressionProvider.ExpressionFeature>map(_allMessages, _function_1); - Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map_1); - break; - case DATA_DRIVEN: - boolean _isConjugated_2 = this.roomHelpers.isConjugated(((InterfaceItem)obj_1)); - if (_isConjugated_2) { - List<Message> _allIncomingMessages = this.roomHelpers.getAllIncomingMessages(pc); - final Function1<Message, IDetailExpressionProvider.ExpressionFeature> _function_2 = new Function1<Message, IDetailExpressionProvider.ExpressionFeature>() { - public IDetailExpressionProvider.ExpressionFeature apply(final Message it) { - return DefaultDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); - } - }; - List<IDetailExpressionProvider.ExpressionFeature> _map_2 = ListExtensions.<Message, IDetailExpressionProvider.ExpressionFeature>map(_allIncomingMessages, _function_2); - Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map_2); - } else { - List<Message> _allIncomingMessages_1 = this.roomHelpers.getAllIncomingMessages(pc); - final Function1<Message, IDetailExpressionProvider.ExpressionFeature> _function_3 = new Function1<Message, IDetailExpressionProvider.ExpressionFeature>() { - public IDetailExpressionProvider.ExpressionFeature apply(final Message it) { - return DefaultDetailExpressionProvider.this.createExprFeature(it); - } - }; - List<IDetailExpressionProvider.ExpressionFeature> _map_3 = ListExtensions.<Message, IDetailExpressionProvider.ExpressionFeature>map(_allIncomingMessages_1, _function_3); - Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map_3); - } - break; - case SYNCHRONOUS: - break; - default: - break; - } + List<IDetailExpressionProvider.ExpressionFeature> _map_2 = ListExtensions.<Message, IDetailExpressionProvider.ExpressionFeature>map(_allIncomingMessages, _function_2); + Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map_2); + } else { + List<Message> _allIncomingMessages_1 = this.roomHelpers.getAllIncomingMessages(pc); + final Function1<Message, IDetailExpressionProvider.ExpressionFeature> _function_3 = new Function1<Message, IDetailExpressionProvider.ExpressionFeature>() { + @Override + public IDetailExpressionProvider.ExpressionFeature apply(final Message it) { + return DefaultDetailExpressionProvider.this.createExprFeature(it); + } + }; + List<IDetailExpressionProvider.ExpressionFeature> _map_3 = ListExtensions.<Message, IDetailExpressionProvider.ExpressionFeature>map(_allIncomingMessages_1, _function_3); + Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map_3); + } + break; + case SYNCHRONOUS: + break; + default: + break; } } } @@ -234,6 +227,7 @@ public class DefaultDetailExpressionProvider extends GuardDetailExpressionProvid final DataClass dc = ((DataClass) _type_3); List<Attribute> _allAttributes = this.roomHelpers.getAllAttributes(dc); final Function1<Attribute, IDetailExpressionProvider.ExpressionFeature> _function_1 = new Function1<Attribute, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final Attribute it) { IDetailExpressionProvider.ExpressionFeature _xifexpression = null; int _size = it.getSize(); diff --git a/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/GuardDetailExpressionProvider.java b/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/GuardDetailExpressionProvider.java index 75145f85f..b5c88cfa5 100644 --- a/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/GuardDetailExpressionProvider.java +++ b/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/GuardDetailExpressionProvider.java @@ -62,6 +62,7 @@ public class GuardDetailExpressionProvider implements IDetailExpressionProvider @Accessors(AccessorType.PUBLIC_SETTER) protected VarDecl transitionEventData; + @Override public List<IDetailExpressionProvider.ExpressionFeature> getInitialFeatures() { final List<IDetailExpressionProvider.ExpressionFeature> scope = CollectionLiterals.<IDetailExpressionProvider.ExpressionFeature>newArrayList(); boolean _notEquals = (!Objects.equal(this.transitionEventData, null)); @@ -71,31 +72,22 @@ public class GuardDetailExpressionProvider implements IDetailExpressionProvider } List<InterfaceItem> _allInterfaceItems = this.roomHelpers.getAllInterfaceItems(this.actorClass); final Function1<InterfaceItem, Boolean> _function = new Function1<InterfaceItem, Boolean>() { + @Override public Boolean apply(final InterfaceItem it) { - boolean _and = false; - boolean _isDataDriven = GuardDetailExpressionProvider.this.roomHelpers.isDataDriven(it); - if (!_isDataDriven) { - _and = false; - } else { - boolean _isConjugated = GuardDetailExpressionProvider.this.roomHelpers.isConjugated(it); - boolean _not = (!_isConjugated); - _and = _not; - } - return Boolean.valueOf(_and); + return Boolean.valueOf((GuardDetailExpressionProvider.this.roomHelpers.isDataDriven(it) && (!GuardDetailExpressionProvider.this.roomHelpers.isConjugated(it)))); } }; Iterable<InterfaceItem> _filter = IterableExtensions.<InterfaceItem>filter(_allInterfaceItems, _function); final Function1<InterfaceItem, IDetailExpressionProvider.ExpressionFeature> _function_1 = new Function1<InterfaceItem, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final InterfaceItem it) { IDetailExpressionProvider.ExpressionFeature _switchResult = null; boolean _matched = false; - if (!_matched) { - if (it instanceof Port) { - boolean _isReplicated = ((Port)it).isReplicated(); - if (_isReplicated) { - _matched=true; - _switchResult = GuardDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); - } + if (it instanceof Port) { + boolean _isReplicated = ((Port)it).isReplicated(); + if (_isReplicated) { + _matched=true; + _switchResult = GuardDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); } } if (!_matched) { @@ -108,6 +100,7 @@ public class GuardDetailExpressionProvider implements IDetailExpressionProvider Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map); List<StandardOperation> _latestOperations = this.roomHelpers.getLatestOperations(this.actorClass); final Function1<StandardOperation, IDetailExpressionProvider.ExpressionFeature> _function_2 = new Function1<StandardOperation, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final StandardOperation it) { return GuardDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); } @@ -116,17 +109,16 @@ public class GuardDetailExpressionProvider implements IDetailExpressionProvider Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map_1); List<Attribute> _allAttributes = this.roomHelpers.getAllAttributes(this.actorClass); final Function1<Attribute, IDetailExpressionProvider.ExpressionFeature> _function_3 = new Function1<Attribute, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final Attribute it) { IDetailExpressionProvider.ExpressionFeature _switchResult = null; int _size = it.getSize(); boolean _matched = false; - if (!_matched) { - int _size_1 = it.getSize(); - boolean _greaterThan = (_size_1 > 1); - if (_greaterThan) { - _matched=true; - _switchResult = GuardDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); - } + int _size_1 = it.getSize(); + boolean _greaterThan = (_size_1 > 1); + if (_greaterThan) { + _matched=true; + _switchResult = GuardDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); } if (!_matched) { _switchResult = GuardDetailExpressionProvider.this.createExprFeature(it); @@ -139,36 +131,36 @@ public class GuardDetailExpressionProvider implements IDetailExpressionProvider return scope; } + @Override public List<IDetailExpressionProvider.ExpressionFeature> getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { this.assertNotNull(ctx); final List<IDetailExpressionProvider.ExpressionFeature> scope = CollectionLiterals.<IDetailExpressionProvider.ExpressionFeature>newArrayList(); Object _data = ctx.getData(); final Object obj = _data; boolean _matched = false; - if (!_matched) { - if (obj instanceof InterfaceItem) { - _matched=true; - final ProtocolClass pc = this.roomHelpers.getProtocol(((InterfaceItem)obj)); - CommunicationType _commType = pc.getCommType(); - if (_commType != null) { - switch (_commType) { - case DATA_DRIVEN: - boolean _isConjugated = this.roomHelpers.isConjugated(((InterfaceItem)obj)); - boolean _not = (!_isConjugated); - if (_not) { - List<Message> _allIncomingMessages = this.roomHelpers.getAllIncomingMessages(pc); - final Function1<Message, IDetailExpressionProvider.ExpressionFeature> _function = new Function1<Message, IDetailExpressionProvider.ExpressionFeature>() { - public IDetailExpressionProvider.ExpressionFeature apply(final Message it) { - return GuardDetailExpressionProvider.this.createExprFeature(it); - } - }; - List<IDetailExpressionProvider.ExpressionFeature> _map = ListExtensions.<Message, IDetailExpressionProvider.ExpressionFeature>map(_allIncomingMessages, _function); - Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map); - } - break; - default: - break; - } + if (obj instanceof InterfaceItem) { + _matched=true; + final ProtocolClass pc = this.roomHelpers.getProtocol(((InterfaceItem)obj)); + CommunicationType _commType = pc.getCommType(); + if (_commType != null) { + switch (_commType) { + case DATA_DRIVEN: + boolean _isConjugated = this.roomHelpers.isConjugated(((InterfaceItem)obj)); + boolean _not = (!_isConjugated); + if (_not) { + List<Message> _allIncomingMessages = this.roomHelpers.getAllIncomingMessages(pc); + final Function1<Message, IDetailExpressionProvider.ExpressionFeature> _function = new Function1<Message, IDetailExpressionProvider.ExpressionFeature>() { + @Override + public IDetailExpressionProvider.ExpressionFeature apply(final Message it) { + return GuardDetailExpressionProvider.this.createExprFeature(it); + } + }; + List<IDetailExpressionProvider.ExpressionFeature> _map = ListExtensions.<Message, IDetailExpressionProvider.ExpressionFeature>map(_allIncomingMessages, _function); + Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map); + } + break; + default: + break; } } } @@ -183,6 +175,7 @@ public class GuardDetailExpressionProvider implements IDetailExpressionProvider final DataClass dc = ((DataClass) _type_3); List<Attribute> _allAttributes = this.roomHelpers.getAllAttributes(dc); final Function1<Attribute, IDetailExpressionProvider.ExpressionFeature> _function = new Function1<Attribute, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final Attribute it) { IDetailExpressionProvider.ExpressionFeature _xifexpression = null; int _size = it.getSize(); @@ -199,6 +192,7 @@ public class GuardDetailExpressionProvider implements IDetailExpressionProvider Iterables.<IDetailExpressionProvider.ExpressionFeature>addAll(scope, _map); List<StandardOperation> _latestOperations = this.roomHelpers.getLatestOperations(dc); final Function1<StandardOperation, IDetailExpressionProvider.ExpressionFeature> _function_1 = new Function1<StandardOperation, IDetailExpressionProvider.ExpressionFeature>() { + @Override public IDetailExpressionProvider.ExpressionFeature apply(final StandardOperation it) { return GuardDetailExpressionProvider.this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); } diff --git a/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/RuntimeDetailExpressionProvider.java b/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/RuntimeDetailExpressionProvider.java index f532f2c5f..4a9db9e51 100644 --- a/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/RuntimeDetailExpressionProvider.java +++ b/plugins/org.eclipse.etrice.ui.behavior/xtend-gen/org/eclipse/etrice/ui/behavior/detailcode/RuntimeDetailExpressionProvider.java @@ -24,34 +24,31 @@ public class RuntimeDetailExpressionProvider extends DefaultDetailExpressionProv public final static String RT_METHOD_GET_REPLICATION = "getReplication"; + @Override public List<IDetailExpressionProvider.ExpressionFeature> getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { final List<IDetailExpressionProvider.ExpressionFeature> scope = super.getContextFeatures(ctx); Object _data = ctx.getData(); final Object obj = _data; boolean _matched = false; - if (!_matched) { - if (obj instanceof InterfaceItem) { - _matched=true; - IDetailExpressionProvider.ExpressionPostfix _postfix = ctx.getPostfix(); - boolean _equals = Objects.equal(_postfix, IDetailExpressionProvider.ExpressionPostfix.NONE); - if (_equals) { - boolean _matched_1 = false; - if (!_matched_1) { - if (obj instanceof Port) { - boolean _isReplicated = ((Port)obj).isReplicated(); - if (_isReplicated) { - _matched_1=true; - } - } - if (!_matched_1) { - if (obj instanceof SPP) { - _matched_1=true; - } - } - if (_matched_1) { - } + if (obj instanceof InterfaceItem) { + _matched=true; + IDetailExpressionProvider.ExpressionPostfix _postfix = ctx.getPostfix(); + boolean _equals = Objects.equal(_postfix, IDetailExpressionProvider.ExpressionPostfix.NONE); + if (_equals) { + boolean _matched_1 = false; + if (obj instanceof Port) { + boolean _isReplicated = ((Port)obj).isReplicated(); + if (_isReplicated) { + _matched_1=true; } } + if (!_matched_1) { + if (obj instanceof SPP) { + _matched_1=true; + } + } + if (_matched_1) { + } } } return scope; diff --git a/plugins/org.eclipse.etrice.ui.common.base/.classpath b/plugins/org.eclipse.etrice.ui.common.base/.classpath index ad32c83a7..eca7bdba8 100644 --- a/plugins/org.eclipse.etrice.ui.common.base/.classpath +++ b/plugins/org.eclipse.etrice.ui.common.base/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/plugins/org.eclipse.etrice.ui.common.base/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.etrice.ui.common.base/.settings/org.eclipse.jdt.core.prefs index c537b6306..0c68a61dc 100644 --- a/plugins/org.eclipse.etrice.ui.common.base/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.etrice.ui.common.base/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugins/org.eclipse.etrice.ui.common.base/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.ui.common.base/META-INF/MANIFEST.MF index 8f9019c89..317b50a29 100644 --- a/plugins/org.eclipse.etrice.ui.common.base/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.ui.common.base/META-INF/MANIFEST.MF @@ -25,7 +25,7 @@ Require-Bundle: org.eclipse.etrice.core.common.ui;bundle-version="1.1.0", org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.100", org.eclipse.ui.ide;bundle-version="3.9.2", org.eclipse.help -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: org.apache.log4j Export-Package: org.eclipse.etrice.ui.common.base, diff --git a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/dialogs/AbstractPropertyDialog.java b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/dialogs/AbstractPropertyDialog.java index 350ca7bd6..b8482662d 100644 --- a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/dialogs/AbstractPropertyDialog.java +++ b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/dialogs/AbstractPropertyDialog.java @@ -70,7 +70,8 @@ import org.eclipse.ui.forms.widgets.Form; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.xtext.resource.IEObjectDescription; - +// note: the FormDialog of org.eclipse.ui.forms.source_3.7.0 requires JavaSE-1.8 +// therefore we need to set the BREE of this plug-in also to Java 8 public abstract class AbstractPropertyDialog extends FormDialog { private class GlobalStatus extends ComputedValue { diff --git a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/CustomUpdateBehavior.java b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/CustomUpdateBehavior.java index 3916cac29..1502fb98f 100644 --- a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/CustomUpdateBehavior.java +++ b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/CustomUpdateBehavior.java @@ -24,10 +24,9 @@ import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl; import org.eclipse.emf.workspace.IWorkspaceCommandStack; import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory; import org.eclipse.etrice.core.fsm.ui.FSMUiModule; -import org.eclipse.etrice.ui.common.base.editor.CustomResourceSetProvider; -import org.eclipse.etrice.ui.common.base.editor.IInputUriHolder; import org.eclipse.graphiti.ui.editor.DefaultUpdateBehavior; import org.eclipse.graphiti.ui.editor.DiagramBehavior; +import org.eclipse.graphiti.ui.editor.IDiagramEditorInput; import org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl; import org.eclipse.xtext.resource.XtextResourceSet; import org.eclipse.xtext.ui.resource.IResourceSetProvider; @@ -57,7 +56,7 @@ public class CustomUpdateBehavior extends DefaultUpdateBehavior { * @see org.eclipse.graphiti.ui.editor.DefaultUpdateBehavior#createEditingDomain() */ @Override - protected void createEditingDomain() { + protected void createEditingDomain(IDiagramEditorInput input) { ResourceSet resourceSet; if (diagramBehavior.getDiagramContainer() instanceof IInputUriHolder) { URI uri = ((IInputUriHolder)diagramBehavior.getDiagramContainer()).getInputUri(); diff --git a/plugins/org.eclipse.etrice.ui.layout/.classpath b/plugins/org.eclipse.etrice.ui.layout/.classpath deleted file mode 100644 index ad32c83a7..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/plugins/org.eclipse.etrice.ui.layout/.gitignore b/plugins/org.eclipse.etrice.ui.layout/.gitignore deleted file mode 100644 index ba077a403..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/plugins/org.eclipse.etrice.ui.layout/.project b/plugins/org.eclipse.etrice.ui.layout/.project deleted file mode 100644 index 1c2d0c1a3..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.etrice.ui.layout</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/plugins/org.eclipse.etrice.ui.layout/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.etrice.ui.layout/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c537b6306..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.etrice.ui.layout/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.ui.layout/META-INF/MANIFEST.MF deleted file mode 100644 index 41e05ab10..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/META-INF/MANIFEST.MF +++ /dev/null @@ -1,29 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: KIELER support for ETrice -Bundle-SymbolicName: org.eclipse.etrice.ui.layout;singleton:=true -Bundle-Version: 1.1.0.qualifier -Bundle-Vendor: Eclipse eTrice -Require-Bundle: org.eclipse.graphiti;bundle-version="0.8.1", - org.eclipse.graphiti.ui;bundle-version="0.8.1", - org.eclipse.gef;bundle-version="3.5.0", - org.eclipse.ui;bundle-version="3.5.0", - org.eclipse.core.runtime;bundle-version="3.5.0", - org.eclipse.emf.transaction;bundle-version="1.3.0", - org.eclipse.ui.ide;bundle-version="3.5.0", - org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.0", - com.google.guava;bundle-version="8.0.0", - de.cau.cs.kieler.core;bundle-version="0.8.0", - de.cau.cs.kieler.core.kgraph;bundle-version="0.4.1", - de.cau.cs.kieler.kiml.ui;bundle-version="0.7.1", - de.cau.cs.kieler.kiml.graphiti;bundle-version="0.2.0", - org.eclipse.etrice.ui.behavior;bundle-version="1.1.0", - org.eclipse.etrice.ui.behavior.fsm;bundle-version="1.1.0", - org.eclipse.etrice.ui.structure;bundle-version="1.1.0", - org.eclipse.etrice.ui.common;bundle-version="1.1.0", - org.eclipse.etrice.ui.common.base;bundle-version="1.1.0", - org.eclipse.etrice.core.room;bundle-version="1.1.0", - org.eclipse.etrice.core.fsm;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-ActivationPolicy: lazy -Bundle-Activator: org.eclipse.etrice.ui.layout.Activator diff --git a/plugins/org.eclipse.etrice.ui.layout/about.html b/plugins/org.eclipse.etrice.ui.layout/about.html deleted file mode 100644 index d35d5aed6..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 5, 2007</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> - -</body> -</html> diff --git a/plugins/org.eclipse.etrice.ui.layout/build.properties b/plugins/org.eclipse.etrice.ui.layout/build.properties deleted file mode 100644 index 0a3895ac9..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - epl-v10.html -src.includes = epl-v10.html diff --git a/plugins/org.eclipse.etrice.ui.layout/epl-v10.html b/plugins/org.eclipse.etrice.ui.layout/epl-v10.html deleted file mode 100644 index 9e4b628d6..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/epl-v10.html +++ /dev/null @@ -1,262 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> -<title>Eclipse Public License - Version 1.0</title> -<style type="text/css"> - body { - size: 8.5in 11.0in; - margin: 0.25in 0.5in 0.25in 0.5in; - tab-interval: 0.5in; - } - p { - margin-left: auto; - margin-top: 0.5em; - margin-bottom: 0.5em; - } - p.list { - margin-left: 0.5in; - margin-top: 0.05em; - margin-bottom: 0.05em; - } - </style> - -</head> - -<body lang="EN-US"> - -<p align=center><b>Eclipse Public License - v 1.0</b></p> - -<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR -DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS -AGREEMENT.</p> - -<p><b>1. DEFINITIONS</b></p> - -<p>"Contribution" means:</p> - -<p class="list">a) in the case of the initial Contributor, the initial -code and documentation distributed under this Agreement, and</p> -<p class="list">b) in the case of each subsequent Contributor:</p> - -<p class="list">i) changes to the Program, and</p> -<p class="list">ii) additions to the Program;</p> -<p class="list">where such changes and/or additions to the Program -originate from and are distributed by that particular Contributor. A -Contribution 'originates' from a Contributor if it was added to the -Program by such Contributor itself or anyone acting on such -Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in -conjunction with the Program under their own license agreement, and (ii) -are not derivative works of the Program.</p> - -<p>"Contributor" means any person or entity that distributes -the Program.</p> - -<p>"Licensed Patents" mean patent claims licensable by a -Contributor which are necessarily infringed by the use or sale of its -Contribution alone or when combined with the Program.</p> - -<p>"Program" means the Contributions distributed in accordance -with this Agreement.</p> - -<p>"Recipient" means anyone who receives the Program under -this Agreement, including all Contributors.</p> - -<p><b>2. GRANT OF RIGHTS</b></p> - -<p class="list">a) Subject to the terms of this Agreement, each -Contributor hereby grants Recipient a non-exclusive, worldwide, -royalty-free copyright license to reproduce, prepare derivative works -of, publicly display, publicly perform, distribute and sublicense the -Contribution of such Contributor, if any, and such derivative works, in -source code and object code form.</p> - -<p class="list">b) Subject to the terms of this Agreement, each -Contributor hereby grants Recipient a non-exclusive, worldwide, -royalty-free patent license under Licensed Patents to make, use, sell, -offer to sell, import and otherwise transfer the Contribution of such -Contributor, if any, in source code and object code form. This patent -license shall apply to the combination of the Contribution and the -Program if, at the time the Contribution is added by the Contributor, -such addition of the Contribution causes such combination to be covered -by the Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder.</p> - -<p class="list">c) Recipient understands that although each Contributor -grants the licenses to its Contributions set forth herein, no assurances -are provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility to -secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow Recipient -to distribute the Program, it is Recipient's responsibility to acquire -that license before distributing the Program.</p> - -<p class="list">d) Each Contributor represents that to its knowledge it -has sufficient copyright rights in its Contribution, if any, to grant -the copyright license set forth in this Agreement.</p> - -<p><b>3. REQUIREMENTS</b></p> - -<p>A Contributor may choose to distribute the Program in object code -form under its own license agreement, provided that:</p> - -<p class="list">a) it complies with the terms and conditions of this -Agreement; and</p> - -<p class="list">b) its license agreement:</p> - -<p class="list">i) effectively disclaims on behalf of all Contributors -all warranties and conditions, express and implied, including warranties -or conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose;</p> - -<p class="list">ii) effectively excludes on behalf of all Contributors -all liability for damages, including direct, indirect, special, -incidental and consequential damages, such as lost profits;</p> - -<p class="list">iii) states that any provisions which differ from this -Agreement are offered by that Contributor alone and not by any other -party; and</p> - -<p class="list">iv) states that source code for the Program is available -from such Contributor, and informs licensees how to obtain it in a -reasonable manner on or through a medium customarily used for software -exchange.</p> - -<p>When the Program is made available in source code form:</p> - -<p class="list">a) it must be made available under this Agreement; and</p> - -<p class="list">b) a copy of this Agreement must be included with each -copy of the Program.</p> - -<p>Contributors may not remove or alter any copyright notices contained -within the Program.</p> - -<p>Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution.</p> - -<p><b>4. COMMERCIAL DISTRIBUTION</b></p> - -<p>Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use of -the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create -potential liability for other Contributors. Therefore, if a Contributor -includes the Program in a commercial product offering, such Contributor -("Commercial Contributor") hereby agrees to defend and -indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") -arising from claims, lawsuits and other legal actions brought by a third -party against the Indemnified Contributor to the extent caused by the -acts or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In -order to qualify, an Indemnified Contributor must: a) promptly notify -the Commercial Contributor in writing of such claim, and b) allow the -Commercial Contributor to control, and cooperate with the Commercial -Contributor in, the defense and any related settlement negotiations. The -Indemnified Contributor may participate in any such claim at its own -expense.</p> - -<p>For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages.</p> - -<p><b>5. NO WARRANTY</b></p> - -<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS -OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, -ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable laws, -damage to or loss of data, programs or equipment, and unavailability or -interruption of operations.</p> - -<p><b>6. DISCLAIMER OF LIABILITY</b></p> - -<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT -NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p> - -<p><b>7. GENERAL</b></p> - -<p>If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further action -by the parties hereto, such provision shall be reformed to the minimum -extent necessary to make such provision valid and enforceable.</p> - -<p>If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that the -Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the -date such litigation is filed.</p> - -<p>All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of time -after becoming aware of such noncompliance. If all Recipient's rights -under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.</p> - -<p>Everyone is permitted to copy and distribute copies of this -Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The -Agreement Steward reserves the right to publish new versions (including -revisions) of this Agreement from time to time. No one other than the -Agreement Steward has the right to modify this Agreement. The Eclipse -Foundation is the initial Agreement Steward. The Eclipse Foundation may -assign the responsibility to serve as the Agreement Steward to a -suitable separate entity. Each new version of the Agreement will be -given a distinguishing version number. The Program (including -Contributions) may always be distributed subject to the version of the -Agreement under which it was received. In addition, after a new version -of the Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives no -rights or licenses to the intellectual property of any Contributor under -this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved.</p> - -<p>This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No party -to this Agreement will bring a legal action under this Agreement more -than one year after the cause of action arose. Each party waives its -rights to a jury trial in any resulting litigation.</p> - -</body> - -</html> diff --git a/plugins/org.eclipse.etrice.ui.layout/plugin.xml b/plugins/org.eclipse.etrice.ui.layout/plugin.xml deleted file mode 100644 index 1def84f93..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/plugin.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="de.cau.cs.kieler.kiml.ui.layoutManagers"> - <manager - class="org.eclipse.etrice.ui.layout.BehaviorDiagramLayoutManager" - priority="1"> - </manager> - <manager - class="org.eclipse.etrice.ui.layout.StructureDiagramLayoutManager" - priority="1"> - </manager> - </extension> - <extension - point="de.cau.cs.kieler.kiml.layoutInfo"> - <diagramType - id="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram" - name="eTrice Behavior Diagram"> - </diagramType> - <option - class="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram" - option="de.cau.cs.kieler.algorithm" - value="de.cau.cs.kieler.graphviz.dot"> - </option> - <option - class="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram" - option="de.cau.cs.kieler.borderSpacing" - value="30"> - </option> - <option - class="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram" - option="de.cau.cs.kieler.spacing" - value="50"> - </option> - <diagramType - id="org.eclipse.etrice.ui.layout.eTriceStructureDiagram" - name="eTrice Structure Diagram"> - </diagramType> - <option - class="org.eclipse.etrice.ui.layout.eTriceStructureDiagram" - option="de.cau.cs.kieler.algorithm" - value="de.cau.cs.kieler.klay.layered"> - </option> - <option - class="org.eclipse.etrice.ui.layout.eTriceStructureDiagram" - option="de.cau.cs.kieler.spacing" - value="50"> - </option> - <option - class="org.eclipse.etrice.ui.layout.eTriceStructureDiagram" - option="de.cau.cs.kieler.borderSpacing" - value="50"> - </option> - <config - class="org.eclipse.etrice.ui.layout.ETriceLayoutConfig"> - </config> - </extension> - <extension - point="org.eclipse.core.runtime.preferences"> - </extension> - <extension - point="org.eclipse.ui.preferencePages"> - <page - category="org.eclipse.etrice.ui.common.preferences.ETricePreferencePage" - class="org.eclipse.etrice.ui.layout.preferences.ETriceLayoutPreferencePage" - id="org.eclipse.etrice.ui.layout.preferences.ETriceLayoutPreferencePage" - name="Layout"> - </page> - <page - category="org.eclipse.etrice.ui.layout.preferences.ETriceLayoutPreferencePage" - class="org.eclipse.etrice.ui.layout.preferences.ETriceBehaviorPreferencePage" - id="org.eclipse.etrice.ui.layout.ETriceBehaviorPreferencePage" - name="Behavior"> - </page> - <page - category="org.eclipse.etrice.ui.layout.preferences.ETriceLayoutPreferencePage" - class="org.eclipse.etrice.ui.layout.preferences.EtriceStructurePreferencePage" - id="org.eclipse.etrice.ui.layout.ETriceStructurePreferencePage" - name="Structure"> - </page> - </extension> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - locationURI="popup:org.eclipse.ui.popup.any?after=additions"> - <command - commandId="de.cau.cs.kieler.kiml.ui.command.layout" - label="Layout" - style="push"> - <parameter - name="de.cau.cs.kieler.kiml.ui.layoutScope" - value="selection"> - </parameter> - <visibleWhen - checkEnabled="false"> - <with - variable="activeEditor"> - <test - property="de.cau.cs.kieler.kiml.ui.activeEditorIsSupported"> - </test> - </with> - </visibleWhen> - </command> - </menuContribution> - </extension> - -</plugin> diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/Activator.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/Activator.java deleted file mode 100644 index 90c62aef3..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/Activator.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import de.cau.cs.kieler.kiml.ui.KimlUiPlugin; - -/** - * The activator class which controls the plug-in life cycle. - * - * @author jayant - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.etrice.ui.layout"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Gets the common Preference Store which is shared with KIELER Preference page as well. - * - * @return the shared preference store - * - * @author jayant - * - */ - public IPreferenceStore getSharedPreferenceStore(){ - return (KimlUiPlugin.getDefault().getPreferenceStore()); - - } -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java deleted file mode 100644 index c4485fa1a..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java +++ /dev/null @@ -1,182 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.TrPoint; -import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor; -import org.eclipse.etrice.ui.behavior.fsm.support.StateSupport; -import org.eclipse.graphiti.mm.pictograms.Anchor; -import org.eclipse.graphiti.mm.pictograms.Diagram; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.eclipse.graphiti.mm.pictograms.Shape; -import org.eclipse.graphiti.ui.internal.parts.IPictogramElementEditPart; - -import de.cau.cs.kieler.core.kgraph.KNode; -import de.cau.cs.kieler.kiml.graphiti.KimlGraphitiUtil; -import de.cau.cs.kieler.kiml.ui.diagram.LayoutMapping; -import de.cau.cs.kieler.kiml.util.KimlUtil; - -/** - * Layout Manager implementation for eTrice Structure Editor. - * - * @author jayant - */ -@SuppressWarnings("restriction") -public class BehaviorDiagramLayoutManager extends ETriceDiagramLayoutManager { - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean supports(final Object object) { - - return object instanceof BehaviorEditor - || object instanceof IPictogramElementEditPart - || object instanceof PictogramElement; - - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void buildLayoutGraphForBoundingBox( - LayoutMapping<PictogramElement> mapping, Diagram diagram, - KNode diagramNode, boolean onlyVisible) { - - if (onlyVisible) { - for (Shape boundingBox : ((Diagram) diagram).getChildren()) { - if (boundingBox.isVisible()) { - buildAllLevels(mapping, boundingBox, diagramNode); - break; - } - } - } else { - // This happens when the user requests Layout of the whole hierarchy - // of Diagrams in the behavior editor - // FIXME need to be corrected. - for (Shape boundingBox : ((Diagram) diagram).getChildren()) - buildAllLevels(mapping, boundingBox, diagramNode); - } - - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected Dimension getDefaultSize(Shape shape) { - Dimension defaultSize = new Dimension(); - - // This code sets the same minimal default size for both State Graph and - // State - defaultSize.setSize(StateSupport.MIN_SIZE_X, StateSupport.MIN_SIZE_Y); - - /* - * This code snippet sets default the size for State Graphs and States - * differently. With this the top-level container remains large after - * layout (according to the default size in StateGraphSupport), which - * might not look proper. - */ - /* - EObject modelObject = shape.getLink().getBusinessObjects().get(0); - if (modelObject instanceof StateGraph) { - defaultSize.setSize(StateGraphSupport.DEFAULT_SIZE_X, - StateGraphSupport.DEFAULT_SIZE_Y); - } else if (modelObject instanceof State) { - defaultSize.setSize(StateSupport.MIN_SIZE_X, - StateSupport.MIN_SIZE_Y); - - } else { - defaultSize.setSize(20, 20); - }*/ - - return defaultSize; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected KNode createNode(final LayoutMapping<PictogramElement> mapping, - final KNode parentNode, final Shape shape) { - KNode node = KimlUtil.createInitializedNode(); - node.setParent(parentNode); - - setCurrentPositionAndSize(mapping, parentNode, node, shape); - - mapping.getGraphMap().put(node, shape); - - // gather all connections directly connected to the Node (not the - // connections connected via ports). These only exist in the behavior - // editor. - for (Anchor anchor : shape.getAnchors()) { - mapping.getProperty(KimlGraphitiUtil.CONNECTIONS).addAll( - anchor.getOutgoingConnections()); - } - - return node; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean isBoundaryPort(Shape shape) { - EObject modelObject = shape.getLink().getBusinessObjects().get(0); - if (modelObject instanceof TrPoint) - return true; - - return false; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean isInternalPort(Shape shape) { - // No shape is an internal port (i.e. All ports are external only) - return false; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean isTopLevelBoundingBox(Shape shape) { - EObject modelObject = shape.getLink().getBusinessObjects().get(0); - if (modelObject instanceof StateGraph) - return true; - - return false; - } - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorLayoutCommand.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorLayoutCommand.java deleted file mode 100644 index 78825d3ac..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorLayoutCommand.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.ui.behavior.fsm.support.TrPointSupport; -import org.eclipse.graphiti.features.IFeatureProvider; -import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm; -import org.eclipse.graphiti.mm.algorithms.Text; -import org.eclipse.graphiti.mm.algorithms.styles.Orientation; -import org.eclipse.graphiti.mm.pictograms.Anchor; -import org.eclipse.graphiti.mm.pictograms.ContainerShape; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.eclipse.graphiti.services.Graphiti; -import org.eclipse.graphiti.services.IGaService; - -import de.cau.cs.kieler.core.kgraph.KNode; -import de.cau.cs.kieler.core.kgraph.KPort; - -/** - * A command for applying the result of automatic layout to diagram elements in - * eTrice Behavior Editor. - * - * @author jayant - */ -public class BehaviorLayoutCommand extends ETriceLayoutCommand { - - public BehaviorLayoutCommand(TransactionalEditingDomain domain, - IFeatureProvider thefeatureProvider) { - super(domain, thefeatureProvider); - // TODO Auto-generated constructor stub - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void applyNodeLayout(KNode knode, PictogramElement pelem) { - setCalculatedPositionAndSize(knode, knode.getParent(), - (ContainerShape) pelem); - }; - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void applyPortLayout(KPort kport, PictogramElement pelem) { - - ContainerShape shape = (ContainerShape) ((Anchor) pelem).getParent(); - - setCalculatedPositionAndSize(kport, kport.getNode(), shape); - - GraphicsAlgorithm ga = shape.getGraphicsAlgorithm(); - EObject bo = shape.getContainer().getLink().getBusinessObjects().get(0); - - // margin and size for bounding box (State Graph) - int margin = TrPointSupport.MARGIN; - int size = TrPointSupport.ITEM_SIZE; - - if (bo instanceof State) { - // margin and size for a State - margin = TrPointSupport.MARGIN_SMALL; - size = TrPointSupport.ITEM_SIZE_SMALL; - } - - Text label = (Text) (shape.getChildren().get(0).getGraphicsAlgorithm()); - - adjustLabel(label, ga.getX(), ga.getY(), ga.getWidth(), margin, size); - } - - /** - * Sets correct port label position depending on the corresponding port - * position. - * - * @param label - * Text Graphics Algorithm to be placed - * @param x - * The x coordinate of the containing shape - * @param y - * The y coordinate of the containing shape - * @param width - * The width of the containing shape - * @param margin - * The margin of the containing shape - * @param size - * The size(length/width) of the port's visible graphics - * algorithm - * - */ - /* - * This method has been copied from TrPointSuppot.FeatureProvider class - * since its visibility is not public there - */ - private static void adjustLabel(Text label, int x, int y, int width, - int margin, int size) { - Orientation halign = Orientation.ALIGNMENT_CENTER; - Orientation valign = Orientation.ALIGNMENT_CENTER; - - int pos = 0; - - if (x <= margin) - halign = Orientation.ALIGNMENT_LEFT; - else if ((width - margin) <= x) - halign = Orientation.ALIGNMENT_RIGHT; - if (y <= margin) { - pos = 0; - valign = Orientation.ALIGNMENT_BOTTOM; - } else { - pos = 5 * margin / 4; - valign = Orientation.ALIGNMENT_TOP; - } - - label.setHorizontalAlignment(halign); - label.setVerticalAlignment(valign); - - if (pos != label.getY()) { - IGaService gaService = Graphiti.getGaService(); - gaService.setLocationAndSize(label, 0, pos, 2 * margin, - 3 * margin / 4); - } - } - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java deleted file mode 100644 index f77557283..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java +++ /dev/null @@ -1,624 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map.Entry; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor; -import org.eclipse.etrice.ui.common.base.editor.DiagramEditorBase; -import org.eclipse.gef.EditPart; -import org.eclipse.graphiti.mm.algorithms.AbstractText; -import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm; -import org.eclipse.graphiti.mm.pictograms.Anchor; -import org.eclipse.graphiti.mm.pictograms.Connection; -import org.eclipse.graphiti.mm.pictograms.ContainerShape; -import org.eclipse.graphiti.mm.pictograms.Diagram; -import org.eclipse.graphiti.mm.pictograms.FreeFormConnection; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.eclipse.graphiti.mm.pictograms.Shape; -import org.eclipse.graphiti.ui.editor.DiagramEditor; -import org.eclipse.graphiti.ui.internal.parts.IPictogramElementEditPart; -import org.eclipse.ui.IWorkbenchPart; - -import de.cau.cs.kieler.core.kgraph.KGraphElement; -import de.cau.cs.kieler.core.kgraph.KLabeledGraphElement; -import de.cau.cs.kieler.core.kgraph.KNode; -import de.cau.cs.kieler.core.kgraph.KPort; -import de.cau.cs.kieler.kiml.LayoutContext; -import de.cau.cs.kieler.kiml.config.VolatileLayoutConfig; -import de.cau.cs.kieler.kiml.graphiti.GefDiagramLayoutManager; -import de.cau.cs.kieler.kiml.graphiti.GraphitiLayoutCommand; -import de.cau.cs.kieler.kiml.graphiti.GraphitiLayoutConfig; -import de.cau.cs.kieler.kiml.graphiti.KimlGraphitiUtil; -import de.cau.cs.kieler.kiml.klayoutdata.KInsets; -import de.cau.cs.kieler.kiml.klayoutdata.KShapeLayout; -import de.cau.cs.kieler.kiml.klayoutdata.impl.KShapeLayoutImpl; -import de.cau.cs.kieler.kiml.options.LayoutOptions; -import de.cau.cs.kieler.kiml.ui.diagram.LayoutMapping; -import de.cau.cs.kieler.kiml.util.KimlUtil; - -/** - * The abstract class to support the creation of eTrice - * {@link BehaviorDiagramLayoutManager } and - * {@link StructureDiagramLayoutManager} - * - * @author jayant - */ -@SuppressWarnings("restriction") -public abstract class ETriceDiagramLayoutManager extends - GefDiagramLayoutManager<PictogramElement> { - - /** - * {@inheritDoc} - */ - public abstract boolean supports(Object object); - - /** - * {@inheritDoc} - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - public Object getAdapter(final Object object, final Class adapterType) { - if (adapterType.isAssignableFrom(GraphitiLayoutConfig.class)) { - return layoutConfig; - } else if (adapterType - .isAssignableFrom(IPictogramElementEditPart.class)) { - if (object instanceof IPictogramElementEditPart) { - return object; - } else if (object instanceof DiagramEditor) { - return ((DiagramEditor) object).getGraphicalViewer() - .getContents(); - } - } else if (adapterType.isAssignableFrom(EObject.class)) { - if (object instanceof IPictogramElementEditPart) { - PictogramElement pe = ((IPictogramElementEditPart) object) - .getPictogramElement(); - if (pe.getLink() != null) { - List<EObject> businessObjects = pe.getLink() - .getBusinessObjects(); - if (!businessObjects.isEmpty()) { - return businessObjects.get(0); - } - } - } else if (object instanceof PictogramElement) { - PictogramElement pe = (PictogramElement) object; - if (pe.getLink() != null) { - List<EObject> businessObjects = pe.getLink() - .getBusinessObjects(); - if (!businessObjects.isEmpty()) { - return businessObjects.get(0); - } - } - } - } else if (adapterType.isAssignableFrom(PictogramElement.class)) { - if (object instanceof PictogramElement) { - return object; - } else if (object instanceof IPictogramElementEditPart) { - return ((IPictogramElementEditPart) object) - .getPictogramElement(); - } else if (object instanceof DiagramEditor) { - EditPart contents = ((DiagramEditor) object) - .getGraphicalViewer().getContents(); - if (contents instanceof IPictogramElementEditPart) { - return ((IPictogramElementEditPart) contents) - .getPictogramElement(); - } - } - } else if (adapterType - .isAssignableFrom(TransactionalEditingDomain.class)) { - if (object instanceof DiagramEditor) { - return ((DiagramEditor) object).getEditingDomain(); - } else if (object instanceof IPictogramElementEditPart) { - return ((IPictogramElementEditPart) object) - .getConfigurationProvider().getDiagramBehavior() - .getEditingDomain(); - } - } - if (object instanceof IAdaptable) { - return ((IAdaptable) object).getAdapter(adapterType); - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public Class<?>[] getAdapterList() { - return new Class<?>[] { PictogramElement.class }; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - - @Override - protected void transferLayout(final LayoutMapping<PictogramElement> mapping) { - DiagramEditor diagramEditor = mapping - .getProperty(KimlGraphitiUtil.DIAGRAM_EDITOR); - - ETriceLayoutCommand command = null; - - if (diagramEditor instanceof BehaviorEditor) { - command = new BehaviorLayoutCommand( - diagramEditor.getEditingDomain(), diagramEditor - .getDiagramTypeProvider().getFeatureProvider()); - } else { - command = new StructureLayoutCommand( - diagramEditor.getEditingDomain(), diagramEditor - .getDiagramTypeProvider().getFeatureProvider()); - } - - for (Entry<KGraphElement, PictogramElement> entry : mapping - .getGraphMap().entrySet()) { - command.add(entry.getKey(), entry.getValue()); - } - mapping.setProperty(KimlGraphitiUtil.LAYOUT_COMMAND, command); - } - - /** - * {@inheritDoc} - */ - @Override - protected void applyLayout(final LayoutMapping<PictogramElement> mapping) { - TransactionalEditingDomain editingDomain = mapping.getProperty( - KimlGraphitiUtil.DIAGRAM_EDITOR).getEditingDomain(); - editingDomain.getCommandStack().execute( - mapping.getProperty(KimlGraphitiUtil.LAYOUT_COMMAND)); - } - - /** the cached layout configuration for Graphiti. */ - private GraphitiLayoutConfig layoutConfig = new GraphitiLayoutConfig(); - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public LayoutMapping<PictogramElement> buildLayoutGraph( - final IWorkbenchPart workbenchPart, final Object diagramPart) { - LayoutMapping<PictogramElement> mapping = new LayoutMapping<PictogramElement>( - this); - mapping.setProperty(KimlGraphitiUtil.CONNECTIONS, - new LinkedList<Connection>()); - mapping.setProperty(KimlGraphitiUtil.STATIC_CONFIG, - new VolatileLayoutConfig()); - - if (workbenchPart instanceof DiagramEditorBase) { - mapping.setProperty(KimlGraphitiUtil.DIAGRAM_EDITOR, - (DiagramEditorBase) workbenchPart); - } - - EditPart layoutRootPart = null; - if (diagramPart instanceof IPictogramElementEditPart) { - layoutRootPart = (EditPart) diagramPart; - } else if (mapping.getProperty(KimlGraphitiUtil.DIAGRAM_EDITOR) != null) { - layoutRootPart = mapping - .getProperty(KimlGraphitiUtil.DIAGRAM_EDITOR) - .getGraphicalViewer().getContents(); - } - if (!(layoutRootPart instanceof IPictogramElementEditPart)) { - throw new UnsupportedOperationException( - "Not supported by this layout manager: Workbench part " - + workbenchPart + ", Edit part " + diagramPart); - } - PictogramElement element = ((IPictogramElementEditPart) layoutRootPart) - .getPictogramElement(); - mapping.setParentElement(element); - - if (element instanceof Diagram) { - - KNode diagramNode = KimlUtil.createInitializedNode(); - KShapeLayout shapeLayout = diagramNode.getData(KShapeLayout.class); - GraphicsAlgorithm ga = element.getGraphicsAlgorithm(); - shapeLayout.setPos(ga.getX(), ga.getY()); - shapeLayout.setSize(ga.getWidth(), ga.getHeight()); - mapping.getGraphMap().put(diagramNode, element); - - // Node creation for currently visible top-level Container - // Shape(Bounding Box) in - // eTrice Diagrams - buildLayoutGraphForBoundingBox(mapping, (Diagram) element, - diagramNode, true); - - mapping.setLayoutGraph(diagramNode); - - } else if (element instanceof Shape) { - - if (isTopLevelBoundingBox((Shape) element)) { - // The selected Element is the Top Level Top Level Bounding Box - mapping.setLayoutGraph((KNode) buildAllLevels(mapping, - (Shape) element, null)); - } else { - - KGraphElement internalKGraphElement = createKGraphElementFromShape( - mapping, null, (Shape) element); - - if (internalKGraphElement instanceof KNode - && !isInternalPort((Shape) element)) { - // The selected Element is a Node. - for (Shape childShape : ((ContainerShape) element) - .getChildren()) { - - createKGraphElementFromShape(mapping, - internalKGraphElement, childShape); - } - - mapping.setLayoutGraph((KNode) internalKGraphElement); - - } else { - // The selected Element is a Port(Boundary or Internal) or - // an Edge Label. - // It is an illegal argument for layout - throw new IllegalArgumentException( - "The seleted element cannot be lay-outed separately"); - - } - - } - } else if (element instanceof FreeFormConnection) { - // The selected element is an edge. - // It is an illegal argument for layout - throw new IllegalArgumentException( - "A connection cannot be layouted separately"); - } - - for (Connection entry : mapping - .getProperty(KimlGraphitiUtil.CONNECTIONS)) { - KimlGraphitiUtil.createEdge(mapping, entry); - } - - // create a layout configuration - mapping.getLayoutConfigs().add( - mapping.getProperty(KimlGraphitiUtil.STATIC_CONFIG)); - mapping.getLayoutConfigs().add(layoutConfig); - - return mapping; - } - - /** - * Identifies the visible Bounding Box (Top Level Container) and delegates - * the control to {@link #buildAllLevels(LayoutMapping, Shape, KNode)} - * - * @param mapping - * the mapping of pictogram elements to graph elements - * @param diagram - * The Diagram Containing the Bounding Box - * @param diagramNode - * The Node for the diagram - * @param onlyVisible - * If true, only the visible bounding box will be lay-outed. - * Otherwise, all bounding boxes in current Diagram are - * lay-outed. - * - * @author jayant - */ - protected abstract void buildLayoutGraphForBoundingBox( - final LayoutMapping<PictogramElement> mapping, - final Diagram diagram, final KNode diagramNode, - final boolean onlyVisible); - - /** - * Develops the complete LayoutGraph for the eTrice Diagram starting from - * the Bounding Box. - * - * @param mapping - * the mapping of pictogram elements to graph elements - * @param topLevelBoundingBox - * The Top Level Container Shape containing all other shapes - * @param diagramNode - * The KNode corresponding to the Diagram - * - * @author jayant - */ - /* This is fairly general for both the eTrice editors */ - protected KNode buildAllLevels(LayoutMapping<PictogramElement> mapping, - Shape topLevelBoundingBox, KNode diagramNode) { - // Top Level - KNode topLevelBoundingBoxNode = createNode(mapping, diagramNode, - topLevelBoundingBox); - - for (Shape secondLevelShape : ((ContainerShape) topLevelBoundingBox) - .getChildren()) { - // Second Level - KGraphElement secondLevelKGraphElement = createKGraphElementFromShape( - mapping, topLevelBoundingBoxNode, secondLevelShape); - - if (secondLevelKGraphElement instanceof KNode) { - for (Shape thirdLevelShape : ((ContainerShape) secondLevelShape) - .getChildren()) { - // Third Level - createKGraphElementFromShape(mapping, - secondLevelKGraphElement, thirdLevelShape); - } - - if (!isInternalPort(secondLevelShape)) { - // For KNodes which are not internal ports. - setNodeLayoutOptions(mapping, - (KNode) secondLevelKGraphElement, secondLevelShape); - } - - } - } - - setNodeLayoutOptions(mapping, topLevelBoundingBoxNode, - topLevelBoundingBox); - - return topLevelBoundingBoxNode; - } - - /** - * Identifies the type of Shape (Label, Port or Node) and creates the - * corresponding KGraphElement Element - * - * @param mapping - * the mapping of pictogram elements to graph elements - * @param parent - * the parent KNode - * @param shape - * the shape for which a KGraphElement is required - * - * @return the created KGraphElement for the given Shape - * - * @author jayant - */ - /* This is fairly general for both the eTrice editors */ - private KGraphElement createKGraphElementFromShape( - LayoutMapping<PictogramElement> mapping, KGraphElement parent, - Shape shape) { - - GraphicsAlgorithm ga = shape.getGraphicsAlgorithm(); - - // Checking whether this shape is a label - if (ga instanceof AbstractText) { - - KInsets parentInsets = parent.getData(KShapeLayout.class) - .getProperty(GraphitiLayoutCommand.INVIS_INSETS); - - assert (parentInsets != null) : "There must be an invisible insets attached to all ports and nodes(except diagramNode)"; - return KimlGraphitiUtil.createLabel((KLabeledGraphElement) parent, - (AbstractText) ga, -parentInsets.getLeft(), - -parentInsets.getTop()); - } - - else if (shape instanceof ContainerShape) { - - // Checking whether this shape is a boundary port - if (isBoundaryPort(shape)) - return createPort(mapping, (KNode) parent, shape); - - else - // This shape is considered to be a node (includes internal - // Ports) - return createNode(mapping, (KNode) parent, shape); - - } else - return null; - } - - /** - * Create a node for the layout graph. - * - * @param mapping - * the mapping of pictogram elements to graph elements - * @param parentNode - * the parent node - * @param shape - * the shape for a new node - * @return a new layout node - */ - protected abstract KNode createNode( - final LayoutMapping<PictogramElement> mapping, - final KNode parentNode, final Shape shape); - - /** - * Create a port for the layout graph. - * - * @param mapping - * the mapping of pictogram elements to graph elements - * @param parentNode - * the parent node - * @param shape - * the shape for a new port - * @return a new layout node - * - * @author jayant - */ - /* This is fairly general for both the eTrice editors */ - protected KPort createPort(final LayoutMapping<PictogramElement> mapping, - final KNode parentNode, final Shape shape) { - KPort port = KimlUtil.createInitializedPort(); - port.setNode(parentNode); - - setCurrentPositionAndSize(mapping, parentNode, port, shape); - - mapping.getGraphMap().put(port, shape.getAnchors().get(0)); - - // Set Port label - Shape portLabelShape = ((ContainerShape) shape).getChildren().get(0); - createKGraphElementFromShape(mapping, port, portLabelShape); - - // gather all connections connected to the parentNode via this port - for (Anchor anchor : shape.getAnchors()) { - mapping.getProperty(KimlGraphitiUtil.CONNECTIONS).addAll( - anchor.getOutgoingConnections()); - } - - return port; - } - - /** - * Sets the insets(border) and calculates the position and size of the - * KgraphElement. - * - * @param mapping - * the mapping of pictogram elements to graph elements - * @param parentNode - * the parent node - * @param kelem - * the kGraphElement whose size and position is to be determined - * @param shape - * the corresponding shape - * - * @author jayant - */ - /* - * This is fairly general for both the eTrice editors and same for Nodes and - * Ports - */ - protected void setCurrentPositionAndSize( - final LayoutMapping<PictogramElement> mapping, - final KNode parentNode, final KGraphElement kelem, final Shape shape) { - - VolatileLayoutConfig staticConfig = mapping - .getProperty(KimlGraphitiUtil.STATIC_CONFIG); - - KShapeLayout shapeLayout = kelem.getData(KShapeLayout.class); - GraphicsAlgorithm ga = shape.getGraphicsAlgorithm(); - - // Calculate and set the invisible insets - KInsets shapeInsets = KimlGraphitiUtil.calcInsets(ga); - shapeLayout - .setProperty(GraphitiLayoutCommand.INVIS_INSETS, shapeInsets); - staticConfig.setValue(GraphitiLayoutCommand.INVIS_INSETS, kelem, - LayoutContext.GRAPH_ELEM, shapeInsets); - - // Get the parent insets - KInsets parentInsets = parentNode == null ? null : parentNode.getData( - KShapeLayout.class).getProperty( - GraphitiLayoutCommand.INVIS_INSETS); - - // Set Position - if (parentInsets == null) { - shapeLayout.setPos(ga.getX() + shapeInsets.getLeft(), ga.getY() - + shapeInsets.getTop()); - } else { - shapeLayout.setPos( - ga.getX() + shapeInsets.getLeft() - parentInsets.getLeft(), - ga.getY() + shapeInsets.getTop() - parentInsets.getTop()); - } - - // Set Size - shapeLayout - .setSize( - ga.getWidth() - shapeInsets.getLeft() - - shapeInsets.getRight(), - ga.getHeight() - shapeInsets.getTop() - - shapeInsets.getBottom()); - - // the modification flag must initially be false - ((KShapeLayoutImpl) shapeLayout).resetModificationFlag(); - - } - - /** - * Sets the heuristic layout options for nodes (like minimal width and - * minimal height) - * - * @param mapping - * the mapping of pictogram elements to graph elements - * @param node - * the node for which layout options need to be set - * @param shape - * the corresponding shape - * @author jayant - */ - /* This is fairly general for both the eTrice editors */ - protected void setNodeLayoutOptions( - final LayoutMapping<PictogramElement> mapping, final KNode node, - Shape shape) { - - // get label width and height for the node - // these would be added to the node width and height - float labelWidth = 0.0f; - float labelHeight = 0.0f; - - if (!node.getLabels().isEmpty()) { - KShapeLayout labelLayout = node.getLabels().get(0) - .getData(KShapeLayout.class); - // halh of the label width is taken to avoid too much widening of - // node due to labels - labelWidth = labelLayout.getWidth() * 0.5f; - } - - Dimension defaultSize = getDefaultSize(shape); - float ratio = (float) defaultSize.height() / defaultSize.width(); - // label height is not the original label height but the increase is - // node height due to label; it is in ratio with the increase in label - // width. - labelHeight = ratio * labelWidth; - - VolatileLayoutConfig staticConfig = mapping - .getProperty(KimlGraphitiUtil.STATIC_CONFIG); - staticConfig.setValue(LayoutOptions.MIN_WIDTH, node, - LayoutContext.GRAPH_ELEM, defaultSize.width() + labelWidth); - staticConfig.setValue(LayoutOptions.MIN_HEIGHT, node, - LayoutContext.GRAPH_ELEM, defaultSize.height() + labelHeight); - } - - /** - * Determines whether the given shape is a boundary port or not. - * - * @param shape - * the shape to be investigated - * @return true if the {@code shape} is a port else false - * - * @author jayant - */ - public abstract boolean isBoundaryPort(Shape shape); - - /** - * Determines whether the given shape is an internal port or not. - * - * @param shape - * the shape to be investigated - * @return true if the {@code shape} is a port else false - * - * @author jayant - */ - public abstract boolean isInternalPort(Shape shape); - - /** - * Determines whether the given shape is a Top Level Bounding Box or not. - * - * @param shape - * the shape to be investigated - * - * @return true if the {@code shape} is the Top Level Bounding Box - * - * @author jayant - */ - public abstract boolean isTopLevelBoundingBox(Shape shape); - - /** - * Gets the Default Minimal Size for a node - * - * @param shape - * The shape attached to the node - * - * @return the defaults minimal size for a node - * - * @author jayant - */ - protected abstract Dimension getDefaultSize(Shape shape); - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutCommand.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutCommand.java deleted file mode 100644 index 26b0048cf..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutCommand.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout; - -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.graphiti.features.IFeatureProvider; -import org.eclipse.graphiti.features.context.impl.LayoutContext; -import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm; -import org.eclipse.graphiti.mm.algorithms.styles.Point; -import org.eclipse.graphiti.mm.pictograms.Anchor; -import org.eclipse.graphiti.mm.pictograms.ContainerShape; -import org.eclipse.graphiti.mm.pictograms.FreeFormConnection; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.eclipse.graphiti.services.Graphiti; -import org.eclipse.graphiti.services.IGaService; - -import de.cau.cs.kieler.core.kgraph.KEdge; -import de.cau.cs.kieler.core.kgraph.KGraphElement; -import de.cau.cs.kieler.core.kgraph.KNode; -import de.cau.cs.kieler.core.kgraph.KPort; -import de.cau.cs.kieler.core.math.KVector; -import de.cau.cs.kieler.core.math.KVectorChain; -import de.cau.cs.kieler.core.util.Pair; -import de.cau.cs.kieler.kiml.graphiti.GraphitiLayoutCommand; -import de.cau.cs.kieler.kiml.klayoutdata.KInsets; -import de.cau.cs.kieler.kiml.klayoutdata.KShapeLayout; -import de.cau.cs.kieler.kiml.klayoutdata.impl.KShapeLayoutImpl; - -/** - * An abstract class to support creation of commands for applying the result of - * automatic layout to eTrice diagrams. Help create the - * {@link BehaviorLayoutCommand} and the {@link StructureLayoutCommand}. - * - * @author jayant - */ -public abstract class ETriceLayoutCommand extends GraphitiLayoutCommand { - - /** list of graph elements(nodes & ports) and pictogram elements to layout. */ - private List<Pair<KGraphElement, PictogramElement>> elements = - new LinkedList<Pair<KGraphElement, PictogramElement>>(); - - public ETriceLayoutCommand(TransactionalEditingDomain domain, - IFeatureProvider thefeatureProvider) { - super(domain, thefeatureProvider); - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public void add(KGraphElement graphElement, - PictogramElement pictogramElement) { - - super.add(graphElement, pictogramElement); - - // Prepare a local list of modified nodes and ports. - // This list is used in doExecute() method below. - if (graphElement instanceof KPort || graphElement instanceof KNode) { - KShapeLayoutImpl shapeLayout = graphElement - .getData(KShapeLayoutImpl.class); - if (shapeLayout.isModified()) { - elements.add(new Pair<KGraphElement, PictogramElement>( - graphElement, pictogramElement)); - } - } - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void doExecute() { - super.doExecute(); - - /* - * Re-layout diagram elements according to eTrice after performing - * complete KIELER Layout. - * - * Note: This operation needs to be carried after completing the KIELER - * layout since eTrice positioning depend not only on current diagram - * element but also on the parameters of its parent element. - */ - for (Pair<KGraphElement, PictogramElement> entry : elements) { - KGraphElement element = entry.getFirst(); - if (element instanceof KPort) { - PictogramElement pelem = ((Anchor) entry.getSecond()) - .getParent(); - getFeatureProvider().layoutIfPossible(new LayoutContext(pelem)); - } else if (element instanceof KNode) { - PictogramElement pelem = entry.getSecond(); - getFeatureProvider().layoutIfPossible(new LayoutContext(pelem)); - } - } - - // refresh the diagram editor after re-placement by eTrice. - getFeatureProvider().getDiagramTypeProvider().getDiagramBehavior() - .refresh(); - } - - /** - * {@inheritDoc} Also responsible for the layout of internal ports in eTrice - * (which are considered as KNodes) - * - * @author jayant - */ - @Override - protected abstract void applyNodeLayout(KNode knode, PictogramElement pelem); - - /** - * {@inheritDoc} Only Boundary Ports are lay-outed by this method - * - * @author jayant - */ - @Override - protected abstract void applyPortLayout(KPort kport, PictogramElement pelem); - - /** - * {@inheritDoc} - * - */ - /* - * The code used in this function has been taken from - * GraphitilayoutCommand.applyEdgeLayout() method. (Removing some unwanted - * code) - */ - @Override - protected void applyEdgeLayout(final KEdge kedge, - final PictogramElement pelem) { - // create bend points for the edge - KVectorChain bendPoints = getBendPoints(kedge); - - if (pelem instanceof FreeFormConnection) { - FreeFormConnection connection = (FreeFormConnection) pelem; - List<Point> pointList = connection.getBendpoints(); - // add the bend points to the connection, reusing existing points - for (int i = 0; i < bendPoints.size(); i++) { - KVector kpoint = bendPoints.get(i); - if (i >= pointList.size()) { - Point point = Graphiti.getGaService().createPoint( - (int) Math.round(kpoint.x), - (int) Math.round(kpoint.y)); - pointList.add(point); - } else { - Point point = pointList.get(i); - point.setX((int) Math.round(kpoint.x)); - point.setY((int) Math.round(kpoint.y)); - } - } - while (pointList.size() > bendPoints.size()) { - pointList.remove(pointList.size() - 1); - } - } - } - - /** - * Sets the calculated position and size from a KGraph Model-Element (Node - * or Port) back to the corresponding diagram shape. - * - * @param kelem - * the KGraph Model Element (Node/Port) - * @param parentNode - * for nodes : the parent node , for ports : the containing node - * @param shape - * the corresponding pictogram element for Node/Port - * - * @author jayant - */ - protected void setCalculatedPositionAndSize(final KGraphElement kelem, - KNode parentNode, final ContainerShape shape) { - - KShapeLayout shapeLayout = kelem.getData(KShapeLayout.class); - float xpos = shapeLayout.getXpos(); - float ypos = shapeLayout.getYpos(); - - if (parentNode != null) { - KInsets parentInsets = parentNode.getData(KShapeLayout.class) - .getProperty(INVIS_INSETS); - if (parentInsets != null) { - xpos += parentInsets.getLeft(); - ypos += parentInsets.getTop(); - } - } - - float width = shapeLayout.getWidth(); - float height = shapeLayout.getHeight(); - - KInsets shapeInsets = shapeLayout.getProperty(INVIS_INSETS); - if (shapeInsets != null) { - xpos -= shapeInsets.getLeft(); - ypos -= shapeInsets.getTop(); - width += shapeInsets.getLeft() + shapeInsets.getRight(); - height += shapeInsets.getTop() + shapeInsets.getBottom(); - } - - GraphicsAlgorithm ga = shape.getGraphicsAlgorithm(); - - IGaService gaService = Graphiti.getGaService(); - gaService.setLocationAndSize(ga, Math.round(xpos), Math.round(ypos), - Math.round(width), Math.round(height)); - - } - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutConfig.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutConfig.java deleted file mode 100644 index 11d976b0e..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutConfig.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.room.ActorContainerClass; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor; -import org.eclipse.ui.IWorkbenchPart; - -import de.cau.cs.kieler.core.kgraph.KGraphData; -import de.cau.cs.kieler.kiml.LayoutContext; -import de.cau.cs.kieler.kiml.LayoutOptionData; -import de.cau.cs.kieler.kiml.config.DefaultLayoutConfig; -import de.cau.cs.kieler.kiml.config.ILayoutConfig; -import de.cau.cs.kieler.kiml.options.LayoutOptions; -import de.cau.cs.kieler.kiml.ui.service.EclipseLayoutConfig; - -/** - * A layout config for option configuration in eTrice. It configures the diagram - * types of diagram elements based on the domain model and the specific diagram - * editor. - * - * @author jayant - */ -public class ETriceLayoutConfig implements ILayoutConfig { - - /** The priority for this layout configurations. */ - public static final int PRIORITY = 40; - - /** - * The diagram type for the diagram elements in eTrice behavior diagrams. - */ - public static final String BEHAVIOR_DIAGRAM_TYPE = "org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram"; - - /** - * The diagram type for the diagram elements in eTrice structure diagrams. - */ - public static final String STRUCTURE_DIAGRAM_TYPE = "org.eclipse.etrice.ui.layout.eTriceStructureDiagram"; - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public int getPriority() { - return PRIORITY; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public void enrich(LayoutContext context) { - Object element = context.getProperty(LayoutContext.DOMAIN_MODEL); - - if (element instanceof ActorContainerClass - || element instanceof StateGraph) { - IWorkbenchPart workbenchPart = context - .getProperty(EclipseLayoutConfig.WORKBENCH_PART); - Object diagramType = getDiagramType(element, workbenchPart); - - if (diagramType != null) - context.setProperty(DefaultLayoutConfig.CONTENT_DIAGT, - diagramType); - } - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public Object getValue(LayoutOptionData<?> optionData, LayoutContext context) { - if (optionData.equals(LayoutOptions.DIAGRAM_TYPE)) { - EObject element = context.getProperty(LayoutContext.DOMAIN_MODEL); - - if (element instanceof ActorContainerClass - || element instanceof StateGraph) { - IWorkbenchPart workbenchPart = context - .getProperty(EclipseLayoutConfig.WORKBENCH_PART); - return getDiagramType(element, workbenchPart); - } - } - - return null; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public void transferValues(KGraphData graphData, LayoutContext context) { - // not required : no other options to set dynamically - } - - /** - * Returns the diagram type(string) for a domain model element depending - * upon the diagram editor which contains the corresponding diagram element - * - * @param modelElement - * the domain model element - * @param workbenchPart - * the editor containing the corresspnding diagram element - * @return the diagram type for the domain model element - * - * @author jayant - */ - private String getDiagramType(final Object modelElement, - IWorkbenchPart workbenchPart) { - if (modelElement instanceof StateGraph) { - return BEHAVIOR_DIAGRAM_TYPE; - } else if (modelElement instanceof ActorContainerClass) { - if (workbenchPart instanceof BehaviorEditor) - return BEHAVIOR_DIAGRAM_TYPE; - else - return STRUCTURE_DIAGRAM_TYPE; - } - - return null; - } -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java deleted file mode 100644 index 186484dcf..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorContainerClass; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.SAPoint; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.SPPoint; -import org.eclipse.etrice.ui.structure.editor.StructureEditor; -import org.eclipse.etrice.ui.structure.support.ActorContainerRefSupport; -import org.eclipse.graphiti.mm.pictograms.Anchor; -import org.eclipse.graphiti.mm.pictograms.Diagram; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.eclipse.graphiti.mm.pictograms.Shape; -import org.eclipse.graphiti.ui.internal.parts.IPictogramElementEditPart; - -import de.cau.cs.kieler.core.kgraph.KNode; -import de.cau.cs.kieler.kiml.graphiti.KimlGraphitiUtil; -import de.cau.cs.kieler.kiml.ui.diagram.LayoutMapping; -import de.cau.cs.kieler.kiml.util.KimlUtil; - -/** - * Layout Manager implementation for eTrice Structure Editor. - * - * @author jayant - */ -@SuppressWarnings("restriction") -public class StructureDiagramLayoutManager extends ETriceDiagramLayoutManager { - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean supports(final Object object) { - - return object instanceof StructureEditor - || object instanceof IPictogramElementEditPart - || object instanceof PictogramElement; - - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void buildLayoutGraphForBoundingBox( - LayoutMapping<PictogramElement> mapping, Diagram diagram, - KNode diagramNode, boolean onlyVisible) { - - for (Shape boundingBox : ((Diagram) diagram).getChildren()) { - if (boundingBox.isVisible()) { - buildAllLevels(mapping, boundingBox, diagramNode); - break; - } - } - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected Dimension getDefaultSize(Shape shape) { - - Dimension defaultSize = new Dimension(); - - // This code sets the same minimal default size for both Actor Class and - // Actor Container Refs - defaultSize.setSize(ActorContainerRefSupport.MIN_SIZE_X, - ActorContainerRefSupport.MIN_SIZE_Y); - - /* - * This code snippet sets default the size for Actor Class and Actor - * Container Refs differently. With this the top-level container remains - * large after layout (according to the default size in - * StructureSupport), which might not look proper. - */ - /* - EObject modelObject = shape.getLink().getBusinessObjects().get(0); - if (modelObject instanceof ActorClass) { - defaultSize.setSize(StructureClassSupport.DEFAULT_SIZE_X, - StructureClassSupport.DEFAULT_SIZE_Y); - } else if (modelObject instanceof ActorContainerRef) { - defaultSize.setSize(ActorContainerRefSupport.MIN_SIZE_X, - ActorContainerRefSupport.MIN_SIZE_Y); - } else { - defaultSize.setSize(20, 20); - }*/ - - return defaultSize; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected KNode createNode(final LayoutMapping<PictogramElement> mapping, - final KNode parentNode, final Shape shape) { - KNode node = KimlUtil.createInitializedNode(); - node.setParent(parentNode); - - setCurrentPositionAndSize(mapping, parentNode, node, shape); - - mapping.getGraphMap().put(node, shape); - - // gather all connections connected to Internal ports in the diagram. - // It is of no use to ActorRefs as they do-not possess direct - // connection(They have all connections via port). - for (Anchor anchor : shape.getAnchors()) { - mapping.getProperty(KimlGraphitiUtil.CONNECTIONS).addAll( - anchor.getOutgoingConnections()); - } - - return node; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean isBoundaryPort(Shape shape) { - EObject modelObject = shape.getLink().getBusinessObjects().get(0); - if ((modelObject instanceof InterfaceItem && !isInternal((InterfaceItem) modelObject)) - || modelObject instanceof SPPoint - || modelObject instanceof SAPoint) - return true; - - return false; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean isInternalPort(Shape shape) { - EObject modelObject = shape.getLink().getBusinessObjects().get(0); - - if ((modelObject instanceof InterfaceItem && isInternal((InterfaceItem) modelObject))) - return true; - - return false; - } - - /* - * This method has been derived from - * org.eclipse.eTrice.ui.structure.InterfaceItem.FeatureProvider - */ - private static boolean isInternal(InterfaceItem item) { - if (item instanceof Port) { - Port port = (Port) item; - - // NB: the port's container might be a base class of the depicted - // actor class - ActorContainerClass acc = (ActorContainerClass) port.eContainer(); - if (acc instanceof ActorClass) { - ActorClass ac = (ActorClass) acc; - if (ac.getInternalPorts().contains(port)) - return true; - } - } else if (item instanceof SPP) { - return false; - } else { - assert (false) : "unexpected sub type"; - } - - return false; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean isTopLevelBoundingBox(Shape shape) { - EObject modelObject = shape.getLink().getBusinessObjects().get(0); - if (modelObject instanceof ActorClass) - return true; - - return false; - } - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureLayoutCommand.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureLayoutCommand.java deleted file mode 100644 index 72b7a8526..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureLayoutCommand.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.etrice.core.room.ActorContainerRef; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.ui.structure.support.InterfaceItemSupport; -import org.eclipse.graphiti.features.IFeatureProvider; -import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm; -import org.eclipse.graphiti.mm.algorithms.Text; -import org.eclipse.graphiti.mm.algorithms.styles.Orientation; -import org.eclipse.graphiti.mm.pictograms.Anchor; -import org.eclipse.graphiti.mm.pictograms.ContainerShape; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.eclipse.graphiti.services.Graphiti; -import org.eclipse.graphiti.services.IGaService; - -import de.cau.cs.kieler.core.kgraph.KNode; -import de.cau.cs.kieler.core.kgraph.KPort; - -/** - * A command for applying the result of automatic layout to diagram elements in - * eTrice Structure Editor. - * - * @author jayant - */ -public class StructureLayoutCommand extends ETriceLayoutCommand { - - public StructureLayoutCommand(TransactionalEditingDomain domain, - IFeatureProvider thefeatureProvider) { - super(domain, thefeatureProvider); - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void applyNodeLayout(KNode knode, PictogramElement pelem) { - - setCalculatedPositionAndSize(knode, knode.getParent(), - (ContainerShape) pelem); - - // Checking whether this node corresponds to an internal port or - // ActorContainerRef - EObject modelObject = pelem.getLink().getBusinessObjects().get(0); - if (modelObject instanceof InterfaceItem) { - // adjust label for internal port - adjustLabelForPort((ContainerShape) pelem); - } - }; - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void applyPortLayout(KPort kport, PictogramElement pelem) { - - ContainerShape shape = (ContainerShape) ((Anchor) pelem).getParent(); - - setCalculatedPositionAndSize(kport, kport.getNode(), shape); - - // adjust label for this (boundary)port - adjustLabelForPort(shape); - } - - /** - * Extracts relevant information and delegates it to - * {@link #adjustLabel(Text, int, int, int, int, int)} for proper adjustment - * of port label - * - * @param shape - * the Shape for the port - * - * @author jayant - */ - private static void adjustLabelForPort(ContainerShape shape) { - GraphicsAlgorithm ga = shape.getGraphicsAlgorithm(); - EObject boContainer = shape.getContainer().getLink() - .getBusinessObjects().get(0); - - // First make sure that the shape corresponds to a Port - EObject bo = shape.getLink().getBusinessObjects().get(0); - if (bo instanceof InterfaceItem) { - // margin and size for bounding box (ActorClass ) - int margin = InterfaceItemSupport.MARGIN; - int size = InterfaceItemSupport.ITEM_SIZE; - - if (boContainer instanceof ActorContainerRef) { - // margin and size for ActorContainerRef - margin = InterfaceItemSupport.MARGIN_SMALL; - size = InterfaceItemSupport.ITEM_SIZE_SMALL; - } - - Text label = (Text) (shape.getChildren().get(0) - .getGraphicsAlgorithm()); - - adjustLabel(label, ga.getX(), ga.getY(), ga.getWidth(), margin, - size); - } - }; - - /** - * Sets correct port label position depending on the corresponding port - * position. - * - * @param label - * Text Graphics Algorithm to be placed - * @param x - * The x coordinate of the containing shape - * @param y - * The y coordinate of the containing shape - * @param width - * The width of the containing shape - * @param margin - * The margin of the containing shape - * @param size - * The size(length/width) of the port's visible graphics - * algorithm - * - */ - /* - * This method has been copied from InterfaceItemSuppot.FeatureProvider - * class since its visibility is not public there - */ - private static void adjustLabel(Text label, int x, int y, int width, - int margin, int size) { - Orientation align = Orientation.ALIGNMENT_CENTER; - label.setHorizontalAlignment(align); - - int pos = margin + size / 2; - - if (x <= margin) - align = Orientation.ALIGNMENT_LEFT; - else if ((width - margin) <= x) - align = Orientation.ALIGNMENT_RIGHT; - if (y <= margin) - pos = (margin - size) / 2; - - if (align != label.getHorizontalAlignment()) { - label.setHorizontalAlignment(align); - } - if (pos != label.getY()) { - IGaService gaService = Graphiti.getGaService(); - gaService.setLocationAndSize(label, 0, pos, 2 * margin, margin / 2); - } - } -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceBehaviorPreferencePage.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceBehaviorPreferencePage.java deleted file mode 100644 index b989da79a..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceBehaviorPreferencePage.java +++ /dev/null @@ -1,478 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout.preferences; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.eclipse.etrice.ui.layout.Activator; -import org.eclipse.etrice.ui.layout.preferences.ETricePreferenceUtil.ElementType; -import org.eclipse.etrice.ui.layout.preferences.ETricePreferenceUtil.NewOptionDialog; -import org.eclipse.etrice.ui.layout.preferences.ETricePreferenceUtil.OptionsTableProvider; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeNode; -import org.eclipse.jface.viewers.TreeNodeContentProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; -import org.eclipse.ui.dialogs.ListDialog; - -import de.cau.cs.kieler.core.util.Pair; -import de.cau.cs.kieler.kiml.LayoutDataService; -import de.cau.cs.kieler.kiml.LayoutOptionData; -import de.cau.cs.kieler.kiml.ui.Messages; -import de.cau.cs.kieler.kiml.ui.service.EclipseLayoutInfoService; -import de.cau.cs.kieler.kiml.ui.views.LayoutViewPart; - -/** - * Preference page for eTrice Behavior preferences - * - * @author jayant - */ -public class ETriceBehaviorPreferencePage extends PreferencePage implements - IWorkbenchPreferencePage { - - /** - * Creates the behavior layout preference page. - * - * @author jayant - */ - public ETriceBehaviorPreferencePage() { - super(); - setDescription("Preference Page for configuring layout options specific to eTrice Behavior diagrams"); - } - - /** table viewer to refresh after changes to the option table data. */ - private TableViewer optionTableViewer; - - /** list of layout option entries. */ - private List<OptionsTableProvider.DataEntry> optionEntries; - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected Control createContents(Composite parent) { - Group optionsGroup = createOptionsGroup(parent); - optionsGroup - .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - return optionsGroup; - } - - /** - * Creates the group that holds the diagram element options table. - * - * @param parent - * the parent control - * @return a group with the diagram element options table - */ - protected Group createOptionsGroup(final Composite parent) { - Group elementGroup = new Group(parent, SWT.NONE); - elementGroup.setText(Messages.getString("kiml.ui.28")); //$NON-NLS-1$ - IPreferenceStore preferenceStore = getPreferenceStore(); - LayoutDataService dataService = LayoutDataService.getInstance(); - Collection<LayoutOptionData<?>> layoutOptionData = dataService - .getOptionData(); - optionEntries = new LinkedList<OptionsTableProvider.DataEntry>(); - - // add options for edit parts and behavior domain model elements - Set<String> elements = EclipseLayoutInfoService.getInstance() - .getRegisteredElements(); - - for (String element : elements) { - - //Finding whether diagram element is an Edit Part or Model Element - Class<?> elementClass = null; - ElementType type; - try { - elementClass = Class.forName(element); - try { - type = PictogramElement.class.isAssignableFrom(elementClass) - ? ElementType.EDIT_PART : ElementType.MODEL_ELEM; - } catch (NullPointerException e) { - type = ElementType.MODEL_ELEM; - } - } catch (ClassNotFoundException e) { - type = ElementType.MODEL_ELEM; - } - - //Making the element name more presentable - int dotIndex = element.lastIndexOf('.'); - String partName = element.substring(dotIndex + 1); - if (partName.endsWith("Impl")) { - partName = partName.substring(0, - partName.length() - "Impl".length()); - } - - for (LayoutOptionData<?> data : layoutOptionData) { - String preference = EclipseLayoutInfoService.getPreferenceName( - element, data.getId()); - if (preferenceStore.contains(preference)) { - Object value = data.parseValue(preferenceStore - .getString(preference)); - if (value != null) { - // If element is edit part or behavior model element, - // then add to the option table - if (type == ElementType.EDIT_PART - || ETriceDomainModelElement - .isBehaviorModelElement(element)) - optionEntries - .add(new OptionsTableProvider.DataEntry( - partName, element, type, data, - value)); - } - } - } - } - - // add options for diagram types(only those which are relevant to eTrice - // Behavior Diagram) - for (Pair<String, String> diagramType : ETriceDomainModelElement.BEHAVIOR_DIAGRAM_TYPES) { - for (LayoutOptionData<?> data : layoutOptionData) { - String preference = EclipseLayoutInfoService.getPreferenceName( - diagramType.getFirst(), data.getId()); - if (preferenceStore.contains(preference)) { - Object value = data.parseValue(preferenceStore - .getString(preference)); - if (value != null) { - optionEntries.add(new OptionsTableProvider.DataEntry( - diagramType.getSecond(), - diagramType.getFirst(), ElementType.DIAG_TYPE, - data, value)); - } - } - } - } - - // create the table and actions to edit layout option values - addOptionTable(elementGroup, optionEntries); - - elementGroup.setLayout(new GridLayout(2, false)); - return elementGroup; - } - - /** - * Adds a table to display options and buttons to edit the options. - * - * @param parent - * the parent to which controls are added - * @param entries - * the list of table entries - */ - private void addOptionTable(final Composite parent, - final List<OptionsTableProvider.DataEntry> entries) { - // construct the options table - final Table table = new Table(parent, SWT.BORDER); - final TableColumn column1 = new TableColumn(table, SWT.NONE); - column1.setText(Messages.getString("kiml.ui.29")); //$NON-NLS-1$ - final TableColumn column2 = new TableColumn(table, SWT.NONE); - column2.setText(Messages.getString("kiml.ui.9")); //$NON-NLS-1$ - final TableColumn column3 = new TableColumn(table, SWT.NONE); - column3.setText(Messages.getString("kiml.ui.19")); //$NON-NLS-1$ - final TableColumn column4 = new TableColumn(table, SWT.NONE); - column4.setText(Messages.getString("kiml.ui.20")); //$NON-NLS-1$ - table.setHeaderVisible(true); - final TableViewer tableViewer = new TableViewer(table); - OptionsTableProvider optionsTableProvider = new OptionsTableProvider(); - tableViewer.setContentProvider(optionsTableProvider); - tableViewer.setLabelProvider(optionsTableProvider); - tableViewer.setInput(entries); - optionTableViewer = tableViewer; - - column1.pack(); - column2.pack(); - column3.pack(); - column4.pack(); - GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, - 1, 1); - table.setLayoutData(tableLayoutData); - table.pack(); - tableLayoutData.heightHint = ETricePreferenceUtil.OPTIONS_TABLE_HEIGHT; - - // add button to add new options - Composite composite = new Composite(parent, SWT.NONE); - final Button newButton = new Button(composite, SWT.PUSH | SWT.CENTER); - newButton.setText(Messages.getString("kiml.ui.41")); //$NON-NLS-1$ - - // add button to edit the options - final Button editButton = new Button(composite, SWT.PUSH | SWT.CENTER); - editButton.setText(Messages.getString("kiml.ui.21")); //$NON-NLS-1$ - editButton.setEnabled(false); - editButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - OptionsTableProvider.DataEntry entry = ETricePreferenceUtil - .getEntry(entries, table.getSelectionIndex()); - if (entry != null) { - ETricePreferenceUtil.showEditDialog(parent.getShell(), - entry); - tableViewer.refresh(); - } - } - }); - - // add button to remove an option - final Button removeButton = new Button(composite, SWT.PUSH | SWT.CENTER); - removeButton.setText(Messages.getString("kiml.ui.22")); //$NON-NLS-1$ - removeButton.setEnabled(false); - removeButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - OptionsTableProvider.DataEntry entry = ETricePreferenceUtil - .getEntry(entries, table.getSelectionIndex()); - if (entry != null) { - entry.setValue(null); - tableViewer.refresh(); - int count = 0; - for (OptionsTableProvider.DataEntry e : entries) { - if (e.getValue() != null) { - count++; - } - } - if (count == 0) { - editButton.setEnabled(false); - removeButton.setEnabled(false); - } - } - } - }); - - // react on selection changes of the options table - table.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - if (!entries.isEmpty() && event.item != null) { - editButton.setEnabled(true); - removeButton.setEnabled(true); - } else { - editButton.setEnabled(false); - removeButton.setEnabled(false); - } - } - }); - newButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - int newIndex = showNewDialog(parent.getShell(), entries); - if (newIndex >= 0) { - tableViewer.refresh(); - tableViewer.setSelection(new StructuredSelection(entries - .get(newIndex))); - editButton.setEnabled(true); - removeButton.setEnabled(true); - column1.pack(); - column2.pack(); - column3.pack(); - column4.pack(); - } - } - }); - - composite.setLayout(new FillLayout(SWT.VERTICAL)); - GridData compositeLayoutData = new GridData(SWT.LEFT, SWT.TOP, false, - false, 1, 1); - composite.setLayoutData(compositeLayoutData); - } - - /** - * Shows an input dialog to add a new layout option to the list. - * - * @param shell - * the current shell - * @param entries - * the list of table entries - * @return the table index to put focus on, or -1 if the focus should not be - * changed - */ - private int showNewDialog(final Shell shell, - final List<OptionsTableProvider.DataEntry> entries) { - - NewOptionDialog dialog = new NewOptionDialog(shell) { - // Overriding the function for Behavior diagrams specific - // implementation - - /** - * @author jayant - */ - @Override - protected String showBrowseModelElementDialog() { - ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( - this.getShell(), new LabelProvider(), - new TreeNodeContentProvider()); - dialog.setTitle("Select Behavior Model Element"); - - TreeNode[] input = ETriceDomainModelElement.BEHAVIOR_MODEL - .getChildren(); - dialog.setInput(input); - - if (dialog.open() == ElementTreeSelectionDialog.OK) { - Object[] result = dialog.getResult(); - if (result != null && result.length > 0) { - return ((ETriceDomainModelElement) result[0]).getId(); - } - } - return null; - } - - /** - * @author jayant - */ - @Override - protected String showBrowseDiagtDialog() { - ListDialog dialog = new ListDialog(this.getShell()); - dialog.setTitle(Messages.getString("kiml.ui.57")); //$NON-NLS-1$ - dialog.setContentProvider(ArrayContentProvider.getInstance()); - dialog.setLabelProvider(new LabelProvider()); - - SelectionData[] input = new SelectionData[ETriceDomainModelElement.BEHAVIOR_DIAGRAM_TYPES - .size()]; - int i = 0; - for (Pair<String, String> type : ETriceDomainModelElement.BEHAVIOR_DIAGRAM_TYPES) { - SelectionData seld = new SelectionData(type); - input[i++] = seld; - } - Arrays.sort(input); - dialog.setInput(input); - if (dialog.open() == ListDialog.OK) { - Object[] result = dialog.getResult(); - if (result != null && result.length > 0) { - return ((SelectionData) result[0]).getId(); - } - } - return null; - } - }; - - if (dialog.open() == NewOptionDialog.OK) { - OptionsTableProvider.DataEntry newEntry = dialog.createDataEntry(); - if (newEntry == null) { - MessageDialog.openError(shell, - Messages.getString("kiml.ui.51"), - Messages.getString("kiml.ui.52")); - } else { - // look for an existing entry with same identifiers - int oldIndex = 0; - OptionsTableProvider.DataEntry oldEntry = null; - for (OptionsTableProvider.DataEntry e : entries) { - if (e.getValue() != null) { - if (e.equals(newEntry)) { - oldEntry = e; - break; - } - oldIndex++; - } - } - if (oldEntry != null) { - return oldIndex; - } else { - entries.add(newEntry); - return entries.size() - 1; - } - } - } - return -1; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - public void init(final IWorkbench workbench) { - setPreferenceStore(Activator.getDefault().getSharedPreferenceStore()); - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void performDefaults() { - super.performDefaults(); - - // clear the layout options table - for (OptionsTableProvider.DataEntry entry : optionEntries) { - entry.setValue(null); - } - optionTableViewer.refresh(); - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean performOk() { - EclipseLayoutInfoService infoService = EclipseLayoutInfoService - .getInstance(); - IPreferenceStore preferenceStore = getPreferenceStore(); - - // store data for the diagram element and diagram type options - for (OptionsTableProvider.DataEntry entry : optionEntries) { - Object oldValue = infoService.getOptionValue(entry.getElementId(), - entry.getOptionData().getId()); - Object newValue = entry.getValue(); - if (oldValue == null && newValue != null - || !oldValue.equals(newValue)) { - String preference = EclipseLayoutInfoService.getPreferenceName( - entry.getElementId(), entry.getOptionData().getId()); - if (newValue == null) { - infoService.removeOptionValue(entry.getElementId(), entry - .getOptionData().getId()); - preferenceStore.setToDefault(preference); - infoService.getRegisteredElements().remove( - entry.getElementId()); - } else { - infoService.addOptionValue(entry.getElementId(), entry - .getOptionData().getId(), newValue); - preferenceStore.setValue(preference, newValue.toString()); - if (entry.getType() != ElementType.DIAG_TYPE) { - infoService.getRegisteredElements().add( - entry.getElementId()); - } - } - } - } - - LayoutViewPart layoutView = LayoutViewPart.findView(); - if (layoutView != null) { - layoutView.refresh(); - } - return true; - } - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceDomainModelElement.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceDomainModelElement.java deleted file mode 100644 index 493a16d85..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceDomainModelElement.java +++ /dev/null @@ -1,309 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout.preferences; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jface.util.Util; -import org.eclipse.jface.viewers.TreeNode; - -import de.cau.cs.kieler.core.util.Pair; - -/** - * A class to represent Domain Model Elements(classes of eTrice). The class - * extends {@code TreeNode} which helps in : - * <ul> - * <li>Representing the class hierarchy - * <li>Making it a valid object to be passes to {@code TreeNodeContentProvider}, - * thus eliminates the need of a custom Content Provider. - * </ul> - * - * @author jayant - * - */ -public class ETriceDomainModelElement extends TreeNode { - - /** - * Constructs a new instance of {@code ETriceDomainModelElement} with the - * given id and no children. - * - * @param id - * The String which represents the Fully Qualified Domain Name of - * the Class - * - * @author jayant - */ - public ETriceDomainModelElement(String id) { - super(id.substring(id.lastIndexOf('.') + 1)); - this.id = id; - } - - /** - * Constructs a new instance of {@code ETriceDomainModelElement} with given - * id and array of children - * - * @param id - * The String which represents the Fully Qualified Domain Name of - * the Class - * @param children - * The array of children fo this element(node) - * - * @author jayant - */ - public ETriceDomainModelElement(String id, - ETriceDomainModelElement[] children) { - super(id.substring(id.lastIndexOf('.') + 1)); - this.id = id; - setChildren(children); - } - - /** - * The id of the Domain Model Class. This is a string which is the Fully - * Qualified Domain Name of the class. - */ - private String id; - - /** - * The public instance of {@code ETriceDomainModelElement} which encompasses - * the complete class hierarchy of configurable Structure diagram elements - */ - public static final ETriceDomainModelElement STRUCTURE_MODEL = new ETriceDomainModelElement( - "StructureRoot", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.ActorContainerRef", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.ActorRef"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.SubSystemRef") }), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.InterfaceItem", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.Port"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.SAPRef"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.SPPRef") }), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.StructureClass", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.ActorContainerClass", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.ActorClass"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.SubSystemClass") }), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.LogicalSystem") }), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.SAPoint", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.RefSAPoint"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.RelaySAPoint") }), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.SPPoint"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.Binding") }); - - /** - * The public instance of {@code ETriceDomainModelElement} which encompasses - * the complete class hierarchy of configurable Behavior diagram elements - */ - public static final ETriceDomainModelElement BEHAVIOR_MODEL = new ETriceDomainModelElement( - "BehaviorRoot", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.StateGraph"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.StateGraphItem", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.StateGraphNode", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.ChoicePoint"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.State", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.RefinedState"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.SimpleState") }), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.TrPoint", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.EntryPoint"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.ExitPoint"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.TransitionPoint") }) }), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.Transition", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.InitialTransition"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.NonInitialTransition", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.ContinuationTransition"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.CPBranchTransition"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.TransitionChainStartTransition", - new ETriceDomainModelElement[] { - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.GuardedTransition"), - new ETriceDomainModelElement( - "org.eclipse.etrice.core.room.TriggeredTransition") }) }) }) }), }); - - /** - * public list of {@code Pair<String, <String>>} enumerating all diagram - * types relevant for Structure Diagrams - */ - @SuppressWarnings("unchecked") - public static final List<Pair<String, String>> STRUCTURE_DIAGRAM_TYPES = new ArrayList<Pair<String, String>>( - Arrays.asList( - new Pair<String, String>( - "de.cau.cs.kieler.layout.diagrams.gereral", - "General"), - new Pair<String, String>( - "org.eclipse.etrice.ui.layout.eTriceStructureDiagram", - "eTrice Structure Diagram"))); - - /** - * public list of {@code Pair<String, <String>>} enumerating all diagram - * types relevant for Behavior Diagrams - */ - @SuppressWarnings("unchecked") - public static final List<Pair<String, String>> BEHAVIOR_DIAGRAM_TYPES = new ArrayList<Pair<String, String>>( - Arrays.asList( - new Pair<String, String>( - "de.cau.cs.kieler.layout.diagrams.gereral", - "General"), - new Pair<String, String>( - "org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram", - "eTrice Behavior Diagram"))); - - /** - * Finds whether the given id belongs to a particular domain model class - * (for behavior diagram elements) - * - * @param id - * The id to be checked (found) - * @return true, if there is a class in behavior model hierarchy with same - * id, otherwise false - */ - public static boolean isBehaviorModelElement(String id) { - return (BEHAVIOR_MODEL.traverseModel(id)); - } - - /** - * Finds whether the given id belongs to a particular domain model class - * (for structure diagram elements) - * - * @param id - * The id to be found - * @return true, if there is a class in structure model hierarchy with same - * id, otherwise false - */ - public static boolean isStructureModelElement(String id) { - return (STRUCTURE_MODEL.traverseModel(id)); - } - - /** - * Traverses the n-ary tree recursively from the invoking node and try to - * find the given id. - * - * @param findId - * The id to be found - * @return true, if id matches with any node of the tree (with root as the - * invoking node), otherwise false - */ - public boolean traverseModel(final String findId) { - - if (Util.equals(this.id, findId)) { - return true; - } else { - TreeNode[] children = getChildren(); - if (children != null) { - for (TreeNode child : children) { - if (((ETriceDomainModelElement) child) - .traverseModel(findId)) - return true; - } - } - - return false; - } - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean equals(final Object object) { - if (object instanceof ETriceDomainModelElement) { - return Util.equals(this.id, ((ETriceDomainModelElement) object).id); - } - - return false; - } - - /** - * Getter for id - * - * @return the id - * - * @author jayant - */ - public String getId() { - return id; - } - - /** - * Setter for id - * - * @param id - * the id to set - * - * @author jayant - */ - public void setId(String id) { - this.id = id; - } - - /** - * {@inheritDoc} - * <p> - * Useful for using this class with default {@code LabelProvider} - * - * @author jayant - */ - @Override - public String toString() { - return ((String) value + " (" + id + ")"); - } - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceLayoutPreferencePage.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceLayoutPreferencePage.java deleted file mode 100644 index cf9ca5943..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETriceLayoutPreferencePage.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout.preferences; - -import org.eclipse.etrice.ui.layout.Activator; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -import de.cau.cs.kieler.kiml.ui.Messages; -import de.cau.cs.kieler.kiml.ui.diagram.LayoutHandler; -import de.cau.cs.kieler.kiml.ui.service.EclipseLayoutInfoService; - -/** - * Preference page for common KIML preferences. - * - * @author jayant - */ -public class ETriceLayoutPreferencePage extends PreferencePage implements - IWorkbenchPreferencePage { - - /** checkbox for animation. */ - private Button animationCheckBox; - /** checkbox for zoom-to-fit. */ - private Button zoomCheckBox; - /** checkbox for progress dialog. */ - private Button progressCheckBox; - /** checkbox for edge routing style. */ - private Button obliqueCheckBox; - - /** - * Creates the layout preference page. - * - * @author jayant - */ - public ETriceLayoutPreferencePage() { - super(); - setDescription("Preferences for eTrice automatic diagram layout"); - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - protected Control createContents(final Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - - Group generalGroup = createGeneralGroup(composite); - generalGroup - .setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); - - Label redirectionText = new Label(composite, SWT.WRAP); - redirectionText.setAlignment(SWT.LEFT); - redirectionText - .setText("Use sub-pages to set Diagram specific preferences"); - - GridLayout compositeLayout = new GridLayout(1, false); - composite.setLayout(compositeLayout); - - return composite; - } - - /** margin width for layouts. */ - private static final int MARGIN_WIDTH = 10; - /** margin height for layouts. */ - private static final int MARGIN_HEIGHT = 5; - - /** - * Creates the group for general options. - * - * @param parent - * the parent control - * @return a group with general options - */ - private Group createGeneralGroup(final Composite parent) { - Group generalGroup = new Group(parent, SWT.NONE); - generalGroup.setText(Messages.getString("kiml.ui.35")); //$NON-NLS-1$ - - // add check box for animation - animationCheckBox = new Button(generalGroup, SWT.CHECK | SWT.LEFT); - animationCheckBox.setText(Messages.getString("kiml.ui.64")); //$NON-NLS-1$ - animationCheckBox.setSelection(getPreferenceStore().getBoolean( - LayoutHandler.PREF_ANIMATION)); - - // add check box for zoom-to-fit - zoomCheckBox = new Button(generalGroup, SWT.CHECK | SWT.LEFT); - zoomCheckBox.setText(Messages.getString("kiml.ui.65")); //$NON-NLS-1$ - zoomCheckBox.setSelection(getPreferenceStore().getBoolean( - LayoutHandler.PREF_ZOOM)); - - // add check box for progress dialog - progressCheckBox = new Button(generalGroup, SWT.CHECK | SWT.LEFT); - progressCheckBox.setText(Messages.getString("kiml.ui.66")); //$NON-NLS-1$ - progressCheckBox.setSelection(getPreferenceStore().getBoolean( - LayoutHandler.PREF_PROGRESS)); - - // add check box for oblique routing - obliqueCheckBox = new Button(generalGroup, SWT.CHECK | SWT.LEFT); - obliqueCheckBox.setText(Messages.getString("kiml.ui.36")); //$NON-NLS-1$ - obliqueCheckBox.setSelection(getPreferenceStore().getBoolean( - EclipseLayoutInfoService.PREF_OBLIQUE_ROUTE)); - - FillLayout layout = new FillLayout(SWT.VERTICAL); - layout.marginWidth = MARGIN_WIDTH; - layout.marginHeight = MARGIN_HEIGHT; - generalGroup.setLayout(layout); - return generalGroup; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - public void init(final IWorkbench workbench) { - setPreferenceStore(Activator.getDefault().getSharedPreferenceStore()); - } - - /** - * {@inheritDoc} - */ - @Override - protected void performDefaults() { - super.performDefaults(); - IPreferenceStore preferenceStore = getPreferenceStore(); - - // set default values for the general options - animationCheckBox.setSelection(preferenceStore - .getDefaultBoolean(LayoutHandler.PREF_ANIMATION)); - zoomCheckBox.setSelection(preferenceStore - .getDefaultBoolean(LayoutHandler.PREF_ZOOM)); - progressCheckBox.setSelection(preferenceStore - .getDefaultBoolean(LayoutHandler.PREF_PROGRESS)); - obliqueCheckBox - .setSelection(preferenceStore - .getDefaultBoolean(EclipseLayoutInfoService.PREF_OBLIQUE_ROUTE)); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean performOk() { - IPreferenceStore preferenceStore = getPreferenceStore(); - - // set new values for the general options - preferenceStore.setValue(LayoutHandler.PREF_ANIMATION, - animationCheckBox.getSelection()); - preferenceStore.setValue(LayoutHandler.PREF_ZOOM, - zoomCheckBox.getSelection()); - preferenceStore.setValue(LayoutHandler.PREF_PROGRESS, - progressCheckBox.getSelection()); - preferenceStore.setValue(EclipseLayoutInfoService.PREF_OBLIQUE_ROUTE, - obliqueCheckBox.getSelection()); - - return true; - } - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETricePreferenceUtil.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETricePreferenceUtil.java deleted file mode 100644 index 931972d2c..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETricePreferenceUtil.java +++ /dev/null @@ -1,806 +0,0 @@ -/******************************************************************************* - * Copyright 2010 by Christian-Albrechts-University of Kiel and Others - * Department of Computer Science - * + Real-Time and Embedded Systems Group - * This code is provided under the terms of the Eclipse Public License (EPL). - * See the file epl-v10.html for the license text. - * - * CONTRIBUTORS: - * Jayant Gupta (used KIELER code with minor modifications in eTrice) - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout.preferences; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ListDialog; - -import de.cau.cs.kieler.core.util.Pair; -import de.cau.cs.kieler.kiml.LayoutDataService; -import de.cau.cs.kieler.kiml.LayoutOptionData; -import de.cau.cs.kieler.kiml.options.LayoutOptions; -import de.cau.cs.kieler.kiml.ui.KimlUiPlugin; -import de.cau.cs.kieler.kiml.ui.LayoutOptionValidator; -import de.cau.cs.kieler.kiml.ui.LayouterHintDialog; -import de.cau.cs.kieler.kiml.ui.Messages; -import de.cau.cs.kieler.kiml.ui.service.EclipseLayoutDataService; -import de.cau.cs.kieler.kiml.ui.service.EclipseLayoutInfoService; - -/** - * The Utility class for eTrice Preference Pages. - * <p> - * This class provides a few useful methods, an enumerated type and two static - * nested class : - * <ul> - * <li>{@link ElementType}</li> - * <li>{@link NewOptionDialog}</li> - * <li>{@link OptionsTableProvider}</li> - * </ul> - * - * @author jayant - */ -public final class ETricePreferenceUtil { - - /** - * Hidden constructor to avoid instantiation. - * - * @author jayant - */ - private ETricePreferenceUtil() { - - } - - /** fixed height of the options table. */ - public static final int OPTIONS_TABLE_HEIGHT = 300; - - /** - * Fetches the entry with given index of a list of data entry, bypassing - * elements whose value was set to {@code null}. - * - * @param entries - * list of data entries - * @param index - * index of the entry to look up - * @return the entry at the given index - */ - public static OptionsTableProvider.DataEntry getEntry( - final List<OptionsTableProvider.DataEntry> entries, final int index) { - ListIterator<OptionsTableProvider.DataEntry> entryIter = entries - .listIterator(); - int i = 0; - while (entryIter.hasNext()) { - OptionsTableProvider.DataEntry entry = entryIter.next(); - if (entry.getValue() != null) { - if (i == index) { - return entry; - } - i++; - } - } - return null; - } - - /** - * Shows an input dialog to edit the given option table entry. - * - * @param shell - * the current shell - * @param entry - * an option table entry - */ - public static void showEditDialog(final Shell shell, - final OptionsTableProvider.DataEntry entry) { - LayoutOptionData<?> optionData = entry.getOptionData(); - if (entry.getValue() != null) { - if (optionData.equals(LayoutOptions.ALGORITHM)) { - // show a selection dialog for a layouter hint - LayouterHintDialog dialog = new LayouterHintDialog(shell, null); - if (dialog.open() == LayouterHintDialog.OK) { - String result = dialog.getSelectedHint(); - if (result != null) { - entry.setValue(result); - } - } - } else { - // show an input dialog for some other option - String value = entry.getValue().toString(); - InputDialog dialog = new InputDialog(shell, - Messages.getString("kiml.ui.23"), - Messages.getString("kiml.ui.24"), value, - new LayoutOptionValidator(optionData)); - if (dialog.open() == InputDialog.OK) { - String result = dialog.getValue().trim(); - switch (optionData.getType()) { - case REMOTE_ENUM: - case ENUM: - entry.setValue(optionData.parseValue(result - .toUpperCase())); - break; - default: - entry.setValue(optionData.parseValue(result)); - } - } - } - } - } - - /** - * Enumeration of element types that can receive default options. - * - * @author msp - */ - public static enum ElementType { - - /** highest priority: edit parts of specific diagram editors. */ - EDIT_PART, - - /** medium priority: domain model elements. */ - MODEL_ELEM, - - /** - * lowest priority: diagram type definition (contributed via extension - * point). - */ - DIAG_TYPE; - - /** - * Returns a description for the element type. - * - * @return a user-friendly description - */ - public String getDescription() { - switch (this) { - case EDIT_PART: - return Messages.getString("kiml.ui.54"); - case MODEL_ELEM: - return Messages.getString("kiml.ui.55"); - case DIAG_TYPE: - return Messages.getString("kiml.ui.56"); - } - return null; - } - - } - - /** - * A dialog to add new default layout options in the preference page. - * - * @author msp - * @author jayant (adapted it for eTrice) - */ - public static class NewOptionDialog extends Dialog { - - /** the currently selected element type. */ - private ElementType elementType; - /** the text for selection of a specific element. */ - private Text elementText; - /** the value of the specific element or diagram type. */ - private String elementValue; - /** the browse button for element selection. */ - private Button elementBrowseButton; - /** the text for selection of a layout option. */ - private Text optionText; - /** the value of the layout option identifier. */ - private String optionValue; - - /** - * Creates a new option dialog. - * - * @param parentShell - * the parent shell - */ - protected NewOptionDialog(final Shell parentShell) { - super(parentShell); - } - - /** - * {@inheritDoc} - */ - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - shell.setText(Messages.getString("kiml.ui.46")); //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public boolean close() { - elementValue = elementText.getText(); - optionValue = optionText.getText(); - return super.close(); - } - - /** gap between label and control. */ - private static final int HORIZONTAL_GAP = 8; - /** minimum width of each group. */ - private static final int MINIMUM_WIDTH = 500; - - /** - * {@inheritDoc} - */ - @Override - protected Control createDialogArea(final Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - createTypeGroup(composite); - createElementGroup(composite); - createOptionGroup(composite); - return composite; - } - - /** - * Create group for element type selection. - * - * @param parent - * the parent control - */ - protected void createTypeGroup(final Composite parent) { - Group group = new Group(parent, SWT.NONE); - group.setText(Messages.getString("kiml.ui.42")); //$NON-NLS-1$ - GridLayout layout = new GridLayout(1, false); - layout.horizontalSpacing = HORIZONTAL_GAP; - group.setLayout(layout); - String[][] labelsAndValues = new String[][] { - { - Messages.getString("kiml.ui.43"), ElementType.EDIT_PART.toString() }, //$NON-NLS-1$ - { - Messages.getString("kiml.ui.44"), ElementType.MODEL_ELEM.toString() }, //$NON-NLS-1$ - { - Messages.getString("kiml.ui.45"), ElementType.DIAG_TYPE.toString() } //$NON-NLS-1$ - }; - for (int i = 0; i < labelsAndValues.length; i++) { - Button radio = new Button(group, SWT.RADIO | SWT.LEFT); - radio.setSelection(i == 0); - String[] labelAndValue = labelsAndValues[i]; - radio.setText(labelAndValue[0]); - radio.setData(labelAndValue[1]); - radio.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - elementType = ElementType.valueOf((String) event.widget - .getData()); - elementBrowseButton - .setEnabled(elementType == ElementType.DIAG_TYPE - || elementType == ElementType.MODEL_ELEM); - } - }); - } - elementType = ElementType.EDIT_PART; - GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); - gridData.minimumWidth = MINIMUM_WIDTH; - group.setLayoutData(gridData); - } - - /** - * Create group for selection of specific element. - * - * @param parent - * the parent control - */ - protected void createElementGroup(final Composite parent) { - Group group = new Group(parent, SWT.NONE); - group.setText(Messages.getString("kiml.ui.47")); //$NON-NLS-1$ - group.setLayout(new GridLayout(2, false)); - Label label = new Label(group, SWT.WRAP); - label.setText(Messages.getString("kiml.ui.53")); //$NON-NLS-1$ - GridData labelLayoutData = new GridData(SWT.LEFT, SWT.FILL, false, - false, 2, 1); - labelLayoutData.widthHint = MINIMUM_WIDTH - HORIZONTAL_GAP; - label.setLayoutData(labelLayoutData); - elementText = new Text(group, SWT.SINGLE | SWT.BORDER); - elementText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, - false)); - elementBrowseButton = new Button(group, SWT.PUSH | SWT.CENTER); - elementBrowseButton.setEnabled(false); - elementBrowseButton.setText(Messages.getString("kiml.ui.48")); //$NON-NLS-1$ - elementBrowseButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent e) { - String id = (elementType == ElementType.DIAG_TYPE) ? showBrowseDiagtDialog() - : showBrowseModelElementDialog(); - if (id != null) { - elementText.setText(id); - } - } - }); - GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); - gridData.minimumWidth = MINIMUM_WIDTH; - group.setLayoutData(gridData); - } - - /** - * Create group for selection of a layout option. - * - * @param parent - * the parent control - */ - protected void createOptionGroup(final Composite parent) { - Group group = new Group(parent, SWT.NONE); - group.setText(Messages.getString("kiml.ui.49")); //$NON-NLS-1$ - group.setLayout(new GridLayout(2, false)); - optionText = new Text(group, SWT.SINGLE | SWT.BORDER); - optionText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, - false)); - Button browseButton = new Button(group, SWT.PUSH | SWT.CENTER); - browseButton.setText(Messages.getString("kiml.ui.48")); //$NON-NLS-1$ - browseButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent e) { - String id = showBrowseOptionDialog(); - if (id != null) { - optionText.setText(id); - } - } - }); - GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); - gridData.minimumWidth = MINIMUM_WIDTH; - group.setLayoutData(gridData); - - } - - /** data holder class for selection of a layout option or diagram type. */ - protected static final class SelectionData implements - Comparable<SelectionData> { - private String id; - - /** - * @return the id - */ - public String getId() { - return id; - } - - private String name; - private LayoutOptionData.Type type; - - /** - * Create a selection data object from a layout option data. - * - * @param optionData - * a layout option data - */ - public SelectionData(final LayoutOptionData<?> optionData) { - this.id = optionData.getId(); - this.name = optionData.getName(); - this.type = optionData.getType(); - } - - /** - * Create a selection data object from a diagram type. - * - * @param diagramType - * a pair with the diagram type identifier as first - * element and the name as second element - */ - public SelectionData(final Pair<String, String> diagramType) { - this.id = diagramType.getFirst(); - this.name = diagramType.getSecond(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(final Object object) { - if (object instanceof SelectionData) { - SelectionData other = (SelectionData) object; - return this.id.equals(other.id) - && this.name.equals(other.name); - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return id.hashCode() + name.hashCode(); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return name + " (" + id + ")"; - } - - /** - * {@inheritDoc} - */ - public int compareTo(final SelectionData other) { - int nameComp = this.name.compareTo(other.name); - if (nameComp == 0) { - return this.id.compareTo(other.id); - } else { - return nameComp; - } - } - } - - /** - * Open a dialog to browse diagram types. - * - * @return the selected diagram type - */ - protected String showBrowseDiagtDialog() { - ListDialog dialog = new ListDialog(this.getShell()); - dialog.setTitle(Messages.getString("kiml.ui.57")); //$NON-NLS-1$ - dialog.setContentProvider(ArrayContentProvider.getInstance()); - dialog.setLabelProvider(new LabelProvider()); - List<Pair<String, String>> diagramTypes = EclipseLayoutInfoService - .getInstance().getDiagramTypes(); - SelectionData[] input = new SelectionData[diagramTypes.size()]; - int i = 0; - for (Pair<String, String> type : diagramTypes) { - SelectionData seld = new SelectionData(type); - input[i++] = seld; - } - Arrays.sort(input); - dialog.setInput(input); - if (dialog.open() == ListDialog.OK) { - Object[] result = dialog.getResult(); - if (result != null && result.length > 0) { - return ((SelectionData) result[0]).id; - } - } - return null; - } - - /** - * Open a dialog to browse Domain Model Elements (Classes). - * - * @return the selected Model Element - * - * @author jayant - */ - protected String showBrowseModelElementDialog() { - // The Exact Implementation depends on the respective preference - // classes - // from which the New Dialog is invoked - - return "null"; - } - - /** - * Open a dialog to browse layout options. - * - * @return the selected layout option - */ - protected String showBrowseOptionDialog() { - ListDialog dialog = new ListDialog(this.getShell()); - dialog.setTitle(Messages.getString("kiml.ui.50")); //$NON-NLS-1$ - dialog.setContentProvider(ArrayContentProvider.getInstance()); - dialog.setLabelProvider(new LabelProvider() { - public Image getImage(final Object element) { - if (element instanceof SelectionData) { - KimlUiPlugin.Images images = KimlUiPlugin.getDefault() - .getImages(); - switch (((SelectionData) element).type) { - case OBJECT: - case STRING: - return images.getPropText(); - case BOOLEAN: - return images.getPropTrue(); - case REMOTE_ENUM: - case ENUM: - return images.getPropChoice(); - case INT: - return images.getPropInt(); - case FLOAT: - return images.getPropFloat(); - default: - break; - } - } - return null; - } - }); - Collection<LayoutOptionData<?>> data = EclipseLayoutDataService - .getInstance().getOptionData(); - ArrayList<SelectionData> inputList = new ArrayList<SelectionData>( - data.size()); - for (LayoutOptionData<?> optionData : data) { - // layout options without target definition are now shown to the - // user - if (!optionData.getTargets().isEmpty()) { - inputList.add(new SelectionData(optionData)); - } - } - SelectionData[] input = inputList.toArray(new SelectionData[0]); - Arrays.sort(input); - dialog.setInput(input); - if (dialog.open() == ListDialog.OK) { - Object[] result = dialog.getResult(); - if (result != null && result.length > 0) { - return ((SelectionData) result[0]).id; - } - } - return null; - } - - /** - * Create a new data entry for the layout option. - * - * @return a new data entry, or {@code null} if the dialog contents are - * invalid - */ - public OptionsTableProvider.DataEntry createDataEntry() { - if (elementValue != null && optionValue != null) { - String name; - if (elementType == ElementType.DIAG_TYPE) { - name = EclipseLayoutInfoService.getInstance() - .getDiagramTypeName(elementValue); - } else { - int dotIndex = elementValue.lastIndexOf('.'); - name = elementValue.substring(dotIndex + 1); - } - LayoutOptionData<?> optionData = LayoutDataService - .getInstance().getOptionData(optionValue); - if (optionData != null) { - Object value = optionData.getDefault(); - if (value == null) { - value = optionData.getDefaultDefault(); - } - if (name != null && value != null) { - return new OptionsTableProvider.DataEntry(name, - elementValue, elementType, optionData, value); - } - } - } - return null; - } - - } - - /** - * Provider class for the options tables. Contains a label provider and a - * content provider. - * - * @author msp - */ - public static class OptionsTableProvider extends LabelProvider implements - ITableLabelProvider, IStructuredContentProvider { - - /** data type for row entries in the table. */ - public static class DataEntry { - /** name of the associated diagram type or element. */ - private String elementName; - /** identifier of the associated diagram type or element type. */ - private String elementId; - /** type of element (diagram type / model element / edit part). */ - private ElementType type; - /** layout option data. */ - private LayoutOptionData<?> optionData; - /** the current value. */ - private Object value; - - /** - * Creates a data entry. - * - * @param name - * name of the associated diagram type or element - * @param id - * identifier of the associated diagram type or element - * type - * @param thetype - * type of element (diagram type / model element / edit - * part) - * @param theoptionData - * layout option data - * @param thevalue - * the current value - */ - public DataEntry(final String name, final String id, - final ElementType thetype, - final LayoutOptionData<?> theoptionData, - final Object thevalue) { - this.elementName = name; - this.elementId = id; - this.type = thetype; - this.optionData = theoptionData; - this.value = thevalue; - } - - /** - * Returns the associated element name. - * - * @return the name of the associated element - */ - public String getElementName() { - return elementName; - } - - /** - * Returns the associated element identifier. - * - * @return the identifier of the associated element - */ - public String getElementId() { - return elementId; - } - - /** - * Returns the type of element (diagram type / model element / edit - * part). - * - * @return the element type - */ - public ElementType getType() { - return type; - } - - /** - * Returns the option data. - * - * @return the option data - */ - public LayoutOptionData<?> getOptionData() { - return optionData; - } - - /** - * Returns the value. - * - * @return the value - */ - public Object getValue() { - return value; - } - - /** - * Sets the value. - * - * @param thevalue - * the new value - */ - public void setValue(final Object thevalue) { - this.value = thevalue; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(final Object object) { - if (object instanceof DataEntry) { - DataEntry other = (DataEntry) object; - return this.elementId.equals(other.elementId) - && this.optionData.equals(other.optionData); - } else { - return false; - } - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return elementId.hashCode() + optionData.hashCode(); - } - } - - /** the "Element" column. */ - private static final int COL_ELEMENT = 0; - /** the "Type" column. */ - private static final int COL_TYPE = 1; - /** the "Option" column. */ - private static final int COL_OPTION = 2; - /** the "Value" column. */ - private static final int COL_VALUE = 3; - - /** - * {@inheritDoc} - */ - public Image getColumnImage(final Object element, final int columnIndex) { - if (element instanceof DataEntry && columnIndex == COL_VALUE) { - DataEntry entry = (DataEntry) element; - KimlUiPlugin.Images images = KimlUiPlugin.getDefault() - .getImages(); - switch (entry.optionData.getType()) { - case STRING: - return images.getPropText(); - case BOOLEAN: - if ((Boolean) entry.value) { - return images.getPropTrue(); - } else { - return images.getPropFalse(); - } - case REMOTE_ENUM: - case ENUM: - return images.getPropChoice(); - case INT: - return images.getPropInt(); - case FLOAT: - return images.getPropFloat(); - default: - break; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - public String getColumnText(final Object element, final int columnIndex) { - if (element instanceof DataEntry) { - DataEntry entry = (DataEntry) element; - switch (columnIndex) { - case COL_ELEMENT: - return entry.elementName; - case COL_TYPE: - return entry.type.getDescription(); - case COL_OPTION: - return entry.optionData.getName(); - case COL_VALUE: - if (entry.optionData.getType() == LayoutOptionData.Type.ENUM - && entry.value instanceof Integer) { - return entry.optionData.getEnumValue( - (Integer) entry.value).toString(); - } else { - return entry.value.toString(); - } - } - } - return null; - } - - /** - * {@inheritDoc} - */ - public Object[] getElements(final Object inputElement) { - if (inputElement instanceof List<?>) { - @SuppressWarnings("unchecked") - List<DataEntry> list = new ArrayList<DataEntry>( - (List<DataEntry>) inputElement); - ListIterator<DataEntry> listIter = list.listIterator(); - while (listIter.hasNext()) { - DataEntry next = listIter.next(); - if (next.value == null) { - listIter.remove(); - } - } - return list.toArray(); - } else if (inputElement instanceof Object[]) { - return (Object[]) inputElement; - } else { - return null; - } - } - - /** - * {@inheritDoc} - */ - public void inputChanged(final Viewer viewer, final Object oldInput, - final Object newInput) { - } - - } - -} diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/EtriceStructurePreferencePage.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/EtriceStructurePreferencePage.java deleted file mode 100644 index d2b2bfd68..000000000 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/EtriceStructurePreferencePage.java +++ /dev/null @@ -1,473 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Jayant Gupta - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Jayant Gupta (initial contribution) - * - * - *******************************************************************************/ - -package org.eclipse.etrice.ui.layout.preferences; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.eclipse.etrice.ui.layout.Activator; -import org.eclipse.etrice.ui.layout.preferences.ETricePreferenceUtil.ElementType; -import org.eclipse.etrice.ui.layout.preferences.ETricePreferenceUtil.NewOptionDialog; -import org.eclipse.etrice.ui.layout.preferences.ETricePreferenceUtil.OptionsTableProvider; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeNode; -import org.eclipse.jface.viewers.TreeNodeContentProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; -import org.eclipse.ui.dialogs.ListDialog; - -import de.cau.cs.kieler.core.util.Pair; -import de.cau.cs.kieler.kiml.LayoutDataService; -import de.cau.cs.kieler.kiml.LayoutOptionData; -import de.cau.cs.kieler.kiml.ui.Messages; -import de.cau.cs.kieler.kiml.ui.service.EclipseLayoutInfoService; -import de.cau.cs.kieler.kiml.ui.views.LayoutViewPart; - -/** - * Preference page for eTrice Behavior preferences - * - * @author jayant - */ -public class EtriceStructurePreferencePage extends ETriceLayoutPreferencePage { - - /** - * Creates the behavior layout preference page. - * - * @author jayant - */ - public EtriceStructurePreferencePage() { - super(); - setDescription("Preference Page for configuring layout options specific to eTrice Structure diagrams"); - } - - /** table viewer to refresh after changes to the option table data. */ - private TableViewer optionTableViewer; - - /** list of layout option entries. */ - private List<OptionsTableProvider.DataEntry> optionEntries; - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected Control createContents(Composite parent) { - Group optionsGroup = createOptionsGroup(parent); - optionsGroup - .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - return optionsGroup; - } - - /** - * Creates the group that holds the diagram element options table. - * - * @param parent - * the parent control - * @return a group with the diagram element options table - */ - protected Group createOptionsGroup(final Composite parent) { - Group elementGroup = new Group(parent, SWT.NONE); - elementGroup.setText(Messages.getString("kiml.ui.28")); //$NON-NLS-1$ - IPreferenceStore preferenceStore = getPreferenceStore(); - LayoutDataService dataService = LayoutDataService.getInstance(); - Collection<LayoutOptionData<?>> layoutOptionData = dataService - .getOptionData(); - optionEntries = new LinkedList<OptionsTableProvider.DataEntry>(); - - // add options for edit parts and structure domain model elements - Set<String> elements = EclipseLayoutInfoService.getInstance() - .getRegisteredElements(); - - for (String element : elements) { - - //Finding whether diagram element is an Edit Part or Model Element - Class<?> elementClass = null; - ElementType type; - try { - elementClass = Class.forName(element); - try { - type = PictogramElement.class.isAssignableFrom(elementClass) - ? ElementType.EDIT_PART : ElementType.MODEL_ELEM; - } catch (NullPointerException e) { - type = ElementType.MODEL_ELEM; - } - } catch (ClassNotFoundException e) { - type = ElementType.MODEL_ELEM; - } - - //Making the element name more presentable - int dotIndex = element.lastIndexOf('.'); - String partName = element.substring(dotIndex + 1); - if (partName.endsWith("Impl")) { - partName = partName.substring(0, - partName.length() - "Impl".length()); - } - - for (LayoutOptionData<?> data : layoutOptionData) { - String preference = EclipseLayoutInfoService.getPreferenceName( - element, data.getId()); - if (preferenceStore.contains(preference)) { - Object value = data.parseValue(preferenceStore - .getString(preference)); - if (value != null) { - // If element is edit part or structure model element, - // then add to the option table - if (type == ElementType.EDIT_PART - || ETriceDomainModelElement - .isStructureModelElement(element)) - optionEntries - .add(new OptionsTableProvider.DataEntry( - partName, element, type, data, - value)); - } - } - } - } - - // add options for diagram types(only those which are relevant to eTrice - // Structure Diagram) - for (Pair<String, String> diagramType : ETriceDomainModelElement.STRUCTURE_DIAGRAM_TYPES) { - for (LayoutOptionData<?> data : layoutOptionData) { - String preference = EclipseLayoutInfoService.getPreferenceName( - diagramType.getFirst(), data.getId()); - if (preferenceStore.contains(preference)) { - Object value = data.parseValue(preferenceStore - .getString(preference)); - if (value != null) { - optionEntries.add(new OptionsTableProvider.DataEntry( - diagramType.getSecond(), - diagramType.getFirst(), ElementType.DIAG_TYPE, - data, value)); - } - } - } - } - - // create the table and actions to edit layout option values - addOptionTable(elementGroup, optionEntries); - - elementGroup.setLayout(new GridLayout(2, false)); - return elementGroup; - } - - /** - * Adds a table to display options and buttons to edit the options. - * - * @param parent - * the parent to which controls are added - * @param entries - * the list of table entries - */ - private void addOptionTable(final Composite parent, - final List<OptionsTableProvider.DataEntry> entries) { - // construct the options table - final Table table = new Table(parent, SWT.BORDER); - final TableColumn column1 = new TableColumn(table, SWT.NONE); - column1.setText(Messages.getString("kiml.ui.29")); //$NON-NLS-1$ - final TableColumn column2 = new TableColumn(table, SWT.NONE); - column2.setText(Messages.getString("kiml.ui.9")); //$NON-NLS-1$ - final TableColumn column3 = new TableColumn(table, SWT.NONE); - column3.setText(Messages.getString("kiml.ui.19")); //$NON-NLS-1$ - final TableColumn column4 = new TableColumn(table, SWT.NONE); - column4.setText(Messages.getString("kiml.ui.20")); //$NON-NLS-1$ - table.setHeaderVisible(true); - final TableViewer tableViewer = new TableViewer(table); - OptionsTableProvider optionsTableProvider = new OptionsTableProvider(); - tableViewer.setContentProvider(optionsTableProvider); - tableViewer.setLabelProvider(optionsTableProvider); - tableViewer.setInput(entries); - optionTableViewer = tableViewer; - - column1.pack(); - column2.pack(); - column3.pack(); - column4.pack(); - GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, - 1, 1); - table.setLayoutData(tableLayoutData); - table.pack(); - tableLayoutData.heightHint = ETricePreferenceUtil.OPTIONS_TABLE_HEIGHT; - - // add button to add new options - Composite composite = new Composite(parent, SWT.NONE); - final Button newButton = new Button(composite, SWT.PUSH | SWT.CENTER); - newButton.setText(Messages.getString("kiml.ui.41")); //$NON-NLS-1$ - - // add button to edit the options - final Button editButton = new Button(composite, SWT.PUSH | SWT.CENTER); - editButton.setText(Messages.getString("kiml.ui.21")); //$NON-NLS-1$ - editButton.setEnabled(false); - editButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - OptionsTableProvider.DataEntry entry = ETricePreferenceUtil - .getEntry(entries, table.getSelectionIndex()); - if (entry != null) { - ETricePreferenceUtil.showEditDialog(parent.getShell(), - entry); - tableViewer.refresh(); - } - } - }); - - // add button to remove an option - final Button removeButton = new Button(composite, SWT.PUSH | SWT.CENTER); - removeButton.setText(Messages.getString("kiml.ui.22")); //$NON-NLS-1$ - removeButton.setEnabled(false); - removeButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - OptionsTableProvider.DataEntry entry = ETricePreferenceUtil - .getEntry(entries, table.getSelectionIndex()); - if (entry != null) { - entry.setValue(null); - tableViewer.refresh(); - int count = 0; - for (OptionsTableProvider.DataEntry e : entries) { - if (e.getValue() != null) { - count++; - } - } - if (count == 0) { - editButton.setEnabled(false); - removeButton.setEnabled(false); - } - } - } - }); - - // react on selection changes of the options table - table.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - if (!entries.isEmpty() && event.item != null) { - editButton.setEnabled(true); - removeButton.setEnabled(true); - } else { - editButton.setEnabled(false); - removeButton.setEnabled(false); - } - } - }); - newButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - int newIndex = showNewDialog(parent.getShell(), entries); - if (newIndex >= 0) { - tableViewer.refresh(); - tableViewer.setSelection(new StructuredSelection(entries - .get(newIndex))); - editButton.setEnabled(true); - removeButton.setEnabled(true); - column1.pack(); - column2.pack(); - column3.pack(); - column4.pack(); - } - } - }); - - composite.setLayout(new FillLayout(SWT.VERTICAL)); - GridData compositeLayoutData = new GridData(SWT.LEFT, SWT.TOP, false, - false, 1, 1); - composite.setLayoutData(compositeLayoutData); - } - - /** - * Shows an input dialog to add a new layout option to the list. - * - * @param shell - * the current shell - * @param entries - * the list of table entries - * @return the table index to put focus on, or -1 if the focus should not be - * changed - */ - private int showNewDialog(final Shell shell, - final List<OptionsTableProvider.DataEntry> entries) { - NewOptionDialog dialog = new NewOptionDialog(shell) { - // Overriding the function for Behavior diagrams specific - // implementation - - /** - * @author jayant - */ - @Override - protected String showBrowseModelElementDialog() { - ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( - this.getShell(), new LabelProvider(), - new TreeNodeContentProvider()); - dialog.setTitle("Select Structure Model Element"); - - TreeNode[] input = ETriceDomainModelElement.STRUCTURE_MODEL - .getChildren(); - dialog.setInput(input); - - if (dialog.open() == ElementTreeSelectionDialog.OK) { - Object[] result = dialog.getResult(); - if (result != null && result.length > 0) { - return ((ETriceDomainModelElement) result[0]).getId(); - } - } - return null; - } - - /** - * @author jayant - */ - @Override - protected String showBrowseDiagtDialog() { - ListDialog dialog = new ListDialog(this.getShell()); - dialog.setTitle(Messages.getString("kiml.ui.57")); //$NON-NLS-1$ - dialog.setContentProvider(ArrayContentProvider.getInstance()); - dialog.setLabelProvider(new LabelProvider()); - - SelectionData[] input = new SelectionData[ETriceDomainModelElement.STRUCTURE_DIAGRAM_TYPES - .size()]; - int i = 0; - for (Pair<String, String> type : ETriceDomainModelElement.STRUCTURE_DIAGRAM_TYPES) { - SelectionData seld = new SelectionData(type); - input[i++] = seld; - } - Arrays.sort(input); - dialog.setInput(input); - if (dialog.open() == ListDialog.OK) { - Object[] result = dialog.getResult(); - if (result != null && result.length > 0) { - return ((SelectionData) result[0]).getId(); - } - } - return null; - } - }; - if (dialog.open() == NewOptionDialog.OK) { - OptionsTableProvider.DataEntry newEntry = dialog.createDataEntry(); - if (newEntry == null) { - MessageDialog.openError(shell, - Messages.getString("kiml.ui.51"), - Messages.getString("kiml.ui.52")); - } else { - // look for an existing entry with same identifiers - int oldIndex = 0; - OptionsTableProvider.DataEntry oldEntry = null; - for (OptionsTableProvider.DataEntry e : entries) { - if (e.getValue() != null) { - if (e.equals(newEntry)) { - oldEntry = e; - break; - } - oldIndex++; - } - } - if (oldEntry != null) { - return oldIndex; - } else { - entries.add(newEntry); - return entries.size() - 1; - } - } - } - return -1; - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - public void init(final IWorkbench workbench) { - setPreferenceStore(Activator.getDefault().getSharedPreferenceStore()); - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - protected void performDefaults() { - super.performDefaults(); - - // clear the layout options table - for (OptionsTableProvider.DataEntry entry : optionEntries) { - entry.setValue(null); - } - optionTableViewer.refresh(); - } - - /** - * {@inheritDoc} - * - * @author jayant - */ - @Override - public boolean performOk() { - EclipseLayoutInfoService infoService = EclipseLayoutInfoService - .getInstance(); - IPreferenceStore preferenceStore = getPreferenceStore(); - - // store data for the diagram element and diagram type options - for (OptionsTableProvider.DataEntry entry : optionEntries) { - Object oldValue = infoService.getOptionValue(entry.getElementId(), - entry.getOptionData().getId()); - Object newValue = entry.getValue(); - if (oldValue == null && newValue != null - || !oldValue.equals(newValue)) { - String preference = EclipseLayoutInfoService.getPreferenceName( - entry.getElementId(), entry.getOptionData().getId()); - if (newValue == null) { - infoService.removeOptionValue(entry.getElementId(), entry - .getOptionData().getId()); - preferenceStore.setToDefault(preference); - infoService.getRegisteredElements().remove( - entry.getElementId()); - } else { - infoService.addOptionValue(entry.getElementId(), entry - .getOptionData().getId(), newValue); - preferenceStore.setValue(preference, newValue.toString()); - if (entry.getType() != ElementType.DIAG_TYPE) { - infoService.getRegisteredElements().add( - entry.getElementId()); - } - } - } - } - - LayoutViewPart layoutView = LayoutViewPart.findView(); - if (layoutView != null) { - layoutView.refresh(); - } - return true; - } - -} diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip Binary files differindex 7bbd0b02c..54558e292 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip Binary files differindex 710a6a449..05e4d10a1 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip Binary files differindex 3a03a99ca..7d6c3df14 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip Binary files differindex 03ecefe25..462449c24 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip Binary files differindex 41769a96a..ea4301b99 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip Binary files differindex b8d886b42..3ee2d28f4 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip Binary files differindex e3c293bd8..659a475dd 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip Binary files differindex 0f2614c73..5bff1e19b 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip Binary files differindex de4b337da..d370a20f3 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip Binary files differindex 8741b90c7..e887aca17 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip Binary files differindex a29ab097e..e29128ff0 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip Binary files differindex 7bcda84e6..b8f234e73 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip Binary files differindex 09d9e4751..919480bf0 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/DiagramRefreshBehavior.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/DiagramRefreshBehavior.java index df877f5fb..7782206fe 100644 --- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/DiagramRefreshBehavior.java +++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/DiagramRefreshBehavior.java @@ -33,7 +33,7 @@ public class DiagramRefreshBehavior extends DefaultRefreshBehavior { } @Override - protected void handleAutoUpdateAtStartup() { + public void handleAutoUpdateAtStartup() { IDiagramTypeProvider diagramTypeProvider = diagramBehavior.getDiagramTypeProvider(); if (diagramTypeProvider.isAutoUpdateAtStartup()) { StructureClass sc = structureEditor.getStructureClass(); @@ -46,7 +46,7 @@ public class DiagramRefreshBehavior extends DefaultRefreshBehavior { } @Override - protected void handleAutoUpdateAtReset() { + public void handleAutoUpdateAtReset() { super.handleAutoUpdateAtReset(); } |