2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
24 import jalview.bin.Cache;
25 import jalview.gui.Help.HelpId;
26 import jalview.gui.StructureViewer.ViewerType;
27 import jalview.hmmer.HmmerCommand;
28 import jalview.io.BackupFiles;
29 import jalview.io.BackupFilesPresetEntry;
30 import jalview.io.FileFormatI;
31 import jalview.io.JalviewFileChooser;
32 import jalview.io.JalviewFileView;
33 import jalview.jbgui.GPreferences;
34 import jalview.jbgui.GSequenceLink;
35 import jalview.schemes.ColourSchemeI;
36 import jalview.schemes.ColourSchemes;
37 import jalview.schemes.ResidueColourScheme;
38 import jalview.urls.UrlLinkTableModel;
39 import jalview.urls.api.UrlProviderFactoryI;
40 import jalview.urls.api.UrlProviderI;
41 import jalview.urls.desktop.DesktopUrlProviderFactory;
42 import jalview.util.FileUtils;
43 import jalview.util.MessageManager;
44 import jalview.util.Platform;
45 import jalview.util.UrlConstants;
46 import jalview.ws.sifts.SiftsSettings;
48 import java.awt.BorderLayout;
49 import java.awt.Color;
50 import java.awt.Component;
51 import java.awt.Dimension;
53 import java.awt.event.ActionEvent;
54 import java.awt.event.ActionListener;
55 import java.awt.event.FocusAdapter;
56 import java.awt.event.FocusEvent;
57 import java.awt.event.MouseEvent;
59 import java.util.ArrayList;
60 import java.util.List;
62 import javax.help.HelpSetException;
63 import javax.swing.JComboBox;
64 import javax.swing.JFileChooser;
65 import javax.swing.JInternalFrame;
66 import javax.swing.JPanel;
67 import javax.swing.JTextField;
68 import javax.swing.ListSelectionModel;
69 import javax.swing.RowFilter;
70 import javax.swing.RowSorter;
71 import javax.swing.SortOrder;
72 import javax.swing.event.DocumentEvent;
73 import javax.swing.event.DocumentListener;
74 import javax.swing.event.ListSelectionEvent;
75 import javax.swing.event.ListSelectionListener;
76 import javax.swing.table.TableCellRenderer;
77 import javax.swing.table.TableColumn;
78 import javax.swing.table.TableModel;
79 import javax.swing.table.TableRowSorter;
81 import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
89 public class Preferences extends GPreferences
91 // suggested list delimiter character
92 public static final String COMMA = ",";
94 public static final String HMMSEARCH_SEQCOUNT = "HMMSEARCH_SEQCOUNT";
96 public static final String HMMINFO_GLOBAL_BACKGROUND = "HMMINFO_GLOBAL_BACKGROUND";
98 public static final String HMMALIGN_TRIM_TERMINI = "HMMALIGN_TRIM_TERMINI";
100 public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
102 public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA";
104 public static final String DEFAULT_COLOUR = "DEFAULT_COLOUR";
106 public static final String DEFAULT_COLOUR_PROT = "DEFAULT_COLOUR_PROT";
108 public static final String DEFAULT_COLOUR_NUC = "DEFAULT_COLOUR_NUC";
110 public static final String ADD_TEMPFACT_ANN = "ADD_TEMPFACT_ANN";
112 public static final String ADD_SS_ANN = "ADD_SS_ANN";
114 public static final String USE_RNAVIEW = "USE_RNAVIEW";
116 public static final String STRUCT_FROM_PDB = "STRUCT_FROM_PDB";
118 public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
120 public static final String CHIMERA_PATH = "CHIMERA_PATH";
122 public static final String HMMER_PATH = "HMMER_PATH";
124 public static final String CYGWIN_PATH = "CYGWIN_PATH";
126 public static final String HMMSEARCH_DBS = "HMMSEARCH_DBS";
128 public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
130 public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
132 public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY";
134 public static final String SHOW_OV_HIDDEN_AT_START = "SHOW_OV_HIDDEN_AT_START";
136 public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP";
138 public static final String GAP_COLOUR = "GAP_COLOUR";
140 public static final String HIDDEN_COLOUR = "HIDDEN_COLOUR";
142 private static final int MIN_FONT_SIZE = 1;
144 private static final int MAX_FONT_SIZE = 30;
147 * Holds name and link separated with | character. Sequence ID must be
148 * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
150 public static UrlProviderI sequenceUrlLinks;
152 public static UrlLinkTableModel dataModel;
155 * Holds name and link separated with | character. Sequence IDS and Sequences
156 * must be $SEQUENCEIDS$ or $SEQUENCEIDS=/.possible | chars ./=$ and
157 * $SEQUENCES$ or $SEQUENCES=/.possible | chars ./=$ and separation character
158 * for first and second token specified after a pipe character at end |,|.
159 * (TODO: proper escape for using | to separate ids or sequences
162 public static List<String> groupURLLinks;
165 // get links selected to be in the menu (SEQUENCE_LINKS)
166 // and links entered by the user but not selected (STORED_LINKS)
167 String inMenuString = Cache.getDefault("SEQUENCE_LINKS", "");
168 String notInMenuString = Cache.getDefault("STORED_LINKS", "");
169 String defaultUrl = Cache.getDefault("DEFAULT_URL",
170 UrlConstants.DEFAULT_LABEL);
172 // if both links lists are empty, add the DEFAULT_URL link
173 // otherwise we assume the default link is in one of the lists
174 if (inMenuString.isEmpty() && notInMenuString.isEmpty())
176 inMenuString = UrlConstants.DEFAULT_STRING;
178 UrlProviderFactoryI factory = new DesktopUrlProviderFactory(defaultUrl,
179 inMenuString, notInMenuString);
180 sequenceUrlLinks = factory.createUrlProvider();
181 dataModel = new UrlLinkTableModel(sequenceUrlLinks);
184 * TODO: reformulate groupURL encoding so two or more can be stored in the
185 * .properties file as '|' separated strings
188 groupURLLinks = new ArrayList<>();
191 JInternalFrame frame;
193 private WsPreferences wsPrefs;
195 private OptionsParam promptEachTimeOpt = new OptionsParam(
196 MessageManager.getString("label.prompt_each_time"),
199 private OptionsParam lineArtOpt = new OptionsParam(
200 MessageManager.getString("label.lineart"), "Lineart");
202 private OptionsParam textOpt = new OptionsParam(
203 MessageManager.getString("action.text"), "Text");
206 * Creates a new Preferences object.
211 frame = new JInternalFrame();
212 frame.setContentPane(this);
213 if (!Platform.isJS())
220 wsPrefs = new WsPreferences();
221 wsTab.add(wsPrefs, BorderLayout.CENTER);
223 int width = 500, height = 450;
224 if (Platform.isAMacAndNotJS())
230 Desktop.addInternalFrame(frame,
231 MessageManager.getString("label.preferences"), width, height);
232 frame.setMinimumSize(new Dimension(width, height));
235 * Set HMMER tab defaults
237 hmmrTrimTermini.setSelected(Cache.getDefault(HMMALIGN_TRIM_TERMINI, false));
238 if (Cache.getDefault(HMMINFO_GLOBAL_BACKGROUND, false))
240 hmmerBackgroundUniprot.setSelected(true);
244 hmmerBackgroundAlignment.setSelected(true);
247 .setText(Cache.getProperty(HMMSEARCH_SEQCOUNT));
248 hmmerPath.setText(Cache.getProperty(HMMER_PATH));
249 hmmerPath.addActionListener(new ActionListener()
252 public void actionPerformed(ActionEvent e)
257 hmmerPath.addFocusListener(new FocusAdapter()
260 public void focusLost(FocusEvent e)
265 if (cygwinPath != null)
267 String path = Cache.getProperty(CYGWIN_PATH);
270 path = FileUtils.getPathTo("bash");
272 cygwinPath.setText(path);
273 cygwinPath.addActionListener(new ActionListener()
276 public void actionPerformed(ActionEvent e)
278 validateCygwinPath();
281 cygwinPath.addFocusListener(new FocusAdapter()
284 public void focusLost(FocusEvent e)
286 validateCygwinPath();
292 * Set Visual tab defaults
294 seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true));
295 rightAlign.setSelected(Cache.getDefault("RIGHT_ALIGN_IDS", false));
296 fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false));
297 annotations.setSelected(Cache.getDefault("SHOW_ANNOTATIONS", true));
299 conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true));
300 quality.setSelected(Cache.getDefault("SHOW_QUALITY", true));
301 identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true));
302 openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
304 .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
305 showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false));
307 .setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", false));
308 showGroupConservation.setSelected(
309 Cache.getDefault("SHOW_GROUP_CONSERVATION", false));
310 showConsensHistogram.setSelected(
311 Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", true));
313 .setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", false));
314 showInformationHistogram.setSelected(
315 Cache.getDefault("SHOW_INFORMATION_HISTOGRAM", true));
316 showHMMLogo.setSelected(Cache.getDefault("SHOW_HMM_LOGO", false));
318 .setSelected(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
320 .setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
322 String[] fonts = java.awt.GraphicsEnvironment
323 .getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
324 for (int i = 0; i < fonts.length; i++)
326 fontNameCB.addItem(fonts[i]);
329 for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++)
331 fontSizeCB.addItem(i + "");
334 fontStyleCB.addItem("plain");
335 fontStyleCB.addItem("bold");
336 fontStyleCB.addItem("italic");
338 fontNameCB.setSelectedItem(Cache.getDefault("FONT_NAME", "SansSerif"));
339 fontSizeCB.setSelectedItem(Cache.getDefault("FONT_SIZE", "10"));
340 fontStyleCB.setSelectedItem(
341 Cache.getDefault("FONT_STYLE", Font.PLAIN + ""));
343 smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", true));
345 .setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA, false));
347 idItalics.setSelected(Cache.getDefault("ID_ITALICS", true));
349 wrap.setSelected(Cache.getDefault("WRAP_ALIGNMENT", false));
351 gapSymbolCB.addItem("-");
352 gapSymbolCB.addItem(".");
354 gapSymbolCB.setSelectedItem(Cache.getDefault("GAP_SYMBOL", "-"));
356 sortby.addItem("No sort");
357 sortby.addItem("Id");
358 sortby.addItem("Pairwise Identity");
359 sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort"));
361 sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString());
363 .addItem(SequenceAnnotationOrder.SEQUENCE_AND_LABEL.toString());
365 .addItem(SequenceAnnotationOrder.LABEL_AND_SEQUENCE.toString());
366 SequenceAnnotationOrder savedSort = SequenceAnnotationOrder
367 .valueOf(Cache.getDefault(SORT_ANNOTATIONS,
368 SequenceAnnotationOrder.NONE.name()));
369 sortAnnBy.setSelectedItem(savedSort.toString());
371 sortAutocalc.addItem("Autocalculated first");
372 sortAutocalc.addItem("Autocalculated last");
373 final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE, true);
374 sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0)
375 : sortAutocalc.getItemAt(1));
377 .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true));
378 startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE",
379 Cache.getDefault("www.jalview.org", "http://www.jalview.org")
380 + "/examples/exampleFile_2_3.jar"));
383 * Set Colours tab defaults
385 protColour.addItem(ResidueColourScheme.NONE);
386 nucColour.addItem(ResidueColourScheme.NONE);
387 for (ColourSchemeI cs : ColourSchemes.getInstance().getColourSchemes())
389 String name = cs.getSchemeName();
390 protColour.addItem(name);
391 nucColour.addItem(name);
393 String oldProp = Cache.getDefault(DEFAULT_COLOUR,
394 ResidueColourScheme.NONE);
395 String newProp = Cache.getDefault(DEFAULT_COLOUR_PROT, null);
396 protColour.setSelectedItem(newProp != null ? newProp : oldProp);
397 newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null);
398 nucColour.setSelectedItem(newProp != null ? newProp : oldProp);
399 minColour.setBackground(
400 Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange));
401 maxColour.setBackground(
402 Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red));
405 * Set overview panel defaults
407 gapColour.setBackground(
408 Cache.getDefaultColour(GAP_COLOUR,
409 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP));
410 hiddenColour.setBackground(
411 Cache.getDefaultColour(HIDDEN_COLOUR,
412 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN));
413 useLegacyGap.setSelected(Cache.getDefault(USE_LEGACY_GAP, false));
414 gapLabel.setEnabled(!useLegacyGap.isSelected());
415 gapColour.setEnabled(!useLegacyGap.isSelected());
417 .setSelected(Cache.getDefault(SHOW_OV_HIDDEN_AT_START, false));
420 * Set Structure tab defaults.
422 final boolean structSelected = Cache.getDefault(STRUCT_FROM_PDB, false);
423 structFromPdb.setSelected(structSelected);
424 useRnaView.setSelected(Cache.getDefault(USE_RNAVIEW, false));
425 useRnaView.setEnabled(structSelected);
426 addSecondaryStructure.setSelected(Cache.getDefault(ADD_SS_ANN, false));
427 addSecondaryStructure.setEnabled(structSelected);
428 addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false));
429 addTempFactor.setEnabled(structSelected);
430 structViewer.setSelectedItem(
431 Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name()));
432 chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, ""));
433 chimeraPath.addActionListener(new ActionListener()
436 public void actionPerformed(ActionEvent e)
438 validateChimeraPath();
442 if (Cache.getDefault("MAP_WITH_SIFTS", false))
444 siftsMapping.setSelected(true);
448 nwMapping.setSelected(true);
452 .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false));
455 * Set Connections tab defaults
459 linkUrlTable.setModel(dataModel);
460 final TableRowSorter<TableModel> sorter = new TableRowSorter<>(
461 linkUrlTable.getModel());
462 linkUrlTable.setRowSorter(sorter);
463 List<RowSorter.SortKey> sortKeys = new ArrayList<>();
465 UrlLinkTableModel m = (UrlLinkTableModel) linkUrlTable.getModel();
466 sortKeys.add(new RowSorter.SortKey(m.getPrimaryColumn(),
467 SortOrder.DESCENDING));
468 sortKeys.add(new RowSorter.SortKey(m.getSelectedColumn(),
469 SortOrder.DESCENDING));
471 new RowSorter.SortKey(m.getNameColumn(), SortOrder.ASCENDING));
473 sorter.setSortKeys(sortKeys);
474 // BH 2018 setSortKeys will do the sort
478 ActionListener onReset;
479 onReset = new ActionListener()
482 public void actionPerformed(ActionEvent e)
484 filterTB.setText("");
485 sorter.setRowFilter(RowFilter.regexFilter(""));
489 doReset.addActionListener(onReset);
491 // filter to display only custom urls
492 final RowFilter<TableModel, Object> customUrlFilter = new RowFilter<TableModel, Object>()
495 public boolean include(
496 Entry<? extends TableModel, ? extends Object> entry)
498 return ((UrlLinkTableModel) entry.getModel()).isUserEntry(entry);
502 final TableRowSorter<TableModel> customSorter = new TableRowSorter<>(
503 linkUrlTable.getModel());
504 customSorter.setRowFilter(customUrlFilter);
506 ActionListener onCustomOnly;
507 onCustomOnly = new ActionListener()
510 public void actionPerformed(ActionEvent e)
512 filterTB.setText("");
513 sorter.setRowFilter(customUrlFilter);
516 userOnly.addActionListener(onCustomOnly);
518 filterTB.getDocument().addDocumentListener(new DocumentListener()
520 String caseInsensitiveFlag = "(?i)";
523 public void changedUpdate(DocumentEvent e)
525 sorter.setRowFilter(RowFilter
526 .regexFilter(caseInsensitiveFlag + filterTB.getText()));
530 public void removeUpdate(DocumentEvent e)
532 sorter.setRowFilter(RowFilter
533 .regexFilter(caseInsensitiveFlag + filterTB.getText()));
537 public void insertUpdate(DocumentEvent e)
539 sorter.setRowFilter(RowFilter
540 .regexFilter(caseInsensitiveFlag + filterTB.getText()));
544 // set up list selection functionality
545 linkUrlTable.getSelectionModel()
546 .addListSelectionListener(new UrlListSelectionHandler());
548 // set up radio buttons
549 int onClickCol = ((UrlLinkTableModel) linkUrlTable.getModel())
551 String onClickName = linkUrlTable.getColumnName(onClickCol);
552 linkUrlTable.getColumn(onClickName)
553 .setCellRenderer(new RadioButtonRenderer());
554 linkUrlTable.getColumn(onClickName)
555 .setCellEditor(new RadioButtonEditor());
557 // get boolean columns and resize those to min possible
558 for (int column = 0; column < linkUrlTable.getColumnCount(); column++)
560 if (linkUrlTable.getModel().getColumnClass(column)
561 .equals(Boolean.class))
563 TableColumn tableColumn = linkUrlTable.getColumnModel()
565 int preferredWidth = tableColumn.getMinWidth();
567 TableCellRenderer cellRenderer = linkUrlTable.getCellRenderer(0,
569 Component c = linkUrlTable.prepareRenderer(cellRenderer, 0, column);
570 int cwidth = c.getPreferredSize().width
571 + linkUrlTable.getIntercellSpacing().width;
572 preferredWidth = Math.max(preferredWidth, cwidth);
574 tableColumn.setPreferredWidth(preferredWidth);
578 useProxy.setSelected(Cache.getDefault("USE_PROXY", false));
579 useProxy_actionPerformed(); // make sure useProxy is correctly initialised
580 proxyServerTB.setText(Cache.getDefault("PROXY_SERVER", ""));
581 proxyPortTB.setText(Cache.getDefault("PROXY_PORT", ""));
583 defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", ""));
585 usagestats.setSelected(Cache.getDefault("USAGESTATS", false));
586 // note antisense here: default is true
588 .setSelected(Cache.getProperty("NOQUESTIONNAIRES") == null);
589 versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true));
592 * Set Output tab defaults
594 setupOutputCombo(epsRendering, "EPS_RENDERING");
595 setupOutputCombo(htmlRendering, "HTML_RENDERING");
596 setupOutputCombo(svgRendering, "SVG_RENDERING");
597 autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
598 userIdWidth.setEnabled(!autoIdWidth.isSelected());
599 userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
600 Integer wi = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH");
601 userIdWidth.setText(wi == null ? "" : wi.toString());
602 // TODO: refactor to use common enum via FormatAdapter and allow extension
603 // for new flat file formats
604 blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
605 clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true));
606 fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true));
607 msfjv.setSelected(Cache.getDefault("MSF_JVSUFFIX", true));
608 pfamjv.setSelected(Cache.getDefault("PFAM_JVSUFFIX", true));
609 pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true));
610 pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true));
611 modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false));
613 .setSelected(Cache.getDefault("EXPORT_EMBBED_BIOJSON", true));
616 * Set Editing tab defaults
618 autoCalculateConsCheck
619 .setSelected(Cache.getDefault("AUTO_CALC_CONSENSUS", true));
620 padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
621 sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
623 annotations_actionPerformed(null); // update the display of the annotation
628 * Set Backups tab defaults
630 loadLastSavedBackupsOptions();
634 * A helper method that sets the items and initial selection in a character
635 * rendering option list (Prompt each time/Lineart/Text)
640 protected void setupOutputCombo(JComboBox<Object> comboBox,
643 comboBox.addItem(promptEachTimeOpt);
644 comboBox.addItem(lineArtOpt);
645 comboBox.addItem(textOpt);
648 * JalviewJS doesn't support Lineart so force it to Text
650 String defaultOption = Platform.isJS() ? "Text"
651 : Cache.getDefault(propertyKey, "Prompt each time");
652 if (defaultOption.equalsIgnoreCase("Text"))
654 comboBox.setSelectedItem(textOpt);
656 else if (defaultOption.equalsIgnoreCase("Lineart"))
658 comboBox.setSelectedItem(lineArtOpt);
662 comboBox.setSelectedItem(promptEachTimeOpt);
667 * Save user selections on the Preferences tabs to the Cache and write out to
673 public void ok_actionPerformed(ActionEvent e)
675 if (!validateSettings())
681 * Save Visual settings
683 Cache.applicationProperties.setProperty("SHOW_JVSUFFIX",
684 Boolean.toString(seqLimit.isSelected()));
685 Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS",
686 Boolean.toString(rightAlign.isSelected()));
687 Cache.applicationProperties.setProperty("SHOW_FULLSCREEN",
688 Boolean.toString(fullScreen.isSelected()));
689 Cache.applicationProperties.setProperty("SHOW_OVERVIEW",
690 Boolean.toString(openoverv.isSelected()));
691 Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
692 Boolean.toString(annotations.isSelected()));
693 Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
694 Boolean.toString(conservation.isSelected()));
695 Cache.applicationProperties.setProperty("SHOW_QUALITY",
696 Boolean.toString(quality.isSelected()));
697 Cache.applicationProperties.setProperty("SHOW_IDENTITY",
698 Boolean.toString(identity.isSelected()));
700 Cache.applicationProperties.setProperty("GAP_SYMBOL",
701 gapSymbolCB.getSelectedItem().toString());
703 Cache.applicationProperties.setProperty("FONT_NAME",
704 fontNameCB.getSelectedItem().toString());
705 Cache.applicationProperties.setProperty("FONT_STYLE",
706 fontStyleCB.getSelectedItem().toString());
707 Cache.applicationProperties.setProperty("FONT_SIZE",
708 fontSizeCB.getSelectedItem().toString());
710 Cache.applicationProperties.setProperty("ID_ITALICS",
711 Boolean.toString(idItalics.isSelected()));
712 Cache.applicationProperties.setProperty("SHOW_UNCONSERVED",
713 Boolean.toString(showUnconserved.isSelected()));
714 Cache.applicationProperties.setProperty(SHOW_OCCUPANCY,
715 Boolean.toString(showOccupancy.isSelected()));
716 Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS",
717 Boolean.toString(showGroupConsensus.isSelected()));
718 Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION",
719 Boolean.toString(showGroupConservation.isSelected()));
720 Cache.applicationProperties.setProperty("SHOW_CONSENSUS_HISTOGRAM",
721 Boolean.toString(showConsensHistogram.isSelected()));
722 Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO",
723 Boolean.toString(showConsensLogo.isSelected()));
724 Cache.applicationProperties.setProperty("SHOW_INFORMATION_HISTOGRAM",
725 Boolean.toString(showConsensHistogram.isSelected()));
726 Cache.applicationProperties.setProperty("SHOW_HMM_LOGO",
727 Boolean.toString(showHMMLogo.isSelected()));
728 Cache.applicationProperties.setProperty("ANTI_ALIAS",
729 Boolean.toString(smoothFont.isSelected()));
730 Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA,
731 Boolean.toString(scaleProteinToCdna.isSelected()));
732 Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP",
733 Boolean.toString(showNpTooltip.isSelected()));
734 Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP",
735 Boolean.toString(showDbRefTooltip.isSelected()));
737 Cache.applicationProperties.setProperty("WRAP_ALIGNMENT",
738 Boolean.toString(wrap.isSelected()));
740 Cache.applicationProperties.setProperty("STARTUP_FILE",
741 startupFileTextfield.getText());
742 Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE",
743 Boolean.toString(startupCheckbox.isSelected()));
745 Cache.applicationProperties.setProperty("SORT_ALIGNMENT",
746 sortby.getSelectedItem().toString());
748 // convert description of sort order to enum name for save
749 SequenceAnnotationOrder annSortOrder = SequenceAnnotationOrder
750 .forDescription(sortAnnBy.getSelectedItem().toString());
751 if (annSortOrder != null)
753 Cache.applicationProperties.setProperty(SORT_ANNOTATIONS,
754 annSortOrder.name());
757 final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
758 Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE,
759 Boolean.valueOf(showAutocalcFirst).toString());
762 * Save Colours settings
764 Cache.applicationProperties.setProperty(DEFAULT_COLOUR_PROT,
765 protColour.getSelectedItem().toString());
766 Cache.applicationProperties.setProperty(DEFAULT_COLOUR_NUC,
767 nucColour.getSelectedItem().toString());
768 Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
769 minColour.getBackground());
770 Cache.setColourProperty("ANNOTATIONCOLOUR_MAX",
771 maxColour.getBackground());
774 * Save HMMER settings
776 Cache.applicationProperties.setProperty(HMMALIGN_TRIM_TERMINI,
777 Boolean.toString(hmmrTrimTermini.isSelected()));
778 Cache.applicationProperties.setProperty(HMMINFO_GLOBAL_BACKGROUND,
779 Boolean.toString(hmmerBackgroundUniprot.isSelected()));
780 Cache.applicationProperties.setProperty(HMMSEARCH_SEQCOUNT,
781 hmmerSequenceCount.getText());
782 Cache.setOrRemove(HMMER_PATH, hmmerPath.getText());
783 if (cygwinPath != null)
785 Cache.setOrRemove(CYGWIN_PATH, cygwinPath.getText());
787 AlignFrame[] frames = Desktop.getAlignFrames();
788 if (frames != null && frames.length > 0)
790 for (AlignFrame f : frames)
792 f.updateHMMERStatus();
796 hmmrTrimTermini.setSelected(Cache.getDefault(HMMALIGN_TRIM_TERMINI, false));
797 if (Cache.getDefault(HMMINFO_GLOBAL_BACKGROUND, false))
799 hmmerBackgroundUniprot.setSelected(true);
803 hmmerBackgroundAlignment.setSelected(true);
806 .setText(Cache.getProperty(HMMSEARCH_SEQCOUNT));
807 hmmerPath.setText(Cache.getProperty(HMMER_PATH));
810 * Save Overview settings
812 Cache.setColourProperty(GAP_COLOUR, gapColour.getBackground());
813 Cache.setColourProperty(HIDDEN_COLOUR, hiddenColour.getBackground());
814 Cache.applicationProperties.setProperty(USE_LEGACY_GAP,
815 Boolean.toString(useLegacyGap.isSelected()));
816 Cache.applicationProperties.setProperty(SHOW_OV_HIDDEN_AT_START,
817 Boolean.toString(showHiddenAtStart.isSelected()));
820 * Save Structure settings
822 Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN,
823 Boolean.toString(addTempFactor.isSelected()));
824 Cache.applicationProperties.setProperty(ADD_SS_ANN,
825 Boolean.toString(addSecondaryStructure.isSelected()));
826 Cache.applicationProperties.setProperty(USE_RNAVIEW,
827 Boolean.toString(useRnaView.isSelected()));
828 Cache.applicationProperties.setProperty(STRUCT_FROM_PDB,
829 Boolean.toString(structFromPdb.isSelected()));
830 Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY,
831 structViewer.getSelectedItem().toString());
832 Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
833 Cache.applicationProperties.setProperty("MAP_WITH_SIFTS",
834 Boolean.toString(siftsMapping.isSelected()));
835 SiftsSettings.setMapWithSifts(siftsMapping.isSelected());
838 * Save Output settings
840 Cache.applicationProperties.setProperty("EPS_RENDERING",
841 ((OptionsParam) epsRendering.getSelectedItem()).getCode());
842 Cache.applicationProperties.setProperty("HTML_RENDERING",
843 ((OptionsParam) htmlRendering.getSelectedItem()).getCode());
844 Cache.applicationProperties.setProperty("SVG_RENDERING",
845 ((OptionsParam) svgRendering.getSelectedItem()).getCode());
848 * Save Connections settings
850 Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText());
852 jalview.util.BrowserLauncher.resetBrowser();
854 // save user-defined and selected links
855 String menuLinks = sequenceUrlLinks.writeUrlsAsString(true);
856 if (menuLinks.isEmpty())
858 Cache.applicationProperties.remove("SEQUENCE_LINKS");
862 Cache.applicationProperties.setProperty("SEQUENCE_LINKS",
863 menuLinks.toString());
866 String nonMenuLinks = sequenceUrlLinks.writeUrlsAsString(false);
867 if (nonMenuLinks.isEmpty())
869 Cache.applicationProperties.remove("STORED_LINKS");
873 Cache.applicationProperties.setProperty("STORED_LINKS",
874 nonMenuLinks.toString());
877 Cache.applicationProperties.setProperty("DEFAULT_URL",
878 sequenceUrlLinks.getPrimaryUrlId());
880 Cache.applicationProperties.setProperty("USE_PROXY",
881 Boolean.toString(useProxy.isSelected()));
883 Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText());
885 Cache.setOrRemove("PROXY_PORT", proxyPortTB.getText());
887 if (useProxy.isSelected())
889 System.setProperty("http.proxyHost", proxyServerTB.getText());
890 System.setProperty("http.proxyPort", proxyPortTB.getText());
894 System.setProperty("http.proxyHost", "");
895 System.setProperty("http.proxyPort", "");
897 Cache.setProperty("VERSION_CHECK",
898 Boolean.toString(versioncheck.isSelected()));
899 if (Cache.getProperty("USAGESTATS") != null || usagestats.isSelected())
901 // default is false - we only set this if the user has actively agreed
902 Cache.setProperty("USAGESTATS",
903 Boolean.toString(usagestats.isSelected()));
905 if (!questionnaire.isSelected())
907 Cache.setProperty("NOQUESTIONNAIRES", "true");
911 // special - made easy to edit a property file to disable questionnaires
912 // by just adding the given line
913 Cache.removeProperty("NOQUESTIONNAIRES");
917 * Save Output settings
919 Cache.applicationProperties.setProperty("BLC_JVSUFFIX",
920 Boolean.toString(blcjv.isSelected()));
921 Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX",
922 Boolean.toString(clustaljv.isSelected()));
923 Cache.applicationProperties.setProperty("FASTA_JVSUFFIX",
924 Boolean.toString(fastajv.isSelected()));
925 Cache.applicationProperties.setProperty("MSF_JVSUFFIX",
926 Boolean.toString(msfjv.isSelected()));
927 Cache.applicationProperties.setProperty("PFAM_JVSUFFIX",
928 Boolean.toString(pfamjv.isSelected()));
929 Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX",
930 Boolean.toString(pileupjv.isSelected()));
931 Cache.applicationProperties.setProperty("PIR_JVSUFFIX",
932 Boolean.toString(pirjv.isSelected()));
933 Cache.applicationProperties.setProperty("PIR_MODELLER",
934 Boolean.toString(modellerOutput.isSelected()));
935 Cache.applicationProperties.setProperty("EXPORT_EMBBED_BIOJSON",
936 Boolean.toString(embbedBioJSON.isSelected()));
937 jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
939 Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH",
940 Boolean.toString(autoIdWidth.isSelected()));
941 userIdWidth_actionPerformed();
942 Cache.applicationProperties.setProperty("FIGURE_FIXEDIDWIDTH",
943 userIdWidth.getText());
946 * Save Editing settings
948 Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS",
949 Boolean.toString(autoCalculateConsCheck.isSelected()));
950 Cache.applicationProperties.setProperty("SORT_BY_TREE",
951 Boolean.toString(sortByTree.isSelected()));
952 Cache.applicationProperties.setProperty("PAD_GAPS",
953 Boolean.toString(padGaps.isSelected()));
955 if (!Platform.isJS())
957 wsPrefs.updateAndRefreshWsMenuConfig(false);
961 * Save Backups settings
963 Cache.applicationProperties.setProperty(BackupFiles.ENABLED,
964 Boolean.toString(enableBackupFiles.isSelected()));
965 int preset = getComboIntStringKey(backupfilesPresetsCombo);
966 Cache.applicationProperties.setProperty(BackupFiles.NS + "_PRESET", Integer.toString(preset));
968 if (preset == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
970 BackupFilesPresetEntry customBFPE = getBackupfilesCurrentEntry();
971 BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
972 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM, customBFPE);
973 Cache.applicationProperties
974 .setProperty(BackupFilesPresetEntry.CUSTOMCONFIG,
975 customBFPE.toString());
978 BackupFilesPresetEntry savedBFPE = BackupFilesPresetEntry.backupfilesPresetEntriesValues
980 Cache.applicationProperties.setProperty(
981 BackupFilesPresetEntry.SAVEDCONFIG, savedBFPE.toString());
983 Cache.saveProperties();
984 Desktop.instance.doConfigureStructurePrefs();
987 frame.setClosed(true);
988 } catch (Exception ex)
994 * Do any necessary validation before saving settings. Return focus to the
995 * first tab which fails validation.
999 private boolean validateSettings()
1001 if (!validateStructure())
1003 structureTab.requestFocusInWindow();
1010 protected boolean validateStructure()
1012 return validateChimeraPath();
1020 public void startupFileTextfield_mouseClicked()
1022 // TODO: JAL-3048 not needed for Jalview-JS
1023 String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
1024 JalviewFileChooser chooser = JalviewFileChooser
1025 .forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat);
1026 chooser.setFileView(new JalviewFileView());
1027 chooser.setDialogTitle(
1028 MessageManager.getString("label.select_startup_file"));
1030 int value = chooser.showOpenDialog(this);
1032 if (value == JalviewFileChooser.APPROVE_OPTION)
1034 FileFormatI format = chooser.getSelectedFormat();
1037 Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT",
1040 startupFileTextfield
1041 .setText(chooser.getSelectedFile().getAbsolutePath());
1052 public void cancel_actionPerformed(ActionEvent e)
1056 if (!Platform.isJS())
1058 wsPrefs.updateWsMenuConfig(true);
1059 wsPrefs.refreshWs_actionPerformed(e);
1061 frame.setClosed(true);
1062 } catch (Exception ex)
1074 public void annotations_actionPerformed(ActionEvent e)
1076 conservation.setEnabled(annotations.isSelected());
1077 quality.setEnabled(annotations.isSelected());
1078 identity.setEnabled(annotations.isSelected());
1079 showOccupancy.setEnabled(annotations.isSelected());
1080 showGroupConsensus.setEnabled(annotations.isSelected());
1081 showGroupConservation.setEnabled(annotations.isSelected());
1082 showConsensHistogram.setEnabled(annotations.isSelected()
1083 && (identity.isSelected() || showGroupConsensus.isSelected()));
1084 showConsensLogo.setEnabled(annotations.isSelected()
1085 && (identity.isSelected() || showGroupConsensus.isSelected()));
1086 showInformationHistogram.setEnabled(annotations.isSelected());
1087 showHMMLogo.setEnabled(annotations.isSelected());
1091 public void newLink_actionPerformed(ActionEvent e)
1093 GSequenceLink link = new GSequenceLink();
1094 boolean valid = false;
1097 if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
1098 MessageManager.getString("label.new_sequence_url_link"),
1099 JvOptionPane.OK_CANCEL_OPTION, -1,
1100 null) == JvOptionPane.OK_OPTION)
1102 if (link.checkValid())
1104 if (((UrlLinkTableModel) linkUrlTable.getModel())
1105 .isUniqueName(link.getName()))
1107 ((UrlLinkTableModel) linkUrlTable.getModel())
1108 .insertRow(link.getName(), link.getURL());
1113 link.notifyDuplicate();
1126 public void editLink_actionPerformed(ActionEvent e)
1128 GSequenceLink link = new GSequenceLink();
1130 int index = linkUrlTable.getSelectedRow();
1133 // button no longer enabled if row is not selected
1134 Cache.log.debug("Edit with no row selected in linkUrlTable");
1138 int nameCol = ((UrlLinkTableModel) linkUrlTable.getModel())
1140 int urlCol = ((UrlLinkTableModel) linkUrlTable.getModel())
1142 String oldName = linkUrlTable.getValueAt(index, nameCol).toString();
1143 link.setName(oldName);
1144 link.setURL(linkUrlTable.getValueAt(index, urlCol).toString());
1146 boolean valid = false;
1149 if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
1150 MessageManager.getString("label.edit_sequence_url_link"),
1151 JvOptionPane.OK_CANCEL_OPTION, -1,
1152 null) == JvOptionPane.OK_OPTION)
1154 if (link.checkValid())
1156 if ((oldName.equals(link.getName()))
1157 || (((UrlLinkTableModel) linkUrlTable.getModel())
1158 .isUniqueName(link.getName())))
1160 linkUrlTable.setValueAt(link.getName(), index, nameCol);
1161 linkUrlTable.setValueAt(link.getURL(), index, urlCol);
1166 link.notifyDuplicate();
1179 public void deleteLink_actionPerformed(ActionEvent e)
1181 int index = linkUrlTable.getSelectedRow();
1182 int modelIndex = -1;
1185 // button no longer enabled if row is not selected
1186 Cache.log.debug("Delete with no row selected in linkUrlTable");
1191 modelIndex = linkUrlTable.convertRowIndexToModel(index);
1194 // make sure we use the model index to delete, and not the table index
1195 ((UrlLinkTableModel) linkUrlTable.getModel()).removeRow(modelIndex);
1199 public void defaultBrowser_mouseClicked(MouseEvent e)
1201 // TODO: JAL-3048 not needed for j2s
1202 if (!Platform.isJS()) // BH 2019
1209 JFileChooser chooser = new JFileChooser(".");
1210 chooser.setDialogTitle(
1211 MessageManager.getString("label.select_default_browser"));
1213 int value = chooser.showOpenDialog(this);
1215 if (value == JFileChooser.APPROVE_OPTION)
1217 defaultBrowser.setText(chooser.getSelectedFile().getAbsolutePath());
1226 * jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event
1230 protected void showunconserved_actionPerformed(ActionEvent e)
1232 // TODO Auto-generated method stub
1233 super.showunconserved_actionPerformed(e);
1236 public static List<String> getGroupURLLinks()
1238 return groupURLLinks;
1242 public void minColour_actionPerformed(JPanel panel)
1244 JalviewColourChooser.showColourChooser(this,
1245 MessageManager.getString("label.select_colour_minimum_value"),
1250 public void maxColour_actionPerformed(JPanel panel)
1252 JalviewColourChooser.showColourChooser(this,
1253 MessageManager.getString("label.select_colour_maximum_value"),
1258 public void gapColour_actionPerformed(JPanel gap)
1260 if (!useLegacyGap.isSelected())
1262 JalviewColourChooser.showColourChooser(this,
1263 MessageManager.getString("label.select_gap_colour"),
1269 public void hiddenColour_actionPerformed(JPanel hidden)
1271 JalviewColourChooser.showColourChooser(this,
1272 MessageManager.getString("label.select_hidden_colour"),
1277 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1279 boolean enabled = useLegacyGap.isSelected();
1282 gapColour.setBackground(
1283 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_LEGACY_GAP);
1287 gapColour.setBackground(
1288 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP);
1290 gapColour.setEnabled(!enabled);
1291 gapLabel.setEnabled(!enabled);
1295 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1297 useLegacyGap.setSelected(false);
1298 useLegacyGaps_actionPerformed(null);
1299 showHiddenAtStart.setSelected(false);
1300 hiddenColour.setBackground(
1301 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN);
1305 protected void userIdWidth_actionPerformed()
1309 String val = userIdWidth.getText().trim();
1310 if (val.length() > 0)
1312 Integer iw = Integer.parseInt(val);
1313 if (iw.intValue() < 12)
1315 throw new NumberFormatException();
1317 userIdWidth.setText(iw.toString());
1319 } catch (NumberFormatException x)
1321 userIdWidth.setText("");
1322 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1324 .getString("warn.user_defined_width_requirements"),
1325 MessageManager.getString("label.invalid_id_column_width"),
1326 JvOptionPane.WARNING_MESSAGE);
1331 protected void autoIdWidth_actionPerformed()
1333 userIdWidth.setEnabled(!autoIdWidth.isSelected());
1334 userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
1338 * Returns true if chimera path is to a valid executable, else show an error
1341 private boolean validateChimeraPath()
1343 if (chimeraPath.getText().trim().length() > 0)
1345 File f = new File(chimeraPath.getText());
1346 if (!f.canExecute())
1348 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1349 MessageManager.getString("label.invalid_chimera_path"),
1350 MessageManager.getString("label.invalid_name"),
1351 JvOptionPane.ERROR_MESSAGE);
1359 * Returns true if the given text field contains a path to a folder that
1360 * contains an executable with the given name, else false (after showing a
1361 * warning dialog). The executable name will be tried with .exe appended if not
1367 protected boolean validateExecutablePath(JTextField textField, String executable)
1369 String folder = textField.getText().trim();
1371 if (FileUtils.getExecutable(executable, folder) != null)
1375 if (folder.length() > 0)
1377 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1378 MessageManager.formatMessage("label.executable_not_found",
1380 MessageManager.getString("label.invalid_folder"),
1381 JvOptionPane.ERROR_MESSAGE);
1387 * Checks if a file can be executed
1390 * the path to the file
1393 public boolean canExecute(String path)
1395 File file = new File(path);
1396 if (!file.canExecute())
1398 file = new File(path + ".exe");
1400 if (!file.canExecute())
1410 * If Chimera is selected, check it can be found on default or user-specified
1411 * path, if not show a warning/help dialog.
1414 protected void structureViewer_actionPerformed(String selectedItem)
1416 if (!selectedItem.equals(ViewerType.CHIMERA.name()))
1420 boolean found = false;
1423 * Try user-specified and standard paths for Chimera executable.
1425 List<String> paths = StructureManager.getChimeraPaths();
1426 paths.add(0, chimeraPath.getText());
1427 for (String path : paths)
1429 if (new File(path.trim()).canExecute())
1437 String[] options = { "OK", "Help" };
1438 int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
1439 JvSwingUtils.wrapTooltip(true,
1440 MessageManager.getString("label.chimera_missing")),
1441 "", JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE,
1442 null, options, options[0]);
1443 if (showHelp == JvOptionPane.NO_OPTION)
1447 Help.showHelpWindow(HelpId.StructureViewer);
1448 } catch (HelpSetException e)
1450 e.printStackTrace();
1457 protected void validateHmmerPath()
1459 validateExecutablePath(hmmerPath, HmmerCommand.HMMBUILD);
1463 protected void validateCygwinPath()
1465 validateExecutablePath(cygwinPath, "run");
1468 public class OptionsParam
1470 private String name;
1472 private String code;
1474 public OptionsParam(String name, String code)
1480 public String getName()
1485 public void setName(String name)
1490 public String getCode()
1495 public void setCode(String code)
1501 public String toString()
1507 public boolean equals(Object that)
1509 if (!(that instanceof OptionsParam))
1513 return this.code.equalsIgnoreCase(((OptionsParam) that).code);
1517 public int hashCode()
1519 return name.hashCode() + code.hashCode();
1523 private class UrlListSelectionHandler implements ListSelectionListener
1527 public void valueChanged(ListSelectionEvent e)
1529 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1531 int index = lsm.getMinSelectionIndex();
1534 // no selection, so disable delete/edit buttons
1535 editLink.setEnabled(false);
1536 deleteLink.setEnabled(false);
1539 int modelIndex = linkUrlTable.convertRowIndexToModel(index);
1541 // enable/disable edit and delete link buttons
1542 if (((UrlLinkTableModel) linkUrlTable.getModel())
1543 .isRowDeletable(modelIndex))
1545 deleteLink.setEnabled(true);
1549 deleteLink.setEnabled(false);
1552 if (((UrlLinkTableModel) linkUrlTable.getModel())
1553 .isRowEditable(modelIndex))
1555 editLink.setEnabled(true);
1559 editLink.setEnabled(false);