From 3ed42169d92894728cc55cd1efe6021904430efe Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Tue, 15 Aug 2017 10:40:32 +0100 Subject: [PATCH] JAL-2629 the HMMER tab is now disabled when HMMER is not installed --- resources/lang/Messages.properties | 3 +- src/jalview/gui/AlignFrame.java | 5 + src/jalview/gui/Preferences.java | 62 ++++++++--- src/jalview/jbgui/GAlignFrame.java | 210 ++++++++++++++++++----------------- src/jalview/jbgui/GPreferences.java | 22 +++- 5 files changed, 184 insertions(+), 118 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 807f88f..a03ab7f 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1342,4 +1342,5 @@ label.hmmsearch_not_found = The hmmsearch binary was not found. warn.hmmbuild_failed = hmmbuild was not found. warn.align_failed = hmmalign was not found. label.invalid_folder = Invalid Folder -label.folder_not_exists = HMMER not found. \n Please enter the path to HMMER (if installed). \ No newline at end of file +label.folder_not_exists = HMMER not found. \n Please enter the path to HMMER (if installed). +label.hmmer_installed = HMMER installed \ No newline at end of file diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index c2a1b94..9c4a75c 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -5693,6 +5693,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, new CalculationChooser(AlignFrame.this); } } + + public void updateHMMERStatus(boolean status) + { + hmmerMenu.setEnabled(status); + } } class PrintThread extends Thread diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index e11bdec..39023dc 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -204,6 +204,8 @@ public class Preferences extends GPreferences * Set HMMER tab defaults */ trimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false)); + isHMMERInstalled + .setSelected(Cache.getDefault("HMMER_INSTALLED", false)); if (Cache.getDefault("USE_UNIPROT", false)) { uniprot.setSelected(true); @@ -214,6 +216,8 @@ public class Preferences extends GPreferences } numberOfSequencesToKeepField .setText(Cache.getProperty("SEQUENCES_TO_KEEP")); + installationLocation.setEnabled(isHMMERInstalled.isSelected()); + hmmerPath.setEnabled(isHMMERInstalled.isSelected()); hmmerPath.setText(Cache.getProperty(HMMER_PATH)); hmmerPath.addActionListener(new ActionListener() { @@ -674,6 +678,20 @@ public class Preferences extends GPreferences numberOfSequencesToKeepField.getText()); Cache.applicationProperties.setProperty(HMMER_PATH, hmmerPath.getText()); + boolean hmmerInstalled = isHMMERInstalled.isSelected(); + Cache.applicationProperties.setProperty("HMMER_INSTALLED", + Boolean.toString(hmmerInstalled)); + boolean hmmerFunctioning = validateHMMERPath(false); + Cache.applicationProperties.setProperty("HMMER_FUNCTIONING", + Boolean.toString(hmmerFunctioning)); + AlignFrame[] frames = Desktop.getAlignFrames(); + boolean hmmerStatus = hmmerFunctioning && hmmerInstalled ? true : false; + for (AlignFrame frame : frames) + { + frame.updateHMMERStatus(hmmerStatus); + } + + trimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false)); if (Cache.getDefault("USE_UNIPROT", false)) { @@ -844,10 +862,13 @@ public class Preferences extends GPreferences structureTab.requestFocusInWindow(); return false; } - if (!validateHMMER()) + if (isHMMERInstalled.isSelected()) { - hmmerTab.requestFocusInWindow(); - return false; + if (!validateHMMER()) + { + hmmerTab.requestFocusInWindow(); + return false; + } } return true; } @@ -1158,27 +1179,26 @@ public class Preferences extends GPreferences } /** - * Returns true if hmmer path contains the necessary valid executables, else show an error - * dialog. + * Returns true if hmmer path contains the necessary valid executables, else + * show an error dialog (if showing dialog). */ - private boolean validateHMMERPath() + private boolean validateHMMERPath(boolean showDialog) { int missing = 0; String message = ""; - String path = hmmerPath.getText(); - if (path.length() < 1) - { - return false; - } - else + String path = hmmerPath.getText().trim(); + if (path.length() > 0) { File f = new File(path); if (!f.exists()) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, + if (showDialog) + { + JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.getString("label.folder_not_exists"), MessageManager.getString("label.invalid_folder"), JvOptionPane.ERROR_MESSAGE); + } return false; } @@ -1216,17 +1236,24 @@ public class Preferences extends GPreferences { if (missing < 3) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, message, + if (showDialog) + { + JvOptionPane.showInternalMessageDialog(Desktop.desktop, message, MessageManager.getString("label.invalid_folder"), JvOptionPane.ERROR_MESSAGE); + } return false; } else { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, + if (showDialog) + { + JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.getString("label.no_binaries"), MessageManager.getString("label.invalid_folder"), JvOptionPane.ERROR_MESSAGE); + } + return false; } } @@ -1235,6 +1262,11 @@ public class Preferences extends GPreferences return true; } + private boolean validateHMMERPath() + { + return validateHMMERPath(true); + } + /** * If Chimera is selected, check it can be found on default or user-specified * path, if not show a warning/help dialog. diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 74a3940..e9dd53b 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -263,7 +263,7 @@ public class GAlignFrame extends JInternalFrame { initColourMenu(); initHMMERMenu(); - + JMenuItem saveAs = new JMenuItem( MessageManager.getString("action.save_as")); ActionListener al = new ActionListener() @@ -274,13 +274,13 @@ public class GAlignFrame extends JInternalFrame saveAs_actionPerformed(e); } }; - + // FIXME getDefaultToolkit throws an exception in Headless mode KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask() | KeyEvent.SHIFT_MASK, false); addMenuActionAndAccelerator(keyStroke, saveAs, al); - + closeMenuItem.setText(MessageManager.getString("action.close")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false); @@ -293,7 +293,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, closeMenuItem, al); - + JMenu editMenu = new JMenu(MessageManager.getString("action.edit")); JMenu viewMenu = new JMenu(MessageManager.getString("action.view")); JMenu annotationsMenu = new JMenu( @@ -304,6 +304,16 @@ public class GAlignFrame extends JInternalFrame MessageManager.getString("action.calculate")); webService.setText(MessageManager.getString("action.web_service")); hmmerMenu.setText(MessageManager.getString("action.hmmer")); + String status = Cache.getProperty("HMMER_FUNCTIONING"); + if ("false".equals(status) || status == null) + { + hmmerMenu.setEnabled(false); + } + else + { + hmmerMenu.setEnabled(true); + } + JMenuItem selectAllSequenceMenuItem = new JMenuItem( MessageManager.getString("action.select_all")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit @@ -317,7 +327,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, selectAllSequenceMenuItem, al); - + JMenuItem deselectAllSequenceMenuItem = new JMenuItem( MessageManager.getString("action.deselect_all")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); @@ -330,7 +340,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, deselectAllSequenceMenuItem, al); - + JMenuItem invertSequenceMenuItem = new JMenuItem( MessageManager.getString("action.invert_sequence_selection")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit @@ -344,7 +354,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, invertSequenceMenuItem, al); - + JMenuItem grpsFromSelection = new JMenuItem( MessageManager.getString("action.make_groups_selection")); grpsFromSelection.addActionListener(new ActionListener() @@ -380,7 +390,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, remove2LeftMenuItem, al); - + JMenuItem remove2RightMenuItem = new JMenuItem( MessageManager.getString("action.remove_right")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit @@ -394,7 +404,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, remove2RightMenuItem, al); - + JMenuItem removeGappedColumnMenuItem = new JMenuItem( MessageManager.getString("action.remove_empty_columns")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit @@ -408,7 +418,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, removeGappedColumnMenuItem, al); - + JMenuItem removeAllGapsMenuItem = new JMenuItem( MessageManager.getString("action.remove_all_gaps")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit @@ -423,7 +433,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, removeAllGapsMenuItem, al); - + JMenuItem justifyLeftMenuItem = new JMenuItem( MessageManager.getString("action.left_justify_alignment")); justifyLeftMenuItem.addActionListener(new ActionListener() @@ -515,7 +525,7 @@ public class GAlignFrame extends JInternalFrame sortGroupMenuItem_actionPerformed(e); } }); - + JMenuItem removeRedundancyMenuItem = new JMenuItem( MessageManager.getString("action.remove_redundancy")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit @@ -529,7 +539,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, removeRedundancyMenuItem, al); - + JMenuItem pairwiseAlignmentMenuItem = new JMenuItem( MessageManager.getString("action.pairwise_alignment")); pairwiseAlignmentMenuItem.addActionListener(new ActionListener() @@ -540,7 +550,7 @@ public class GAlignFrame extends JInternalFrame pairwiseAlignmentMenuItem_actionPerformed(e); } }); - + this.getContentPane().setLayout(new BorderLayout()); alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11)); statusBar.setBackground(Color.white); @@ -549,7 +559,7 @@ public class GAlignFrame extends JInternalFrame statusBar.setText(MessageManager.getString("label.status_bar")); outputTextboxMenu.setText(MessageManager .getString("label.out_to_textbox")); - + annotationPanelMenuItem.setActionCommand(""); annotationPanelMenuItem.setText(MessageManager .getString("label.show_annotations")); @@ -616,7 +626,7 @@ public class GAlignFrame extends JInternalFrame MessageManager.getString("label.sort_annotations_by_sequence")); final JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem( MessageManager.getString("label.sort_annotations_by_label")); - + sortAnnBySequence .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL); sortAnnBySequence.addActionListener(new ActionListener() @@ -656,7 +666,7 @@ public class GAlignFrame extends JInternalFrame colourTextMenuItem_actionPerformed(e); } }); - + JMenuItem htmlMenuItem = new JMenuItem( MessageManager.getString("label.html")); htmlMenuItem.addActionListener(new ActionListener() @@ -667,7 +677,7 @@ public class GAlignFrame extends JInternalFrame htmlMenuItem_actionPerformed(e); } }); - + JMenuItem createBioJS = new JMenuItem( MessageManager.getString("label.biojs_html_export")); createBioJS.addActionListener(new java.awt.event.ActionListener() @@ -678,7 +688,7 @@ public class GAlignFrame extends JInternalFrame bioJSMenuItem_actionPerformed(e); } }); - + JMenuItem overviewMenuItem = new JMenuItem( MessageManager.getString("label.overview_window")); overviewMenuItem.addActionListener(new ActionListener() @@ -689,7 +699,7 @@ public class GAlignFrame extends JInternalFrame overviewMenuItem_actionPerformed(e); } }); - + undoMenuItem.setEnabled(false); undoMenuItem.setText(MessageManager.getString("action.undo")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit @@ -703,7 +713,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, undoMenuItem, al); - + redoMenuItem.setEnabled(false); redoMenuItem.setText(MessageManager.getString("action.redo")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit @@ -717,7 +727,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, redoMenuItem, al); - + wrapMenuItem.setText(MessageManager.getString("label.wrap")); wrapMenuItem.addActionListener(new ActionListener() { @@ -727,7 +737,7 @@ public class GAlignFrame extends JInternalFrame wrapMenuItem_actionPerformed(e); } }); - + JMenuItem printMenuItem = new JMenuItem( MessageManager.getString("action.print")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit @@ -741,7 +751,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, printMenuItem, al); - + renderGapsMenuItem .setText(MessageManager.getString("action.show_gaps")); renderGapsMenuItem.setState(true); @@ -753,7 +763,7 @@ public class GAlignFrame extends JInternalFrame renderGapsMenuItem_actionPerformed(e); } }); - + JMenuItem findMenuItem = new JMenuItem( MessageManager.getString("action.find")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit @@ -769,7 +779,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, findMenuItem, al); - + showSeqFeatures.setText(MessageManager .getString("label.show_sequence_features")); showSeqFeatures.addActionListener(new ActionListener() @@ -790,86 +800,86 @@ public class GAlignFrame extends JInternalFrame .getString("label.show_database_refs")); showDbRefsMenuitem.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { showDbRefs_actionPerformed(e); } - + }); showNpFeatsMenuitem.setText(MessageManager .getString("label.show_non_positional_features")); showNpFeatsMenuitem.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { showNpFeats_actionPerformed(e); } - + }); showGroupConservation.setText(MessageManager .getString("label.group_conservation")); showGroupConservation.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { showGroupConservation_actionPerformed(e); } - + }); - + showGroupConsensus.setText(MessageManager .getString("label.group_consensus")); showGroupConsensus.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { showGroupConsensus_actionPerformed(e); } - + }); showConsensusHistogram.setText(MessageManager .getString("label.show_consensus_histogram")); showConsensusHistogram.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { showConsensusHistogram_actionPerformed(e); } - + }); showSequenceLogo.setText(MessageManager .getString("label.show_consensus_logo")); showSequenceLogo.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { showSequenceLogo_actionPerformed(e); } - + }); normaliseSequenceLogo.setText(MessageManager .getString("label.norm_consensus_logo")); normaliseSequenceLogo.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { normaliseSequenceLogo_actionPerformed(e); } - + }); applyAutoAnnotationSettings.setText(MessageManager .getString("label.apply_all_groups")); @@ -883,7 +893,7 @@ public class GAlignFrame extends JInternalFrame applyAutoAnnotationSettings_actionPerformed(e); } }); - + ButtonGroup buttonGroup = new ButtonGroup(); final JRadioButtonMenuItem showAutoFirst = new JRadioButtonMenuItem( MessageManager.getString("label.show_first")); @@ -914,7 +924,7 @@ public class GAlignFrame extends JInternalFrame sortAnnotations_actionPerformed(); } }); - + JMenuItem deleteGroups = new JMenuItem( MessageManager.getString("action.undefine_groups")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit @@ -928,7 +938,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, deleteGroups, al); - + JMenuItem annotationColumn = new JMenuItem( MessageManager.getString("action.select_by_annotation")); annotationColumn.addActionListener(new ActionListener() @@ -939,7 +949,7 @@ public class GAlignFrame extends JInternalFrame annotationColumn_actionPerformed(e); } }); - + JMenuItem createGroup = new JMenuItem( MessageManager.getString("action.create_group")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit @@ -953,7 +963,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, createGroup, al); - + JMenuItem unGroup = new JMenuItem( MessageManager.getString("action.remove_group")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit @@ -968,11 +978,11 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, unGroup, al); - + copy.setText(MessageManager.getString("action.copy")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false); - + al = new ActionListener() { @Override @@ -982,7 +992,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, copy, al); - + cut.setText(MessageManager.getString("action.cut")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false); @@ -995,7 +1005,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, cut, al); - + JMenuItem delete = new JMenuItem( MessageManager.getString("action.delete")); delete.addActionListener(new ActionListener() @@ -1006,7 +1016,7 @@ public class GAlignFrame extends JInternalFrame delete_actionPerformed(e); } }); - + pasteMenu.setText(MessageManager.getString("action.paste")); JMenuItem pasteNew = new JMenuItem( MessageManager.getString("label.to_new_alignment")); @@ -1029,7 +1039,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, pasteNew, al); - + JMenuItem pasteThis = new JMenuItem( MessageManager.getString("label.to_this_alignment")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit @@ -1050,7 +1060,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, pasteThis, al); - + JMenuItem createPNG = new JMenuItem("PNG"); createPNG.addActionListener(new ActionListener() { @@ -1062,7 +1072,7 @@ public class GAlignFrame extends JInternalFrame }); createPNG.setActionCommand(MessageManager .getString("label.save_png_image")); - + JMenuItem font = new JMenuItem(MessageManager.getString("action.font")); font.addActionListener(new ActionListener() { @@ -1092,7 +1102,7 @@ public class GAlignFrame extends JInternalFrame createEPS(null); } }); - + JMenuItem createSVG = new JMenuItem("SVG"); createSVG.addActionListener(new ActionListener() { @@ -1102,7 +1112,7 @@ public class GAlignFrame extends JInternalFrame createSVG(null); } }); - + JMenuItem loadTreeMenuItem = new JMenuItem( MessageManager.getString("label.load_associated_tree")); loadTreeMenuItem.setActionCommand(MessageManager @@ -1115,7 +1125,7 @@ public class GAlignFrame extends JInternalFrame loadTreeMenuItem_actionPerformed(e); } }); - + scaleAbove.setVisible(false); scaleAbove.setText(MessageManager.getString("action.scale_above")); scaleAbove.addActionListener(new ActionListener() @@ -1166,15 +1176,15 @@ public class GAlignFrame extends JInternalFrame .getString("label.automatic_scrolling")); followHighlightMenuItem.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { followHighlight_actionPerformed(); } - + }); - + sortByTreeMenu .setText(MessageManager.getString("action.by_tree_order")); sort.setText(MessageManager.getString("action.sort")); @@ -1185,12 +1195,12 @@ public class GAlignFrame extends JInternalFrame { buildTreeSortMenu(); } - + @Override public void menuDeselected(MenuEvent e) { } - + @Override public void menuCanceled(MenuEvent e) { @@ -1201,17 +1211,17 @@ public class GAlignFrame extends JInternalFrame sort.add(sortByAnnotScore); sort.addMenuListener(new javax.swing.event.MenuListener() { - + @Override public void menuCanceled(MenuEvent e) { } - + @Override public void menuDeselected(MenuEvent e) { } - + @Override public void menuSelected(MenuEvent e) { @@ -1219,10 +1229,10 @@ public class GAlignFrame extends JInternalFrame } }); sortByAnnotScore.setVisible(false); - + calculateTree.setText(MessageManager .getString("action.calculate_tree_pca")); - + padGapsMenuitem.setText(MessageManager.getString("label.pad_gaps")); padGapsMenuitem.setState(jalview.bin.Cache .getDefault("PAD_GAPS", false)); @@ -1274,7 +1284,7 @@ public class GAlignFrame extends JInternalFrame showReverse_actionPerformed(true); } }); - + JMenuItem extractScores = new JMenuItem( MessageManager.getString("label.extract_scores")); extractScores.addActionListener(new ActionListener() @@ -1287,10 +1297,10 @@ public class GAlignFrame extends JInternalFrame }); extractScores.setVisible(true); // JBPNote: TODO: make gui for regex based score extraction - + // for show products actions see AlignFrame.canShowProducts showProducts.setText(MessageManager.getString("label.get_cross_refs")); - + runGroovy.setText(MessageManager.getString("label.run_groovy")); runGroovy.setToolTipText(MessageManager .getString("label.run_groovy_tip")); @@ -1302,7 +1312,7 @@ public class GAlignFrame extends JInternalFrame runGroovy_actionPerformed(); } }); - + JMenuItem openFeatureSettings = new JMenuItem( MessageManager.getString("action.feature_settings")); openFeatureSettings.addActionListener(new ActionListener() @@ -1323,7 +1333,7 @@ public class GAlignFrame extends JInternalFrame fetchSequence_actionPerformed(e); } }); - + JMenuItem associatedData = new JMenuItem( MessageManager.getString("label.load_features_annotations")); associatedData.addActionListener(new ActionListener() @@ -1369,7 +1379,7 @@ public class GAlignFrame extends JInternalFrame sortByTreeOption_actionPerformed(e); } }); - + listenToViewSelections.setText(MessageManager .getString("label.listen_for_selections")); listenToViewSelections @@ -1385,7 +1395,7 @@ public class GAlignFrame extends JInternalFrame listenToViewSelections_actionPerformed(e); } }); - + JMenu addSequenceMenu = new JMenu( MessageManager.getString("label.add_sequences")); JMenuItem addFromFile = new JMenuItem( @@ -1531,7 +1541,7 @@ public class GAlignFrame extends JInternalFrame hiddenMarkers_actionPerformed(e); } }); - + JMenuItem invertColSel = new JMenuItem( MessageManager.getString("action.invert_column_selection")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit @@ -1546,7 +1556,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, invertColSel, al); - + showComplementMenuItem.setVisible(false); showComplementMenuItem.addActionListener(new ActionListener() { @@ -1556,7 +1566,7 @@ public class GAlignFrame extends JInternalFrame showComplement_actionPerformed(showComplementMenuItem.getState()); } }); - + tabbedPane.addChangeListener(new javax.swing.event.ChangeListener() { @Override @@ -1577,7 +1587,7 @@ public class GAlignFrame extends JInternalFrame tabbedPane_mousePressed(e); } } - + @Override public void mouseReleased(MouseEvent e) { @@ -1595,7 +1605,7 @@ public class GAlignFrame extends JInternalFrame tabbedPane_focusGained(e); } }); - + JMenuItem save = new JMenuItem(MessageManager.getString("action.save")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false); @@ -1608,7 +1618,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, save, al); - + reload.setEnabled(false); reload.setText(MessageManager.getString("action.reload")); reload.addActionListener(new ActionListener() @@ -1619,7 +1629,7 @@ public class GAlignFrame extends JInternalFrame reload_actionPerformed(e); } }); - + JMenuItem newView = new JMenuItem( MessageManager.getString("action.new_view")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit @@ -1633,14 +1643,14 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, newView, al); - + tabbedPane.setToolTipText("" + MessageManager.getString("label.rename_tab_eXpand_reGroup") + ""); - + formatMenu.setText(MessageManager.getString("action.format")); JMenu selectMenu = new JMenu(MessageManager.getString("action.select")); - + idRightAlign.setText(MessageManager .getString("label.right_align_sequence_id")); idRightAlign.addActionListener(new ActionListener() @@ -1651,7 +1661,7 @@ public class GAlignFrame extends JInternalFrame idRightAlign_actionPerformed(e); } }); - + gatherViews.setEnabled(false); gatherViews.setText(MessageManager.getString("action.gather_views")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false); @@ -1664,7 +1674,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, gatherViews, al); - + expandViews.setEnabled(false); expandViews.setText(MessageManager.getString("action.expand_views")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false); @@ -1677,7 +1687,7 @@ public class GAlignFrame extends JInternalFrame } }; addMenuActionAndAccelerator(keyStroke, expandViews, al); - + JMenuItem pageSetup = new JMenuItem( MessageManager.getString("action.page_setup")); pageSetup.addActionListener(new ActionListener() @@ -1713,7 +1723,7 @@ public class GAlignFrame extends JInternalFrame hmmBuild.setText(MessageManager.getString("label.hmmbuild")); hmmBuild.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { @@ -1730,12 +1740,12 @@ public class GAlignFrame extends JInternalFrame e1.printStackTrace(); } } - + }); hmmAlign.setText(MessageManager.getString("label.hmmalign")); hmmAlign.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { @@ -1752,14 +1762,14 @@ public class GAlignFrame extends JInternalFrame e1.printStackTrace(); } } - + }); selectHighlighted.addActionListener(al); JMenu tooltipSettingsMenu = new JMenu( MessageManager.getString("label.sequence_id_tooltip")); JMenu autoAnnMenu = new JMenu( MessageManager.getString("label.autocalculated_annotation")); - + JMenu exportImageMenu = new JMenu( MessageManager.getString("label.export_image")); JMenu fileMenu = new JMenu(MessageManager.getString("action.file")); @@ -1773,7 +1783,7 @@ public class GAlignFrame extends JInternalFrame alignFrameMenuBar.add(calculateMenu); alignFrameMenuBar.add(webService); alignFrameMenuBar.add(hmmerMenu); - + fileMenu.add(fetchSequence); fileMenu.add(addSequenceMenu); fileMenu.add(reload); @@ -1792,7 +1802,7 @@ public class GAlignFrame extends JInternalFrame fileMenu.add(associatedData); fileMenu.addSeparator(); fileMenu.add(closeMenuItem); - + pasteMenu.add(pasteNew); pasteMenu.add(pasteThis); editMenu.add(undoMenuItem); @@ -1814,7 +1824,7 @@ public class GAlignFrame extends JInternalFrame // editMenu.add(justifyRightMenuItem); // editMenu.addSeparator(); editMenu.add(padGapsMenuitem); - + showMenu.add(showAllColumns); showMenu.add(showAllSeqs); showMenu.add(showAllhidden); @@ -1842,7 +1852,7 @@ public class GAlignFrame extends JInternalFrame viewMenu.add(alignmentProperties); viewMenu.addSeparator(); viewMenu.add(overviewMenuItem); - + annotationsMenu.add(annotationPanelMenuItem); annotationsMenu.addSeparator(); annotationsMenu.add(showAllAlAnnotations); @@ -1864,8 +1874,8 @@ public class GAlignFrame extends JInternalFrame autoAnnMenu.add(showGroupConservation); autoAnnMenu.add(showGroupConsensus); annotationsMenu.add(autoAnnMenu); - - + + sort.add(sortIDMenuItem); sort.add(sortLengthMenuItem); sort.add(sortGroupMenuItem); @@ -1887,7 +1897,7 @@ public class GAlignFrame extends JInternalFrame calculateMenu.add(extractScores); calculateMenu.addSeparator(); calculateMenu.add(runGroovy); - + webServiceNoServices = new JMenuItem( MessageManager.getString("label.no_services")); webService.add(webServiceNoServices); @@ -1902,7 +1912,7 @@ public class GAlignFrame extends JInternalFrame this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH); statusPanel.add(statusBar, null); this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER); - + formatMenu.add(font); formatMenu.addSeparator(); formatMenu.add(wrapMenuItem); diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 25742b4..68dc27b 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -276,6 +276,8 @@ public class GPreferences extends JPanel protected JLabel installationLocation = new JLabel(); + protected JCheckBox isHMMERInstalled = new JCheckBox(); + protected JTextField hmmerPath = new JTextField(); protected JLabel hmmsearch = new JLabel(); @@ -377,7 +379,8 @@ public class GPreferences extends JPanel } } else if (lastTab == hmmerTab - && tabbedPane.getSelectedComponent() != hmmerTab) + && tabbedPane.getSelectedComponent() != hmmerTab + && isHMMERInstalled.isSelected()) { if (!validateHMMER()) { @@ -427,7 +430,6 @@ public class GPreferences extends JPanel */ private JPanel initHMMERTab() { - JPanel hmmerTab = new JPanel(); hmmerTab.setLayout(null); hmmalign.setFont(LABEL_FONT); @@ -448,6 +450,20 @@ public class GPreferences extends JPanel sequencesToKeep.setBounds(new Rectangle(250, 30, 125, 23)); numberOfSequencesToKeepField.setBounds(new Rectangle(375, 30, 40, 23)); + isHMMERInstalled.setFont(LABEL_FONT); + isHMMERInstalled.setText( + MessageManager.getString("label.hmmer_installed")); + isHMMERInstalled.setBounds(new Rectangle(22, 180, 200, 23)); + isHMMERInstalled.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + boolean status = isHMMERInstalled.isSelected(); + installationLocation.setEnabled(status); + hmmerPath.setEnabled(status); + } + }); installationLocation.setFont(LABEL_FONT); installationLocation.setText( MessageManager.getString("label.change_hmmer_location")); @@ -491,6 +507,8 @@ public class GPreferences extends JPanel hmmerTab.add(sequencesToKeep); hmmerTab.add(sequencesToKeep); hmmerTab.add(numberOfSequencesToKeepField); + hmmerTab.add(isHMMERInstalled); + return hmmerTab; } -- 1.7.10.2