Search in sources :

Example 1 with FileMinimumVersionException

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);
            }
        }
    }
}
Also used : JFrame(javax.swing.JFrame) FileMinimumVersionException(com.ramussoft.core.impl.FileMinimumVersionException) SplashScreen(com.ramussoft.gui.common.SplashScreen) ZipException(java.util.zip.ZipException) FileMinimumVersionException(com.ramussoft.core.impl.FileMinimumVersionException) IOException(java.io.IOException)

Aggregations

FileMinimumVersionException (com.ramussoft.core.impl.FileMinimumVersionException)1 SplashScreen (com.ramussoft.gui.common.SplashScreen)1 IOException (java.io.IOException)1 ZipException (java.util.zip.ZipException)1 JFrame (javax.swing.JFrame)1