Package org.eclipse.gef

Examples of org.eclipse.gef.GraphicalViewer


      EObject selectedView = diagramEditorResourceSet.getEObject(
          EcoreUtil.getURI(navigatorView), true);
      if (selectedView == null) {
        return;
      }
      GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor
          .getAdapter(GraphicalViewer.class);
      EditPart selectedEditPart = (EditPart) graphicalViewer
          .getEditPartRegistry().get(selectedView);
      if (selectedEditPart != null) {
        graphicalViewer.select(selectedEditPart);
      }
    }
  }
View Full Code Here


      EObject selectedView = diagramEditorResourceSet.getEObject(
          EcoreUtil.getURI(navigatorView), true);
      if (selectedView == null) {
        return;
      }
      GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor
          .getAdapter(GraphicalViewer.class);
      EditPart selectedEditPart = (EditPart) graphicalViewer
          .getEditPartRegistry().get(selectedView);
      if (selectedEditPart != null) {
        graphicalViewer.select(selectedEditPart);
      }
    }
  }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer()
     */
    protected void configureGraphicalViewer() {
        super.configureGraphicalViewer();
        GraphicalViewer viewer = getGraphicalViewer();
        viewer.getControl().setBackground( ColorConstants.white );
        viewer.setEditPartFactory( new VertexEditPartFactory() );
        viewer.setRootEditPart( rootEditPart );
        viewer.setKeyHandler( new GraphicalViewerKeyHandler( viewer ) );
    }
View Full Code Here

    fileDialog.setFilterIndex(0);
    String saveLocation = fileDialog.open();
    if (saveLocation != null) {
      Image img;
      GC imageGC;
      GraphicalViewer graphicalViewer = getGraphicalViewer();
      ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) graphicalViewer
          .getEditPartRegistry().get(LayerManager.ID);
      IFigure fig1 = ((FreeformGraphicalRootEditPart) rootEditPart)
          .getLayer(LayerConstants.PRINTABLE_LAYERS);
      IFigure fig2 = ((FreeformGraphicalRootEditPart) rootEditPart)
          .getLayer(LayerConstants.CONNECTION_LAYER);
View Full Code Here

  /**
   * renders the whole score to fix any visual glitches called upon bootup or
   * by user via explicit action
   */
  public void refreshScreen() {
    final GraphicalViewer graphicalViewer = getGraphicalViewer();
    WorkbenchJob job = new WorkbenchJob(MusicMessages.MeiseEditor_37) {
      @Override
      public IStatus runInUIThread(IProgressMonitor monitor) {
        monitor.beginTask(MusicMessages.MeiseEditor_38, 4);
        Image img;
        GC imageGC;
        ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) graphicalViewer
            .getEditPartRegistry().get(LayerManager.ID);
        IFigure fig1 = ((FreeformGraphicalRootEditPart) rootEditPart)
            .getLayer(LayerConstants.PRINTABLE_LAYERS);
        monitor.worked(1);
        ImageData data = new ImageData(fig1.getClientArea().width,
View Full Code Here

   * @param parent
   *            the parent composite
   */
  @Override
  protected void createGraphicalViewer(Composite parent) {
    GraphicalViewer viewer = new MeiseNonScrollingGraphicalViewer();
    viewer.createControl(parent);
    setGraphicalViewer(viewer);
    configureGraphicalViewer();
    hookGraphicalViewer();
    initializeGraphicalViewer();
  }
View Full Code Here

  protected void configureGraphicalViewer() {
    double[] zoomLevels;
    ArrayList<String> zoomContributions;

    super.configureGraphicalViewer();
    GraphicalViewer viewer = getGraphicalViewer();
    viewer.setEditPartFactory(new EditPartFactoryImpl());

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

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

    // List of possible zoom levels. 1 = 100%
    zoomLevels = new double[] { 0.1, 0.15, 0.25, 0.5, 0.75, 1.0, 1.5, 2.0 };
    manager.setZoomLevels(zoomLevels);

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

    viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL),
        MouseWheelZoomHandler.SINGLETON);

    // Context menu
    ContextMenuProvider provider = new GraphEditorContextMenuProvider(
        viewer, getActionRegistry());
    viewer.setContextMenu(provider);
  }
View Full Code Here

    return manager.getZoom();
  }

  @Override
  protected void initializeGraphicalViewer() {
    GraphicalViewer viewer = getGraphicalViewer();

    if (graph == null) {
      viewer.setContents(status);
    } else {
      viewer.setContents(graph);
      if (!(Boolean) graph.getValue(Graph.PROPERTY_HAS_LAYOUT)) {
        automaticallyLayout(PositionConstants.EAST);
      }
    }
View Full Code Here

      EObject selectedView = diagramEditorResourceSet.getEObject(
          EcoreUtil.getURI(navigatorView), true);
      if (selectedView == null) {
        return;
      }
      GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor
          .getAdapter(GraphicalViewer.class);
      EditPart selectedEditPart = (EditPart) graphicalViewer
          .getEditPartRegistry().get(selectedView);
      if (selectedEditPart != null) {
        graphicalViewer.select(selectedEditPart);
      }
    }
  }
View Full Code Here

      EObject selectedView = diagramEditorResourceSet.getEObject(
          EcoreUtil.getURI(navigatorView), true);
      if (selectedView == null) {
        return;
      }
      GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor
          .getAdapter(GraphicalViewer.class);
      EditPart selectedEditPart = (EditPart) graphicalViewer
          .getEditPartRegistry().get(selectedView);
      if (selectedEditPart != null) {
        graphicalViewer.select(selectedEditPart);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.gef.GraphicalViewer

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.