1 23 24 25 package org.enhydra.kelp.forte.actions; 26 27 import java.awt.event.ActionEvent ; 28 import java.awt.Component ; 29 import javax.swing.*; 30 31 import org.openide.util.HelpCtx; 32 import org.openide.util.NbBundle; 33 import org.openide.util.actions.Presenter; 34 import org.openide.util.actions.SystemAction; 35 40 public class EnhydraAction extends SystemAction implements Presenter.Menu, Presenter.Popup { 41 42 public void actionPerformed (ActionEvent ev) { 43 } 45 46 public String getName () { 47 return NbBundle.getMessage (EnhydraAction.class, "LBL_Enhydra_Tools"); 48 } 49 50 protected String iconResource () { 51 return "XMLCActionIcon.gif"; 52 } 53 54 public HelpCtx getHelpCtx () { 55 return HelpCtx.DEFAULT_HELP; 57 } 58 59 60 private static final SystemAction[] grouped = new SystemAction[] { 61 SystemAction.get (XMLCAction.class), 62 SystemAction.get (DeploymentAction.class), 63 SystemAction.get (AppWizardAction.class), 64 }; 65 66 private static Icon icon = null; 67 68 public JMenuItem getMenuPresenter () { 69 JMenu menu = new JMenu (getName ()); 70 if (icon == null) icon = new ImageIcon (EnhydraAction.class.getResource (iconResource ())); 71 menu.setIcon (icon); 72 for (int i = 0; i < grouped.length; i++) { 73 SystemAction action = grouped[i]; 74 if (action == null) { 75 menu.addSeparator (); 76 } else if (action instanceof Presenter.Menu) { 77 menu.add (((Presenter.Menu) action).getMenuPresenter ()); 78 } 79 } 80 return menu; 81 } 82 83 public JMenuItem getPopupPresenter () { 84 JMenu menu = new JMenu (getName ()); 85 for (int i = 0; i < grouped.length; i++) { 87 SystemAction action = grouped[i]; 88 if (action == null) { 89 menu.addSeparator (); 90 } else if (action instanceof Presenter.Popup) { 91 menu.add (((Presenter.Popup) action).getPopupPresenter ()); 92 } 93 } 94 return menu; 95 } 96 97 } 98 | Popular Tags |