1 19 20 21 package org.netbeans.core.windows.actions; 22 23 24 import org.openide.util.NbBundle; 25 26 import javax.swing.*; 27 28 29 32 public class CloseAllDocumentsAction extends AbstractAction { 33 34 37 public CloseAllDocumentsAction() { 38 this(true); 39 } 40 41 44 public CloseAllDocumentsAction(boolean withMnemonic) { 45 String key; 46 if (withMnemonic) { 47 key = "CTL_CloseAllDocumentsAction"; } else { 49 key = "LBL_CloseAllDocumentsAction"; } 51 putValue(NAME, NbBundle.getMessage(CloseAllDocumentsAction.class, key)); 52 } 53 54 55 public void actionPerformed(java.awt.event.ActionEvent ev) { 56 ActionUtils.closeAllDocuments(); 57 } 58 59 62 public void putValue(String key, Object newValue) { 63 if (Action.ACCELERATOR_KEY.equals(key)) { 64 ActionUtils.putSharedAccelerator("CloseAllDocuments", newValue); 65 } else { 66 super.putValue(key, newValue); 67 } 68 } 69 70 73 public Object getValue(String key) { 74 if (Action.ACCELERATOR_KEY.equals(key)) { 75 return ActionUtils.getSharedAccelerator("CloseAllDocuments"); 76 } else { 77 return super.getValue(key); 78 } 79 } 80 81 } 82 83 | Popular Tags |