public override void SwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView)
		{
			if (file == this.PrimaryFile && oldView != this) {
				primaryViewContent.SwitchToThisWithoutSaveLoad(file, oldView);
				LoadFromPrimary();
			}
		}
Exemplo n.º 2
0
        protected void SwitchedToView(IViewContent newView)
        {
            if (currentView != null)
            {
                if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView) ||
                    currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
                {
                    // switch without Save/Load
                    currentView.SwitchFromThisWithoutSaveLoad(this, newView);
                    newView.SwitchToThisWithoutSaveLoad(this, currentView);

                    currentView = newView;
                    return;
                }
            }
            if (currentView != null)
            {
                SaveCurrentView();
            }
            try {
                inLoadOperation = true;
                Properties memento = GetMemento(newView);
                using (Stream sourceStream = OpenRead()) {
                    currentView = newView;
                    fileData    = null;
                    newView.Load(this, sourceStream);
                }
                RestoreMemento(newView, memento);
            } finally {
                inLoadOperation = false;
            }
        }
Exemplo n.º 3
0
        public void SwitchedToView(IViewContent newView)
        {
            if (newView == null)
            {
                throw new ArgumentNullException("newView");
            }
            if (currentView == newView)
            {
                return;
            }
            if (currentView != null)
            {
                if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView) ||
                    currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
                {
                    // switch without Save/Load
                    currentView.SwitchFromThisWithoutSaveLoad(this, newView);
                    newView.SwitchToThisWithoutSaveLoad(this, currentView);

                    currentView = newView;
                    return;
                }
            }
            if (currentView != null)
            {
                SaveCurrentView();
            }
            try
            {
                inLoadOperation = true;
                VelerSoftware.SZC.Debugger.Core.Properties memento = GetMemento(newView);
                using (Stream sourceStream = OpenRead())
                {
                    IViewContent oldView = currentView;
                    try
                    {
                        currentView = newView;
                        // don't reset fileData if the file is untitled, because OpenRead() wouldn't be able to read it otherwise
                        if (this.IsUntitled == false)
                        {
                            fileData = null;
                        }
                        newView.Load(this, sourceStream);
                    }
                    catch
                    {
                        // stay with old view in case of exceptions
                        currentView = oldView;
                        throw;
                    }
                }
                RestoreMemento(newView, memento);
            }
            finally
            {
                inLoadOperation = false;
            }
        }
Exemplo n.º 4
0
        public void SwitchedToView(IViewContent newView)
        {
            if (newView == null)
            {
                throw new ArgumentNullException("newView");
            }
            if (currentView == newView)
            {
                return;
            }
            if (currentView != null)
            {
                if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView) ||
                    currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
                {
                    // switch without Save/Load
                    currentView.SwitchFromThisWithoutSaveLoad(this, newView);
                    newView.SwitchToThisWithoutSaveLoad(this, currentView);

                    currentView = newView;
                    return;
                }
                SaveCurrentView();
            }
            try {
                inLoadOperation = true;
                Properties memento = GetMemento(newView);
                using (Stream sourceStream = OpenRead()) {
                    IViewContent oldView = currentView;
                    bool         success = false;
                    try {
                        currentView = newView;
                        // don't reset fileData if the file is untitled, because OpenRead() wouldn't be able to read it otherwise
                        if (this.IsUntitled == false)
                        {
                            fileData = null;
                        }
                        newView.Load(this, sourceStream);
                        success = true;
                    } finally {
                        // Use finally instead of catch+rethrow so that the debugger
                        // breaks at the original crash location.
                        if (!success)
                        {
                            // stay with old view in case of exceptions
                            currentView = oldView;
                        }
                    }
                }
                RestoreMemento(newView, memento);
            } finally {
                inLoadOperation = false;
            }
        }
Exemplo n.º 5
0
		public void SwitchedToView(IViewContent newView)
		{
			if (newView == null)
				throw new ArgumentNullException("newView");
			if (currentView == newView)
				return;
			if (currentView != null) {
				if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView)
				    || currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
				{
					// switch without Save/Load
					currentView.SwitchFromThisWithoutSaveLoad(this, newView);
					newView.SwitchToThisWithoutSaveLoad(this, currentView);
					
					currentView = newView;
					return;
				}
				SaveCurrentView();
			}
			try {
				inLoadOperation = true;
				Properties memento = GetMemento(newView);
				using (Stream sourceStream = OpenRead()) {
					IViewContent oldView = currentView;
					bool success = false;
					try {
						currentView = newView;
						// don't reset fileData if the file is untitled, because OpenRead() wouldn't be able to read it otherwise
						if (this.IsUntitled == false)
							fileData = null;
						newView.Load(this, sourceStream);
						success = true;
					} finally {
						// Use finally instead of catch+rethrow so that the debugger
						// breaks at the original crash location.
						if (!success) {
							// stay with old view in case of exceptions
							currentView = oldView;
						}
					}
				}
				RestoreMemento(newView, memento);
			} finally {
				inLoadOperation = false;
			}
		}
Exemplo n.º 6
0
		protected void SwitchedToView(IViewContent newView)
		{
			if (currentView != null) {
				if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView)
				    || currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
				{
					// switch without Save/Load
					currentView.SwitchFromThisWithoutSaveLoad(this, newView);
					newView.SwitchToThisWithoutSaveLoad(this, currentView);
					
					currentView = newView;
					return;
				}
			}
			if (currentView != null) {
				SaveCurrentView();
			}
			try {
				inLoadOperation = true;
				Properties memento = GetMemento(newView);
				using (Stream sourceStream = OpenRead()) {
					currentView = newView;
					fileData = null;
					newView.Load(this, sourceStream);
				}
				RestoreMemento(newView, memento);
			} finally {
				inLoadOperation = false;
			}
		}
Exemplo n.º 7
0
		public void SwitchedToView(IViewContent newView)
		{
			if (newView == null)
				throw new ArgumentNullException("newView");
			if (currentView == newView)
				return;
			if (currentView != null) {
				if (newView.SupportsSwitchToThisWithoutSaveLoad(this, currentView)
				    || currentView.SupportsSwitchFromThisWithoutSaveLoad(this, newView))
				{
					// switch without Save/Load
					currentView.SwitchFromThisWithoutSaveLoad(this, newView);
					newView.SwitchToThisWithoutSaveLoad(this, currentView);
					
					currentView = newView;
					return;
				}
			}
			if (currentView != null) {
				SaveCurrentView();
			}
			try {
				inLoadOperation = true;
				Properties memento = GetMemento(newView);
				using (Stream sourceStream = OpenRead()) {
					currentView = newView;
					// don't reset fileData if the file is untitled, because OpenRead() wouldn't be able to read it otherwise
					if (this.IsUntitled == false)
						fileData = null;
					newView.Load(this, sourceStream);
				}
				RestoreMemento(newView, memento);
			} finally {
				inLoadOperation = false;
			}
		}