Package com.cburch.logisim.tools

Examples of com.cburch.logisim.tools.Library


  public void reload(LoadedLibrary lib) {
    LibraryManager.instance.reload(this, lib);
  }
 
  public boolean save(LogisimFile file, File dest) {
    Library reference = LibraryManager.instance.findReference(file, dest);
    if (reference != null) {
      JOptionPane.showMessageDialog(parent,
          StringUtil.format(Strings.get("fileCircularError"), reference.getDisplayName()),
          Strings.get("fileSaveErrorTitle"),
          JOptionPane.ERROR_MESSAGE);
      return false;
    }
   
View Full Code Here


    if (!(Library.class.isAssignableFrom(retClass))) {
      throw new LoadFailedException(StringUtil.format(Strings.get("jarClassNotLibraryError"), className));
    }
   
    // instantiate library
    Library ret;
    try {
      ret = (Library) retClass.newInstance();
    } catch (Exception e) {
      throw new LoadFailedException(StringUtil.format(Strings.get("jarLibraryNotCreatedError"), className));
    }
View Full Code Here

    }
    return elt;
  }

  Element fromTool(Tool tool) {
    Library lib = findLibrary(tool);
    String lib_name;
    if (lib == null) {
      loader.showError(StringUtil.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

      } else if (act == LibraryEvent.REMOVE_LIBRARY) {
        if (event.getData() instanceof LibraryEventSource) {
          ((LibraryEventSource) event.getData()).removeLibraryListener(subListener);
        }
      }
      Library lib = event.getSource();
      switch (act) {
      case LibraryEvent.DIRTY_STATE:
      case LibraryEvent.SET_NAME:
        model.fireNodesChanged(model.findPaths(lib));
        break;
View Full Code Here

    }
    String fmt = "%" + countDigits(total.getUniqueCount()) + "d\t"
      + "%" + countDigits(total.getRecursiveCount()) + "d\t";
    String fmtNormal = fmt + "%-" + maxName + "s\t%s\n";
    for (FileStatistics.Count count : stats.getCounts()) {
      Library lib = count.getLibrary();
      String libName = lib == null ? "-" : lib.getDisplayName();
      System.out.printf(fmtNormal, //OK
          Integer.valueOf(count.getUniqueCount()),
          Integer.valueOf(count.getRecursiveCount()),
          count.getFactory().getDisplayName(), libName);
    }
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);
      }
     
      // second, create the circuits - empty for now
      List<CircuitData> circuitsData = new ArrayList<CircuitData>();
View Full Code Here

        loader.showError(Strings.get("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(Strings.get("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(Strings.get("toolNameMissing"));
      }
      Tool tool = lib.getTool(name);
      if (tool == null) {
        throw new XmlReaderException(Strings.get("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(StringUtil.format(
          Strings.get("libMissingError"), lib_name));
      } else {
        return ret;
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.