|
|
@ -73,15 +73,16 @@ 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 static final Logger logger = Logger.getLogger(ProjectAssetManager.class.getName()); |
|
|
|
private Project project; |
|
|
|
private Project project; |
|
|
|
|
|
|
|
private URLClassLoader loader; |
|
|
|
private List<String> folderNames = new LinkedList<String>(); |
|
|
|
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<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 URLClassLoader loader; |
|
|
|
|
|
|
|
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 LinkedList<FileObject> jarItems = new LinkedList<FileObject>(); |
|
|
|
|
|
|
|
private final Mutex mutex = new Mutex(); |
|
|
|
private final Mutex mutex = new Mutex(); |
|
|
|
|
|
|
|
|
|
|
|
public ProjectAssetManager(Project prj, String folderName) { |
|
|
|
public ProjectAssetManager(Project prj, String folderName) { |
|
|
@ -137,7 +138,7 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
classPaths.clear(); |
|
|
|
classPaths.clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private synchronized void loadClassLoader() { |
|
|
|
private void loadClassLoader() { |
|
|
|
Sources sources = ProjectUtils.getSources(project); |
|
|
|
Sources sources = ProjectUtils.getSources(project); |
|
|
|
if (sources != null) { |
|
|
|
if (sources != null) { |
|
|
|
if (loader != null) { |
|
|
|
if (loader != null) { |
|
|
@ -215,7 +216,7 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private synchronized void updateClassLoader() { |
|
|
|
private void updateClassLoader() { |
|
|
|
ProjectManager.mutex().postWriteRequest(new Runnable() { |
|
|
|
ProjectManager.mutex().postWriteRequest(new Runnable() { |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
synchronized (classPathItems) { |
|
|
|
synchronized (classPathItems) { |
|
|
@ -328,12 +329,12 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
return filesWithSuffix("j3md"); |
|
|
|
return filesWithSuffix("j3md"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String[] getAssetsWithSuffix(String string){ |
|
|
|
public String[] getAssetsWithSuffix(String string) { |
|
|
|
return filesWithSuffix(string); |
|
|
|
return filesWithSuffix(string); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String[] filesWithSuffix(String string){ |
|
|
|
private String[] filesWithSuffix(String string) { |
|
|
|
List<String> list=collectFilesWithSuffix(string); |
|
|
|
List<String> list = collectFilesWithSuffix(string); |
|
|
|
return list.toArray(new String[list.size()]); |
|
|
|
return list.toArray(new String[list.size()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -356,7 +357,6 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (classPathItems != null) { |
|
|
|
|
|
|
|
synchronized (classPathItems) { |
|
|
|
synchronized (classPathItems) { |
|
|
|
// TODO I need to find out if classPathItems contains all jars added to a project
|
|
|
|
// TODO I need to find out if classPathItems contains all jars added to a project
|
|
|
|
Iterator<ClassPathItem> classPathItemsIter = classPathItems.iterator(); |
|
|
|
Iterator<ClassPathItem> classPathItemsIter = classPathItems.iterator(); |
|
|
@ -373,8 +373,6 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -384,7 +382,6 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
public InputStream getResourceAsStream(String name) { |
|
|
|
public InputStream getResourceAsStream(String name) { |
|
|
|
InputStream in = null;//JmeSystem.getResourceAsStream(name);
|
|
|
|
InputStream in = null;//JmeSystem.getResourceAsStream(name);
|
|
|
|
synchronized (classPathItems) { |
|
|
|
synchronized (classPathItems) { |
|
|
|
if (in == null && classPathItems != null) { |
|
|
|
|
|
|
|
// TODO I need to find out if classPathItems contains all jars added to a project
|
|
|
|
// TODO I need to find out if classPathItems contains all jars added to a project
|
|
|
|
Iterator<ClassPathItem> classPathItemsIter = classPathItems.iterator(); |
|
|
|
Iterator<ClassPathItem> classPathItemsIter = classPathItems.iterator(); |
|
|
|
while (classPathItemsIter.hasNext()) { |
|
|
|
while (classPathItemsIter.hasNext()) { |
|
|
@ -405,7 +402,6 @@ public class ProjectAssetManager extends DesktopAssetManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return in; |
|
|
|
return in; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|