1 19 package org.openide.actions; 20 21 import org.openide.cookies.PrintCookie; 22 import org.openide.nodes.Node; 23 import org.openide.util.HelpCtx; 24 import org.openide.util.NbBundle; 25 import org.openide.util.RequestProcessor; 26 import org.openide.util.actions.CookieAction; 27 28 29 34 public class PrintAction extends CookieAction { 35 public PrintAction() { 36 putValue("noIconInMenu", Boolean.TRUE); } 38 39 protected Class [] cookieClasses() { 40 return new Class [] { PrintCookie.class }; 41 } 42 43 protected void performAction(final Node[] activatedNodes) { 44 for (int i = 0; i < activatedNodes.length; i++) { 45 PrintCookie pc = (PrintCookie) activatedNodes[i].getCookie(PrintCookie.class); 46 47 if (pc != null) { 48 pc.print(); 49 } 50 } 51 } 52 53 protected boolean asynchronous() { 54 return true; 55 } 56 57 protected int mode() { 58 return MODE_EXACTLY_ONE; 59 } 60 61 public String getName() { 62 return NbBundle.getMessage(PrintAction.class, "Print"); 63 } 64 65 public HelpCtx getHelpCtx() { 66 return new HelpCtx(PrintAction.class); 67 } 68 69 protected String iconResource() { 70 return "org/openide/resources/actions/print.png"; } 72 } 73 | Popular Tags |