public void schemeEditorPrepare() {
        schemeEditorSetEnabled(true);
        boolean libraryCorrect = false;
        boolean schemeCorrect = false;
        ce_element.removeAll();
        ce_circuit.removeAll();
        ce_input.removeAll();
        ce_output.removeAll();
        
        try {
            libraryCorrect = library != null ? ModelingEngine.checkLibrary(library) : false;
            schemeCorrect = libraryCorrect ? scheme != null ? ModelingEngine.checkScheme(library, scheme) : false : false;
        } catch (ModelingException e) {
            MainWindow.showMessage(e.getMessage(), "Error");
            e.printStackTrace();
        }
        
        if(libraryCorrect) {
            ce_type.setItems(library.getLibrary().keySet().toArray(new String[0]));
        }
        if(schemeCorrect) {
            ce_element.setItems(scheme.getElements().keySet().toArray(new String[0]));
            ce_circuit.setItems(scheme.getCircuits().keySet().toArray(new String[0]));
            ce_circuit2.setItems(ce_circuit.getItems());
            
            for(String elementName : scheme.getElements().keySet()) {
                Element element = library.getLibrary().get(scheme.getElements().get(elementName));
                for(int n = 0; n < element.getIcnt(); n++) {
                    ce_drain.add(new Contact(elementName, n).toString());
                }
                for(int n = element.getIcnt(); n < element.getIcnt() + element.getOcnt(); n++) {
                    ce_source.add(new Contact(elementName, n).toString());
                }
            }
            
            for(String inputName : scheme.getInputs()) {
                ce_input.add(inputName);
                ce_source.add(new Contact(inputName, -1).toString());
            }
            
            for(String outputName : scheme.getOutputs()) {
                ce_output.add(outputName);
                ce_drain.add(new Contact(outputName, -1).toString());
            }
            
            Yaml yaml = new Yaml();
            ce_view.setText(yaml.dump(scheme));
            initResetBtn.setEnabled(true);
            initResetMenuItem.setEnabled(true);                    
            
        }
    }