import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.UrlConstants;
-import jalview.util.dialogrunner.RunResponse;
import jalview.viewmodel.AlignmentViewport;
import jalview.ws.params.ParamManager;
import jalview.ws.utils.UrlDownloadClient;
import java.util.Hashtable;
import java.util.List;
import java.util.ListIterator;
-import java.util.StringTokenizer;
import java.util.Vector;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
*/
public Desktop()
{
+ super();
/**
* A note to implementors. It is ESSENTIAL that any activities that might block
* are spawned off as threads rather than waited for during this constructor.
*/
instance = this;
- if (!Jalview.isJS())
+ if (!Platform.isJS())
{
doVamsasClientCheck();
}
// getContentPane().add(sp, BorderLayout.CENTER);
// BH 2018 - just an experiment to try unclipped JInternalFrames.
- // Must set for all three to be active:
- if (Jalview.isJS())
+ if (Platform.isJS())
{
getRootPane().putClientProperty("swingjs.overflow.hidden", "false");
- ((JComponent) getContentPane()).putClientProperty("swingjs.overflow.hidden", "false");
- desktop.putClientProperty("swingjs.overflow.hidden", "false");
}
getContentPane().add(desktop, BorderLayout.CENTER);
// This line prevents Windows Look&Feel resizing all new windows to maximum
// if previous window was maximised
desktop.setDesktopManager(new MyDesktopManager(
- (Platform.isWindows() ? new DefaultDesktopManager()
- : Platform.isAMac()
+ (Platform.isWindowsAndNotJS() ? new DefaultDesktopManager()
+ : Platform.isAMacAndNotJS()
? new AquaInternalFrameManager(
desktop.getDesktopManager())
: desktop.getDesktopManager())));
MessageManager.getString("label.open_local_file"));
chooser.setToolTipText(MessageManager.getString("action.open"));
- chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
+ chooser.setResponseHandler(0, new Runnable()
{
-
@Override
public void run()
{
new FileLoader().LoadFile(viewport, selectedFile,
DataSourceType.FILE, format);
}
- }).showOpenDialog(this);
+ });
+ chooser.showOpenDialog(this);
}
/**
*/
JComponent history;
String urlBase = "http://www.";
- if (Jalview.isJS())
+ if (Platform.isJS())
{
history = new JTextField(urlBase, 35);
}
Object[] options = new Object[] { MessageManager.getString("action.ok"),
MessageManager.getString("action.cancel") };
- RunResponse action = new RunResponse(JvOptionPane.OK_OPTION) {
+ Runnable action = new Runnable() {
@Override
public void run()
{
- String url = Jalview.isJS() ? ((JTextField) history).getText()
+ String url = Platform.isJS() ? ((JTextField) history).getText()
: ((JComboBox<String>) history).getSelectedItem()
.toString();
}};
String dialogOption = MessageManager
.getString("label.input_alignment_from_url");
- JvOptionPane.newOptionDialog(desktop).response(action)
+ JvOptionPane.newOptionDialog(desktop).setResponseHandler(0, action)
.showInternalDialog(panel, dialogOption,
JvOptionPane.YES_NO_CANCEL_OPTION,
JvOptionPane.PLAIN_MESSAGE, null, options,
{
try
{
- if (Jalview.isJS())
+ if (Platform.isJS())
{
BrowserLauncher.openURL("http://www.jalview.org/help.html");
}
"Jalview Project");
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager.getString("label.restore_state"));
- chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
+ chooser.setResponseHandler(0, new Runnable()
{
@Override
public void run()
{
File selectedFile = chooser.getSelectedFile();
setProjectFile(selectedFile);
- final String choice = selectedFile.getAbsolutePath();
+ String choice = selectedFile.getAbsolutePath();
Cache.setProperty("LAST_DIRECTORY", selectedFile.getParent());
new Thread(new Runnable()
{
}
else
{
- new jalview.project.Jalview2XML().loadJalviewAlign(choice);
+ new jalview.project.Jalview2XML().loadJalviewAlign(selectedFile);
}
} catch (OutOfMemoryError oom)
{
@Override
public void setProgressBar(String message, long id)
{
+ Platform.timeCheck("Desktop " + message, Platform.TIME_MARK);
+
if (progressBars == null)
{
progressBars = new Hashtable<>();
}
else
{
- if (Platform.isAMac())
+ if (Platform.isAMacAndNotJS())
{
System.err.println(
"Please ignore plist error - occurs due to problem with java 8 on OSX");
}
}
}
- if (Platform.isWindows())
-
+ if (Platform.isWindowsAndNotJS())
{
Cache.log.debug("Scanning dropped content for Windows Link Files");