Skip to content

Commit

Permalink
add Preserve only first occurences
Browse files Browse the repository at this point in the history
  • Loading branch information
xulihang committed Nov 19, 2020
1 parent 7e70a86 commit 27f75c1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion BasicCAT/BasicCAT.b4j.meta
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,6 @@ ModuleClosedNodes78=
ModuleClosedNodes79=
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=searchAndReplaceDialog,InTimeRange,100,0,searchAndReplaceDialog,ResultsMap,534,6,searchAndReplaceDialog,resultListView_SelectedIndexChanged,38,0,searchAndReplaceDialog,findButton_Click,44,6,searchAndReplaceDialog,findTextField_TextChanged,506,0,searchAndReplaceDialog,replaceTextField_TextChanged,504,0,searchAndReplaceDialog,CheckShouldShowBasedonExtendedItem,56,0,searchAndReplaceDialog,FilterButton_MouseClicked,529,0,searchAndReplaceDialog,showRegexResult,124,6,searchAndReplaceDialog,showResult,267,6
NavigationStack=searchAndReplaceDialog,showRegexResult,102,6,searchAndReplaceDialog,Class_Globals,4,0,searchAndReplaceDialog,showResult,355,6,searchAndReplaceDialog,replaceTextField_TextChanged,521,0,searchAndReplaceDialog,findTextField_TextChanged,527,0,searchAndReplaceDialog,GetTimestampButton_MouseClicked,577,0,Visual Designer,searchandreplace.bjl,-100,6,searchAndReplaceDialog,FilterButton_MouseClicked,544,0,searchAndReplaceDialog,replaceSelectedButton_MouseClicked,424,0,searchAndReplaceDialog,resultListView_Action,498,6
SelectedBuild=0
VisibleModules=1,2,3,4,5,6,7,8,9,10,11
Binary file modified BasicCAT/Files/searchandreplace.bjl
Binary file not shown.
43 changes: 32 additions & 11 deletions BasicCAT/searchAndReplaceDialog.bas
Original file line number Diff line number Diff line change
Expand Up @@ -503,17 +503,38 @@ Sub replaceAllButton_MouseClicked (EventData As MouseEvent)
End Sub

Sub resultListView_Action
Dim p As Pane
p=resultListView.Items.Get(resultListView.SelectedIndex)
Dim tagMap As Map
tagMap=p.Tag
Dim filename As String=tagMap.Get("filename")
If filename<>Main.currentProject.currentFilename Then
Main.currentProject.openFile(filename,False)
End If
Main.editorLV.ScrollTo(tagMap.get("index"))
Main.MainForm.AlwaysOnTop=True
Main.MainForm.AlwaysOnTop=False
Dim mi As MenuItem=Sender
Select mi.Text
Case "Preserve only first occurences"
Dim new As List
new.Initialize
Dim map1 As Map
map1.Initialize
For Each p As Pane In resultListView.Items
Dim tagMap As Map
tagMap=p.Tag
Dim source As String
source=Regex.Split(CRLF&"- ",tagMap.Get("text"))(0)
If map1.ContainsKey(source)=False Then
map1.Put(source,"")
new.Add(p)
End If
Next
resultListView.Items.Clear
resultListView.Items.AddAll(new)
Case "Go to the segment"
Dim p As Pane
p=resultListView.Items.Get(resultListView.SelectedIndex)
Dim tagMap As Map
tagMap=p.Tag
Dim filename As String=tagMap.Get("filename")
If filename<>Main.currentProject.currentFilename Then
Main.currentProject.openFile(filename,False)
End If
Main.editorLV.ScrollTo(tagMap.get("index"))
Main.MainForm.AlwaysOnTop=True
Main.MainForm.AlwaysOnTop=False
End Select
End Sub

Sub searchSourceCheckBox_CheckedChange(Checked As Boolean)
Expand Down

0 comments on commit 27f75c1

Please sign in to comment.