1 19 20 package org.netbeans.core.actions; 21 22 import java.awt.datatransfer.Clipboard ; 23 import java.awt.datatransfer.StringSelection ; 24 import org.netbeans.core.ui.ProductInformationPanel; 25 import org.openide.util.HelpCtx; 26 import org.openide.util.NbBundle; 27 import org.openide.util.actions.CallableSystemAction; 28 29 34 public class CopyProductInfoAction extends CallableSystemAction { 35 36 public String getName() { 37 return NbBundle.getBundle(CopyProductInfoAction.class).getString("CopyProductInfo"); 38 } 39 40 public HelpCtx getHelpCtx() { 41 return HelpCtx.DEFAULT_HELP; 42 } 45 46 protected String iconResource() { 47 return "org/netbeans/core/resources/copy.gif"; } 49 50 public CopyProductInfoAction() { 51 String tooltip = NbBundle.getMessage(ProductInformationPanel.class, 52 "CTL_CopyButton_tooltip"); putValue(javax.swing.Action.SHORT_DESCRIPTION, tooltip); 54 putValue("iconBase", iconResource()); 55 } 56 57 protected boolean asynchronous() { 58 return false; 59 } 60 61 public void performAction() { 62 StringBuilder sb = new StringBuilder (); 63 sb.append(ProductInformationPanel.getProductVersionValue()); 64 sb.append('\n'); 65 sb.append(ProductInformationPanel.getJavaValue()); 66 sb.append("; "); 67 sb.append(ProductInformationPanel.getVMValue()); 68 sb.append('\n'); 69 sb.append(ProductInformationPanel.getOperatingSystemValue()); 70 sb.append('\n'); 71 sb.append(ProductInformationPanel.getSystemLocaleValue()); 72 sb.append("; "); 73 sb.append(ProductInformationPanel.getEncodingValue()); 74 StringSelection stringSel = new StringSelection (sb.toString()); 75 Clipboard cb = ProductInformationPanel.getExClipboard(); 76 if (cb != null) { 77 cb.setContents(stringSel, null); 78 } 79 } 80 81 } 82 | Popular Tags |