提交 51ff4c57 编写于 作者: E enricosada 提交者: latkin

Remove unused code

Deletes code conditional on unused defines
  - SINGLE_FILE_GENERATOR
  - NOT_YET_NEEDED
  - BETA2
  - IMPLEMENT_IVSPERSISTHIERARCHYITEM2
  - IVsOutliningCapableLanguage
  - CUT
  - DISABLED
  - OLDCODE
  - Suggestion4299
  - UNUSED_DEPENDENT_FILES
  - UNUSED_NESTED_PROJECTS
  - NEVER
  - false
  - UNUSED

closes https://github.com/Microsoft/visualfsharp/pull/353

commit 2839aab40f4e3ab434f0738d5c8e3691d7c2c5df
Author: latkin <latkin@microsoft.com>
Date:   Mon Aug 3 17:22:20 2015 -0700

    Fix merge conflict

commit fc4602bf8b60204d85e707db1438f78cc082cb3d
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 18:15:19 2015 +0200

    remove SINGLE_FILE_GENERATOR

commit 2dc0802e76006c6f5dcceae3360325eba01aea6c
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 18:08:21 2015 +0200

    remove NOT_YET_NEEDED

commit df49b75211747dcd4e0ff887ef4473a280bf4a59
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 18:05:56 2015 +0200

    remove BETA2

commit 70858f0689b29638ebfb35e1c3b0aa149895b801
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 18:05:36 2015 +0200

    remove IMPLEMENT_IVSPERSISTHIERARCHYITEM2

commit d5ec2047ed550db9396892bfbdea28b07bc46193
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 18:02:21 2015 +0200

    remove IVsOutliningCapableLanguage

commit 7f78d984171b4ed22da6339c6b799bbd44e743b3
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 17:55:24 2015 +0200

    remove CUT

commit d781a86012e497dd81fe811250d5efb481c80945
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 17:54:59 2015 +0200

    remove DISABLED

commit d19d387bd38a0b60e688fe6fa40a24d539d5853d
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 17:50:06 2015 +0200

    remove OLDCODE

commit 1997a739aa040aa06428f2d225f7d8771b27f938
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 17:48:02 2015 +0200

    remove Suggestion4299

commit 58cfe73fd9931dfb0276be146dc8d51c04c68c51
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 17:31:29 2015 +0200

    remove UNUSED_DEPENDENT_FILES

commit 790e49786bb74b1c7a3915ed4b4aaf6243543803
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 17:19:47 2015 +0200

    remove UNUSED_NESTED_PROJECTS

commit b738f464175e825dad7abdc55ad0e0e20a36545c
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 17:01:08 2015 +0200

    remove NEVER

commit 1f9dea77c2618eeaadec25edced524d51c21b534
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 16:59:43 2015 +0200

    remove false

commit e43fe145b73c81329c1af18744517bef7deb9da4
Author: enricosada <enrico@sada.io>
Date:   Thu Apr 9 16:57:27 2015 +0200

    remove UNUSED
上级 66d48836
......@@ -341,53 +341,6 @@ type Graph<'Data, 'Id when 'Id : comparison and 'Id : equality>
else List.iter (trace (node.nodeData::path)) node.nodeNeighbours
List.iter (fun node -> trace [] node) nodes
#if OLDCODE
member g.DepthFirstSearch() =
let grey = ref Set.empty
let time = ref 0
let forest = ref []
let backEdges = ref []
let discoveryTimes = ref Map.empty
let finishingTimes = ref Map.empty
nodes |> List.iter (fun n ->
// build a dfsTree for each node in turn
let treeEdges = ref []
let rec visit n1 =
incr time;
grey := Set.add n1.nodeId !grey;
discoveryTimes := Map.add n1.nodeId !time !discoveryTimes;
for n2 in n1.nodeNeighbours do
if not ((!grey).Contains n2.nodeId) then
treeEdges := (n1.nodeId,n2.nodeId) :: !treeEdges;
visit(n2)
else
backEdges := (n1.nodeId,n2.nodeId) :: !backEdges
incr time;
finishingTimes := Map.add n1.nodeId !time !finishingTimes;
()
if not ((!grey).Contains n.nodeId) then
visit(n);
forest := (n.nodeId,!treeEdges) :: !forest);
!forest, !backEdges, (fun n -> (!discoveryTimes).[n]), (fun n -> (!finishingTimes).[n])
// Present strongly connected components, in dependency order
// Each node is assumed to have a self-edge
member g.GetTopologicalSortStronglyConnectedComponents() =
let forest, backEdges, discoveryTimes, finishingTimes = g.DepthFirstSearch()
let nodeIds = List.map (fun n -> n.nodeId) nodes
let nodesInDecreasingFinishingOrder =
List.sortWith (fun n1 n2 -> -(compare (finishingTimes n1) (finishingTimes n2))) nodeIds
let gT = Graph (nodeIdentity, List.map g.GetNodeData nodesInDecreasingFinishingOrder, List.map (fun (x,y) -> (g.GetNodeData y, g.GetNodeData x)) edges)
let forest, backEdges, discoveryTimes, finishingTimes = gT.DepthFirstSearch()
let scc (root,tree) = Set.add root (List.foldBack (fun (n1,n2) acc -> Set.add n1 (Set.add n2 acc)) tree Set.empty)
let sccs = List.rev (List.map scc forest)
List.map (Set.toList >> List.map g.GetNodeData) sccs
#endif
//---------------------------------------------------------------------------
// In some cases we play games where we use 'null' as a more efficient representation
// in F#. The functions below are used to give initial values to mutable fields.
......
......@@ -107,35 +107,6 @@ module internal ItemDescriptionsImpl =
// Format the supertypes and other useful information about a type to a buffer
let OutputUsefulTypeInfo _isDeclInfo (_infoReader:InfoReader) _m _denv _os _ty = ()
#if DISABLED
if false then
ErrorScope.ProtectAndDiscard m (fun () ->
let g = infoReader.g
let amap = infoReader.amap
let supertypes =
let supertypes = AllSuperTypesOfType g amap m AllowMultiIntfInstantiations.Yes ty
let supertypes = supertypes |> List.filter (AccessibilityLogic.IsTypeAccessible g AccessibleFromSomewhere)
let supertypes = supertypes |> List.filter (typeEquiv g g.obj_ty >> not)
let selfs,supertypes = supertypes |> List.partition (typeEquiv g ty)
let supertypesC,supertypesI = supertypes |> List.partition (isInterfaceTy g)
let supertypes = selfs @ supertypesC @ supertypesI
supertypes
let supertypeLs,_ = NicePrint.layoutPrettifiedTypes denv supertypes
// Suppress printing supertypes for enums, delegates, exceptions and attributes
if supertypes.Length > 1 // more then self
&& not (isEnumTy g ty)
&& not (isUnionTy g ty)
&& not (isRecdTy g ty)
&& not (isDelegateTy g ty)
&& not (ExistsHeadTypeInEntireHierarchy g amap m ty g.exn_tcr)
&& not (ExistsHeadTypeInEntireHierarchy g amap m ty g.tcref_System_Attribute) then
bprintf os "\n\n";
List.zip supertypes supertypeLs |> List.iter (fun (superty,supertyL) ->
if typeEquiv g superty ty then bprintf os " %s: %a\n" (FSComp.SR.typeInfoType()) bufferL supertyL
elif isClassTy g superty || isInterfaceTy g ty then bprintf os " %s: %a\n" (FSComp.SR.typeInfoInherits()) bufferL supertyL
else bprintf os " %s: %a\n" (FSComp.SR.typeInfoImplements()) bufferL supertyL))
#endif
let rangeOfPropInfo (pinfo:PropInfo) =
match pinfo with
......
......@@ -1159,31 +1159,6 @@ namespace Microsoft.FSharp.Text.StructuredFormat
// pprinter: leafFormatter
// --------------------------------------------------------------------
#if Suggestion4299
// See bug 4299. Suppress FSI_dddd+<etc> from fsi printer.
let fixupForInteractiveFSharpClassesWithNoToString obj (text:string) =
// Given obj:T.
// If T is a nested type inside a parent type called FSI_dddd, then it looks like an F# Interactive type.
// Further, if the .ToString() text starts with "FSI_dddd+T" then it looks like it's the default ToString.
// A better test: it is default ToString if the MethodInfo.DeclaringType is System.Object.
// In this case, replace "FSI_dddd+T" by "T".
// assert(obj <> null)
let fullName = obj.GetType().FullName // e.g. "FSI_0123+Name"
let name = obj.GetType().Name // e.g. "Name"
let T = obj.GetType()
if text.StartsWith(fullName) then
// text could be a default .ToString() since it starts with the FullName of the type. More checks...
if T.IsNested &&
T.DeclaringType.Name.StartsWith("FSI_") && // Name has "FSI_" which is
T.DeclaringType.Name.Substring(4) |> Seq.forall System.Char.IsDigit // followed by digits?
then
name ^ text.Substring(fullName.Length) // replace fullName by name at start of text
else
text
else
text
#endif
let leafFormatter (opts:FormatOptions) (obj :obj) =
match obj with
| null -> "null"
......@@ -1219,10 +1194,6 @@ namespace Microsoft.FSharp.Text.StructuredFormat
| :? bool as b -> (if b then "true" else "false")
| :? char as c -> "\'" + formatChar true c + "\'"
| _ -> try let text = obj.ToString()
//Suggestion4299. Not yet fixed.
//#if COMPILER
// let text = fixupForInteractiveFSharpClassesWithNoToString obj text
//#endif
text
with e ->
// If a .ToString() call throws an exception, catch it and use the message as the result.
......
......@@ -1222,39 +1222,6 @@ module internal VsMocks =
member this.UnadviseFileChange(vscookie) = nothing()
}
#if NOT_YET_NEEDED
let vsExtensibility3 =
{ new IVsExtensibility3 with
member this.GetProperties(pParent, pdispPropObj, ppProperties) = err(__LINE__)
member this.RunWizardFile(bstrWizFilename, hwndOwner, vContextParams, pResult) = err(__LINE__)
member this.EnterAutomationFunction() = err(__LINE__)
member this.ExitAutomationFunction() = err(__LINE__)
member this.IsInAutomationFunction(pfInAutoFunc) = err(__LINE__)
member this.GetUserControl( fUserControl) = err(__LINE__)
member this.SetUserControl( fUserControl) = err(__LINE__)
member this.SetUserControlUnlatched( fUserControl) = err(__LINE__)
member this.LockServer( vb) = err(__LINE__)
member this.GetLockCount( pCount) = err(__LINE__)
member this.TestForShutdown( fShutdown) = err(__LINE__)
member this.GetGlobalsObject( extractFrom, ppGlobals) = err(__LINE__)
member this.GetConfigMgr( pIVsProject, itemid, ppCfgMgr) = err(__LINE__)
member this.FireMacroReset() = err(__LINE__)
member this.GetDocumentFromDocCookie( lDocCookie, ppDoc) = err(__LINE__)
member this.IsMethodDisabled( pGUID, dispid) = err(__LINE__)
member this. SetSuppressUI( In) = err(__LINE__)
member this.GetSuppressUI( pOut) = err(__LINE__)
member this.FireProjectsEvent_ItemAdded( project) = err(__LINE__)
member this.FireProjectsEvent_ItemRemoved( project) = err(__LINE__)
member this.FireProjectsEvent_ItemRenamed( project, oldName) = err(__LINE__)
member this.FireProjectItemsEvent_ItemAdded( projectItem) = err(__LINE__)
member this.FireProjectItemsEvent_ItemRemoved( projectItem) = err(__LINE__)
member this.FireProjectItemsEvent_ItemRenamed( projectItem, oldName) = err(__LINE__)
member this.IsFireCodeModelEventNeeded( vbNeeded) = err(__LINE__)
member this.RunWizardFileEx( bstrWizFilename, hwndOwner, vContextParams, vCustomParams, pResult) = err(__LINE__)
member this.FireCodeModelEvent3( dispid, pParent, pElement, changeKind) = err(__LINE__)
}
#endif
let vsSolution =
{ new IVsSolution with
member x.GetProjectEnum(grfEnumFlags, rguidEnumOnlyThisType, ppenum) = err(__LINE__)
......@@ -1566,9 +1533,6 @@ module internal VsMocks =
sp.AddService(typeof<SVsTaskList>, box(vsTaskList()), false)
sp.AddService(typeof<SVsShellMonitorSelection>, box vsMonitorSelection, false)
sp.AddService(typeof<SVsFileChangeEx>, box vsFileChangeManager, false)
#if NOT_YET_NEEDED
sp.AddService(typeof<EnvDTE.IVsExtensibility>, box vsExtensibility3, false)
#endif
sp.AddService(typeof<SVsSolution>, box vsSolution, false)
sp.AddService(typeof<SVsSolutionBuildManager>, box vsSolutionBuildManager, false)
sp.AddService(typeof<SVsRunningDocumentTable>, box vsRunningDocumentTable, false)
......
......@@ -247,170 +247,6 @@ public abstract class SimpleEditorView : IOleCommandTarget, IVsWindowPane, IVsTo
}
}
#if CUT
/// <summary>
/// This class View provides an abstract base class for custom editor views that
/// support Ole Inplace activation (ActiveX controls).
/// </summary>
[CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class OleEditorView : SimpleEditorView, IOleCommandTarget, IVsWindowPane, IVsToolboxUser, IVsStatusbarUser, IOleObject, IOleInPlaceActiveObject, IOleInPlaceObject, IOleInPlaceComponent
//IServiceProvider,
//IOleDocumentView,
//IOleDocument,
//IOleInPlaceUIWindow,
//IVsMultiViewDocumentView,
//IVsFindTarget,
//IVsWindowFrameNotify,
//IVsCodeWindow,
//IVsWindowPaneCommit,
//IVsBroadcastMessageEvents,
//IVsDocOutlineProvider,
//IVsDebuggerEvents,
// ??? VxDTE::IExtensibleObject,
//IVsBackForwardNavigation
// ??? public IVsTextLinesEvents,
// ??? public ISelectionContainer,
// ??? public IVsTextBufferDataEvents,
{
internal EventSinkCollection eventSinks = new EventSinkCollection();
protected IOleComponentUIManager pCompUIMgr;
protected IOleInPlaceComponentSite pIPCompSite;
protected IOleClientSite pClientSite;
protected Hashtable monikers = new Hashtable();
protected OleEditorView(IVsTextLines buffer) : base(buffer) {
}
public virtual void Advise(IAdviseSink sink, out uint cookie) {
cookie = eventSinks.Add(sink);
}
public virtual void Close(uint dwSaveOption) {
}
public virtual int DoVerb(int iVerb, MSG[] msg, IOleClientSite site, int index, IntPtr hwndParent, RECT[] posRect) {
return NativeMethods.S_OK;
}
public virtual void EnumAdvise(out IEnumSTATDATA ppEnumAdvise) {
ppEnumAdvise = null;
}
public virtual int EnumVerbs(out IEnumOLEVERB ppEnumVerbs) {
ppEnumVerbs = null;
return NativeMethods.S_OK;
}
public virtual void GetClientSite(out IOleClientSite site) {
site = this.pClientSite;
}
public virtual void GetClipboardData(uint reserved, out Microsoft.VisualStudio.OLE.Interop.IDataObject obj) {
obj = null;
}
public virtual void GetExtent(uint dwDrawAspect, SIZEL[] size) {
}
public virtual int GetMiscStatus(uint dwAspect, out uint status) {
status = 0;
return NativeMethods.S_OK;
}
public virtual void GetMoniker(uint iAssign, uint whichMoniker, out IMoniker moniker) {
object key = (object)whichMoniker;
moniker = (IMoniker)monikers[key];
}
public virtual void GetUserClassID(out Guid pClsid) {
pClsid = this.GetType().GUID;
}
public virtual int GetUserType(uint formOfType, IntPtr userType) {
return NativeMethods.S_OK;
}
public virtual int InitFromData(Microsoft.VisualStudio.OLE.Interop.IDataObject data, int fCreation, uint reserved) {
return NativeMethods.S_OK;
}
public virtual int IsUpToDate() {
return NativeMethods.S_OK;
}
public virtual void SetClientSite(IOleClientSite site) {
this.pClientSite = site;
}
public virtual void SetColorScheme(LOGPALETTE[] logicalPalette) {
}
public virtual void SetExtent(uint drawAspect, SIZEL[] size) {
}
public virtual void SetHostNames(string containerApp, string containerObj) {
}
public virtual void SetMoniker(uint whichMoniker, IMoniker moniker) {
object key = (object)whichMoniker;
if (monikers.Contains(key)) monikers.Remove(key);
monikers.Add(key, moniker);
}
public virtual void Unadvise(uint dwCookie) {
eventSinks.RemoveAt(dwCookie);
}
public virtual int Update() {
return NativeMethods.S_OK;
}
public virtual void EnableModeless(int fEnable) {
}
public virtual void OnDocWindowActivate(int fActivate) {
}
public virtual void OnFrameWindowActivate(int fActivate) {
}
public virtual void ResizeBorder(RECT[] border, ref Guid iid, IOleInPlaceUIWindow window, int fFrameWindow) {
}
public virtual void ContextSensitiveHelp(int fEnterHelp) {
}
public virtual void GetWindow(out IntPtr hwnd) {
hwnd = IntPtr.Zero;
}
public virtual void InPlaceDeactivate() {
}
public virtual void ReactivateAndUndo() {
}
public virtual void SetObjectRects(RECT[] posRect, RECT[] clipRect) {
}
public virtual void UIDeactivate() {
}
public virtual int FQueryClose(int fPromptUser) {
return 0;
}
public virtual int GetCntrContextMenu(uint dwRoleActiveObject, ref Guid clsidActiveObject, int nMenuIdActiveObject, POINTS[] pos, out Guid clsidCntr, OLEMENUID[] menuid, out uint pgrf) {
clsidCntr = Guid.Empty;
pgrf = 0;
return NativeMethods.S_OK;
}
public virtual int GetCntrHelp(ref uint pdwRole, ref Guid pclsid, POINT posMouse, uint dwHelpCmd, string pszHelpFileIn, out string pwsHelpFileOut, uint dwDataIn, out uint dwDataOut) {
pwsHelpFileOut = pszHelpFileIn;
dwDataOut = dwDataIn;
return NativeMethods.S_OK;
}
public virtual int GetCntrMessage(ref uint pdwRolw, ref Guid clsid, string titleIn, string textIn, string helpFileIn, out string titleOut, out string textOut, out string helpFileOut, ref uint dwHelpContextId, OLEMSGBUTTON[] msgbutton, OLEMSGDEFBUTTON[] msgdefbutton, OLEMSGICON[] msgicon, ref int sysAlert) {
titleOut = titleIn;
textOut = textIn;
helpFileOut = helpFileIn;
return NativeMethods.S_OK;
}
void IOleInPlaceComponent.OnEnterState(uint dwStateId, int fEnter) {
((IOleComponent)this).OnEnterState(dwStateId, fEnter);
}
public virtual int OnWindowActivate(uint windowType, int fActivate) {
return NativeMethods.S_OK;
}
public virtual int TranslateCntrAccelerator(MSG[] msg) {
return NativeMethods.S_OK;
}
public virtual int UseComponentUIManager(uint dwCompRole, out uint pgrfCompFlags, IOleComponentUIManager pCompUIMgr, IOleInPlaceComponentSite pIPCompSite) {
pgrfCompFlags = 0;
this.pCompUIMgr = pCompUIMgr;
this.pIPCompSite = pIPCompSite;
return NativeMethods.S_OK;
}
}
#endif
/// <summary>
/// This class wraps a managed WinForm control and uses that as the editor window.
/// </summary>
......
......@@ -88,7 +88,6 @@
<Compile Include="DocumentProperties.cs" />
<Compile Include="DocumentTask.cs" />
<Compile Include="EditArray.cs" />
<Compile Include="EditorFactory.cs" />
<Compile Include="EditorView.cs" />
<Compile Include="ExpansionProvider.cs" />
<Compile Include="ExternDll.cs" />
......
......@@ -58,7 +58,7 @@ public abstract class LanguageService : IDisposable, IVsLanguageInfo, IVsLanguag
IObjectWithSite, IVsDebuggerEvents,
IVsFormatFilterProvider,
ILanguageServiceTestHelper
{ //, IVsOutliningCapableLanguage {
{
private IServiceProvider site;
private ArrayList codeWindowManagers;
......@@ -1024,14 +1024,6 @@ public void SetSite(object site)
this.lcid = pkg.GetProviderLocale();
}
#if IVsOutliningCapableLanguage
public virtual void CollapseToDefinitions(IVsTextLines buffer, IVsOutliningSession session) {
Source source = this.GetSource(buffer);
source.CollapseAllHiddenRegions(session);
}
#endif
public virtual int OnModeChange(DBGMODE dbgmodeNew)
{
this.dbgMode = dbgmodeNew;
......
......@@ -216,14 +216,6 @@ public static IntPtr SetWindowLong(IntPtr hWnd, short nIndex, IntPtr dwNewLong)
[DllImport("shell32.dll", EntryPoint = "DragQueryFileW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern uint DragQueryFile(IntPtr hDrop, uint iFile, char[] lpszFile, uint cch);
///////////// UNUSED
#if false
[DllImport(ExternDll.Oleaut32, PreserveSig=false)]
public static extern UCOMITypeLib LoadRegTypeLib(ref Guid clsid, int majorVersion, int minorVersion, int lcid);
#endif
}
}
......@@ -1933,65 +1933,6 @@ module FSharpIntellisenseProvider =
member x.Name = filename
#if UNUSED
module Setup =
/// This attribute adds a intellisense provider for a specific language
/// type.
/// For Example:
/// [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0Exp\Languages\IntellisenseProviders\
/// [Custom_Provider]
///
[<AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)>]
type ProvideIntellisenseProviderAttribute(provider:Type, providerName:string, addItemLanguageName:string, defaultExtension:string, shortLanguageName:string, templateFolderName:string) =
inherit RegistrationAttribute()
let mutable additionalExtensions : Option<string> = None
/// Private function to get the provider base key name
let providerRegKey() = String.Format(CultureInfo.InvariantCulture, @"Languages\IntellisenseProviders\{0}", [| box providerName |])
/// Gets the Type of the intellisense provider.
member x.Provider = provider
/// Get the Guid representing the generator type
member x.ProviderGuid = provider.GUID
/// Get the ProviderName
member x.ProviderName = providerName
/// Get item language
member x.AddItemLanguageName = addItemLanguageName
/// Get the Default extension
member x.DefaultExtension = defaultExtension
/// Get the short language name
member x.ShortLanguageName = shortLanguageName
/// Get the tempalte folder name
member x.TemplateFolderName = templateFolderName
/// Get/Set Additional extensions
member x.AdditionalExtensions
with get() = additionalExtensions
and set v = additionalExtensions <- Some(v)
/// Called to register this attribute with the given context. The context
/// contains the location where the registration inforomation should be placed.
/// It also contains other information such as the type being registered and path information.
override x.Register(context:RegistrationAttribute.RegistrationContext) =
Check.ArgumentNotNull context "context"
use childKey = context.CreateKey(providerRegKey())
let mutable providerGuid = provider.GUID
childKey.SetValue("GUID", providerGuid.ToString("B"))
childKey.SetValue("AddItemLanguageName", addItemLanguageName)
childKey.SetValue("DefaultExtension", defaultExtension)
childKey.SetValue("ShortLanguageName", shortLanguageName)
childKey.SetValue("TemplateFolderName", templateFolderName)
match additionalExtensions with
| None | Some "" -> ()
| Some(s) -> childKey.SetValue("AdditionalExtensions", s)
/// <summary>
/// Unregister this file extension.
/// </summary>
/// <param name="context"></param>
override x.Unregister(context:RegistrationAttribute.RegistrationContext) =
if (null <> context) then
context.RemoveKey(providerRegKey())
#endif
// Workaround to access non-public settings persistence type.
// GetService( ) with this will work as long as the GUID matches the real type.
[<Guid("9B164E40-C3A2-4363-9BC5-EB4039DEF653")>]
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if UNUSED_NESTED_PROJECTS
using System;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Shell;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Collections;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Reflection;
using IServiceProvider = System.IServiceProvider;
using Microsoft.VisualStudio.OLE.Interop;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.Fsharp.ProjectSystem;
namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
[SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")]
[ComVisible(true), CLSCompliant(false)]
public class OANestedProjectItem : OAProjectItem<NestedProjectNode>
{
EnvDTE.Project nestedProject = null;
internal OANestedProjectItem(OAProject project, NestedProjectNode node)
: base(project, node)
{
object nestedproject = null;
if (ErrorHandler.Succeeded(node.NestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out nestedproject)))
{
this.nestedProject = nestedproject as EnvDTE.Project;
}
}
/// <summary>
/// Returns the collection of project items defined in the nested project
/// </summary>
public override EnvDTE.ProjectItems ProjectItems
{
get
{
if (this.nestedProject != null)
{
return this.nestedProject.ProjectItems;
}
return null;
}
}
/// <summary>
/// Returns the nested project.
/// </summary>
public override EnvDTE.Project SubProject
{
get
{
return this.nestedProject;
}
}
}
}
#endif
......@@ -23,9 +23,6 @@ namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
public class OAProject : EnvDTE.Project, EnvDTE.ISupportVSProperties
{
private ProjectNode project;
#if UNUSED_NESTED_PROJECTS
Automation.OASolutionFolder<ProjectContainerNode> solutionFolder;
#endif
EnvDTE.ConfigurationManager configurationManager;
public ProjectNode Project
......@@ -36,13 +33,6 @@ public ProjectNode Project
internal OAProject(ProjectNode project)
{
this.project = project;
#if UNUSED_NESTED_PROJECTS
if (project is ProjectContainerNode)
{
this.solutionFolder = new Automation.OASolutionFolder<ProjectContainerNode>((ProjectContainerNode)project);
}
#endif
}
public virtual string Name
......
......@@ -255,12 +255,6 @@ public virtual EnvDTE.ProjectItem EvaluateAddResult(VSADDRESULT result, string p
{
item = new OAFileItem(this.Project, nodeAdded as FileNode);
}
#if UNUSED_NESTED_PROJECTS
else if (nodeAdded is NestedProjectNode)
{
item = new OANestedProjectItem(this.Project, nodeAdded as NestedProjectNode);
}
#endif
else
{
item = new OAProjectItem<HierarchyNode>(this.Project, nodeAdded);
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if UNUSED_NESTED_PROJECTS
using System;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Shell;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Collections;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Reflection;
using IServiceProvider = System.IServiceProvider;
using Microsoft.VisualStudio.OLE.Interop;
using System.Globalization;
using Microsoft.VisualStudio.FSharp.ProjectSystem;
namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
[ComVisible(true), CLSCompliant(false)]
public class OASolutionFolder<T> : EnvDTE80.SolutionFolder
where T : HierarchyNode
{
bool hidden = false;
T node;
internal OASolutionFolder(T associatedNode)
{
if (associatedNode == null)
{
throw new ArgumentNullException("associatedNode");
}
Debug.Assert(associatedNode.ProjectMgr is ProjectContainerNode, "Expecting obejct of type" + typeof(ProjectContainerNode).Name);
if (!(associatedNode.ProjectMgr is ProjectContainerNode))
throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "associatedNode");
this.node = associatedNode;
}
public virtual EnvDTE.Project AddFromFile(string fileName)
{
ProjectContainerNode projectContainer = (ProjectContainerNode)this.node.ProjectMgr;
ProjectElement newElement = new ProjectElement(projectContainer, fileName, ProjectFileConstants.SubProject);
NestedProjectNode newNode = projectContainer.AddExistingNestedProject(newElement, __VSCREATEPROJFLAGS.CPF_NOTINSLNEXPLR | __VSCREATEPROJFLAGS.CPF_SILENT | __VSCREATEPROJFLAGS.CPF_OPENFILE);
if (newNode == null)
return null;
// Now that the sub project was created, get its extensibility object so we can return it
object newProject = null;
if (ErrorHandler.Succeeded(newNode.NestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out newProject)))
return newProject as EnvDTE.Project;
else
return null;
}
public virtual EnvDTE.Project AddFromTemplate(string fileName, string destination, string projectName)
{
bool isVSTemplate = Utilities.IsTemplateFile(fileName);
NestedProjectNode newNode = null;
if (isVSTemplate)
{
// Get the wizard to run, we will get called again and use the alternate code path
ProjectElement newElement = new ProjectElement(this.node.ProjectMgr, System.IO.Path.Combine(destination, projectName), ProjectFileConstants.SubProject);
newElement.SetMetadata(ProjectFileConstants.Template, fileName);
((ProjectContainerNode)this.node.ProjectMgr).RunVsTemplateWizard(newElement, false);
}
else
{
if ((String.IsNullOrEmpty(System.IO.Path.GetExtension(projectName))))
{
string targetExtension = System.IO.Path.GetExtension(fileName);
projectName = System.IO.Path.ChangeExtension(projectName, targetExtension);
}
ProjectContainerNode projectContainer = (ProjectContainerNode)this.node.ProjectMgr;
newNode = projectContainer.AddNestedProjectFromTemplate(fileName, destination, projectName, null, __VSCREATEPROJFLAGS.CPF_NOTINSLNEXPLR | __VSCREATEPROJFLAGS.CPF_SILENT | __VSCREATEPROJFLAGS.CPF_CLONEFILE);
}
if (newNode == null)
return null;
// Now that the sub project was created, get its extensibility object so we can return it
object newProject = null;
if (ErrorHandler.Succeeded(newNode.NestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out newProject)))
return newProject as EnvDTE.Project;
else
return null;
}
public virtual EnvDTE.Project AddSolutionFolder(string Name)
{
throw new NotImplementedException();
}
public virtual EnvDTE.Project Parent
{
get
{
throw new NotImplementedException();
}
}
public virtual bool Hidden
{
get
{
return hidden;
}
set
{
hidden = value;
}
}
public virtual EnvDTE.DTE DTE
{
get
{
return (EnvDTE.DTE)this.node.ProjectMgr.Site.GetService(typeof(EnvDTE.DTE));
}
}
}
}
#endif
......@@ -49,9 +49,6 @@ public virtual DTE DTE
public virtual void RunCustomTool()
{
#if SINGLE_FILE_GENERATOR
this.FileNode.RunGenerator();
#endif
}
public FileNode FileNode
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if UNUSED_DEPENDENT_FILES
using System;
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Diagnostics;
using System.Globalization;
using System.Text;
using System.Threading;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.TextManager.Interop;
using OleConstants = Microsoft.VisualStudio.OLE.Interop.Constants;
using VsCommands = Microsoft.VisualStudio.VSConstants.VSStd97CmdID;
using VsCommands2K = Microsoft.VisualStudio.VSConstants.VSStd2KCmdID;
using MSBuild = Microsoft.Build.BuildEngine;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.VisualStudio.FSharp.ProjectSystem
{
/// <summary>
/// Defines the logic for all dependent file nodes (solution explorer icon, commands etc.)
/// </summary>
[CLSCompliant(false)]
[ComVisible(true)]
public class DependentFileNode : FileNode
{
/// <summary>
/// Defines if the node has a name relation to its parent node
/// e.g. Form1.ext and Form1.resx are name related (until first occurence of extention separator)
/// </summary>
public override int ImageIndex
{
get { return (this.CanShowDefaultIcon() ? (int)ProjectNode.ImageName.DependentFile : (int) ProjectNode.ImageName.MissingFile); }
}
/// <summary>
/// Constructor for the DependentFileNode
/// </summary>
/// <param name="root">Root of the hierarchy</param>
/// <param name="e">Associated project element</param>
internal DependentFileNode(ProjectNode root, ProjectElement element)
: base(root, element)
{
this.HasParentNodeNameRelation = false;
}
/// <summary>
/// Disable rename
/// </summary>
/// <param name="label">new label</param>
/// <returns>E_NOTIMPLE in order to tell the call that we do not support rename</returns>
public override string GetEditLabel()
{
throw new NotImplementedException();
}
/// <summary>
/// Gets a handle to the icon that should be set for this node
/// </summary>
/// <param name="open">Whether the folder is open, ignored here.</param>
/// <returns>Handle to icon for the node</returns>
public override object GetIconHandle(bool open)
{
return this.ProjectMgr.ImageHandler.GetIconHandle(this.ImageIndex);
}
/// <summary>
/// Disable certain commands for dependent file nodes
/// </summary>
public override int QueryStatusOnNode(Guid cmdGroup, uint cmd, IntPtr pCmdText, ref QueryStatusResult result)
{
if (cmdGroup == VsMenus.guidStandardCommandSet97)
{
switch ((VsCommands)cmd)
{
case VsCommands.Copy:
case VsCommands.Paste:
case VsCommands.Cut:
case VsCommands.Rename:
result |= QueryStatusResult.NOTSUPPORTED;
return VSConstants.S_OK;
case VsCommands.ViewCode:
case VsCommands.Open:
case VsCommands.OpenWith:
result |= QueryStatusResult.SUPPORTED | QueryStatusResult.ENABLED;
return VSConstants.S_OK;
}
}
else if (cmdGroup == VsMenus.guidStandardCommandSet2K)
{
if ((VsCommands2K)cmd == VsCommands2K.EXCLUDEFROMPROJECT)
{
result |= QueryStatusResult.NOTSUPPORTED;
return VSConstants.S_OK;
}
}
else
{
return (int)OleConstants.OLECMDERR_E_UNKNOWNGROUP;
}
return base.QueryStatusOnNode(cmdGroup, cmd, pCmdText, ref result);
}
/// <summary>
/// DependentFileNodes node cannot be dragged.
/// </summary>
/// <returns>null</returns>
public override StringBuilder PrepareSelectedNodesForClipBoard()
{
return null;
}
public override NodeProperties CreatePropertiesObject()
{
return new DependentFileNodeProperties(this);
}
/// <summary>
/// Redraws the state icon if the node is not excluded from source control.
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Scc")]
public override void UpdateSccStateIcons()
{
if (!this.ExcludeNodeFromScc)
{
this.Parent.ReDraw(UIHierarchyElement.SccState);
}
}
}
}
#endif
......@@ -212,13 +212,7 @@ internal FileNode(ProjectNode root, ProjectElement element, uint? hierarchyId =
public override NodeProperties CreatePropertiesObject()
{
#if SINGLE_FILE_GENERATOR
ISingleFileGenerator generator = this.CreateSingleFileGenerator();
return generator == null ? new FileNodeProperties(this) : new SingleFileGeneratorNodeProperties(this);
#else
return new FileNodeProperties(this);
#endif
}
public override object GetIconHandle(bool open)
......@@ -418,12 +412,7 @@ public int SetEditLabel(string label, string relativePath)
string oldrelPath = this.ItemNode.GetMetadata(ProjectFileConstants.Include);
RenameDocument(oldName, newName);
#if UNUSED_DEPENDENT_FILES
if (this is DependentFileNode)
{
OnInvalidateItems(this.Parent);
}
#endif
// Return S_FALSE if the hierarchy item id has changed. This forces VS to flush the stale
// hierarchy item id.
if (returnValue == (int)VSConstants.S_OK || returnValue == (int)VSConstants.S_FALSE || returnValue == VSConstants.OLE_E_PROMPTSAVECANCELLED)
......@@ -491,29 +480,6 @@ public override int ExecCommandOnNode(Guid cmdGroup, uint cmd, uint nCmdexecopt,
}
}
// Exec on special filenode commands
if (cmdGroup == VsMenus.guidStandardCommandSet2K)
{
#if SINGLE_FILE_GENERATOR
switch ((VsCommands2K)cmd)
{
case VsCommands2K.RUNCUSTOMTOOL:
{
try
{
this.RunGenerator();
return VSConstants.S_OK;
}
catch (Exception e)
{
Trace.WriteLine("Running Custom Tool failed : " + e.Message);
throw;
}
}
}
#endif
}
return base.ExecCommandOnNode(cmdGroup, cmd, nCmdexecopt, pvaIn, pvaOut);
}
......@@ -545,16 +511,6 @@ internal override int QueryStatusOnNode(Guid cmdGroup, uint cmd, IntPtr pCmdText
result |= QueryStatusResult.SUPPORTED | QueryStatusResult.ENABLED;
return VSConstants.S_OK;
}
#if SINGLE_FILE_GENERATOR
if ((VsCommands2K)cmd == VsCommands2K.RUNCUSTOMTOOL)
{
if (string.IsNullOrEmpty(this.ItemNode.GetMetadata(ProjectFileConstants.DependentUpon)) && (this.NodeProperties is SingleFileGeneratorNodeProperties))
{
result |= QueryStatusResult.SUPPORTED | QueryStatusResult.ENABLED;
return VSConstants.S_OK;
}
}
#endif
}
else
{
......@@ -930,17 +886,6 @@ public virtual void RenameInStorage(string oldName, string newName)
File.Move(oldName, newName);
}
#if SINGLE_FILE_GENERATOR
/// <summary>
/// factory method for creating single file generators.
/// </summary>
/// <returns></returns>
public virtual ISingleFileGenerator CreateSingleFileGenerator()
{
return new SingleFileGenerator(this.ProjectMgr);
}
#endif
/// <summary>
/// This method should be overridden to provide the list of special files and associated flags for source control.
/// </summary>
......@@ -1103,42 +1048,6 @@ private void RenameCaseOnlyChange(string newFileName)
uiWindow.ExpandItem(this.ProjectMgr.InteropSafeIVsUIHierarchy, this.ID, EXPANDFLAGS.EXPF_SelectItem);
}
#if SINGLE_FILE_GENERATOR
/// <summary>
/// Event handler for the Custom tool property changes
/// </summary>
/// <param name="sender">FileNode sending it</param>
/// <param name="e">Node event args</param>
internal virtual void OnCustomToolChanged(object sender, HierarchyNodeEventArgs e)
{
this.RunGenerator();
}
/// <summary>
/// Event handler for the Custom tool namespce property changes
/// </summary>
/// <param name="sender">FileNode sending it</param>
/// <param name="e">Node event args</param>
internal virtual void OnCustomToolNameSpaceChanged(object sender, HierarchyNodeEventArgs e)
{
this.RunGenerator();
}
#endif
#if SINGLE_FILE_GENERATOR
/// <summary>
/// Runs a generator.
/// </summary>
public void RunGenerator()
{
ISingleFileGenerator generator = this.CreateSingleFileGenerator();
if (generator != null)
{
generator.RunGenerator(this.Url);
}
}
#endif
/// <summary>
/// Update the ChildNodes after the parent node has been renamed
/// </summary>
......
......@@ -211,17 +211,6 @@ public override void GetSccSpecialFiles(string sccFile, IList<string> files, ILi
{
throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "sccFile");
}
// Get the file node for the file passed in.
FileNode node = this.FindChild(sccFile) as FileNode;
#if UNUSED_DEPENDENT_FILES
// Dependents do not participate directly in scc.
if (node != null && !(node is DependentFileNode))
{
node.GetSccSpecialFiles(sccFile, files, flags);
}
#endif
}
/// <summary>
......
......@@ -34,23 +34,11 @@
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.HierarchyNode.#Remove(System.Boolean)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.HierarchyNode.#SaveItem(Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS,System.String,System.UInt32,System.IntPtr,System.Int32&)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ImageHandler.#GetIconHandle(System.Int32)")]
#if UNUSED_NESTED_PROJECTS
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#Init(System.String,System.String,System.String,Microsoft.VisualStudio.Shell.Interop.__VSCREATEPROJFLAGS)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#IsItemDirty(System.UInt32,System.IntPtr,System.Int32&)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#LockRDTEntry()")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#RenameNestedProjectInParentProject(System.String)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#SaveItem(Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS,System.String,System.UInt32,System.IntPtr,System.Int32&)")]
#endif
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.OleServiceProvider.#QueryService(System.Guid&,System.Guid&,System.IntPtr&)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectConfig.#.ctor(Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectNode,System.String)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectConfig.#DebugLaunch(System.UInt32)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectConfig.#Microsoft.VisualStudio.Shell.Interop.IVsProjectFlavorCfg.get_CfgType(System.Guid&,System.IntPtr&)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectConfig.#SetConfigurationProperty(System.String,System.String)")]
#if UNUSED_NESTED_PROJECTS
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectContainerNode.#CloseChildren()")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectContainerNode.#GetNestedHierarchy(System.UInt32,System.Guid&,System.IntPtr&,System.UInt32&)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectContainerNode.#OpenChildren()")]
#endif
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectElement.#ItemName")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectElement.#SetMetadata(System.String,System.String)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectFactory.#CreateProject(System.String,System.String,System.String,System.UInt32,System.Guid&,System.IntPtr&,System.Int32&)")]
......@@ -139,27 +127,9 @@
[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.IDEBuildLogger.#ShutdownLogger()", MessageId = "")]
[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.IDEBuildLogger.#get_WarningString()", MessageId = "")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ImageHandler.#.ctor(System.Windows.Forms.ImageList)", MessageId = "")]
#if UNUSED_NESTED_PROJECTS
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#DelegateGetPropertyToNested(System.Int32)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsHierarchy.GetProperty(System.UInt32,System.Int32,System.Object@)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#GetIconHandle(System.Boolean)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsHierarchy.GetProperty(System.UInt32,System.Int32,System.Object@)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#Init(System.String,System.String,System.String,Microsoft.VisualStudio.Shell.Interop.__VSCREATEPROJFLAGS)", MessageId = "")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#InitializeInstanceGuid()", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsHierarchy.GetGuidProperty(System.UInt32,System.Int32,System.Guid@)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#InitializeInstanceGuid()", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsHierarchy.SetGuidProperty(System.UInt32,System.Int32,System.Guid@)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#InitImageHandler()", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsHierarchy.GetProperty(System.UInt32,System.Int32,System.Object@)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#OnChanged(System.Int32)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsProject3.GetMkDocument(System.UInt32,System.String@)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#SaveItem(Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS,System.String,System.UInt32,System.IntPtr,System.Int32&)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsUIShell.SaveDocDataToFile(Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS,System.Object,System.String,System.String@,System.Int32@)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode.#SetDocCookieOnNestedHier(System.UInt32)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsHierarchy.SetProperty(System.UInt32,System.Int32,System.Object)")]
#endif
[assembly: SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Scope = "type", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.OleServiceProvider+ServiceCreatorCallback", MessageId = "")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.OleServiceProvider+ServiceData.#.ctor(System.Type,System.Object,Microsoft.VisualStudio.FSharp.ProjectSystem.OleServiceProvider+ServiceCreatorCallback,System.Boolean)", MessageId = "")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectConfig.#IsFlavorDirty(Microsoft.VisualStudio.Shell.Interop._PersistStorageType)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IPersistXMLFragment.IsFragmentDirty(System.UInt32,System.Int32@)")]
#if UNUSED_NESTED_PROJECTS
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectContainerNode.#ReloadNestedProjectNode(Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsFireSolutionEvents.FireOnAfterLoadProject(Microsoft.VisualStudio.Shell.Interop.IVsHierarchy)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectContainerNode.#ReloadNestedProjectNode(Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsSolution.CloseSolutionElement(System.UInt32,Microsoft.VisualStudio.Shell.Interop.IVsHierarchy,System.UInt32)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectContainerNode.#ReloadNestedProjectNode(Microsoft.VisualStudio.FSharp.ProjectSystem.NestedProjectNode)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsSolution.GetProjectOfUniqueName(System.String,Microsoft.VisualStudio.Shell.Interop.IVsHierarchy@)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectContainerNode.#RunVsTemplateWizard(Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectElement,System.Boolean)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsDetermineWizardTrust.OnWizardCompleted")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectContainerNode.#RunVsTemplateWizard(Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectElement,System.Boolean)", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsDetermineWizardTrust.OnWizardInitiated(System.String,System.Guid@)")]
#endif
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.VisualStudio.Package.ProjectNode.#AddFolderFromOtherProject(System.String,Microsoft.VisualStudio.Package.HierarchyNode)", MessageId = "")]
[assembly: SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Scope = "member", Target = "Microsoft.VisualStudio.Package.ProjectNode.#AddItemWithSpecific(System.UInt32,Microsoft.VisualStudio.Shell.Interop.VSADDITEMOPERATION,System.String,System.UInt32,System.String[],System.IntPtr,System.UInt32,System.Guid&,System.String,System.Guid&,Microsoft.VisualStudio.Shell.Interop.VSADDRESULT[])", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsFileChangeEx.IgnoreFile(System.UInt32,System.String,System.Int32)")]
[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.VisualStudio.Package.ProjectNode.#AddReferenceCouldNotBeAddedErrorMessage(System.String)", MessageId = "")]
......
......@@ -37,9 +37,6 @@ namespace Microsoft.VisualStudio.FSharp.ProjectSystem
public abstract class HierarchyNode :
IVsUIHierarchy,
IVsPersistHierarchyItem,
#if IMPLEMENT_IVSPERSISTHIERARCHYITEM2
IVsPersistHierarchyItem2,
#endif
Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget,
IVsHierarchyDropDataSource2,
IVsHierarchyDropDataSource,
......@@ -2144,11 +2141,7 @@ public virtual void GetSccFiles(IList<string> files, IList<tagVsSccFilesFlags> f
files.Add(this.GetMkDocument());
#if UNUSED_DEPENDENT_FILES
tagVsSccFilesFlags flagsToAdd = (this.firstChild != null && (this.firstChild is DependentFileNode)) ? tagVsSccFilesFlags.SFF_HasSpecialFiles : tagVsSccFilesFlags.SFF_NoFlags;
#else
tagVsSccFilesFlags flagsToAdd = tagVsSccFilesFlags.SFF_NoFlags;
#endif
flags.Add(flagsToAdd);
}
......@@ -2187,36 +2180,6 @@ public virtual void DeleteFromStorage(string path)
{
}
#if IMPLEMENT_IVSPERSISTHIERARCHYITEM2
/// <summary>
/// Determines whether a file change should be ignored or not.
/// </summary>
/// <param name="ignoreFlag">Flag indicating whether or not to ignore changes (true to ignore changes).</param>
public virtual int IgnoreItemFileChanges(bool ignoreFlag)
{
return VSConstants.E_NOTIMPL;
}
/// <summary>
/// Called to determine whether a project item is reloadable.
/// </summary>
/// <returns>True if the project item is reloadable.</returns>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Reloadable")]
public virtual bool IsItemReloadable()
{
return false;
}
/// <summary>
/// Reloads an item.
/// </summary>
/// <param name="reserved">Reserved parameter defined at the IVsPersistHierarchyItem2::ReloadItem parameter.</param>
public virtual int ReloadItem(uint reserved)
{
return VSConstants.E_NOTIMPL;
}
#endif
/// <summary>
/// Handle the Copy operation to the clipboard
/// This method is typically overriden on the project node
......@@ -2876,84 +2839,6 @@ public virtual int SaveItem(VSSAVEFLAGS saveFlag, string silentSaveAsName, uint
return returnCode;
}
#if IMPLEMENT_IVSPERSISTHIERARCHYITEM2
/// <summary>
/// Flag indicating that changes to a file can be ignored when item is saved or reloaded.
/// </summary>
/// <param name="itemId">Specifies the item id from VSITEMID.</param>
/// <param name="ignoreFlag">Flag indicating whether or not to ignore changes (1 to ignore, 0 to stop ignoring).</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int IgnoreItemFileChanges(uint itemId, int ignoreFlag)
{
if (this.ProjectMgr == null || this.ProjectMgr.IsClosed)
{
return VSConstants.E_FAIL;
}
HierarchyNode n = this.ProjectMgr.NodeFromItemId(itemId);
if (n != null)
{
return n.IgnoreItemFileChanges(ignoreFlag == 0 ? false : true);
}
else
{
return VSConstants.E_INVALIDARG;
}
}
/// <summary>
/// Called to determine whether a project item is reloadable before calling ReloadItem.
/// </summary>
/// <param name="itemId">Item identifier of an item in the hierarchy. Valid values are VSITEMID_NIL, VSITEMID_ROOT and VSITEMID_SELECTION.</param>
/// <param name="isReloadable">A flag indicating that the project item is reloadable (1 for reloadable, 0 for non-reloadable).</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code. </returns>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Reloadable")]
public virtual int IsItemReloadable(uint itemId, out int isReloadable)
{
isReloadable = 0;
if (this.ProjectMgr == null || this.ProjectMgr.IsClosed)
{
return VSConstants.E_FAIL;
}
HierarchyNode n = this.ProjectMgr.NodeFromItemId(itemId);
if (n != null)
{
isReloadable = (n.IsItemReloadable()) ? 1 : 0;
return VSConstants.S_OK;
}
else
{
return VSConstants.E_INVALIDARG;
}
}
/// <summary>
/// Called to reload a project item.
/// </summary>
/// <param name="itemId">Specifies itemid from VSITEMID.</param>
/// <param name="reserved">Reserved.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code. </returns>
public virtual int ReloadItem(uint itemId, uint reserved)
{
if (this.ProjectMgr == null || this.ProjectMgr.IsClosed)
{
return VSConstants.E_FAIL;
}
HierarchyNode n = this.ProjectMgr.NodeFromItemId(itemId);
if (n != null)
{
return n.ReloadItem(reserved);
}
else
{
return VSConstants.E_INVALIDARG;
}
}
#endif
/// <summary>
/// CommandTarget.Exec is called for most major operations if they are NOT UI based. Otherwise IVSUInode::exec is called first
/// </summary>
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if UNUSED_NESTED_PROJECTS
using System;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System.Diagnostics;
using System.Globalization;
using System.Collections;
using System.IO;
namespace Microsoft.VisualStudio.FSharp.ProjectSystem
{
/// <summary>
/// Used for adding a build dependency to nested project (not a real project reference)
/// </summary>
internal class NestedProjectBuildDependency : IVsBuildDependency
{
IVsHierarchy dependentHierarchy = null;
[CLSCompliant(false)]
public NestedProjectBuildDependency(IVsHierarchy dependentHierarchy)
{
this.dependentHierarchy = dependentHierarchy;
}
public int get_CanonicalName(out string canonicalName)
{
canonicalName = null;
return VSConstants.S_OK;
}
public int get_Type(out System.Guid guidType)
{
// All our dependencies are build projects
guidType = VSConstants.GUID_VS_DEPTYPE_BUILD_PROJECT;
return VSConstants.S_OK;
}
public int get_Description(out string description)
{
description = null;
return VSConstants.S_OK;
}
[CLSCompliant(false)]
public int get_HelpContext(out uint helpContext)
{
helpContext = 0;
return VSConstants.E_NOTIMPL;
}
public int get_HelpFile(out string helpFile)
{
helpFile = null;
return VSConstants.E_NOTIMPL;
}
public int get_MustUpdateBefore(out int mustUpdateBefore)
{
// Must always update dependencies
mustUpdateBefore = 1;
return VSConstants.S_OK;
}
public int get_ReferredProject(out object unknownProject)
{
unknownProject = this.dependentHierarchy;
return (unknownProject == null) ? VSConstants.E_FAIL : VSConstants.S_OK;
}
}
}
#endif
......@@ -727,84 +727,6 @@ public override string GetClassName()
}
}
#if SINGLE_FILE_GENERATOR
[CLSCompliant(false), ComVisible(true)]
public class SingleFileGeneratorNodeProperties : FileNodeProperties
{
private EventHandler<HierarchyNodeEventArgs> onCustomToolChanged;
private EventHandler<HierarchyNodeEventArgs> onCustomToolNameSpaceChanged;
public string _customTool = "";
public string _customToolNamespace = "";
public event EventHandler<HierarchyNodeEventArgs> OnCustomToolChanged
{
add { onCustomToolChanged += value; }
remove { onCustomToolChanged -= value; }
}
public event EventHandler<HierarchyNodeEventArgs> OnCustomToolNameSpaceChanged
{
add { onCustomToolNameSpaceChanged += value; }
remove { onCustomToolNameSpaceChanged -= value; }
}
[SRCategoryAttribute(SR.Advanced)]
[LocDisplayName(SR.CustomTool)]
[SRDescriptionAttribute(SR.CustomToolDescription)]
public virtual string CustomTool
{
get
{
_customTool = this.Node.ItemNode.GetMetadata(ProjectFileConstants.Generator);
return _customTool;
}
set
{
_customTool = value;
if (!string.IsNullOrEmpty(_customTool))
{
this.Node.ItemNode.SetMetadata(ProjectFileConstants.Generator, _customTool);
HierarchyNodeEventArgs args = new HierarchyNodeEventArgs(this.Node);
if (onCustomToolChanged != null)
{
onCustomToolChanged(this.Node, args);
}
}
}
}
[SRCategoryAttribute(SR.Advanced)]
[LocDisplayName(SR.CustomToolNamespace)]
[SRDescriptionAttribute(SR.CustomToolNamespaceDescription)]
public virtual string CustomToolNamespace
{
get
{
_customToolNamespace = this.Node.ItemNode.GetMetadata(ProjectFileConstants.CustomToolNamespace);
return _customToolNamespace;
}
set
{
_customToolNamespace = value;
if (!string.IsNullOrEmpty(_customToolNamespace))
{
this.Node.ItemNode.SetMetadata(ProjectFileConstants.CustomToolNamespace, _customToolNamespace);
HierarchyNodeEventArgs args = new HierarchyNodeEventArgs(this.Node);
if (onCustomToolNameSpaceChanged != null)
{
onCustomToolNameSpaceChanged(this.Node, args);
}
}
}
}
internal SingleFileGeneratorNodeProperties(HierarchyNode node)
: base(node)
{
}
}
#endif
[CLSCompliant(false), ComVisible(true)]
public class ProjectNodeProperties : NodeProperties
, VSLangProj.ProjectProperties
......
......@@ -181,9 +181,6 @@ internal enum WrapperToolAttributeValue
internal static class DefaultSortOrderNode
{
public const int HierarchyNode = 1000;
#if UNUSED_NESTED_PROJECTS
public const int NestedProjectNode = 200;
#endif
public const int ReferenceContainerNode = 300;
}
......
......@@ -649,13 +649,6 @@ public enum EventTriggering
private Microsoft.Build.Framework.ILogger myDebugLogger;
private static readonly System.Runtime.Versioning.FrameworkName DefaultTargetFrameworkMoniker = new System.Runtime.Versioning.FrameworkName(".NETFramework", new Version(4, 0));
#if UNUSED
/// <summary>
/// Token processor used by the project sample.
/// </summary>
private TokenProcessor tokenProcessor = null;
#endif
/// <summary>
/// Member to store output base relative path. Used by OutputBaseRelativePath property
/// </summary>
......@@ -957,24 +950,6 @@ public bool CanFileNodesHaveChilds
}
}
#if UNUSED
/// <summary>
/// Get and set the Token processor.
/// </summary>
public TokenProcessor FileTemplateProcessor
{
get
{
if (tokenProcessor == null)
tokenProcessor = new TokenProcessor();
return tokenProcessor;
}
set
{
tokenProcessor = value;
}
}
#endif
public IVsHierarchy InteropSafeIVsHierarchy { get; protected set; }
public IVsUIHierarchy InteropSafeIVsUIHierarchy { get; protected set; }
public IVsProject InteropSafeIVsProject { get; protected set; }
......@@ -2265,52 +2240,6 @@ public virtual void OnOpenItem(string fullPathToSourceFile)
{
}
#if UNUSED_DEPENDENT_FILES
/// <summary>
/// This add methos adds the "key" item to the hierarchy, potentially adding other subitems in the process
/// This method may recurse if the parent is an other subitem
///
/// </summary>
/// <param name="subitems">List of subitems not yet added to the hierarchy</param>
/// <param name="key">Key to retrieve the target item from the subitems list</param>
/// <returns>Newly added node</returns>
/// <remarks>If the parent node was found we add the dependent item to it otherwise we add the item ignoring the "DependentUpon" metatdata</remarks>
public virtual HierarchyNode AddDependentFileNode(IDictionary<String, Microsoft.Build.Evaluation.ProjectItem> subitems, string key)
{
Microsoft.Build.Evaluation.ProjectItem item = subitems[key];
subitems.Remove(key);
HierarchyNode newNode;
HierarchyNode parent = null;
string dependentOf = MSBuildItem.GetMetadataValue(item, ProjectFileConstants.DependentUpon);
Debug.Assert(String.Compare(dependentOf, key, StringComparison.OrdinalIgnoreCase) != 0, "File dependent upon itself is not valid. Ignoring the DependentUpon metadata");
if (subitems.ContainsKey(dependentOf))
{
// The parent item is an other subitem, so recurse into this method to add the parent first
parent = AddDependentFileNode(subitems, dependentOf);
}
else
{
// See if the parent node already exist in the hierarchy
uint parentItemID;
string path = Path.Combine(this.ProjectFolder, dependentOf);
ErrorHandler.ThrowOnFailure(this.ParseCanonicalName(path, out parentItemID));
if (parentItemID != 0)
parent = this.NodeFromItemId(parentItemID);
Debug.Assert(parent != null, "File dependent upon a non existing item or circular dependency. Ignoring the DependentUpon metadata");
}
// If the parent node was found we add the dependent item to it otherwise we add the item ignoring the "DependentUpon" metatdata
if (parent != null)
newNode = this.AddDependentFileNodeToNode(item, parent);
else
newNode = this.AddIndependentFileNode(item);
return newNode;
}
#endif
/// <summary>
/// This is called from the main thread before the background build starts.
/// cleanBuild is not part of the vsopts, but passed down as the callpath is differently
......@@ -2765,29 +2694,6 @@ internal virtual LinkedFileNode CreateFileNode(string file, uint? newItemId = nu
return this.CreateFileNode(item, newItemId);
}
#if UNUSED_DEPENDENT_FILES
/// <summary>
/// Create dependent file node based on an msbuild item
/// </summary>
/// <param name="item">msbuild item</param>
/// <returns>dependent file node</returns>
public virtual DependentFileNode CreateDependentFileNode(ProjectElement item)
{
return new DependentFileNode(this, item);
}
/// <summary>
/// Create a dependent file node based on a string.
/// </summary>
/// <param name="file">filename of the new dependent file node</param>
/// <returns>Dependent node added</returns>
public virtual DependentFileNode CreateDependentFileNode(string file)
{
ProjectElement item = this.AddFileToMsBuild(file);
return this.CreateDependentFileNode(item);
}
#endif
/// <summary>
/// Return an absolute path that is normalized (e.g. no ".." portions)
/// </summary>
......@@ -2991,16 +2897,6 @@ public virtual IList<HierarchyNode> GetSelectedNodes()
selectedNodes.Add(node);
}
}
#if UNUSED_NESTED_PROJECTS
else
{
NestedProjectNode node = this.GetNestedProjectForHierarchy(hierarchy);
if (node != null)
{
selectedNodes.Add(node);
}
}
#endif
}
else if (multiItemSelect != null)
{
......@@ -3963,28 +3859,8 @@ public virtual HierarchyNode AddNewFileNodeToHierarchy(HierarchyNode parentNode,
private HierarchyNode AddNewFileNodeToHierarchyCore(HierarchyNode parentNode, string fileName, uint? newItemId = null)
{
HierarchyNode child;
#if UNUSED_DEPENDENT_FILES
// In the case of subitem, we want to create dependent file node
// and set the DependentUpon property
if (this.canFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode))
{
child = this.CreateDependentFileNode(fileName);
child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include));
// Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
if (!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
{
child.HasParentNodeNameRelation = true;
}
}
else
#endif
{
//Create and add new filenode to the project
child = this.CreateFileNode(fileName, newItemId);
}
//Create and add new filenode to the project
HierarchyNode child = this.CreateFileNode(fileName, newItemId);
parentNode.AddChild(child);
......@@ -4240,34 +4116,7 @@ public virtual void ProcessFilesAndFolders()
subitems.Add(MSBuildItem.GetEvaluatedInclude(item), item);
}
}
#if UNUSED_DEPENDENT_FILES
// Now process the dependent items.
if (this.CanFileNodesHaveChilds)
{
ProcessDependentFileNodes(subitemsKeys, subitems);
}
#endif
}
#if UNUSED_DEPENDENT_FILES
/// <summary>
/// Processes dependent filenodes from list of subitems. Multi level supported, but not circular dependencies.
/// </summary>
/// <param name="subitemsKeys">List of sub item keys </param>
/// <param name="subitems"></param>
public virtual void ProcessDependentFileNodes(List<String> subitemsKeys, Dictionary<String, Microsoft.Build.Evaluation.ProjectItem> subitems)
{
foreach (string key in subitemsKeys)
{
// A previous pass could have removed the key so make sure it still needs to be added
if (!subitems.ContainsKey(key))
continue;
AddDependentFileNode(subitems, key);
}
}
#endif
/// <summary>
/// For flavored projects which implement IPersistXMLFragment, load the information now
......@@ -4626,36 +4475,6 @@ internal bool QueryEditProjectFile(bool suppressUI)
return result;
}
#if UNUSED_NESTED_PROJECTS
/// <summary>
/// Checks whether a hierarchy is a nested project.
/// </summary>
/// <param name="hierarchy"></param>
/// <returns></returns>
public NestedProjectNode GetNestedProjectForHierarchy(IVsHierarchy hierarchy)
{
if (hierarchy != null && (hierarchy is IVsProject3))
{
IVsProject3 project = hierarchy as IVsProject3;
string mkDocument = String.Empty;
project.GetMkDocument(VSConstants.VSITEMID_ROOT, out mkDocument);
if (!String.IsNullOrEmpty(mkDocument))
{
HierarchyNode node = this.FindChild(mkDocument);
if (node != null && (node is NestedProjectNode))
{
return node as NestedProjectNode;
}
}
}
return null;
}
#endif
/// <summary>
/// Given a node determines what is the directory that can accept files.
/// If the node is a FoldeNode than it is the Url of the Folder.
......@@ -6470,28 +6289,6 @@ private HierarchyNode AddIndependentFileNode(Microsoft.Build.Evaluation.ProjectI
return node;
}
#if UNUSED_DEPENDENT_FILES
/// <summary>
/// Add a dependent file node to the hierarchy
/// </summary>
/// <param name="item">msbuild item to add</param>
/// <param name="parentNode">Parent Node</param>
/// <returns>Added node</returns>
private HierarchyNode AddDependentFileNodeToNode(Microsoft.Build.Evaluation.ProjectItem item, HierarchyNode parentNode)
{
FileNode node = this.CreateDependentFileNode(new ProjectElement(this, item, false));
parentNode.AddChild(node);
// Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
if (!node.HasParentNodeNameRelation && string.Compare(node.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
{
node.HasParentNodeNameRelation = true;
}
return node;
}
#endif
/// <summary>
/// Add a file node to the hierarchy
/// </summary>
......
......@@ -45,9 +45,6 @@ protected override void Initialize()
// Subscribe to the solution events
this.solutionListeners.Add(new SolutionListenerForProjectReferenceUpdate(this));
this.solutionListeners.Add(new SolutionListenerForProjectOpen(this));
#if UNUSED_NESTED_PROJECTS
this.solutionListeners.Add(new SolutionListenerForBuildDependencyUpdate(this));
#endif
this.solutionListeners.Add(new SolutionListenerForProjectEvents(this));
foreach (SolutionListener solutionListener in this.solutionListeners)
......
......@@ -76,12 +76,9 @@
<Reference Include="Microsoft.VisualStudio.Designer.Interfaces" />
<Reference Include="Microsoft.VisualStudio.VSHelp.dll" />
<Compile Include="InternalsVisibleTo.cs" />
<Compile Include="..\RegistrationAttributes\WebSiteProjectAttribute.cs" />
<Compile Include="..\RegistrationAttributes\WebSiteProjectRelatedFilesAttribute.cs" />
<Compile Include="..\RegistrationAttributes\WAProvideLanguagePropertyAttribute.cs" />
<Compile Include="..\RegistrationAttributes\WAProvideProjectFactoryAttribute.cs" />
<Compile Include="..\RegistrationAttributes\WAProvideProjectFactoryTemplateMappingAttribute.cs" />
<Compile Include="..\RegistrationAttributes\SingleFileGeneratorSupportRegistrationAttribute.cs" />
<Compile Include="Misc\ConnectionPointContainer.cs" />
<Compile Include="Misc\ExternDll.cs" />
<Compile Include="Misc\NativeMethods.cs" />
......@@ -95,7 +92,6 @@
<!-- Automation Objects -->
<Compile Include="Automation\OAFileItem.cs" />
<Compile Include="Automation\OAFolderItem.cs" />
<Compile Include="Automation\OANestedProjectItem.cs" />
<Compile Include="Automation\OANullProperty.cs" />
<Compile Include="Automation\OAProject.cs" />
<Compile Include="Automation\OAProjectItem.cs" />
......@@ -105,7 +101,6 @@
<Compile Include="Automation\OANavigableProjectItems.cs" />
<Compile Include="Automation\OAReferenceFolderItem.cs" />
<Compile Include="Automation\OAReferenceItem.cs" />
<Compile Include="Automation\OASolutionFolder.cs" />
<!-- Objects needed to implement a Language Project -->
<Compile Include="Automation\VSProject\OAAssemblyReference.cs" />
......@@ -128,7 +123,6 @@
<Compile Include="FileChangeManager.cs" />
<Compile Include="FileDocumentManager.cs" />
<Compile Include="FileNode.cs" />
<Compile Include="DependentFileNode.cs" />
<Compile Include="FolderNode.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="HierarchyNode.cs" />
......@@ -139,14 +133,11 @@
<Compile Include="LinkedFileNode.cs" />
<Compile Include="LocalizableProperties.cs" />
<Compile Include="Microsoft.VisualStudio.Package.Project.cs" />
<Compile Include="NestedProjectBuildDependency.cs" />
<Compile Include="NestedProjectNode.cs" />
<Compile Include="NodeProperties.cs" />
<Compile Include="OleServiceProvider.cs" />
<Compile Include="Output.cs" />
<Compile Include="OutputGroup.cs" />
<Compile Include="ProjectConfig.cs" />
<Compile Include="ProjectContainerNode.cs"/>
<Compile Include="ProjectDesignerDocumentManager.cs" />
<Compile Include="ProjectElement.cs" />
<Compile Include="ProjectFactory.cs" />
......@@ -160,21 +151,15 @@
<Compile Include="PropertiesEditorLauncher.cs" />
<Compile Include="ReferenceContainerNode.cs" />
<Compile Include="ReferenceNode.cs" />
<Compile Include="RegisteredProjectType.cs" />
<Compile Include="SingleFileGenerator.cs" />
<Compile Include="SingleFileGeneratorFactory.cs" />
<Compile Include="SolutionListener.cs" />
<Compile Include="SolutionListenerForBuildDependencyUpdate.cs" />
<Compile Include="SolutionListenerForProjectEvents.cs" />
<Compile Include="SolutionListenerForProjectOpen.cs" />
<Compile Include="SolutionListenerForProjectReferenceUpdate.cs" />
<Compile Include="StructuresEnums.cs" />
<Compile Include="SuspendFileChanges.cs" />
<Compile Include="Tracing.cs" />
<Compile Include="TokenProcessor.cs" />
<Compile Include="TrackDocumentsHelper.cs" />
<Compile Include="TypeConverters.cs" />
<Compile Include="Url.cs" />
<Compile Include="Utilities.cs" />
<Compile Include="VsCommands.cs" />
<Compile Include="VSMDCodeDomProvider.cs" />
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if UNUSED_NESTED_PROJECTS
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using Microsoft.Win32;
using Microsoft.VisualStudio.Shell.Interop;
using VSRegistry = Microsoft.VisualStudio.Shell.VSRegistry;
namespace Microsoft.VisualStudio.FSharp.ProjectSystem
{
/// <summary>
/// Gets registry settings from for a project.
/// </summary>
internal class RegisteredProjectType
{
private string defaultProjectExtension;
private string projectTemplatesDir;
private string wizardTemplatesDir;
private Guid packageGuid;
public const string DefaultProjectExtension = "DefaultProjectExtension";
public const string WizardsTemplatesDir = "WizardsTemplatesDir";
public const string ProjectTemplatesDir = "ProjectTemplatesDir";
public const string Package = "Package";
public string DefaultProjectExtensionValue
{
get
{
return this.defaultProjectExtension;
}
set
{
this.defaultProjectExtension = value;
}
}
public string ProjectTemplatesDirValue
{
get
{
return this.projectTemplatesDir;
}
set
{
this.projectTemplatesDir = value;
}
}
public string WizardTemplatesDirValue
{
get
{
return this.wizardTemplatesDir;
}
set
{
this.wizardTemplatesDir = value;
}
}
public Guid PackageGuidValue
{
get
{
return this.packageGuid;
}
set
{
this.packageGuid = value;
}
}
/// <summary>
/// If the project support VsTemplates, returns the path to
/// the vstemplate file corresponding to the requested template
///
/// You can pass in a string such as: "Windows\Console Application"
/// </summary>
public string GetVsTemplateFile(string templateFile)
{
// First see if this use the vstemplate model
if (!String.IsNullOrEmpty(DefaultProjectExtensionValue))
{
EnvDTE80.DTE2 dte = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2;
if (dte != null)
{
EnvDTE80.Solution2 solution = dte.Solution as EnvDTE80.Solution2;
if (solution != null)
{
string fullPath = solution.GetProjectTemplate(templateFile, DefaultProjectExtensionValue);
// The path returned by GetProjectTemplate can be in the format "path|FrameworkVersion=x.y|Language=xxx"
// where the framework version and language sections are optional.
// Here we are interested only in the full path, so we have to remove all the other sections.
int pipePos = fullPath.IndexOf('|');
if (0 == pipePos)
{
return null;
}
if (pipePos > 0)
{
fullPath = fullPath.Substring(0, pipePos);
}
return fullPath;
}
}
}
return null;
}
public static RegisteredProjectType CreateRegisteredProjectType(Guid projectTypeGuid)
{
RegisteredProjectType registederedProjectType = null;
using (RegistryKey rootKey = VSRegistry.RegistryRoot(__VsLocalRegistryType.RegType_Configuration))
{
if (rootKey == null)
{
return null;
}
string projectPath = "Projects\\" + projectTypeGuid.ToString("B");
using (RegistryKey projectKey = rootKey.OpenSubKey(projectPath))
{
if (projectKey == null)
{
return null;
}
registederedProjectType = new RegisteredProjectType();
registederedProjectType.DefaultProjectExtensionValue = projectKey.GetValue(DefaultProjectExtension) as string;
registederedProjectType.ProjectTemplatesDirValue = projectKey.GetValue(ProjectTemplatesDir) as string;
registederedProjectType.WizardTemplatesDirValue = projectKey.GetValue(WizardsTemplatesDir) as string;
registederedProjectType.PackageGuidValue = new Guid(projectKey.GetValue(Package) as string);
}
}
return registederedProjectType;
}
}
}
#endif
\ No newline at end of file
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if UNUSED_NESTED_PROJECTS
using Microsoft.VisualStudio.Shell.Interop;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Security;
using System.Windows;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Collections;
using System.Text;
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
using IServiceProvider = System.IServiceProvider;
using ShellConstants = Microsoft.VisualStudio.Shell.Interop.Constants;
using OleConstants = Microsoft.VisualStudio.OLE.Interop.Constants;
namespace Microsoft.VisualStudio.FSharp.ProjectSystem
{
/// <summary>
/// The purpose of this class is to set a build dependency from a modeling project to all its sub projects
/// </summary>
internal class SolutionListenerForBuildDependencyUpdate : SolutionListener
{
public SolutionListenerForBuildDependencyUpdate(IServiceProvider serviceProvider) : base(serviceProvider)
{
}
/// <summary>
/// Update build dependency list if solution is fully loaded
/// </summary>
/// <param name="hierarchy"></param>
/// <param name="added"></param>
/// <returns></returns>
public override int OnAfterOpenProject(IVsHierarchy hierarchy, int added)
{
// Return from here if we are at load time
if (added == 0)
{
return VSConstants.S_OK;
}
IBuildDependencyOnProjectContainer projectNode = hierarchy as IBuildDependencyOnProjectContainer;
// We will update only nested project types and the BuildNestedProjectsOnBuild flag is set to true
if (projectNode != null)
{
if (projectNode.BuildNestedProjectsOnBuild)
{
// Enum all sub projects and add to dependency list
UpdateDependencyListWithSubProjects(projectNode);
}
}
return VSConstants.S_OK;
}
/// <summary>
/// Called at load time when solution has finished opening.
/// </summary>
/// <param name="pUnkReserved">reserved</param>
/// <param name="fNewSolution">true if this is a new solution</param>
/// <returns></returns>
public override int OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
{
// Enum all sub project and add to dependeny list
UpdateDependencyListWithSubProjects(null);
return VSConstants.S_OK;
}
/// <summary>
/// Update dependency list
/// </summary>
/// <param name="projectNode">Project node to be updated. If null then all ProjectContainer nodes are updated</param>
private void UpdateDependencyListWithSubProjects(IBuildDependencyOnProjectContainer projectNode)
{
if (projectNode != null)
{
// Get list of sub projects
IList<IVsHierarchy> nestedProjectList = projectNode.EnumNestedHierachiesForBuildDependency();
if (nestedProjectList != null && nestedProjectList.Count > 0)
{
// Loop nested projects and add project dependency (if supported)
foreach (IVsHierarchy nestedProject in nestedProjectList)
{
AddBuildDependenyToNestedProject(projectNode as IBuildDependencyUpdate, nestedProject);
}
}
}
else
{
// Update all ProjectContainerNode nodes
List<IBuildDependencyOnProjectContainer> projectList = this.GetListOfProjectContainerNodes();
if (projectList != null && projectList.Count > 0)
{
foreach (IBuildDependencyOnProjectContainer project in projectList)
{
UpdateDependencyListWithSubProjects(project);
}
}
}
}
/// <summary>
/// Enum all projects in the solution and collect all that derives from ProjectContainerNode
/// </summary>
/// <returns>List of ProjectContainerNode nodes</returns>
private List<IBuildDependencyOnProjectContainer> GetListOfProjectContainerNodes()
{
List<IBuildDependencyOnProjectContainer> projectList = new List<IBuildDependencyOnProjectContainer>();
Debug.Assert(this.Solution != null, "IVsSolution object not set on this object");
if (this.Solution == null)
{
// Bad state, so we quit
return projectList;
}
// Enum projects loaded in the solution (normal projects only)
IEnumHierarchies enumHierarchies = null;
Guid guid = Guid.Empty;
__VSENUMPROJFLAGS flags = __VSENUMPROJFLAGS.EPF_LOADEDINSOLUTION;
ErrorHandler.ThrowOnFailure(this.Solution.GetProjectEnum((uint)flags, ref guid, out enumHierarchies));
if (enumHierarchies != null)
{
// Loop projects found
IVsHierarchy[] hierarchy = new IVsHierarchy[1];
uint fetched = 0;
while (enumHierarchies.Next(1, hierarchy, out fetched) == VSConstants.S_OK && fetched == 1)
{
// If this is a ProjectContainerNode then add to list
IBuildDependencyOnProjectContainer projectNode = hierarchy[0] as IBuildDependencyOnProjectContainer;
if (projectNode != null)
{
projectList.Add(projectNode);
}
}
}
return projectList;
}
/// <summary>
/// Add build dependency to ProjectContainerNode if IVsBuildDependency is supported by the nested project
/// </summary>
/// <param name="projectContainer">Project Container where we should add the build dependency</param>
/// <param name="nestedProject">Nested project to set a build dependency against</param>
private void AddBuildDependenyToNestedProject(IBuildDependencyUpdate projectContainer, IVsHierarchy nestedProject)
{
// Validate input
Debug.Assert(projectContainer != null, "Project Container must not be null");
Debug.Assert(nestedProject != null, "Nested Project must not be null");
if (projectContainer == null || nestedProject == null)
{
// Invalid argument
return;
}
// Create new NestedProjectBuildDependency
NestedProjectBuildDependency dependency = new NestedProjectBuildDependency(nestedProject);
projectContainer.AddBuildDependency(dependency);
}
}
}
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册