Java 类org.eclipse.swt.printing.Printer 实例源码

项目:AppleCommander    文件:DiskExplorerTab.java   
/**
 * Print the file listing for this disk. 
 */
protected void print() {
    PrintDialog printDialog = new PrintDialog(shell);
    PrinterData printerData = printDialog.open();
    if (printerData == null) {
        // cancelled
        return;
    }
    final Printer printer = new Printer(printerData);
    new Thread() {
        public void run() {
            new Printing(printer).run();
            printer.dispose();
        }
    }.start();
}
项目:AppleCommander    文件:StyledTextAdapter.java   
public void print() {
    final Printer printer = SwtUtil.showPrintDialog(styledText);
    if (printer == null) return;    // Print was cancelled
    StyledTextPrintOptions options = new StyledTextPrintOptions();
    options.jobName = printJobName;
    options.printLineBackground = true;
    options.printTextBackground = true;
    options.printTextFontStyle = true;
    options.printTextForeground = true;
    options.footer = "\t<page>"; //$NON-NLS-1$ (for StyledText widget!)
    options.header = "\t" + printJobName; //$NON-NLS-1$

    final Runnable runnable = styledText.print(printer, options);
    new Thread(new Runnable() {
        public void run() {
            runnable.run();
            printer.dispose();
        }
    }).start();
}
项目:AppleCommander    文件:ImageCanvasAdapter.java   
public void print() {
    final Printer printer = SwtUtil.showPrintDialog(imageCanvas);
    if (printer == null) return;    // Print was cancelled
    new Thread(new Runnable() {
        public void run() {
            printer.startJob(getPrintJobName());
            printer.startPage();
            Point dpi = printer.getDPI();
            Image image = getImageCanvas().getImage();
            int imageWidth = image.getImageData().width;
            int imageHeight = image.getImageData().height;
            int printedWidth = imageWidth * (dpi.x / 96);
            int printedHeight = imageHeight * (dpi.y / 96);
            GC gc = new GC(printer);
            gc.drawImage(image,
                0, 0, imageWidth, imageHeight,
                0, 0, printedWidth, printedHeight);
            printer.endPage();
            printer.endJob();
            gc.dispose();
            printer.dispose();
        }
    }).start();
}
项目:applecommander    文件:DiskExplorerTab.java   
/**
 * Print the file listing for this disk. 
 */
protected void print() {
    PrintDialog printDialog = new PrintDialog(shell);
    PrinterData printerData = printDialog.open();
    if (printerData == null) {
        // cancelled
        return;
    }
    final Printer printer = new Printer(printerData);
    new Thread() {
        public void run() {
            new Printing(printer).run();
            printer.dispose();
        }
    }.start();
}
项目:applecommander    文件:StyledTextAdapter.java   
public void print() {
    final Printer printer = SwtUtil.showPrintDialog(styledText);
    if (printer == null) return;    // Print was cancelled
    StyledTextPrintOptions options = new StyledTextPrintOptions();
    options.jobName = printJobName;
    options.printLineBackground = true;
    options.printTextBackground = true;
    options.printTextFontStyle = true;
    options.printTextForeground = true;
    options.footer = "\t<page>"; //$NON-NLS-1$ (for StyledText widget!)
    options.header = "\t" + printJobName; //$NON-NLS-1$

    final Runnable runnable = styledText.print(printer, options);
    new Thread(new Runnable() {
        public void run() {
            runnable.run();
            printer.dispose();
        }
    }).start();
}
项目:applecommander    文件:ImageCanvasAdapter.java   
public void print() {
    final Printer printer = SwtUtil.showPrintDialog(imageCanvas);
    if (printer == null) return;    // Print was cancelled
    new Thread(new Runnable() {
        public void run() {
            printer.startJob(getPrintJobName());
            printer.startPage();
            Point dpi = printer.getDPI();
            Image image = getImageCanvas().getImage();
            int imageWidth = image.getImageData().width;
            int imageHeight = image.getImageData().height;
            int printedWidth = imageWidth * (dpi.x / 96);
            int printedHeight = imageHeight * (dpi.y / 96);
            GC gc = new GC(printer);
            gc.drawImage(image,
                0, 0, imageWidth, imageHeight,
                0, 0, printedWidth, printedHeight);
            printer.endPage();
            printer.endJob();
            gc.dispose();
            printer.dispose();
        }
    }).start();
}
项目:applecommander    文件:SwtUtil.java   
/**
 * Display the Print dialog helper method. 
 */
public static Printer showPrintDialog(Control control) {
    PrintDialog dialog = new PrintDialog(control.getShell());
    PrinterData printerData = dialog.open();
    if (printerData == null) return null;
    return new Printer(printerData);
}
项目:ccu-historian    文件:ChartPrintJob.java   
protected void startPrintJob(Composite elementToPrint, 
        PrinterData printerData) {
    Printer printer = new Printer(printerData);
    try {
        printer.startJob(jobName);

        GC gc = new GC(printer);
        try {
            Rectangle printArea = getPrintableArea(printer, BORDER);
            printer.startPage();
            printComposite(elementToPrint, gc, printArea);
            printer.endPage();
        } finally {
            gc.dispose();
        }
        printer.endJob();

    } finally {
        printer.dispose();
    }
}
项目:ccu-historian    文件:ChartPrintJob.java   
/**
 * @param printer
 * @param safetyBorder
 * @return the rectangle in pixels to print on (and which is also supported
 * by the printer hardware)
 */
private Rectangle getPrintableArea(Printer printer, double safetyBorder) {
    int safetyBorderWidth = (int) (safetyBorder * printer.getDPI().x);
    int safetyBorderHeight = (int) (safetyBorder * printer.getDPI().y);

    Rectangle trim = printer.computeTrim(0, 0, 0, 0);
    int trimLeft = -trim.x;
    int trimTop = -trim.y;
    int trimRight = trim.x + trim.width;
    int trimBottom = trim.y + trim.height;

    int marginLeft = Math.max(trimLeft, safetyBorderWidth);
    int marginRight = Math.max(trimRight, safetyBorderWidth);
    int marginTop = Math.max(trimTop, safetyBorderHeight);
    int marginBottom = Math.max(trimBottom, safetyBorderHeight);

    int availWidth = printer.getClientArea().width - marginLeft
            - marginRight;
    int availHeight = printer.getClientArea().height - marginTop
            - marginBottom;
    return new Rectangle(marginLeft, marginTop, availWidth, availHeight);
}
项目:aya-lang    文件:ChartPrintJob.java   
protected void startPrintJob(Composite elementToPrint, 
        PrinterData printerData) {
    Printer printer = new Printer(printerData);
    try {
        printer.startJob(jobName);

        GC gc = new GC(printer);
        try {
            Rectangle printArea = getPrintableArea(printer, BORDER);
            printer.startPage();
            printComposite(elementToPrint, gc, printArea);
            printer.endPage();
        } finally {
            gc.dispose();
        }
        printer.endJob();

    } finally {
        printer.dispose();
    }
}
项目:aya-lang    文件:ChartPrintJob.java   
/**
 * @param printer
 * @param safetyBorder
 * @return the rectangle in pixels to print on (and which is also supported
 * by the printer hardware)
 */
private Rectangle getPrintableArea(Printer printer, double safetyBorder) {
    int safetyBorderWidth = (int) (safetyBorder * printer.getDPI().x);
    int safetyBorderHeight = (int) (safetyBorder * printer.getDPI().y);

    Rectangle trim = printer.computeTrim(0, 0, 0, 0);
    int trimLeft = -trim.x;
    int trimTop = -trim.y;
    int trimRight = trim.x + trim.width;
    int trimBottom = trim.y + trim.height;

    int marginLeft = Math.max(trimLeft, safetyBorderWidth);
    int marginRight = Math.max(trimRight, safetyBorderWidth);
    int marginTop = Math.max(trimTop, safetyBorderHeight);
    int marginBottom = Math.max(trimBottom, safetyBorderHeight);

    int availWidth = printer.getClientArea().width - marginLeft
            - marginRight;
    int availHeight = printer.getClientArea().height - marginTop
            - marginBottom;
    return new Rectangle(marginLeft, marginTop, availWidth, availHeight);
}
项目:http4e    文件:PrintAction.java   
void print( Shell shell){
   PrintDialog printDialog = new PrintDialog(shell, SWT.NONE);
   printDialog.setText("Print Http Packets");
   PrinterData printerData = printDialog.open();
   if (!(printerData == null)) {
      final Printer printer = new Printer(printerData);

      Thread printingThread = new Thread("Printing") {
         public void run(){
            try {
               new PrinterFacade(getTextToPrint(), printer).print();
            } catch (Exception e) {
               ExceptionHandler.handle(e);
            } finally {
               printer.dispose();
            }
         }
      };
      printingThread.start();         
   }
}
项目:TuxGuitar-1.3.1-fork    文件:TGPrintAction.java   
protected void processAction(TGActionContext context){
    PrintStyles styles = context.getAttribute(ATTRIBUTE_STYLES);
    if( styles == null ) {
        this.configureStyles(context);
        return;
    }

    PrinterData printerData = context.getAttribute(ATTRIBUTE_DATA);
    if( printerData == null ) {
        this.configurePrinterData(context);
        return;
    }

    TGSongManager manager = new TGSongManager(new TGFactoryImpl());
    TGSong sourceSong = context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG);
    TGSong targetSong = sourceSong.clone(manager.getFactory());

    Printer printer = new Printer(printerData);
    PrintController controller = new PrintController(targetSong, manager, new TGResourceFactoryImpl(printer));
    PrintLayout printLayout = new PrintLayout(controller, styles);
    printLayout.loadStyles(getPrinterScale(printer), 1f);
    printLayout.updateSong();
    printLayout.makeDocument(new PrintDocumentImpl(printLayout, printer, printerData, getPrinterArea(printer, 0.5f)));
    printLayout.getResourceBuffer().disposeAllResources();
}
项目:ermasterr    文件:PrintImageAction.java   
/**
 * {@inheritDoc}
 */
@Override
public void run() {
    GraphicalViewer viewer;
    viewer = getWorkbenchPart().getAdapter(GraphicalViewer.class);

    final PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(), SWT.NULL);
    final PrinterData data = dialog.open();

    if (data != null) {
        final Printer printer = new Printer(data);
        final PrintGraphicalViewerOperation op = new PrintERDiagramOperation(printer, viewer);

        op.run(getWorkbenchPart().getTitle());
    }
}
项目:mipsasm    文件:Ide.java   
private void onPrint() {
    PrintDialog printDialog = new PrintDialog(shell);
    PrinterData printerData = printDialog.open();
    if (printerData == null) {
        return;
    }
    Printer printer = new Printer(printerData);
    editText.print(printer).run();
    printer.dispose();
}
项目:translationstudio8    文件:RiskRenderer.java   
public RiskRenderer(Printer printer) {
    super(printer);
    if (printer != null) {
        _yellow = printer.getSystemColor(SWT.COLOR_YELLOW);
        _green = printer.getSystemColor(SWT.COLOR_GREEN);
        _red = printer.getSystemColor(SWT.COLOR_RED);
        _black = printer.getSystemColor(SWT.COLOR_BLACK);
        _redInactive = new Color(printer, INACTIVE_RED);
        _yellowInactive = new Color(printer, INACTIVE_YELLOW);
        _greenInactive = new Color(printer, INACTIVE_GREEN);
    }
    Color[][] inactiveColors = { { _yellowInactive, _redInactive, _redInactive },
            { _greenInactive, _yellowInactive, _redInactive }, { _greenInactive, _greenInactive, _yellowInactive } };
    _inactiveColors = inactiveColors;
    Color[][] colors = { { _yellow, _red, _red }, { _green, _yellow, _red }, { _green, _green, _yellow } };
    _colors = colors;
}
项目:read-open-source-code    文件:Spoon.java   
private void printJobFile(JobMeta jobMeta) {
  JobGraph jobGraph = getActiveJobGraph();
  if (jobGraph == null)
    return;

  PrintSpool ps = new PrintSpool();
  Printer printer = ps.getPrinter(shell);

  // Create an image of the screen
  Point max = jobMeta.getMaximum();

  Image img = jobGraph.getJobImage(printer, max.x, max.y, 1.0f);

  ps.printImage(shell, img);

  img.dispose();
  ps.dispose();
}
项目:tmxeditor8    文件:GridLayerPrinter.java   
private Printer setupPrinter(final Shell shell) {
    Printer defaultPrinter = new Printer();
    Point pageCount = getPageCount(defaultPrinter);
    defaultPrinter.dispose();

    final PrintDialog printDialog = new PrintDialog(shell);
    printDialog.setStartPage(1);
    printDialog.setEndPage(pageCount.x * pageCount.y);
    printDialog.setScope(PrinterData.ALL_PAGES);

    PrinterData printerData = printDialog.open();
    if(printerData == null){
        return null;
    }
    return new Printer(printerData);
}
项目:read-open-source-code    文件:Spoon.java   
private void printTransFile(TransMeta transMeta) {
  TransGraph transGraph = getActiveTransGraph();
  if (transGraph == null)
    return;

  PrintSpool ps = new PrintSpool();
  Printer printer = ps.getPrinter(shell);

  // Create an image of the screen
  Point max = transMeta.getMaximum();

  Image img = transGraph.getTransformationImage(printer, max.x, max.y, 1.0f);

  ps.printImage(shell, img);

  img.dispose();
  ps.dispose();
}
项目:translationstudio8    文件:GridLayerPrinter.java   
private Printer setupPrinter(final Shell shell) {
    Printer defaultPrinter = new Printer();
    Point pageCount = getPageCount(defaultPrinter);
    defaultPrinter.dispose();

    final PrintDialog printDialog = new PrintDialog(shell);
    printDialog.setStartPage(1);
    printDialog.setEndPage(pageCount.x * pageCount.y);
    printDialog.setScope(PrinterData.ALL_PAGES);

    PrinterData printerData = printDialog.open();
    if(printerData == null){
        return null;
    }
    return new Printer(printerData);
}
项目:ermaster-nhit    文件:PrintImageAction.java   
/**
 * {@inheritDoc}
 */
@Override
public void run() {
    GraphicalViewer viewer;
    viewer = (GraphicalViewer) getWorkbenchPart().getAdapter(
            GraphicalViewer.class);

    PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(),
            SWT.NULL);
    PrinterData data = dialog.open();

    if (data != null) {
        Printer printer = new Printer(data);
        PrintGraphicalViewerOperation op = new PrintERDiagramOperation(
                printer, viewer);

        op.run(getWorkbenchPart().getTitle());
    }
}
项目:ECG-Viewer    文件:ChartPrintJob.java   
protected void startPrintJob(Composite elementToPrint, 
        PrinterData printerData) {
    Printer printer = new Printer(printerData);
    try {
        printer.startJob(jobName);

        GC gc = new GC(printer);
        try {
            Rectangle printArea = getPrintableArea(printer, BORDER);
            printer.startPage();
            printComposite(elementToPrint, gc, printArea);
            printer.endPage();
        } finally {
            gc.dispose();
        }
        printer.endJob();

    } finally {
        printer.dispose();
    }
}
项目:ECG-Viewer    文件:ChartPrintJob.java   
/**
 * @param printer
 * @param safetyBorder
 * @return the rectangle in pixels to print on (and which is also supported
 * by the printer hardware)
 */
private Rectangle getPrintableArea(Printer printer, double safetyBorder) {
    int safetyBorderWidth = (int) (safetyBorder * printer.getDPI().x);
    int safetyBorderHeight = (int) (safetyBorder * printer.getDPI().y);

    Rectangle trim = printer.computeTrim(0, 0, 0, 0);
    int trimLeft = -trim.x;
    int trimTop = -trim.y;
    int trimRight = trim.x + trim.width;
    int trimBottom = trim.y + trim.height;

    int marginLeft = Math.max(trimLeft, safetyBorderWidth);
    int marginRight = Math.max(trimRight, safetyBorderWidth);
    int marginTop = Math.max(trimTop, safetyBorderHeight);
    int marginBottom = Math.max(trimBottom, safetyBorderHeight);

    int availWidth = printer.getClientArea().width - marginLeft
            - marginRight;
    int availHeight = printer.getClientArea().height - marginTop
            - marginBottom;
    return new Rectangle(marginLeft, marginTop, availWidth, availHeight);
}
项目:gef-gwt    文件:PrintAction.java   
/**
 * @see org.eclipse.jface.action.Action#run()
 */
public void run() {
    GraphicalViewer viewer;
    viewer = (GraphicalViewer) getWorkbenchPart().getAdapter(
            GraphicalViewer.class);

    PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(),
            SWT.NULL);
    PrinterData data = dialog.open();

    if (data != null) {
        PrintGraphicalViewerOperation op = new PrintGraphicalViewerOperation(
                new Printer(data), viewer);
        op.run(getWorkbenchPart().getTitle());
    }
}
项目:group-five    文件:ChartPrintJob.java   
protected void startPrintJob(Composite elementToPrint, 
        PrinterData printerData) {
    Printer printer = new Printer(printerData);
    try {
        printer.startJob(jobName);

        GC gc = new GC(printer);
        try {
            Rectangle printArea = getPrintableArea(printer, BORDER);
            printer.startPage();
            printComposite(elementToPrint, gc, printArea);
            printer.endPage();
        } finally {
            gc.dispose();
        }
        printer.endJob();

    } finally {
        printer.dispose();
    }
}
项目:group-five    文件:ChartPrintJob.java   
/**
 * @param printer
 * @param safetyBorder
 * @return the rectangle in pixels to print on (and which is also supported
 * by the printer hardware)
 */
private Rectangle getPrintableArea(Printer printer, double safetyBorder) {
    int safetyBorderWidth = (int) (safetyBorder * printer.getDPI().x);
    int safetyBorderHeight = (int) (safetyBorder * printer.getDPI().y);

    Rectangle trim = printer.computeTrim(0, 0, 0, 0);
    int trimLeft = -trim.x;
    int trimTop = -trim.y;
    int trimRight = trim.x + trim.width;
    int trimBottom = trim.y + trim.height;

    int marginLeft = Math.max(trimLeft, safetyBorderWidth);
    int marginRight = Math.max(trimRight, safetyBorderWidth);
    int marginTop = Math.max(trimTop, safetyBorderHeight);
    int marginBottom = Math.max(trimBottom, safetyBorderHeight);

    int availWidth = printer.getClientArea().width - marginLeft
            - marginRight;
    int availHeight = printer.getClientArea().height - marginTop
            - marginBottom;
    return new Rectangle(marginLeft, marginTop, availWidth, availHeight);
}
项目:geokettle-2.0    文件:Spoon.java   
private void printTransFile(TransMeta transMeta) {
    TransGraph transGraph = getActiveTransGraph();
    if (transGraph == null)
        return;

    PrintSpool ps = new PrintSpool();
    Printer printer = ps.getPrinter(shell);

    // Create an image of the screen
    Point max = transMeta.getMaximum();

    Image img = transGraph.getTransformationImage(printer, max.x, max.y, false, 1.0f);

    ps.printImage(shell, img);

    img.dispose();
    ps.dispose();
}
项目:birt    文件:SwtChartPrinter.java   
/**
 * @param args
 */
public static void main( String[] args )
{
    try
    {
        Chart chart = PrimitiveCharts.createBarChart();

        Printer printer = createPrinter();
        printChart( chart, printer );
    }
    catch ( Exception e )
    {
        e.printStackTrace();
    }

}
项目:tmxeditor8    文件:RiskRenderer.java   
public RiskRenderer(Printer printer) {
    super(printer);
    if (printer != null) {
        _yellow = printer.getSystemColor(SWT.COLOR_YELLOW);
        _green = printer.getSystemColor(SWT.COLOR_GREEN);
        _red = printer.getSystemColor(SWT.COLOR_RED);
        _black = printer.getSystemColor(SWT.COLOR_BLACK);
        _redInactive = new Color(printer, INACTIVE_RED);
        _yellowInactive = new Color(printer, INACTIVE_YELLOW);
        _greenInactive = new Color(printer, INACTIVE_GREEN);
    }
    Color[][] inactiveColors = { { _yellowInactive, _redInactive, _redInactive },
            { _greenInactive, _yellowInactive, _redInactive }, { _greenInactive, _greenInactive, _yellowInactive } };
    _inactiveColors = inactiveColors;
    Color[][] colors = { { _yellow, _red, _red }, { _green, _yellow, _red }, { _green, _green, _yellow } };
    _colors = colors;
}
项目:neoscada    文件:PrintCommand.java   
private void printQuery ( final AbstractQueryBuffer query )
{
    final List<ValueInformation> vis = query.getValueInformation ();
    final Map<String, List<Double>> values = query.getValues ();

    final PrintDialog dlg = new PrintDialog ( getWorkbenchWindow ().getShell () );

    final PrinterData printerData = dlg.open ();

    if ( printerData == null )
    {
        return;
    }

    printerData.orientation = PrinterData.LANDSCAPE;

    final Printer printer = new Printer ( printerData );

    try
    {
        final PrintProcessor processor = new PrintProcessor ( vis, values );
        processor.print ( printer );
    }
    finally
    {
        printer.dispose ();
    }
}
项目:AppleCommander    文件:SwtUtil.java   
/**
 * Display the Print dialog helper method. 
 */
public static Printer showPrintDialog(Control control) {
    PrintDialog dialog = new PrintDialog(control.getShell());
    PrinterData printerData = dialog.open();
    if (printerData == null) return null;
    return new Printer(printerData);
}
项目:http4e    文件:PrinterFacade.java   
private void printText( Printer printer){
   printer.startPage();
   wordBuffer = new StringBuilder();
   x = leftMargin;
   y = topMargin;
   index = 0;
   end = textToPrint.length();
   while (index < end) {
      char c = textToPrint.charAt(index);
      index++;
      if (c != 0) {
         if (c == 0x0a || c == 0x0d) {
            if (c == 0x0d && index < end && textToPrint.charAt(index) == 0x0a) {
               index++; // if this is cr-lf, skip the lf
            }
            printWordBuffer(printer);
            newline(printer);
         } else {
            if (c != '\t') {
               wordBuffer.append(c);
            }
            if (Character.isWhitespace(c)) {
               printWordBuffer(printer);
               if (c == '\t') {
                  x += tabWidth;
               }
            }
         }
      }
   }
   if (y + lineHeight <= bottomMargin) {
      printer.endPage();
   }
}
项目:http4e    文件:PrinterFacade.java   
private void printWordBuffer( Printer printer){
   if (wordBuffer.length() > 0) {
      String word = wordBuffer.toString();
      int wordWidth = gc.stringExtent(word).x;
      if (x + wordWidth > rightMargin) {
         /* word doesn't fit on current line, so wrap */
         newline(printer);
      }
      gc.drawString(word, x, y, false);
      x += wordWidth;
      wordBuffer = new StringBuilder();
   }
}
项目:http4e    文件:PrinterFacade.java   
private void newline( Printer printer){
   x = leftMargin;
   y += lineHeight;
   if (y + lineHeight > bottomMargin) {
      printer.endPage();
      if (index + 1 < end) {
         y = topMargin;
         printer.startPage();
      }
   }
}
项目:TuxGuitar-1.3.1-fork    文件:TGPrintAction.java   
protected TGRectangle getPrinterArea(Printer printer, float margin) {
    Rectangle clientArea = printer.getClientArea();
    Rectangle trim = printer.computeTrim(0, 0, 0, 0);
    Point dpi = printer.getDPI();

    float x = (trim.x + (dpi.x * margin));
    float y = (trim.y + (dpi.y * margin));
    float width = ((clientArea.width + trim.width) - (dpi.x * margin));
    float height = ((clientArea.height + trim.height) - (dpi.y * margin));

    return new TGRectangle(x, y, width, height);
}
项目:TuxGuitar-1.3.1-fork    文件:TGPrintAction.java   
protected float getPrinterScale(Printer printer) {
    Point dpi = printer.getDPI();
    if( dpi != null ){
        return ( dpi.x / 100.0f );
    }
    return 1.0f;
}
项目:TuxGuitar-1.3.1-fork    文件:TGPrintAction.java   
public PrintDocumentImpl(PrintLayout layout, Printer printer,PrinterData printerData, TGRectangle bounds){
    this.layout = layout;
    this.printer = printer;
    this.printerData = printerData;
    this.bounds = bounds;
    this.painter = new TGPainterImpl();
}
项目:NEXCORE-UML-Modeler    文件:PrintGraphicalViewerOperation.java   
/**
 * PrintGraphicalViewerOperation
 * @param p
 * @param g
 */
public PrintGraphicalViewerOperation(Printer p, GraphicalViewer g) {
    super(p, g);
    viewer = g;
    printer = p;
    previewBounds = ((DiagramRootEditPart)g.getRootEditPart()).getPrintPreviewFigure().getBounds();
}
项目:org.csstudio.display.builder    文件:PrintAction.java   
public PrintAction(final Shell shell, final Scene scene)
{
    super(Messages.Print,
          PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT));
    this.shell = shell;
    this.scene = scene;

    // Skip printer check on GTK because of hangups:
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=153936,
    // -Dorg.eclipse.swt.internal.gtk.disablePrinting if there are no printers,
    // https://github.com/ControlSystemStudio/cs-studio/issues/83
    if (! SWT.getPlatform().equals("gtk"))
    {
        // Only enable if printing is supported.
        final PrinterData[] printers = Printer.getPrinterList();
        if (printers != null)
        {
            logger.fine("Available printers:");
            for (PrinterData p : printers)
                logger.fine("Printer: " + p.name + " (" + p.driver + ")");
            setEnabled(printers.length > 0);
        }
        else
        {
            logger.fine("No available printers");
            setEnabled(false);
        }
    }
}
项目:org.csstudio.display.builder    文件:PrintAction.java   
/** Initialize
 *  @param shell Parent shell
 *  @param graph Graph to print
 */
public PrintAction(final Shell shell, final RTTimePlot graph)
{
    super(Messages.PrintSnapshot,
            PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT));
    this.shell = shell;
    this.graph = graph;
    this.media_pool = new SWTMediaPool(shell);

    // Skip printer check on GTK because of hangups:
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=153936,
    // -Dorg.eclipse.swt.internal.gtk.disablePrinting if there are no printers,
    // https://github.com/ControlSystemStudio/cs-studio/issues/83
    if (! SWT.getPlatform().equals("gtk"))
    {
        // Only enable if printing is supported.
        final PrinterData[] printers = Printer.getPrinterList();
        final Logger logger = Logger.getLogger(getClass().getName());
        if (printers != null)
        {
            logger.fine("Available printers:");
            for (PrinterData p : printers)
                logger.fine("Printer: " + p.name + " (" + p.driver + ")");
            setEnabled(printers.length > 0);
        }
        else
        {
            logger.fine("No available printers");
            setEnabled(false);
        }
    }
}