Search in sources :

Example 1 with PrintFigureOperation

use of org.eclipse.draw2d.PrintFigureOperation in project dbeaver by dbeaver.

the class ERDEditorPart method printDiagram.

public void printDiagram() {
    GraphicalViewer viewer = getGraphicalViewer();
    PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(), SWT.NULL);
    PrinterData data = dialog.open();
    if (data != null) {
        IFigure rootFigure = rootPart.getLayer(ScalableFreeformRootEditPart.PRINTABLE_LAYERS);
        // EntityDiagramFigure diagramFigure = findFigure(rootFigure, EntityDiagramFigure.class);
        if (rootFigure != null) {
            PrintFigureOperation printOp = new PrintFigureOperation(new Printer(data), rootFigure);
            // Set print preferences
            IPreferenceStore store = ERDActivator.getDefault().getPreferenceStore();
            printOp.setPrintMode(store.getInt(ERDConstants.PREF_PRINT_PAGE_MODE));
            printOp.setPrintMargin(new Insets(store.getInt(ERDConstants.PREF_PRINT_MARGIN_TOP), store.getInt(ERDConstants.PREF_PRINT_MARGIN_LEFT), store.getInt(ERDConstants.PREF_PRINT_MARGIN_BOTTOM), store.getInt(ERDConstants.PREF_PRINT_MARGIN_RIGHT)));
            // Run print
            printOp.run("Print ER diagram");
        }
    }
// new PrintAction(this).run();
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) PrintDialog(org.eclipse.swt.printing.PrintDialog) PrinterData(org.eclipse.swt.printing.PrinterData) Printer(org.eclipse.swt.printing.Printer) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) PrintFigureOperation(org.eclipse.draw2d.PrintFigureOperation) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with PrintFigureOperation

use of org.eclipse.draw2d.PrintFigureOperation in project dbeaver by serge-rider.

the class ERDEditorPart method printDiagram.

public void printDiagram() {
    GraphicalViewer viewer = getGraphicalViewer();
    PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(), SWT.NULL);
    PrinterData data = dialog.open();
    if (data != null) {
        IFigure rootFigure = rootPart.getLayer(ScalableFreeformRootEditPart.PRINTABLE_LAYERS);
        // EntityDiagramFigure diagramFigure = findFigure(rootFigure, EntityDiagramFigure.class);
        if (rootFigure != null) {
            PrintFigureOperation printOp = new PrintFigureOperation(new Printer(data), rootFigure);
            // Set print preferences
            DBPPreferenceStore store = ERDUIActivator.getDefault().getPreferences();
            printOp.setPrintMode(store.getInt(ERDUIConstants.PREF_PRINT_PAGE_MODE));
            printOp.setPrintMargin(new Insets(store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_TOP), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_LEFT), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_BOTTOM), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_RIGHT)));
            // Run print
            printOp.run("Print ER diagram");
        }
    }
// new PrintAction(this).run();
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) PrintDialog(org.eclipse.swt.printing.PrintDialog) PrinterData(org.eclipse.swt.printing.PrinterData) Printer(org.eclipse.swt.printing.Printer) PrintFigureOperation(org.eclipse.draw2d.PrintFigureOperation) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with PrintFigureOperation

use of org.eclipse.draw2d.PrintFigureOperation in project dbeaver by dbeaver.

the class ERDEditorPart method printDiagram.

public void printDiagram() {
    GraphicalViewer viewer = getGraphicalViewer();
    PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(), SWT.NULL);
    PrinterData data = dialog.open();
    if (data != null) {
        IFigure rootFigure = rootPart.getLayer(ScalableFreeformRootEditPart.PRINTABLE_LAYERS);
        // EntityDiagramFigure diagramFigure = findFigure(rootFigure, EntityDiagramFigure.class);
        if (rootFigure != null) {
            PrintFigureOperation printOp = new PrintFigureOperation(new Printer(data), rootFigure);
            // Set print preferences
            DBPPreferenceStore store = ERDUIActivator.getDefault().getPreferences();
            printOp.setPrintMode(store.getInt(ERDUIConstants.PREF_PRINT_PAGE_MODE));
            printOp.setPrintMargin(new Insets(store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_TOP), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_LEFT), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_BOTTOM), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_RIGHT)));
            // Run print
            printOp.run("Print ER diagram");
        }
    }
// new PrintAction(this).run();
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) PrintDialog(org.eclipse.swt.printing.PrintDialog) PrinterData(org.eclipse.swt.printing.PrinterData) Printer(org.eclipse.swt.printing.Printer) PrintFigureOperation(org.eclipse.draw2d.PrintFigureOperation) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IFigure (org.eclipse.draw2d.IFigure)3 PrintFigureOperation (org.eclipse.draw2d.PrintFigureOperation)3 Insets (org.eclipse.draw2d.geometry.Insets)3 PrintDialog (org.eclipse.swt.printing.PrintDialog)3 Printer (org.eclipse.swt.printing.Printer)3 PrinterData (org.eclipse.swt.printing.PrinterData)3 DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1