Example usage for org.eclipse.jface.resource DeviceResourceManager DeviceResourceManager

List of usage examples for org.eclipse.jface.resource DeviceResourceManager DeviceResourceManager

Introduction

In this page you can find the example usage for org.eclipse.jface.resource DeviceResourceManager DeviceResourceManager.

Prototype

public DeviceResourceManager(Device device) 

Source Link

Document

Creates a new registry for the given device.

Usage

From source file:org.eclipse.scada.ui.chart.view.AbstractChartView.java

License:Open Source License

public void print() {
    if (Printer.getPrinterList().length == 0) {
        MessageDialog.openInformation(this.shell, "No printer", "No installed printer could be found");
        return;//from  w  w  w.ja v  a2 s . co m
    }

    final PrintDialog dlg = new PrintDialog(this.shell, SWT.APPLICATION_MODAL);

    final PrinterData initialPd = Printer.getDefaultPrinterData();
    initialPd.orientation = PrinterData.LANDSCAPE;
    dlg.setPrinterData(initialPd);

    final PrinterData pd = dlg.open();

    if (pd != null) {
        final Printer printer = new Printer(pd);
        final ResourceManager rm = new DeviceResourceManager(printer);
        try {
            printer.startJob("Chart");
            printer.startPage();

            final GC gc = new GC(printer);
            try {
                final SWTGraphics g = new SWTGraphics(gc, rm);
                try {
                    this.viewer.getChartRenderer().paint(g);
                } finally {
                    g.dispose();
                }
            } finally {
                gc.dispose();
            }

            printer.endPage();
            printer.endJob();
        } finally {
            rm.dispose();
            printer.dispose();
        }
    }
}

From source file:org.eclipse.scada.vi.ui.chart.draw2d.Draw2DGraphics.java

License:Open Source License

public Draw2DGraphics(final org.eclipse.draw2d.Graphics g, final Device device) {
    this.g = g;/*  w w w .  j av  a 2  s.  c om*/
    this.resourceManager = new DeviceResourceManager(device);
}

From source file:org.soyatec.tooling.gef.resources.ResourcesFactory.java

License:Open Source License

public static ResourceManager getResources() {
    if (resources == null) {
        resources = new DeviceResourceManager(getDisplay());
    }/* w  w  w .ja  v  a2  s. c o  m*/
    return resources;
}