Package org.eclipse.gef.editparts

Examples of org.eclipse.gef.editparts.ZoomManager


    /**
     * Loads Rete model and initializes zoom manager.
     */
    protected void initializeGraphicalViewer() {
        ZoomManager zoomManager = rootEditPart.getZoomManager();

        //List<String>
        List<String> zoomLevels = new ArrayList<String>(3);

        zoomLevels.add( ZoomManager.FIT_ALL );
        zoomLevels.add( ZoomManager.FIT_HEIGHT );
        zoomLevels.add( ZoomManager.FIT_WIDTH );

        zoomManager.setZoomLevelContributions( zoomLevels );

        // Zoom mousewheel - Ctrl+Mousewheel for zoom in/out
        getGraphicalViewer().setProperty( MouseWheelHandler.KeyGenerator.getKey( SWT.MOD1 ),
                                          MouseWheelZoomHandler.SINGLETON );

View Full Code Here


    viewer.setEditPartFactory(new RecordPartFactory());

    ScalableFreeformRootEditPart rootEditPart = new ScalableFreeformRootEditPart();
    viewer.setRootEditPart(rootEditPart);

    ZoomManager manager = rootEditPart.getZoomManager();
    getActionRegistry().registerAction(new ZoomInAction(manager));
    getActionRegistry().registerAction(new ZoomOutAction(manager));

    zoomLevels = new double[] { 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2.0, 2.5, 3,
        4, 5, 10 };
    manager.setZoomLevels(zoomLevels);
    manager.setZoom(1);
    ArrayList<String> zoomContributions = new ArrayList<String>();
    zoomContributions.add(ZoomManager.FIT_ALL);
    zoomContributions.add(ZoomManager.FIT_HEIGHT);
    zoomContributions.add(ZoomManager.FIT_WIDTH);
    manager.setZoomLevelContributions(zoomContributions);

    /*
     * A workaround because - when embedded in a ViewPart - the SWT.DEL key
     * is not recognized. This problem might be related to the GEF
     * EditDomain, that should be hooked separately in the ViewPart.
View Full Code Here

        parent = LayoutUtils.translateAndGetParent(constraint, parent);
      }

      /* adjust the default size to the zoom */
      double zoom = 1d;
      ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getTargetEditPart(
          request).getViewer().getRootEditPart()).getZoomManager();
      if (zoomManager != null)
        zoom = zoomManager.getZoom() * zoomManager.getUIMultiplier();

      // created by Drag and Drop or click
      if (constraint.width == -1 && constraint.height == -1) {
        normalizeConstraint(constraint, (int) (DEFAULT_WIDTH / zoom),
            (int) (DEFAULT_HEIGHT / zoom));
View Full Code Here

    /**
     * Loads Rete model and initializes zoom manager.
     */
    protected void initializeGraphicalViewer() {
        ZoomManager zoomManager = rootEditPart.getZoomManager();

        //List<String>
        List zoomLevels = new ArrayList( 3 );

        zoomLevels.add( ZoomManager.FIT_ALL );
        zoomLevels.add( ZoomManager.FIT_HEIGHT );
        zoomLevels.add( ZoomManager.FIT_WIDTH );

        zoomManager.setZoomLevelContributions( zoomLevels );

        // Zoom mousewheel - Ctrl+Mousewheel for zoom in/out
        getGraphicalViewer().setProperty( MouseWheelHandler.KeyGenerator.getKey( SWT.MOD1 ),
                                          MouseWheelZoomHandler.SINGLETON );

View Full Code Here

    ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) getGraphicalViewer();
    ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
    double[] zoomLevels;
    ArrayList<String> zoomContributions;

    ZoomManager manager = root.getZoomManager();
    getActionRegistry().registerAction(new ZoomInAction(manager));
    getActionRegistry().registerAction(new ZoomOutAction(manager));
    zoomLevels = new double[] { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 2.5, 3.0 };
    manager.setZoomLevels(zoomLevels);

    zoomContributions = new ArrayList<String>();
    zoomContributions.add(ZoomManager.FIT_ALL);
    zoomContributions.add(ZoomManager.FIT_HEIGHT);
    zoomContributions.add(ZoomManager.FIT_WIDTH);
    manager.setZoomLevelContributions(zoomContributions);

    IAction zoomIn = new ZoomInAction(root.getZoomManager());
    IAction zoomOut = new ZoomOutAction(root.getZoomManager());
    getActionRegistry().registerAction(zoomIn);
    getActionRegistry().registerAction(zoomOut);
View Full Code Here

  public double getEditorZoomScaling() {
    if (getGraphicalViewer() == null) {
      return 1.0d;
    } else {
      ZoomManager manager = (ZoomManager) getGraphicalViewer()
          .getProperty(ZoomManager.class.toString());
      return manager.getZoom();
    }
  }
View Full Code Here

  }

  protected void loadProperties() {
    if (getMusicDiagram() == null)
      return;
    ZoomManager manager = (ZoomManager) getGraphicalViewer().getProperty(
        ZoomManager.class.toString());
    if (manager != null)
      manager.setZoom(getMusicDiagram().getZoom());
    // Scroll-wheel Zoom
    getGraphicalViewer().setProperty(
        MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
        MouseWheelZoomHandler.SINGLETON);
View Full Code Here

    job.setPriority(Job.BUILD);
    job.schedule();
  }

  protected void saveProperties() {
    ZoomManager manager = (ZoomManager) getGraphicalViewer().getProperty(
        ZoomManager.class.toString());
    if (manager != null)
      getMusicDiagram().setZoom(manager.getZoom());
  }
View Full Code Here

   *            {@link #getEditor()}.
   */
  public ContextButtonManager(SapphireDiagramEditor editor) {
    this.editor = editor;

    ZoomManager zoomMgr = (ZoomManager) getEditor().getGraphicalViewer().getProperty(ZoomManager.class.toString());
    if (zoomMgr != null) {
      zoomMgr.addZoomListener(zoomListener);
    }
  }
View Full Code Here

    GraphicalViewer viewer = getGraphicalViewer();
    return (FigureCanvas) viewer.getControl();
  }
 
  public double getZoomLevel() {
    ZoomManager zoomManager = getZoomManager();
    if (zoomManager == null)
      return 1;

    /*
     * avoid long running calculations for large diagrams and zoom factors
     * below 5%
     */
    return Math.max(0.05D, zoomManager.getZoom());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.gef.editparts.ZoomManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.