1 19 20 package org.netbeans.modules.project.ui; 21 22 import javax.swing.AbstractAction ; 23 import javax.swing.Action ; 24 import org.openide.util.NbBundle; 25 import org.openide.windows.TopComponent; 26 27 public class ProjectTabAction extends AbstractAction { 28 29 private static final String ICON1 = "org/netbeans/modules/project/ui/resources/projectTab.gif"; private static final String ICON2 = "org/netbeans/modules/project/ui/resources/filesTab.gif"; 32 private static final String PHYSICAL_NAME = NbBundle.getMessage( ProjectTabAction.class, "LBL_ProjectsPhysicalTabAction_Name" ); private static final String LOGICAL_NAME = NbBundle.getMessage( ProjectTabAction.class, "LBL_ProjectsLogicalTabAction_Name" ); 35 private int type; 36 37 public static Action projectsPhysical() { 38 return new ProjectTabAction( PHYSICAL_NAME, ICON2, 0 ); 39 } 40 41 public static Action projectsLogical() { 42 return new ProjectTabAction( LOGICAL_NAME, ICON1, 1 ); 43 } 44 45 46 public ProjectTabAction( String name, String iconResource, int type ) { 47 super( name ); 48 putValue("iconBase", iconResource); this.type = type; 50 } 51 52 public void actionPerformed(java.awt.event.ActionEvent e) { 53 54 TopComponent tc = ProjectTab.findDefault( type == 1 ? ProjectTab.ID_LOGICAL : ProjectTab.ID_PHYSICAL ); 55 56 tc.open(); 57 tc.requestActive(); 58 59 60 } 61 62 } 63 | Popular Tags |