SDK : fixed scene explorer refresh when deleting a light node

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7926 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
rem..om 2011-07-27 08:24:40 +00:00
parent 1b623df1ab
commit 48e4522da5
2 changed files with 14 additions and 9 deletions

View File

@ -53,8 +53,8 @@ import org.openide.util.actions.SystemAction;
* *
* @author normenhansen * @author normenhansen
*/ */
@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class) @org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class)
public class JmeLight extends AbstractSceneExplorerNode{ public class JmeLight extends AbstractSceneExplorerNode {
private Spatial spatial; private Spatial spatial;
private Light light; private Light light;
@ -127,7 +127,13 @@ public class JmeLight extends AbstractSceneExplorerNode{
spatial.removeLight(light); spatial.removeLight(light);
return null; return null;
} }
}).get(); }).get();
if (getParentNode() instanceof JmeNode) {
JmeNode node = ((JmeNode) getParentNode());
if (node != null) {
node.refresh(false);
}
}
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
Exceptions.printStackTrace(ex); Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
@ -142,5 +148,4 @@ public class JmeLight extends AbstractSceneExplorerNode{
public Class getExplorerNodeClass() { public Class getExplorerNodeClass() {
return JmeLight.class; return JmeLight.class;
} }
} }

View File

@ -124,7 +124,6 @@ public class JmeSpatial extends AbstractSceneExplorerNode {
// SystemAction.get(DeleteAction.class) // SystemAction.get(DeleteAction.class)
// }; // };
// } // }
@Override @Override
public Action[] getActions(boolean context) { public Action[] getActions(boolean context) {
// return super.getActions(context); // return super.getActions(context);
@ -196,10 +195,11 @@ public class JmeSpatial extends AbstractSceneExplorerNode {
return null; return null;
} }
}).get(); }).get();
//TODO: not a good cast if (getParentNode() instanceof JmeNode) {
JmeNode node = ((JmeNode) getParentNode()); JmeNode node = ((JmeNode) getParentNode());
if (node != null) { if (node != null) {
node.refresh(false); node.refresh(false);
}
} }
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
Exceptions.printStackTrace(ex); Exceptions.printStackTrace(ex);