SDK:
- Improve OpenModel / ConvertModel actions git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10254 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
dd0bc7f916
commit
026aa8a235
@ -31,6 +31,7 @@
|
||||
*/
|
||||
package com.jme3.gde.core.assets.actions;
|
||||
|
||||
import com.jme3.export.Savable;
|
||||
import com.jme3.gde.core.assets.BinaryModelDataObject;
|
||||
import com.jme3.gde.core.assets.SpatialAssetDataObject;
|
||||
import java.awt.event.ActionEvent;
|
||||
@ -38,9 +39,6 @@ import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import org.netbeans.api.progress.ProgressHandle;
|
||||
import org.netbeans.api.progress.ProgressHandleFactory;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.NotifyDescriptor.Confirmation;
|
||||
import org.openide.util.Exceptions;
|
||||
|
||||
public final class ConvertModel implements ActionListener {
|
||||
@ -53,22 +51,18 @@ public final class ConvertModel implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
Runnable run = new Runnable() {
|
||||
|
||||
public void run() {
|
||||
ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Converting Model");
|
||||
progressHandle.start();
|
||||
for (SpatialAssetDataObject spatialAssetDataObject : context) {
|
||||
if (!(spatialAssetDataObject instanceof BinaryModelDataObject)) {
|
||||
try {
|
||||
spatialAssetDataObject.loadAsset();
|
||||
spatialAssetDataObject.saveAsset();
|
||||
Savable sav = spatialAssetDataObject.loadAsset();
|
||||
if (sav != null) {
|
||||
spatialAssetDataObject.saveAsset();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Confirmation msg = new NotifyDescriptor.Confirmation(
|
||||
"Error converting " + spatialAssetDataObject.getName() + "\n" + ex.toString(),
|
||||
NotifyDescriptor.OK_CANCEL_OPTION,
|
||||
NotifyDescriptor.ERROR_MESSAGE);
|
||||
DialogDisplayer.getDefault().notifyLater(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import com.jme3.gde.core.scene.SceneApplication;
|
||||
import com.jme3.gde.core.scene.SceneRequest;
|
||||
import com.jme3.gde.core.sceneexplorer.nodes.JmeNode;
|
||||
import com.jme3.gde.core.sceneexplorer.nodes.NodeUtility;
|
||||
import com.jme3.gde.core.util.notify.NotifyUtil;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import java.awt.event.ActionEvent;
|
||||
@ -85,11 +86,7 @@ public final class OpenModel implements ActionListener {
|
||||
request.setWindowTitle("OpenGL Window - View Model");
|
||||
app.openScene(request);
|
||||
} else {
|
||||
Confirmation msg = new NotifyDescriptor.Confirmation(
|
||||
"Error opening " + context.getPrimaryFile().getNameExt(),
|
||||
NotifyDescriptor.OK_CANCEL_OPTION,
|
||||
NotifyDescriptor.ERROR_MESSAGE);
|
||||
DialogDisplayer.getDefault().notify(msg);
|
||||
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message("Error opening " + context.getPrimaryFile().getNameExt(), NotifyDescriptor.ERROR_MESSAGE));
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
|
Loading…
x
Reference in New Issue
Block a user