SDK:
- fix custom controls and classpath updating git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9835 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
627f9b616a
commit
1ee8375d82
@ -112,11 +112,11 @@ public class ProjectAssetManager extends DesktopAssetManager {
|
||||
this(null);
|
||||
}
|
||||
|
||||
private synchronized void updateClassLoader() {
|
||||
private void clearClassLoader() {
|
||||
for (FileObject fileObject : jarItems) {
|
||||
try {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Remove locator:{0}", fileObject.getURL());
|
||||
unregisterLocator(fileObject.getURL().toExternalForm(),
|
||||
unregisterLocator(fileObject.toURL().toExternalForm(),
|
||||
com.jme3.asset.plugins.UrlLocator.class);
|
||||
} catch (FileStateInvalidException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
@ -128,6 +128,9 @@ public class ProjectAssetManager extends DesktopAssetManager {
|
||||
fileObject.object.removeRecursiveListener(fileObject.listener);
|
||||
}
|
||||
classPathItems.clear();
|
||||
}
|
||||
|
||||
private synchronized void loadClassLoader() {
|
||||
Sources sources = project.getLookup().lookup(Sources.class);
|
||||
if (sources != null) {
|
||||
if (loader != null) {
|
||||
@ -148,7 +151,9 @@ public class ProjectAssetManager extends DesktopAssetManager {
|
||||
}
|
||||
|
||||
public void fileDataCreated(FileEvent fe) {
|
||||
// notifyClassPathListeners();
|
||||
if (!fe.isExpected()) {
|
||||
notifyClassPathListeners();
|
||||
}
|
||||
}
|
||||
|
||||
public void fileChanged(FileEvent fe) {
|
||||
@ -172,12 +177,12 @@ public class ProjectAssetManager extends DesktopAssetManager {
|
||||
fileObject.addRecursiveListener(listener);
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Add classpath:{0}", fileObject);
|
||||
classPathItems.add(new ClassPathItem(fileObject, listener));
|
||||
urls.add(fileObject.getURL());
|
||||
urls.add(fileObject.toURL());
|
||||
}
|
||||
if (fileObject.getURL().toExternalForm().startsWith("jar")) {
|
||||
if (fileObject.toURL().toExternalForm().startsWith("jar")) {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Add locator:{0}", fileObject.getURL());
|
||||
jarItems.add(fileObject);
|
||||
registerLocator(fileObject.getURL().toExternalForm(),
|
||||
registerLocator(fileObject.toURL().toExternalForm(),
|
||||
"com.jme3.asset.plugins.UrlLocator");
|
||||
}
|
||||
}
|
||||
@ -191,6 +196,11 @@ public class ProjectAssetManager extends DesktopAssetManager {
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void updateClassLoader() {
|
||||
clearClassLoader();
|
||||
loadClassLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAssetEventListener(AssetEventListener listener) {
|
||||
throw new UnsupportedOperationException("Setting the asset event listener is not allowed for ProjectAssetManager, use addAssetEventListener instead");
|
||||
|
@ -59,7 +59,9 @@ public final class NewCustomControlVisualPanel1 extends JPanel {
|
||||
|
||||
Project proj;
|
||||
|
||||
/** Creates new form NewCustomControlVisualPanel1 */
|
||||
/**
|
||||
* Creates new form NewCustomControlVisualPanel1
|
||||
*/
|
||||
public NewCustomControlVisualPanel1() {
|
||||
this.proj = proj;
|
||||
initComponents();
|
||||
@ -98,7 +100,6 @@ public final class NewCustomControlVisualPanel1 extends JPanel {
|
||||
JavaSource js = JavaSource.create(cpInfo);
|
||||
try {
|
||||
js.runUserActionTask(new Task<CompilationController>() {
|
||||
|
||||
public void run(CompilationController control)
|
||||
throws Exception {
|
||||
control.toPhase(Phase.RESOLVED);
|
||||
@ -106,6 +107,7 @@ public final class NewCustomControlVisualPanel1 extends JPanel {
|
||||
// TypeUtilities util = control.getTypeUtilities();//.isCastable(Types., null)
|
||||
// util.isCastable(null, null);
|
||||
TypeElement elem = elementHandle.resolve(control);
|
||||
if (elem != null) {
|
||||
List<? extends TypeMirror> interfaces = elem.getInterfaces();
|
||||
for (TypeMirror typeMirror : interfaces) {
|
||||
String interfaceName = typeMirror.toString();
|
||||
@ -119,6 +121,7 @@ public final class NewCustomControlVisualPanel1 extends JPanel {
|
||||
list.add(elem.getQualifiedName().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
} catch (Exception ioe) {
|
||||
Exceptions.printStackTrace(ioe);
|
||||
@ -136,10 +139,10 @@ public final class NewCustomControlVisualPanel1 extends JPanel {
|
||||
scanControls();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user