Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BigDataViewer_Core_Extension
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
BioinformaticDataCompression
BigDataViewer_Core_Extension
Commits
ef2de623
Commit
ef2de623
authored
8 years ago
by
Tobias Pietzsch
Browse files
Options
Downloads
Patches
Plain Diff
remove deprecated KeyProperties class
parent
69341e5b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/bdv/BigDataViewer.java
+0
-15
0 additions, 15 deletions
src/main/java/bdv/BigDataViewer.java
src/main/java/bdv/util/KeyProperties.java
+0
-193
0 additions, 193 deletions
src/main/java/bdv/util/KeyProperties.java
with
0 additions
and
208 deletions
src/main/java/bdv/BigDataViewer.java
+
0
−
15
View file @
ef2de623
...
...
@@ -49,7 +49,6 @@ import org.jdom2.input.SAXBuilder;
import
org.jdom2.output.Format
;
import
org.jdom2.output.XMLOutputter
;
import
org.scijava.ui.behaviour.io.InputTriggerConfig
;
import
org.scijava.ui.behaviour.io.InputTriggerDescription
;
import
org.scijava.ui.behaviour.io.yaml.YamlConfigIO
;
import
bdv.cache.CacheControl
;
...
...
@@ -74,7 +73,6 @@ import bdv.tools.crop.CropDialog;
import
bdv.tools.transformation.ManualTransformation
;
import
bdv.tools.transformation.ManualTransformationEditor
;
import
bdv.tools.transformation.TransformedSource
;
import
bdv.util.KeyProperties
;
import
bdv.viewer.NavigationActions
;
import
bdv.viewer.SourceAndConverter
;
import
bdv.viewer.ViewerFrame
;
...
...
@@ -643,19 +641,6 @@ public class BigDataViewer
}
}
// try to load and convert old KeyProperties file "bigdataviewer.keys.properties" in current directory
if
(
conf
==
null
&&
new
File
(
"bigdataviewer.keys.properties"
).
exists
()
)
{
final
ArrayList
<
InputTriggerDescription
>
descriptions
=
KeyProperties
.
readPropertyFile
().
getInputTriggerDescriptions
();
conf
=
new
InputTriggerConfig
(
descriptions
);
try
{
YamlConfigIO
.
write
(
descriptions
,
"bdvkeyconfig.yaml"
);
}
catch
(
final
IOException
e
)
{}
}
if
(
conf
==
null
)
{
conf
=
new
InputTriggerConfig
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/bdv/util/KeyProperties.java
deleted
100644 → 0
+
0
−
193
View file @
69341e5b
/*
* #%L
* BigDataViewer core classes with minimal dependencies
* %%
* Copyright (C) 2012 - 2015 BigDataViewer authors
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package
bdv.util
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map.Entry
;
import
java.util.Properties
;
import
java.util.Set
;
import
javax.swing.InputMap
;
import
javax.swing.KeyStroke
;
import
org.scijava.ui.behaviour.KeyStrokeAdder
;
import
org.scijava.ui.behaviour.io.InputTriggerDescription
;
@Deprecated
public
final
class
KeyProperties
implements
KeyStrokeAdder
.
Factory
{
private
final
HashSet
<
KeyStroke
>
allKeys
;
private
final
HashMap
<
String
,
HashSet
<
KeyStroke
>
>
actionToKeysMap
;
private
static
final
HashSet
<
KeyStroke
>
emptySet
=
new
HashSet
<>();
public
KeyProperties
(
final
Properties
properties
)
{
allKeys
=
new
HashSet
<>();
actionToKeysMap
=
new
HashMap
<>();
if
(
properties
!=
null
)
{
final
Set
<
Entry
<
Object
,
Object
>
>
entries
=
properties
.
entrySet
();
for
(
final
Entry
<
Object
,
Object
>
entry
:
entries
)
{
final
String
keyname
=
(
String
)
entry
.
getKey
();
final
String
action
=
(
String
)
entry
.
getValue
();
final
KeyStroke
key
=
KeyStroke
.
getKeyStroke
(
keyname
);
if
(
key
==
null
)
System
.
err
.
println
(
"key name formatted incorrectly: \""
+
keyname
+
"\""
);
else
{
allKeys
.
add
(
key
);
HashSet
<
KeyStroke
>
keys
=
actionToKeysMap
.
get
(
action
);
if
(
keys
==
null
)
{
keys
=
new
HashSet
<>();
actionToKeysMap
.
put
(
action
,
keys
);
}
keys
.
add
(
key
);
}
}
}
}
public
static
KeyProperties
readPropertyFile
()
{
final
File
file
=
new
File
(
"bigdataviewer.keys.properties"
);
return
readPropertyFile
(
file
);
}
public
static
KeyProperties
readPropertyFile
(
final
File
file
)
{
try
{
final
InputStream
stream
=
new
FileInputStream
(
file
);
final
Properties
config
=
new
Properties
();
config
.
load
(
stream
);
return
new
KeyProperties
(
config
);
}
catch
(
final
IOException
e
)
{
System
.
out
.
println
(
"Cannot find the config file :"
+
file
+
". Using default key bindings."
);
System
.
out
.
println
(
e
.
getMessage
()
);
}
return
new
KeyProperties
(
null
);
}
public
Set
<
KeyStroke
>
getKeyStrokes
(
final
String
actionName
)
{
final
HashSet
<
KeyStroke
>
keys
=
actionToKeysMap
.
get
(
actionName
);
return
keys
==
null
?
emptySet
:
keys
;
}
public
Set
<
KeyStroke
>
getAllKeyStrokes
()
{
return
allKeys
;
}
@Override
public
KeyStrokeAdder
keyStrokeAdder
(
final
InputMap
map
,
final
String
...
contexts
)
{
return
new
KeyStrokeAdderImp
(
map
,
this
);
}
public
static
class
KeyStrokeAdderImp
implements
KeyStrokeAdder
{
private
final
InputMap
map
;
private
final
KeyProperties
config
;
public
KeyStrokeAdderImp
(
final
InputMap
map
,
final
KeyProperties
config
)
{
this
.
map
=
map
;
this
.
config
=
config
;
}
@Override
public
void
put
(
final
String
actionName
,
final
KeyStroke
...
defaultKeyStrokes
)
{
final
Set
<
KeyStroke
>
keys
=
config
.
getKeyStrokes
(
actionName
);
for
(
final
KeyStroke
key
:
keys
)
map
.
put
(
key
,
actionName
);
final
Set
<
KeyStroke
>
overriddenKeys
=
config
.
getAllKeyStrokes
();
for
(
final
KeyStroke
key
:
defaultKeyStrokes
)
if
(
!
overriddenKeys
.
contains
(
key
)
)
map
.
put
(
key
,
actionName
);
}
@Override
public
void
put
(
final
String
actionName
,
final
String
...
defaultKeyStrokes
)
{
final
KeyStroke
[]
keys
=
new
KeyStroke
[
defaultKeyStrokes
.
length
];
int
i
=
0
;
for
(
final
String
s
:
defaultKeyStrokes
)
keys
[
i
++
]
=
KeyStroke
.
getKeyStroke
(
s
);
put
(
actionName
,
keys
);
}
@Override
public
void
put
(
final
String
actionName
)
{
put
(
actionName
,
new
KeyStroke
[
0
]
);
}
}
public
static
Properties
createPropertiesFromInputMap
(
final
InputMap
inputMap
)
{
final
Properties
properties
=
new
Properties
();
final
KeyStroke
[]
keys
=
inputMap
.
allKeys
();
for
(
final
KeyStroke
key
:
keys
)
{
final
Object
actionName
=
inputMap
.
get
(
key
);
properties
.
put
(
key
.
toString
(),
actionName
.
toString
()
);
}
return
properties
;
}
public
ArrayList
<
InputTriggerDescription
>
getInputTriggerDescriptions
()
{
final
ArrayList
<
InputTriggerDescription
>
descriptions
=
new
ArrayList
<>();
for
(
final
Entry
<
String
,
HashSet
<
KeyStroke
>
>
actionToKeysEntry
:
actionToKeysMap
.
entrySet
()
)
{
final
String
action
=
actionToKeysEntry
.
getKey
();
final
ArrayList
<
String
>
triggers
=
new
ArrayList
<>();
for
(
final
KeyStroke
key
:
actionToKeysEntry
.
getValue
()
)
triggers
.
add
(
key
.
toString
()
);
descriptions
.
add
(
new
InputTriggerDescription
(
triggers
.
toArray
(
new
String
[
0
]
),
action
,
"bdv"
)
);
}
return
descriptions
;
}
}
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