Browse Source

Add svcutil.exe path configuration to Tools - Options.

pull/6/merge
Matt Ward 14 years ago
parent
commit
7edecd46ba
  1. 3
      src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
  2. 6
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  3. 22
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptions.cs
  4. 32
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel..xaml
  5. 63
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel..xaml.cs
  6. 26
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilPath.cs
  7. 2
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilRunner.cs

3
src/Main/Base/Project/ICSharpCode.SharpDevelop.addin

@ -1237,6 +1237,9 @@ @@ -1237,6 +1237,9 @@
<OptionPanel id = "ExternalTools"
label = "${res:Dialog.Options.ExternalToolsText}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.ExternalToolPane"/>
<OptionPanel id = "ServiceReferences"
label = "Service References"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference.ServiceReferenceOptionsPanel"/>
</OptionPanel>
</Path>

6
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -291,6 +291,11 @@ @@ -291,6 +291,11 @@
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceMapFileName.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceMapFileProjectItem.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceMapGenerator.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptions.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptionsPanel..xaml.cs">
<DependentUpon>ServiceReferenceOptionsPanel..xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceProxyGenerator.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceUrlHistory.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\SvcUtilCommandLine.cs" />
@ -888,6 +893,7 @@ @@ -888,6 +893,7 @@
</Page>
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\AddServiceReferenceDialog.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\AdvancedServiceDialog.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptionsPanel..xaml" />
<Page Include="Src\Services\RefactoringService\ContextActions\ContextActionsBulbControl.xaml" />
<Page Include="Src\Services\RefactoringService\ContextActions\ContextActionsControl.xaml" />
<Page Include="Src\Services\RefactoringService\ContextActions\ContextActionsHeaderedControl.xaml" />

22
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptions.cs

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference
{
public static class ServiceReferenceOptions
{
static Properties properties = PropertyService.Get("ServiceReferenceOptions", new Properties());
public static bool HasSvcUtilPath {
get { return !String.IsNullOrEmpty(SvcUtilPath); }
}
public static string SvcUtilPath {
get { return properties.Get<string>("SvcUtilPath", null); }
set { properties.Set("SvcUtilPath", value); }
}
}
}

32
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel..xaml

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
<gui:OptionPanel
x:Class="ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference.ServiceReferenceOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:sd="clr-namespace:ICSharpCode.SharpDevelop"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels">
<StackPanel>
<GroupBox Header="SvcUtil Configuration">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Content="Path:"/>
<TextBox
Grid.Column="1"
Text="{Binding SvcUtilPath}"/>
<Button
Grid.Column="2"
Content="..."
Command="{Binding BrowseCommand}"
Padding="4, 0"
Margin="4,0"/>
</Grid>
</GroupBox>
</StackPanel>
</gui:OptionPanel>

63
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel..xaml.cs

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.ComponentModel;
using System.Windows.Input;
using ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference;
using ICSharpCode.SharpDevelop.Widgets;
using Microsoft.Win32;
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference
{
public partial class ServiceReferenceOptionsPanel : OptionPanel, INotifyPropertyChanged
{
string svcUtilPath;
bool changed;
public ServiceReferenceOptionsPanel()
{
InitializeComponent();
BrowseCommand = new RelayCommand(Browse);
svcUtilPath = ServiceReferenceOptions.SvcUtilPath;
DataContext = this;
}
public ICommand BrowseCommand { get; private set; }
void Browse()
{
var dialog = new OpenFileDialog();
if (dialog.ShowDialog() ?? false) {
SvcUtilPath = dialog.FileName;
}
}
public string SvcUtilPath {
get { return svcUtilPath; }
set {
svcUtilPath = value;
changed = true;
OnPropertyChanged("SvcUtilPath");
}
}
public override bool SaveOptions()
{
if (changed) {
ServiceReferenceOptions.SvcUtilPath = svcUtilPath;
}
return true;
}
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged(string name)
{
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}
}

26
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilPath.cs

@ -9,7 +9,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference @@ -9,7 +9,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference
{
public class SvcUtilPath
{
string fileName = "svcutil.exe";
string svcUtilFileName = "svcutil.exe";
bool exists = true;
public SvcUtilPath()
@ -22,6 +22,23 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference @@ -22,6 +22,23 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference
}
void FindSvcUtil()
{
if (ServiceReferenceOptions.HasSvcUtilPath) {
SetSvcUtilPathIfFileExists(ServiceReferenceOptions.SvcUtilPath);
} else {
FindSvcUtilFromSdk();
}
}
void SetSvcUtilPathIfFileExists(string fileName)
{
exists = File.Exists(fileName);
if (exists) {
svcUtilFileName = fileName;
}
}
void FindSvcUtilFromSdk()
{
string sdkPath = TryGetCurrentUserSdkInstallPath();
if (sdkPath == null) {
@ -29,10 +46,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference @@ -29,10 +46,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference
}
if (sdkPath != null) {
string fullPath = Path.Combine(sdkPath, @"bin\NETFX 4.0 Tools\svcutil.exe");
exists = File.Exists(fullPath);
if (exists) {
fileName = fullPath;
}
SetSvcUtilPathIfFileExists(fullPath);
}
}
@ -57,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference @@ -57,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference
}
public string FileName {
get { return fileName; }
get { return svcUtilFileName; }
}
}
}

2
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilRunner.cs

@ -38,7 +38,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference @@ -38,7 +38,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference
void DisplaySvcUtilNotFoundMessage()
{
string message =
"Unable to find svcutil.exe. Please install the Windows SDK";
"Unable to find svcutil.exe. Please install the Windows SDK or specify the path to svcutil in Tools | Options.";
SvcUtilMessageView.AppendLine(message);
}

Loading…
Cancel
Save