Settings.getInstance().setShowGrid(showGrid); CommandManager.getInstance().execute("RepaintWorkspace");
		public void run() {			try {				PrintRequestAttributeSet printRequestAttributeSet = Page.getPrintRequestAttributeSet();				PrinterJob printerJob = PrinterJob.getPrinterJob();				printerJob.setJobName(getTitle());				printerJob.setPageable(pi.getPageable());								if (lastPrintService != null) {				    try {	                    printerJob.setPrintService(lastPrintService);	                } catch (PrinterException e) {	                    handleException(e);	                }				}								if(!printerJob.printDialog(printRequestAttributeSet)) {				    lastPrintService = printerJob.getPrintService();					return;				}				lastPrintService = printerJob.getPrintService();								int pageFormatOrientation = PageFormat.PORTRAIT;				OrientationRequested orientationRequested = (OrientationRequested)					printRequestAttributeSet.get(OrientationRequested.class);									if(orientationRequested != null)				{					if(orientationRequested.equals(OrientationRequested.LANDSCAPE))						pageFormatOrientation = PageFormat.LANDSCAPE;					else if(orientationRequested.equals(OrientationRequested.REVERSE_LANDSCAPE))						pageFormatOrientation = PageFormat.REVERSE_LANDSCAPE;				}								pi.getPageable().getPageFormat(0).setOrientation(pageFormatOrientation);				MediaPrintableArea mediaPrintableArea = (MediaPrintableArea)					printRequestAttributeSet.get(MediaPrintableArea.class);									Paper paper = pi.getPageable().getPageFormat(0).getPaper();				paper.setImageableArea(mediaPrintableArea.getX(MediaPrintableArea.INCH) * 72.0,					mediaPrintableArea.getY(MediaPrintableArea.INCH) * 72.0,					mediaPrintableArea.getWidth(MediaPrintableArea.INCH) * 72,					mediaPrintableArea.getHeight(MediaPrintableArea.INCH) * 72);					pi.getPageable().getPageFormat(0).setPaper(paper);				// store settings 				com.cosylab.vdct.graphics.printing.Page.setPageFormat(pi.getPageable().getPageFormat(0));				setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));								Thread.yield();				printerJob.print(printRequestAttributeSet);											} catch (PrinterException ex) {				ex.printStackTrace();				com.cosylab.vdct.Console.getInstance().println("Printing error: "+ex);			}			finally			{				setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));			}		}