- More ProjectAssetManager cleanups (final vars, logger etc)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10114 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 02964b1c0d
commit 03f1060500
  1. 28
      sdk/jme3-core/src/com/jme3/gde/core/assets/ProjectAssetManager.java

@ -75,15 +75,15 @@ import org.openide.util.lookup.Lookups;
public class ProjectAssetManager extends DesktopAssetManager { public class ProjectAssetManager extends DesktopAssetManager {
private static final Logger logger = Logger.getLogger(ProjectAssetManager.class.getName()); private static final Logger logger = Logger.getLogger(ProjectAssetManager.class.getName());
private Project project; private final Mutex mutex = new Mutex();
private URLClassLoader loader; private final Project project;
private List<String> folderNames = new LinkedList<String>();
private LinkedList<FileObject> jarItems = new LinkedList<FileObject>();
private final List<AssetEventListener> assetEventListeners = Collections.synchronizedList(new LinkedList<AssetEventListener>());
private final List<ClassPathChangeListener> classPathListeners = Collections.synchronizedList(new LinkedList<ClassPathChangeListener>()); private final List<ClassPathChangeListener> classPathListeners = Collections.synchronizedList(new LinkedList<ClassPathChangeListener>());
private final List<ClassPath> classPaths = Collections.synchronizedList(new LinkedList<ClassPath>()); private final List<ClassPath> classPaths = Collections.synchronizedList(new LinkedList<ClassPath>());
private final List<ClassPathItem> classPathItems = Collections.synchronizedList(new LinkedList<ClassPathItem>()); private final List<ClassPathItem> classPathItems = Collections.synchronizedList(new LinkedList<ClassPathItem>());
private final Mutex mutex = new Mutex(); private final List<AssetEventListener> assetEventListeners = Collections.synchronizedList(new LinkedList<AssetEventListener>());
private final List<String> folderNames = new LinkedList<String>();
private final List<FileObject> jarItems = new LinkedList<FileObject>();
private URLClassLoader loader;
public ProjectAssetManager(Project prj, String folderName) { public ProjectAssetManager(Project prj, String folderName) {
super(true); super(true);
@ -120,7 +120,7 @@ public class ProjectAssetManager extends DesktopAssetManager {
if (jarItems.isEmpty() && classPathItems.isEmpty()) { if (jarItems.isEmpty() && classPathItems.isEmpty()) {
return; return;
} }
Logger.getLogger(ProjectAssetManager.class.getName()).log(Level.INFO, "Clear {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()}); logger.log(Level.INFO, "Clear {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()});
for (FileObject fileObject : jarItems) { for (FileObject fileObject : jarItems) {
logger.log(Level.FINE, "Remove locator:{0}", fileObject.toURL()); logger.log(Level.FINE, "Remove locator:{0}", fileObject.toURL());
unregisterLocator(fileObject.toURL().toExternalForm(), unregisterLocator(fileObject.toURL().toExternalForm(),
@ -170,7 +170,7 @@ public class ProjectAssetManager extends DesktopAssetManager {
} }
loader = new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader()); loader = new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader());
addClassLoader(loader); addClassLoader(loader);
Logger.getLogger(ProjectAssetManager.class.getName()).log(Level.INFO, "Updated {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()}); logger.log(Level.INFO, "Updated {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()});
} }
} }
FileChangeListener listener = new FileChangeListener() { FileChangeListener listener = new FileChangeListener() {
@ -197,15 +197,13 @@ public class ProjectAssetManager extends DesktopAssetManager {
} }
private void fireChange(FileEvent fe) { private void fireChange(FileEvent fe) {
Logger.getLogger(ProjectAssetManager.class.getName()).log(Level.FINE, "Classpath item changed: {0}", fe); logger.log(Level.FINE, "Classpath item changed: {0}", fe);
// if (!fe.isExpected()) {
updateClassLoader(); updateClassLoader();
// }
} }
}; };
private PropertyChangeListener classPathListener = new PropertyChangeListener() { private PropertyChangeListener classPathListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
Logger.getLogger(ProjectAssetManager.class.getName()).log(Level.FINE, "Classpath event: {0}", evt); logger.log(Level.FINE, "Classpath event: {0}", evt);
if (ClassPath.PROP_ROOTS.equals(evt.getPropertyName())) { if (ClassPath.PROP_ROOTS.equals(evt.getPropertyName())) {
updateClassLoader(); updateClassLoader();
} else if (ClassPath.PROP_ENTRIES.equals(evt.getPropertyName())) { } else if (ClassPath.PROP_ENTRIES.equals(evt.getPropertyName())) {
@ -338,12 +336,6 @@ public class ProjectAssetManager extends DesktopAssetManager {
return list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
/**
* Collects files over the asset folder(s) and classpath
*
* @param suffix
* @return
*/
private List<String> collectFilesWithSuffix(String suffix) { private List<String> collectFilesWithSuffix(String suffix) {
List<String> list = new LinkedList<String>(); List<String> list = new LinkedList<String>();
FileObject assetsFolder = getAssetFolder(); FileObject assetsFolder = getAssetFolder();

Loading…
Cancel
Save