diff --git a/src/Test/Utilities/Portable/Traits/Traits.cs b/src/Test/Utilities/Portable/Traits/Traits.cs
index b5da3351f74003707e76ff862fa96f59069b1fbf..825427ccff253cd67c56985f5735bce5b1d44034 100644
--- a/src/Test/Utilities/Portable/Traits/Traits.cs
+++ b/src/Test/Utilities/Portable/Traits/Traits.cs
@@ -111,6 +111,7 @@ public static class Features
public const string CodeActionsMergeConsecutiveIfStatements = "CodeActions.MergeConsecutiveIfStatements";
public const string CodeActionsMergeNestedIfStatements = "CodeActions.MergeNestedIfStatements";
public const string CodeActionsMoveDeclarationNearReference = "CodeActions.MoveDeclarationNearReference";
+ public const string CodeActionsMoveToNamespace = nameof(CodeActionsMoveToNamespace);
public const string CodeActionsMoveToTopOfFile = "CodeActions.MoveToTopOfFile";
public const string CodeActionsMoveType = "CodeActions.MoveType";
public const string CodeActionsOrderModifiers = "CodeActions.OrderModifiers";
diff --git a/src/VisualStudio/Core/Def/Implementation/MoveToNamespace/MoveToNamespaceDialogViewModel.cs b/src/VisualStudio/Core/Def/Implementation/MoveToNamespace/MoveToNamespaceDialogViewModel.cs
index 8122e452b986a9f6e815b2dbed19a1161d0b0561..f8af7c48aab2519efd3905b297c52384bc335e23 100644
--- a/src/VisualStudio/Core/Def/Implementation/MoveToNamespace/MoveToNamespaceDialogViewModel.cs
+++ b/src/VisualStudio/Core/Def/Implementation/MoveToNamespace/MoveToNamespaceDialogViewModel.cs
@@ -2,10 +2,8 @@
using System.Collections.Immutable;
using Microsoft.VisualStudio.Imaging.Interop;
-using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
using Microsoft.VisualStudio.Imaging;
-using Microsoft.CodeAnalysis.MoveToNamespace;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.MoveToNamespace
@@ -19,7 +17,7 @@ class MoveToNamespaceDialogViewModel : AbstractNotifyPropertyChanged
NamespaceName = defaultNamespace;
AvailableNamespaces = availableNamespaces;
- this.PropertyChanged += MoveToNamespaceDialogViewModel_PropertyChanged;
+ PropertyChanged += MoveToNamespaceDialogViewModel_PropertyChanged;
}
private void MoveToNamespaceDialogViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
@@ -40,14 +38,14 @@ public void OnNamespaceUpdated()
if (isNewNamespace && isValidName)
{
Icon = KnownMonikers.StatusInformation;
- Message = $"'{NamespaceName}' will be created as a new namespace";
+ Message = string.Format(ServicesVSResources._0_will_be_created_as_a_new_namespace, NamespaceName);
ShowMessage = true;
CanSubmit = true;
}
else if (!isValidName)
{
Icon = KnownMonikers.StatusInvalid;
- Message = $"'{NamespaceName}' is not a valid namespace";
+ Message = string.Format(ServicesVSResources._0_is_an_invalid_namespace, NamespaceName);
ShowMessage = true;
CanSubmit = false;
}
diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs b/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
index b8300fe79b359d3c568619958df25891e7d79acd..31adcece4262110eb76911267b909cfde9983075 100644
--- a/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
+++ b/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
@@ -69,6 +69,15 @@ internal class ServicesVSResources {
}
}
+ ///
+ /// Looks up a localized string similar to '{0}' is an invalid namespace.
+ ///
+ internal static string _0_is_an_invalid_namespace {
+ get {
+ return ResourceManager.GetString("_0_is_an_invalid_namespace", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to {0} references.
///
@@ -116,6 +125,15 @@ internal class ServicesVSResources {
}
}
+ ///
+ /// Looks up a localized string similar to '{0}' will be created as a new namespace.
+ ///
+ internal static string _0_will_be_created_as_a_new_namespace {
+ get {
+ return ResourceManager.GetString("_0_will_be_created_as_a_new_namespace", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to 1 reference.
///
diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx
index b618538e0199b6e7d711c85353f2e96858524607..5160fc606879c05317d80a3dc228438e05ff5639 100644
--- a/src/VisualStudio/Core/Def/ServicesVSResources.resx
+++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx
@@ -1210,4 +1210,10 @@ I agree to all of the foregoing:
Target Namespace:
+
+ '{0}' is an invalid namespace
+
+
+ '{0}' will be created as a new namespace
+
\ No newline at end of file
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf
index ef74d6d871469c96e8235cd0d5e73067204c60c8..c35b49af7fbc4a15bd1970aaee87fbce359e5d82 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf
@@ -432,6 +432,11 @@
Není platnou hodnotou.
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.{0} se změní na abstraktní.
@@ -447,6 +452,11 @@
{0} se změní na veřejný.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undoDaný pracovní prostor nepodporuje vrácení akce zpátky.
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf
index d89163769e22a30404fd3db8a1845409a41367c1..a4f80320fd95f68179ddaded8df0187240019294 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf
@@ -432,6 +432,11 @@
Kein gültiger Wert.
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract."{0}" wird in abstrakten Wert geändert.
@@ -447,6 +452,11 @@
"{0}" wird in öffentlichen Wert geändert.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undoDer angegebene Arbeitsbereich unterstützt die Funktion "Rückgängig" nicht.
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf
index a652e4b35018ab8b64385c9bc4acffbe877e1965..f15db8ca380872f7a2b4c2e08041ffc5107416ce 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf
@@ -432,6 +432,11 @@
No es un valor válido
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract."{0}" se cambiará a abstracto.
@@ -447,6 +452,11 @@
"{0}" se cambiará a público.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undoel área de trabajo determinada no permite deshacer
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf
index abf2fe93cf3483bb95ccf54457722cd965b236ad..5b445603aa033fd53d070a57e2ecf4d8415bbe98 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf
@@ -432,6 +432,11 @@
Valeur non valide
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.'{0}' va être changé en valeur abstraite.
@@ -447,6 +452,11 @@
'{0}' va être changé en valeur publique.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undol'espace de travail donné ne prend pas en charge la fonction Annuler
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf
index 465712bde78f46cf84560cf32aa7fe111e72a739..279183b57bb7a36c3461393073d1d4a8d6d74e91 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf
@@ -432,6 +432,11 @@
Valore non valido
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.'{0}' verrà modificato in astratto.
@@ -447,6 +452,11 @@
'{0}' verrà modificato in pubblico.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undol'area di lavoro specificata non supporta l'annullamento di operazioni
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf
index 8a8662ae9799c52471bca284a6ce51b50b18a1dc..a2d16066e17f2039312993fbaf453122b0cc0464 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf
@@ -432,6 +432,11 @@
有効な値ではありません
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.'{0}' は抽象に変更されます。
@@ -447,6 +452,11 @@
'{0}' はパブリックに変更されます。
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undo指定されたワークスペースは元に戻す操作をサポートしていません
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf
index a10677dbf8e46d41060d6c6d132cb50be65ca172..ca6c472486d9c561838aeaef4ee2e45a4b2375ab 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf
@@ -432,6 +432,11 @@
값이 잘못되었습니다.
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.'{0}'이(가) 추상으로 변경됩니다.
@@ -447,6 +452,11 @@
'{0}'이(가) 공용으로 변경됩니다.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undo지정한 작업 영역에서 실행을 취소할 수 없습니다.
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf
index 0c4276963f18ce86257434aa7444b058439bff74..37fdf14d496180333607a4e2ce539ab8e3837b27 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf
@@ -432,6 +432,11 @@
Nieprawidłowa wartość
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.Element „{0}” zostanie zmieniony na abstrakcyjny.
@@ -447,6 +452,11 @@
Element „{0}” zostanie zmieniony na publiczny.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undodany obszar roboczy nie obsługuje operacji cofania
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf
index 488824871709254c13357fc892294fc5b943836a..86c7d49e82ba3d225e9046e01f753efe10f7dbb6 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf
@@ -432,6 +432,11 @@
O valor não é válido
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.'{0}' será alterado para abstrato.
@@ -447,6 +452,11 @@
'{0}' será alterado para público.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undoo workspace fornecido não dá suporte a desfazer
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf
index e8e733afbaed36f25e82afdf8f0df9316fe4e285..370521bce904f6547645ddcd954f22d09dd00f62 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf
@@ -432,6 +432,11 @@
Недопустимое значение
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.Элемент "{0}" будет изменен на абстрактный.
@@ -447,6 +452,11 @@
Элемент "{0}" будет изменен на открытый.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undoзаданная рабочая область не поддерживает отмену.
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf
index 444f04bd48cac0f50ce701110505296d6fb6df1d..691978322ea425ec247b1b7f4c8e7cc8a02e7535 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf
@@ -432,6 +432,11 @@
Geçerli bir değer değil
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.'{0}' soyut olacak şekilde değiştirildi.
@@ -447,6 +452,11 @@
'{0}' ortak olacak şekilde değiştirildi.
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undosağlanan çalışma alanı, geri almayı desteklemiyor
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf
index 9198b7bb785a00e4b37777ef328c4e9079ff26e9..804e954cbd0a9ed2dba730048639d90b88b20906 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf
@@ -432,6 +432,11 @@
值无效
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.“{0}”将更改为“抽象”。
@@ -447,6 +452,11 @@
“{0}”将更改为“公共”。
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undo给定的工作区不支持撤消
diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf
index 2d50cb1ee8e8987fb8956568b6a225912b370e9d..302adca52a741ce2394cf1700581a35c4cb48676 100644
--- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf
+++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf
@@ -432,6 +432,11 @@
值無效
+
+ '{0}' is an invalid namespace
+ '{0}' is an invalid namespace
+
+ '{0}' will be changed to abstract.'{0}' 會變更為抽象。
@@ -447,6 +452,11 @@
'{0}' 會變更為公用。
+
+ '{0}' will be created as a new namespace
+ '{0}' will be created as a new namespace
+
+ given workspace doesn't support undo指定的工作區不支援復原
diff --git a/src/VisualStudio/Core/Test/MoveToNamespace/MoveToNamespaceDialogViewModelTests.vb b/src/VisualStudio/Core/Test/MoveToNamespace/MoveToNamespaceDialogViewModelTests.vb
new file mode 100644
index 0000000000000000000000000000000000000000..da66ee2f416dea81aad3b7ed5103c2f70f029ee4
--- /dev/null
+++ b/src/VisualStudio/Core/Test/MoveToNamespace/MoveToNamespaceDialogViewModelTests.vb
@@ -0,0 +1,66 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports Microsoft.CodeAnalysis.Test.Utilities
+Imports Microsoft.VisualStudio.Imaging
+Imports Microsoft.VisualStudio.LanguageServices.Implementation.MoveToNamespace
+
+Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.MoveToNamespace
+
+ <[UseExportProvider]>
+ Public Class MoveToNamespaceDialogViewModelTests
+
+ Public Sub TestMoveToNamespace_ErrorState()
+ Dim viewModel = CreateViewModel()
+
+ Assert.True(viewModel.CanSubmit)
+ Assert.False(viewModel.ShowMessage)
+
+ viewModel.NamespaceName = "2InvalidNamespace"
+
+ Assert.False(viewModel.CanSubmit)
+ Assert.True(viewModel.ShowMessage)
+ Assert.Equal(viewModel.Icon, KnownMonikers.StatusInvalid)
+
+ viewModel.NamespaceName = viewModel.AvailableNamespaces.First()
+
+ Assert.True(viewModel.CanSubmit)
+ Assert.False(viewModel.ShowMessage)
+ End Sub
+
+
+ Public Sub TestMoveToNamespace_NewNamespaceState()
+ Dim viewModel = CreateViewModel()
+
+ Assert.True(viewModel.CanSubmit)
+ Assert.False(viewModel.ShowMessage)
+
+ viewModel.NamespaceName = viewModel.AvailableNamespaces.Last() & ".NewNamespace"
+
+ Assert.True(viewModel.CanSubmit)
+ Assert.True(viewModel.ShowMessage)
+ Assert.Equal(viewModel.Icon, KnownMonikers.StatusInformation)
+
+ viewModel.NamespaceName = viewModel.AvailableNamespaces.First()
+
+ Assert.True(viewModel.CanSubmit)
+ Assert.False(viewModel.ShowMessage)
+ End Sub
+
+ Private Function CreateViewModel(Optional defaultNamespace As String = Nothing, Optional availableNamespaces As ImmutableArray(Of String) = Nothing) As MoveToNamespaceDialogViewModel
+ If (defaultNamespace Is Nothing) Then
+ defaultNamespace = "Default.Namespace"
+ End If
+
+ If (availableNamespaces = Nothing) Then
+ availableNamespaces = ImmutableArray.Create({
+ defaultNamespace,
+ defaultNamespace & "1",
+ defaultNamespace & "2"})
+ End If
+
+ Return New MoveToNamespaceDialogViewModel(defaultNamespace, availableNamespaces)
+ End Function
+ End Class
+End Namespace
+