public Image getImage() { if (m_Element instanceof VhdlOutlineElement) { VhdlOutlineElement e = (VhdlOutlineElement) m_Element; return VerilogPlugin.getPlugin().getImage(e.GetImageName()); } return null; }
/** * Gets the replace string for a component or entity declaration * * @return */ private String getComponentReplaceString() { String replaceString = "", generics = "", ports = ""; Object obj[] = m_Element.getChildren(); for (int i = 0; i < obj.length; i++) { // do the generics if (obj[i] instanceof GenericElement) { GenericElement generic = (GenericElement) obj[i]; generics += "\n " + generic.getName() + " => " + generic.getName() + ","; } // do the ports if (obj[i] instanceof VhdlPortElement) { VhdlPortElement port = (VhdlPortElement) obj[i]; ports += "\n " + port.getName() + " => " + port.getName() + ","; } } // assemble the replace string if (m_Element instanceof EntityDeclElement) { replaceString += "entity work."; } replaceString += m_Element.getName(); // do we have any generics if (generics.length() > 0) { replaceString += "\ngeneric map("; // trim the last comma int lastComma = generics.lastIndexOf(','); replaceString += generics.substring(0, lastComma) + generics.substring(lastComma + 1); replaceString += "\n)"; } if (ports.length() > 0) { replaceString += "\nport map("; // trim the last comma int lastComma = ports.lastIndexOf(','); replaceString += ports.substring(0, lastComma) + ports.substring(lastComma + 1); replaceString += "\n)"; } replaceString += ";"; // align the string replaceString = VerilogPlugin.alignOnChar(replaceString, '=', 1); // add the indent string replaceString = replaceString.replace("\n ", "\n\t"); String indentationstring = VerilogPlugin.getIndentationString(); replaceString = replaceString.replace("\t", indentationstring); return replaceString.replace("\n", eol + getIndentString()); }