示例#1
0
        public static List <ITextLine> InsertChildren(SymbolTable table, DataDefinition type, int level, int indent)
        {
            var lines = new List <ITextLine>();

            foreach (var child in type.Children)
            {
                if (child is TypedDataNode)
                {
                    continue;
                }
                var  typed           = (ITypedNode)child;
                var  types           = table.GetType(typed.DataType);
                bool isCustomTypeToo = !(child is TypeDefinition) && (types.Count > 0);
                if (child.CodeElement is DataDefinitionEntry)
                {
                    lines.Add(CreateDataDefinition((DataDefinitionEntry)child.CodeElement, level, indent, isCustomTypeToo, false, isCustomTypeToo ? types[0] : null));
                }
                else
                {//Humm ... It will be a bug.
                    System.Diagnostics.Debug.Assert(child.CodeElement is DataDefinitionEntry);
                }
                if (isCustomTypeToo)
                {
                    lines.AddRange(InsertChildren(table, types[0], level + 1, indent + 1));
                }
                else
                {
                    lines.AddRange(InsertChildren(table, child as DataDefinition, level + 1, indent + 1));
                }
            }
            return(lines);
        }
    public string GetActualAdditionalColumns()
    {
        List <string> Columns = new List <string>();
        string        Culture = SqlHelper.EscapeQuotes(DataHelper.GetNotEmpty(URLHelper.GetQueryValue(Request.RawUrl, "culture"), "en-US"));

        foreach (string AdditionalColumn in AdditionalColumns.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
        {
            string CleanAdditionalColumn = AdditionalColumn.ToLower().Trim();
            if (DocumentColumnsToDataClass.ContainsKey(CleanAdditionalColumn))
            {
                Columns.Add(string.Format("(select top 1 {0} from CMS_Document where DocumentNodeID = NodeID order by (case when DocumentCulture = '{1}' then 0 else 1 end)) as {0}", CleanAdditionalColumn, Culture));
            }
            else if (ColumnsToDataClass.ContainsKey(CleanAdditionalColumn))
            {
                DataClassInfo  ClassObj    = ColumnsToDataClass[CleanAdditionalColumn];
                DataDefinition ClassFields = new DataDefinition(ClassObj.ClassXmlSchema);
                Columns.Add(string.Format("(select top 1 {0} from {1} where {2} = (select top 1 DocumentForeignKeyValue from CMS_Document where DocumentNodeID = NodeID  order by (case when DocumentCulture = '{3}' then 0 else 1 end))) as {0}"
                                          , CleanAdditionalColumn, ClassObj.ClassTableName, ClassToPrimaryKeyColumn[ClassObj.ClassName.ToLower()], Culture));
            }
            else
            {
                Columns.Add(AdditionalColumn);
            }
        }
        return(string.Join(",", Columns));
    }
示例#3
0
        public void MatchVariable(IList <DataDefinition> found, DataDefinition heaDataDefinition, QualifiedName name,
                                  int nameIndex, DataDefinition currentDataDefinition)
        {
            var currentTypeDef = currentDataDefinition as TypeDefinition;

            //Name match ?
            if (currentTypeDef == null && //Do not try to match a TYPEDEF name
                name[nameIndex].Equals(currentDataDefinition.Name, StringComparison.InvariantCultureIgnoreCase))
            {
                nameIndex--;
                if (nameIndex < 0)   //We reached the end of the name : it's a complete match

                {
                    var parentTypeDef = currentDataDefinition.GetParentTypeDefinition;
                    if (parentTypeDef != null)   //We are under a TypeDefinition
                    //For each variable declared with this type (or a type that use this type), we need to add the headDataDefinition
                    {
                        AddAllReference(found, heaDataDefinition, parentTypeDef);
                    }
                    else     //we are on a variable
                    {
                        found.Add(heaDataDefinition);
                    }

                    //End here
                    return;
                }

                //else it's not the end of name, let's continue with next part of QualifiedName
            }


            //Either we have a match or not, we need to continue to the parent or DataDefinition that use this TypeDefinition
            var parent = currentDataDefinition.Parent as DataDefinition;

            if (parent != null)
            {
                MatchVariable(found, heaDataDefinition, name, nameIndex, parent);
                return;
            }


            if (currentTypeDef != null)
            {
                foreach (var reference in currentTypeDef.References)
                {
                    //references property of a TypeDefinition can lead to variable in totally others scopes, like in another program
                    //So we need to check if we can access this variable
                    if (reference.IsPartOfATypeDef || GetVariable(reference.Name).Contains(reference))
                    {
                        MatchVariable(found, heaDataDefinition, name, nameIndex, reference);
                    }
                }
                return;
            }


            //If we reach here, it means we are on a DataDefinition with no parent
            //==> End of treatment, there is no match
        }
示例#4
0
 public selectlabel_test()
 {
     InitializeComponent();
     dcore = new DataCoreLibrary();
     DataControls.LoadComboBoxData(cmbunit, DataDefinition.GetUnitTab(), "UNITNAME", "REFNUM");
     cmbunit.SelectedValue = 0;
 }
        public static IReadOnlyList <Node> GetTypeChildrens(SymbolTable symbolTable, DataDefinition dataDefNode)
        {
            if (symbolTable == null || dataDefNode == null)
            {
                return(null);
            }

            var type = symbolTable.GetTypes(
                t => t.Name.Equals(dataDefNode.DataType.Name, StringComparison.InvariantCultureIgnoreCase)
                ||
                t.VisualQualifiedName.ToString()
                .Equals(dataDefNode.DataType.Name, StringComparison.InvariantCultureIgnoreCase),
                new List <SymbolTable.Scope>
            {
                SymbolTable.Scope.Declarations,
                SymbolTable.Scope.Global,
                SymbolTable.Scope.Intrinsic,
                SymbolTable.Scope.Namespace
            }).FirstOrDefault();

            if (type != null)
            {
                return(type.Children);
            }
            else
            {
                return(null);
            }
        }
        public void Read(Stream input, DataDefinition data, Stream output)
        {
            switch (data.Type.CompressionMode)
            {
            case CompressionMode.CompressedPerType:
            {
                var buffer = this.GetType(input, data.Type);
                buffer.Seek(data.Offset, SeekOrigin.Begin);
                output.WriteFromStream(buffer, data.UncompressedSize);
                return;
            }

            case CompressionMode.CompressedPerResource:
            {
                input.Seek(data.Type.Offset, SeekOrigin.Begin);
                input.Seek(data.Offset, SeekOrigin.Current);
                var zlib = new InflaterInputStream(input);
                output.WriteFromStream(zlib, data.UncompressedSize);
                return;
            }

            default:
            {
                throw new NotImplementedException();
            }
            }
        }
示例#7
0
        public override bool Visit(DataDefinition dataDefinition)
        {
            if (dataDefinition.CodeElement is CommonDataDescriptionAndDataRedefines)
            {
                CheckPicture(dataDefinition);
            }

            //Check if DataDefinition is level 88 and declared under BOOL variable
            if (!(dataDefinition.CodeElement is DataDefinitionEntry))
            {
                return(true);
            }

            var levelNumber          = ((DataDefinitionEntry)dataDefinition.CodeElement).LevelNumber;
            var dataDefinitionParent = (dataDefinition.Parent as DataDefinition);

            if (levelNumber != null && dataDefinitionParent != null &&
                dataDefinitionParent.DataType == DataType.Boolean && levelNumber.Value == 88)
            {
                DiagnosticUtils.AddError(dataDefinition.CodeElement,
                                         "The Level 88 symbol '" + dataDefinition.Name + "' cannot be declared under a BOOL typed symbol");
            }
            if (levelNumber != null && !(levelNumber.Value == 01 || levelNumber.Value == 77) &&
                dataDefinitionParent == null)
            {
                DiagnosticUtils.AddError(dataDefinition.CodeElement,
                                         "The variable '" + dataDefinition.Name + "' can only be of level 01 or 77");
            }

            return(true);
        }
示例#8
0
        public navy_search(string id13, string name, string sname, string status, string mode)
        {
            dcore = new DataCoreLibrary();
            InitializeComponent();
            DataControls.LoadComboBoxData(cmbselectaddress, DataDefinition.GetUnitTab(), "unitname", "REFNUM");
            if (!string.IsNullOrEmpty(txtid13.Text.Trim()))
            {
                id13 = txtid13.Text.Trim();
            }
            else if (!string.IsNullOrEmpty(id13))
            {
                txtid13.Text = id13;
            }

            if (!string.IsNullOrEmpty(txtname.Text.Trim()))
            {
                name = txtname.Text.Trim();
            }
            else if (!string.IsNullOrEmpty(name))
            {
                txtname.Text = name;
            }
            if (!string.IsNullOrEmpty(txtlname.Text.Trim()))
            {
                sname = txtlname.Text.Trim();
            }
            else if (!string.IsNullOrEmpty(sname))
            {
                txtlname.Text = sname;
            }
            mode_search = mode;

            GetData(id13, name, sname, status);
        }
示例#9
0
        public static void WriteDelete <T>(T item)
        {
            DataDefinition def = DataDefinition.FromType(item.GetType());

            Console.WriteLine("Delete:\r\n    " + def.GenerateDeleteSQL());
            Console.WriteLine();
        }
示例#10
0
        //- instructions ------------------------------------------------------

        public PseudoOp handlePseudoOp(Token token)
        {
            PseudoOp pseudo = null;

            switch (token.strval)
            {
            case "DB":
            case "DW":
            case "DD":
            case "DQ":
            case "DT":
                char    ch   = token.strval[1];
                int     size = (ch == 'B') ? 1 : (ch == 'W') ? 2 : (ch == 'D') ? 4 : (ch == 'Q') ? 8 : 10;
                Operand val  = getOperand();
                pseudo = new DataDefinition(size, val);
                break;
            }

            //skip any trailing junk & goto eoln
            while (token.type != TokenType.EOLN)
            {
                token = prep.getToken();
            }
            return(pseudo);
        }
        public static CompletionItem CreateCompletionItemForVariable(DataDefinition variable, bool useQualifiedName = true)
        {
            var qualifiedName = variable.VisualQualifiedName.ToString()
                                .Split(variable.VisualQualifiedName.Separator)
                                .Skip(variable.VisualQualifiedName.Count > 1 ? 1 : 0); //Skip Program Name

            var finalQualifiedName = qualifiedName.ToList();

            if (variable.CodeElement != null && variable.CodeElement.IsInsideCopy())
            {
                finalQualifiedName.Clear();

#if EUROINFO_RULES
                var lastSplited = qualifiedName.Last().Split('-');
                if (!qualifiedName.First().Contains(lastSplited.First()))
                {
                    finalQualifiedName.Add(qualifiedName.First());
                }
#else
                finalQualifiedName.Add(qualifiedName.First());
#endif
                if (qualifiedName.First() != qualifiedName.Last())
                {
                    finalQualifiedName.Add(qualifiedName.Last());
                }
            }

            var variableArrangedQualifiedName = useQualifiedName ? string.Join("::", finalQualifiedName) : variable.Name;

            var variableDisplay = string.Format("{0} ({1}) ({2})", variable.Name, variable.DataType.Name, variableArrangedQualifiedName);
            return(new CompletionItem(variableDisplay)
            {
                insertText = variableArrangedQualifiedName, kind = CompletionItemKind.Variable
            });
        }
        //-----------------------------------------------------------------------
        public ReferenceItem(DataDefinition definition, UndoRedoManager undoRedo) : base(definition, undoRedo)
        {
            SelectedDefinition = (Tuple <string, string>)(definition as ReferenceDefinition).ItemsSource.GetItemAt(0);

            PropertyChanged += (e, args) =>
            {
                if (args.PropertyName == "DataModel")
                {
                    if (WrappedItem != null)
                    {
                        WrappedItem.DataModel = DataModel;
                    }
                }
                else if (args.PropertyName == "Parent")
                {
                    if (WrappedItem != null)
                    {
                        Future.Call(() =>
                        {
                            try
                            {
                                Name = Parent is CollectionChildItem && !(((Parent as CollectionChildItem).ParentCollection.Definition as CollectionDefinition)?.ChildrenAreUnique ?? false) ? WrappedItem.Name : Definition.Name + " (" + WrappedItem.Name + ")";
                            }
                            catch (Exception)
                            {
                            }
                        }, 10);
                    }
                }
            };
        }
示例#13
0
        private void cmbUnit_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbSubUnit.DataSource = null;
            object value = ((ComboBox)sender).SelectedValue;

            if (value != null)
            {
                DataControls.LoadComboBoxData(cmbSubUnit, DataDefinition.GetSubUnitmoreTab(DataControls.GetSelectedValueComboBoxToString(cmbUnit)), "unit_name", "subunit_id");
                DataRow dr = dcore.GetAddress(DataControls.GetSelectedValueComboBoxToString(cmbUnit));
                if (dr != null)
                {
                    txtaddress_old.Text      = dr["ADDRESS"].ToString();
                    txtaddress_mu_old.Text   = dr["ADDRESS_MU"].ToString();
                    txtaddress_soid_old.Text = dr["ADDRESS_SOIL"].ToString();
                    txtaddress_road_old.Text = dr["ADDRESS_ROAD"].ToString();
                    string tcode = dr["TOWNCODE"].ToString();
                    if (!string.IsNullOrEmpty(tcode))
                    {
                        try
                        {
                            townnameManage.LoadProvinceToComboBox(cmbprovince_old, tcode);
                            cmbprovince_old.SelectedValue = tcode.Substring(0, 2) + "0000";
                            townnameManage.LoadCityToComboBox(cmbdistrict_old, tcode.Substring(0, 2) + "0000", tcode.Substring(0, 4) + "00");
                            townnameManage.LoadTumbonToComboBox(cmbsub_district_old, tcode.Substring(0, 4) + "00", tcode);
                        }
                        catch { }
                    }
                }
            }
        }
示例#14
0
        public static void WriteInsert <T>(T item)
        {
            DataDefinition def = DataDefinition.FromType(item.GetType());

            Console.WriteLine("Insert:\r\n    " + def.GenerateInsertSQL());
            Console.WriteLine();
        }
示例#15
0
 private static void AddEntries([NotNull] List <DataDefinition> linkage, DataDefinition node)
 {
     linkage.Add(node);
     foreach (var child in node.Children())
     {
         AddEntries(linkage, child);
     }
 }
示例#16
0
 public override bool Visit(DataDefinition dataDefinition)
 {
     if (dataDefinition.CodeElement is CommonDataDescriptionAndDataRedefines)
     {
         CheckPicture((dataDefinition.CodeElement as CommonDataDescriptionAndDataRedefines));
     }
     return(true);
 }
示例#17
0
 //-----------------------------------------------------------------------
 public GraphNodeItem(DataDefinition definition, UndoRedoManager undoRedo) : base(definition, undoRedo)
 {
     Children.CollectionChanged += (e, args) =>
     {
         RaisePropertyChangedEvent("GraphData");
         RaisePropertyChangedEvent("Datas");
     };
 }
示例#18
0
        public static void WriteDefinition <T>(T item)
        {
            DataDefinition def = DataDefinition.FromType(typeof(T));

            Console.WriteLine("Tablename:\r\n" + def.TableName);
            Console.WriteLine("Typename:\r\n" + def.Type.Name);
            Console.WriteLine("Params:\r\n" + string.Join(Environment.NewLine + "", def.GenerateParameters(item).Select(P => $"{P.ParameterName,15} : {P.Value}")));
        }
示例#19
0
 public AddSubUnit()
 {
     dcore = new DataCoreLibrary();
     townnameManage_old = new DataControls.TownnameTab();
     InitializeComponent();
     townnameManage_old.LoadProvinceToComboBox(cmbprovince_old, "");
     DataControls.LoadComboBoxData(cmbUnit, DataDefinition.GetUnitmoreTab(), "unit_name", "unit_id");
 }
示例#20
0
        public ReportAddressMore()
        {
            InitializeComponent();
            dcore = new DataCoreLibrary();


            DataControls.LoadComboBoxData(cmbselectaddress, DataDefinition.GetUnitTab(), "UNITNAME", "REFNUM");
        }
示例#21
0
        public static List <ITextLine> InsertChildren(SymbolTable table, DataDefinition type, int level, int indent)
        {
            var lines = new List <ITextLine>();

            foreach (var child in type.Children)
            {
                if (child is TypedDataNode)
                {
                    continue;
                }
                //Special case type BOOL
                if (child is TypeCobol.Compiler.Nodes.DataDescription)
                {
                    string attr_type = (string)child["type"];
                    if (attr_type != null)
                    {
                        if (attr_type.ToUpper().Equals("BOOL"))
                        {
                            string attr_name = (string)child["name"];
                            string margin    = "";
                            for (int i = 0; i < indent; i++)
                            {
                                margin += "  ";
                            }
                            string slevel = level.ToString("00");
                            foreach (string str in BoolTypeTemplate)
                            {
                                string           sline = string.Format(str, attr_name, slevel, margin);
                                TextLineSnapshot line  = new TextLineSnapshot(-1, sline, null);
                                lines.Add(line);
                            }
                            continue;
                        }
                    }
                }

                var  typed           = (ITypedNode)child;
                var  types           = table.GetType(typed.DataType);
                bool isCustomTypeToo = !(child is TypeDefinition) && (types.Count > 0);
                if (child.CodeElement is DataDefinitionEntry)
                {
                    lines.Add(CreateDataDefinition((DataDefinitionEntry)child.CodeElement, level, indent, isCustomTypeToo, false, isCustomTypeToo ? types[0] : null));
                }
                else
                {//Humm ... It will be a bug.
                    System.Diagnostics.Debug.Assert(child.CodeElement is DataDefinitionEntry);
                }
                if (isCustomTypeToo)
                {
                    lines.AddRange(InsertChildren(table, types[0], level + 1, indent + 1));
                }
                else
                {
                    lines.AddRange(InsertChildren(table, child as DataDefinition, level + 1, indent + 1));
                }
            }
            return(lines);
        }
示例#22
0
 internal void AddVariable([NotNull] DataDefinition symbol)
 {
     // TODO: generate a name for FILLERs and anonymous data to be referenced by in the symbol table
     if (symbol.Name == null)
     {
         return;
     }
     Add(DataEntries, symbol);
 }
示例#23
0
        private static long SimulatedTypeDefLevel(long startingLevel, DataDefinition node)
        {
            var maximalLevelReached = startingLevel;

            if (node is TypeDefinition)
            {
                if (browsedTypes.Contains(node))
                {
                    return(maximalLevelReached); //Stop here because of self referencing type
                }
                else
                {
                    browsedTypes.Add(node);
                }
            }
            foreach (DataDefinition child in node.Children)
            {
                var calculatedLevel = startingLevel;
                if (child.DataType.CobolLanguageLevel > CobolLanguageLevel.Cobol85) //If variable is typed
                {
                    /*----- This section should be removed when issue #1009 is fixed ----- */
                    /*----- We'll only need child.TypeDefinition --------------------------*/
                    TypeDefinition foundType;
                    if (child.TypeDefinition == null)
                    {
                        var foundedTypes = node.SymbolTable.GetType(child.DataType);
                        if (foundedTypes.Count != 1)
                        {
                            continue; //If none or multiple corresponding type, it's useless to check
                        }
                        foundType = foundedTypes.First();
                    }
                    else
                    {
                        foundType = child.TypeDefinition;
                    }
                    /* -----------------------------------------------------------------  */

                    calculatedLevel = SimulatedTypeDefLevel(++calculatedLevel, foundType);
                }
                else if (child.Children.Count > 0) //If variable is not typed, check if there is children
                {
                    calculatedLevel = SimulatedTypeDefLevel(++calculatedLevel, child);
                }
                else //It's a final variable, just add one level
                {
                    calculatedLevel++;
                }

                if (calculatedLevel > maximalLevelReached)
                {
                    maximalLevelReached = calculatedLevel;
                }
            }
            return(maximalLevelReached);
        }
示例#24
0
        private void cbbArmtown_SelectedIndexChanged(object sender, EventArgs e)
        {
            dtpComeDate.Value = dtpRegisDate.Value;
            string value = DataControls.GetSelectedValueComboBoxToString(cbbArmtown);

            if (DataDefinition.GetArmtownLegion(value) == "4")
            {
                dtpComeDate.Value = dtpRegisDate.Value.AddDays(1);
            }
        }
示例#25
0
 public MoveToAddressUnit(string id, string number)
 {
     report_number  = number;
     navyid         = id;
     dcore          = new DataCoreLibrary();
     townnameManage = new DataControls.TownnameTab();
     InitializeComponent();
     GetData(id);
     DataControls.LoadComboBoxData(cmbUnit, DataDefinition.GetUnitmoreTab(), "unit_name", "unit_id");
 }
        //-----------------------------------------------------------------------
        public override void Paste()
        {
            if (WrappedItem != null)
            {
                WrappedItem.Paste();
            }
            else
            {
                DataDefinition chosen = null;
                foreach (var def in ReferenceDef.Definitions.Values)
                {
                    if (Clipboard.ContainsData(def.CopyKey))
                    {
                        var flat = Clipboard.GetData(def.CopyKey) as string;
                        var root = XElement.Parse(flat);

                        if (root.Name == def.Name)
                        {
                            chosen = def;
                            break;
                        }
                    }
                }

                if (chosen == null)
                {
                    return;
                }

                DataItem item = null;
                using (UndoRedo.DisableUndoScope())
                {
                    item = chosen.CreateData(UndoRedo);
                    if (item is StructItem && item.Children.Count == 0)
                    {
                        (item.Definition as StructDefinition).CreateChildren(item as StructItem, UndoRedo);
                    }

                    item.Paste();
                }

                UndoRedo.ApplyDoUndo(delegate
                {
                    ChosenDefinition = chosen;
                    WrappedItem      = item;
                },
                                     delegate
                {
                    ChosenDefinition = null;
                    WrappedItem      = null;
                },
                                     "Paste Item " + item.Name);
            }
        }
示例#27
0
 //-----------------------------------------------------------------------
 private void NewFile(DataDefinition dataType)
 {
     if (IsDirectory)
     {
         Workspace.New(dataType, FullPath);
     }
     else
     {
         Workspace.New(dataType, System.IO.Path.GetDirectoryName(FullPath));
     }
 }
示例#28
0
        private static void SearchVariableInTypesAndLevels(Node node, DataDefinition variable, ref List <CompletionItem> completionItems)
        {
            var symbolTable = node.SymbolTable;

            if (!variable.IsPartOfATypeDef)                                         //Variable is not comming from a type.
            {
                if (symbolTable.GetVariablesExplicit(new URI(variable.Name)).Any()) //Check if this variable is present locally.
                {
                    completionItems.Add(CompletionFactoryHelpers.CreateCompletionItemForVariable(variable));
                }
            }
            else
            {
                if (symbolTable.TypesReferences != null) //We are in a typedef, get references of this type
                {
                    var type = variable.ParentTypeDefinition;
                    IEnumerable <DataDefinition> references = null;
                    references = symbolTable.TypesReferences.Where(t => t.Key == type).SelectMany(r => r.Value);

                    foreach (var reference in references)
                    {
                        if (symbolTable.GetVariablesExplicit(new URI(reference.Name)).Any())                                                                                             //Check if this variable is present locally. If not just ignore it
                        {
                            if (reference.ParentTypeDefinition == null)                                                                                                                  //Check if the variable is inside a typedef or not, if not it's a final varaible
                            {
                                var referenceArrangedQualifiedName = string.Join("::", reference.VisualQualifiedName.ToString().Split(reference.VisualQualifiedName.Separator).Skip(1)); //Skip Program Name
                                var finalQualifiedName             = string.Format("{0}::{1}", referenceArrangedQualifiedName, variable.VisualQualifiedName.Head);
                                var variableDisplay = string.Format("{0} ({1}) ({2})", variable.Name, variable.DataType.Name, finalQualifiedName);
                                completionItems.Add(new CompletionItem(variableDisplay)
                                {
                                    insertText = finalQualifiedName, kind = CompletionItemKind.Variable
                                });
                            }
                            else //If the reference is always in a typedef, let's loop and ride up until we are in a final variable
                            {
                                var tempCompletionItems = new List <CompletionItem>();
                                SearchVariableInTypesAndLevels(node, reference, ref tempCompletionItems);

                                if (tempCompletionItems.Count > 0)
                                {
                                    foreach (var tempComp in tempCompletionItems)
                                    {
                                        tempComp.insertText += "::" + variable.VisualQualifiedName.Head;
                                        tempComp.label       = string.Format("{0} ({1}) ({2})", variable.Name, variable.DataType.Name, tempComp.insertText);
                                        completionItems.Add(tempComp);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#29
0
        private void LoadControlsValue()
        {
            if (cbbArmtown.DataSource == null)
            {
                DataControls.LoadComboBoxData(cbbArmtown, DataDefinition.GetArmtownTab(), "ARMNAME", "ARMID");
            }

            if (cbbOrigin.DataSource == null)
            {
                DataControls.LoadComboBoxData(cbbOrigin, DataDefinition.GetOriginTab(), "origin", "origincode", "1");
            }
        }
 //-----------------------------------------------------------------------
 public void Swap(DataDefinition def)
 {
     using (UndoRedo.ActionScope("Swap " + ChosenDefinition.Name + " to " + def.Name))
     {
         Copy();
         SelectedDefinition = (Definition as ReferenceDefinition).Keys.FirstOrDefault(e => e.Item1 == def.Name);
         ChosenDefinition   = def;
         Clear();
         Create();
         Paste();
     }
 }
示例#31
0
 public static List<ITextLine> InsertChildren(SymbolTable table, DataDefinition type, int level, int indent)
 {
     var lines = new List<ITextLine>();
     foreach(var child in type.Children) {
     if (child is TypedDataNode) continue;
     var typed = (ITypedNode)child;
     var types = table.GetType(new URI(typed.DataType.Name));
     bool isCustomTypeToo = !(child is TypeDefinition) && (types.Count > 0);
     lines.Add(CreateDataDefinition((DataDescriptionEntry)child.CodeElement, level, indent, isCustomTypeToo));
     if (isCustomTypeToo) lines.AddRange(InsertChildren(table, (TypeDefinition)types[0], level+1, indent+1));
     }
     return lines;
 }
 private void AddEntries(List<DataDefinition> linkage, DataDefinition node)
 {
     linkage.Add(node);
     foreach(var child in node.Children())
     AddEntries(linkage, child);
 }
示例#33
0
 internal void DeleteDataDefinition(DataDefinition DataDefinition)
 {
     try
     {
         SetService();
         SerClient.DeleteDataDefinition(DataDefinition);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
示例#34
0
 internal DataDefinition SaveDataDefinition(DataDefinition DataDefinition)
 {
     try
     {
         SetService();
         return SerClient.SaveDataDefinition(DataDefinition);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }