Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
TDT4250
2021
Examples
Commits
c017fa97
Commit
c017fa97
authored
5 years ago
by
Hallvard Trætteberg
Browse files
Options
Downloads
Patches
Plain Diff
Added doc strings and dependency on corresponding annotations.
parent
898ded0a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
dict-ws/tdt4250.dict3.gogo/bnd.bnd
+2
-1
2 additions, 1 deletion
dict-ws/tdt4250.dict3.gogo/bnd.bnd
dict-ws/tdt4250.dict3.gogo/src/tdt4250/dict3/gogo/DictCommands.java
+21
-3
21 additions, 3 deletions
...t4250.dict3.gogo/src/tdt4250/dict3/gogo/DictCommands.java
with
23 additions
and
4 deletions
dict-ws/tdt4250.dict3.gogo/bnd.bnd
+
2
−
1
View file @
c017fa97
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
osgi.core;version=7.0.0,\
osgi.core;version=7.0.0,\
osgi.cmpn;version=7.0.0,\
osgi.cmpn;version=7.0.0,\
tdt4250.dict3.util;version=latest,\
tdt4250.dict3.util;version=latest,\
tdt4250.dict3.api;version=latest
tdt4250.dict3.api;version=latest,\
org.apache.felix.gogo.runtime
-testpath: \
-testpath: \
${junit},\
${junit},\
...
...
This diff is collapsed.
Click to expand it.
dict-ws/tdt4250.dict3.gogo/src/tdt4250/dict3/gogo/DictCommands.java
+
21
−
3
View file @
c017fa97
...
@@ -4,6 +4,7 @@ import java.io.IOException;
...
@@ -4,6 +4,7 @@ import java.io.IOException;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
import
org.apache.felix.service.command.Descriptor
;
import
org.osgi.framework.BundleContext
;
import
org.osgi.framework.BundleContext
;
import
org.osgi.framework.FrameworkUtil
;
import
org.osgi.framework.FrameworkUtil
;
import
org.osgi.framework.InvalidSyntaxException
;
import
org.osgi.framework.InvalidSyntaxException
;
...
@@ -30,6 +31,7 @@ import tdt4250.dict3.util.SortedSetWords;
...
@@ -30,6 +31,7 @@ import tdt4250.dict3.util.SortedSetWords;
)
)
public
class
DictCommands
{
public
class
DictCommands
{
@Descriptor
(
"list available dictionaries"
)
public
void
list
()
{
public
void
list
()
{
Activator
activator
=
Activator
.
getActivator
();
Activator
activator
=
Activator
.
getActivator
();
System
.
out
.
print
(
"Dictionaries: "
);
System
.
out
.
print
(
"Dictionaries: "
);
...
@@ -43,7 +45,11 @@ public class DictCommands {
...
@@ -43,7 +45,11 @@ public class DictCommands {
System
.
out
.
println
();
System
.
out
.
println
();
}
}
public
void
lookup
(
String
s
)
{
@Descriptor
(
"look up a word in each available dictionary"
)
public
void
lookup
(
@Descriptor
(
"the word to look up"
)
String
s
)
{
BundleContext
bc
=
FrameworkUtil
.
getBundle
(
this
.
getClass
()).
getBundleContext
();
BundleContext
bc
=
FrameworkUtil
.
getBundle
(
this
.
getClass
()).
getBundleContext
();
try
{
try
{
// iterate through all Dict service objects
// iterate through all Dict service objects
...
@@ -60,7 +66,15 @@ public class DictCommands {
...
@@ -60,7 +66,15 @@ public class DictCommands {
}
}
}
}
public
void
add
(
String
name
,
String
urlStringOrWord
,
String
...
ss
)
{
@Descriptor
(
"add a dictionary, with content from a URL and/or specific words"
)
public
void
add
(
@Descriptor
(
"the name of the new dictionary"
)
String
name
,
@Descriptor
(
"the URL of file with the words, or a simple word to add to the dictionary"
)
String
urlStringOrWord
,
@Descriptor
(
"additional words to add to the dictionary"
)
String
...
ss
)
{
MutableWords
words
=
null
;
MutableWords
words
=
null
;
try
{
try
{
URL
url
=
new
URL
(
urlStringOrWord
);
URL
url
=
new
URL
(
urlStringOrWord
);
...
@@ -81,7 +95,11 @@ public class DictCommands {
...
@@ -81,7 +95,11 @@ public class DictCommands {
System
.
out
.
println
(
"\""
+
name
+
"\" dictionary "
+
(
existed
?
"replaced"
:
"added"
));
System
.
out
.
println
(
"\""
+
name
+
"\" dictionary "
+
(
existed
?
"replaced"
:
"added"
));
}
}
public
void
remove
(
String
name
)
{
@Descriptor
(
"remove a (manually added) dictionary"
)
public
void
remove
(
@Descriptor
(
"the name of the (manually added) dictionary to remove"
)
String
name
)
{
boolean
removed
=
Activator
.
getActivator
().
removeDict
(
name
);
boolean
removed
=
Activator
.
getActivator
().
removeDict
(
name
);
System
.
out
.
println
(
"\""
+
name
+
"\" dictionary "
+
(
removed
?
"removed"
:
"was not added manually"
));
System
.
out
.
println
(
"\""
+
name
+
"\" dictionary "
+
(
removed
?
"removed"
:
"was not added manually"
));
}
}
...
...
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