package com.onaro.util.jfc; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.datatransfer.*; /** * This action displays a property and copies its value to the clipboard when activated. * It is used in the debug submenus */ public class SelectedObjectDebugAction extends AbstractAction implements ClipboardOwner{ private static final long serialVersionUID = 1L; private static final String TOOLTIP_TEXT = Messages.INSTANCE.getCopyValueClipboardMessage(); private String value; public SelectedObjectDebugAction(String name, String value) { super(name+"="+value); //$NON-NLS-1$ putValue(Action.LONG_DESCRIPTION,TOOLTIP_TEXT); this.value = value; } public void actionPerformed(ActionEvent e) { Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(value),this); } public void lostOwnership(Clipboard clipboard, Transferable contents) { //do nothing } }