001: /*
002: * CSCheckAllBuffersAction.java
003: *
004: * Created on 01 October 2003, 22:09
005: */
006:
007: package org.acm.seguin.ide.netbeans;
008:
009: import javax.swing.*;
010: import org.openide.cookies.*;
011: import org.openide.nodes.Node;
012: import org.openide.util.HelpCtx;
013: import org.openide.util.NbBundle;
014: import org.openide.util.actions.*;
015:
016: import org.acm.seguin.ide.common.IDEPlugin;
017:
018: /**
019: * Applies the JRefactory pretty printer to the currently selected editor. Will
020: * only be applied if only one editor is selected.
021: *
022: *@author unknown
023: *@created October 18, 2001
024: */
025: public class CSCheckAllBuffersAction extends CookieAction {
026:
027: /**
028: * Gets the helpCtx attribute of the PrettyPrinterAction object
029: *
030: *@return The helpCtx value
031: */
032: public HelpCtx getHelpCtx() {
033: return HelpCtx.DEFAULT_HELP;
034: // (PENDING) context help
035: // return new HelpCtx (PrettyPrinterAction.class);
036: }
037:
038: /**
039: * Gets the menuPresenter attribute of the PrettyPrinterAction object
040: *
041: *@return The menuPresenter value
042: */
043: // public JMenuItem getMenuPresenter() {
044: // JMenuItem item = new JMenuItem(getName());
045: // item.addActionListener(this);
046: // return item;
047: // }
048:
049: /**
050: * Gets the name attribute of the PrettyPrinterAction object
051: *
052: *@return The name value
053: */
054: public String getName() {
055: return NbBundle.getMessage(CSCheckAllBuffersAction.class,
056: "LBL_CSCheckAllBuffersAction");
057: }
058:
059: /**
060: * Description of the Method
061: *
062: *@return Description of the Return Value
063: */
064: protected Class[] cookieClasses() {
065: return new Class[] { EditorCookie.class };
066: }
067:
068: /**
069: * Perform special enablement check in addition to the normal one.
070: *
071: *@param nodes Description of the Parameter
072: *@return Description of the Return Value
073: */
074: protected boolean enable(Node[] nodes) {
075: // Any additional checks ...
076: return true;
077: }
078:
079: /**
080: * Get the path to the icon to be displayed in menus, etc
081: *
082: *@return Icon to be displayed in menus, etc.
083: */
084: protected String iconResource() {
085: return "org/acm/seguin/ide/netbeans/CSCheckAllBuffersActionIcon.gif";
086: }
087:
088: /**
089: * Perform extra initialization of this action's singleton. PLEASE do not
090: * use constructors for this purpose!
091: */
092: protected void initialize() {
093: super .initialize();
094: putProperty(CSCheckAllBuffersAction.SHORT_DESCRIPTION, NbBundle
095: .getMessage(CSCheckAllBuffersAction.class,
096: "HINT_CSCheckAllBuffersAction"));
097: }
098:
099: /**
100: *@return MODE_EXACTLY_ONE
101: */
102: protected int mode() {
103: return MODE_EXACTLY_ONE;
104: }
105:
106: /** this means that performAction is expecting to be run in the event thread */
107: protected boolean asynchronous() {
108: return false;
109: }
110:
111: /**
112: * Description of the Method
113: *
114: *@param nodes Description of the Parameter
115: */
116: protected void performAction(Node[] nodes) {
117: JRefactory.ensureVisible();
118: java.awt.Frame frame = org.openide.windows.WindowManager
119: .getDefault().getMainWindow();
120: IDEPlugin.checkAllOpenBuffers(frame);
121: }
122:
123: }
|