1 19 20 package org.netbeans.modules.project.ui.api; 21 22 import java.beans.PropertyChangeEvent ; 23 import java.beans.PropertyChangeListener ; 24 import java.beans.PropertyChangeSupport ; 25 26 import java.util.List ; 27 28 import org.netbeans.modules.project.ui.OpenProjectList; 29 30 36 public final class RecentProjects { 37 38 41 public static final String PROP_RECENT_PROJECT_INFO = "RecentProjectInformation"; 43 private static RecentProjects INSTANCE; 44 45 private PropertyChangeSupport pch; 46 47 public static RecentProjects getDefault() { 48 if (INSTANCE == null) { 49 return new RecentProjects(); 50 } else { 51 return INSTANCE; 52 } 53 } 54 55 58 private RecentProjects() { 59 pch = new PropertyChangeSupport (this); 60 OpenProjectList.getDefault().addPropertyChangeListener(new PropertyChangeListener () { 61 public void propertyChange(PropertyChangeEvent evt) { 62 if (evt.getPropertyName().equals(OpenProjectList.PROPERTY_RECENT_PROJECTS)) { 63 pch.firePropertyChange(new PropertyChangeEvent (RecentProjects.class, 64 PROP_RECENT_PROJECT_INFO, null, null)); 65 } 66 } 67 }); 68 } 69 70 77 public List getRecentProjectInformation() { 78 return OpenProjectList.getDefault().getRecentProjectsInformation(); 79 } 80 81 85 public void addPropertyChangeListener(PropertyChangeListener listener) { 86 pch.addPropertyChangeListener(listener); 87 } 88 89 93 public void removePropertyChangeListener(PropertyChangeListener listener) { 94 pch.removePropertyChangeListener(listener); 95 } 96 97 } 98 | Popular Tags |