Пример #1
0
        public AssemblyTreeMember(IReferenceInfo reference)
            : this()
        {
            referenceInfo = reference;

            if (reference.Definition != null)
            {
                Name = reference.Definition.Name;
            }
            else
            {
                Name = "Unknown member in " + reference.DefinitionSF.ToString();
            }

            Text = Name;

            #region ToolTipText
            ToolTipText = reference.CodePart;
            #endregion

            #region Image
            ImageIndex         = AssemblyTreeIcons.Reference;
            SelectedImageIndex = ImageIndex;
            #endregion

            this.ContextMenuStrip = new ReferenceContextMenuStrip(this, reference);
        }
Пример #2
0
        public void OpenMember(AssemblyTreeMember member)
        {
            if (member.Member is IMemberInfo)
            {
                IMemberInfo memberInfo = (IMemberInfo)member.Member;
                FileManager.GoToDefinition(memberInfo);

                // TODO: remove threading!

                if (memberInfo.SF == this.fileManager.CurrentFile)
                {
                    this.assemblyTreeView.CurrentNode = member;
                    this.assemblyTreeView.RefreshSelectedNode(false);
                }
            }
            else if (member.Member is IReferenceInfo)
            {
                IReferenceInfo referenceInfo = (IReferenceInfo)member.Member;
                FileManager.GoToPosition(referenceInfo.SF, referenceInfo.CharIndex, referenceInfo.CharLength, referenceInfo);

                if (referenceInfo.SF == this.fileManager.CurrentFile)
                {
                    this.assemblyTreeView.CurrentNode = member;
                    this.assemblyTreeView.RefreshSelectedNode(false);
                }
            }
        }
Пример #3
0
        public Artifact.Artifact Add(IReferenceInfo reference)
        {
            EnsureInitialized();

            string artifactFileName = CopyToReferenceFolder(reference.Artifact, referenceFolder);

            Artifact.Artifact a = reference.Artifact;

            a.FileInfo = new FileInfo(artifactFileName);
            return a;
        }
Пример #4
0
        public Artifact.Artifact Add(IReferenceInfo reference)
        {
            EnsureInitialized();

            string artifactFileName = CopyToReferenceFolder(reference.Artifact, referenceFolder);

            Artifact.Artifact a = reference.Artifact;

            a.FileInfo = new FileInfo(artifactFileName);
            return(a);
        }
Пример #5
0
        public void SelectMemberInTree(IReferenceInfo refInfo)
        {
            AssemblyTreeFile file = this.assemblyTreeView.FindFile(refInfo.SF);

            if (file != null)
            {
                AssemblyTreeMember m = file.Find(refInfo);

                this.assemblyTreeView.CurrentNode = m;
                this.assemblyTreeView.RefreshSelectedNode(false);
            }
        }
Пример #6
0
        private static System.Reflection.Assembly GetReflectionAssembly(IReferenceInfo ri)
        {
            var path = Compiler.get_assembly_path(Path.Combine(ProjectFactory.Instance.ProjectDirectory, ri.FullAssemblyName), false);

            if (path == null)
            {
                path = Compiler.get_assembly_path(ri.FullAssemblyName, false);
            }
            if (path != null)
            {
                return(PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(path));
            }
            return(null);
        }
Пример #7
0
        public ReferenceContextMenuStrip(AssemblyTreeMember member, IReferenceInfo refInfo)
        {
            _member  = member;
            _refInfo = refInfo;

            ToolStripMenuItem refGoToReference = new ToolStripMenuItem("Go To Reference");

            refGoToReference.Click += new EventHandler(refGoToReference_Click);

            ToolStripMenuItem refGoToDefinition = new ToolStripMenuItem("Go To Definition");

            refGoToDefinition.Click += new EventHandler(refGoToDefinition_Click);

            this.Items.AddRange(new ToolStripMenuItem[] { refGoToReference, refGoToDefinition });
        }
Пример #8
0
        public bool Compare(IReferenceInfo anotherRef)
        {
            if (anotherRef == null)
            {
                return(false);
            }

            return(anotherRef is FuncRefInfo &&
                   this.SF == anotherRef.SF &&
                   this.Definition != null &&
                   anotherRef.Definition != null &&
                   this.Definition.Compare(anotherRef.Definition) &&
                   this.CharIndex == anotherRef.CharIndex &&
                   this.CharLength == anotherRef.CharLength);
        }
Пример #9
0
        /// <summary>
        /// Handle end element.
        /// </summary>
        /// <param name="localname">
        /// The element local name.
        /// </param>
        protected override void HandleEndElement(object localname)
        {
            if (NameTableCache.IsElement(localname, ElementNameTable.KeyFamilyRef))
            {
                Debug.Assert(this._currentReferenceInfo != null, "_currentReferenceInfo is null.", "local name: {0}", localname);
                Debug.Assert(this._currentDataflow != null, "_currentDataflow is null.", "local name: {0}", localname);
                if (this._currentReferenceInfo != null && this._currentDataflow != null)
                {
                    this._currentDataflow.DataStructureRef = this._currentReferenceInfo.CreateReference(new string[] { });
                }

                this._currentReferenceInfo = null;
            }
            else if (NameTableCache.IsElement(localname, ElementNameTable.CategoryRef))
            {
                Debug.Assert(this._currentReferenceInfo != null, "_currentReferenceInfo is null.", "local name: {0}", localname);
                Debug.Assert(this._currentDataflow != null, "_currentDataflow is null.", "local name: {0}", localname);
                if (this._currentReferenceInfo != null && this._currentDataflow != null)
                {
                    ICategorisationMutableObject categorisation = new CategorisationMutableCore();
                    categorisation.StructureReference = CreateReference(this._currentDataflow);
                    categorisation.CategoryReference = this._currentReferenceInfo.CreateReference(this._currentCategoryIds.ToArray());

                    categorisation.AgencyId = this._currentDataflow.AgencyId;
                    categorisation.Id = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", categorisation.CategoryReference.GetHashCode(), categorisation.StructureReference.GetHashCode());

                    categorisation.Names.AddAll(this._currentDataflow.Names);

                    this.Structure.AddCategorisation(categorisation);

                    this._currentCategoryIds.Clear();
                }

                this._currentReferenceInfo = null;
            }
        }
Пример #10
0
 public void AddReference(IReferenceInfo reference)
 {
     references.Add(reference);
 }
 /// <summary>
 /// The handle text child element.
 /// </summary>
 /// <param name="categoryRef">
 /// The category ref.
 /// </param>
 /// <param name="localName">
 /// The local name.
 /// </param>
 private void HandleTextChildElementCategoryRef(IReferenceInfo categoryRef, object localName)
 {
     if (NameTableCache.IsElement(localName, ElementNameTable.CategorySchemeID))
     {
         categoryRef.ID = this.Text;
     }
     else if (NameTableCache.IsElement(localName, ElementNameTable.CategorySchemeAgencyID))
     {
         categoryRef.AgencyId = this.Text;
     }
     else if (NameTableCache.IsElement(localName, ElementNameTable.CategorySchemeVersion))
     {
         categoryRef.Version = this.Text;
     }
     else if (NameTableCache.IsElement(localName, ElementNameTable.URN))
     {
         categoryRef.URN = Helper.TrySetUri(this.Text);
     }
 }
Пример #12
0
 public void AddReference(IReferenceInfo reference)
 {
     references.Add(reference);
 }
Пример #13
0
 public AssemblyTreeMember Find(IReferenceInfo refInfo)
 {
     return(_members.Find(a => ((IReferenceInfo)a.Member).Compare(refInfo)));
 }
 /// <summary>
 /// Write the specified reference
 /// </summary>
 /// <param name="bean">
 /// The reference to write
 /// </param>
 private void WriteHierarchicalCodeListRef(IReferenceInfo bean)
 {
     this.WriteStartElement(this.DefaultNS, ElementNameTable.HierarchicalCodelistRef);
     this.WriteCommonRef(bean, ElementNameTable.HierarchicalCodelistID);
 }
        /// <summary>
        /// Write the specified reference
        /// </summary>
        /// <param name="dataflow">
        /// The reference to write
        /// </param>
        private void WriteMetadataflowRef(IReferenceInfo dataflow)
        {
            this.WriteStartElement(this.DefaultNS, ElementNameTable.MetadataflowRef);
            this.WriteCommonRef(dataflow, ElementNameTable.MetadataflowID);

            ////this.WriteDataSource(dataflow.Datasource);
            ////this.WriteConstrain(dataflow.Constraint);
        }
        /// <summary>
        /// When override handles end element.
        /// </summary>
        /// <param name="localName">
        /// The element local name.
        /// </param>
        protected override void HandleEndElement(object localName)
        {
            if (NameTableCache.IsElement(localName, ElementNameTable.CodelistRef))
            {
                if (this._currentReference != null && this._currentCodelistRef != null)
                {
                    this._currentCodelistRef.CodelistReference = this._currentReference.CreateReference();
                }

                this._currentCodelistRef = null;
                this._currentReference = null;
            }
            else if (NameTableCache.IsElement(localName, ElementNameTable.Hierarchy))
            {
                var levelMutableObjects = this._currentLevels;
                var currentHierarchy = this._currentHierarchy;
                SetupHierarchyLevels(levelMutableObjects, currentHierarchy);

                SetupCodeRefLevels(currentHierarchy);


                levelMutableObjects.Clear();
            }
        }
 /// <summary>
 /// Write the specified reference
 /// </summary>
 /// <param name="dataflow">
 /// The reference to write
 /// </param>
 private void WriteDataflowRefBasic(IReferenceInfo dataflow)
 {
     this.WriteStartElement(this.DefaultNS, ElementNameTable.DataflowRef);
     this.WriteCommonRef(dataflow, ElementNameTable.DataflowID);
 }
        /// <summary>
        /// Handles the Dataflow element child elements
        /// </summary>
        /// <param name="parent">
        /// The parent IDataflowMutableObject object
        /// </param>
        /// <param name="localName">
        /// The name of the current xml element
        /// </param>
        /// <returns>
        /// The <see cref="StructureReaderBaseV20.ElementActions"/>.
        /// </returns>
        private ElementActions HandleChildElements(IDataflowMutableObject parent, object localName)
        {
            ElementActions actions = null;
            if (NameTableCache.IsElement(localName, ElementNameTable.KeyFamilyRef))
            {
                IReferenceInfo reference = new ReferenceInfo(SdmxStructureEnumType.Dsd);
                this._currentReferenceInfo = reference;
                actions = this.AddReferenceAction(reference, DoNothingComplex, this.HandleTextChildElementKeyFamily);
            }
            else if (NameTableCache.IsElement(localName, ElementNameTable.CategoryRef))
            {
                IReferenceInfo reference = new ReferenceInfo(SdmxStructureEnumType.Category);
                this._currentReferenceInfo = reference;
                this._currentCategoryIds.Clear();
                actions = this.AddReferenceAction(reference, this.HandleChildElementsCategory, this.HandleTextChildElementCategoryRef);
            }

            return actions;
        }
Пример #19
0
 public void Remove(IReferenceInfo reference)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 /// <summary>
 /// Handle A Reference based class Child Text elements
 /// </summary>
 /// <param name="parent">
 /// The parent reference object
 /// </param>
 /// <param name="localName">
 /// The name of the current XML element
 /// </param>
 protected void HandleTextChildElement(IReferenceInfo parent, object localName)
 {
     if (NameTableCache.IsElement(localName, ElementNameTable.URN))
     {
         parent.URN = Helper.TrySetUri(this.Text);
     }
     else if (NameTableCache.IsElement(localName, ElementNameTable.AgencyID))
     {
         parent.AgencyId = this.Text;
     }
     else if (NameTableCache.IsElement(localName, ElementNameTable.Version))
     {
         parent.Version = this.Text;
     }
     else if (NameTableCache.IsElement(localName, ElementNameTable.MetadataflowID) || NameTableCache.IsElement(localName, ElementNameTable.DataflowID)
              || NameTableCache.IsElement(localName, ElementNameTable.CodelistID) || NameTableCache.IsElement(localName, ElementNameTable.CategorySchemeID)
              || NameTableCache.IsElement(localName, ElementNameTable.ConceptSchemeID) || NameTableCache.IsElement(localName, ElementNameTable.OrganisationSchemeID)
              || NameTableCache.IsElement(localName, ElementNameTable.KeyFamilyID) || NameTableCache.IsElement(localName, ElementNameTable.MetadataStructureID)
              || NameTableCache.IsElement(localName, ElementNameTable.HierarchicalCodelistID))
     {
         parent.ID = this.Text;
     }
 }
Пример #21
0
 public void RemoveReference(IReferenceInfo ri)
 {
     this.references.Remove(ri as ReferenceInfo);
 }
 /// <summary>
 /// Handles the KeyFamily Ref element child elements
 /// </summary>
 /// <param name="refBean">
 /// The parent reference object
 /// </param>
 /// <param name="localName">
 /// The name of the current xml element
 /// </param>
 private void HandleTextChildElementKeyFamily(IReferenceInfo refBean, object localName)
 {
     if (NameTableCache.IsElement(localName, ElementNameTable.KeyFamilyID))
     {
         refBean.ID = this.Text;
     }
     else if (NameTableCache.IsElement(localName, ElementNameTable.KeyFamilyAgencyID))
     {
         refBean.AgencyId = this.Text;
     }
 }
 /// <summary>
 /// Write common IReferenceInfo elements
 /// </summary>
 /// <param name="refBean">
 /// The IReferenceInfo to write
 /// </param>
 /// <param name="id">
 /// The name of the element
 /// </param>
 private void WriteCommonRef(IReferenceInfo refBean, ElementNameTable id)
 {
     this.TryToWriteElement(this.DefaultNS, ElementNameTable.URN, refBean.URN);
     this.TryToWriteElement(this.DefaultNS, ElementNameTable.AgencyID, refBean.AgencyId);
     this.TryToWriteElement(this.DefaultNS, id, refBean.ID);
     this.TryToWriteElement(this.DefaultNS, ElementNameTable.Version, refBean.Version);
 }
        /// <summary>
        /// Handles the HierarchicalCodelist element child elements
        /// </summary>
        /// <param name="parent">
        /// The parent IHierarchicalCodelistMutableObject object
        /// </param>
        /// <param name="localName">
        /// The name of the current xml element
        /// </param>
        /// <returns>
        /// The <see cref="StructureReaderBaseV20.ElementActions"/>.
        /// </returns>
        private ElementActions HandleChildElements(IHierarchicalCodelistMutableObject parent, object localName)
        {
            ElementActions actions = null;
            if (NameTableCache.IsElement(localName, ElementNameTable.CodelistRef))
            {
                var codelistRefMutableCore = new CodelistRefMutableCore();
                parent.AddCodelistRef(codelistRefMutableCore);
                this._currentCodelistRef = codelistRefMutableCore;
                IReferenceInfo reference = new ReferenceInfo(SdmxStructureEnumType.CodeList);
                this._currentReference = reference;
                actions = this.BuildElementActions(codelistRefMutableCore, DoNothingComplex, HandleTextChildElement);
            }
            else if (NameTableCache.IsElement(localName, ElementNameTable.Hierarchy))
            {
                var hc = new HierarchyMutableCore();
                ParseAttributes(hc, this.Attributes);
                this._currentHierarchy = hc;
                
                //// TODO java 0.9.9 no isFinal 
                ////hc.IsFinal = Helper.TrySetFromAttribute(this.Attributes, AttributeNameTable.isFinal, hc.IsFinal);
                parent.AddHierarchies(hc);
                actions = this.AddNameableAction(hc, this.HandleChildElements);
            }

            return actions;
        }
 /// <summary>
 /// Write the specified reference
 /// </summary>
 /// <param name="conceptScheme">
 /// The reference to write
 /// </param>
 private void WriteConceptSchemeRef(IReferenceInfo conceptScheme)
 {
     this.WriteStartElement(this.DefaultNS, ElementNameTable.ConceptSchemeRef);
     this.WriteCommonRef(conceptScheme, ElementNameTable.ConceptSchemeID);
 }
 /// <summary>
 /// Handles the Category element child elements
 /// </summary>
 /// <param name="parent">
 /// The parent category of this category element
 /// </param>
 /// <param name="localName">
 /// The name of the current xml element
 /// </param>
 /// <returns>
 /// The <see cref="StructureReaderBaseV20.ElementActions"/>.
 /// </returns>
 private ElementActions HandleChildElements(ICategoryMutableObject parent, object localName)
 {
     ElementActions actions = null;
     if (NameTableCache.IsElement(localName, ElementNameTable.Category))
     {
         ICategoryMutableObject category = HandleCategory(this.Attributes);
         parent.AddItem(category);
         actions = this.AddNameableAction(category, this.HandleChildElements);
     }
     else if (NameTableCache.IsElement(localName, ElementNameTable.DataflowRef))
     {
         IReferenceInfo reference = new ReferenceInfo(SdmxStructureEnumType.Dataflow) { ReferenceFrom = parent };
         this._currentDataflowReference = reference;
         actions = this.AddSimpleAction(reference, this.HandleTextChildElement);
     }
     
     return actions;
 }
 /// <summary>
 /// Write the specified reference
 /// </summary>
 /// <param name="bean">
 /// The reference to write
 /// </param>
 private void WriteDsdRef(IReferenceInfo bean)
 {
     this.WriteStartElement(this.DefaultNS, ElementNameTable.KeyFamilyRef);
     this.WriteCommonRef(bean, ElementNameTable.KeyFamilyID);
 }
Пример #28
0
		public void RemoveReference(IReferenceInfo ri)
		{
			this.references.Remove(ri as ReferenceInfo);
		}
 /// <summary>
 /// Write the specified reference
 /// </summary>
 /// <param name="bean">
 /// The reference to write
 /// </param>
 private void WriteMetadataStructureRef(IReferenceInfo bean)
 {
     this.WriteStartElement(this.DefaultNS, ElementNameTable.MetadataStructureRef);
     this.WriteCommonRef(bean, ElementNameTable.MetadataStructureID);
 }
        /// <summary>
        /// Handle end element.
        /// </summary>
        /// <param name="localname">
        /// The element local name.
        /// </param>
        protected override void HandleEndElement(object localname)
        {
            if (NameTableCache.IsElement(localname, ElementNameTable.DataflowRef))
            {
                if (this._currentDataflowReference != null)
                {
                    IStructureReference categoryReference = CreateReference(this._currentCategoryScheme, SdmxStructureEnumType.Category, this._currentDataflowReference.ReferenceFrom.Id);
                    IStructureReference dataflowReference = this._currentDataflowReference.CreateReference();
                    var categorisation = new CategorisationMutableCore
                                             {
                                                 CategoryReference = categoryReference, 
                                                 StructureReference = dataflowReference, 
                                                 AgencyId = this._currentCategoryScheme.AgencyId
                                             };
                    categorisation.Id = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", categorisation.CategoryReference.GetHashCode(), categorisation.StructureReference.GetHashCode());

                    if (this._currentDataflowReference.ReferenceFrom.Names.Count > 0)
                    {
                        categorisation.Names.AddAll(this._currentDataflowReference.ReferenceFrom.Names);
                    }
                    else
                    {
                        string name = string.Format(
                            CultureInfo.InvariantCulture, 
                            "Categorisation between Category {0} and Dataflow {1}", 
                            categorisation.CategoryReference, 
                            categorisation.StructureReference.MaintainableReference);
                        categorisation.AddName("en", name);
                    }

                    this.Structure.AddCategorisation(categorisation);
                    this._currentDataflowReference = null;
                }
            }
        }
 /// <summary>
 /// Write the specified reference
 /// </summary>
 /// <param name="bean">
 /// The reference to write
 /// </param>
 private void WriteOrganisationSchemeRef(IReferenceInfo bean)
 {
     this.WriteStartElement(this.DefaultNS, ElementNameTable.OrganisationSchemeRef);
     this.WriteCommonRef(bean, ElementNameTable.OrganisationSchemeID);
 }
 /// <summary>
 /// Write the specified reference
 /// </summary>
 /// <param name="codelistRef">
 /// The reference to write
 /// </param>
 protected void WriteCodeListRef(IReferenceInfo codelistRef)
 {
     this.WriteStartElement(this.DefaultNS, ElementNameTable.CodelistRef);
     this.WriteCommonRef(codelistRef, ElementNameTable.CodelistID);
 }
Пример #33
0
 public void Remove(IReferenceInfo reference)
 {
     throw new Exception("The method or operation is not implemented.");
 }
        /// <summary>
        /// Write a Ref type element
        /// </summary>
        /// <param name="refBean">
        /// The <see cref="IReferenceInfo"/> based object
        /// </param>
        protected void WriteRef(IReferenceInfo refBean)
        {
            switch (refBean.SdmxStructure)
            {
                case SdmxStructureEnumType.Dataflow:
                    var dataflowReferenceInfo = refBean as IDataflowReferenceInfo;
                    if (dataflowReferenceInfo != null)
                    {
                        this.WriteDataflowRef(dataflowReferenceInfo);
                    }
                    else
                    {
                        this.WriteDataflowRefBasic(refBean);
                    }

                    break;
                case SdmxStructureEnumType.CategoryScheme:
                    this.WriteCategorySchemeRef(refBean);
                    break;
                case SdmxStructureEnumType.CodeList:
                    this.WriteCodeListRef(refBean);
                    break;
                case SdmxStructureEnumType.ConceptScheme:
                    this.WriteConceptSchemeRef(refBean);
                    break;
                case SdmxStructureEnumType.OrganisationScheme:
                    this.WriteOrganisationSchemeRef(refBean);
                    break;
                case SdmxStructureEnumType.Dsd:
                    this.WriteDsdRef(refBean);
                    break;
                case SdmxStructureEnumType.Msd:
                    this.WriteMetadataStructureRef(refBean);
                    break;
                case SdmxStructureEnumType.MetadataFlow:
                    this.WriteMetadataflowRef(refBean);
                    break;
                case SdmxStructureEnumType.HierarchicalCodelist:
                    this.WriteHierarchicalCodeListRef(refBean);
                    break;

                default:
                    return;
            }

            this.WriteEndElement();
        }
Пример #35
0
 private static System.Reflection.Assembly GetReflectionAssembly(IReferenceInfo ri)
 {
     var path = Compiler.get_assembly_path(Path.Combine(ProjectFactory.Instance.ProjectDirectory, ri.FullAssemblyName), false);
     if (path == null)
         path = Compiler.get_assembly_path(ri.FullAssemblyName, false);
     if (path != null)
         return PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(path);
     return null;
 }
 /// <summary>
 /// Write the specified reference
 /// </summary>
 /// <param name="categorySchemeRefBean">
 /// The reference to write
 /// </param>
 private void WriteCategorySchemeRef(IReferenceInfo categorySchemeRefBean)
 {
     this.WriteStartElement(this.DefaultNS, ElementNameTable.CategorySchemeRef);
     this.WriteCommonRef(categorySchemeRefBean, ElementNameTable.CategorySchemeID);
 }
        /// <summary>
        /// Handles the DataflowRef element child elements
        /// </summary>
        /// <param name="parent">
        /// The parent DataflowRefBean object
        /// </param>
        /// <param name="localName">
        /// The name of the current xml element
        /// </param>
        private void HandleTextChildElement(IReferenceInfo parent, object localName)
        {
            if (this.HandleReferenceTextChildElement(parent, localName))
            {
                return;
            }

            if (NameTableCache.IsElement(localName, ElementNameTable.DataflowID))
            {
                parent.ID = this.Text;
            }
            else if (NameTableCache.IsElement(localName, ElementNameTable.AgencyID))
            {
                parent.AgencyId = this.Text;
            }
        }
        /// <summary>
        /// Handles the CategoryRef element child elements
        /// </summary>
        /// <param name="parent">
        /// The parent CategoryRefBean object
        /// </param>
        /// <param name="localName">
        /// The name of the current xml element
        /// </param>
        /// <returns>
        /// The <see cref="StructureReaderBaseV20.ElementActions"/>.
        /// </returns>
        private ElementActions HandleChildElementsCategory(IReferenceInfo parent, object localName)
        {
            ElementActions actions = null;
            if (NameTableCache.IsElement(localName, ElementNameTable.CategoryID))
            {
                actions = this.BuildElementActions(this._currentCategoryIds, this.HandleChildElements, this.HandleTextChildElement);
            }

            return actions;
        }