1 19 20 package org.netbeans.modules.project.uiapi; 21 22 import java.util.HashMap ; 23 import java.util.Map ; 24 import org.netbeans.spi.project.ui.support.ProjectCustomizer; 25 import org.openide.util.Lookup; 26 27 31 public class Utilities { 32 33 private static final Map <ProjectCustomizer.Category,CategoryChangeSupport> CATEGORIES = new HashMap <ProjectCustomizer.Category,CategoryChangeSupport>(); 34 35 private Utilities() {} 36 37 39 public static ActionsFactory getActionsFactory() { 40 ActionsFactory instance = Lookup.getDefault().lookup(ActionsFactory.class); 41 assert instance != null : "Need to have " + ActionsFactory.class.getName() + " instance in the default lookup"; 42 return instance; 43 } 44 45 47 public static ProjectChooserFactory getProjectChooserFactory() { 48 ProjectChooserFactory instance = Lookup.getDefault().lookup(ProjectChooserFactory.class); 49 assert instance != null : "Need to have " + ProjectChooserFactory.class.getName() + " instance in the default lookup"; 50 return instance; 51 } 52 53 55 public static OpenProjectsTrampoline getOpenProjectsTrampoline() { 56 OpenProjectsTrampoline instance = Lookup.getDefault().lookup(OpenProjectsTrampoline.class); 57 assert instance != null : "Need to have " + OpenProjectsTrampoline.class.getName() + " instance in the default lookup"; 58 return instance; 59 } 60 61 public static CategoryChangeSupport getCategoryChangeSupport(ProjectCustomizer.Category category) { 62 CategoryChangeSupport cw = Utilities.CATEGORIES.get(category); 63 return cw == null ? CategoryChangeSupport.NULL_INSTANCE : cw; 64 } 65 66 public static void putCategoryChangeSupport( 67 ProjectCustomizer.Category category, CategoryChangeSupport wrapper) { 68 Utilities.CATEGORIES.put(category, wrapper); 69 } 70 71 public static void removeCategoryChangeSupport(ProjectCustomizer.Category category) { 72 Utilities.CATEGORIES.remove(category); 73 } 74 75 } 76 | Popular Tags |