コード例 #1
0
        async Task UpdateStyleParent(MonoDevelop.Projects.Project styleParent, string mimeType)
        {
            RemovePolicyChangeHandler();

            if (string.IsNullOrEmpty(mimeType))
            {
                mimeType = "text/plain";
            }

            var mimeTypes = DesktopService.GetMimeTypeInheritanceChain(mimeType);

            if (styleParent != null)
            {
                policyContainer = styleParent.Policies;
            }
            else
            {
                policyContainer = MonoDevelop.Projects.Policies.PolicyService.DefaultPolicies;
            }
            var currentPolicy = policyContainer.Get <TextStylePolicy> (mimeTypes);

            policyContainer.PolicyChanged += HandlePolicyChanged;
            ((DefaultSourceEditorOptions)textEditor.Options).UpdateStylePolicy(currentPolicy);

            var context = await EditorConfigService.GetEditorConfigContext(textEditor.FileName, default(CancellationToken));

            if (context == null)
            {
                return;
            }
            ((DefaultSourceEditorOptions)textEditor.Options).SetContext(context);
        }
コード例 #2
0
        void UpdateStyleParent(MonoDevelop.Projects.Project styleParent, string mimeType)
        {
            RemovePolicyChangeHandler();

            if (string.IsNullOrEmpty(mimeType))
            {
                mimeType = "text/plain";
            }

            var mimeTypes = DesktopService.GetMimeTypeInheritanceChain(mimeType);

            if (styleParent != null)
            {
                policyContainer = styleParent.Policies;
            }
            else
            {
                policyContainer = MonoDevelop.Projects.Policies.PolicyService.DefaultPolicies;
            }
            var currentPolicy = policyContainer.Get <TextStylePolicy> (mimeTypes);

            policyContainer.PolicyChanged += HandlePolicyChanged;
            textEditor.Options             = DefaultSourceEditorOptions.Instance.WithTextStyle(currentPolicy);
        }
コード例 #3
0
		void UpdateStyleParent (MonoDevelop.Projects.Project styleParent, string mimeType)
		{
			RemovePolicyChangeHandler ();

			if (string.IsNullOrEmpty (mimeType))
				mimeType = "text/plain";

			var mimeTypes = DesktopService.GetMimeTypeInheritanceChain (mimeType);

			if (styleParent != null)
				policyContainer = styleParent.Policies;
			else
				policyContainer = MonoDevelop.Projects.Policies.PolicyService.DefaultPolicies;
			var currentPolicy = policyContainer.Get<TextStylePolicy> (mimeTypes);

			policyContainer.PolicyChanged += HandlePolicyChanged;
			textEditor.Options = DefaultSourceEditorOptions.Instance.WithTextStyle (currentPolicy);
		}