Browse Source

Remove weird extension method that was only used in a single place.

pull/520/merge
Daniel Grunwald 12 years ago
parent
commit
6c0d5d2561
  1. 9
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/ToolboxProvider.cs
  2. 11
      src/Main/Base/Project/Util/SharpDevelopExtensions.cs

9
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/ToolboxProvider.cs

@ -136,6 +136,13 @@ namespace ICSharpCode.FormsDesigner
toolboxService.SetSelectedToolboxItem(null); toolboxService.SetSelectedToolboxItem(null);
} }
static ICompilation GetCompilationForCurrentProject()
{
IProject project = SD.ProjectService.CurrentProject;
if (project == null) return null;
return SD.ParserService.GetCompilation(project);
}
static void SelectedToolUsedHandler(object sender, EventArgs e) static void SelectedToolUsedHandler(object sender, EventArgs e)
{ {
SD.Log.Debug("SelectedToolUsedHandler"); SD.Log.Debug("SelectedToolUsedHandler");
@ -148,7 +155,7 @@ namespace ICSharpCode.FormsDesigner
if (selectedItem != null && selectedItem.TypeName != null) { if (selectedItem != null && selectedItem.TypeName != null) {
SD.Log.Debug("Checking for reference to CustomComponent: " + selectedItem.TypeName); SD.Log.Debug("Checking for reference to CustomComponent: " + selectedItem.TypeName);
// Check current project has the custom component first. // Check current project has the custom component first.
ICompilation currentCompilation = SD.ParserService.GetCompilationForCurrentProject(); ICompilation currentCompilation = GetCompilationForCurrentProject();
var typeName = new FullTypeName(selectedItem.TypeName); var typeName = new FullTypeName(selectedItem.TypeName);
if (currentCompilation != null && currentCompilation.FindType(typeName).Kind == TypeKind.Unknown) { if (currentCompilation != null && currentCompilation.FindType(typeName).Kind == TypeKind.Unknown) {
// Check other projects in the solution. // Check other projects in the solution.

11
src/Main/Base/Project/Util/SharpDevelopExtensions.cs

@ -902,17 +902,6 @@ namespace ICSharpCode.SharpDevelop
} }
#endregion #endregion
#region Service Extensions
public static ICompilation GetCompilationForCurrentProject(this IParserService svc)
{
if (svc == null)
throw new ArgumentNullException("svc");
IProject project = SD.ProjectService.CurrentProject;
if (project == null) return null;
return SD.ParserService.GetCompilation(project);
}
#endregion
#region Resource Service Extensions #region Resource Service Extensions
/// <summary> /// <summary>
/// Gets an <see cref="IImage"/> from a resource. /// Gets an <see cref="IImage"/> from a resource.

Loading…
Cancel
Save