1 23 24 package org.objectweb.fractal.gui.menu.control; 25 26 import org.objectweb.fractal.gui.model.Component; 27 import org.objectweb.fractal.gui.model.ServerInterface; 28 29 import java.awt.event.ActionEvent ; 30 import java.net.URL ; 31 32 import javax.swing.ImageIcon ; 33 import javax.swing.KeyStroke ; 34 35 38 39 public class NewServerInterfaceAction extends CreateAction { 40 41 44 45 public NewServerInterfaceAction () { 46 putValue(NAME, "New server interface"); 47 putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F8")); 48 URL url = getClass().getResource( 49 "/org/objectweb/fractal/gui/resources/empty.gif"); 50 putValue(SMALL_ICON, new ImageIcon (url)); 51 setEnabled(false); 52 } 53 54 58 public void selectionChanged () { 59 setEnabled(selection.getSelection() instanceof Component); 60 } 61 62 66 public void actionPerformed (final ActionEvent e) { 67 Object o = selection.getSelection(); 68 Component c = (Component)o; 69 ServerInterface i = factory.createServerInterface(c); 70 c.addServerInterface(i); 71 } 73 } 74 | Popular Tags |