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.AlignmentSorter;
24 import jalview.analysis.scoremodels.ScoreModels;
25 import jalview.api.StructureSelectionManagerProvider;
26 import jalview.ext.ensembl.EnsemblInfo;
27 import jalview.fts.service.pdb.PDBFTSRestClient;
28 import jalview.fts.service.uniprot.UniProtFTSRestClient;
29 import jalview.gui.Desktop;
30 import jalview.httpserver.HttpServer;
31 import jalview.io.gff.SequenceOntologyI;
32 import jalview.rest.RestHandler;
33 import jalview.structure.StructureImportSettings;
34 import jalview.structure.StructureSelectionManager;
35 import jalview.urls.IdOrgSettings;
36 import jalview.ws.SequenceFetcher;
37 import jalview.ws.jws1.Discoverer;
38 import jalview.ws.jws2.Jws2Discoverer;
39 import jalview.ws.jws2.jabaws2.Jws2InstanceFactory;
40 import jalview.ws.rest.RestClient;
41 import jalview.ws.sifts.SiftsSettings;
43 import java.awt.Color;
44 import java.util.IdentityHashMap;
47 * a class to hold singleton instances so that they are not shared
52 public class Instance {
54 private static Instance instance;
56 public static Instance getInstance()
59 @SuppressWarnings("unused")
60 ThreadGroup g = Thread.currentThread().getThreadGroup();
62 * @j2sNative i = g._instance;
69 i = instance = new Instance();
71 * @j2sNative g._instance = i;
78 * singleton instance of this class in Java only
81 public Jalview jalview;
83 public Desktop desktop;
85 public static Jalview getJalview()
87 Instance i = getInstance();
88 if (i.jalview == null)
95 public static void setJalview(Jalview j)
97 getInstance().jalview = j;
100 public static Desktop getDesktop()
102 Instance i = getInstance();
103 return (i.desktop == null ? (i.desktop = new Desktop(true))
107 public static void setDesktop(Desktop d)
109 getInstance().desktop = d;
114 public AlignmentSorter alignmentSorter;
116 public Color[] rnaHelices = null;
118 public Discoverer discoverer;
120 public EnsemblInfo ensemblInfo;
122 public HttpServer httpServer;
124 public IdOrgSettings idOrgSettings;
126 public Jws2Discoverer j2s2discoverer;
128 public Jws2InstanceFactory jws2InstanceFactory;
130 public PDBFTSRestClient pdbFTSRestClient;
132 public RestClient restClient;
134 public RestHandler restHandler;
136 public ScoreModels scoreModels;
138 public SequenceFetcher sequenceFetcher;
140 public SequenceOntologyI sequenceOntology;
142 public SiftsSettings siftsSettings;
144 public StructureImportSettings structureImportSettings;
146 public UniProtFTSRestClient uniprotFTSRestClient;
148 public IdentityHashMap<StructureSelectionManagerProvider, StructureSelectionManager> structureSelections;