import jalview.json.binding.biojson.v1.ColourSchemeMapper;
import jalview.project.Jalview2XML;
import jalview.schemes.ColourSchemeI;
+import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.ws.utils.UrlDownloadClient;
@Override
public void run()
{
+
+
String title = protocol == DataSourceType.PASTE
? "Copied From Clipboard"
: file;
format = new IdentifyFile().identify(source, false);
// identify stream and rewind rather than close
}
- else if (selectedFile != null) {
+ else if (selectedFile != null)
+ {
format = new IdentifyFile().identify(selectedFile, protocol);
}
else
}
return;
}
+
// TODO: cache any stream datasources as a temporary file (eg. PDBs
// retrieved via URL)
- if (Desktop.getDesktopPane() != null && Desktop.getDesktopPane().isShowMemoryUsage())
+ if (Desktop.getDesktopPane() != null
+ && Desktop.getDesktopPane().isShowMemoryUsage())
{
System.gc();
memused = (rt.maxMemory() - rt.totalMemory() + rt.freeMemory()); // free
}
// BH 2018 switch to File object here instead of filename
Platform.timeCheck(null, Platform.TIME_MARK);
- alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign(selectedFile == null ? file : selectedFile);
+ alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign(
+ selectedFile == null ? file : selectedFile);
Platform.timeCheck("JVP loaded", Platform.TIME_MARK);
}
file.lastIndexOf("."));
String tempStructureFileStr = createNamedJvTempFile(
urlLeafName, structExt);
-
+
// BH - switching to File object here so as to hold
// .秘bytes array directly
File tempFile = new File(tempStructureFileStr);
UrlDownloadClient.download(file, tempFile);
-
- al = fa.readFile(tempFile, DataSourceType.FILE,
- format);
+
+ al = fa.readFile(tempFile, DataSourceType.FILE, format);
source = fa.getAlignFile();
}
else
{
- if (selectedFile == null) {
+ if (selectedFile == null)
+ {
al = fa.readFile(file, protocol, format);
-
- } else {
+
+ }
+ else
+ {
al = fa.readFile(selectedFile, protocol, format);
- }
+ }
source = fa.getAlignFile(); // keep reference for later if
-
- // necessary.
+
+ // necessary.
}
}
} catch (java.io.IOException ex)
error = ex.getMessage();
}
+ System.out.println("OK1");
+
+
if ((al != null) && (al.getHeight() > 0) && al.hasValidSequence())
{
+
+
// construct and register dataset sequences
+
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.getInstance());
for (SequenceI sq : al.getSequences())
{
while (sq.getDatasetSequence() != null)
{
// register PDB entries with desktop's structure selection
// manager
- Desktop.getInstance().getStructureSelectionManager()
- .registerPDBEntry(pdbe);
+ ssm.registerPDBEntry(pdbe);
}
}
}
FeatureSettingsModelI proxyColourScheme = source
.getFeatureColourScheme();
+
if (viewport != null)
{
+
if (proxyColourScheme != null)
{
viewport.applyFeaturesStyle(proxyColourScheme);
}
else
{
+
+ System.out.println("OK9");
// otherwise construct the alignFrame
if (source instanceof ComplexAlignFile)
.getGlobalColourScheme();
FeaturesDisplayedI fd = ((ComplexAlignFile) source)
.getDisplayedFeatures();
+
alignFrame = new AlignFrame(al, hiddenSeqs, colSel,
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+
alignFrame.getViewport().setFeaturesDisplayed(fd);
alignFrame.getViewport().setShowSequenceFeatures(
((ComplexAlignFile) source).isShowSeqFeatures());
}
else
{
- alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
+
+ // Headless start fails here in Windows
+
+ // Sorry, no JInternalFrame when headless, at least in Windows.
+ // Not clear why that would be, since an InternalFrame is not a
+ // top-level component. But maybe it is
+
+ System.out.println("FileLoader test1");
+
+ try
+ {
+ //
+ alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+
+ System.out.println("FileLoader test2");
+
+ } catch (Throwable t)
+ {
+ System.out.println(t);
+ t.printStackTrace();
+ }
+
if (source instanceof FeaturesSourceI)
{
+
+ System.out.println("FileLoader test3");
+
alignFrame.getViewport().setShowSequenceFeatures(true);
}
}
// add metadata and update ui
+
+ System.out.println("FileLoader test4");
+
if (!(protocol == DataSourceType.PASTE))
{
+
+ System.out.println("FileLoader test5");
alignFrame.setFileName(file, format);
alignFrame.setFileObject(selectedFile); // BH 2018 SwingJS
}
+
+ System.out.println("FileLoader test6");
+
if (proxyColourScheme != null)
{
alignFrame.getViewport()
.applyFeaturesStyle(proxyColourScheme);
}
+
+ System.out.println("FileLoader test7");
+
alignFrame.setStatus(MessageManager.formatMessage(
"label.successfully_loaded_file", new String[]
{ title }));
+ System.out.println("FileLoader test8" + raiseGUI);
if (raiseGUI)
{
// add the window to the GUI
}
else
{
+
+ System.out.println("OK10");
+
if (Desktop.getInstance() != null)
{
Desktop.getInstance().stopLoading();
"label.couldnt_load_file") + " " + title + "\n" + error;
// TODO: refactor FileLoader to be independent of Desktop / Applet GUI
// bits ?
- if (raiseGUI && Desktop.getDesktopPane() != null)
+ if (raiseGUI)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
- JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
- errorMessage,
+ JvOptionPane.showInternalMessageDialog(
+ Desktop.getDesktopPane(), errorMessage,
MessageManager
.getString("label.error_loading_file"),
JvOptionPane.WARNING_MESSAGE);
}
}
+
updateRecentlyOpened();
} catch (Exception er)
}
loadtime += System.currentTimeMillis();
+
// TODO: Estimate percentage of memory used by a newly loaded alignment -
// warn if more memory will be needed to work with it
// System.gc();
// memory
// after
// load
- if (Desktop.getDesktopPane() != null && Desktop.getDesktopPane().isShowMemoryUsage())
+ if (Desktop.getDesktopPane() != null
+ && Desktop.getDesktopPane().isShowMemoryUsage())
{
if (alignFrame != null)
{