Examples of HdlDocument


Examples of net.sourceforge.veditor.document.HdlDocument

    public String getHoverInfo(ITextViewer textViewer, IRegion region)
    {
      String text;

      // FIXME: module and signal is contents dependent
      HdlDocument doc = (HdlDocument)textViewer.getDocument();
      try
      {
        text = doc.get(region.getOffset(), region.getLength());
      }
      catch (BadLocationException e)
      {
        return null;
      }
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

    }

    private OutlineElement getComponentElement (String text, HdlDocument doc,int offset) {
     
      OutlineElement currentElement = null;
           HdlDocument wi=doc;
           try
             currentElement=wi.getElementAt(offset,true);
          
           }
           catch (BadLocationException e) {
       } catch (HdlParserException e) {
         e.printStackTrace();     
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

   * called to get a list of elements for an object
   */
  public Object[] getElements(Object inputElement)
  {
    // parse source code and get instance list
    HdlDocument doc = (HdlDocument)inputElement;
    try {
      doc.refreshOutline();
      scanOutline(doc);
      return (Object[])m_TopLevelEntities.toArray()
    } catch (HdlParserException e) {     
    }
    return new Object[0];
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

    {
      m_TreeViewer.setInput(doc);
      m_TreeViewer.collapseAll();
      //register the update function
      if (doc instanceof HdlDocument) {
        HdlDocument hdlDoc = (HdlDocument) doc;       
        hdlDoc.getOutlineDatabase().addChangeListner(new databaseListner());
      }
    }     
  }
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

  /**
   * Attempts to find the definition for the highlighted word
   */
  public void gotoDefinition(){
    HdlEditor   editor= getEditor();
    HdlDocument doc   = editor.getHdlDocument();
    StyledText widget = getViewer().getTextWidget();
    String selectionText = widget.getSelectionText();
    Point  selectionRange = widget.getSelection();
    Point  selectionPos   = widget.getLocationAtOffset(selectionRange.y);

    Vector<OutlineElement> definitionList=
      doc.getDefinitionList(selectionText,selectionRange.x);
   

    //go to the definition
    if(definitionList.size() == 1){
      editor.showElement(definitionList.get(0));
    }
    else if(definitionList.size() > 1){
      for(int i = 0; i < definitionList.size(); i++)
      {
        OutlineElement element = definitionList.get(i);
        if (element.getType().equals("module#"))
        {
          editor.showElement(element);
          return;
        }
      }
     
      // if module is not found, show popup
      showPopUp(definitionList, editor, selectionPos);
    } else { // not found in this file, search in packages of other files
      OutlineDatabase database = doc.getOutlineDatabase()
      if (database != null) {
        OutlineElement[] elements = database.findTopLevelElements("");
        for (int i = 0; i < elements.length; i++) {
          if(elements[i] instanceof PackageDeclElement ){
            OutlineElement[] subPackageElements=elements[i].getChildren();
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

{
  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;

      int context = IParser.OUT_OF_MODULE;
      try
     
        context = doc.getContext(documentOffset - match.length());
        currentElement=doc.getElementAt(documentOffset,false);
      }
      catch (BadLocationException e)
      {
      }
      catch (HdlParserException e){
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

  }
 
  private HdlHierarchyPage getHierarchyPage(){
    HdlHierarchyPage page=null;
   
    HdlDocument doc=getHdlDocument();
   
    if(doc != null){
      IProject project=doc.getProject();
      if(project!=null){
        try {     
          page=(HdlHierarchyPage)project.getSessionProperty(VerilogPlugin.getHierarchyId());
        } catch (CoreException e) {
          e.printStackTrace();
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

      getHierarchyPage().setInput(input);
  }
 
  private void checkSyntax()
  {
    HdlDocument doc = getHdlDocument()
    OutlineContainer outlineContainer;
   
    if(doc == null){
      return;
    }
    // check for non-workspace file
    IFile file = doc.getFile();
    if (file == null)
      return;
   
    try
    {
      outlineContainer=doc.getOutlineContainer();
      //update the folding structure
      updateFoldingStructure(outlineContainer.getCollapsibleRegions());
    }
    catch (HdlParserException e)
    {     
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

 
  protected Position getElementPosition(Collapsible collapsible){
    Position  results= new Position(0,0);
    int start,end;
            
       HdlDocument doc=getHdlDocument();     
           
      try {
        start=doc.getLineOffset(collapsible.startLine-1);
        try{
          end=doc.getLineOffset(collapsible.endLine);
        }
        catch(BadLocationException e){
          //second chance
          //If there is not and end of line at the end of the
          //last line in a file, getLineOffset fails
          //in that case, get the last document character
          end=doc.getLength();
        }
       
        results.setOffset(start);
        results.setLength(end-start);         
      } catch (BadLocationException e) {
View Full Code Here

Examples of net.sourceforge.veditor.document.HdlDocument

   * @param file
   */
  protected void storeCollapsibleStates(){
    String stateString;   
    StringBuffer buffer = new StringBuffer();
    HdlDocument doc = getHdlDocument();

    if (doc == null)
        return;
    //check for non-workspace file
    IFile file = doc.getFile();
    if (file == null)
      return;

    for(Collapsible collapsible:m_CollapsibleElements.keySet().toArray(new Collapsible[0])){
      if(m_CollapsibleElements.get(collapsible).isCollapsed()){
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.