Search in sources :

Example 31 with ZoomManager

use of org.eclipse.gef.editparts.ZoomManager in project knime-core by knime.

the class WorkflowRootEditPart method createToolTipHelper.

/**
 * @param underlyingShell underlying shell
 */
public void createToolTipHelper(final Shell underlyingShell) {
    // create a tooltip helper for all child figures
    ZoomManager zoomManager = (ZoomManager) (getRoot().getViewer().getProperty(ZoomManager.class.toString()));
    m_toolTipHelper = new ProgressToolTipHelper(getViewer().getControl(), zoomManager);
    getFigure().setProgressToolTipHelper(m_toolTipHelper);
}
Also used : ProgressToolTipHelper(org.knime.workbench.editor2.figures.ProgressToolTipHelper) ZoomManager(org.eclipse.gef.editparts.ZoomManager)

Example 32 with ZoomManager

use of org.eclipse.gef.editparts.ZoomManager in project knime-core by knime.

the class ConnectionBendpointEditPolicy method getCreateBendpointCommand.

/**
 * {@inheritDoc}
 */
protected Command getCreateBendpointCommand(final BendpointRequest req) {
    int index = req.getIndex();
    Point loc = req.getLocation();
    ConnectionContainerEditPart editPart = (ConnectionContainerEditPart) getHost();
    ZoomManager zoomManager = (ZoomManager) getHost().getRoot().getViewer().getProperty(ZoomManager.class.toString());
    return new NewBendpointCreateCommand(editPart, getWorkflowManager(), index, loc, zoomManager);
}
Also used : ConnectionContainerEditPart(org.knime.workbench.editor2.editparts.ConnectionContainerEditPart) ZoomManager(org.eclipse.gef.editparts.ZoomManager) NewBendpointCreateCommand(org.knime.workbench.editor2.commands.NewBendpointCreateCommand) Point(org.eclipse.draw2d.geometry.Point) AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) Point(org.eclipse.draw2d.geometry.Point) Bendpoint(org.eclipse.draw2d.Bendpoint)

Example 33 with ZoomManager

use of org.eclipse.gef.editparts.ZoomManager in project knime-core by knime.

the class ConnectionBendpointEditPolicy method getMoveBendpointCommand.

/**
 * {@inheritDoc}
 */
protected Command getMoveBendpointCommand(final BendpointRequest request) {
    // index of the bendpoint to move
    int index = request.getIndex();
    Point loc = request.getLocation();
    ConnectionContainerEditPart edit = (ConnectionContainerEditPart) getHost();
    ZoomManager zoomManager = (ZoomManager) getHost().getRoot().getViewer().getProperty(ZoomManager.class.toString());
    WorkflowManager m = getWorkflowManager();
    return new NewBendpointMoveCommand(edit, m, index, loc, zoomManager);
}
Also used : ConnectionContainerEditPart(org.knime.workbench.editor2.editparts.ConnectionContainerEditPart) ZoomManager(org.eclipse.gef.editparts.ZoomManager) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) Point(org.eclipse.draw2d.geometry.Point) NewBendpointMoveCommand(org.knime.workbench.editor2.commands.NewBendpointMoveCommand) AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) Point(org.eclipse.draw2d.geometry.Point) Bendpoint(org.eclipse.draw2d.Bendpoint)

Example 34 with ZoomManager

use of org.eclipse.gef.editparts.ZoomManager in project knime-core by knime.

the class SnapIconToGrid method getIconOffset.

private Point getIconOffset(final NodeContainerFigure nodeFigure) {
    Point iconOffset = getGridRefPointOffset(nodeFigure);
    double zoomFactor = ((ZoomManager) (m_container.getViewer().getProperty(ZoomManager.class.toString()))).getZoom();
    iconOffset = iconOffset.getScaled(zoomFactor);
    return iconOffset;
}
Also used : ZoomManager(org.eclipse.gef.editparts.ZoomManager) Point(org.eclipse.draw2d.geometry.Point)

Example 35 with ZoomManager

use of org.eclipse.gef.editparts.ZoomManager in project yamcs-studio by yamcs.

the class OPIEditor method getDisplayCenterPosition.

/**
 * Returns the Point, which is the center of the Display.
 *
 * @return Point The Point, which is the center of the Display
 */
public Point getDisplayCenterPosition() {
    ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart) getGraphicalViewer().getRootEditPart();
    ZoomManager m = root.getZoomManager();
    Point center = m.getViewport().getBounds().getCenter();
    Rectangle x = new Rectangle(center.x, center.y, 10, 10);
    x.translate(m.getViewport().getViewLocation());
    m.getScalableFigure().translateFromParent(x);
    Point result = x.getLocation();
    return result;
}
Also used : ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart) ZoomManager(org.eclipse.gef.editparts.ZoomManager) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

ZoomManager (org.eclipse.gef.editparts.ZoomManager)46 Point (org.eclipse.draw2d.geometry.Point)14 ArrayList (java.util.ArrayList)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 Dimension (org.eclipse.draw2d.geometry.Dimension)4 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)4 ZoomInAction (org.eclipse.gef.ui.actions.ZoomInAction)4 ZoomOutAction (org.eclipse.gef.ui.actions.ZoomOutAction)4 Iterator (java.util.Iterator)3 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 GraphicalViewer (org.eclipse.gef.GraphicalViewer)3 IAction (org.eclipse.jface.action.IAction)3 ConnectionContainerEditPart (org.knime.workbench.editor2.editparts.ConnectionContainerEditPart)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)2 Bendpoint (org.eclipse.draw2d.Bendpoint)2 FigureCanvas (org.eclipse.draw2d.FigureCanvas)2 Viewport (org.eclipse.draw2d.Viewport)2 KeyHandler (org.eclipse.gef.KeyHandler)2