Package net.sourceforge.veditor.editor

Examples of net.sourceforge.veditor.editor.HdlEditor


     * @param targetEditor the new editor target
     */
    public void setActiveEditor(IAction action, IEditorPart targetEditor){
      //FIXME: there should be a way to do this from inside the editor
      //but until then
      HdlEditor hdlEditor=(HdlEditor)targetEditor;
      if(hdlEditor!=null){
        hdlEditor.setCurrent();
      }
    }
View Full Code Here


 
  /**
   * 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();
            for(int j=0; j< subPackageElements.length; j++){
              if ( subPackageElements[j].getName()
                      .equalsIgnoreCase(selectionText)) {
                editor.showElement(subPackageElements[j]);

              }
            }
          }
          // jump to architecture
           if(elements[i] instanceof ArchitectureElement ){
             ArchitectureElement architureElement =(ArchitectureElement)elements[i];
             if(architureElement.GetEntityName().equalsIgnoreCase(selectionText)){
               editor.showElement(architureElement);
             }
           }
          
           if(elements[i] instanceof PackageDeclElement ){
             PackageDeclElement packageDeclElement = (PackageDeclElement)elements[i];
             if (packageDeclElement.getName().equalsIgnoreCase(selectionText)) {
               editor.showElement(packageDeclElement);
             }
           }
       
        } 

View Full Code Here

TOP

Related Classes of net.sourceforge.veditor.editor.HdlEditor

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.