1 19 20 package org.netbeans.modules.welcome; 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 ShowWelcomeAction extends CallableSystemAction { 35 36 public ShowWelcomeAction() { 37 putValue("noIconInMenu", Boolean.TRUE); 38 } 39 40 public void performAction() { 41 WelcomeComponent 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 WelcomeComponent) { 47 topComp = (WelcomeComponent) tc; 48 break; 49 } 50 } 51 if(topComp == null){ 52 topComp = WelcomeComponent.findComp(); 53 } 54 55 topComp.open(); 56 topComp.requestActive(); 57 } 58 59 public String getName() { 60 return NbBundle.getMessage(ShowWelcomeAction.class, "LBL_Action"); 61 } 62 63 protected String iconResource() { 64 return "org/netbeans/modules/welcome/resources/welcome.gif"; } 66 67 public HelpCtx getHelpCtx() { 68 return HelpCtx.DEFAULT_HELP; 69 } 70 71 protected boolean asynchronous(){ 72 return false; 73 } 74 75 } 76 | Popular Tags |