Loading de.ugoe.cs.swe.TTCN3.ui/src/de/ugoe/cs/swe/ui/TTCN3UiModule.java +25 −0 Original line number Diff line number Diff line Loading @@ -3,7 +3,11 @@ */ package de.ugoe.cs.swe.ui; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.xtext.builder.IXtextBuilderParticipant; import org.eclipse.xtext.builder.nature.NatureAddingEditorCallback; Loading @@ -17,6 +21,10 @@ import com.google.common.base.Predicate; import com.google.inject.Binder; import com.google.inject.name.Names; import de.ugoe.cs.swe.TTCN3.ui.internal.TTCN3Activator; import de.ugoe.cs.swe.TTCN3Configuration.QualityCheckProfile; import de.ugoe.cs.swe.common.ConfigTools; import de.ugoe.cs.swe.ui.preferences.TTCN3PreferenceInitializer; import de.ugoe.cs.swe.ui.preferences.TTCN3RootPreferencePage; import de.ugoe.cs.swe.ui.syntaxcoloring.TTCN3HighlightingCalculator; import de.ugoe.cs.swe.ui.syntaxcoloring.TTCN3HighlightingConfiguration; Loading Loading @@ -59,6 +67,23 @@ public class TTCN3UiModule extends de.ugoe.cs.swe.ui.AbstractTTCN3UiModule { return false; } }); //TODO: duplicated from TTCN3RootPreferencePage -> factor out! final IPreferenceStore store = TTCN3Activator.getInstance().getPreferenceStore(); final QualityCheckProfile activeProfile = (QualityCheckProfile) ConfigTools.getInstance().getSelectedProfile(); String[] booleans = TTCN3PreferenceInitializer.getBooleans(); //Update profile from stored settings for (String s : booleans) { try { boolean v = store.getBoolean(s); Method method = activeProfile.getClass().getDeclaredMethod("set"+(""+s.charAt(0)).toUpperCase()+s.substring(1), Boolean.TYPE); method.invoke(activeProfile, v); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } //store.setDefault("checkNoUninitialisedVariables", activeProfile.isCheckNoUninitialisedVariables()); } } public Class<? extends IXtextEditorCallback> bindIXtextEditorCallback() { Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/TTCN3.xtext +11 −7 Original line number Diff line number Diff line Loading @@ -9,10 +9,12 @@ TTCN3File: modules+=TTCN3Module*; ConstDef: CONSTKEYWORD type=Type defs=ConstList; //TODO: workaround for automatic type may have performance implications CONSTKEYWORD ((type=Type defs=ConstList) | defs=ConstList); Type: pre=PredefinedType | ref=TypeReference extensions+=ExtendedFieldReference*; //TODO: any is not part of the grammar directly so far, needs to be restricted to ExtFunctionDef only any=ANYKEYWORD | pre=PredefinedType | ref=TypeReference extensions+=ExtendedFieldReference*; TypeReferenceTailType: ReferencedType | FieldReference; Loading Loading @@ -40,7 +42,8 @@ ModuleParDef: MODULEPARKEYWORD (param=ModulePar | LBRACKET multitypeParam=MultitypedModuleParList RBRACKET); ModulePar: type=Type list=ModuleParList; //TODO: template modifier? ((type=Type) list=ModuleParList) | list=ModuleParList; ModuleParList: params+=ModuleParameter (COMMA params+=ModuleParameter)*; Loading Loading @@ -664,8 +667,9 @@ TimerInstance: TIMERKEYWORD list=VarList; VarInstance: VARKEYWORD ((listMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? listType=Type list=VarList) | ((TEMPLATEKEYWORD | resTemplate=RestrictedTemplate) tempMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? type=Type tempList=TempVarList)); //TODO: workarounds for automatic type support may have performance implications VARKEYWORD ((listMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? ((listType=Type list=VarList) | list=VarList) ) | ((TEMPLATEKEYWORD | resTemplate=RestrictedTemplate) tempMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? ((type=Type tempList=TempVarList) | tempList=TempVarList)) ); VarList: variables+=SingleVarInstance (COMMA variables+=SingleVarInstance)*; Loading Loading @@ -1119,7 +1123,7 @@ SpecElement: Head | RefValueTail; ExtendedFieldReference: DOT (field=[FieldReference|IDENTIFIER] | type=PredefinedType) | array=ArrayOrBitRef | decoded=DecodedFieldReference | {ExtendedFieldReference} (DOT (field=[FieldReference|IDENTIFIER] | type=PredefinedType)) | array=ArrayOrBitRef | decoded=DecodedFieldReference | {ExtendedFieldReference} SQUAREOPEN MINUS SQUARECLOSE; DecodedFieldReference: Loading @@ -1127,7 +1131,7 @@ DecodedFieldReference: ; DecodedFieldType: type=Type type=Type | (LPAREN type=Type (COMMA expr=Expression)? RPAREN) ; // BaseTemplate contained in FunctionRef Loading Loading
de.ugoe.cs.swe.TTCN3.ui/src/de/ugoe/cs/swe/ui/TTCN3UiModule.java +25 −0 Original line number Diff line number Diff line Loading @@ -3,7 +3,11 @@ */ package de.ugoe.cs.swe.ui; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.xtext.builder.IXtextBuilderParticipant; import org.eclipse.xtext.builder.nature.NatureAddingEditorCallback; Loading @@ -17,6 +21,10 @@ import com.google.common.base.Predicate; import com.google.inject.Binder; import com.google.inject.name.Names; import de.ugoe.cs.swe.TTCN3.ui.internal.TTCN3Activator; import de.ugoe.cs.swe.TTCN3Configuration.QualityCheckProfile; import de.ugoe.cs.swe.common.ConfigTools; import de.ugoe.cs.swe.ui.preferences.TTCN3PreferenceInitializer; import de.ugoe.cs.swe.ui.preferences.TTCN3RootPreferencePage; import de.ugoe.cs.swe.ui.syntaxcoloring.TTCN3HighlightingCalculator; import de.ugoe.cs.swe.ui.syntaxcoloring.TTCN3HighlightingConfiguration; Loading Loading @@ -59,6 +67,23 @@ public class TTCN3UiModule extends de.ugoe.cs.swe.ui.AbstractTTCN3UiModule { return false; } }); //TODO: duplicated from TTCN3RootPreferencePage -> factor out! final IPreferenceStore store = TTCN3Activator.getInstance().getPreferenceStore(); final QualityCheckProfile activeProfile = (QualityCheckProfile) ConfigTools.getInstance().getSelectedProfile(); String[] booleans = TTCN3PreferenceInitializer.getBooleans(); //Update profile from stored settings for (String s : booleans) { try { boolean v = store.getBoolean(s); Method method = activeProfile.getClass().getDeclaredMethod("set"+(""+s.charAt(0)).toUpperCase()+s.substring(1), Boolean.TYPE); method.invoke(activeProfile, v); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } //store.setDefault("checkNoUninitialisedVariables", activeProfile.isCheckNoUninitialisedVariables()); } } public Class<? extends IXtextEditorCallback> bindIXtextEditorCallback() { Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/TTCN3.xtext +11 −7 Original line number Diff line number Diff line Loading @@ -9,10 +9,12 @@ TTCN3File: modules+=TTCN3Module*; ConstDef: CONSTKEYWORD type=Type defs=ConstList; //TODO: workaround for automatic type may have performance implications CONSTKEYWORD ((type=Type defs=ConstList) | defs=ConstList); Type: pre=PredefinedType | ref=TypeReference extensions+=ExtendedFieldReference*; //TODO: any is not part of the grammar directly so far, needs to be restricted to ExtFunctionDef only any=ANYKEYWORD | pre=PredefinedType | ref=TypeReference extensions+=ExtendedFieldReference*; TypeReferenceTailType: ReferencedType | FieldReference; Loading Loading @@ -40,7 +42,8 @@ ModuleParDef: MODULEPARKEYWORD (param=ModulePar | LBRACKET multitypeParam=MultitypedModuleParList RBRACKET); ModulePar: type=Type list=ModuleParList; //TODO: template modifier? ((type=Type) list=ModuleParList) | list=ModuleParList; ModuleParList: params+=ModuleParameter (COMMA params+=ModuleParameter)*; Loading Loading @@ -664,8 +667,9 @@ TimerInstance: TIMERKEYWORD list=VarList; VarInstance: VARKEYWORD ((listMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? listType=Type list=VarList) | ((TEMPLATEKEYWORD | resTemplate=RestrictedTemplate) tempMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? type=Type tempList=TempVarList)); //TODO: workarounds for automatic type support may have performance implications VARKEYWORD ((listMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? ((listType=Type list=VarList) | list=VarList) ) | ((TEMPLATEKEYWORD | resTemplate=RestrictedTemplate) tempMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? ((type=Type tempList=TempVarList) | tempList=TempVarList)) ); VarList: variables+=SingleVarInstance (COMMA variables+=SingleVarInstance)*; Loading Loading @@ -1119,7 +1123,7 @@ SpecElement: Head | RefValueTail; ExtendedFieldReference: DOT (field=[FieldReference|IDENTIFIER] | type=PredefinedType) | array=ArrayOrBitRef | decoded=DecodedFieldReference | {ExtendedFieldReference} (DOT (field=[FieldReference|IDENTIFIER] | type=PredefinedType)) | array=ArrayOrBitRef | decoded=DecodedFieldReference | {ExtendedFieldReference} SQUAREOPEN MINUS SQUARECLOSE; DecodedFieldReference: Loading @@ -1127,7 +1131,7 @@ DecodedFieldReference: ; DecodedFieldType: type=Type type=Type | (LPAREN type=Type (COMMA expr=Expression)? RPAREN) ; // BaseTemplate contained in FunctionRef Loading