diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java index e904e617c..f6f6df0f1 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java @@ -76,6 +76,7 @@ import org.openide.util.Lookup; import org.openide.util.LookupEvent; import org.openide.util.LookupListener; import org.openide.util.NbBundle.Messages; +import org.openide.util.WeakListeners; import org.openide.util.lookup.InstanceContent; import org.openide.windows.TopComponent; @@ -484,7 +485,7 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme Dot leftDot = findConnectPoint(mapping.getLeftNameSpace(), mapping.getLeftVar(), true); Dot rightDot = findConnectPoint(mapping.getRightNameSpace(), mapping.getRightVar(), false); Connection conn = diagram1.connect(leftDot, rightDot); - mapping.addPropertyChangeListener(conn); + mapping.addPropertyChangeListener(WeakListeners.propertyChange(conn, mapping)); conn.makeKey(mapping, diagram1.getCurrentTechniqueName()); } diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java index 6ff461c43..96d005577 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java @@ -94,11 +94,10 @@ public class MaterialPreviewRenderer implements SceneListener { if (!init) { init(); } - final DesktopAssetManager assetManager = (DesktopAssetManager) SceneApplication.getApplication().getAssetManager(); SceneApplication.getApplication().enqueue(new Callable() { public Material call() throws Exception { - final Material mat = reloadMaterial(m, assetManager); + final Material mat = reloadMaterial(m); if (mat != null) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { @@ -124,11 +123,9 @@ public class MaterialPreviewRenderer implements SceneListener { } - public Material reloadMaterial(Material mat, DesktopAssetManager assetManager) { - - //MaterialKey key = new MaterialKey(mat.getMaterialDef().getAssetName()); - ((ProjectAssetManager)mat.getMaterialDef().getAssetManager()).clearCache(); - //assetManager.clearCache(); + public Material reloadMaterial(Material mat) { + + ((ProjectAssetManager)mat.getMaterialDef().getAssetManager()).clearCache(); //creating a dummy mat with the mat def of the mat to reload Material dummy = new Material(mat.getMaterialDef());