Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mbe-tools
TTool
Commits
84e28e27
Commit
84e28e27
authored
6 years ago
by
apvrille
Browse files
Options
Downloads
Patches
Plain Diff
Adding in search box of TTool help elements
parent
120521b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/java/help/HelpEntry.java
+50
-0
50 additions, 0 deletions
src/main/java/help/HelpEntry.java
src/main/java/help/HelpManager.java
+23
-1
23 additions, 1 deletion
src/main/java/help/HelpManager.java
src/main/java/ui/MainGUI.java
+2
-0
2 additions, 0 deletions
src/main/java/ui/MainGUI.java
with
75 additions
and
1 deletion
src/main/java/help/HelpEntry.java
+
50
−
0
View file @
84e28e27
...
...
@@ -249,5 +249,55 @@ public class HelpEntry implements GenericTree {
return
getIndexOfKid
((
HelpEntry
)
child
);
}
public
HelpEntry
getFromMasterKeyword
(
String
search
)
{
if
(
masterKeyword
!=
null
)
{
if
(
masterKeyword
.
compareTo
(
search
)
==
0
)
{
return
this
;
}
}
if
(
entries
!=
null
)
{
HelpEntry
ret
;
for
(
HelpEntry
he:
entries
)
{
ret
=
he
.
getFromMasterKeyword
(
search
);
if
(
ret
!=
null
)
{
return
ret
;
}
}
}
return
null
;
}
public
void
addEntries
(
Vector
<
HelpEntry
>
list
)
{
list
.
add
(
this
);
if
(
entries
!=
null
)
{
for
(
HelpEntry
he
:
entries
)
{
he
.
addEntries
(
list
);
}
}
}
public
int
hasSimilarWords
(
String
[]
words
)
{
int
result
=
0
;
for
(
String
s:
words
)
{
if
(
hasKeyword
(
s
))
{
result
++;
}
}
return
result
;
}
public
boolean
hasKeyword
(
String
word
)
{
for
(
String
s:
keywords
)
{
if
(
s
.
compareTo
(
word
)
==
0
)
{
return
true
;
}
}
return
false
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/help/HelpManager.java
+
23
−
1
View file @
84e28e27
...
...
@@ -45,6 +45,7 @@ import java.io.BufferedReader;
import
java.io.File
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.util.Vector
;
/**
...
...
@@ -61,6 +62,8 @@ public class HelpManager extends HelpEntry {
private
boolean
helpLoaded
=
false
;
private
Vector
<
HelpEntry
>
allEntries
;
public
HelpManager
()
{
linkToParent
=
null
;
...
...
@@ -123,7 +126,7 @@ public class HelpManager extends HelpEntry {
return
false
;
}
computeAllEntries
();
helpLoaded
=
true
;
return
true
;
...
...
@@ -243,4 +246,23 @@ public class HelpManager extends HelpEntry {
return
top
;
}
private
void
computeAllEntries
()
{
allEntries
=
new
Vector
<>();
addEntries
(
allEntries
);
}
public
Vector
<
HelpEntry
>
getEntriesWithKeyword
(
String
[]
words
)
{
Vector
<
HelpEntry
>
result
=
new
Vector
<>();
for
(
HelpEntry
he:
allEntries
)
{
int
nb
=
he
.
hasSimilarWords
(
words
);
if
(
nb
>
0
)
{
result
.
add
(
he
);
}
}
return
result
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/ui/MainGUI.java
+
2
−
0
View file @
84e28e27
...
...
@@ -758,6 +758,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
panel
.
searchForText
(
text
.
toLowerCase
(),
elements
);
}
elements
.
addAll
(
helpManager
.
getEntriesWithKeyword
(
text
.
split
(
" "
)));
gtm
.
setElementsOfSearchTree
(
elements
);
//TraceManager.addDev("Found " + elements.size() + " elements");
dtree
.
forceUpdate
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment