Class PrintAction

java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
de.cau.cs.kieler.klighd.ui.printing.PrintAction
All Implemented Interfaces:
org.eclipse.jface.action.IAction

public class PrintAction extends org.eclipse.jface.action.Action
An Action contributing print support to KLighD diagram viewers including a system independent printout configuration dialog a with print preview. The printer selection is delegated to the native 'printer selection' dialog.

This class can be subclass in order to contribute a specialized version of the KlighdPrintDialog by overriding getPrintDialog(Shell, PrintOptions).

In order to register the print support for editor parts a corresponding EditorActionBarContributor must be created and registered. Our default one is DiagramEditorPart.PrintActionContributor, it is registered in the plugin.xml as a contributor of the DiagramEditorPart.

In order to enable printing for self implemented view parts, this print action must be registered in the view site's action base as done in DiagramViewPart#registerPrintSupport.

Note: A PiccoloViewer must be set to successfully perform the printing.
Author:
csp, chsch
  • Field Summary

    Fields inherited from interface org.eclipse.jface.action.IAction

    AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new PrintAction.
    Creates a new PrintAction using the given viewer while printing.
  • Method Summary

    Modifier and Type
    Method
    Description
    getPrintDialog(org.eclipse.swt.widgets.Shell parentShell, PrintOptions options)
    Factor method contributing the employed KlighdPrintDialog, may be overridden if a customized dialog shall be injected.
    final void
    run()
    Show the print dialog and print.
    void
    Set a new viewer to use while printing.

    Methods inherited from class org.eclipse.jface.action.Action

    convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText

    Methods inherited from class org.eclipse.jface.action.AbstractAction

    addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener

    Methods inherited from class org.eclipse.core.commands.common.EventManager

    addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PrintAction

      public PrintAction()
      Create a new PrintAction. A viewer must be set separately.
    • PrintAction

      public PrintAction(IViewer viewer)
      Creates a new PrintAction using the given viewer while printing.
      Parameters:
      viewer - the viewer to print.
  • Method Details

    • setViewer

      public void setViewer(IViewer viewer)
      Set a new viewer to use while printing.
      Parameters:
      viewer - the new viewer to print
    • getPrintDialog

      protected KlighdPrintDialog getPrintDialog(org.eclipse.swt.widgets.Shell parentShell, PrintOptions options)
      Factor method contributing the employed KlighdPrintDialog, may be overridden if a customized dialog shall be injected.
      Parameters:
      parentShell - the parent Shell required by the dialog
      options - the PrintOptions instance to work with
      Returns:
      the KlighdPrintDialog to be used
    • run

      public final void run()
      Show the print dialog and print.
      Specified by:
      run in interface org.eclipse.jface.action.IAction
      Overrides:
      run in class org.eclipse.jface.action.Action