コード例 #1
0
  private Point computeWordStart() {
    ITextSelection selection = (ITextSelection) fEditor.getSelectionProvider().getSelection();
    IRegion textRegion =
        DartWordFinder.findWord(fEditor.getViewer().getDocument(), selection.getOffset());
    if (textRegion == null) {
      return null;
    }

    IRegion widgetRegion = modelRange2WidgetRange(textRegion);
    if (widgetRegion == null) {
      return null;
    }

    int start = widgetRegion.getOffset();

    StyledText styledText = fEditor.getViewer().getTextWidget();
    Point result = styledText.getLocationAtOffset(start);
    result.y += styledText.getLineHeight(start);

    if (!styledText.getClientArea().contains(result)) {
      return null;
    }
    return result;
  }
コード例 #2
0
 /**
  * Note: This constructor is for internal use only. Clients should not call this constructor.
  *
  * @param editor the Dart editor
  * @noreference This constructor is not intended to be referenced by clients.
  */
 public DartdocActionGroup_OLD(DartEditor editor) {
   Assert.isNotNull(editor);
   openExternalDartdocAction = new OpenExternalDartdocAction_OLD(editor);
   editor.setAction("OpenDartdoc", openExternalDartdocAction); // $NON-NLS-1$
   initialize(editor.getSelectionProvider());
 }
コード例 #3
0
 protected final ITextSelection getTextSelection() {
   return (ITextSelection) fEditor.getSelectionProvider().getSelection();
 }