diff --git a/sdk/jme3-core/src/com/jme3/gde/core/assets/AssetDataObject.java b/sdk/jme3-core/src/com/jme3/gde/core/assets/AssetDataObject.java index f5178339d..5393a363a 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/assets/AssetDataObject.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/assets/AssetDataObject.java @@ -35,8 +35,8 @@ import com.jme3.asset.AssetEventListener; import com.jme3.asset.AssetKey; import com.jme3.export.Savable; import com.jme3.export.binary.BinaryExporter; +import com.jme3.gde.core.scene.ApplicationLogHandler.LogLevel; import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.util.notify.NotifyUtil; import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; @@ -52,7 +52,6 @@ import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectManager; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; -import org.openide.awt.StatusDisplayer; import org.openide.cookies.SaveCookie; import org.openide.filesystems.FileLock; import org.openide.filesystems.FileObject; @@ -74,7 +73,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 +97,7 @@ public class AssetDataObject extends MultiDataObject { protected List assetList = new LinkedList(); protected List assetKeyList = new LinkedList(); protected List failedList = new LinkedList(); - + public AssetDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException { super(pf, loader); contentLookup = new AbstractLookup(getLookupContents()); @@ -108,7 +107,7 @@ public class AssetDataObject extends MultiDataObject { setSaveCookie(saveCookie); findAssetManager(); } - + protected void findAssetManager() { FileObject file = getPrimaryFile(); ProjectManager pm = ProjectManager.getDefault(); @@ -131,14 +130,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 +147,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 +189,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 +222,14 @@ public class AssetDataObject extends MultiDataObject { } } progressHandle.finish(); - NotifyUtil.info("Saved file", "File " + getPrimaryFile().getNameExt() + " saved successfully."); + logger.log(LogLevel.USERINFO, "File {0} saved successfully", getPrimaryFile().getNameExt()); setModified(false); } - + public synchronized void closeAsset() { savable = null; } - + public synchronized AssetKey getAssetKey() { if (assetKey == null) { ProjectAssetManager mgr = getLookup().lookup(ProjectAssetManager.class); @@ -242,7 +241,7 @@ public class AssetDataObject extends MultiDataObject { } return assetKey; } - + public synchronized void setAssetKeyData(AssetKey key) { try { BeanUtils.copyProperties(getAssetKey(), key); @@ -252,37 +251,37 @@ public class AssetDataObject extends MultiDataObject { Exceptions.printStackTrace(ex); } } - + public synchronized List getAssetList() { return new LinkedList(assetList); } - + public synchronized List getAssetKeyList() { return new LinkedList(assetKeyList); } - + public synchronized List getFailedList() { return new LinkedList(failedList); } - + protected static class AssetListListener implements AssetEventListener { - + private AssetDataObject obj; private List assetList; private List assetKeyList; private List failedList; private Thread loadingThread; - + public AssetListListener(AssetDataObject obj, List assetList, List assetKeyList, List 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 +293,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 +308,7 @@ public class AssetDataObject extends MultiDataObject { failedList.add(ak1); } } - + public void start() { ProjectAssetManager pm = obj.getLookup().lookup(ProjectAssetManager.class); loadingThread = Thread.currentThread(); @@ -321,7 +320,7 @@ public class AssetDataObject extends MultiDataObject { } pm.addAssetEventListener(this); } - + public void stop() { ProjectAssetManager pm = obj.getLookup().lookup(ProjectAssetManager.class); if (pm == null) { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/ApplicationLogHandler.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/ApplicationLogHandler.java index 7febb9b8d..1283317cc 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/ApplicationLogHandler.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/ApplicationLogHandler.java @@ -50,6 +50,13 @@ import org.openide.windows.InputOutput; */ public class ApplicationLogHandler extends Handler implements Callable { + public static class LogLevel extends Level { + + public static final Level USERINFO = new LogLevel("User Info", 801, "User Info Log Level"); + public LogLevel(String name, int level, String string) { + super(name, level, string); + } + } InputOutput io = IOProvider.getDefault().getIO("Application", true); JmeFormatter formatter = new JmeFormatter(); ActionListener listener = new ActionListener() { @@ -78,7 +85,7 @@ public class ApplicationLogHandler extends Handler implements Callable NotifyUtil.show("Warning", formatter.formatMessage(record), MessageType.WARNING, listener, 5000); } else if (record.getLevel().equals(Level.INFO)) { io.getOut().println(formatter.formatMessage(record)); - } else if (record.getLevel().intValue()>800) { + } else if (record.getLevel().intValue() > 800) { //larger than INFO: NotifyUtil.show("Info", formatter.formatMessage(record), MessageType.INFO, listener, 3000); io.getOut().println(formatter.formatMessage(record));