1 9 10 package org.netbeans.modules.web.jsf.navigation.graph.actions; 11 12 import org.netbeans.modules.web.jsf.navigation.graph.NavigationBridgeUtilities; 13 import java.awt.Point ; 14 import java.awt.event.ActionEvent ; 15 import java.awt.event.ActionListener ; 16 import java.awt.event.InputEvent ; 17 import java.awt.event.KeyEvent ; 18 import javax.swing.JMenuItem ; 19 import javax.swing.JPopupMenu ; 20 import javax.swing.KeyStroke ; 21 import org.netbeans.api.visual.action.PopupMenuProvider; 22 import org.netbeans.api.visual.widget.Widget; 23 import org.netbeans.modules.web.jsf.navigation.graph.NavigationGraphScene; 24 import org.openide.util.NbBundle; 25 26 30 public class GraphPopupProvider implements PopupMenuProvider, ActionListener { 31 32 NavigationGraphScene graphScene; 33 34 private JMenuItem miAddWebPage; 35 private JPopupMenu graphPopup; 36 37 private String addPage = NbBundle.getMessage(GraphPopupProvider.class, "MSG_AddPage"); 38 39 40 41 public GraphPopupProvider(NavigationGraphScene graphScene) { 42 43 this.graphScene = graphScene; 44 initialize(); 45 } 46 47 private void initialize() { 48 49 graphPopup = new JPopupMenu ("Transition Menu"); 50 51 graphPopup = new JPopupMenu (); 52 miAddWebPage = new JMenuItem (addPage); 53 miAddWebPage.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,InputEvent.CTRL_MASK)); 54 miAddWebPage.addActionListener(this); 55 graphPopup.add(miAddWebPage); 56 } 57 58 59 60 public JPopupMenu getPopupMenu(Widget widget, Point point){ 61 return graphPopup; 62 } 63 64 65 public void actionPerformed(ActionEvent e) { 66 67 if(e.getSource() == miAddWebPage){ 68 NavigationBridgeUtilities.getInstance().createWebPage(); 69 } 70 return; 71 } 72 73 } 74 | Popular Tags |