this.putValue(Action.SHORT_DESCRIPTION, CySBML.NAME + " Import SBML");
}
public void actionPerformed(ActionEvent e) {
// open new dialog
ImportNetworkDialog fd = null;
try {
fd = new ImportNetworkDialog(Cytoscape.getDesktop(), true);
} catch (JAXBException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
fd.pack();
fd.setLocationRelativeTo(Cytoscape.getDesktop());
fd.setVisible(true);
if (fd.getStatus() == false) {
return;
}
if (fd.isRemote()) {
String URLstr = fd.getURLStr();
try {
LoadNetworkTask.loadURL(new URL(URLstr), false);
} catch (MalformedURLException e3) {
JOptionPane.showMessageDialog(fd, "URL error!", "Warning",
JOptionPane.INFORMATION_MESSAGE);
}
} else {
final File[] files = fd.getFiles();
boolean skipMessage = false;
if ((files != null) && (files.length != 0)) {
if (files.length != 1) {
skipMessage = true;
}
List<String> messages = new ArrayList<String>();
messages.add("Successfully loaded the following files:");
messages.add(" ");
for (int i = 0; i < files.length; i++) {
if (fd.isRemote() == true) {
messages.add(fd.getURLStr());
} else {
messages.add(files[i].getName());
}
LoadNetworkTask.loadFile(files[i], skipMessage);