This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 154280
Collapse All | Expand All

(-)a/project.libraries/src/org/netbeans/modules/project/libraries/LibrariesStorage.java (-1 / +16 lines)
Lines 72-83 Link Here
72
import org.openide.filesystems.FileUtil;
72
import org.openide.filesystems.FileUtil;
73
import org.openide.filesystems.Repository;
73
import org.openide.filesystems.Repository;
74
import org.openide.util.NbBundle;
74
import org.openide.util.NbBundle;
75
import org.openide.util.Task;
76
import org.openide.util.TaskListener;
75
import org.openide.xml.XMLUtil;
77
import org.openide.xml.XMLUtil;
76
import org.xml.sax.InputSource;
78
import org.xml.sax.InputSource;
77
import org.xml.sax.SAXException;
79
import org.xml.sax.SAXException;
78
80
79
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.spi.project.libraries.LibraryProvider.class)
81
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.spi.project.libraries.LibraryProvider.class)
80
public class LibrariesStorage extends FileChangeAdapter implements WritableLibraryProvider<LibraryImplementation> {
82
public class LibrariesStorage extends FileChangeAdapter
83
implements WritableLibraryProvider<LibraryImplementation>, TaskListener {
81
84
82
    private static final String NB_HOME_PROPERTY = "netbeans.home";  //NOI18N
85
    private static final String NB_HOME_PROPERTY = "netbeans.home";  //NOI18N
83
    private static final String LIBRARIES_REPOSITORY = "org-netbeans-api-project-libraries/Libraries";  //NOI18N
86
    private static final String LIBRARIES_REPOSITORY = "org-netbeans-api-project-libraries/Libraries";  //NOI18N
Lines 206-211 Link Here
206
            }            
209
            }            
207
            this.loadFromStorage();            
210
            this.loadFromStorage();            
208
            this.storage.addFileChangeListener (this);
211
            this.storage.addFileChangeListener (this);
212
            LibraryTypeRegistry.getDefault().addTaskListener(this);
209
            initialized = true;
213
            initialized = true;
210
        }
214
        }
211
    }
215
    }
Lines 564-567 Link Here
564
        return sb.toString();
568
        return sb.toString();
565
    }
569
    }
566
570
571
    public void taskFinished(Task task) {
572
        if (initialized) {
573
            HashMap<String, LibraryImplementation> clone;
574
            clone = new HashMap<String,LibraryImplementation>(libraries);
575
            loadFromStorage();
576
            if (!clone.equals(libraries)) {
577
                fireLibrariesChanged();
578
            }
579
        }
580
    }
581
567
}
582
}
(-)a/project.libraries/test/unit/src/org/netbeans/modules/project/libraries/LibrariesStorageTest.java (-4 / +4 lines)
Lines 174-180 Link Here
174
        }
174
        }
175
    }
175
    }
176
    
176
    
177
    private static void registerLibraryTypeProvider () throws Exception {
177
    static void registerLibraryTypeProvider () throws Exception {
178
        StringTokenizer tk = new StringTokenizer("org-netbeans-api-project-libraries/LibraryTypeProviders","/");
178
        StringTokenizer tk = new StringTokenizer("org-netbeans-api-project-libraries/LibraryTypeProviders","/");
179
        FileObject root = Repository.getDefault().getDefaultFileSystem().getRoot();
179
        FileObject root = Repository.getDefault().getDefaultFileSystem().getRoot();
180
        while (tk.hasMoreElements()) {
180
        while (tk.hasMoreElements()) {
Lines 192-198 Link Here
192
        }
192
        }
193
    }
193
    }
194
    
194
    
195
    private static void createLibraryDefinition (final FileObject storageFolder, final String libName) throws IOException {
195
    static void createLibraryDefinition (final FileObject storageFolder, final String libName) throws IOException {
196
        storageFolder.getFileSystem().runAtomicAction(new FileSystem.AtomicAction() {
196
        storageFolder.getFileSystem().runAtomicAction(new FileSystem.AtomicAction() {
197
            public void run () throws IOException {
197
            public void run () throws IOException {
198
                FileObject defFile = storageFolder.createData(libName,"xml");
198
                FileObject defFile = storageFolder.createData(libName,"xml");
Lines 222-228 Link Here
222
        });
222
        });
223
    }
223
    }
224
    
224
    
225
    private static class TestListener implements PropertyChangeListener {
225
    static class TestListener implements PropertyChangeListener {
226
        
226
        
227
        private List<String> eventNames = new ArrayList<String>();
227
        private List<String> eventNames = new ArrayList<String>();
228
        
228
        
Lines 241-247 Link Here
241
    }
241
    }
242
    
242
    
243
    
243
    
244
    private static class TestEntityCatalog extends EntityCatalog {        
244
    static class TestEntityCatalog extends EntityCatalog {        
245
        
245
        
246
        private static final String DTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
246
        private static final String DTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
247
            "<!ELEMENT library (name, type, description?, localizing-bundle?, volume*) >\n" +
247
            "<!ELEMENT library (name, type, description?, localizing-bundle?, volume*) >\n" +

Return to bug 154280