예제 #1
0
 @Override
 public void selectionChanged(ITextSelection selection) {
   try {
     if (editor.getModule() != null) {
       this.node = editor.getModule().getNodeAtPosition(selection.getOffset());
     } else {
       this.node = null;
     }
   } catch (YangModelException e) {
     this.node = null;
   }
   setEnabled(node != null && (node instanceof GroupingDefinition || node instanceof UsesNode));
 }
예제 #2
0
  @Override
  public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
    @SuppressWarnings("deprecation")
    String info = super.getHoverInfo(textViewer, hoverRegion);
    if (info != null) {
      return HelpCompositionUtils.wrapHtmlText(info, null);
    }

    String hoverInfo = null;
    YangEditor editor = (YangEditor) getEditor();
    if (editor != null) {
      try {
        Module module = editor.getModule();
        if (module != null) {
          ASTNode node = module.getNodeAtPosition(hoverRegion.getOffset());
          hoverInfo = HelpCompositionUtils.getNodeHelp(node);
        }
      } catch (YangModelException e) {
        YangCorePlugin.log(e);
      }
    }
    return hoverInfo;
  }