فهرست منبع

SDK:
- Make log warning/exception bubbles open log.. :)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10255 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

nor..67 12 سال پیش
والد
کامیت
a3ca919bef

+ 25 - 25
jme3-core/src/com/jme3/gde/core/assets/AssetDataObject.java

@@ -74,7 +74,7 @@ import org.openide.util.lookup.ProxyLookup;
  */
 @SuppressWarnings("unchecked")
 public class AssetDataObject extends MultiDataObject {
-
+    
     protected static final Logger logger = Logger.getLogger(AssetDataObject.class.getName());
     protected final Lookup lookup;
     protected final InstanceContent lookupContents = new InstanceContent();
@@ -98,7 +98,7 @@ public class AssetDataObject extends MultiDataObject {
     protected List<FileObject> assetList = new LinkedList<FileObject>();
     protected List<AssetKey> assetKeyList = new LinkedList<AssetKey>();
     protected List<AssetKey> failedList = new LinkedList<AssetKey>();
-
+    
     public AssetDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
         super(pf, loader);
         contentLookup = new AbstractLookup(getLookupContents());
@@ -108,7 +108,7 @@ public class AssetDataObject extends MultiDataObject {
         setSaveCookie(saveCookie);
         findAssetManager();
     }
-
+    
     protected void findAssetManager() {
         FileObject file = getPrimaryFile();
         ProjectManager pm = ProjectManager.getDefault();
@@ -131,14 +131,14 @@ public class AssetDataObject extends MultiDataObject {
         }
 //        getLookupContents().add(new ProjectAssetManager(file.getParent()));
     }
-
+    
     @Override
     protected Node createNodeDelegate() {
         AssetDataNode node = new AssetDataNode(this, Children.LEAF, new ProxyLookup(getCookieSet().getLookup(), contentLookup));
         node.setIconBaseWithExtension("com/jme3/gde/core/icons/jme-logo.png");
         return node;
     }
-
+    
     @Override
     public synchronized void setModified(boolean modif) {
         super.setModified(modif);
@@ -148,22 +148,22 @@ public class AssetDataObject extends MultiDataObject {
             getCookieSet().assign(SaveCookie.class);
         }
     }
-
+    
     @Override
     public Lookup getLookup() {
         return lookup;
     }
-
+    
     public InstanceContent getLookupContents() {
         return lookupContents;
     }
-
+    
     public synchronized void setSaveCookie(SaveCookie cookie) {
         this.saveCookie = cookie;
         getCookieSet().assign(SaveCookie.class, saveCookie);
         setModified(false);
     }
-
+    
     public synchronized Savable loadAsset() {
         if (isModified() && savable != null) {
             return savable;
@@ -190,7 +190,7 @@ public class AssetDataObject extends MultiDataObject {
         }
         return savable;
     }
-
+    
     public synchronized void saveAsset() throws IOException {
         if (savable == null) {
             logger.log(Level.WARNING, "Trying to write asset failed, asset data null!\nImport failed?");
@@ -223,14 +223,14 @@ public class AssetDataObject extends MultiDataObject {
             }
         }
         progressHandle.finish();
-        StatusDisplayer.getDefault().setStatusText(getPrimaryFile().getNameExt() + " saved.");
+        NotifyUtil.info("Saved file", "File " + getPrimaryFile().getNameExt() + " saved successfully.");
         setModified(false);
     }
-
+    
     public synchronized void closeAsset() {
         savable = null;
     }
-
+    
     public synchronized AssetKey<?> getAssetKey() {
         if (assetKey == null) {
             ProjectAssetManager mgr = getLookup().lookup(ProjectAssetManager.class);
@@ -242,7 +242,7 @@ public class AssetDataObject extends MultiDataObject {
         }
         return assetKey;
     }
-
+    
     public synchronized void setAssetKeyData(AssetKey key) {
         try {
             BeanUtils.copyProperties(getAssetKey(), key);
@@ -252,37 +252,37 @@ public class AssetDataObject extends MultiDataObject {
             Exceptions.printStackTrace(ex);
         }
     }
-
+    
     public synchronized List<FileObject> getAssetList() {
         return new LinkedList<FileObject>(assetList);
     }
-
+    
     public synchronized List<AssetKey> getAssetKeyList() {
         return new LinkedList<AssetKey>(assetKeyList);
     }
-
+    
     public synchronized List<AssetKey> getFailedList() {
         return new LinkedList<AssetKey>(failedList);
     }
-
+    
     protected static class AssetListListener implements AssetEventListener {
-
+        
         private AssetDataObject obj;
         private List<FileObject> assetList;
         private List<AssetKey> assetKeyList;
         private List<AssetKey> failedList;
         private Thread loadingThread;
-
+        
         public AssetListListener(AssetDataObject obj, List<FileObject> assetList, List<AssetKey> assetKeyList, List<AssetKey> failedList) {
             this.obj = obj;
             this.assetList = assetList;
             this.assetKeyList = assetKeyList;
             this.failedList = failedList;
         }
-
+        
         public void assetLoaded(AssetKey ak) {
         }
-
+        
         public void assetRequested(AssetKey ak) {
             ProjectAssetManager pm = obj.getLookup().lookup(ProjectAssetManager.class);
             if (pm == null || loadingThread != Thread.currentThread()) {
@@ -294,7 +294,7 @@ public class AssetDataObject extends MultiDataObject {
                 assetKeyList.add(ak);
             }
         }
-
+        
         public void assetDependencyNotFound(AssetKey ak, AssetKey ak1) {
             ProjectAssetManager pm = obj.getLookup().lookup(ProjectAssetManager.class);
             if (pm == null || loadingThread != Thread.currentThread()) {
@@ -309,7 +309,7 @@ public class AssetDataObject extends MultiDataObject {
                 failedList.add(ak1);
             }
         }
-
+        
         public void start() {
             ProjectAssetManager pm = obj.getLookup().lookup(ProjectAssetManager.class);
             loadingThread = Thread.currentThread();
@@ -321,7 +321,7 @@ public class AssetDataObject extends MultiDataObject {
             }
             pm.addAssetEventListener(this);
         }
-
+        
         public void stop() {
             ProjectAssetManager pm = obj.getLookup().lookup(ProjectAssetManager.class);
             if (pm == null) {

+ 13 - 4
jme3-core/src/com/jme3/gde/core/scene/ApplicationLogHandler.java

@@ -31,8 +31,11 @@
  */
 package com.jme3.gde.core.scene;
 
+import com.jme3.gde.core.util.notify.MessageType;
 import com.jme3.gde.core.util.notify.NotifyUtil;
 import com.jme3.util.JmeFormatter;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.util.logging.Handler;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
@@ -47,6 +50,11 @@ public class ApplicationLogHandler extends Handler {
 
     InputOutput io = IOProvider.getDefault().getIO("Application", true);
     JmeFormatter formatter = new JmeFormatter();
+    ActionListener listener = new ActionListener() {
+        public void actionPerformed(ActionEvent e) {
+            io.select();
+        }
+    };
 
     public ApplicationLogHandler() {
         io.setErrSeparated(true);
@@ -57,15 +65,16 @@ public class ApplicationLogHandler extends Handler {
         if (record.getLevel().equals(Level.SEVERE)) {
             Throwable thrown = record.getThrown();
             if (thrown != null) {
-                NotifyUtil.error("Exception!", formatter.formatMessage(record), false);
-            }else{
-                NotifyUtil.error("Severe error!", formatter.formatMessage(record), true);
+                NotifyUtil.show("Exception!", formatter.formatMessage(record), MessageType.EXCEPTION, listener, 0);
+            } else {
+                NotifyUtil.show("Error!", formatter.formatMessage(record), MessageType.ERROR, listener, 10000);
             }
             io.getErr().println(formatter.formatMessage(record));
         } else if (record.getLevel().equals(Level.WARNING)) {
             io.getErr().println(formatter.formatMessage(record));
-            NotifyUtil.warn("Warning!", formatter.formatMessage(record), true);
+            NotifyUtil.show("Warning", formatter.formatMessage(record), MessageType.WARNING, listener, 5000);
         } else if (record.getLevel().equals(Level.INFO)) {
+//            NotifyUtil.show("Message", formatter.formatMessage(record), MessageType.INFO, listener, 3000);
             io.getOut().println(formatter.formatMessage(record));
         } else {
             io.getOut().println(formatter.formatMessage(record));