Codota Logo
IVerticalRulerInfo
Code IndexAdd Codota to your IDE (free)

How to use
IVerticalRulerInfo
in
org.eclipse.jface.text.source

Best Java code snippets using org.eclipse.jface.text.source.IVerticalRulerInfo (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

@Override
public int getLineOfLastMouseButtonActivity() {
  if (fDelegate instanceof IVerticalRulerInfo)
    return ((IVerticalRulerInfo)fDelegate).getLineOfLastMouseButtonActivity();
  return -1;
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Returns the line of interest deduced from the mouse hover event.
 *
 * @param event a mouse hover event that triggered hovering
 * @return the document model line number on which the hover event occurred or <code>-1</code> if there is no event
 * @since 3.0
 */
private int getHoverLine(MouseEvent event) {
  return event == null ? -1 : fVerticalRulerInfo.toDocumentLineNumber(event.y);
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Determines the hover to be used to display information based on the source of the
 * mouse hover event. If <code>fVerticalRulerInfo</code> is not a composite ruler, the
 * standard hover is returned.
 *
 * @param event the source of the mouse hover event
 * @return the hover depending on <code>source</code>, or <code>fAnnotationHover</code> if none can be found.
 * @since 3.0
 */
private IAnnotationHover getHover(MouseEvent event) {
  if (event == null || event.getSource() == null)
    return fAnnotationHover;
  if (fVerticalRulerInfo instanceof CompositeRuler) {
    CompositeRuler comp= (CompositeRuler) fVerticalRulerInfo;
    for (Iterator<IVerticalRulerColumn> it= comp.getDecoratorIterator(); it.hasNext();) {
      Object o= it.next();
      if (o instanceof IVerticalRulerInfoExtension && o instanceof IVerticalRulerInfo) {
        if (((IVerticalRulerInfo) o).getControl() == event.getSource()) {
          IAnnotationHover hover= ((IVerticalRulerInfoExtension) o).getHover();
          if (hover != null)
            return hover;
        }
      }
    }
  }
  return fAnnotationHover;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Determines the hover to be used to display information based on the source of the
 * mouse hover event. If <code>fVerticalRulerInfo</code> is not a composite ruler, the
 * standard hover is returned.
 *
 * @param event the source of the mouse hover event
 * @return the hover depending on <code>source</code>, or <code>fAnnotationHover</code> if none can be found.
 * @since 3.0
 */
private IAnnotationHover getHover(MouseEvent event) {
  if (event == null || event.getSource() == null)
    return fAnnotationHover;
  if (fVerticalRulerInfo instanceof CompositeRuler) {
    CompositeRuler comp= (CompositeRuler) fVerticalRulerInfo;
    for (Iterator<IVerticalRulerColumn> it= comp.getDecoratorIterator(); it.hasNext();) {
      Object o= it.next();
      if (o instanceof IVerticalRulerInfoExtension && o instanceof IVerticalRulerInfo) {
        if (((IVerticalRulerInfo) o).getControl() == event.getSource()) {
          IAnnotationHover hover= ((IVerticalRulerInfoExtension) o).getHover();
          if (hover != null)
            return hover;
        }
      }
    }
  }
  return fAnnotationHover;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

@Override
public int getLineOfLastMouseButtonActivity() {
  if (fDelegate instanceof IVerticalRulerInfo)
    return ((IVerticalRulerInfo)fDelegate).getLineOfLastMouseButtonActivity();
  return -1;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

  /**
   * Determines graphical area covered for which the hover is valid.
   *
   * @param y y-coordinate in the vertical ruler
   * @return the graphical extend where the hover is valid
   */
  private Rectangle computeArea(int y) {
    // This is OK (see constructor)
    IOverviewRuler overviewRuler= (IOverviewRuler) getVerticalRulerInfo();

    int hover_height= overviewRuler.getAnnotationHeight();
    int hover_width= getVerticalRulerInfo().getControl().getSize().x;

    // Calculate y-coordinate for hover
    int hover_y= y;
    boolean hasAnnotation= true;
    while (hasAnnotation && hover_y > y - hover_height) {
      hover_y--;
      hasAnnotation= overviewRuler.hasAnnotation(hover_y);
    }
    hover_y++;

    return new Rectangle(0, hover_y, hover_width, hover_height);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Returns the line of interest deduced from the mouse hover event.
 *
 * @param event a mouse hover event that triggered hovering
 * @return the document model line number on which the hover event occurred or <code>-1</code> if there is no event
 * @since 3.0
 */
private int getHoverLine(MouseEvent event) {
  return event == null ? -1 : fVerticalRulerInfo.toDocumentLineNumber(event.y);
}
origin: org.eclipse/org.eclipse.ui.editors

public int getLineOfLastMouseButtonActivity() {
  if (fDelegate instanceof IVerticalRulerInfo)
    ((IVerticalRulerInfo) fDelegate).getLineOfLastMouseButtonActivity();
  return -1;
}
origin: org.eclipse/org.eclipse.ui.workbench.texteditor

public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
  if (fEditor != null) {
    IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) fEditor.getAdapter(IVerticalRulerInfo.class);
    if (rulerInfo != null) {
      Control control= rulerInfo.getControl();
      if (control != null && !control.isDisposed())
        control.removeMouseListener(this);
    }
    if (fEditor instanceof ITextEditorExtension)
      ((ITextEditorExtension) fEditor).removeRulerContextMenuListener(this);
  }
  fEditor= (ITextEditor)(targetEditor == null ? null : targetEditor.getAdapter(ITextEditor.class));
  fCallerAction= callerAction;
  fAction= null;
  if (fEditor != null) {
    if (fEditor instanceof ITextEditorExtension)
      ((ITextEditorExtension) fEditor).addRulerContextMenuListener(this);
    IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) fEditor.getAdapter(IVerticalRulerInfo.class);
    if (rulerInfo != null) {
      fAction= createAction(fEditor, rulerInfo);
      update();
      Control control= rulerInfo.getControl();
      if (control != null && !control.isDisposed())
        control.addMouseListener(this);
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

@Override
public int toDocumentLineNumber(int y_coordinate) {
  if (fDelegate instanceof IVerticalRulerInfo)
    return ((IVerticalRulerInfo)fDelegate).toDocumentLineNumber(y_coordinate);
  return -1;
}
origin: org.eclipse/org.eclipse.ui.editors

public int getLineOfLastMouseButtonActivity() {
  if (fDelegate instanceof IVerticalRulerInfo)
    ((IVerticalRulerInfo) fDelegate).getLineOfLastMouseButtonActivity();
  return -1;
}
origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor

@Override
public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
  if (fEditor != null) {
    IVerticalRulerInfo rulerInfo= fEditor.getAdapter(IVerticalRulerInfo.class);
    if (rulerInfo != null) {
      Control control= rulerInfo.getControl();
      if (control != null && !control.isDisposed())
        control.removeMouseListener(this);
    }
    if (fEditor instanceof ITextEditorExtension)
      ((ITextEditorExtension) fEditor).removeRulerContextMenuListener(this);
  }
  fEditor= targetEditor == null ? null : targetEditor.getAdapter(ITextEditor.class);
  fCallerAction= callerAction;
  fAction= null;
  if (fEditor != null) {
    if (fEditor instanceof ITextEditorExtension)
      ((ITextEditorExtension) fEditor).addRulerContextMenuListener(this);
    IVerticalRulerInfo rulerInfo= fEditor.getAdapter(IVerticalRulerInfo.class);
    if (rulerInfo != null) {
      fAction= createAction(fEditor, rulerInfo);
      update();
      Control control= rulerInfo.getControl();
      if (control != null && !control.isDisposed())
        control.addMouseListener(this);
    }
  }
}
origin: org.eclipse/org.eclipse.ui.editors

public int toDocumentLineNumber(int y_coordinate) {
  if (fDelegate instanceof IVerticalRulerInfo)
    ((IVerticalRulerInfo) fDelegate).toDocumentLineNumber(y_coordinate);
  return -1;
}
origin: org.eclipse/org.eclipse.ui.editors

/**
 * Checks whether a position includes the ruler's line of activity.
 *
 * @param position the position to be checked
 * @param document the document the position refers to
 * @return <code>true</code> if the line is included by the given position
 */
protected boolean includesRulerLine(Position position, IDocument document) {
  if (position != null) {
    try {
      int markerLine= document.getLineOfOffset(position.getOffset());
      int line= fRuler.getLineOfLastMouseButtonActivity();
      if (line == markerLine)
        return true;
      // commented because of "1GEUOZ9: ITPJUI:ALL - Confusing UI for multi-line Bookmarks and Tasks"
      // return (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()));
    } catch (BadLocationException x) {
    }
  }
  return false;
}
origin: org.eclipse/org.eclipse.jdt.ui

  public void handleEvent(Event event) {
    if (event.type == SWT.MenuDetect) {
      // TODO: show per-item menu
      // for now: show ruler context menu
      if (fInput != null) {
        Control ruler= fInput.fRulerInfo.getControl();
        if (ruler != null && !ruler.isDisposed()) {
          Menu menu= ruler.getMenu();
          if (menu != null && !menu.isDisposed()) {
            menu.setLocation(event.x, event.y);
            menu.addMenuListener(new MenuListener() {
              public void menuHidden(MenuEvent e) {
                dispose();
              }
              public void menuShown(MenuEvent e) {
              }
            });
            menu.setVisible(true);
          }
        }
      }
    }
  }
}
origin: org.eclipse/org.eclipse.ui.editors

  public int toDocumentLineNumber(int y_coordinate) {
    if (fDelegate instanceof IVerticalRulerInfo)
      ((IVerticalRulerInfo) fDelegate).toDocumentLineNumber(y_coordinate);
    return -1;
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

/**
 * Checks whether a position includes the ruler's line of activity.
 *
 * @param position the position to be checked
 * @param document the document the position refers to
 * @return <code>true</code> if the line is included by the given position
 */
protected final boolean includesRulerLine(Position position, IDocument document) {
  if (position != null) {
    try {
      int markerLine= document.getLineOfOffset(position.getOffset());
      int line= fRuler.getLineOfLastMouseButtonActivity();
      if (line == markerLine)
        return true;
      // commented because of "1GEUOZ9: ITPJUI:ALL - Confusing UI for multi-line Bookmarks and Tasks"
      // return (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()));
    } catch (BadLocationException x) {
    }
  }
  return false;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor

@Override
public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
  if (fEditor != null) {
    IVerticalRulerInfo rulerInfo= fEditor.getAdapter(IVerticalRulerInfo.class);
    if (rulerInfo != null) {
      Control control= rulerInfo.getControl();
      if (control != null && !control.isDisposed())
        control.removeMouseListener(this);
    }
    if (fEditor instanceof ITextEditorExtension)
      ((ITextEditorExtension) fEditor).removeRulerContextMenuListener(this);
  }
  fEditor= targetEditor == null ? null : targetEditor.getAdapter(ITextEditor.class);
  fCallerAction= callerAction;
  fAction= null;
  if (fEditor != null) {
    if (fEditor instanceof ITextEditorExtension)
      ((ITextEditorExtension) fEditor).addRulerContextMenuListener(this);
    IVerticalRulerInfo rulerInfo= fEditor.getAdapter(IVerticalRulerInfo.class);
    if (rulerInfo != null) {
      fAction= createAction(fEditor, rulerInfo);
      update();
      Control control= rulerInfo.getControl();
      if (control != null && !control.isDisposed())
        control.addMouseListener(this);
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

  @Override
  public int toDocumentLineNumber(int y_coordinate) {
    if (fDelegate instanceof IVerticalRulerInfo)
      return ((IVerticalRulerInfo)fDelegate).toDocumentLineNumber(y_coordinate);
    return -1;
  }
}
origin: org.eclipse/org.eclipse.ui.editors

/**
 * Checks whether a position includes the ruler's line of activity.
 *
 * @param position the position to be checked
 * @param document the document the position refers to
 * @return <code>true</code> if the line is included by the given position
 */
protected boolean includesRulerLine(Position position, IDocument document) {
  if (position != null) {
    try {
      int markerLine= document.getLineOfOffset(position.getOffset());
      int line= fRuler.getLineOfLastMouseButtonActivity();
      if (line == markerLine)
        return true;
      // commented because of "1GEUOZ9: ITPJUI:ALL - Confusing UI for multi-line Bookmarks and Tasks"
      // return (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()));
    } catch (BadLocationException x) {
    }
  }
  return false;
}
org.eclipse.jface.text.sourceIVerticalRulerInfo

Javadoc

A vertical ruler is a visual component which may serve text viewers as an annotation presentation area. The vertical ruler info provides interested clients with the mapping and interaction aspect of the vertical ruler. This covers the mapping between coordinates of the ruler's control and line numbers based on the connected text viewer's document. In order to provide backward compatibility for clients of IVerticalRulerInfo, extension interfaces are used as a means of evolution. The following extension interfaces exist:
  • org.eclipse.jface.text.source.IVerticalRulerInfoExtension since version 3.0 allowing custom annotation hovers and specific annotation models.

Most used methods

  • getLineOfLastMouseButtonActivity
    Returns the line number of the last mouse button activity. Based on the input document of the connec
  • getControl
    Returns the ruler's SWT control.
  • toDocumentLineNumber
    Translates a y-coordinate of the ruler's SWT control into the according line number of the document

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • Kernel (java.awt.image)
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • JButton (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now