public virtual int get_ProjectCfgProvider(out IVsProjectCfgProvider p) { CCITracing.TraceCall(); p = null; IVsCfgProvider cfgProvider = null; this.project.GetCfgProvider(out cfgProvider); if (cfgProvider != null) { p = cfgProvider as IVsProjectCfgProvider; } return((null == p) ? VSConstants.E_NOTIMPL : VSConstants.S_OK); }
/// <include file='doc\ProjectConfig.uex' path='docs/doc[@for="BuildableProjectConfig.QueryStartUpToDateCheck"]/*' /> public virtual int QueryStartUpToDateCheck(uint options, int[] supported, int[] ready) { CCITracing.TraceCall(); config.PrepareBuild(false); if (supported != null) { supported[0] = 0; // TODO: } if (ready != null) { ready[0] = (thread == null) ? 1 : 0; } return(NativeMethods.S_OK); }
public virtual int QueryStartUpToDateCheck(uint options, int[] supported, int[] ready) { CCITracing.TraceCall(); config.PrepareBuild(false); if (supported != null && supported.Length > 0) { supported[0] = 0; // TODO: } if (ready != null && ready.Length > 0) { ready[0] = (this.config.ProjectMgr.BuildInProgress) ? 0 : 1; } return(VSConstants.S_OK); }
/// <include file='doc\ProjectConfig.uex' path='docs/doc[@for="BuildableProjectConfig.StartClean"]/*' /> public virtual int StartClean(IVsOutputWindowPane pane, uint options) { CCITracing.TraceCall(); config.PrepareBuild(true); Debug.Assert(thread == null); this.options = options; // add "clean" option this.output = pane; this.fCleanBuild = true; // Current version of MSBuild wish to be called in an STA BuildMain(); // thread = new Thread(new ThreadStart(BuildMain)); // thread.Start(); return(NativeMethods.S_OK); }
/// <summary> /// creates the physical directory for a folder node /// Override if your node does not use file system folder /// </summary> public virtual void CreateDirectory() { try { if (Directory.Exists(this.Url) == false) { Directory.CreateDirectory(this.Url); } } //TODO - this should not digest all exceptions. catch (System.Exception e) { CCITracing.Trace(e); throw e; } }
/// <summary> /// The set config property is robust in the sense that they will create the /// attributes if needed. If value is null it will set empty string. /// </summary> /// <param name="attrName"></param> /// <param name="value"></param> public void SetConfigProperty(string attrName, string value) { CCITracing.TraceCall(); if (value == null) { value = String.Empty; } if (this.ProjectMgr != null) { for (int i = 0, n = this.projectConfigs.Length; i < n; i++) { ProjectConfig config = projectConfigs[i]; config.SetConfigurationProperty(attrName, value); } this.ProjectMgr.SetProjectFileDirty(true); } }
public void AddCfgsOfCfgName(string name, string cloneName, int fPrivate) { CCITracing.TraceCall(); XmlElement settings = (XmlElement)this.projectManager.StateElement.SelectSingleNode("Build/Settings"); XmlElement newNode; if (cloneName != null) { XmlElement toClone = (XmlElement)settings.SelectSingleNode("Config[@Name='" + cloneName + "']"); newNode = (XmlElement)toClone.CloneNode(true); newNode.SetAttribute("Name", name); } else { newNode = settings.OwnerDocument.CreateElement("Config"); newNode.SetAttribute("Name", name); } settings.AppendChild(newNode); NotifyOnCfgNameAdded(name); }
/// <summary> /// Gets properties whose values are GUIDs. /// </summary> /// <param name="propid">Identifier of the hierarchy property</param> /// <param name="guid"> Pointer to a GUID property specified in propid</param> /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns> public override int GetGuidProperty(int propid, out Guid guid) { guid = Guid.Empty; switch ((__VSHPROPID)propid) { case __VSHPROPID.VSHPROPID_ProjectIDGuid: guid = this.projectInstanceGuid; break; default: return(base.GetGuidProperty(propid, out guid)); } CCITracing.TraceCall(String.Format(CultureInfo.CurrentCulture, "Guid for {0} property", propid)); if (guid.CompareTo(Guid.Empty) == 0) { return(VSConstants.DISP_E_MEMBERNOTFOUND); } return(VSConstants.S_OK); }
/// <include file='doc\HierarchyItem.uex' path='docs/doc[@for="HierarchyItemNode.SetEditLabel1"]/*' /> /// <summary> /// Rename the underlying document based on the change the user just made to the edit label. /// </summary> public override int SetEditLabel(string label, string strRelPath) { uint oldId = this.hierarchyId; string strSavePath = Path.GetDirectoryName(strRelPath); string newRelPath = Path.Combine(strSavePath, label); if (!Path.IsPathRooted(strRelPath)) { strSavePath = Path.Combine(Path.GetDirectoryName(this.ProjectMgr.BaseURI.Uri.LocalPath), strSavePath); } string strNewName = Path.Combine(strSavePath, label); string strOldName = this.Url; // must update the caption prior to calling RenameDocument, since it may // cause queries of that property (such as from open editors). string oldrelPath = this.ItemNode.GetAttribute("Include"); this.ItemNode.Rename(newRelPath); try { if (!RenameDocument(strOldName, strNewName)) { this.ItemNode.Rename(oldrelPath); this.itemNode.RefreshProperties(); } } catch (Exception e) { // Just re-throw the exception so we don't get duplicate message boxes. //RTLAwareMessageBox.Show(null, e.Message, null, MessageBoxButtons.OK, // MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0); CCITracing.Trace(e); this.ItemNode.Rename(oldrelPath); throw e; //return (int)NativeMethods.E_FAIL; } /// Return S_FALSE if the hierarchy item id has changed. This forces VS to flush the stale /// hierarchy item id. return((oldId == this.hierarchyId) ? 0 : (int)NativeMethods.S_FALSE); }
/// <summary> /// Returns the existing configurations stored in the project file. /// </summary> public void GetCfgNames(uint celt, string[] names, uint[] actual) { // get's called twice, once for allocation, then for retrieval CCITracing.TraceCall(); int i = 0; foreach (XmlElement e in this.projectManager.StateElement.SelectNodes("Build/Settings/Config")) { if (names != null) { names[i++] = e.GetAttribute("Name"); if (i == celt) { break; } } else { // if no names[] was passed in, this is used for counting the array size for the caller i++; } } actual[0] = (uint)i; }
public virtual int Wait(uint ms, int fTickWhenMessageQNotEmpty) { CCITracing.TraceCall(); return(VSConstants.E_NOTIMPL); }
public virtual int Stop(int fsync) { CCITracing.TraceCall(); return(VSConstants.S_OK); }
public virtual int StartUpToDateCheck(IVsOutputWindowPane pane, uint options) { CCITracing.TraceCall(); return(VSConstants.E_NOTIMPL); }
public virtual void SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider site) { CCITracing.TraceCall(); this.site = new ServiceProvider(site); }
public override void DoDefaultAction() { CCITracing.TraceCall(); OpenItem(false, false); }
public virtual void CanCreateProject(string filename, uint flags, out int canCreate) { CCITracing.TraceCall(); canCreate = 1; }
static public void Trace(System.Exception e) { CCITracing.InternalTraceCall(2); System.Diagnostics.Trace.WriteLine("ExceptionInfo: \t" + e.ToString()); }
/// <include file='doc\HierarchyItem.uex' path='docs/doc[@for="HierarchyItemNode.GetEditLabel"]/*' /> public override string GetEditLabel() { CCITracing.TraceCall(); return(Caption); }
public virtual int get_Platform(out Guid platform) { CCITracing.TraceCall(); platform = Guid.Empty; return(VSConstants.E_NOTIMPL); }
public virtual int get_IsSpecifyingOutputSupported(out int f) { CCITracing.TraceCall(); f = 1; return(VSConstants.S_OK); }
public virtual int get_IsPackaged(out int pkgd) { CCITracing.TraceCall(); pkgd = 0; return(VSConstants.S_OK); }
public virtual int EnumOutputs(out IVsEnumOutputs eo) { CCITracing.TraceCall(); eo = null; return(VSConstants.E_NOTIMPL); }
public override string GetEditLabel() { CCITracing.TraceCall(); return Path.GetFileName(this.xmlNode.GetAttribute("RelPath")); }
static public void TraceCall() { // skip this one as well CCITracing.InternalTraceCall(2); }
static public void TraceCall(string strParameters) { CCITracing.InternalTraceCall(2); System.Diagnostics.Trace.WriteLine("\tParameters: \t" + strParameters); }
public virtual int get_TargetCodePage(out uint target) { CCITracing.TraceCall(); target = (uint)System.Text.Encoding.Default.CodePage; return(VSConstants.S_OK); }
public virtual void Close() { CCITracing.TraceCall(); this.site.Dispose(); this.site = null; }
public virtual int OpenOutput(string name, out IVsOutput output) { CCITracing.TraceCall(); output = null; return(VSConstants.E_NOTIMPL); }
public virtual int get_RootURL(out string root) { CCITracing.TraceCall(); root = null; return(VSConstants.S_OK); }
/// <summary> /// Called by the vs shell to start debugging (managed or unmanaged). /// Override this method to support other debug engines. /// </summary> /// <param name="grfLaunch">A flag that determines the conditions under which to start the debugger. For valid grfLaunch values, see __VSDBGLAUNCHFLAGS</param> /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code</returns> public virtual int DebugLaunch(uint grfLaunch) { CCITracing.TraceCall(); try { VsDebugTargetInfo info = new VsDebugTargetInfo(); info.cbSize = (uint)Marshal.SizeOf(info); info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; // On first call, reset the cache, following calls will use the cached values string property = GetConfigurationProperty("StartProgram", true); if (string.IsNullOrEmpty(property)) { info.bstrExe = this.ProjectMgr.GetOutputAssembly(this.ConfigName, this.PlatformName); } else { info.bstrExe = property; } property = GetConfigurationProperty("WorkingDirectory", false); if (string.IsNullOrEmpty(property)) { info.bstrCurDir = Path.GetDirectoryName(info.bstrExe); } else { info.bstrCurDir = property; } property = GetConfigurationProperty("CmdArgs", false); if (!string.IsNullOrEmpty(property)) { info.bstrArg = property; } property = GetConfigurationProperty("RemoteDebugMachine", false); if (property != null && property.Length > 0) { info.bstrRemoteMachine = property; } info.fSendStdoutToOutputWindow = 0; property = GetConfigurationProperty("EnableUnmanagedDebugging", false); if (property != null && string.Compare(property, "true", StringComparison.OrdinalIgnoreCase) == 0) { //Set the unmanged debugger //TODO change to vsconstant when it is available in VsConstants (guidNativeOnlyEng was the old name, maybe it has got a new name) info.clsidCustom = new Guid("{3B476D35-A401-11D2-AAD4-00C04F990171}"); } else { //Set the managed debugger info.clsidCustom = VSConstants.CLSID_ComPlusOnlyDebugEngine; } info.grfLaunch = grfLaunch; VsShellUtilities.LaunchDebugger(this.ProjectMgr.Site, info); } catch (Exception e) { Trace.WriteLine("Exception : " + e.Message); return(Marshal.GetHRForException(e)); } return(VSConstants.S_OK); }