use of com.ramussoft.core.impl.FileMinimumVersionException in project ramus by Vitaliy-Yakovchuk.
the class Runner method open.
public boolean open(File afile) {
JFrame frame = null;
if (afile != null)
for (FilePlugin plugin : FilePlugin.plugins) {
if ((plugin.getFile() != null) && (plugin.getFile().equals(afile))) {
frame = plugin.getFramework().getMainFrame();
break;
}
}
if (frame != null) {
frame.setVisible(true);
return false;
} else {
SplashScreen screen = null;
if (FilePlugin.plugins.size() < 1 && !Metadata.HIDE_SPLASH) {
screen = new SplashScreen() {
/**
*/
private static final long serialVersionUID = -8194442573188103621L;
@Override
protected String getImageName() {
return Runner.this.getSplashImageName();
}
};
screen.setLocationRelativeTo(null);
screen.setVisible(true);
}
try {
openFile(afile);
return true;
} catch (Exception e) {
e.printStackTrace();
if (screen != null)
screen.setVisible(false);
if (e instanceof FileMinimumVersionException) {
JOptionPane.showMessageDialog(null, MessageFormat.format(GlobalResourcesManager.getString("MinimumApplicationVersionToOpenFile"), ((FileMinimumVersionException) e).getMinimumVersion()));
} else
JOptionPane.showMessageDialog(null, e.getLocalizedMessage());
return false;
} finally {
if (FilePlugin.plugins.size() < 2) {
if (screen != null)
screen.setVisible(false);
}
}
}
}
Aggregations