From 57fd679367c2aee35500b9a95d9710d760360121 Mon Sep 17 00:00:00 2001 From: BobHanson Date: Tue, 2 Jun 2020 22:05:11 -0500 Subject: [PATCH] JAL-3446 from JAL-3253 Discoverers --- src/jalview/gui/AlignFrame.java | 521 ++++++++++---------- src/jalview/gui/AnnotationLabels.java | 44 +- src/jalview/gui/Desktop.java | 43 +- src/jalview/urls/IdOrgSettings.java | 31 +- src/jalview/ws/jws1/Discoverer.java | 86 +++- src/jalview/ws/jws2/Jws2Discoverer.java | 96 ++-- .../ws/jws2/jabaws2/Jws2InstanceFactory.java | 34 +- src/jalview/ws/rest/RestClient.java | 30 +- src/jalview/ws/sifts/SiftsSettings.java | 45 +- test/jalview/ws/sifts/SiftsClientTest.java | 1 - 10 files changed, 515 insertions(+), 416 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 93713d2..815b5ef 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -346,8 +346,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ void init() { -// setBackground(Color.white); // BH 2019 - + // setBackground(Color.white); // BH 2019 + if (!Jalview.isHeadlessMode()) { progressBar = new ProgressBar(this.statusPanel, this.statusBar); @@ -847,8 +847,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, javax.swing.event.InternalFrameEvent evt) { // System.out.println("deregistering discoverer listener"); - Desktop.getInstance().removeJalviewPropertyChangeListener("services", - thisListener); + Desktop.getInstance().removeJalviewPropertyChangeListener( + "services", thisListener); closeMenuItem_actionPerformed(true); } }); @@ -1242,15 +1242,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, String shortName = title; if (shortName.indexOf(File.separatorChar) > -1) { - shortName = shortName.substring( - shortName.lastIndexOf(File.separatorChar) + 1); + shortName = shortName + .substring(shortName.lastIndexOf(File.separatorChar) + 1); } - lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file, shortName); - + lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file, + shortName); + statusBar.setText(MessageManager.formatMessage( "label.successfully_saved_to_file_in_format", new Object[] { fileName, format })); - + return; } @@ -1287,16 +1288,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, BackupFiles backupfiles = doBackup ? new BackupFiles(file) : null; try { - String tempFilePath = doBackup ? backupfiles.getTempFilePath() : file; - PrintWriter out = new PrintWriter( - new FileWriter(tempFilePath)); + String tempFilePath = doBackup ? backupfiles.getTempFilePath() + : file; + PrintWriter out = new PrintWriter(new FileWriter(tempFilePath)); out.print(output); out.close(); AlignFrame.this.setTitle(file); statusBar.setText(MessageManager.formatMessage( - "label.successfully_saved_to_file_in_format", new Object[] - { fileName, format.getName() })); + "label.successfully_saved_to_file_in_format", + new Object[] + { fileName, format.getName() })); lastSaveSuccessful = true; } catch (Exception ex) { @@ -1490,7 +1492,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, final JalviewFileChooser chooser = new JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); - String tooltip = MessageManager.getString("label.load_jalview_annotations"); + String tooltip = MessageManager + .getString("label.load_jalview_annotations"); chooser.setDialogTitle(tooltip); chooser.setToolTipText(tooltip); chooser.setResponseHandler(0, new Runnable() @@ -1936,7 +1939,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, try { - jalview.gui.Desktop.internalCopy = true; + Desktop.getInstance().internalCopy = true; // Its really worth setting the clipboard contents // to empty before setting the large StringSelection!! Toolkit.getDefaultToolkit().getSystemClipboard() @@ -1963,7 +1966,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, hiddenCutoff, hiddenOffset); } - Desktop.jalviewClipboard = new Object[] { seqs, + Desktop.getInstance().jalviewClipboard = new Object[] { seqs, viewport.getAlignment().getDataset(), hiddenColumns }; setStatus(MessageManager.formatMessage( "label.copied_sequences_to_clipboard", new Object[] @@ -2003,6 +2006,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, void paste(boolean newAlignment) { boolean externalPaste = true; + Desktop d = Desktop.getInstance(); try { Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); @@ -2035,12 +2039,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, boolean annotationAdded = false; AlignmentI alignment = null; - if (Desktop.jalviewClipboard != null) + if (d.jalviewClipboard != null) { // The clipboard was filled from within Jalview, we must use the // sequences // And dataset from the copied alignment - SequenceI[] newseq = (SequenceI[]) Desktop.jalviewClipboard[0]; + SequenceI[] newseq = (SequenceI[]) d.jalviewClipboard[0]; // be doubly sure that we create *new* sequence objects. sequences = new SequenceI[newseq.length]; for (int i = 0; i < newseq.length; i++) @@ -2065,10 +2069,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (newAlignment) { - if (Desktop.jalviewClipboard != null) + if (d.jalviewClipboard != null) { // dataset is inherited - alignment.setDataset((Alignment) Desktop.jalviewClipboard[1]); + alignment.setDataset((Alignment) d.jalviewClipboard[1]); } else { @@ -2084,8 +2088,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignment = viewport.getAlignment(); alwidth = alignment.getWidth() + 1; // decide if we need to import sequences from an existing dataset - boolean importDs = Desktop.jalviewClipboard != null - && Desktop.jalviewClipboard[1] != alignment.getDataset(); + boolean importDs = d.jalviewClipboard != null + && d.jalviewClipboard[1] != alignment.getDataset(); // importDs==true instructs us to copy over new dataset sequences from // an existing alignment Vector newDs = (importDs) ? new Vector<>() : null; // used to @@ -2287,10 +2291,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, DEFAULT_HEIGHT); String newtitle = new String("Copied sequences"); - if (Desktop.jalviewClipboard != null - && Desktop.jalviewClipboard[2] != null) + if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null) { - HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; + HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2]; af.viewport.setHiddenColumns(hc); } @@ -2342,11 +2345,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, DEFAULT_HEIGHT); String newtitle = new String("Flanking alignment"); - - if (Desktop.jalviewClipboard != null - && Desktop.jalviewClipboard[2] != null) + Desktop d = Desktop.getInstance(); + if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null) { - HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; + HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2]; af.viewport.setHiddenColumns(hc); } @@ -2405,56 +2407,62 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, return; } - Runnable okAction = new Runnable() - { - @Override - public void run() - { - SequenceI[] cut = sg.getSequences() - .toArray(new SequenceI[sg.getSize()]); - - addHistoryItem(new EditCommand( - MessageManager.getString("label.cut_sequences"), Action.CUT, - cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1, - viewport.getAlignment())); - - viewport.setSelectionGroup(null); - viewport.sendSelection(); - viewport.getAlignment().deleteGroup(sg); - - viewport.firePropertyChange("alignment", null, - viewport.getAlignment().getSequences()); - if (viewport.getAlignment().getHeight() < 1) - { - try - { - AlignFrame.this.setClosed(true); - } catch (Exception ex) - { - } - } - }}; + Runnable okAction = new Runnable() + { + @Override + public void run() + { + SequenceI[] cut = sg.getSequences() + .toArray(new SequenceI[sg.getSize()]); + + addHistoryItem(new EditCommand( + MessageManager.getString("label.cut_sequences"), Action.CUT, + cut, sg.getStartRes(), + sg.getEndRes() - sg.getStartRes() + 1, + viewport.getAlignment())); + + viewport.setSelectionGroup(null); + viewport.sendSelection(); + viewport.getAlignment().deleteGroup(sg); + + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); + if (viewport.getAlignment().getHeight() < 1) + { + try + { + AlignFrame.this.setClosed(true); + } catch (Exception ex) + { + } + } + } + }; /* * If the cut affects all sequences, prompt for confirmation */ - boolean wholeHeight = sg.getSize() == viewport.getAlignment().getHeight(); + boolean wholeHeight = sg.getSize() == viewport.getAlignment() + .getHeight(); boolean wholeWidth = (((sg.getEndRes() - sg.getStartRes()) + 1) == viewport.getAlignment().getWidth()) ? true : false; - if (wholeHeight && wholeWidth) - { - JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane()); - dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION - Object[] options = new Object[] { MessageManager.getString("action.ok"), - MessageManager.getString("action.cancel") }; - dialog.showDialog(MessageManager.getString("warn.delete_all"), - MessageManager.getString("label.delete_all"), - JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null, - options, options[0]); - } else - { - okAction.run(); - } + if (wholeHeight && wholeWidth) + { + JvOptionPane dialog = JvOptionPane + .newOptionDialog(Desktop.getDesktopPane()); + dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION + Object[] options = new Object[] { + MessageManager.getString("action.ok"), + MessageManager.getString("action.cancel") }; + dialog.showDialog(MessageManager.getString("warn.delete_all"), + MessageManager.getString("label.delete_all"), + JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null, + options, options[0]); + } + else + { + okAction.run(); + } } /** @@ -2626,8 +2634,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, column, viewport.getAlignment()); } - setStatus(MessageManager - .formatMessage("label.removed_columns", new String[] + setStatus(MessageManager.formatMessage("label.removed_columns", + new String[] { Integer.valueOf(trimRegion.getSize()).toString() })); addHistoryItem(trimRegion); @@ -2676,8 +2684,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, addHistoryItem(removeGapCols); - setStatus(MessageManager - .formatMessage("label.removed_empty_columns", new Object[] + setStatus(MessageManager.formatMessage("label.removed_empty_columns", + new Object[] { Integer.valueOf(removeGapCols.getSize()).toString() })); // This is to maintain viewport position on first residue @@ -2799,8 +2807,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (viewport.getViewName() == null) { - viewport.setViewName(MessageManager - .getString("label.view_name_original")); + viewport.setViewName( + MessageManager.getString("label.view_name_original")); } /* @@ -3326,7 +3334,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JLabel textLabel = new JLabel(); textLabel.setText(content); textLabel.setBackground(Color.WHITE); - + pane = new JPanel(new BorderLayout()); ((JPanel) pane).setOpaque(true); pane.setBackground(Color.WHITE); @@ -3369,8 +3377,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } JInternalFrame frame = new JInternalFrame(); - - // BH 2019.07.26 we allow for an embedded // undecorated overview with defined size @@ -3482,8 +3488,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * otherwise set the chosen colour scheme (or null for 'None') */ ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name, - viewport, - viewport.getAlignment(), viewport.getHiddenRepSequences()); + viewport, viewport.getAlignment(), + viewport.getHiddenRepSequences()); changeColour(cs); } @@ -3867,8 +3873,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Enumeration labels = scoreSorts.keys(); while (labels.hasMoreElements()) { - addSortByAnnotScoreMenuItem(sortByAnnotScore, - labels.nextElement()); + addSortByAnnotScoreMenuItem(sortByAnnotScore, labels.nextElement()); } sortByAnnotScore.setVisible(scoreSorts.size() > 0); scoreSorts.clear(); @@ -4035,7 +4040,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, chooser.setToolTipText( MessageManager.getString("label.load_tree_file")); - chooser.setResponseHandler(0,new Runnable() + chooser.setResponseHandler(0, new Runnable() { @Override public void run() @@ -4050,7 +4055,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setCurrentTree(showNewickTree(fin, filePath).getTree()); } catch (Exception ex) { - JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), ex.getMessage(), + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), + ex.getMessage(), MessageManager .getString("label.problem_reading_tree_file"), JvOptionPane.WARNING_MESSAGE); @@ -4195,9 +4201,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, final JMenu dismenu = new JMenu("Protein Disorder"); // JAL-940 - only show secondary structure prediction services from // the legacy server + Hashtable> ds = Discoverer + .getServices(); + if (// Cache.getDefault("SHOW_JWS1_SERVICES", true) // && - Discoverer.services != null && (Discoverer.services.size() > 0)) + ds != null && (ds.size() > 0)) { // TODO: refactor to allow list of AbstractName/Handler bindings to // be @@ -4205,15 +4214,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // No MSAWS used any more: // Vector msaws = null; // (Vector) // Discoverer.services.get("MsaWS"); - Vector secstrpr = Discoverer.services - .get("SecStrPred"); + Vector secstrpr = ds.get("SecStrPred"); if (secstrpr != null) { // Add any secondary structure prediction services for (int i = 0, j = secstrpr.size(); i < j; i++) { - final ext.vamsas.ServiceHandle sh = secstrpr - .get(i); + final ext.vamsas.ServiceHandle sh = secstrpr.get(i); jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer .getServiceClient(sh); int p = secstrmenu.getItemCount(); @@ -4447,8 +4454,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, final String errorTitle = MessageManager .getString("label.implementation_error") + MessageManager.getString("label.translation_failed"); - JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle, - JvOptionPane.ERROR_MESSAGE); + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, + errorTitle, JvOptionPane.ERROR_MESSAGE); return; } if (al == null || al.getHeight() == 0) @@ -4457,8 +4464,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, "label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation"); final String errorTitle = MessageManager .getString("label.translation_failed"); - JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle, - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, + errorTitle, JvOptionPane.WARNING_MESSAGE); } else { @@ -4550,184 +4557,190 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); Transferable t = evt.getTransferable(); - final AlignFrame thisaf = this; final List files = new ArrayList<>(); List protocols = new ArrayList<>(); try { Desktop.transferFromDropTarget(files, protocols, evt, t); + if (files.size() > 0) + { + new Thread(new Runnable() + { + @Override + public void run() + { + loadDroppedFiles(files, protocols, evt, t); + } + }).start(); + } } catch (Exception e) { e.printStackTrace(); } - if (files != null) + } + + protected void loadDroppedFiles(List files, + List protocols, DropTargetDropEvent evt, + Transferable t) + { + try { - new Thread(new Runnable() + // check to see if any of these files have names matching sequences + // in + // the alignment + SequenceIdMatcher idm = new SequenceIdMatcher( + viewport.getAlignment().getSequencesArray()); + /** + * Object[] { String,SequenceI} + */ + ArrayList filesmatched = new ArrayList<>(); + ArrayList filesnotmatched = new ArrayList<>(); + for (int i = 0; i < files.size(); i++) { - @Override - public void run() + // BH 2018 + Object file = files.get(i); + String fileName = file.toString(); + String pdbfn = ""; + DataSourceType protocol = (file instanceof File + ? DataSourceType.FILE + : FormatAdapter.checkProtocol(fileName)); + if (protocol == DataSourceType.FILE) { - try + File fl; + if (file instanceof File) + { + fl = (File) file; + Platform.cacheFileData(fl); + } + else { - // check to see if any of these files have names matching sequences - // in - // the alignment - SequenceIdMatcher idm = new SequenceIdMatcher( - viewport.getAlignment().getSequencesArray()); - /** - * Object[] { String,SequenceI} - */ - ArrayList filesmatched = new ArrayList<>(); - ArrayList filesnotmatched = new ArrayList<>(); - for (int i = 0; i < files.size(); i++) + fl = new File(fileName); + } + pdbfn = fl.getName(); + } + else if (protocol == DataSourceType.URL) + { + URL url = new URL(fileName); + pdbfn = url.getFile(); + } + if (pdbfn.length() > 0) + { + // attempt to find a match in the alignment + SequenceI[] mtch = idm.findAllIdMatches(pdbfn); + int l = 0, c = pdbfn.indexOf("."); + while (mtch == null && c != -1) + { + do { - // BH 2018 - Object file = files.get(i); - String fileName = file.toString(); - String pdbfn = ""; - DataSourceType protocol = (file instanceof File - ? DataSourceType.FILE - : FormatAdapter.checkProtocol(fileName)); - if (protocol == DataSourceType.FILE) - { - File fl; - if (file instanceof File) { - fl = (File) file; - Platform.cacheFileData(fl); - } else { - fl = new File(fileName); - } - pdbfn = fl.getName(); - } - else if (protocol == DataSourceType.URL) - { - URL url = new URL(fileName); - pdbfn = url.getFile(); - } - if (pdbfn.length() > 0) - { - // attempt to find a match in the alignment - SequenceI[] mtch = idm.findAllIdMatches(pdbfn); - int l = 0, c = pdbfn.indexOf("."); - while (mtch == null && c != -1) - { - do - { - l = c; - } while ((c = pdbfn.indexOf(".", l)) > l); - if (l > -1) - { - pdbfn = pdbfn.substring(0, l); - } - mtch = idm.findAllIdMatches(pdbfn); - } - if (mtch != null) - { - FileFormatI type; - try - { - type = new IdentifyFile().identify(file, protocol); - } catch (Exception ex) - { - type = null; - } - if (type != null && type.isStructureFile()) - { - filesmatched.add(new Object[] { file, protocol, mtch }); - continue; - } - } - // File wasn't named like one of the sequences or wasn't a PDB - // file. - filesnotmatched.add(file); - } + l = c; + } while ((c = pdbfn.indexOf(".", l)) > l); + if (l > -1) + { + pdbfn = pdbfn.substring(0, l); } - int assocfiles = 0; - if (filesmatched.size() > 0) + mtch = idm.findAllIdMatches(pdbfn); + } + if (mtch != null) + { + FileFormatI type; + try { - boolean autoAssociate = Cache - .getDefault("AUTOASSOCIATE_PDBANDSEQS", false); - if (!autoAssociate) - { - String msg = MessageManager.formatMessage( - "label.automatically_associate_structure_files_with_sequences_same_name", - new Object[] - { Integer.valueOf(filesmatched.size()) - .toString() }); - String ttl = MessageManager.getString( - "label.automatically_associate_structure_files_by_name"); - int choice = JvOptionPane.showConfirmDialog(thisaf, msg, - ttl, JvOptionPane.YES_NO_OPTION); - autoAssociate = choice == JvOptionPane.YES_OPTION; - } - if (autoAssociate) - { - for (Object[] fm : filesmatched) - { - // try and associate - // TODO: may want to set a standard ID naming formalism for - // associating PDB files which have no IDs. - for (SequenceI toassoc : (SequenceI[]) fm[2]) - { - PDBEntry pe = new AssociatePdbFileWithSeq() - .associatePdbWithSeq(fm[0].toString(), - (DataSourceType) fm[1], toassoc, false, - Desktop.getInstance()); - if (pe != null) - { - System.err.println("Associated file : " - + (fm[0].toString()) + " with " - + toassoc.getDisplayId(true)); - assocfiles++; - } - } - // TODO: do we need to update overview ? only if features are - // shown I guess - alignPanel.paintAlignment(true, false); - } - } - else - { - /* - * add declined structures as sequences - */ - for (Object[] o : filesmatched) - { - filesnotmatched.add(o[0]); - } - } + type = new IdentifyFile().identify(file, protocol); + } catch (Exception ex) + { + type = null; } - if (filesnotmatched.size() > 0) + if (type != null && type.isStructureFile()) { - if (assocfiles > 0 && (Cache.getDefault( - "AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false) - || JvOptionPane.showConfirmDialog(thisaf, - "" + MessageManager.formatMessage( - "label.ignore_unmatched_dropped_files_info", - new Object[] - { Integer.valueOf( - filesnotmatched.size()) - .toString() }) - + "", - MessageManager.getString( - "label.ignore_unmatched_dropped_files"), - JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION)) - { - return; - } - for (Object fn : filesnotmatched) + filesmatched.add(new Object[] { file, protocol, mtch }); + continue; + } + } + // File wasn't named like one of the sequences or wasn't a PDB + // file. + filesnotmatched.add(file); + } + } + int assocfiles = 0; + if (filesmatched.size() > 0) + { + boolean autoAssociate = Cache.getDefault("AUTOASSOCIATE_PDBANDSEQS", + false); + if (!autoAssociate) + { + String msg = MessageManager.formatMessage( + "label.automatically_associate_structure_files_with_sequences_same_name", + new Object[] + { Integer.valueOf(filesmatched.size()).toString() }); + String ttl = MessageManager.getString( + "label.automatically_associate_structure_files_by_name"); + int choice = JvOptionPane.showConfirmDialog(this, msg, ttl, + JvOptionPane.YES_NO_OPTION); + autoAssociate = choice == JvOptionPane.YES_OPTION; + } + if (autoAssociate) + { + for (Object[] fm : filesmatched) + { + // try and associate + // TODO: may want to set a standard ID naming formalism for + // associating PDB files which have no IDs. + for (SequenceI toassoc : (SequenceI[]) fm[2]) + { + PDBEntry pe = new AssociatePdbFileWithSeq() + .associatePdbWithSeq(fm[0].toString(), + (DataSourceType) fm[1], toassoc, false, + Desktop.getInstance()); + if (pe != null) { - loadJalviewDataFile(fn, null, null, null); + System.err.println("Associated file : " + (fm[0].toString()) + + " with " + toassoc.getDisplayId(true)); + assocfiles++; } - } - } catch (Exception ex) + // TODO: do we need to update overview ? only if features are + // shown I guess + alignPanel.paintAlignment(true, false); + } + } + else + { + /* + * add declined structures as sequences + */ + for (Object[] o : filesmatched) { - ex.printStackTrace(); + filesnotmatched.add(o[0]); } } - }).start(); + } + if (filesnotmatched.size() > 0) + { + if (assocfiles > 0 && (Cache + .getDefault("AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false) + || JvOptionPane.showConfirmDialog(this, + "" + MessageManager.formatMessage( + "label.ignore_unmatched_dropped_files_info", + new Object[] + { Integer.valueOf(filesnotmatched.size()) + .toString() }) + + "", + MessageManager.getString( + "label.ignore_unmatched_dropped_files"), + JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION)) + { + return; + } + for (Object fn : filesnotmatched) + { + loadJalviewDataFile(fn, null, null, null); + } + + } + } catch (Exception ex) + { + ex.printStackTrace(); } } @@ -4924,7 +4937,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } - /** * Method invoked by the ChangeListener on the tabbed pane, in other words * when a different tabbed pane is selected by the user or programmatically. @@ -5868,6 +5880,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } private Rectangle lastFeatureSettingsBounds = null; + @Override public void setFeatureSettingsGeometry(Rectangle bounds) { @@ -5908,8 +5921,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { jalview.api.FeatureRenderer fr = null; if (alignPanel != null - && (fr = alignPanel - .getFeatureRenderer()) != null) + && (fr = alignPanel.getFeatureRenderer()) != null) { List gps = fr.getGroups(visible); String[] _gps = gps.toArray(new String[gps.size()]); @@ -5941,7 +5953,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignPanel.getSeqPanel().selection(sel, csel, hidden, null); } - } class PrintThread extends Thread diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 27dcebf..c843f37 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -20,21 +20,6 @@ */ package jalview.gui; -import jalview.analysis.AlignSeq; -import jalview.analysis.AlignmentUtils; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.Annotation; -import jalview.datamodel.HiddenColumns; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.io.FileFormat; -import jalview.io.FormatAdapter; -import jalview.util.Comparison; -import jalview.util.MessageManager; -import jalview.util.Platform; - import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; @@ -62,6 +47,21 @@ import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; +import jalview.analysis.AlignSeq; +import jalview.analysis.AlignmentUtils; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.Annotation; +import jalview.datamodel.HiddenColumns; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.io.FileFormat; +import jalview.io.FormatAdapter; +import jalview.util.Comparison; +import jalview.util.MessageManager; +import jalview.util.Platform; + /** * The panel that holds the labels for alignment annotations, providing * tooltips, context menus, drag to reorder rows, and drag to adjust panel @@ -981,20 +981,12 @@ public class AnnotationLabels extends JPanel av.getAlignment().getHiddenColumns()); } - Desktop.jalviewClipboard = new Object[] { seqs, ds, // what is the dataset - // of a consensus - // sequence ? need to - // flag - // sequence as special. + // what is the dataset of a consensus sequence? + // need to flag sequence as special. + Desktop.getInstance().jalviewClipboard = new Object[] { seqs, ds, hiddenColumns }; } - /** - * DOCUMENT ME! - * - * @param g1 - * DOCUMENT ME! - */ @Override public void paintComponent(Graphics g) { diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 5df48a2..68313e1 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -235,19 +235,19 @@ public class Desktop extends GDesktop .getStructureSelectionManager(getInstance()); } - static int openFrameCount = 0; + int openFrameCount = 0; - static final int xOffset = 30; + final int xOffset = 30; - static final int yOffset = 30; + final int yOffset = 30; - public static jalview.ws.jws1.Discoverer discoverer; + public jalview.ws.jws1.Discoverer discoverer; - public static Object[] jalviewClipboard; + public Object[] jalviewClipboard; - public static boolean internalCopy = false; + public boolean internalCopy = false; - static int fileLoadingCount = 0; + int fileLoadingCount = 0; class MyDesktopManager implements DesktopManager { @@ -851,16 +851,21 @@ public class Desktop extends GDesktop final JInternalFrame frame, String title, boolean makeVisible, int w, int h, boolean resizable, boolean ignoreMinSize) { + + getInstance().addFrame(frame, title, makeVisible, w, h, resizable, ignoreMinSize); + } + + private void addFrame(JInternalFrame frame, String title, + boolean makeVisible, int w, int h, boolean resizable, + boolean ignoreMinSize) + { + // TODO: allow callers to determine X and Y position of frame (eg. via + // bounds object). + // TODO: consider fixing method to update entries in the window submenu with + // the current window title - - - // TODO: allow callers to determine X and Y position of frame (eg. via - // bounds object). - // TODO: consider fixing method to update entries in the window submenu with - // the current window title - - frame.setTitle(title); - if (frame.getWidth() < 1 || frame.getHeight() < 1) + frame.setTitle(title); + if (frame.getWidth() < 1 || frame.getHeight() < 1) { frame.setSize(w, h); } @@ -995,7 +1000,6 @@ public class Desktop extends GDesktop */ private static void setKeyBindings(JInternalFrame frame) { - @SuppressWarnings("serial") final Action closeAction = new AbstractAction() { @Override @@ -2667,7 +2671,7 @@ public class Desktop extends GDesktop // todo: changesupport handlers need to be transferred if (discoverer == null) { - discoverer = new jalview.ws.jws1.Discoverer(); + discoverer = jalview.ws.jws1.Discoverer.getInstance(); // register PCS handler for desktop. discoverer.addPropertyChangeListener(changeSupport); } @@ -3142,6 +3146,7 @@ public class Desktop extends GDesktop * - the payload from the drop event * @throws Exception */ + @SuppressWarnings("unchecked") public static void transferFromDropTarget(List files, List protocols, DropTargetDropEvent evt, Transferable t) throws Exception @@ -3213,7 +3218,7 @@ public class Desktop extends GDesktop { // Works on Windows and MacOSX Cache.log.debug("Drop handled as javaFileListFlavor"); - for (Object file : (List) t + for (File file : (List) t .getTransferData(DataFlavor.javaFileListFlavor)) { files.add(file); diff --git a/src/jalview/urls/IdOrgSettings.java b/src/jalview/urls/IdOrgSettings.java index 7dd1a19..cd7e98e 100644 --- a/src/jalview/urls/IdOrgSettings.java +++ b/src/jalview/urls/IdOrgSettings.java @@ -21,35 +21,46 @@ package jalview.urls; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; + /** * Holds settings for identifiers.org e.g. url, download location - * - * @author $author$ - * @version $Revision$ */ -public class IdOrgSettings +public class IdOrgSettings implements ApplicationSingletonI { - private static String url; + private String url; - private static String location; + private String location; + + private static IdOrgSettings getInstance() + { + return (IdOrgSettings) ApplicationSingletonProvider + .getInstance(IdOrgSettings.class); + } public static void setUrl(String seturl) { - url = seturl; + getInstance().url = seturl; } public static void setDownloadLocation(String setloc) { - location = setloc; + getInstance().location = setloc; } public static String getUrl() { - return url; + return getInstance().url; } public static String getDownloadLocation() { - return location; + return getInstance().location; + } + + private IdOrgSettings() + { + // private singleton } } diff --git a/src/jalview/ws/jws1/Discoverer.java b/src/jalview/ws/jws1/Discoverer.java index ec8c89c..6aa3f48 100644 --- a/src/jalview/ws/jws1/Discoverer.java +++ b/src/jalview/ws/jws1/Discoverer.java @@ -20,11 +20,15 @@ */ package jalview.ws.jws1; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; +import jalview.gui.AlignmentPanel; import jalview.gui.JvOptionPane; import jalview.util.MessageManager; import java.net.URL; import java.util.Hashtable; +import java.util.List; import java.util.StringTokenizer; import java.util.Vector; @@ -34,8 +38,19 @@ import ext.vamsas.RegistryServiceSoapBindingStub; import ext.vamsas.ServiceHandle; import ext.vamsas.ServiceHandles; -public class Discoverer implements Runnable +public class Discoverer implements Runnable, ApplicationSingletonI { + + public static Discoverer getInstance() + { + return (Discoverer) ApplicationSingletonProvider.getInstance(Discoverer.class); + } + + private Discoverer() + { + // use getInstance() + } + ext.vamsas.IRegistry registry; // the root registry service. private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport( @@ -110,20 +125,24 @@ public class Discoverer implements Runnable return server; } - static private java.net.URL RootServiceURL = null; + private java.net.URL RootServiceURL = null; - static public Vector ServiceURLList = null; + private Vector ServiceURLList = null; - static private boolean reallyDiscoverServices = true; + public Vector getServiceURLList() { + return ServiceURLList; + } + + private boolean reallyDiscoverServices = true; - public static java.util.Hashtable> services = null; + private java.util.Hashtable> services = null; // stored by // abstractServiceType // string - public static java.util.Vector serviceList = null; + public java.util.Vector serviceList = null; - static private Vector getDiscoveryURLS() + private Vector getDiscoveryURLS() { Vector urls = new Vector<>(); String RootServiceURLs = jalview.bin.Cache.getDefault("DISCOVERY_URLS", @@ -176,10 +195,16 @@ public class Discoverer implements Runnable */ static public void doDiscovery() { + getInstance().discovery(); + } + + private void discovery() + { jalview.bin.Cache.log .debug("(Re)-Initialising the discovery URL list."); try { + Discoverer d = getInstance(); reallyDiscoverServices = jalview.bin.Cache .getDefault("DISCOVERY_START", false); if (reallyDiscoverServices) @@ -284,7 +309,7 @@ public class Discoverer implements Runnable * Hashtable * @return boolean */ - static private boolean buildServiceLists(ServiceHandle[] sh, + private boolean buildServiceLists(ServiceHandle[] sh, Vector cat, Hashtable> sscat) { @@ -395,10 +420,32 @@ public class Discoverer implements Runnable /** * binding service abstract name to handler class */ - private static Hashtable serviceClientBindings; + private Hashtable serviceClientBindings; public static WS1Client getServiceClient(ServiceHandle sh) { + return getInstance().getClient(sh); + } + + /** + * notes on discovery service 1. need to allow multiple discovery source urls. + * 2. user interface to add/control list of urls in preferences notes on + * wsclient discovery 1. need a classpath property with list of additional + * plugin directories 2. optional config to cite specific bindings between + * class name and Abstract service name. 3. precedence for automatic discovery + * by using getAbstractName for WSClient - user added plugins override default + * plugins ? notes on wsclient gui code for gui attachment now moved to + * wsclient implementation. Needs more abstraction but approach seems to work. + * is it possible to 'generalise' the data retrieval calls further ? current + * methods are very specific (gatherForMSA or gatherForSeqOrMsaSecStrPred), + * new methods for conservation (group or alignment), treecalc (aligned + * profile), seqannot (sequences selected from dataset, annotation back to + * dataset). + * + */ + + private WS1Client getClient(ServiceHandle sh) + { if (serviceClientBindings == null) { // get a list from Config or create below @@ -421,20 +468,9 @@ public class Discoverer implements Runnable } return instance; } - /** - * notes on discovery service 1. need to allow multiple discovery source urls. - * 2. user interface to add/control list of urls in preferences notes on - * wsclient discovery 1. need a classpath property with list of additional - * plugin directories 2. optional config to cite specific bindings between - * class name and Abstract service name. 3. precedence for automatic discovery - * by using getAbstractName for WSClient - user added plugins override default - * plugins ? notes on wsclient gui code for gui attachment now moved to - * wsclient implementation. Needs more abstraction but approach seems to work. - * is it possible to 'generalise' the data retrieval calls further ? current - * methods are very specific (gatherForMSA or gatherForSeqOrMsaSecStrPred), - * new methods for conservation (group or alignment), treecalc (aligned - * profile), seqannot (sequences selected from dataset, annotation back to - * dataset). - * - */ + + public static Hashtable> getServices() + { + return getInstance().services; + } } diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index c3b0b30..255ef8f 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -21,6 +21,8 @@ package jalview.ws.jws2; import jalview.bin.Cache; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; @@ -60,19 +62,9 @@ import compbio.ws.client.Services; * @author JimP * */ -public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI +public class Jws2Discoverer + implements Runnable, WSMenuEntryProviderI, ApplicationSingletonI { - public static final String COMPBIO_JABAWS = "http://www.compbio.dundee.ac.uk/jabaws"; - - /* - * the .jalview_properties entry for JWS2 URLS - */ - private final static String JWS2HOSTURLS = "JWS2HOSTURLS"; - - /* - * Singleton instance - */ - private static Jws2Discoverer discoverer; /** * Returns the singleton instance of this class. @@ -81,22 +73,34 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI */ public static Jws2Discoverer getInstance() { - if (discoverer == null) - { - discoverer = new Jws2Discoverer(); - } - return discoverer; + return (Jws2Discoverer) ApplicationSingletonProvider + .getInstance(Jws2Discoverer.class); + } + + /** + * Private constructor enforces use of singleton via getDiscoverer() + */ + private Jws2Discoverer() + { + // use getInstance(); } + public static final String COMPBIO_JABAWS = "http://www.compbio.dundee.ac.uk/jabaws"; + + /* + * the .jalview_properties entry for JWS2 URLS + */ + private final static String JWS2HOSTURLS = "JWS2HOSTURLS"; + /* * Override for testing only */ - private static List testUrls = null; + private List testUrls = null; // preferred url has precedence over others private String preferredUrl; - private PropertyChangeSupport changeSupport = new PropertyChangeSupport( + protected PropertyChangeSupport changeSupport = new PropertyChangeSupport( this); private Vector invalidServiceUrls = null; @@ -117,13 +121,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI protected Vector services; /** - * Private constructor enforces use of singleton via getDiscoverer() - */ - private Jws2Discoverer() - { - } - - /** * change listeners are notified of "services" property changes * * @param listener @@ -204,7 +201,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI oldthread = Thread.currentThread(); try { - Class foo = getClass().getClassLoader() + getClass().getClassLoader() .loadClass("compbio.ws.client.Jws2Client"); } catch (ClassNotFoundException e) { @@ -597,36 +594,36 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI */ public static void main(String[] args) { + Jws2Discoverer instance = getInstance(); if (args.length > 0) { - testUrls = new ArrayList<>(); + instance.testUrls = new ArrayList<>(); for (String url : args) { - testUrls.add(url); + instance.testUrls.add(url); } } - Thread runner = getInstance() - .startDiscoverer(new PropertyChangeListener() - { + Thread runner = instance.startDiscoverer(new PropertyChangeListener() + { - @Override - public void propertyChange(PropertyChangeEvent evt) - { - if (getInstance().services != null) - { - System.out.println("Changesupport: There are now " - + getInstance().services.size() + " services"); - int i = 1; - for (Jws2Instance instance : getInstance().services) - { - System.out.println("Service " + i++ + " " - + instance.getClass() + "@" + instance.getHost() - + ": " + instance.getActionText()); - } + @Override + public void propertyChange(PropertyChangeEvent evt) + { + if (getInstance().services != null) + { + System.out.println("Changesupport: There are now " + + getInstance().services.size() + " services"); + int i = 1; + for (Jws2Instance instance : getInstance().services) + { + System.out.println("Service " + i++ + " " + instance.getClass() + + "@" + instance.getHost() + ": " + + instance.getActionText()); + } - } - } - }); + } + } + }); while (runner.isAlive()) { try @@ -644,7 +641,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI } } - public boolean hasServices() { return !running && services != null && services.size() > 0; diff --git a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java index 623b8de..1983ff5 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java @@ -20,6 +20,8 @@ */ package jalview.ws.jws2.jabaws2; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; import jalview.ws.jws2.AAConClient; import jalview.ws.jws2.RNAalifoldClient; import jalview.ws.uimodel.AlignAnalysisUIText; @@ -29,11 +31,23 @@ import java.util.HashSet; import compbio.data.msa.JABAService; -public class Jws2InstanceFactory +public class Jws2InstanceFactory implements ApplicationSingletonI { - private static HashMap aaConGUI; - private static HashSet ignoreGUI; + private Jws2InstanceFactory() + { + // private singleton + } + + private static Jws2InstanceFactory getInstance() + { + return (Jws2InstanceFactory) ApplicationSingletonProvider + .getInstance(Jws2InstanceFactory.class); + } + + private HashMap aaConGUI; + + private HashSet ignoreGUI; private static String category_rewrite(String cat_name) { @@ -42,17 +56,17 @@ public class Jws2InstanceFactory : cat_name; } - private static void init() + private void init() { if (aaConGUI == null) { - aaConGUI = new HashMap(); + aaConGUI = new HashMap<>(); aaConGUI.put(compbio.ws.client.Services.AAConWS.toString(), AAConClient.getAlignAnalysisUITest()); aaConGUI.put(compbio.ws.client.Services.RNAalifoldWS.toString(), RNAalifoldClient.getAlignAnalysisUITest()); // ignore list for JABAWS services not supported in jalview ... - ignoreGUI = new HashSet(); + ignoreGUI = new HashSet<>(); } } @@ -65,8 +79,8 @@ public class Jws2InstanceFactory */ public static boolean ignoreService(String serviceType) { - init(); - return (ignoreGUI.contains(serviceType.toString())); + getInstance().init(); + return (getInstance().ignoreGUI.contains(serviceType.toString())); } /** @@ -84,10 +98,10 @@ public class Jws2InstanceFactory String serviceType, String name, String description, JABAService service) { - init(); + getInstance().init(); Jws2Instance svc = new Jws2Instance(jwsservers, serviceType, category_rewrite(name), description, service); - svc.aaui = aaConGUI.get(serviceType.toString()); + svc.aaui = getInstance().aaConGUI.get(serviceType.toString()); return svc; } diff --git a/src/jalview/ws/rest/RestClient.java b/src/jalview/ws/rest/RestClient.java index 08f137d..eea6474 100644 --- a/src/jalview/ws/rest/RestClient.java +++ b/src/jalview/ws/rest/RestClient.java @@ -20,6 +20,8 @@ */ package jalview.ws.rest; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; import jalview.bin.Cache; import jalview.datamodel.AlignmentView; import jalview.gui.AlignFrame; @@ -49,8 +51,20 @@ import javax.swing.event.MenuListener; * */ public class RestClient extends WSClient - implements WSClientI, WSMenuEntryProviderI +implements WSClientI, WSMenuEntryProviderI, ApplicationSingletonI { + +private static RestClient getInstance() +{ +return (RestClient) ApplicationSingletonProvider.getInstance(RestClient.class); +} + +public static final String RSBS_SERVICES = "RSBS_SERVICES"; + + + protected Vector services = null; + + RestServiceDescription service; public RestClient(RestServiceDescription rsd) @@ -399,12 +413,13 @@ public class RestClient extends WSClient return true; } - protected static Vector services = null; - - public static final String RSBS_SERVICES = "RSBS_SERVICES"; - public static RestClient[] getRestClients() { + return getInstance().getClients(); + } + + private RestClient[] getClients() + { if (services == null) { services = new Vector(); @@ -458,10 +473,11 @@ public class RestClient extends WSClient { if (rsbsUrls != null) { + // TODO: consider validating services ? - services = new Vector(rsbsUrls); + getInstance().services = new Vector(rsbsUrls); StringBuffer sprop = new StringBuffer(); - for (String s : services) + for (String s : getInstance().services) { sprop.append(s); } diff --git a/src/jalview/ws/sifts/SiftsSettings.java b/src/jalview/ws/sifts/SiftsSettings.java index 5e2c526..a042bb9 100644 --- a/src/jalview/ws/sifts/SiftsSettings.java +++ b/src/jalview/ws/sifts/SiftsSettings.java @@ -20,59 +20,78 @@ */ package jalview.ws.sifts; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; + import java.util.Objects; -public class SiftsSettings +public class SiftsSettings implements ApplicationSingletonI { - private static boolean mapWithSifts = false; + /** + * Constructor + * + * @return + */ + private static SiftsSettings getInstance() + { + return (SiftsSettings) ApplicationSingletonProvider + .getInstance(SiftsSettings.class); + } + + private SiftsSettings() + { + // singleton; use getInstance() + } + + private boolean mapWithSifts = false; - private static String siftDownloadDirectory; + private String siftDownloadDirectory; - private static int cacheThresholdInDays; + private int cacheThresholdInDays; - private static int failSafePIDThreshold; + private int failSafePIDThreshold; public static boolean isMapWithSifts() { - return mapWithSifts; + return getInstance().mapWithSifts; } public static void setMapWithSifts(boolean mapWithSifts) { - SiftsSettings.mapWithSifts = mapWithSifts; + getInstance().mapWithSifts = mapWithSifts; } public static String getSiftDownloadDirectory() { - return siftDownloadDirectory; + return getInstance().siftDownloadDirectory; } public static void setSiftDownloadDirectory(String siftDownloadDirectory) { - SiftsSettings.siftDownloadDirectory = siftDownloadDirectory; + getInstance().siftDownloadDirectory = siftDownloadDirectory; } public static int getCacheThresholdInDays() { - return cacheThresholdInDays; + return getInstance().cacheThresholdInDays; } public static void setCacheThresholdInDays(String cacheThresholdInDays) { Objects.requireNonNull(cacheThresholdInDays); - SiftsSettings.cacheThresholdInDays = Integer + getInstance().cacheThresholdInDays = Integer .valueOf(cacheThresholdInDays); } public static int getFailSafePIDThreshold() { - return failSafePIDThreshold; + return getInstance().failSafePIDThreshold; } public static void setFailSafePIDThreshold(String failSafePIDThreshold) { Objects.requireNonNull(failSafePIDThreshold); - SiftsSettings.failSafePIDThreshold = Integer + getInstance().failSafePIDThreshold = Integer .valueOf(failSafePIDThreshold); } } diff --git a/test/jalview/ws/sifts/SiftsClientTest.java b/test/jalview/ws/sifts/SiftsClientTest.java index 6122d6d..f661bde 100644 --- a/test/jalview/ws/sifts/SiftsClientTest.java +++ b/test/jalview/ws/sifts/SiftsClientTest.java @@ -189,7 +189,6 @@ public class SiftsClientTest Cache.loadProperties("test/jalview/io/testProps.jvprops"); // SIFTs entries are updated weekly - so use saved SIFTs file to enforce // test reproducibility - new SiftsSettings(); SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache.getDefault( "sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR)); SiftsSettings.setMapWithSifts(true); -- 1.7.10.2