public ExportPDFWizard() {
    PrintingPlugin plugin = PrintingPlugin.getDefault();

    java.util.Map<String, TemplateFactory> templateFactories = plugin.getTemplateFactories();

    setWindowTitle(Messages.ExportPDFWizard_Title);

    String key = Icons.WIZBAN + "exportpdf_wiz.gif"; // $NON-NLS-1$
    ImageRegistry imageRegistry = plugin.getImageRegistry();
    ImageDescriptor image = imageRegistry.getDescriptor(key);
    if (image == null) {
      URL banURL = plugin.getBundle().getResource("icons/" + key); // $NON-NLS-1$
      image = ImageDescriptor.createFromURL(banURL);
      imageRegistry.put(key, image);
    }
    setDefaultPageImageDescriptor(image);

    // get copy of map
    IEditorInput input =
        PlatformUI.getWorkbench()
            .getActiveWorkbenchWindow()
            .getActivePage()
            .getActiveEditor()
            .getEditorInput();
    map = (Map) ((MapEditorInput) input).getProjectElement();

    // get configuration for this wizard
    IBlackboard mapBlackboard = map.getBlackboard();
    ExportPDFWizardConfigBean config =
        (ExportPDFWizardConfigBean) mapBlackboard.get(ExportPDFWizardConfigBean.BLACKBOARD_KEY);

    page1 = new ExportPDFWizardPage1(templateFactories, config);
    addPage(page1);
  }
  /**
   * Iterates through the Page's Boxes, drawing to the provided Graphics object
   *
   * @see java.awt.print.Printable#print(java.awt.Graphics, java.awt.print.PageFormat, int)
   */
  public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
      throws PrinterException {

    if (pageIndex >= 1) {
      return Printable.NO_SUCH_PAGE;
    }

    Graphics2D graphics2d = (Graphics2D) graphics;

    AffineTransform at = graphics2d.getTransform();
    double dpi = at.getScaleX() * 72;

    if (PrintingPlugin.isDebugging(TRACE_PRINTING)) {
      PrintingPlugin.log("Printing page " + pageIndex, null); // $NON-NLS-1$
      System.out.println("PageFormat: " + pageFormat); // $NON-NLS-1$
      System.out.println("PageFormat height: " + pageFormat.getHeight()); // $NON-NLS-1$
      System.out.println("PageFormat width: " + pageFormat.getWidth()); // $NON-NLS-1$
      System.out.println(
          "PageFormat imageableX,Y "
              + pageFormat.getImageableX()
              + ", "
              + pageFormat.getImageableY()); // $NON-NLS-1$ //$NON-NLS-2$
      System.out.println(
          "PageFormat imageable height: " + pageFormat.getImageableHeight()); // $NON-NLS-1$
      System.out.println(
          "PageFormat imageable width: " + pageFormat.getImageableWidth()); // $NON-NLS-1$
      System.out.println(
          "PageFormat orientation (LANDSCAPE="
              + PageFormat.LANDSCAPE
              + ", PORTRAIT="
              + PageFormat.PORTRAIT
              + "): "
              + pageFormat.getOrientation()); // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$

      System.out.println("Graphics: clip bounds: " + graphics2d.getClipBounds()); // $NON-NLS-1$
      System.out.println("Transform: scaleX: " + at.getScaleX()); // $NON-NLS-1$
      System.out.println("Transform: scaleY: " + at.getScaleY()); // $NON-NLS-1$
      System.out.println("DPI?? : " + dpi); // $NON-NLS-1$
    }

    graphics2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());

    Iterator<Box> iter = diagram.getBoxes().iterator();
    while (iter.hasNext()) {

      Box box = iter.next();
      graphics2d =
          (Graphics2D)
              graphics.create(
                  box.getLocation().x,
                  box.getLocation().y,
                  box.getSize().width,
                  box.getSize().height);

      box.getBoxPrinter().draw(graphics2d, monitor);
    }

    return Printable.PAGE_EXISTS;
  }
 @Override
 public void run() {
   if (action == null) {
     try {
       action = (IActionDelegate) element.createExecutableExtension("action"); // $NON-NLS-1$
     } catch (CoreException e) {
       PrintingPlugin.log("", e); // $NON-NLS-1$
     }
   }
   if (action != null) action.run(this);
 }
  public void perform() {
    Layer selectedLayer = getSelectedLayer();
    original = selectedLayer.getStyleBlackboard();
    EditorPageManager manager =
        EditorPageManager.loadManager(PrintingPlugin.getDefault(), selectedLayer);
    Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    StyleEditorDialog dialog =
        StyleEditorDialog.createDialogOn(parentShell, null, selectedLayer, manager);
    dialog.setBlockOnOpen(true);
    int returnCode = dialog.open();

    if (returnCode != Window.OK) {
      selectedLayer.setStyleBlackboard(original);
      original = null;
    }
  }