public InlineTextInputDialog(final IGraphicalEditPart graphicalEditPart, final String value) { super(graphicalEditPart.getViewer().getControl().getShell()); final IFigure theFigure = graphicalEditPart.getFigure(); final org.eclipse.draw2d.geometry.Rectangle r = theFigure.getBounds().getCopy(); theFigure.translateToAbsolute(r); final Control theCanvas = graphicalEditPart.getViewer().getControl(); labelBounds = theCanvas.getDisplay().map(theCanvas, null, new Rectangle(r.x, r.y, r.width, r.height)); this.value = value; setShellStyle(SWT.NO_TRIM | SWT.APPLICATION_MODAL); }
/** * Get the {@link IGraphicalEditPart} from view adapter * * @param any * @return */ private Boolean getEditPartFromViewAdapter(IGraphicalEditPart any) { Object view = adapter.getAdapter(View.class); Map<?, ?> registery = any.getViewer().getEditPartRegistry(); if (view instanceof View) { View childView = (View) view; Object auxPart = registery.get(childView); if (auxPart instanceof IGraphicalEditPart) { mainEditPart = (IGraphicalEditPart) auxPart; return true; } } return false; }