Package com.cburch.logisim.tools

Examples of com.cburch.logisim.tools.Library


        }
        return elt;
    }

    Element fromTool(Tool tool) {
        Library lib = findLibrary(tool);
        String lib_name;
        if (lib == null) {
            loader.showError(String.format("tool `%s' not found",
                tool.getDisplayName()));
            return null;
View Full Code Here


        return ret;
    }

    Element fromComponent(Component comp) {
        ComponentFactory source = comp.getFactory();
        Library lib = findLibrary(source);
        String lib_name;
        if (lib == null) {
            loader.showError(source.getName() + " component not found");
            return null;
        } else if (lib == file) {
View Full Code Here

                sourceVersion = LogisimVersion.parse(versionString);
            }

            // first, load the sublibraries
            for (Element o : XmlIterator.forChildElements(elt, "lib")) {
                Library lib = toLibrary(o);
                if (lib != null) {
                    file.addLibrary(lib);
                }

            }
View Full Code Here

                loader.showError(getFromLocale("libDescMissingError"));
                return null;
            }
            String name = elt.getAttribute("name");
            String desc = elt.getAttribute("desc");
            Library ret = loader.loadLibrary(desc);
            if (ret == null) {
                return null;
            }

            libs.put(name, ret);
            for (Element sub_elt : XmlIterator.forChildElements(elt, "tool")) {
                if (!sub_elt.hasAttribute("name")) {
                    loader.showError(getFromLocale("toolNameMissingError"));
                } else {
                    String tool_str = sub_elt.getAttribute("name");
                    Tool tool = ret.getTool(tool_str);
                    if (tool != null) {
                        try {
                            initAttributeSet(sub_elt, tool.getAttributeSet(), tool);
                        } catch (XmlReaderException e) {
                            addErrors(e, "lib." + name + "." + tool_str);
View Full Code Here

                }
            }
        }

        Tool toTool(Element elt) throws XmlReaderException {
            Library lib = findLibrary(elt.getAttribute("lib"));
            String name = elt.getAttribute("name");
            if (name == null || name.equals("")) {
                throw new XmlReaderException(getFromLocale("toolNameMissing"));
            }
            Tool tool = lib.getTool(name);
            if (tool == null) {
                throw new XmlReaderException(getFromLocale("toolNotFound"));
            }
            return tool;
        }
View Full Code Here

        Library findLibrary(String lib_name) throws XmlReaderException {
            if (lib_name == null || lib_name.equals("")) {
                return file;
            }

            Library ret = libs.get(lib_name);
            if (ret == null) {
                throw new XmlReaderException(getFromLocale("libMissingError", lib_name));
            } else {
                return ret;
            }
View Full Code Here

        chooser.setDialogTitle(getFromLocale("loadLogisimDialogTitle"));
        chooser.setFileFilter(Loader.LOGISIM_FILTER);
        int check = chooser.showOpenDialog(proj.getFrame());
        if (check == JFileChooser.APPROVE_OPTION) {
            File f = chooser.getSelectedFile();
            Library lib = loader.loadLogisimLibrary(f);
            if (lib != null) {
                proj.doAction(LogisimFileActions.loadLibrary(lib));
            }
        }
    }
View Full Code Here

                    return;
                }

            }

            Library lib = loader.loadJarLibrary(f, className);
            if (lib != null) {
                proj.doAction(LogisimFileActions.loadLibrary(lib));
            }
        }
    }
View Full Code Here

     * @param file The source file
     * @param dest The destination file
     * @return if the safe was a success
     */
    public boolean save(LogisimFile file, File dest) {
        Library reference = LibraryManager.instance.findReference(file, dest);
        if (reference != null) {
            JOptionPane.showMessageDialog(parent,
                    getFromLocale("fileCircularError", reference.getDisplayName()),
                    getFromLocale("fileSaveErrorTitle"),
                    JOptionPane.ERROR_MESSAGE);
            return false;
        }

View Full Code Here

            logger.error( "Class not library" );
            throw new LoadFailedException(getFromLocale("jarClassNotLibraryError", className));
        }

        // instantiate library
        Library ret;
        try {
            ret = (Library) retClass.newInstance();
        } catch (Exception e) {
            logger.error( "Class not library" );
            throw new LoadFailedException(getFromLocale("jarLibraryNotCreatedError", className));
View Full Code Here

TOP

Related Classes of com.cburch.logisim.tools.Library

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.