Exemplo n.º 1
0
        public void TextViewCreated(IWpfTextView textView)
        {
            ITextDocument document;

            if (!TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out document))
            {
                return;
            }

            var textViewAdapter = EditorAdaptersFactoryService.GetViewAdapter(textView);

            if (textViewAdapter == null)
            {
                return;
            }

            var info = BuilderInfo.Find(document.FilePath);

            if (info != null)
            {
                // add commands to view form or code
                //textView.Properties.AddProperty(ViewFormKey, new AdapterCommand(textViewAdapter, ServiceProvider, VSConstants.GUID_VSStandardCommandSet97, (uint)VSConstants.VSStd97CmdID.ViewForm, () => ViewDesigner(document)));
                //textView.Properties.AddProperty(ViewCodeKey, new AdapterCommand(textViewAdapter, ServiceProvider, VSConstants.GUID_VSStandardCommandSet97, (uint)VSConstants.VSStd97CmdID.ViewCode, () => ViewCode(document)));
                if (string.Equals(info.Extension, ".xeto", StringComparison.OrdinalIgnoreCase))
                {
                    textView.Properties.GetOrCreateSingletonProperty(() => new XamlCompletionHandler(textViewAdapter, textView, this));
                }
            }
            else if (BuilderInfo.IsCodeBehind(document.FilePath))
            {
                textView.Properties.AddProperty(ViewFormKey, new AdapterCommand(textViewAdapter, ServiceProvider, VSConstants.GUID_VSStandardCommandSet97, (uint)VSConstants.VSStd97CmdID.ViewForm, () => ViewDesigner(document)));
            }
        }
Exemplo n.º 2
0
        public void TextViewCreated(IWpfTextView textView)
        {
            ITextDocument document;

            if (!TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out document))
            {
                return;
            }

            var textViewAdapter = EditorAdaptersFactoryService.GetViewAdapter(textView);

            if (textViewAdapter == null)
            {
                return;
            }

            if (BuilderInfo.Supports(document.FilePath))
            {
                // add commands to view form or code
                textView.Properties.AddProperty(ViewFormKey, new AdapterCommand(textViewAdapter, ServiceProvider, VSConstants.GUID_VSStandardCommandSet97, (uint)VSConstants.VSStd97CmdID.ViewForm, () => ViewDesigner(document)));
                textView.Properties.AddProperty(ViewCodeKey, new AdapterCommand(textViewAdapter, ServiceProvider, VSConstants.GUID_VSStandardCommandSet97, (uint)VSConstants.VSStd97CmdID.ViewCode, () => ViewCode(document)));
            }
            else if (BuilderInfo.IsCodeBehind(document.FilePath))
            {
                textView.Properties.AddProperty(ViewFormKey, new AdapterCommand(textViewAdapter, ServiceProvider, VSConstants.GUID_VSStandardCommandSet97, (uint)VSConstants.VSStd97CmdID.ViewForm, () => ViewDesignSource(document)));
            }
        }