Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 3013e87

Browse files
author
tbulle
committed
Revert "Merge branch 'master' of github.com:gumme/SharpDevelop"
This reverts commit 2b55aeb, reversing changes made to 6f7ebb5.
1 parent 2b55aeb commit 3013e87

9 files changed

Lines changed: 569 additions & 0 deletions
17.9 KB
Binary file not shown.
177 KB
Binary file not shown.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
// software and associated documentation files (the "Software"), to deal in the Software
5+
// without restriction, including without limitation the rights to use, copy, modify, merge,
6+
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7+
// to whom the Software is furnished to do so, subject to the following conditions:
8+
//
9+
// The above copyright notice and this permission notice shall be included in all copies or
10+
// substantial portions of the Software.
11+
//
12+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14+
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15+
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17+
// DEALINGS IN THE SOFTWARE.
18+
19+
using System;
20+
using System.Collections.Generic;
21+
using NuGet;
22+
23+
namespace ICSharpCode.PackageManagement
24+
{
25+
public class InstalledPackageViewModel : PackageViewModel
26+
{
27+
public InstalledPackageViewModel(
28+
IPackageViewModelParent parent,
29+
IPackageFromRepository package,
30+
SelectedProjectsForInstalledPackages selectedProjects,
31+
IPackageManagementEvents packageManagementEvents,
32+
IPackageActionRunner actionRunner,
33+
ILogger logger)
34+
: base(parent, package, selectedProjects, packageManagementEvents, actionRunner, logger)
35+
{
36+
}
37+
38+
public override IList<ProcessPackageAction> GetProcessPackageActionsForSelectedProjects(
39+
IList<IPackageManagementSelectedProject> selectedProjects)
40+
{
41+
var actions = new List<ProcessPackageAction>();
42+
foreach (IPackageManagementSelectedProject selectedProject in selectedProjects) {
43+
ProcessPackageAction action = CreatePackageAction(selectedProject);
44+
if (action != null) {
45+
actions.Add(action);
46+
}
47+
}
48+
return actions;
49+
}
50+
51+
ProcessPackageAction CreatePackageAction(IPackageManagementSelectedProject selectedProject)
52+
{
53+
if (selectedProject.IsSelected) {
54+
return base.CreateInstallPackageAction(selectedProject);
55+
}
56+
return CreateUninstallPackageActionForSelectedProject(selectedProject);
57+
}
58+
59+
ProcessPackageAction CreateUninstallPackageActionForSelectedProject(IPackageManagementSelectedProject selectedProject)
60+
{
61+
ProcessPackageAction action = base.CreateUninstallPackageAction(selectedProject);
62+
if (IsPackageInstalled(action.Project)) {
63+
return action;
64+
}
65+
return null;
66+
}
67+
68+
bool IsPackageInstalled(IPackageManagementProject project)
69+
{
70+
IPackage package = GetPackage();
71+
return project.IsPackageInstalled(package);
72+
}
73+
74+
protected override bool AnyProjectsSelected(IList<IPackageManagementSelectedProject> projects)
75+
{
76+
return true;
77+
}
78+
}
79+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
// software and associated documentation files (the "Software"), to deal in the Software
5+
// without restriction, including without limitation the rights to use, copy, modify, merge,
6+
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7+
// to whom the Software is furnished to do so, subject to the following conditions:
8+
//
9+
// The above copyright notice and this permission notice shall be included in all copies or
10+
// substantial portions of the Software.
11+
//
12+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14+
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15+
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17+
// DEALINGS IN THE SOFTWARE.
18+
19+
using System;
20+
using System.Collections.Generic;
21+
using NuGet;
22+
23+
namespace ICSharpCode.PackageManagement
24+
{
25+
/// <summary>
26+
/// Supports a configurable set of package repositories for project templates that can be
27+
/// different to the registered package repositories used with the Add Package Reference dialog.
28+
/// </summary>
29+
public class ProjectTemplatePackageRepositoryCache : IPackageRepositoryCache
30+
{
31+
IPackageRepositoryCache packageRepositoryCache;
32+
RegisteredProjectTemplatePackageSources registeredPackageSources;
33+
34+
/// <summary>
35+
/// Creates a new instance of the ProjectTemplatePackageRepositoryCache.
36+
/// </summary>
37+
/// <param name="packageRepositoryCache">The main package repository cache used
38+
/// with the Add Package Reference dialog.</param>
39+
public ProjectTemplatePackageRepositoryCache(
40+
IPackageRepositoryCache packageRepositoryCache,
41+
RegisteredProjectTemplatePackageSources registeredPackageSources)
42+
{
43+
this.packageRepositoryCache = packageRepositoryCache;
44+
this.registeredPackageSources = registeredPackageSources;
45+
}
46+
47+
public IRecentPackageRepository RecentPackageRepository {
48+
get { throw new NotImplementedException(); }
49+
}
50+
51+
public IPackageRepository CreateAggregateRepository()
52+
{
53+
IEnumerable<IPackageRepository> repositories = GetRegisteredPackageRepositories();
54+
return CreateAggregateRepository(repositories);
55+
}
56+
57+
IEnumerable<IPackageRepository> GetRegisteredPackageRepositories()
58+
{
59+
foreach (PackageSource packageSource in GetEnabledPackageSources()) {
60+
yield return CreateRepository(packageSource.Source);
61+
}
62+
}
63+
64+
public IEnumerable<PackageSource> GetEnabledPackageSources()
65+
{
66+
return registeredPackageSources.PackageSources.GetEnabledPackageSources();
67+
}
68+
69+
public ISharedPackageRepository CreateSharedRepository(IPackagePathResolver pathResolver, IFileSystem fileSystem, IFileSystem configSettingsFileSystem)
70+
{
71+
throw new NotImplementedException();
72+
}
73+
74+
public IRecentPackageRepository CreateRecentPackageRepository(IList<RecentPackageInfo> recentPackages, IPackageRepository aggregateRepository)
75+
{
76+
throw new NotImplementedException();
77+
}
78+
79+
public IPackageRepository CreateAggregateRepository(IEnumerable<IPackageRepository> repositories)
80+
{
81+
return packageRepositoryCache.CreateAggregateRepository(repositories);
82+
}
83+
84+
public IPackageRepository CreateRepository(string packageSource)
85+
{
86+
return packageRepositoryCache.CreateRepository(packageSource);
87+
}
88+
}
89+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
// software and associated documentation files (the "Software"), to deal in the Software
5+
// without restriction, including without limitation the rights to use, copy, modify, merge,
6+
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7+
// to whom the Software is furnished to do so, subject to the following conditions:
8+
//
9+
// The above copyright notice and this permission notice shall be included in all copies or
10+
// substantial portions of the Software.
11+
//
12+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14+
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15+
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17+
// DEALINGS IN THE SOFTWARE.
18+
19+
using System;
20+
using System.Collections.Generic;
21+
using NuGet;
22+
23+
namespace ICSharpCode.PackageManagement
24+
{
25+
public class RegisteredProjectTemplatePackageSources
26+
{
27+
RegisteredPackageSourceSettings registeredPackageSourceSettings;
28+
29+
public RegisteredProjectTemplatePackageSources()
30+
: this(new PackageManagementPropertyService(), new SettingsFactory())
31+
{
32+
}
33+
34+
public RegisteredProjectTemplatePackageSources(
35+
IPropertyService propertyService,
36+
ISettingsFactory settingsFactory)
37+
{
38+
GetRegisteredPackageSources(propertyService, settingsFactory);
39+
}
40+
41+
void GetRegisteredPackageSources(IPropertyService propertyService, ISettingsFactory settingsFactory)
42+
{
43+
ISettings settings = CreateSettings(propertyService, settingsFactory);
44+
PackageSource defaultPackageSource = CreateDefaultPackageSource(propertyService);
45+
registeredPackageSourceSettings = new RegisteredPackageSourceSettings(settings, defaultPackageSource);
46+
}
47+
48+
ISettings CreateSettings(IPropertyService propertyService, ISettingsFactory settingsFactory)
49+
{
50+
var settingsFileName = new ProjectTemplatePackagesSettingsFileName(propertyService);
51+
return settingsFactory.CreateSettings(settingsFileName.Directory);
52+
}
53+
54+
PackageSource CreateDefaultPackageSource(IPropertyService propertyService)
55+
{
56+
var defaultPackageSource = new DefaultProjectTemplatePackageSource(propertyService);
57+
return defaultPackageSource.PackageSource;
58+
}
59+
60+
public RegisteredPackageSources PackageSources {
61+
get { return registeredPackageSourceSettings.PackageSources; }
62+
}
63+
}
64+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<gui:OptionPanel
2+
x:Class="ICSharpCode.PackageManagement.RegisteredProjectTemplatePackageSourcesView"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
xmlns:pm="clr-namespace:ICSharpCode.PackageManagement"
8+
xmlns:pmd="clr-namespace:ICSharpCode.PackageManagement.Design"
9+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
10+
mc:Ignorable="d"
11+
d:DesignHeight="300"
12+
d:DesignWidth="300"
13+
Height="300">
14+
15+
<Grid x:Name="MainGrid">
16+
<Grid.Resources>
17+
<pm:PackageManagementViewModels x:Key="ViewModels"/>
18+
</Grid.Resources>
19+
20+
<Grid.DataContext>
21+
<Binding Source="{StaticResource ViewModels}" Path="RegisteredProjectTemplatePackageSourcesViewModel"/>
22+
</Grid.DataContext>
23+
24+
<pm:RegisteredPackageSourcesUserControl/>
25+
</Grid>
26+
</gui:OptionPanel>
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
// software and associated documentation files (the "Software"), to deal in the Software
5+
// without restriction, including without limitation the rights to use, copy, modify, merge,
6+
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7+
// to whom the Software is furnished to do so, subject to the following conditions:
8+
//
9+
// The above copyright notice and this permission notice shall be included in all copies or
10+
// substantial portions of the Software.
11+
//
12+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14+
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15+
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17+
// DEALINGS IN THE SOFTWARE.
18+
19+
//using System;
20+
//using System.Collections.Generic;
21+
//using ICSharpCode.NRefactory.Ast;
22+
//using ICSharpCode.SharpDevelop.Dom.Refactoring;
23+
//using NUnit.Framework;
24+
//
25+
//namespace PackageManagement.Tests
26+
//{
27+
// [TestFixture]
28+
// public class CodeGeneratorTests
29+
// {
30+
// CSharpCodeGenerator codeGenerator;
31+
//
32+
// void CreateCodeGenerator()
33+
// {
34+
// codeGenerator = new CSharpCodeGenerator();
35+
// }
36+
//
37+
// [Test]
38+
// public void GenerateCode_Field_CreatesField()
39+
// {
40+
// CreateCodeGenerator();
41+
// var field = new FieldDeclaration(new List<AttributeSection>());
42+
// field.TypeReference = new TypeReference("MyClass");
43+
// field.Modifier = Modifiers.Public;
44+
// field.Fields.Add(new VariableDeclaration("myField"));
45+
//
46+
// string code = codeGenerator.GenerateCode(field, String.Empty);
47+
//
48+
// string expectedCode = "public MyClass myField;\r\n";
49+
//
50+
// Assert.AreEqual(expectedCode, code);
51+
// }
52+
//
53+
// [Test]
54+
// public void GenerateCode_Method_CreatesMethod()
55+
// {
56+
// CreateCodeGenerator();
57+
// var method = new MethodDeclaration();
58+
// method.Name = "MyMethod";
59+
// method.TypeReference = new TypeReference("MyReturnType");
60+
// method.Modifier = Modifiers.Public;
61+
// method.Body = new BlockStatement();
62+
//
63+
// string code = codeGenerator.GenerateCode(method, String.Empty);
64+
//
65+
// string expectedCode =
66+
// "public MyReturnType MyMethod()\r\n" +
67+
// "{\r\n" +
68+
// "}\r\n";
69+
//
70+
// Assert.AreEqual(expectedCode, code);
71+
// }
72+
//
73+
// [Test]
74+
// public void GenerateCode_InterfaceMethodDeclaration_CreatesMethod()
75+
// {
76+
// CreateCodeGenerator();
77+
// var method = new MethodDeclaration();
78+
// method.Name = "MyMethod";
79+
// method.TypeReference = new TypeReference("MyReturnType");
80+
//
81+
// string code = codeGenerator.GenerateCode(method, String.Empty);
82+
//
83+
// string expectedCode = "MyReturnType MyMethod();\r\n";
84+
//
85+
// Assert.AreEqual(expectedCode, code);
86+
// }
87+
// }
88+
//}

0 commit comments

Comments
 (0)