/**
* 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();