void OnCompileFinished(ExpressionCompilerJob job)
		{
			if (m_VSMainWindow == null)
				return;
			m_ExpressionContainsExec = job.ContainsExec;
			Value title_value = job.EvalResult;
			if (title_value != null)
			{
				string title = title_value.ToString();
				m_VSMainWindow.SetTitle(title);
				Debug.WriteLine("Updating the titlebar");
			}
			else
			{
				m_VSMainWindow.SetTitle(m_VSMainWindow.OriginalTitle);
			}
		}
		private void UpdateWindowTitle()
		{
			m_VSMainWindow.Update();

			PackageGlobals globals = PackageGlobals.Instance();
			EvalContext eval_ctx = globals.CreateFreshEvalContext();
			bool variables_changed = !CompareVariables(eval_ctx.VariableValues, m_PrevVariableValues);

			if (variables_changed)
			{
				m_PrevVariableValues = eval_ctx.VariableValues;
				globals.TitleSetupEditor.Variables = eval_ctx.VariableValues;
			}

			ToolOptions options = (ToolOptions)GetDialogPage(typeof(ToolOptions));

#if VS2010_AND_LATER
			if (m_DebugPrintTitleControlHierarchyCount < 5 && options.Debug)
			{
				++m_DebugPrintTitleControlHierarchyCount;
				m_VSMainWindow.DebugPrintTitleControlHierarchy();
			}
#endif
	
			PackageGlobals.VSMultiInstanceInfo multi_instance_info;
			globals.GetVSMultiInstanceInfo(out multi_instance_info);

			bool extension_active;
			switch (options.ExtensionActivationRule)
			{
				case EExtensionActivationRule.ActiveWithMultipleVSInstances:
					extension_active = multi_instance_info.multiple_instances;
					break;
				case EExtensionActivationRule.ActiveWithMultipleVSInstancesOfTheSameVersion:
					extension_active = multi_instance_info.multiple_instances_same_version;
					break;
				case EExtensionActivationRule.AlwaysInactive:
					extension_active = false;
					break;
				default:
					extension_active = true;
					break;
			}

			if (extension_active)
			{
				TitleSetup title_setup = globals.TitleSetup;
				if (m_ExpressionContainsExec || variables_changed || m_PrevExtensionActivationRule != options.ExtensionActivationRule ||
					title_setup.TitleExpression != m_PrevTitleExpressionStr)
				{
					Parser parser = new Parser(title_setup.TitleExpression, globals.ExecFuncEvaluator, globals.CompileTimeConstants); ;
					ExpressionCompilerJob job = new ExpressionCompilerJob(parser,  globals.CreateFreshEvalContext(), false, m_CompiledExpressionCache);
					job.OnCompileFinished += OnCompileFinished;
					m_ExpressionCompilerThread.RemoveAllJobs();
					m_ExpressionCompilerThread.AddJob(job);
				}
				m_PrevTitleExpressionStr = title_setup.TitleExpression;
			}
			else
			{
				m_VSMainWindow.SetTitle(m_VSMainWindow.OriginalTitle);
			}

			m_PrevExtensionActivationRule = options.ExtensionActivationRule;
		}