Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Orion » Using define in Orion editor plugin(Trying to get the "define" function to work in an Orion editor plugin)
Using define in Orion editor plugin [message #1575663] Tue, 20 January 2015 23:39 Go to next message
Brian Payton is currently offline Brian PaytonFriend
Messages: 154
Registered: July 2009
Senior Member
I'm writing an Orion editor plugin to support styling and validation for a language not currently supported in Orion (that is, SQL). I'd like to follow the patterns of the many built-in Orion editor language extensions, in that they all use the "define" function (AMD pattern) to modularize those extensions. However I can't get "define" to work in my editor plugin. If I use define, I always get the dreaded "plug-in handshake timeout" error, and my plugin doesn't install. So I'm doing something wrong (or not doing something right), but I don't know what.

The editor plugin documentation mentions (in https://wiki.eclipse.org/Orion/Documentation/Developer_Guide/Simple_plugin_example, "What you need" section) that you can use "require" with a module loader loader like RequireJS. (Incidentally, shouldn't that be "define", not "require"?) But I don't find any real plugin example code that does that.

So if someone can point me to a complete editor plugin example that uses the AMD pattern, or otherwise give me some tips for making this work, I'd appreciate it.

By the way, when an Orion plugin fails to install, is there any error log entry generated anywhere with a more specific reason than "handshake timeout"? The generic error message makes it quite hard to diagnose the problem.
Re: Using define in Orion editor plugin [message #1585902 is a reply to message #1575663] Mon, 26 January 2015 14:59 Go to previous messageGo to next message
Mark Macdonald is currently offline Mark MacdonaldFriend
Messages: 35
Registered: July 2009
Member
Hi Brian,

Here is an example plugin that uses AMD:



Also, check out these troubleshooting tips for installing plugins, which I recently added to the wiki: Troubleshooting plugin installation

In my experience, the biggest issue with AMD is getting the module paths ("orion/Deferred", "orion/plugin", etc) to resolve correctly. If you still can't get it to work, try using plain old <script> tags instead.

Quote:
By the way, when an Orion plugin fails to install, is there any error log entry generated anywhere with a more specific reason than "handshake timeout"? The generic error message makes it quite hard to diagnose the problem.


When this error occurs, it means that Orion opened an iframe for the plugin, but the plugin did not call back within the timeout period. I'm not sure if it's possible for us to detect exactly what caused the failure (there are many different possible causes, as the troubleshooting steps imply). But I'll open a feature request to investigate.
Re: Using define in Orion editor plugin [message #1585931 is a reply to message #1585902] Mon, 26 January 2015 15:19 Go to previous messageGo to next message
Mark Macdonald is currently offline Mark MacdonaldFriend
Messages: 35
Registered: July 2009
Member
Quote:
you can use "require" with a module loader loader like RequireJS. (Incidentally, shouldn't that be "define", not "require"?)

"define()" is used to define individual modules. But to set the entry point, you'll still need a "require()" statement (or a "data-main" attribute) in your plugin HTML file.
Re: Using define in Orion editor plugin [message #1588392 is a reply to message #1585931] Tue, 27 January 2015 22:58 Go to previous messageGo to next message
Brian Payton is currently offline Brian PaytonFriend
Messages: 154
Registered: July 2009
Senior Member
Thanks for the pointer to the example plugin! Following the example, I was able to get my plugin to install.
Re: Using define in Orion editor plugin [message #1797527 is a reply to message #1575663] Thu, 01 November 2018 08:14 Go to previous message
arnald pirotty is currently offline arnald pirottyFriend
Messages: 3
Registered: November 2018
Junior Member
Brian Payton wrote on Tue, 20 January 2015 23:39
I'm writing an Orion editor plugin to support styling and validation for a language not currently supported in Orion (that is, SQL). I'd like to follow the patterns of the many built-in Orion editor language extensions, in that they all use the "define" function (AMD pattern) to modularize those extensions. However I can't get "define" to work in my editor plugin. If I use define, I always get the dreaded "plug-in handshake timeout" error, and my plugin doesn't install. So I'm doing something wrong (or not doing something right), but I don't know what.

The editor plugin documentation mentions (in https://wiki.eclipse.org/Orion/Documentation/Developer_Guide/Simple_plugin_example, "What you need" section) that you can use "require" with a module loader loader like RequireJS. (Incidentally, shouldn't that be "define", not "require"?) But I don't find any real plugin example code that does that.

So if someone can point me to a complete editor plugin example that uses the AMD pattern, or otherwise give me some tips for making this work, I'd appreciate it.

By the way, when an Orion plugin fails to install, is there any error log entry generated anywhere with a more specific reason than "handshake timeout"? The generic error message makes it quite hard to diagnose the problem.

When this error occurs, it means that Orion opened an iframe for the plugin, but the plugin did not call back within the timeout period. I'm not sure if it's possible for us to detect exactly what caused the failure (there are many different possible causes, as the troubleshooting steps imply). But I'll open a feature request to investigate.
Previous Topic:Adding our own submenu option in File Menu
Goto Forum:
  


Current Time: Mon Nov 19 02:39:01 GMT 2018

Powered by FUDForum. Page generated in 0.02471 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top