/// <summary> /// Configures the filtering dialog /// </summary> /// <param name="efsSystem"></param> /// <param name="filterConfiguration"></param> public void Configure(EfsSystem efsSystem, FilterConfiguration filterConfiguration) { ruleActivationCheckBox.Checked = filterConfiguration.RuleFired; expectationsCheckBox.Checked = filterConfiguration.Expect; variableUpdateCheckBox.Checked = filterConfiguration.VariableUpdate; List<Dictionary> dictionaries = new List<Dictionary>(efsSystem.Dictionaries); dictionaries.Sort(Compare); foreach (Dictionary dictionary in dictionaries) { NamableTreeNode dictionaryTreeNode = new NamableTreeNode(dictionary); nameSpaceTreeView.Nodes.Add(dictionaryTreeNode); List<NameSpace> nameSpaces = new List<NameSpace>(); foreach (NameSpace nameSpace in dictionary.NameSpaces) { nameSpaces.Add(nameSpace); } nameSpaces.Sort(); foreach (NameSpace nameSpace in nameSpaces) { GatherNamespaces(dictionaryTreeNode, nameSpace, filterConfiguration); } } regExpTextBox.Text = filterConfiguration.RegExp; }
/// <summary> /// Constructor /// </summary> /// <param name="system"></param> public MessageCounter(EfsSystem system) { Info = 0; Warning = 0; Error = 0; foreach (Dictionary dictionary in system.Dictionaries) { visit(dictionary, true); } }
/// <summary> /// Constructor /// </summary> /// <param name="fileName">The file path of the file to load</param> /// <param name="system">The EFS system for which the load is performed</param> /// <param name="allowErrors">Indicates that errors are allowed during load</param> /// <param name="updateGuid">Indicates that the GUID should be set during load</param> public OpenFileOperation(string fileName, EfsSystem system, bool allowErrors, bool updateGuid) { FileName = fileName; System = system; if (allowErrors) { ErrorsDuringLoad = new List<ElementLog>(); } else { ErrorsDuringLoad = null; } UpdateGuid = updateGuid; PleaseLockFiles = Util.PleaseLockFiles; }
/// <summary> /// Constructor /// </summary> /// <param name="dictionary"></param> public DictionaryWatcher(EfsSystem system, Dictionary dictionary) { System = system; Dictionary = dictionary; LastChange = DateTime.Now; DeltaTime = new TimeSpan(0, 0, 2); CriticalRegion = new Mutex(false, "Critical region"); if (dictionary.FilePath != null) { if (dictionary.countNameSpaces() > 0) { string path = Path.GetDirectoryName(dictionary.FilePath) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(dictionary.FilePath); path = Path.GetFullPath(path); Directory.CreateDirectory(path); Watcher = new FileSystemWatcher(path, "*.*") { IncludeSubdirectories = true, NotifyFilter = NotifyFilters.LastWrite }; } else { string path = Path.GetDirectoryName(dictionary.FilePath); string fileName = Path.GetFileName(dictionary.FilePath); Watcher = new FileSystemWatcher(path, fileName) { IncludeSubdirectories = false, NotifyFilter = NotifyFilters.LastWrite }; } Watcher.Changed += Watcher_Changed; Watcher.Created += Watcher_Changed; Watcher.Deleted += Watcher_Changed; StartWatching(); } }
/// <summary> /// Provides all the function calls related to this namespace /// </summary> /// <param name="system">The system in which the calls should be gathered</param> /// <param name="container">If provided, indicates that the calls should be limited to a given container</param> /// <returns></returns> public static List<AccessMode> getAccesses(EfsSystem system, IEnclosesNameSpaces container = null) { SortedSet<ProcedureOrFunctionCall> procedureCalls = new SortedSet<ProcedureOrFunctionCall>(); SortedSet<AccessToVariable> accessesToVariables = new SortedSet<AccessToVariable>(); foreach (Usage usage in system.FindReferences(IsCallableOrIsVariable.INSTANCE)) { ModelElement target = (ModelElement) usage.Referenced; ModelElement source = usage.User; NameSpace sourceNameSpace = getCorrespondingNameSpace(source, container, true); NameSpace targetNameSpace = getCorrespondingNameSpace(target, container, false); if (IsCallable.Predicate(usage.Referenced)) { if (considerCall(usage, container, sourceNameSpace, targetNameSpace)) { procedureCalls.Add(new ProcedureOrFunctionCall(sourceNameSpace, targetNameSpace, (ICallable) target)); } } else { // IsVariable(usage.Referenced) if (considerVariableReference(usage, container, sourceNameSpace, targetNameSpace)) { Usage.ModeEnum mode = (Usage.ModeEnum) usage.Mode; // Find a corresponding access to variable (same source and target namespaces, and same variable AccessToVariable otherAccess = null; foreach (AccessToVariable access in accessesToVariables) { if (access.Target == usage.Referenced && access.Source == sourceNameSpace && access.Target == targetNameSpace) { otherAccess = access; break; } } if (otherAccess != null) { if (otherAccess.AccessMode != mode) { // Since the access mode is different, one of them is either Read or ReadWrite and the other is ReadWrite or Write. // So, in any case, the resulting access mode is ReadWrite accessesToVariables.Remove(otherAccess); accessesToVariables.Add(new AccessToVariable(sourceNameSpace, targetNameSpace, (IVariable) target, Usage.ModeEnum.ReadAndWrite)); } else { // Already exists, do nothing } } else { // Does not already exists, insert it in the list accessesToVariables.Add(new AccessToVariable(sourceNameSpace, targetNameSpace, (IVariable) target, mode)); } } } } // Build the results based on the intermediate results List<AccessMode> retVal = new List<AccessMode>(); retVal.AddRange(procedureCalls); retVal.AddRange(accessesToVariables); return retVal; }