Skip to content

Commit

Permalink
Improve behavior of the Hide small indels menu option (#1564)
Browse files Browse the repository at this point in the history
* If you cancel the popup dialogue or enter an invalid value then no change will be made.
  Previously cancelling it produced a stacktrace in the log and toggled the state using the
  old value.
  • Loading branch information
lbergelson authored Sep 10, 2024
1 parent 5b18361 commit 97dd56d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
/.gradle/
/build/
/.idea/

#JENV local config file
.java-version
15 changes: 11 additions & 4 deletions src/main/java/org/broad/igv/sam/AlignmentTrackMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,17 @@ class AlignmentTrackMenu extends IGVPopupMenu {
smallIndelsItem.addActionListener(aEvt -> UIUtilities.invokeOnEventThread(() -> {
if (smallIndelsItem.isSelected()) {
String sith = MessageUtils.showInputDialog("Small indel threshold: ", String.valueOf(renderOptions.getSmallIndelThreshold()));
try {
renderOptions.setSmallIndelThreshold(Integer.parseInt(sith));
} catch (NumberFormatException exc) {
log.error("Error setting small indel threshold - not an integer", exc);
if (sith == null) {
// dialogue was cancelled so no change should be made
return;
} else {
try {
renderOptions.setSmallIndelThreshold(Integer.parseInt(sith));
} catch (NumberFormatException exc) {
log.error("Error setting small indel threshold - not an integer", exc);
//error so no change should be made
return;
}
}
}
renderOptions.setHideSmallIndels(smallIndelsItem.isSelected());
Expand Down

0 comments on commit 97dd56d

Please sign in to comment.