Skip to content

Commit 181ce08

Browse files
authored
Merge branch 'next' into next
2 parents 80a6a79 + 35efce2 commit 181ce08

22 files changed

+1677
-903
lines changed

RetailCoder.VBE/App.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public sealed class App : IDisposable
3434
private IRubberduckHooks _hooks;
3535
private bool _handleSinkEvents = true;
3636
private readonly BranchesViewViewModel _branchesVM;
37-
private readonly SourceControlViewViewModel _panelVM;
37+
private readonly SourceControlViewViewModel _sourceControlPanelVM;
3838

3939
private readonly Logger _logger;
4040

@@ -68,11 +68,11 @@ public App(VBE vbe, IMessageBox messageBox,
6868
_logger = LogManager.GetCurrentClassLogger();
6969

7070
var sourceControlPanel = (SourceControlPanel) sourceControlPresenter.Window();
71-
_panelVM = (SourceControlViewViewModel) sourceControlPanel.ViewModel;
72-
_branchesVM = (BranchesViewViewModel) _panelVM.TabItems.Single(t => t.ViewModel.Tab == SourceControlTab.Branches).ViewModel;
71+
_sourceControlPanelVM = (SourceControlViewViewModel) sourceControlPanel.ViewModel;
72+
_branchesVM = (BranchesViewViewModel) _sourceControlPanelVM.TabItems.Single(t => t.ViewModel.Tab == SourceControlTab.Branches).ViewModel;
7373

74-
_panelVM.OpenRepoStarted += DisableSinkEventHandlers;
75-
_panelVM.OpenRepoCompleted += EnableSinkEventHandlersAndUpdateCache;
74+
_sourceControlPanelVM.OpenRepoStarted += DisableSinkEventHandlers;
75+
_sourceControlPanelVM.OpenRepoCompleted += EnableSinkEventHandlersAndUpdateCache;
7676

7777
_branchesVM.LoadingComponentsStarted += DisableSinkEventHandlers;
7878
_branchesVM.LoadingComponentsCompleted += EnableSinkEventHandlersAndUpdateCache;
@@ -311,6 +311,8 @@ async void sink_ComponentRenamed(object sender, DispatcherRenamedEventArgs<VBCom
311311
return;
312312
}
313313

314+
_sourceControlPanelVM.HandleRenamedComponent(e.Item, e.OldName);
315+
314316
_logger.Debug("Component '{0}' was renamed to '{1}'.", e.OldName, e.Item.Name);
315317

316318
_parser.State.RemoveRenamedComponent(e.Item, e.OldName);
@@ -325,7 +327,7 @@ async void sink_ComponentRemoved(object sender, DispatcherEventArgs<VBComponent>
325327
return;
326328
}
327329

328-
_panelVM.RemoveComponent(e.Item);
330+
_sourceControlPanelVM.HandleRemovedComponent(e.Item);
329331

330332
_logger.Debug("Component '{0}' was removed.", e.Item.Name);
331333
_parser.State.ClearStateCache(e.Item, true);
@@ -353,7 +355,7 @@ async void sink_ComponentAdded(object sender, DispatcherEventArgs<VBComponent> e
353355
return;
354356
}
355357

356-
_panelVM.AddComponent(e.Item);
358+
_sourceControlPanelVM.HandleAddedComponent(e.Item);
357359

358360
_logger.Debug("Component '{0}' was added.", e.Item.Name);
359361
_parser.State.OnParseRequested(sender, e.Item);
@@ -454,10 +456,10 @@ public void Dispose()
454456
return;
455457
}
456458

457-
if (_panelVM != null)
459+
if (_sourceControlPanelVM != null)
458460
{
459-
_panelVM.OpenRepoStarted -= DisableSinkEventHandlers;
460-
_panelVM.OpenRepoCompleted -= EnableSinkEventHandlersAndUpdateCache;
461+
_sourceControlPanelVM.OpenRepoStarted -= DisableSinkEventHandlers;
462+
_sourceControlPanelVM.OpenRepoCompleted -= EnableSinkEventHandlersAndUpdateCache;
461463
}
462464

463465
if (_branchesVM != null)

RetailCoder.VBE/Inspections/InspectionResultBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ public override string ToString()
102102
InspectionsUI.QualifiedSelectionInspection,
103103
Inspection.Severity,
104104
Description,
105-
module.ProjectId,
105+
"(" + module.ProjectDisplayName + ")",
106+
module.ProjectName,
106107
module.ComponentName,
107108
QualifiedSelection.Selection.StartLine);
108109
}

RetailCoder.VBE/Inspections/InspectionsUI.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/Inspections/InspectionsUI.de.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@
501501
<value>Kontexttyp '{0}' ist nicht gültig für {1}.</value>
502502
</data>
503503
<data name="QualifiedSelectionInspection" xml:space="preserve">
504-
<value>{0}: {1} - {2}.{3}, Zeile {4}</value>
504+
<value>{0}: {1} - {2} {3}.{4}, Zeile {5}</value>
505505
</data>
506506
<data name="SetObjectVariableQuickFix" xml:space="preserve">
507507
<value>Benutze das Schlüsselwort 'Set'</value>

RetailCoder.VBE/Inspections/InspectionsUI.fr.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@
501501
<value>Utiliser le mot-clé 'Set'</value>
502502
</data>
503503
<data name="QualifiedSelectionInspection">
504-
<value>{0}: {1} - {2},{3}, ligne {4}</value>
504+
<value>{0}: {1} - {2} {3}.{4}, ligne {5}</value>
505505
</data>
506506
<data name="ObjectVariableNotSetInspectionName">
507507
<value>L'assignation d'une référence d'objet requiert le mot-clé 'Set'</value>

RetailCoder.VBE/Inspections/InspectionsUI.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@
507507
<value>Context type '{0}' is not valid for {1}.</value>
508508
</data>
509509
<data name="QualifiedSelectionInspection" xml:space="preserve">
510-
<value>{0}: {1} - {2}.{3}, line {4}</value>
510+
<value>{0}: {1} - {2} {3}.{4}, line {5}</value>
511511
</data>
512512
<data name="ObjectVariableNotSetInspectionMeta" xml:space="preserve">
513513
<value>As far as Rubberduck can tell, this variable is an object variable, assigned without the 'Set' keyword. This causes run-time error 91 'Object or With block variable not set'.</value>

RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
2828
_folderHelper = folderHelper;
2929
_state = state;
3030
_state.StateChanged += ParserState_StateChanged;
31-
31+
3232
_refreshCommand = new DelegateCommand(param => _state.OnParseRequested(this),
3333
param => !IsBusy && _state.IsDirty());
3434

@@ -188,38 +188,38 @@ public string PanelTitle
188188

189189
if (SelectedItem is CodeExplorerProjectViewModel)
190190
{
191-
var node = (CodeExplorerProjectViewModel) SelectedItem;
191+
var node = (CodeExplorerProjectViewModel)SelectedItem;
192192
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
193193
}
194194

195195
if (SelectedItem is CodeExplorerComponentViewModel)
196196
{
197-
var node = (CodeExplorerComponentViewModel) SelectedItem;
197+
var node = (CodeExplorerComponentViewModel)SelectedItem;
198198
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
199199
}
200200

201201
if (SelectedItem is CodeExplorerMemberViewModel)
202202
{
203-
var node = (CodeExplorerMemberViewModel) SelectedItem;
203+
var node = (CodeExplorerMemberViewModel)SelectedItem;
204204
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
205205
}
206206

207207
return SelectedItem.Name;
208208
}
209209
}
210-
210+
211211
public string Description
212212
{
213213
get
214214
{
215215
if (SelectedItem is ICodeExplorerDeclarationViewModel)
216216
{
217-
return ((ICodeExplorerDeclarationViewModel) SelectedItem).Declaration.DescriptionString;
217+
return ((ICodeExplorerDeclarationViewModel)SelectedItem).Declaration.DescriptionString;
218218
}
219219

220220
if (SelectedItem is CodeExplorerCustomFolderViewModel)
221221
{
222-
return ((CodeExplorerCustomFolderViewModel) SelectedItem).FolderAttribute;
222+
return ((CodeExplorerCustomFolderViewModel)SelectedItem).FolderAttribute;
223223
}
224224

225225
return string.Empty;
@@ -237,7 +237,7 @@ public ObservableCollection<CodeExplorerItemViewModel> Projects
237237
set
238238
{
239239
_projects = new ObservableCollection<CodeExplorerItemViewModel>(value.OrderBy(o => o.NameWithSignature));
240-
240+
241241
ReorderChildNodes(_projects);
242242
OnPropertyChanged();
243243
}
@@ -250,12 +250,12 @@ private void ParserState_StateChanged(object sender, EventArgs e)
250250
Projects = new ObservableCollection<CodeExplorerItemViewModel>();
251251
}
252252

253-
IsBusy = _state.Status == ParserState.Parsing;
254-
if (_state.Status != ParserState.Ready)
253+
IsBusy = _state.Status < ParserState.ResolvedDeclarations;
254+
if (_state.Status != ParserState.ResolvedDeclarations)
255255
{
256256
return;
257257
}
258-
258+
259259
var userDeclarations = _state.AllUserDeclarations
260260
.GroupBy(declaration => declaration.Project)
261261
.Where(grouping => grouping.Key != null)
@@ -273,7 +273,7 @@ private void ParserState_StateChanged(object sender, EventArgs e)
273273
grouping)).ToList();
274274

275275
UpdateNodes(Projects, newProjects);
276-
276+
277277
Projects = new ObservableCollection<CodeExplorerItemViewModel>(newProjects);
278278
}
279279

@@ -403,7 +403,7 @@ private void SetErrorState(CodeExplorerItemViewModel itemNode, VBComponent compo
403403

404404
if (node is CodeExplorerComponentViewModel)
405405
{
406-
var componentNode = (CodeExplorerComponentViewModel) node;
406+
var componentNode = (CodeExplorerComponentViewModel)node;
407407
if (componentNode.GetSelectedDeclaration().QualifiedName.QualifiedModuleName.Component == component)
408408
{
409409
componentNode.IsErrorState = true;
@@ -472,8 +472,8 @@ private void SetErrorState(CodeExplorerItemViewModel itemNode, VBComponent compo
472472
// this is a special case--we have to reset SelectedItem to prevent a crash
473473
private void ExecuteRemoveComand(object param)
474474
{
475-
var node = (CodeExplorerComponentViewModel) SelectedItem;
476-
SelectedItem = Projects.First(p => ((CodeExplorerProjectViewModel) p).Declaration.Project == node.Declaration.Project);
475+
var node = (CodeExplorerComponentViewModel)SelectedItem;
476+
SelectedItem = Projects.First(p => ((CodeExplorerProjectViewModel)p).Declaration.Project == node.Declaration.Project);
477477

478478
_externalRemoveCommand.Execute(param);
479479
}

RetailCoder.VBE/UI/Command/MenuItems/RubberduckCommandBar.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ private void SetSelectionText(QualifiedSelection selection)
9494
private void State_StateChanged(object sender, EventArgs e)
9595
{
9696
_logger.Debug("RubberduckCommandBar handles StateChanged...");
97-
SetStatusText(RubberduckUI.ResourceManager.GetString("ParserState_" + _state.Status));
97+
98+
if (_state.Status != ParserState.ResolvedDeclarations)
99+
{
100+
SetStatusText(RubberduckUI.ResourceManager.GetString("ParserState_" + _state.Status));
101+
}
98102
}
99103

100104
public event EventHandler Refresh;

RetailCoder.VBE/UI/RubberduckUI.Designer.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/RubberduckUI.resx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -59,7 +59,7 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
6363
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>
@@ -1620,4 +1620,16 @@ All our stargazers, likers &amp; followers, for the warm fuzzies
16201620
<data name="GeneralSettings_ShowLogFolder" xml:space="preserve">
16211621
<value>Show Log Folder</value>
16221622
</data>
1623-
</root>
1623+
<data name="SourceControl_CreateNewRemoteRepoButtonToolTip" xml:space="preserve">
1624+
<value>Upload repository to GitHub</value>
1625+
</data>
1626+
<data name="SourceControl_CreateNewRemoteRepo_FailureTitle" xml:space="preserve">
1627+
<value>Create new remote repository.</value>
1628+
</data>
1629+
<data name="SourceControl_CreateNewRemoteRepo_NoOpenRepo" xml:space="preserve">
1630+
<value>No open repository to push to specified remote location.</value>
1631+
</data>
1632+
<data name="SourceControl_ExternalModifications" xml:space="preserve">
1633+
<value>A source file was modified out of the editor; should Rubberduck reload it?</value>
1634+
</data>
1635+
</root>

RetailCoder.VBE/UI/SourceControl/BranchesViewViewModel.cs

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -189,39 +189,41 @@ public string NewBranchName
189189

190190
public bool IsNotValidBranchName
191191
{
192-
get
193-
{
194-
// Rules taken from https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
195-
var isValidName = !string.IsNullOrEmpty(NewBranchName) &&
196-
!LocalBranches.Contains(NewBranchName) &&
197-
!NewBranchName.Any(char.IsWhiteSpace) &&
198-
!NewBranchName.Contains("..") &&
199-
!NewBranchName.Contains("~") &&
200-
!NewBranchName.Contains("^") &&
201-
!NewBranchName.Contains(":") &&
202-
!NewBranchName.Contains("?") &&
203-
!NewBranchName.Contains("*") &&
204-
!NewBranchName.Contains("[") &&
205-
!NewBranchName.Contains("//") &&
206-
NewBranchName.FirstOrDefault() != '/' &&
207-
NewBranchName.LastOrDefault() != '/' &&
208-
NewBranchName.LastOrDefault() != '.' &&
209-
NewBranchName != "@" &&
210-
!NewBranchName.Contains("@{") &&
211-
!NewBranchName.Contains("\\");
212-
213-
if (!isValidName)
214-
{
215-
return true;
216-
}
217-
foreach (var section in NewBranchName.Split('/'))
218-
{
219-
isValidName = section.FirstOrDefault() != '.' &&
220-
!section.EndsWith(".lock");
221-
}
192+
get { return !IsValidBranchName(NewBranchName); }
193+
}
222194

223-
return !isValidName;
195+
public bool IsValidBranchName(string name)
196+
{
197+
// Rules taken from https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
198+
var isValidName = !string.IsNullOrEmpty(name) &&
199+
!LocalBranches.Contains(name) &&
200+
!name.Any(char.IsWhiteSpace) &&
201+
!name.Contains("..") &&
202+
!name.Contains("~") &&
203+
!name.Contains("^") &&
204+
!name.Contains(":") &&
205+
!name.Contains("?") &&
206+
!name.Contains("*") &&
207+
!name.Contains("[") &&
208+
!name.Contains("//") &&
209+
name.FirstOrDefault() != '/' &&
210+
name.LastOrDefault() != '/' &&
211+
name.LastOrDefault() != '.' &&
212+
name != "@" &&
213+
!name.Contains("@{") &&
214+
!name.Contains("\\");
215+
216+
if (!isValidName)
217+
{
218+
return false;
224219
}
220+
foreach (var section in name.Split('/'))
221+
{
222+
isValidName = section.FirstOrDefault() != '.' &&
223+
!section.EndsWith(".lock");
224+
}
225+
226+
return isValidName;
225227
}
226228

227229
private bool _displayMergeBranchesGrid;

0 commit comments

Comments
 (0)