SDK:
- fix NiftyGUI editor problems with screen selection - fix NiftyGUI editor exceptions by making sure a valid screen is selected when none is specified git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8102 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
e2a822fc48
commit
3e7d66a7fc
@ -21,6 +21,8 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.event.MouseMotionListener;
|
import java.awt.event.MouseMotionListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -39,7 +41,6 @@ import org.openide.util.Exceptions;
|
|||||||
import org.openide.xml.XMLUtil;
|
import org.openide.xml.XMLUtil;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import uk.co.mandolane.midi.e;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -111,7 +112,6 @@ public class NiftyPreviewPanel extends PanelView {
|
|||||||
add(toolBar);
|
add(toolBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updatePreView() {
|
public void updatePreView() {
|
||||||
updatePreView(screen);
|
updatePreView(screen);
|
||||||
}
|
}
|
||||||
@ -137,16 +137,32 @@ public class NiftyPreviewPanel extends PanelView {
|
|||||||
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
||||||
|
|
||||||
public Object call() throws Exception {
|
public Object call() throws Exception {
|
||||||
|
try {
|
||||||
nifty.fromXml(pm.getRelativeAssetPath(niftyObject.getPrimaryFile().getPath()), screen);
|
nifty.fromXml(pm.getRelativeAssetPath(niftyObject.getPrimaryFile().getPath()), screen);
|
||||||
|
if (screen == null || screen.length() == 0) {
|
||||||
|
Collection<String> screens = nifty.getAllScreensName();
|
||||||
|
for (Iterator<String> it = screens.iterator(); it.hasNext();) {
|
||||||
|
String string = it.next();
|
||||||
|
nifty.gotoScreen(string);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Message msg = new NotifyDescriptor.Message(
|
||||||
|
"Error opening File:" + ex,
|
||||||
|
NotifyDescriptor.ERROR_MESSAGE);
|
||||||
|
DialogDisplayer.getDefault().notifyLater(msg);
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
// java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
|
//
|
||||||
public void run() {
|
// public void run() {
|
||||||
validateTree();
|
// validateTree();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -239,7 +255,13 @@ public class NiftyPreviewPanel extends PanelView {
|
|||||||
@Override
|
@Override
|
||||||
public void showSelection(Node[] nodes) {
|
public void showSelection(Node[] nodes) {
|
||||||
this.screen = nodes[0].getName();
|
this.screen = nodes[0].getName();
|
||||||
updatePreView();
|
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
||||||
|
|
||||||
|
public Object call() throws Exception {
|
||||||
|
nifty.gotoScreen(screen);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user