public void paste() {   System.out.println("Paste called");
public void paste() {
	public void paste() {		//if (IJ.macroRunning())		//	IJ.wait(500);		System.out.println("Paste called");		if (clipboard==null) {			System.out.println("Clipboard empty, no pasting today");			return;		}		int cType = clipboard.getType();		int iType = imp.getType();				boolean sameType = false;		if ((cType==ImagePlus.GRAY8|cType==ImagePlus.COLOR_256)&&(iType==ImagePlus.GRAY8|iType==ImagePlus.COLOR_256)) sameType = true;		else if ((cType==ImagePlus.COLOR_RGB|cType==ImagePlus.GRAY8|cType==ImagePlus.COLOR_256)&&iType==ImagePlus.COLOR_RGB) sameType = true;		else if (cType==ImagePlus.GRAY16&&iType==ImagePlus.GRAY16) sameType = true;		else if (cType==ImagePlus.GRAY32&&iType==ImagePlus.GRAY32) sameType = true;		if (!sameType) {			IJ.error("Images must be the same type to paste.");			return;		}        int w = clipboard.getWidth();        int h = clipboard.getHeight();		if (w>imp.getWidth() || h>imp.getHeight()) {			IJ.error("Image is too large to paste.");			return;		}		Roi roi = imp.getRoi();		Rectangle r = null;		if (roi!=null)			r = roi.getBounds();		if (r==null || (r!=null && (w!=r.width || h!=r.height))) {			// create a new roi centered on visible part of image			Rectangle srcRect = getSrcRect();			int xCenter = srcRect.x + srcRect.width/2;			int yCenter = srcRect.y + srcRect.height/2;			Roi cRoi = clipboard.getRoi();			if (cRoi!=null && cRoi.getType()!=Roi.RECTANGLE) {				cRoi.setImage(imp);				cRoi.setLocation(xCenter-w/2, yCenter-h/2);				imp.setRoi(cRoi);			} else				imp.setRoi(xCenter-w/2, yCenter-h/2, w, h);			roi = imp.getRoi();		}		if (IJ.macroRunning()) {			//non-interactive paste			int pasteMode = Roi.getCurrentPasteMode();			boolean nonRect = roi.getType()!=Roi.RECTANGLE;			ImageProcessor ip = imp.getProcessor();			if (nonRect) ip.snapshot();			r = roi.getBounds();			ip.copyBits(clipboard.getProcessor(), r.x, r.y, pasteMode);			if (nonRect)				ip.reset(imp.getMask());			imp.updateAndDraw();			imp.killRoi();		} else {			roi.startPaste(clipboard);			Undo.setup(Undo.PASTE, imp);		}		imp.changes = true;		//Image img = clipboard.getImage();		//ImagePlus imp2 = new ImagePlus("Clipboard", img);		//imp2.show();    }