1 19 20 package org.netbeans.modules.j2ee.blueprints; 21 22 import java.util.Iterator ; 23 import java.util.Set ; 24 25 import org.openide.util.HelpCtx; 26 import org.openide.util.NbBundle; 27 import org.openide.util.actions.CallableSystemAction; 28 import org.openide.windows.TopComponent; 29 30 34 public class ShowBluePrintsAction extends CallableSystemAction { 35 36 public ShowBluePrintsAction () { 37 putValue("noIconInMenu", Boolean.TRUE); } 39 40 public void performAction() { 41 BluePrintsComponent topComp = null; 42 Set tcs = TopComponent.getRegistry().getOpened(); 43 Iterator it = tcs.iterator(); 44 while (it.hasNext()) { 45 TopComponent tc = (TopComponent)it.next(); 46 if (tc instanceof BluePrintsComponent) { 47 topComp = (BluePrintsComponent) tc; 48 break; 49 } 50 } 51 if(topComp == null){ 52 topComp = BluePrintsComponent.findComp(); 53 } 54 55 topComp.open(); 56 topComp.requestActive(); 57 } 58 59 public String getName() { 60 return NbBundle.getMessage(ShowBluePrintsAction.class, "LBL_Action"); 61 } 62 63 public HelpCtx getHelpCtx() { 64 return HelpCtx.DEFAULT_HELP; 65 } 66 67 protected boolean asynchronous(){ 68 return false; 69 } 70 71 } 72 | Popular Tags |