jfc.showDialog(this, "Load");
int retval = jfc.showDialog(this, "Load");
    private void openItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openItemActionPerformed        // Present the user with a file chooser                File selectedFile;        Model m = null;                JFileChooser jfc = new JFileChooser(workingDirectory);        jfc.setFileFilter( new FileFilter() {            public boolean accept( File f ) {                return f.isDirectory() || f.getName().endsWith( ".lem" );            }                        public String getDescription() {                return "LEM model files (*.lem)";            }        } );                jfc.setCurrentDirectory(workingDirectory);                jfc.showDialog(this, "Load");                selectedFile = jfc.getSelectedFile();        if( selectedFile != null ) {            try {                m = loadModel( selectedFile );                if( m != null ) {                    models.add( m );                    JOptionPane.showMessageDialog( this, "Model loaded successfully.", "Success!",                             JOptionPane.INFORMATION_MESSAGE );                    workingDirectory = jfc.getSelectedFile().getParentFile();                    getContentPane().remove(MTP);                    MTP = new ModelTreePanel(m);                    getContentPane().add(MTP, BorderLayout.CENTER);                    try{                        ObjectOutputStream Out = new ObjectOutputStream(new FileOutputStream(System.getProperty("user.home")+"/"+"WorkSpace.dat"));                        Out.writeObject(new WorkSpace(workingDirectory.getAbsolutePath()));                        Out.close();                    } catch (FileNotFoundException ex){                    }                                    }            } catch( FileNotFoundException fnfe ) {                JOptionPane.showMessageDialog( this, "Could not open the model file: " + fnfe.getMessage(),                        "File not found", JOptionPane.ERROR_MESSAGE );            } catch( ParseException pe ) {                JOptionPane.showMessageDialog( this, "There was an error in parsing the given model: " + pe.getMessage(),                        "Parse error", JOptionPane.ERROR_MESSAGE );                            } catch( LemException le ) {                JOptionPane.showMessageDialog( this, "There was an error in parsing the given model: " + le.getMessage(),                        "Parse error", JOptionPane.ERROR_MESSAGE );            } catch( IOException ioe ) {                JOptionPane.showMessageDialog( this, "An input/output error occured while trying to read the model: " + ioe.getMessage(),                        "Read error", JOptionPane.ERROR_MESSAGE );            }                    }                setVisible(true);        /*        metamodel.Procedure p = m.getDomain( "Publications" ).getClass( "Manuscript" ).getStateMachine().getState("Adding").getProcedure();        runtime.ModelInstance i = new runtime.ModelInstance();                p.execute(i); */                    }//GEN-LAST:event_openItemActionPerformed