|
|
@ -75,7 +75,7 @@ import org.openide.util.lookup.Lookups; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
|
|
|
|
private static final Logger logger = Logger.getLogger(ProjectAssetManager.class.getName()); |
|
|
|
private Project project; |
|
|
|
private Project project; |
|
|
|
private List<String> folderNames = new LinkedList<String>(); |
|
|
|
private List<String> folderNames = new LinkedList<String>(); |
|
|
|
private final List<AssetEventListener> assetEventListeners = Collections.synchronizedList(new LinkedList<AssetEventListener>()); |
|
|
|
private final List<AssetEventListener> assetEventListeners = Collections.synchronizedList(new LinkedList<AssetEventListener>()); |
|
|
@ -105,7 +105,7 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
this.project = new DummyProject(this, path); |
|
|
|
this.project = new DummyProject(this, path); |
|
|
|
} |
|
|
|
} |
|
|
|
String string = project.getProjectDirectory().getPath(); |
|
|
|
String string = project.getProjectDirectory().getPath(); |
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Add locator: {0}", string); |
|
|
|
logger.log(Level.INFO, "Add locator: {0}", string); |
|
|
|
registerLocator(string, "com.jme3.asset.plugins.FileLocator"); |
|
|
|
registerLocator(string, "com.jme3.asset.plugins.FileLocator"); |
|
|
|
for (AssetManagerConfigurator di : Lookup.getDefault().lookupAll(AssetManagerConfigurator.class)) { |
|
|
|
for (AssetManagerConfigurator di : Lookup.getDefault().lookupAll(AssetManagerConfigurator.class)) { |
|
|
|
di.prepareManager(this); |
|
|
|
di.prepareManager(this); |
|
|
@ -123,13 +123,13 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
} |
|
|
|
} |
|
|
|
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.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()}); |
|
|
|
for (FileObject fileObject : jarItems) { |
|
|
|
for (FileObject fileObject : jarItems) { |
|
|
|
Logger.getLogger(this.getClass().getName()).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(), |
|
|
|
com.jme3.asset.plugins.UrlLocator.class); |
|
|
|
com.jme3.asset.plugins.UrlLocator.class); |
|
|
|
} |
|
|
|
} |
|
|
|
jarItems.clear(); |
|
|
|
jarItems.clear(); |
|
|
|
for (ClassPathItem fileObject : classPathItems) { |
|
|
|
for (ClassPathItem fileObject : classPathItems) { |
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Remove classpath:{0}", fileObject.object); |
|
|
|
logger.log(Level.FINE, "Remove classpath:{0}", fileObject.object); |
|
|
|
fileObject.object.removeRecursiveListener(fileObject.listener); |
|
|
|
fileObject.object.removeRecursiveListener(fileObject.listener); |
|
|
|
} |
|
|
|
} |
|
|
|
classPathItems.clear(); |
|
|
|
classPathItems.clear(); |
|
|
@ -156,12 +156,12 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
for (FileObject fileObject : roots) { |
|
|
|
for (FileObject fileObject : roots) { |
|
|
|
if (!fileObject.equals(getAssetFolder())) { |
|
|
|
if (!fileObject.equals(getAssetFolder())) { |
|
|
|
fileObject.addRecursiveListener(listener); |
|
|
|
fileObject.addRecursiveListener(listener); |
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Add classpath:{0}", fileObject); |
|
|
|
logger.log(Level.FINE, "Add classpath:{0}", fileObject); |
|
|
|
classPathItems.add(new ClassPathItem(fileObject, listener)); |
|
|
|
classPathItems.add(new ClassPathItem(fileObject, listener)); |
|
|
|
urls.add(fileObject.toURL()); |
|
|
|
urls.add(fileObject.toURL()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (fileObject.toURL().toExternalForm().startsWith("jar")) { |
|
|
|
if (fileObject.toURL().toExternalForm().startsWith("jar")) { |
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Add locator:{0}", fileObject.toURL()); |
|
|
|
logger.log(Level.FINE, "Add locator:{0}", fileObject.toURL()); |
|
|
|
jarItems.add(fileObject); |
|
|
|
jarItems.add(fileObject); |
|
|
|
registerLocator(fileObject.toURL().toExternalForm(), |
|
|
|
registerLocator(fileObject.toURL().toExternalForm(), |
|
|
|
"com.jme3.asset.plugins.UrlLocator"); |
|
|
|
"com.jme3.asset.plugins.UrlLocator"); |
|
|
@ -267,7 +267,7 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addFolderLocator(String relativePath) { |
|
|
|
public void addFolderLocator(String relativePath) { |
|
|
|
String string = project.getProjectDirectory().getPath() + "/" + relativePath + "/"; |
|
|
|
String string = project.getProjectDirectory().getPath() + "/" + relativePath + "/"; |
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Add locator:{0}", string); |
|
|
|
logger.log(Level.INFO, "Add locator:{0}", string); |
|
|
|
registerLocator(string, |
|
|
|
registerLocator(string, |
|
|
|
"com.jme3.asset.plugins.FileLocator"); |
|
|
|
"com.jme3.asset.plugins.FileLocator"); |
|
|
|
folderNames.add(relativePath); |
|
|
|
folderNames.add(relativePath); |
|
|
|