Search in sources :

Example 6 with LoadFailedException

use of com.cburch.logisim.file.LoadFailedException in project logisim-evolution by reds-heig.

the class ProjectActions method createNewFile.

public static LogisimFile createNewFile(Project baseProject) {
    Loader loader = new Loader(baseProject == null ? null : baseProject.getFrame());
    InputStream templReader = AppPreferences.getTemplate().createStream();
    LogisimFile file;
    try {
        file = loader.openLogisimFile(templReader);
    } catch (IOException ex) {
        displayException(baseProject.getFrame(), ex);
        file = createEmptyFile(loader, baseProject);
    } catch (LoadFailedException ex) {
        if (!ex.isShown()) {
            displayException(baseProject.getFrame(), ex);
        }
        file = createEmptyFile(loader, baseProject);
    } finally {
        try {
            templReader.close();
        } catch (IOException e) {
        }
    }
    return file;
}
Also used : LogisimFile(com.cburch.logisim.file.LogisimFile) InputStream(java.io.InputStream) Loader(com.cburch.logisim.file.Loader) IOException(java.io.IOException) LoadFailedException(com.cburch.logisim.file.LoadFailedException)

Aggregations

LoadFailedException (com.cburch.logisim.file.LoadFailedException)6 Loader (com.cburch.logisim.file.Loader)6 LogisimFile (com.cburch.logisim.file.LogisimFile)5 IOException (java.io.IOException)4 File (java.io.File)3 Project (com.cburch.logisim.proj.Project)2 InputStream (java.io.InputStream)2 Circuit (com.cburch.logisim.circuit.Circuit)1 CircuitState (com.cburch.logisim.circuit.CircuitState)1 LoadedLibrary (com.cburch.logisim.file.LoadedLibrary)1 Frame (com.cburch.logisim.gui.main.Frame)1 Print (com.cburch.logisim.gui.main.Print)1 LogisimMenuBar (com.cburch.logisim.gui.menu.LogisimMenuBar)1 Instance (com.cburch.logisim.instance.Instance)1 Library (com.cburch.logisim.tools.Library)1 FileNotFoundException (java.io.FileNotFoundException)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1