Examples of HdlDocument


Examples of net.sourceforge.veditor.document.HdlDocument

    return false;
  }

  public Object[] getElements(Object inputElement)
  {   
    HdlDocument doc = (HdlDocument)inputElement;
    OutlineContainer outlineContainer=null;
   
    try {
      outlineContainer=doc.getOutlineContainer();
      if(outlineContainer != null){
        return outlineContainer.getTopLevelElements();
      }
    } catch (HdlParserException e) {
 
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

   * Restores the state of collapsed items
   */
  protected void restoreCollapsibleStates(){
    HashSet<String> collapsedItems=new HashSet<String>();
    String stateString;
    HdlDocument doc = getHdlDocument();
   
    if(doc == null){
      return;
    }
    //check for non-workspace file
    IFile file = doc.getFile();
    if (file == null)
      return;
   
    //attempt to get the files state string
    try {
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

   *            the list of collapsible elements
   */
  protected void addCollapsible(Collapsible collapsible,ArrayList<Position> positions){
   
   
    HdlDocument doc=getHdlDocument();     
    int start,end;
   
   
    try {
      start=doc.getLineOffset(collapsible.startLine-1);
      end=doc.getLineOffset(collapsible.endLine);       
      positions.add(new Position(start,end-start));
    } catch (BadLocationException e) {
      e.printStackTrace();
    }     
  }
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

   
    //walk backwards to find the beginning of the word we are replacing
    int beginning= offset;

    if (viewer.getDocument() instanceof HdlDocument) {
      HdlDocument doc = (HdlDocument) viewer.getDocument();
     
      String indentationstring = VerilogPlugin.getIndentationString();
      String eol = TextUtilities.getDefaultLineDelimiter(doc);
     
      while (beginning > 0) {
        try{
          char ch= doc.getChar(beginning - 1);
          if (!Character.isJavaIdentifierPart(ch))
            break;
          beginning--;     
        }
        catch (BadLocationException e)
        {
          //empty list
          return results;
        }
      }
     
      Region region= new Region(beginning, offset-beginning);
      String prefix=null;
      try{
        prefix=doc.get(beginning, offset-beginning);
      }
      catch (BadLocationException e)
      {
        //empty list
        return results;
      }
      //get a list of templates
      String contextString=getTemplateContextString(context);
      TemplateContextType contextType=VerilogPlugin.getPlugin().getContextTypeRegistry().getContextType(contextString);
      Template[] templates= VerilogPlugin.getPlugin().getTemplateStore().getTemplates(contextType.getId());
      DocumentTemplateContext documnetTemplateContext= new DocumentTemplateContext(contextType, doc, region.getOffset(), region.getLength());
      //find a matching template
      for (int i= 0; i < templates.length; i++) {
        Template template= templates[i];
        String pattern = template.getPattern();
        pattern = pattern.replace("\t", indentationstring);
        pattern = pattern.replace("\r", "");
        pattern = pattern.replace("\n", eol);
        template.setPattern(pattern);
       
        try {
          contextType.validate(template.getPattern());
        } catch (TemplateException e) {
          continue;
        }     
       
        if (template.matches(prefix, contextType.getId()) && template.getName().startsWith(prefix)){
          String indent = doc.getIndentString(offset);
          template = new TemplateWithIndent(template, indent);
          HdlTemplateProposal hdlTemplateProposal=new HdlTemplateProposal(template,
                                documnetTemplateContext,
                                region,
                                getTemplateImage(template),
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

{
  HashMap<String,VerilogModuleElement> m_ModuleList=new HashMap<String,VerilogModuleElement>();
 
  public Object[] getElements(Object inputElement)
  {
    HdlDocument doc = (HdlDocument)inputElement;
    try {
      doc.refreshOutline();
      return (Object[])scanProject(doc);
    } catch (HdlParserException e) {

    }
    return new Object[0];
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

    return null;
  }

  public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
      int documentOffset) {
    HdlDocument doc = (HdlDocument) viewer.getDocument();
    String match = getMatchingWord(doc.get(), documentOffset);
    List<IComparableCompletionProposal> matchList = null;
    OutlineElement currentElement=null;
   
    doc.getFile();
    int context =VhdlDocument.VHDL_GLOBAL_CONTEXT;
    try
      context = doc.getContext(documentOffset);
      currentElement = doc.getElementAt(documentOffset,false);
    } catch (BadLocationException e) {
    } catch (HdlParserException e) {
    }
   
    matchList = matchSpecificPattern(doc, documentOffset);
    String matchwithdot = getMatchingWordWithdot(doc.get(), documentOffset);
   
    matchwithdot = matchwithdot+" ";//add space
    String matchword[]=matchwithdot.split("[.]");
   
    if (matchList != null){
    } else if(matchword.length==1) {
      switch (context) {
         case VhdlDocument.VHDL_GLOBAL_CONTEXT:
           matchList = getGlobalPropsals(doc, documentOffset, match);
           break;
         default:
           Display.getCurrent().beep(); return null;
       }
    
       matchList.addAll(getTemplates(viewer, documentOffset, context));
      addSignalPropsals(doc, documentOffset, match, currentElement,matchList);
      addSubprogramProposals(doc, documentOffset, match,currentElement, matchList);
    } else
      if(matchword.length==2 && matchword[0].equals("work")) { // packages auto completion
        String match2 = matchword[1].trim();
        OutlineDatabase database = doc.getOutlineDatabase();
        OutlineElement[] elements = database.findTopLevelElements(match2);
       
        matchList = new ArrayList<IComparableCompletionProposal>();
       
        for (int i = 0; i < elements.length; i++) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.