14 changed files with 164 additions and 224 deletions
@ -1,80 +0,0 @@
@@ -1,80 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using NuGet; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public class InstalledPackageViewModel : PackageViewModel |
||||
{ |
||||
public InstalledPackageViewModel( |
||||
IPackageViewModelParent parent, |
||||
IPackageFromRepository package, |
||||
SelectedProjectsForInstalledPackages selectedProjects, |
||||
IPackageManagementEvents packageManagementEvents, |
||||
IPackageActionRunner actionRunner, |
||||
ILogger logger) |
||||
: base(parent, package, selectedProjects, packageManagementEvents, actionRunner, logger) |
||||
{ |
||||
} |
||||
|
||||
public override IList<ProcessPackageAction> GetProcessPackageActionsForSelectedProjects( |
||||
IList<IPackageManagementSelectedProject> selectedProjects) |
||||
{ |
||||
var actions = new List<ProcessPackageAction>(); |
||||
foreach (IPackageManagementSelectedProject selectedProject in selectedProjects) { |
||||
ProcessPackageAction action = CreatePackageAction(selectedProject); |
||||
if (action != null) { |
||||
actions.Add(action); |
||||
} |
||||
} |
||||
return actions; |
||||
} |
||||
|
||||
ProcessPackageAction CreatePackageAction(IPackageManagementSelectedProject selectedProject) |
||||
{ |
||||
if (selectedProject.IsSelected) { |
||||
return base.CreateInstallPackageAction(selectedProject); |
||||
} |
||||
return CreateUninstallPackageActionForSelectedProject(selectedProject); |
||||
} |
||||
|
||||
ProcessPackageAction CreateUninstallPackageActionForSelectedProject(IPackageManagementSelectedProject selectedProject) |
||||
{ |
||||
ProcessPackageAction action = base.CreateUninstallPackageAction(selectedProject); |
||||
if (IsPackageInstalled(action.Project)) { |
||||
return action; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
bool IsPackageInstalled(IPackageManagementProject project) |
||||
{ |
||||
IPackage package = GetPackage(); |
||||
return project.IsPackageInstalled(package) || PackageManagementServices.Solution.IsPackageInstalled(package); |
||||
|
||||
} |
||||
|
||||
protected override bool AnyProjectsSelected(IList<IPackageManagementSelectedProject> projects) |
||||
{ |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
@ -1,44 +0,0 @@
@@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public class InstalledPackageViewModelFactory : PackageViewModelFactory |
||||
{ |
||||
SelectedProjectsForInstalledPackages selectedProjectsForInstalledPackages; |
||||
|
||||
public InstalledPackageViewModelFactory(IPackageViewModelFactory packageViewModelFactory) |
||||
: base(packageViewModelFactory) |
||||
{ |
||||
selectedProjectsForInstalledPackages = new SelectedProjectsForInstalledPackages(Solution); |
||||
} |
||||
|
||||
public override PackageViewModel CreatePackageViewModel(IPackageViewModelParent parent, IPackageFromRepository package) |
||||
{ |
||||
return new InstalledPackageViewModel( |
||||
parent, |
||||
package, |
||||
selectedProjectsForInstalledPackages, |
||||
PackageManagementEvents, |
||||
PackageActionRunner, |
||||
Logger); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue