コード例 #1
0
 /**
  * Show page.
  *
  * @param id the id
  */
 protected void showPage(String id) {
   if (ID_ACTION_OUTLINE.equals(id)) {
     showOutlineAction.setChecked(true);
     showOverviewAction.setChecked(false);
     pageBook.showPage(outline);
     if (thumbnail != null) thumbnail.setVisible(false);
   } else if (ID_ACTION_OVERVIEW.equals(id)) {
     if (thumbnail == null) initializeOverview();
     showOutlineAction.setChecked(false);
     showOverviewAction.setChecked(true);
     pageBook.showPage(overview);
     thumbnail.setVisible(true);
   }
 }
コード例 #2
0
  /** Initialize overview. */
  protected void initializeOverview() {
    LightweightSystem lws = new J2DLightweightSystem(overview);

    RootEditPart rep = editor.getGraphicalViewer().getRootEditPart();
    if (rep instanceof MainDesignerRootEditPart) {
      ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart) rep;
      thumbnail =
          new JSSScrollableThumbnail(
              (Viewport) root.getFigure(), (MRoot) getViewer().getContents().getModel());
      thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS));
      lws.setContents(thumbnail);
      disposeListener =
          new DisposeListener() {
            public void widgetDisposed(DisposeEvent e) {
              if (thumbnail != null) {
                thumbnail.deactivate();
                thumbnail = null;
              }
            }
          };
      editor.getEditor().addDisposeListener(disposeListener);
    }
    lws.setControl(overview);
  }