Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Orion (Archived) » 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 messageGo to next 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.
Re: Using define in Orion editor plugin [message #1831603 is a reply to message #1797527] Mon, 24 August 2020 18:30 Go to previous messageGo to next message
aos tv is currently offline aos tvFriend
Messages: 1
Registered: August 2020
Location: manglore
Junior Member
Thank you very much for the nice share about the orion editor plugin, it really means a lot.
Re: Using define in Orion editor plugin [message #1841466 is a reply to message #1831603] Tue, 18 May 2021 01:07 Go to previous message
Alice White is currently offline Alice WhiteFriend
Messages: 4
Registered: May 2021
Junior Member
thank you this github example was really helpful, i was looking for this explanation
Previous Topic:Invisible selected text for not focused editor?..
Next Topic:css content assist
Goto Forum:
  


Current Time: Tue Dec 10 08:37:24 GMT 2024

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

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

Back to the top