Ejemplo n.º 1
0
        /// <summary>
        /// Loads the given file.
        /// </summary>
        protected override void Load(string fileName, bool isReload)
        {
            DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();

            global::pelsoft.FWK_Dsl.ModelRoot modelRoot      = null;
            DslModeling::ISchemaResolver      schemaResolver = new DslShell::ModelingSchemaResolver(this.ServiceProvider);

            // Enable diagram fixup rules in our store, because we will load diagram data.
            global::pelsoft.FWK_Dsl.FWK_DslDomainModel.EnableDiagramRules(this.Store);
            string diagramFileName = fileName + this.DiagramExtension;

            modelRoot = global::pelsoft.FWK_Dsl.FWK_DslSerializationHelper.Instance.LoadModelAndDiagram(serializationResult, this.Store, fileName, diagramFileName, schemaResolver, null /* no load-time validation */);

            // Report serialization messages.
            this.SuspendErrorListRefresh();
            try
            {
                foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
                {
                    this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
                }
            }
            finally
            {
                this.ResumeErrorListRefresh();
            }

            if (serializationResult.Failed)
            {
                // Load failed, can't open the file.
                throw new global::System.InvalidOperationException(global::pelsoft.FWK_Dsl.FWK_DslDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
            }
            else
            {
                this.SetRootElement(modelRoot);
                if (this.Hierarchy != null && global::System.IO.File.Exists(diagramFileName))
                {
                    // Add a lock to the subordinate diagram file.
                    if (this.diagramDocumentLockHolder == null)
                    {
                        uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
                        if (itemId != global::Microsoft.VisualStudio.VSConstants.VSITEMID_NIL)
                        {
                            this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
                            if (this.diagramDocumentLockHolder == null)
                            {
                                throw new global::System.InvalidOperationException(string.Format(global::System.Globalization.CultureInfo.CurrentCulture,
                                                                                                 global::pelsoft.FWK_Dsl.FWK_DslDomainModel.SingletonResourceManager.GetString("CannotCloseExistingDiagramDocument"),
                                                                                                 diagramFileName));
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the given file.
        /// </summary>
        protected override void Load(string fileName, bool isReload)
        {
            DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();

            global::Tum.PDE.LanguageDSL.MetaModel modelRoot      = null;
            DslModeling::ISchemaResolver          schemaResolver = new DslShell::ModelingSchemaResolver(this.ServiceProvider);

            //clear the current root element
            this.SetRootElement(null);
            modelRoot = global::Tum.PDE.LanguageDSL.LanguageDSLSerializationHelper.Instance.LoadModel(serializationResult, this.GetModelPartition(), fileName, schemaResolver, null /* no load-time validation */, this.SerializerLocator);

            // Report serialization messages.
            this.SuspendErrorListRefresh();
            try
            {
                foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
                {
                    this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
                }
            }
            finally
            {
                this.ResumeErrorListRefresh();
            }

            if (serializationResult.Failed)
            {
                // Load failed, can't open the file.
                throw new global::System.InvalidOperationException(global::Tum.PDE.LanguageDSL.LanguageDSLDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
            }
            else
            {
                this.SetRootElement(modelRoot);

                // Attempt to set the encoding
                if (serializationResult.Encoding != null)
                {
                    this.ModelingDocStore.SetEncoding(serializationResult.Encoding);
                    global::Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(this.SetDocDataDirty(0));                     // Setting the encoding will mark the document as dirty, so clear the dirty flag.
                }
            }
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Loads the given file.
		/// </summary>
		protected override void Load(string fileName, bool isReload)
		{
			DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();
			global::LinqToRdf.Design.ModelRoot modelRoot = null;
			DslModeling::ISchemaResolver schemaResolver = new DslShell::ModelingSchemaResolver(this.ServiceProvider);
			
			// Enable diagram fixup rules in our store, because we will load diagram data.
			global::LinqToRdf.Design.LinqToRdfDomainModel.EnableDiagramRules(this.Store);
			string diagramFileName = fileName + this.DiagramExtension;
			
			modelRoot = global::LinqToRdf.Design.LinqToRdfSerializationHelper.Instance.LoadModelAndDiagram(serializationResult, this.Store, fileName, diagramFileName, schemaResolver, null /* no load-time validation */);

			// Report serialization messages.
			this.SuspendErrorListRefresh();
			try
			{
				foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
				{
					this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
				}
			}
			finally
			{
				this.ResumeErrorListRefresh();
			}

			if (serializationResult.Failed)
			{	
				// Load failed, can't open the file.
				throw new global::System.InvalidOperationException(global::LinqToRdf.Design.LinqToRdfDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
			}
			else
			{
				this.SetRootElement(modelRoot);
				if (this.Hierarchy != null && global::System.IO.File.Exists(diagramFileName))
				{
					// Add a lock to the subordinate diagram file.
					if (this.diagramDocumentLockHolder == null)
					{
						uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
						if (itemId != global::Microsoft.VisualStudio.VSConstants.VSITEMID_NIL)
						{
							this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
							if (this.diagramDocumentLockHolder == null)
							{
								throw new global::System.InvalidOperationException(string.Format(global::System.Globalization.CultureInfo.CurrentCulture,
													global::LinqToRdf.Design.LinqToRdfDomainModel.SingletonResourceManager.GetString("CannotCloseExistingDiagramDocument"),
													diagramFileName));
							}
						}
					}
				}
			}
		}
Ejemplo n.º 4
0
        /// <summary>
        /// Loads the given file.
        /// </summary>
        protected override void Load(string fileName, bool isReload)
        {
            DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();

            global::UPM_IPS.RAARMAPMCWeberMDD.WebERMDD modelRoot = null;
            DslModeling::ISchemaResolver schemaResolver          = new DslShell::ModelingSchemaResolver(this.ServiceProvider);

            //clear the current root element
            this.SetRootElement(null);
            // Enable diagram fixup rules in our store, because we will load diagram data.
            global::UPM_IPS.RAARMAPMCWeberMDD.RAARMAPMCWeberMDDDomainModel.EnableDiagramRules(this.Store);
            string diagramFileName = fileName + this.DiagramExtension;

            modelRoot = global::UPM_IPS.RAARMAPMCWeberMDD.RAARMAPMCWeberMDDSerializationHelper.Instance.LoadModelAndDiagram(serializationResult, this.GetModelPartition(), fileName, this.GetDiagramPartition(), diagramFileName, schemaResolver, null /* no load-time validation */, this.SerializerLocator);

            // Report serialization messages.
            this.SuspendErrorListRefresh();
            try
            {
                foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
                {
                    this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
                }
            }
            finally
            {
                this.ResumeErrorListRefresh();
            }

            if (serializationResult.Failed)
            {
                // Load failed, can't open the file.
                throw new global::System.InvalidOperationException(global::UPM_IPS.RAARMAPMCWeberMDD.RAARMAPMCWeberMDDDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
            }
            else
            {
                this.SetRootElement(modelRoot);

                // Attempt to set the encoding
                if (serializationResult.Encoding != null)
                {
                    this.ModelingDocStore.SetEncoding(serializationResult.Encoding);
                    global::Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(this.SetDocDataDirty(0));                     // Setting the encoding will mark the document as dirty, so clear the dirty flag.
                }

                if (this.Hierarchy != null && global::System.IO.File.Exists(diagramFileName))
                {
                    // Add a lock to the subordinate diagram file.
                    if (this.diagramDocumentLockHolder == null)
                    {
                        uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
                        if (itemId != global::Microsoft.VisualStudio.VSConstants.VSITEMID_NIL)
                        {
                            this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
                            if (this.diagramDocumentLockHolder == null)
                            {
                                throw new global::System.InvalidOperationException(string.Format(global::System.Globalization.CultureInfo.CurrentCulture,
                                                                                                 global::UPM_IPS.RAARMAPMCWeberMDD.RAARMAPMCWeberMDDDomainModel.SingletonResourceManager.GetString("CannotCloseExistingDiagramDocument"),
                                                                                                 diagramFileName));
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
		/// <summary>
		/// Loads the given file.
		/// </summary>
		protected override void Load(string fileName, bool isReload)
		{
			DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();
			global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractModel modelRoot = null;
			DslModeling::ISchemaResolver schemaResolver = new DslShell::ModelingSchemaResolver(this.ServiceProvider);
			//clear the current root element
			this.SetRootElement(null);
			// Enable diagram fixup rules in our store, because we will load diagram data.
			global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslDomainModel.EnableDiagramRules(this.Store);
			string diagramFileName = fileName + this.DiagramExtension;
			
			modelRoot = global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslSerializationHelper.Instance.LoadModelAndDiagram(serializationResult, this.GetModelPartition(), fileName, this.GetDiagramPartition(), diagramFileName, schemaResolver, null /* no load-time validation */, this.SerializerLocator);

			// Report serialization messages.
			this.SuspendErrorListRefresh();
			try
			{
				foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
				{
					this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
				}
			}
			finally
			{
				this.ResumeErrorListRefresh();
			}

			if (serializationResult.Failed)
			{	
				// Load failed, can't open the file.
				throw new global::System.InvalidOperationException(global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
			}
			else
			{
				this.SetRootElement(modelRoot);
				
				// Attempt to set the encoding
				if (serializationResult.Encoding != null)
				{
					this.ModelingDocStore.SetEncoding(serializationResult.Encoding);
					global::Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(this.SetDocDataDirty(0)); // Setting the encoding will mark the document as dirty, so clear the dirty flag.
				}
				
				if (this.Hierarchy != null && global::System.IO.File.Exists(diagramFileName))
				{
					// Add a lock to the subordinate diagram file.
					if (this.diagramDocumentLockHolder == null)
					{
						uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
						if (itemId != global::Microsoft.VisualStudio.VSConstants.VSITEMID_NIL)
						{
							this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
							if (this.diagramDocumentLockHolder == null)
							{
								throw new global::System.InvalidOperationException(string.Format(global::System.Globalization.CultureInfo.CurrentCulture,
													global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslDomainModel.SingletonResourceManager.GetString("CannotCloseExistingDiagramDocument"),
													diagramFileName));
							}
						}
					}
				}
			}
		}
Ejemplo n.º 6
0
        /// <summary>
        /// Loads the given file.
        /// </summary>
        protected override void Load(string fileName, bool isReload)
        {
            DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();

            global::DSLFactory.Candle.SystemModel.CandleModel modelRoot = null;
            DslModeling::ISchemaResolver schemaResolver = new DslShell::ModelingSchemaResolver(this.ServiceProvider);

            // Enable diagram fixup rules in our store, because we will load diagram data.
            global::DSLFactory.Candle.SystemModel.CandleDomainModel.EnableDiagramRules(this.Store);
            string diagramFileName = fileName + this.DiagramExtension;

            // Ensure that subordinate diagram file is named properly; handles the case where a rename occurs while the designer was closed.
            if (this.Hierarchy != null)
            {
                uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
                if (itemId != global::Microsoft.VisualStudio.VSConstants.VSITEMID_NIL)
                {
                    global::System.Diagnostics.Debug.Assert(!this.IsLoaded);
                    // Make sure the name is right before we lock the item in the RDT.
                    DslShell::SubordinateFileHelper.EnsureChildFileName(this.ServiceProvider, this.Hierarchy, itemId, diagramFileName);

                    // Found the diagram file, lock it in the running documents table.
                    this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
                    if (this.diagramDocumentLockHolder == null)
                    {
                        throw new global::System.InvalidOperationException(global::DSLFactory.Candle.SystemModel.CandleDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
                    }
                }
            }

            try
            {
                modelRoot = global::DSLFactory.Candle.SystemModel.CandleSerializationHelper.Instance.LoadModelAndDiagram(serializationResult, this.Store, fileName, diagramFileName, schemaResolver, null /* no load-time validation */);
            }
            finally
            {
                if (this.diagramDocumentLockHolder != null && (modelRoot == null || serializationResult.Failed))
                {
                    // Load failed, release the document lock if we added one above.
                    this.diagramDocumentLockHolder.UnregisterSubordinateDocument();
                    this.diagramDocumentLockHolder = null;
                }
            }

            // Report serialization messages.
            this.SuspendErrorListRefresh();
            try
            {
                foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
                {
                    this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
                }
            }
            finally
            {
                this.ResumeErrorListRefresh();
            }

            if (serializationResult.Failed)
            {
                // Load failed, can't open the file.
                throw new global::System.InvalidOperationException(global::DSLFactory.Candle.SystemModel.CandleDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
            }
            else
            {
                this.SetRootElement(modelRoot);
                if (this.Hierarchy != null && global::System.IO.File.Exists(diagramFileName))
                {
                    DslShell::SubordinateFileHelper.EnsureChildProjectItem(this.Hierarchy, this.ItemId, diagramFileName);

                    // Should have a subordinate diagram file now. If we didn't add a lock above, add one now.
                    if (this.diagramDocumentLockHolder == null)
                    {
                        uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
                        this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
                        if (this.diagramDocumentLockHolder == null)
                        {
                            throw new global::System.InvalidOperationException(global::DSLFactory.Candle.SystemModel.CandleDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
                        }
                    }

                    // Connect to events on the RDT in order to allow delayed rename handling.
                    this.eventsCookie = DslShell::SubordinateFileHelper.AdviseRunningDocumentTableEvents(this.ServiceProvider, this);
                }
            }
        }
Ejemplo n.º 7
0
		/// <summary>
		/// Loads the given file.
		/// </summary>
		protected override void Load(string fileName, bool isReload)
		{
			DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();
			global::Tum.PDE.LanguageDSL.MetaModel modelRoot = null;
			DslModeling::ISchemaResolver schemaResolver = new DslShell::ModelingSchemaResolver(this.ServiceProvider);
			//clear the current root element
			this.SetRootElement(null);
			modelRoot = global::Tum.PDE.LanguageDSL.LanguageDSLSerializationHelper.Instance.LoadModel(serializationResult, this.GetModelPartition(), fileName, schemaResolver, null /* no load-time validation */, this.SerializerLocator);

			// Report serialization messages.
			this.SuspendErrorListRefresh();
			try
			{
				foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
				{
					this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
				}
			}
			finally
			{
				this.ResumeErrorListRefresh();
			}

			if (serializationResult.Failed)
			{	
				// Load failed, can't open the file.
				throw new global::System.InvalidOperationException(global::Tum.PDE.LanguageDSL.LanguageDSLDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
			}
			else
			{
				this.SetRootElement(modelRoot);
				
				// Attempt to set the encoding
				if (serializationResult.Encoding != null)
				{
					this.ModelingDocStore.SetEncoding(serializationResult.Encoding);
					global::Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(this.SetDocDataDirty(0)); // Setting the encoding will mark the document as dirty, so clear the dirty flag.
				}
				
			}
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Loads the given file.
		/// </summary>
		protected override void Load(string fileName, bool isReload)
		{
			DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();
			global::Altinoren.ActiveWriter.Model modelRoot = null;
			DslModeling::ISchemaResolver schemaResolver = new DslShell::ModelingSchemaResolver(this.ServiceProvider);
			
			// Enable diagram fixup rules in our store, because we will load diagram data.
			global::Altinoren.ActiveWriter.ActiveWriterDomainModel.EnableDiagramRules(this.Store);
			string diagramFileName = fileName + this.DiagramExtension;
			
			// Ensure that subordinate diagram file is named properly; handles the case where a rename occurs while the designer was closed.
			if(this.Hierarchy != null)
			{
				uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
				if(itemId != global::Microsoft.VisualStudio.VSConstants.VSITEMID_NIL)
				{
					global::System.Diagnostics.Debug.Assert(!this.IsLoaded);
					// Make sure the name is right before we lock the item in the RDT.
					DslShell::SubordinateFileHelper.EnsureChildFileName(this.ServiceProvider, this.Hierarchy, itemId, diagramFileName);

					// Found the diagram file, lock it in the running documents table.
					this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
					if (this.diagramDocumentLockHolder == null)
					{
						throw new global::System.InvalidOperationException(global::Altinoren.ActiveWriter.ActiveWriterDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
					}
				}
			}
			
			try
			{
				modelRoot = global::Altinoren.ActiveWriter.ActiveWriterSerializationHelper.Instance.LoadModelAndDiagram(serializationResult, this.Store, fileName, diagramFileName, schemaResolver, null /* no load-time validation */);
			}
			finally
			{
				if (this.diagramDocumentLockHolder != null && (modelRoot == null || serializationResult.Failed))
				{
					// Load failed, release the document lock if we added one above.
					this.diagramDocumentLockHolder.UnregisterSubordinateDocument();
					this.diagramDocumentLockHolder = null;
				}
			}

			// Report serialization messages.
			this.SuspendErrorListRefresh();
			try
			{
				foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
				{
					this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
				}
			}
			finally
			{
				this.ResumeErrorListRefresh();
			}

			if (serializationResult.Failed)
			{	
				// Load failed, can't open the file.
				throw new global::System.InvalidOperationException(global::Altinoren.ActiveWriter.ActiveWriterDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
			}
			else
			{
				this.SetRootElement(modelRoot);
				if (this.Hierarchy != null && global::System.IO.File.Exists(diagramFileName))
				{
					DslShell::SubordinateFileHelper.EnsureChildProjectItem(this.Hierarchy, this.ItemId, diagramFileName);

					// Should have a subordinate diagram file now. If we didn't add a lock above, add one now.
					if (this.diagramDocumentLockHolder == null)
					{
						uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
						this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
						if (this.diagramDocumentLockHolder == null)
						{
							throw new global::System.InvalidOperationException(global::Altinoren.ActiveWriter.ActiveWriterDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
						}
					}

					// Connect to events on the RDT in order to allow delayed rename handling.
					this.eventsCookie = DslShell::SubordinateFileHelper.AdviseRunningDocumentTableEvents(this.ServiceProvider, this);
				}
			}
		}
Ejemplo n.º 9
0
        private void LoadDiagram <TModel, TDiagram>(string fileName, string diagramExtension, System.Guid diagramDomainId, CreateDiagramHandler callback)
            where TModel : Microsoft.VisualStudio.Modeling.ModelElement
            where TDiagram : ComponentModelDiagram
        {
            ReadOnlyCollection <TModel> modelsLayerList = this.Store.ElementDirectory.FindElements <TModel>();

            if (modelsLayerList.Count == 0)
            {
                return;
            }

            DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();
            DslModeling::ISchemaResolver     schemaResolver      = new DslShell::ModelingSchemaResolver(this.ServiceProvider);

            // Enable diagram fixup rules in our store, because we will load diagram data.
            global::DSLFactory.Candle.SystemModel.CandleDomainModel.EnableDiagramRules(this.Store);
            string diagramFileName = fileName + diagramExtension;

            // Ensure that subordinate diagram file is named properly; handles the case where a rename occurs while the designer was closed.
            if (this.Hierarchy != null)
            {
                uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, DataLayerDiagramExtension);
                if (itemId != global::Microsoft.VisualStudio.VSConstants.VSITEMID_NIL)
                {
                    DslShell::SubordinateFileHelper.EnsureChildFileName(this.ServiceProvider, this.Hierarchy, itemId, diagramFileName);

                    // Found the diagram file, lock it in the running documents table.
                    //this.diagramDocument2LockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument( this.ServiceProvider, this, diagramFileName, itemId );
                    //if( this.diagramDocument2LockHolder == null )
                    //{
                    //    throw new global::System.InvalidOperationException( global::DSLFactory.Candle.SystemModel.SystemModelDomainModel.SingletonResourceManager.GetString( "CannotOpenDocument" ) );
                    //}
                }
            }

            try
            {
                global::DSLFactory.Candle.SystemModel.CandleSerializationHelper.Instance.LoadDiagram <TModel, TDiagram>(serializationResult, modelsLayerList[0], diagramFileName, schemaResolver, diagramDomainId, callback);
            }
            catch
            {
                ServiceLocator.Instance.IDEHelper.ShowMessage(String.Concat("Error when opening diagram file ", diagramFileName));
            }
            finally
            {
                //if( this.diagramDocument2LockHolder != null && (serializationResult.Failed ) )
                //{
                //    // Load failed, release the document lock if we added one above.
                //    this.diagramDocument2LockHolder.UnregisterSubordinateDocument();
                //    this.diagramDocument2LockHolder = null;
                //}
            }
            // Report serialization messages.
            this.SuspendErrorListRefresh();
            try
            {
                // Report serialization messages.
                foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
                {
                    this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
                }
            }
            finally
            {
                this.ResumeErrorListRefresh();
            }

            if (serializationResult.Failed)
            {
                // Load failed, can't open the file.
                throw new global::System.InvalidOperationException(global::DSLFactory.Candle.SystemModel.CandleDomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
            }
            else
            {
                if (this.Hierarchy != null && global::System.IO.File.Exists(diagramFileName))
                {
                    DslShell::SubordinateFileHelper.EnsureChildProjectItem(this.Hierarchy, this.ItemId, diagramFileName);
                }
            }
        }