No internal or system editor

From ENIGMA
Jump to navigation Jump to search

This problem is typically encountered during a fresh install of LateralGM on Linux, when the user attempts to Edit a sprite subimage, a background image, or a sound's data. The user will click the button, and the program will pause for a very brief moment, and then the program will seem to behave as though the user never clicked the button.

Note that this problem can be avoided entirely by following the #Workaround before ever attempting to edit any images in LateralGM.

Stack Trace

The keen user might notice the terminal will dump the following lovely stack trace:

Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: no internal or system sprite editor
        at org.lateralgm.subframes.SpriteFrame$ImageEditor.start(SpriteFrame.java:1054)
        at org.lateralgm.subframes.SpriteFrame$ImageEditor.<init>(SpriteFrame.java:1042)
        at org.lateralgm.subframes.SpriteFrame.editSubimage(SpriteFrame.java:988)
        at org.lateralgm.subframes.SpriteFrame.handleToolbarEvent(SpriteFrame.java:834)
        at org.lateralgm.subframes.SpriteFrame.actionPerformed(SpriteFrame.java:819)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
        at java.awt.Component.processMouseEvent(Component.java:6504)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
        at java.awt.Component.processEvent(Component.java:6269)
        at java.awt.Container.processEvent(Container.java:2229)
        at java.awt.Component.dispatchEventImpl(Component.java:4860)
        at java.awt.Container.dispatchEventImpl(Container.java:2287)
        at java.awt.Component.dispatchEvent(Component.java:4686)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
        at java.awt.Container.dispatchEventImpl(Container.java:2273)
        at java.awt.Window.dispatchEventImpl(Window.java:2713)
        at java.awt.Component.dispatchEvent(Component.java:4686)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
        at java.awt.EventQueue.access$000(EventQueue.java:101)
        at java.awt.EventQueue$3.run(EventQueue.java:666)
        at java.awt.EventQueue$3.run(EventQueue.java:664)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.awt.EventQueue$4.run(EventQueue.java:680)
        at java.awt.EventQueue$4.run(EventQueue.java:678)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.UnsupportedOperationException: The EDIT action is not supported on the current platform!
        at java.awt.Desktop.checkActionSupport(Desktop.java:225)
        at java.awt.Desktop.edit(Desktop.java:300)
        at org.lateralgm.subframes.SpriteFrame$ImageEditor.start(SpriteFrame.java:1050)
        ... 40 more

The two unindented lines are the ones that tell the story:

UnsupportedOperationException: no internal or system sprite editor
Caused by: UnsupportedOperationException: The EDIT action is not supported on the current platform!

Explanation

The Stack Trace Exception is just telling you that you have specified that LGM should use an external sprite editor (the default behavior for LGM), but your operating system/platform does not support the EDIT action. This is a known Java bug 7035369 that affects Linux platforms (especially Debian-based).

Unfortunately, the bug has been there for ages, and it doesn't seem like any effort is being put into correcting it, so we have to provide a workaround. Since there's not a nice way to figure out what your image editor on Linux is (the nice way would have been the EDIT action...), and we cannot assume that you have a specific editor installed (we used to assume the GIMP, but Ubuntu stopped shipping with that, so now Ubuntu pretty much doesn't have an image editor), which means that you, the user, must specify a desired image editor.

Workaround

LateralGM allows you to specify a desired resource editor in its Settings/Preferences. Please see Overriding settings. The properties that you would wish to modify are:

  • externalBackgroundEditorCommand
  • externalSpriteEditorCommand
  • externalSoundEditorCommand

And a typical value for, say, Gimp, would be: gimp %s

Long Term Solution

A long term solution is planned by simply providing an image editor with LateralGM (similar to what Game Maker does). In order for it to be included, however, it would need to meet several criteria.

  • It would need to be small in filesize. LateralGM is only 1-2 MB, and it seems ridiculous to include an image editor that is larger than LGM itself - which already rules out most of the existing image editors.
  • It would need to be GNU GPL 3+ compatible, as this is the license LGM is written in. This rules out several more image editors.
  • It would need to be cross-platform, as LGM is cross-platform. A good way to achieve this would be to be written in Java.
  • It is preferred that it is written in Java, so that it can be completely internal, rather than having to launch an external program. This pretty much rules out the rest of them.

Seeing as we've pretty much ruled out every image editor in existence, this leaves the final solution: build our own. And that's exactly what we've proposed. Enter Java Easy Image Editor (JEIE).