org.eclipse.jface.util.Geometry.toDisplay()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中org.eclipse.jface.util.Geometry.toDisplay()方法的一些代码示例,展示了Geometry.toDisplay()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.toDisplay()方法的具体详情如下:
包路径:org.eclipse.jface.util.Geometry
类名称:Geometry
方法名:toDisplay

Geometry.toDisplay介绍

[英]Converts the given rectangle from the local coordinate system of the given object into display coordinates.
[中]将给定矩形从给定对象的局部坐标系转换为显示坐标。

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

public void addEndRect(Control ctrl) {
  Rectangle ctrlBounds = ctrl.getBounds();
  Rectangle endRect = Geometry.toDisplay(ctrl.getParent(), ctrlBounds);
  addEndRect(endRect);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

public void addStartRect(Control ctrl) {
  Rectangle ctrlBounds = ctrl.getBounds();
  Rectangle startRect = Geometry.toDisplay(ctrl.getParent(), ctrlBounds);
  addStartRect(startRect);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt

/**
 * Shorthand method. Returns the bounding rectangle for the given control,
 * in display coordinates.
 *
 * @param boundsControl
 *            the control whose bounds are to be computed
 * @return the bounds of the given control in display coordinates
 */
public static Rectangle getDisplayBounds(Control boundsControl) {
  Control parent = boundsControl.getParent();
  if (parent == null || boundsControl instanceof Shell) {
    return boundsControl.getBounds();
  }
  return Geometry.toDisplay(parent, boundsControl.getBounds());
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Shorthand method. Returns the bounding rectangle for the given control, in
 * display coordinates. Note that all 'Shell' controls are expected to be 'top level'
 * so DO NOT do the origin offset for them.
 *
 * @param draggedItem
 * @param boundsControl
 * @return
 */
public static Rectangle getDisplayBounds(Control boundsControl) {
  Control parent = boundsControl.getParent();
  if (parent == null || boundsControl instanceof Shell) {
    return boundsControl.getBounds();
  }
  return Geometry.toDisplay(parent, boundsControl.getBounds());
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro

protected IIntroPart closeLaunchBar(boolean restore) {
  IntroPlugin.getDefault().setLaunchBar(null);
  // if we've already been removed, this won't hurt us
  if (trimControl.getParent() != null) {
    trimControl.getParent().getChildren().remove(trimControl);
  }
  IIntroPart intro = null;
  if (restore) {
    IWorkbenchWindow window = getWorkbenchWindow();
    intro = PlatformUI.getWorkbench().getIntroManager().showIntro(window, false);
    CustomizableIntroPart cpart = (CustomizableIntroPart) intro;
    Rectangle startBounds = Geometry.toDisplay(getControl().getParent(), getControl().getBounds());
    Rectangle endBounds = Geometry.toDisplay(cpart.getControl().getParent(), cpart.getControl()
        .getBounds());
    AnimationEngine.createTweakedAnimation(window.getShell(), 400, startBounds, endBounds);
  }
  dispose();
  return intro;
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private void updateVisibility() {
  if (fPopup != null && !fPopup.isDisposed() && fDelayJobFinished) {
    boolean visible= false;
    //TODO: Check for visibility of linked position, not whether popup is outside of editor?
    if (fRenameLinkedMode.isCaretInLinkedPosition()) {
      StyledText textWidget= fEditor.getViewer().getTextWidget();
      Rectangle eArea= Geometry.toDisplay(textWidget, textWidget.getClientArea());
      Rectangle pBounds= fPopup.getBounds();
      pBounds.x-= GAP;
      pBounds.y-= GAP;
      pBounds.width+= 2 * GAP;
      pBounds.height+= 2 * GAP;
      if (eArea.intersects(pBounds)) {
        visible= true;
      }
    }
    if (visible && ! fPopup.isVisible()) {
      ISourceViewer viewer= fEditor.getViewer();
      if (viewer instanceof IWidgetTokenOwnerExtension) {
        IWidgetTokenOwnerExtension widgetTokenOwnerExtension= (IWidgetTokenOwnerExtension) viewer;
        widgetTokenOwnerExtension.requestWidgetToken(this, WIDGET_PRIORITY);
      }
    } else if (! visible && fPopup.isVisible()) {
      releaseWidgetToken();
    }
    fPopup.setVisible(visible);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private void updateVisibility() {
  if (fPopup != null && !fPopup.isDisposed() && fDelayJobFinished) {
    boolean visible= false;
    //TODO: Check for visibility of linked position, not whether popup is outside of editor?
    if (fRenameLinkedMode.isCaretInLinkedPosition()) {
      StyledText textWidget= fEditor.getViewer().getTextWidget();
      Rectangle eArea= Geometry.toDisplay(textWidget, textWidget.getClientArea());
      Rectangle pBounds= fPopup.getBounds();
      pBounds.x-= GAP;
      pBounds.y-= GAP;
      pBounds.width+= 2 * GAP;
      pBounds.height+= 2 * GAP;
      if (eArea.intersects(pBounds)) {
        visible= true;
      }
    }
    if (visible && ! fPopup.isVisible()) {
      ISourceViewer viewer= fEditor.getViewer();
      if (viewer instanceof IWidgetTokenOwnerExtension) {
        IWidgetTokenOwnerExtension widgetTokenOwnerExtension= (IWidgetTokenOwnerExtension) viewer;
        visible= widgetTokenOwnerExtension.requestWidgetToken(this, WIDGET_PRIORITY);
      }
    } else if (! visible && fPopup.isVisible()) {
      releaseWidgetToken();
    }
    fPopup.setVisible(visible);
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void updateVisibility() {
  if (fPopup != null && !fPopup.isDisposed() && fDelayJobFinished) {
    boolean visible= false;
    //TODO: Check for visibility of linked position, not whether popup is outside of editor?
    if (fRenameLinkedMode.isCaretInLinkedPosition()) {
      StyledText textWidget= fEditor.getViewer().getTextWidget();
      Rectangle eArea= Geometry.toDisplay(textWidget, textWidget.getClientArea());
      Rectangle pBounds= fPopup.getBounds();
      pBounds.x-= GAP;
      pBounds.y-= GAP;
      pBounds.width+= 2 * GAP;
      pBounds.height+= 2 * GAP;
      if (eArea.intersects(pBounds)) {
        visible= true;
      }
    }
    if (visible && ! fPopup.isVisible()) {
      ISourceViewer viewer= fEditor.getViewer();
      if (viewer instanceof IWidgetTokenOwnerExtension) {
        IWidgetTokenOwnerExtension widgetTokenOwnerExtension= (IWidgetTokenOwnerExtension) viewer;
        visible= widgetTokenOwnerExtension.requestWidgetToken(this, WIDGET_PRIORITY);
      }
    } else if (! visible && fPopup.isVisible()) {
      releaseWidgetToken();
    }
    fPopup.setVisible(visible);
  }
}

代码示例来源:origin: org.eclipse.xtext/ui

protected void updateVisibility() {
  if (popup != null && !popup.isDisposed() && delayJobFinished) {
    boolean visible = false;
    if (renameLinkedMode.isCaretInLinkedPosition()) {
      StyledText textWidget = editor.getInternalSourceViewer().getTextWidget();
      Rectangle eArea = Geometry.toDisplay(textWidget, textWidget.getClientArea());
      Rectangle pBounds = popup.getBounds();
      pBounds.x -= GAP;
      pBounds.y -= GAP;
      pBounds.width += 2 * GAP;
      pBounds.height += 2 * GAP;
      if (eArea.intersects(pBounds)) {
        visible = true;
      }
    }
    if (visible && !popup.isVisible()) {
      ISourceViewer viewer = editor.getInternalSourceViewer();
      if (viewer instanceof IWidgetTokenOwnerExtension) {
        IWidgetTokenOwnerExtension widgetTokenOwnerExtension = (IWidgetTokenOwnerExtension) viewer;
        widgetTokenOwnerExtension.requestWidgetToken(this, WIDGET_PRIORITY);
      }
    } else if (!visible && popup.isVisible()) {
      releaseWidgetToken();
    }
    popup.setVisible(visible);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro

private boolean switchToLaunchBar() {
    IIntroPart intro = PlatformUI.getWorkbench().getIntroManager()
      .getIntro();
    if (intro == null)
      return false;

    CustomizableIntroPart cpart = (CustomizableIntroPart) intro;
    IntroModelRoot modelRoot = IntroPlugin.getDefault().getIntroModelRoot();
    Rectangle bounds = cpart.getControl().getBounds();
    Rectangle startBounds = Geometry.toDisplay(cpart.getControl()
      .getParent(), bounds);

    IntroLaunchBarElement launchBarElement = modelRoot.getPresentation().getLaunchBarElement();
    if (launchBarElement == null)
      return true;
    IWorkbenchWindow window = intro.getIntroSite().getWorkbenchWindow();
    IntroLaunchBar launchBar = IntroLaunchBar.create(window, modelRoot, launchBarElement);

    PlatformUI.getWorkbench().getIntroManager().setIntroStandby(intro, true);

    closeIntro();
    Rectangle endBounds = Geometry.toDisplay(launchBar.getControl()
      .getParent(), launchBar.getControl().getBounds());

    AnimationEngine.createTweakedAnimation(window.getShell(), 400, startBounds, endBounds);
    return true;
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

Rectangle subjectAreaDisplayRelative= Geometry.toDisplay(fSubjectControl, subjectArea);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

Rectangle subjectAreaDisplayRelative= Geometry.toDisplay(fSubjectControl, subjectArea);

相关文章