org.eclipse.linuxtools.cdt.libhover_1.1.0.201310241731

16:46:03.893 INFO  jd.cli.Main - Decompiling org.eclipse.linuxtools.cdt.libhover_1.1.0.201310241731.jar
package org.eclipse.linuxtools.cdt.libhover;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

public class ClassInfo
  implements Serializable
{
  private static final long serialVersionUID = 1L;
  private String[] templateParms = new String[0];
  private boolean templateParmsFilled = false;
  private String className;
  private String id;
  private String include;
  private ArrayList<ClassInfo> baseClasses = new ArrayList();
  private HashMap<String, MemberInfo> members = new HashMap();
  private transient Document document;
  public transient Node classNode;
  private ArrayList<ClassInfo> children = null;
  
  public ClassInfo(String className, String id, Node classNode)
  {
    this.className = className;
    this.id = id;
    this.classNode = classNode;
  }
  
  public String getClassName()
  {
    return className;
  }
  
  public Node getClassNode()
  {
    if (classNode == null) {
      classNode = document.getElementById(id);
    }
    return classNode;
  }
  
  public void setDocument(Document d)
  {
    document = d;
  }
  
  public void setClassName(String newName)
  {
    className = newName;
  }
  
  public void addTemplate(ClassInfo child)
  {
    if (children == null) {
      children = new ArrayList();
    }
    children.add(child);
  }
  
  public boolean areTemplateParmsFilled()
  {
    return templateParmsFilled;
  }
  
  public String[] getTemplateParms()
  {
    return templateParms;
  }
  
  public void setTemplateParms(String[] templateParms)
  {
    templateParmsFilled = true;
    this.templateParms = templateParms;
  }
  
  public String getInclude()
  {
    return include;
  }
  
  public void setInclude(String include)
  {
    this.include = include;
  }
  
  public ArrayList<ClassInfo> getChildren()
  {
    return children;
  }
  
  public MemberInfo getMember(String name)
  {
    return (MemberInfo)members.get(name);
  }
  
  public void addMember(MemberInfo info)
  {
    String name = info.getName();
    MemberInfo member = (MemberInfo)members.get(name);
    if (member != null) {
      member.addChild(info);
    } else {
      members.put(name, info);
    }
  }
  
  public MemberInfo[] getMembers(String nameStart)
  {
    ArrayList<MemberInfo> matchList = new ArrayList();
    Collection<MemberInfo> values = members.values();
    for (Iterator<MemberInfo> i = values.iterator(); i.hasNext();)
    {
      MemberInfo k = (MemberInfo)i.next();
      if (k.getName().startsWith(nameStart))
      {
        matchList.add(k);
        ArrayList<MemberInfo> children = k.getChildren();
        if (children != null) {
          for (Iterator<MemberInfo> j = children.iterator(); j.hasNext();)
          {
            MemberInfo child = (MemberInfo)i.next();
            matchList.add(child);
          }
        }
      }
    }
    MemberInfo[] matches = new MemberInfo[matchList.size()];
    return (MemberInfo[])matchList.toArray(matches);
  }
  
  public ArrayList<ClassInfo> getBaseClasses()
  {
    return baseClasses;
  }
  
  public void addBaseClass(ClassInfo info)
  {
    baseClasses.add(info);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.ClassInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.cdt.libhover;

import java.io.Serializable;
import java.util.ArrayList;

public class FunctionInfo
  implements Serializable
{
  private static final long serialVersionUID = 1L;
  private String name;
  private String prototype;
  private String desc;
  private String returnType;
  private ArrayList<String> headers = new ArrayList();
  private ArrayList<FunctionInfo> children = null;
  
  public FunctionInfo(String name)
  {
    this.name = name;
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getPrototype()
  {
    return prototype;
  }
  
  public void setPrototype(String prototype)
  {
    this.prototype = prototype;
  }
  
  public String getDescription()
  {
    return desc;
  }
  
  public void setDescription(String desc)
  {
    this.desc = desc;
  }
  
  public String getReturnType()
  {
    return returnType;
  }
  
  public void setReturnType(String returnType)
  {
    this.returnType = returnType;
  }
  
  public ArrayList<String> getHeaders()
  {
    return headers;
  }
  
  public void addHeader(String header)
  {
    headers.add(header);
  }
  
  public void addChild(FunctionInfo info)
  {
    if (children == null) {
      children = new ArrayList();
    }
    children.add(info);
  }
  
  public ArrayList<FunctionInfo> getChildren()
  {
    return children;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.FunctionInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.cdt.libhover;

import org.eclipse.cdt.ui.ICHelpBook;

public class HelpBook
  implements ICHelpBook
{
  private String title;
  private int type;
  
  public HelpBook(String title, String typeName)
  {
    this.title = title;
    if (typeName.equals("C")) {
      type = 1;
    } else if (typeName.equals("C++")) {
      type = 2;
    } else {
      type = 3;
    }
  }
  
  public String getTitle()
  {
    return title;
  }
  
  public int getCHelpType()
  {
    return type;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.HelpBook
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.cdt.libhover;

import java.io.Serializable;
import java.util.HashMap;
import java.util.TreeMap;

public class LibHoverInfo
  implements Serializable
{
  private static final long serialVersionUID = 1L;
  public HashMap<String, ClassInfo> classes = new HashMap();
  public HashMap<String, TypedefInfo> typedefs = new HashMap();
  public TreeMap<String, FunctionInfo> functions = new TreeMap();
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.LibHoverInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.cdt.libhover;

import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.runtime.CoreException;

class LibhoverPlugin$1
  implements ISaveParticipant
{
  LibhoverPlugin$1(LibhoverPlugin paramLibhoverPlugin) {}
  
  public void saving(ISaveContext saveContext)
    throws CoreException
  {
    LibhoverPlugin.access$0(LibhoverPlugin.getDefault(), saveContext);
  }
  
  public void rollback(ISaveContext saveContext) {}
  
  public void prepareToSave(ISaveContext saveContext)
    throws CoreException
  {}
  
  public void doneSaving(ISaveContext saveContext) {}
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.LibhoverPlugin.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.cdt.libhover;

import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.linuxtools.internal.cdt.libhover.LibHover;
import org.eclipse.linuxtools.internal.cdt.libhover.LibHoverLoadJob;
import org.eclipse.linuxtools.internal.cdt.libhover.LibHoverMessages;
import org.eclipse.linuxtools.internal.cdt.libhover.preferences.PreferenceConstants;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class LibhoverPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.linuxtools.cdt.libhover";
  private static final String LOAD_JOB_TXT = "LibHover.LoadJob.txt";
  private static LibhoverPlugin plugin;
  
  public LibhoverPlugin()
  {
    plugin = this;
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
    ResourcesPlugin.getWorkspace().addSaveParticipant("org.eclipse.linuxtools.cdt.libhover", 
      new ISaveParticipant()
      {
        public void saving(ISaveContext saveContext)
          throws CoreException
        {
          LibhoverPlugin.getDefault().save(saveContext);
        }
        
        public void rollback(ISaveContext saveContext) {}
        
        public void prepareToSave(ISaveContext saveContext)
          throws CoreException
        {}
        
        public void doneSaving(ISaveContext saveContext) {}
      });
    IPreferenceStore ps = getPreferenceStore();
    if ((ps == null) || (!ps.getBoolean(PreferenceConstants.LAZY_LOAD)))
    {
      Job k = new LibHoverLoadJob(LibHoverMessages.getString("LibHover.LoadJob.txt"));
      k.schedule();
    }
  }
  
  private void save(ISaveContext context) {}
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static LibhoverPlugin getDefault()
  {
    return plugin;
  }
  
  public static String getID()
  {
    return "org.eclipse.linuxtools.cdt.libhover";
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("org.eclipse.linuxtools.cdt.libhover", path);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.LibhoverPlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.cdt.libhover;

import java.io.Serializable;
import java.util.ArrayList;

public class MemberInfo
  implements Serializable
{
  private static final long serialVersionUID = 1L;
  private String name;
  private String prototype;
  private String desc;
  private String returnType;
  private String[] paramTypes = new String[0];
  private ArrayList<MemberInfo> children = null;
  
  public MemberInfo(String name)
  {
    this.name = name;
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getPrototype()
  {
    return prototype;
  }
  
  public void setPrototype(String prototype)
  {
    this.prototype = prototype;
  }
  
  public String getDescription()
  {
    return desc;
  }
  
  public void setDescription(String desc)
  {
    this.desc = desc;
  }
  
  public String[] getParamTypes()
  {
    return paramTypes;
  }
  
  public void setParamTypes(String[] paramTypes)
  {
    this.paramTypes = paramTypes;
  }
  
  public String getReturnType()
  {
    return returnType;
  }
  
  public void setReturnType(String returnType)
  {
    this.returnType = returnType;
  }
  
  public void addChild(MemberInfo info)
  {
    if (children == null) {
      children = new ArrayList();
    }
    children.add(info);
  }
  
  public ArrayList<MemberInfo> getChildren()
  {
    return children;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.MemberInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.cdt.libhover;

import java.io.Serializable;
import java.util.ArrayList;

public class TypedefInfo
  implements Serializable
{
  private static final long serialVersionUID = 1L;
  private String[] templates = new String[0];
  private String typedefName;
  private String transformedType;
  private ArrayList<TypedefInfo> children = null;
  
  public TypedefInfo(String typedefName, String transformedType)
  {
    this.typedefName = typedefName;
    this.transformedType = transformedType;
  }
  
  public String getTypedefName()
  {
    return typedefName;
  }
  
  public void setTypedefName(String name)
  {
    typedefName = name;
  }
  
  private String[] getTemplateArgs(String str)
  {
    ArrayList<String> list = new ArrayList();
    int index = 0;
    int lastIndex = 0;
    int templateCounter = 0;
    while (index < str.length())
    {
      char ch = str.charAt(index);
      if (ch == '<')
      {
        if (templateCounter == 0) {
          lastIndex = index + 1;
        }
        templateCounter++;
      }
      else if (ch == '>')
      {
        templateCounter--;
      }
      else if ((ch == ',') && (templateCounter == 1))
      {
        list.add(str.substring(lastIndex, index).trim());
        lastIndex = index + 1;
      }
      index++;
    }
    String[] args = new String[list.size()];
    return (String[])list.toArray(args);
  }
  
  public String getTransformedType(String className)
  {
    int index = className.indexOf('<');
    if (index > 0)
    {
      TypedefInfo e = this;
      
      ArrayList<TypedefInfo> children = getChildren();
      for (int x = 0; x < children.size(); x++)
      {
        TypedefInfo child = (TypedefInfo)children.get(x);
        if (className.matches(child.getTypedefName()))
        {
          e = child;
          break;
        }
      }
      String[] templates = e.getTemplates();
      String transformedName = transformedType;
      if (templates.length <= 0) {
        return transformedName;
      }
      String[] args = getTemplateArgs(className);
      String[] templateArgs = getTemplateArgs(e.getTypedefName());
      int j = 0;
      for (int i = 0; i < args.length; i++) {
        if (!args[i].equals(templateArgs[i]))
        {
          transformedName.replaceAll(templates[j], args[i]);
          j++;
        }
      }
      return transformedName;
    }
    return transformedType;
  }
  
  public void addTypedef(TypedefInfo typedef)
  {
    if (children == null) {
      children = new ArrayList();
    }
    children.add(typedef);
  }
  
  public ArrayList<TypedefInfo> getChildren()
  {
    return children;
  }
  
  public void copyTemplates(String[] newTemplates)
  {
    templates = new String[newTemplates.length];
    for (int i = 0; i < templates.length; i++) {
      templates[i] = newTemplates[i];
    }
  }
  
  public String[] getTemplates()
  {
    return templates;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.TypedefInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.cdt.libhover.utils;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.TreeMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.runtime.IPath;
import org.eclipse.linuxtools.cdt.libhover.FunctionInfo;
import org.eclipse.linuxtools.cdt.libhover.LibHoverInfo;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

public class BuildFunctionInfos
{
  private Document document;
  private LibHoverInfo hoverInfo = new LibHoverInfo();
  
  public BuildFunctionInfos(Document document)
  {
    this.document = document;
  }
  
  public Document getDocument()
  {
    return document;
  }
  
  protected FunctionInfo getFunctionInfoFromNode(String name, Node function_node, Document document)
  {
    FunctionInfo f = new FunctionInfo(name);
    NamedNodeMap function_node_map = function_node.getAttributes();
    Node function_node_returntype_node = function_node_map.item(0);
    String function_node_rt_name = function_node_returntype_node.getNodeName();
    if (function_node_rt_name.equals("returntype"))
    {
      String function_node_rt_value = function_node_returntype_node.getNodeValue();
      f.setReturnType(function_node_rt_value);
    }
    NodeList function_node_kids = function_node.getChildNodes();
    for (int fnk = 0; fnk < function_node_kids.getLength(); fnk++)
    {
      Node function_node_kid = function_node_kids.item(fnk);
      String function_node_kid_name = function_node_kid.getNodeName();
      if (function_node_kid_name.equals("prototype"))
      {
        String prototype = null;
        
        NodeList function_node_parms = function_node_kid.getChildNodes();
        for (int fnp = 0; fnp < function_node_parms.getLength(); fnp++)
        {
          Node function_node_parm = function_node_parms.item(fnp);
          String function_node_parm_name = function_node_parm.getNodeName();
          if (function_node_parm_name.equals("parameter"))
          {
            NamedNodeMap function_node_parm_map = function_node_parm.getAttributes();
            Node function_node_parm_node = function_node_parm_map.item(0);
            String parameter = function_node_parm_node.getNodeValue();
            prototype = 
            
              prototype + ", " + parameter;
          }
        }
        f.setPrototype(prototype);
      }
      else if (function_node_kid_name.equals("headers"))
      {
        NodeList function_node_headers = function_node_kid.getChildNodes();
        for (int fnh = 0; fnh < function_node_headers.getLength(); fnh++)
        {
          Node function_node_header = function_node_headers.item(fnh);
          String function_node_header_name = function_node_header.getNodeName();
          if (function_node_header_name.equals("header"))
          {
            NamedNodeMap function_node_header_map = function_node_header.getAttributes();
            Node function_node_header_node = function_node_header_map.item(0);
            f.addHeader(function_node_header_node.getNodeValue());
          }
        }
      }
      else if (function_node_kid_name.equals("groupsynopsis"))
      {
        NamedNodeMap attr = function_node_kid.getAttributes();
        Node idnode = attr.getNamedItem("id");
        String id = idnode.getNodeValue();
        if (id != null)
        {
          Element elem2 = document.getElementById(id);
          if (elem2 != null)
          {
            NodeList synopsisNode = elem2.getElementsByTagName("synopsis");
            if ((synopsisNode != null) && (synopsisNode.getLength() > 0))
            {
              Node synopsis = synopsisNode.item(0);
              Node textNode = synopsis.getLastChild();
              f.setDescription(textNode.getNodeValue());
            }
          }
        }
      }
      else if (function_node_kid_name.equals("synopsis"))
      {
        Node textNode = function_node_kid.getLastChild();
        f.setDescription(textNode.getNodeValue());
      }
    }
    return f;
  }
  
  public void buildCPPInfo(String fileName)
  {
    Document document = getDocument();
    NodeList nl = document.getElementsByTagName("construct");
    for (int i = 0; i < nl.getLength(); i++)
    {
      Node n = nl.item(i);
      NamedNodeMap m = n.getAttributes();
      Node id = m.getNamedItem("id");
      if ((id != null) && (id.getNodeValue().startsWith("function-")))
      {
        String name = id.getNodeValue().substring(9);
        NodeList nl2 = n.getChildNodes();
        for (int j = 0; j < nl2.getLength(); j++)
        {
          Node n2 = nl2.item(j);
          if (n2.getNodeName().equals("function"))
          {
            FunctionInfo f = getFunctionInfoFromNode(name, n2, document);
            hoverInfo.functions.put(name, f);
          }
        }
      }
    }
    try
    {
      FileOutputStream f = new FileOutputStream(fileName);
      ObjectOutputStream out = new ObjectOutputStream(f);
      out.writeObject(hoverInfo);
      out.close();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  
  public static void main(String[] args)
  {
    try
    {
      URI acDoc = new URI(args[0]);
      IPath p = URIUtil.toPath(acDoc);
      InputStream docStream = null;
      if (p == null)
      {
        URL url = acDoc.toURL();
        docStream = url.openStream();
      }
      else
      {
        docStream = new FileInputStream(p.toFile());
      }
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      factory.setValidating(false);
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document doc = builder.parse(docStream);
      if (doc != null)
      {
        BuildFunctionInfos d = new BuildFunctionInfos(doc);
        d.buildCPPInfo(args[1]);
      }
      System.out.println("Built " + args[1] + " from " + args[0]);
    }
    catch (URISyntaxException e)
    {
      e.printStackTrace();
    }
    catch (FileNotFoundException e)
    {
      e.printStackTrace();
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }
    catch (ParserConfigurationException e)
    {
      e.printStackTrace();
    }
    catch (SAXException e)
    {
      e.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.cdt.libhover.utils.BuildFunctionInfos
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.internal.cdt.libhover;

import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.ui.text.SharedASTJob;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

public class LibHover$ASTDeclarationFinderJob
  extends SharedASTJob
{
  private IBinding binding;
  private IASTName[] decls = null;
  
  public LibHover$ASTDeclarationFinderJob(LibHover paramLibHover, ITranslationUnit t, IBinding binding)
  {
    super("ASTDeclarationFinderJob", t);
    this.binding = binding;
  }
  
  public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast)
  {
    if (ast != null) {
      decls = ast.getDeclarationsInAST(binding);
    }
    return Status.OK_STATUS;
  }
  
  public IASTName[] getDeclarations()
  {
    return decls;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.internal.cdt.libhover.LibHover.ASTDeclarationFinderJob
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.internal.cdt.libhover;

import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.ui.text.SharedASTJob;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

class LibHover$EnclosingASTNameJob
  extends SharedASTJob
{
  private int tlength;
  private int toffset;
  private IASTName result = null;
  
  public LibHover$EnclosingASTNameJob(LibHover paramLibHover, ITranslationUnit t, int toffset, int tlength)
  {
    super("EnclosingASTNameJob", t);
    this.toffset = toffset;
    this.tlength = tlength;
  }
  
  public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast)
  {
    if (ast != null) {
      result = ast.getNodeSelector(null).findEnclosingName(toffset, tlength);
    }
    return Status.OK_STATUS;
  }
  
  public IASTName getASTName()
  {
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.internal.cdt.libhover.LibHover.EnclosingASTNameJob
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.internal.cdt.libhover;

import org.eclipse.cdt.ui.IFunctionSummary.IFunctionPrototypeSummary;

public class LibHover$FunctionSummary$FunctionPrototypeSummary
  implements IFunctionSummary.IFunctionPrototypeSummary
{
  public LibHover$FunctionSummary$FunctionPrototypeSummary(LibHover.FunctionSummary paramFunctionSummary) {}
  
  public String getName()
  {
    return LibHover.FunctionSummary.access$1(this$1);
  }
  
  public String getReturnType()
  {
    return LibHover.FunctionSummary.access$2(this$1);
  }
  
  public String getArguments()
  {
    return LibHover.FunctionSummary.access$3(this$1);
  }
  
  public String getPrototypeString(boolean namefirst)
  {
    if (namefirst)
    {
      if (this$1.prototypeHasBrackets()) {
        return LibHover.FunctionSummary.access$1(this$1) + " " + LibHover.FunctionSummary.access$3(this$1) + " " + LibHover.FunctionSummary.access$2(this$1);
      }
      return LibHover.FunctionSummary.access$1(this$1) + " (" + LibHover.FunctionSummary.access$3(this$1) + ") " + LibHover.FunctionSummary.access$2(this$1);
    }
    if (this$1.prototypeHasBrackets()) {
      return LibHover.FunctionSummary.access$2(this$1) + " " + LibHover.FunctionSummary.access$1(this$1) + " " + LibHover.FunctionSummary.access$3(this$1);
    }
    return LibHover.FunctionSummary.access$2(this$1) + " " + LibHover.FunctionSummary.access$1(this$1) + " (" + LibHover.FunctionSummary.access$3(this$1) + ")";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.internal.cdt.libhover.LibHover.FunctionSummary.FunctionPrototypeSummary
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.internal.cdt.libhover;

import org.eclipse.cdt.ui.IRequiredInclude;

class LibHover$FunctionSummary$RequiredInclude
  implements IRequiredInclude
{
  private String include;
  
  public LibHover$FunctionSummary$RequiredInclude(LibHover.FunctionSummary paramFunctionSummary, String file)
  {
    include = file;
  }
  
  public String getIncludeName()
  {
    return include;
  }
  
  public boolean isStandard()
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.internal.cdt.libhover.LibHover.FunctionSummary.RequiredInclude
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.internal.cdt.libhover;

import java.util.ArrayList;
import org.eclipse.cdt.ui.IFunctionSummary;
import org.eclipse.cdt.ui.IFunctionSummary.IFunctionPrototypeSummary;
import org.eclipse.cdt.ui.IRequiredInclude;

class LibHover$FunctionSummary
  implements IFunctionSummary, Comparable<FunctionSummary>
{
  private String Name;
  private String NameSpace;
  private String ReturnType;
  private String Prototype;
  private String Summary;
  private boolean prototypeHasBrackets;
  private LibHover$FunctionSummary(LibHover paramLibHover) {}
  
  private class RequiredInclude
    implements IRequiredInclude
  {
    private String include;
    
    public RequiredInclude(String file)
    {
      include = file;
    }
    
    public String getIncludeName()
    {
      return include;
    }
    
    public boolean isStandard()
    {
      return true;
    }
  }
  
  public int compareTo(FunctionSummary x)
  {
    FunctionSummary y = x;
    return getName().compareTo(y.getName());
  }
  
  private ArrayList<RequiredInclude> Includes = new ArrayList();
  
  private void setIncludeName(String iname)
  {
    RequiredInclude nri = new RequiredInclude(iname);
    Includes.add(nri);
  }
  
  public class FunctionPrototypeSummary
    implements IFunctionSummary.IFunctionPrototypeSummary
  {
    public FunctionPrototypeSummary() {}
    
    public String getName()
    {
      return Name;
    }
    
    public String getReturnType()
    {
      return ReturnType;
    }
    
    public String getArguments()
    {
      return Prototype;
    }
    
    public String getPrototypeString(boolean namefirst)
    {
      if (namefirst)
      {
        if (prototypeHasBrackets()) {
          return Name + " " + Prototype + " " + ReturnType;
        }
        return Name + " (" + Prototype + ") " + ReturnType;
      }
      if (prototypeHasBrackets()) {
        return ReturnType + " " + Name + " " + Prototype;
      }
      return ReturnType + " " + Name + " (" + Prototype + ")";
    }
  }
  
  public String getName()
  {
    return Name;
  }
  
  public String getNamespace()
  {
    return NameSpace;
  }
  
  public String getDescription()
  {
    return Summary;
  }
  
  public boolean prototypeHasBrackets()
  {
    return prototypeHasBrackets;
  }
  
  public void setPrototypeHasBrackets(boolean value)
  {
    prototypeHasBrackets = value;
  }
  
  public IFunctionSummary.IFunctionPrototypeSummary getPrototype()
  {
    return new FunctionPrototypeSummary();
  }
  
  public IRequiredInclude[] getIncludes()
  {
    IRequiredInclude[] includes = new IRequiredInclude[Includes.size()];
    for (int i = 0; i < Includes.size(); i++) {
      includes[i] = ((IRequiredInclude)Includes.get(i));
    }
    return includes;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.internal.cdt.libhover.LibHover.FunctionSummary
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.internal.cdt.libhover;

import org.eclipse.help.IHelpResource;

class LibHover$HelpResource
  implements IHelpResource
{
  private String href;
  private String label;
  
  public LibHover$HelpResource(LibHover paramLibHover, String href, String label)
  {
    this.href = href;
    this.label = label;
  }
  
  public String getHref()
  {
    return href;
  }
  
  public String getLabel()
  {
    return label;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.internal.cdt.libhover.LibHover.HelpResource
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.internal.cdt.libhover;

import java.util.HashMap;
import org.eclipse.cdt.ui.ICHelpBook;
import org.eclipse.cdt.ui.ICHelpResourceDescriptor;
import org.eclipse.help.IHelpResource;

class LibHover$HelpResourceDescriptor
  implements ICHelpResourceDescriptor
{
  private ICHelpBook helpbook;
  
  public LibHover$HelpResourceDescriptor(LibHover paramLibHover, ICHelpBook helpbook)
  {
    this.helpbook = helpbook;
  }
  
  public ICHelpBook getCHelpBook()
  {
    return helpbook;
  }
  
  public IHelpResource[] getHelpResources()
  {
    LibHoverLibrary l = (LibHoverLibrary)LibHover.access$0().get(helpbook);
    if (l != null)
    {
      IHelpResource[] hr = new IHelpResource[1];
      hr[0] = new LibHover.HelpResource(this$0, l.getDocs(), l.getName());
      return hr;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.internal.cdt.libhover.LibHover.HelpResourceDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.internal.cdt.libhover;

import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.ui.ICHelpBook;
import org.eclipse.cdt.ui.ICHelpProvider;
import org.eclipse.cdt.ui.ICHelpResourceDescriptor;
import org.eclipse.cdt.ui.IFunctionSummary;
import org.eclipse.cdt.ui.IFunctionSummary.IFunctionPrototypeSummary;
import org.eclipse.cdt.ui.IRequiredInclude;
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
import org.eclipse.cdt.ui.text.IHoverHelpInvocationContext;
import org.eclipse.cdt.ui.text.SharedASTJob;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.core.runtime.Status;
import org.eclipse.help.IHelpResource;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IRegion;
import org.eclipse.linuxtools.cdt.libhover.ClassInfo;
import org.eclipse.linuxtools.cdt.libhover.FunctionInfo;
import org.eclipse.linuxtools.cdt.libhover.HelpBook;
import org.eclipse.linuxtools.cdt.libhover.LibHoverInfo;
import org.eclipse.linuxtools.cdt.libhover.LibhoverPlugin;
import org.eclipse.linuxtools.cdt.libhover.MemberInfo;
import org.eclipse.linuxtools.internal.cdt.libhover.preferences.PreferenceConstants;
import org.eclipse.ui.IEditorPart;

public class LibHover
  implements ICHelpProvider
{
  public static String LIBHOVER_DOC_EXTENSION = "org.eclipse.linuxtools.cdt.libhover.library";
  private IEditorPart fEditor;
  
  public void setEditor(IEditorPart editor)
  {
    fEditor = editor;
  }
  
  protected IEditorPart getEditor()
  {
    return fEditor;
  }
  
  private static HashMap<ICHelpBook, LibHoverLibrary> libraries = new HashMap();
  static final String[] constructTypes = {
    "dtype", 
    "enum", 
    "function", 
    "groupsynopsis", 
    "struct", 
    "type", 
    "union" };
  static final int dtypeIndex = 0;
  static final int enumIndex = 1;
  static final int functionIndex = 2;
  static final int groupsynopsisIndex = 3;
  static final int structIndex = 4;
  static final int typeIndex = 5;
  static final int unionIndex = 6;
  private static ArrayList<ICHelpBook> helpBooks = new ArrayList();
  private static Map<String, ICHelpBook> helpBooksMap = new HashMap();
  public static boolean docsFetched = false;
  
  public static Collection<LibHoverLibrary> getLibraries()
  {
    return libraries.values();
  }
  
  public static void saveLibraries()
  {
    IPreferenceStore ps = LibhoverPlugin.getDefault().getPreferenceStore();
    if (ps.getBoolean(PreferenceConstants.CACHE_EXT_LIBHOVER))
    {
      IPath locationBase = LibhoverPlugin.getDefault().getStateLocation();
      for (Iterator<LibHoverLibrary> i = libraries.values().iterator(); i.hasNext();)
      {
        LibHoverLibrary l = (LibHoverLibrary)i.next();
        try
        {
          IPath locationDir = locationBase;
          if (l.isCPP()) {
            locationDir = locationBase.append("CPP");
          } else {
            locationDir = locationBase.append("C");
          }
          File lDir = new File(locationDir.toOSString());
          lDir.mkdir();
          IPath location = locationDir.append(getTransformedName(l.getName()) + ".libhover");
          File target = new File(location.toOSString());
          if (!target.exists())
          {
            FileOutputStream f = new FileOutputStream(locationDir.append("tmpFile").toOSString());
            ObjectOutputStream out = new ObjectOutputStream(f);
            out.writeObject(l.getHoverInfo());
            out.close();
            File tmp = new File(locationDir.append("tmpFile").toOSString());
            tmp.renameTo(target);
          }
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
      }
    }
  }
  
  public static synchronized void getLibHoverDocs()
  {
    if (docsFetched) {
      return;
    }
    libraries.clear();
    helpBooks.clear();
    helpBooksMap.clear();
    
    IPreferenceStore ps = LibhoverPlugin.getDefault().getPreferenceStore();
    if (ps.getBoolean(PreferenceConstants.CACHE_EXT_LIBHOVER))
    {
      IPath stateLocation = LibhoverPlugin.getDefault().getStateLocation();
      IFileSystem fs = EFS.getLocalFileSystem();
      IPath CLibraryLocation = stateLocation.append("C");
      IPath CPPLibraryLocation = stateLocation.append("CPP");
      IFileStore cDir = fs.getStore(CLibraryLocation);
      if (cDir.fetchInfo().exists()) {
        getCachedLibraries(cDir, "C");
      }
      IFileStore cppDir = fs.getStore(CPPLibraryLocation);
      if (cppDir.fetchInfo().exists()) {
        getCachedLibraries(cppDir, "C++");
      }
    }
    IExtensionRegistry x = RegistryFactory.getRegistry();
    IConfigurationElement[] ces = x.getConfigurationElementsFor(LIBHOVER_DOC_EXTENSION);
    for (int i = 0; i < ces.length; i++)
    {
      IConfigurationElement ce = ces[i];
      if (ce.getName().equals("library"))
      {
        String location = ce.getAttribute("location");
        String name = ce.getAttribute("name");
        String helpdocs = ce.getAttribute("docs");
        String type = ce.getAttribute("type");
        String nameSpace = ce.getContributor().getName();
        
        ICHelpBook book = (ICHelpBook)helpBooksMap.get(name);
        if (book == null)
        {
          HelpBook h = new HelpBook(name, type);
          helpBooks.add(h);
          helpBooksMap.put(name, h);
          LibHoverLibrary l = new LibHoverLibrary(name, location, helpdocs, nameSpace, 
            "C++".equals(type));
          libraries.put(h, l);
        }
        else
        {
          LibHoverLibrary l = (LibHoverLibrary)libraries.get(book);
          if (l != null) {
            l.setDocs(helpdocs);
          }
        }
        docsFetched = true;
      }
    }
  }
  
  private static String getTransformedName(String name)
  {
    return name.replaceAll("\\s", "_");
  }
  
  private static String getCleanName(String name)
  {
    return name.replaceAll("_", " ");
  }
  
  private static void getCachedLibraries(IFileStore dir, String type)
  {
    try
    {
      boolean isCPP = type.equals("C++");
      IFileStore[] files = dir.childStores(0, null);
      for (int i = 0; i < files.length; i++)
      {
        IFileStore file = files[i];
        String fileName = file.fetchInfo().getName();
        if (fileName.endsWith(".libhover"))
        {
          File f = file.toLocalFile(0, null);
          if (f != null)
          {
            String name = getCleanName(fileName.substring(0, fileName.length() - 9));
            HelpBook h = new HelpBook(name, type);
            helpBooks.add(h);
            helpBooksMap.put(name, h);
            String location = file.toURI().toString();
            LibHoverLibrary l = new LibHoverLibrary(name, location, null, null, isCPP);
            libraries.put(h, l);
          }
        }
      }
    }
    catch (CoreException e)
    {
      e.printStackTrace();
    }
  }
  
  public void initialize() {}
  
  public ICHelpBook[] getCHelpBooks()
  {
    ICHelpBook[] chelpbooks = new ICHelpBook[helpBooks.size()];
    return (ICHelpBook[])helpBooks.toArray(chelpbooks);
  }
  
  private class FunctionSummary
    implements IFunctionSummary, Comparable<FunctionSummary>
  {
    private String Name;
    private String NameSpace;
    private String ReturnType;
    private String Prototype;
    private String Summary;
    private boolean prototypeHasBrackets;
    private FunctionSummary() {}
    
    private class RequiredInclude
      implements IRequiredInclude
    {
      private String include;
      
      public RequiredInclude(String file)
      {
        include = file;
      }
      
      public String getIncludeName()
      {
        return include;
      }
      
      public boolean isStandard()
      {
        return true;
      }
    }
    
    public int compareTo(FunctionSummary x)
    {
      FunctionSummary y 
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd