Commit 9c2030ab authored by Leonard Faecke's avatar Leonard Faecke
Browse files

Merge remote-tracking branch 'origin/dev' into analyzer

parents 083c3388 dff1575f
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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() {
+11 −7
Original line number Diff line number Diff line
@@ -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;
@@ -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)*;
@@ -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)*;
@@ -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:
@@ -1127,7 +1131,7 @@ DecodedFieldReference:
;

DecodedFieldType:
	type=Type
	type=Type | (LPAREN type=Type (COMMA expr=Expression)? RPAREN)
;

	// BaseTemplate contained in FunctionRef