コード例 #1
0
ファイル: EditorFactory.cs プロジェクト: gleblebedev/toe
		public int CreateEditorInstance(
			uint grfCreateDoc,
			string pszMkDocument,
			string pszPhysicalView,
			IVsHierarchy pvHier,
			uint itemid,
			IntPtr punkDocDataExisting,
			out IntPtr ppunkDocView,
			out IntPtr ppunkDocData,
			out string pbstrEditorCaption,
			out Guid pguidCmdUI,
			out int pgrfCDW)
		{
			Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering {0} CreateEditorInstace()", this));

			// Initialize to null
			ppunkDocView = IntPtr.Zero;
			ppunkDocData = IntPtr.Zero;
			pguidCmdUI = GuidList.guidToeVisualStudioExtensionEditorFactory;
			pgrfCDW = 0;
			pbstrEditorCaption = null;

			var e = this.CreateEditor(pszMkDocument);
			if (e == null)
			{
				return VSConstants.VS_E_UNSUPPORTEDFORMAT;
				//return VSConstants.VS_E_INCOMPATIBLEDOCDATA;
			}

			// Validate inputs
			if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0)
			{
				return VSConstants.E_INVALIDARG;
			}
			if (punkDocDataExisting != IntPtr.Zero)
			{
				return VSConstants.VS_E_INCOMPATIBLEDOCDATA;
			}

			// Create the Document (editor)
			EditorPane NewEditor = new EditorPane(this.editorPackage, Path.GetExtension(pszMkDocument), e);
			ppunkDocView = Marshal.GetIUnknownForObject(NewEditor);
			ppunkDocData = Marshal.GetIUnknownForObject(NewEditor);
			pbstrEditorCaption = "";
			return VSConstants.S_OK;
		}
コード例 #2
0
ファイル: EditorPane.cs プロジェクト: gleblebedev/toe
			public EditorProperties(EditorPane Editor)
			{
				this.editor = Editor;
			}