Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-incubator-e4-dev] A change of topic... for those who love plug-ins

It's welcome, just like 中国菜,can have so many tastes!
In my memory, there had a _javascript_ language plugin implementation, I would get it back and post here.

Regards,
Qinxian


2008/4/15, Christopher Aniszczyk <caniszczyk@xxxxxxxxx>:
For those of us who don't have a big modeling fetish and love plug-ins a bit more, here's a couple thoughts:

1) I have a dream that one day we'll be able to write plug-ins in various languages.

To experiment with this thought, I used my 30 hour commute from India back to the US to see if I could quickly hack up a simple example that allows you to define something plug-in related using _javascript_. The simple prototype I came up with is located on this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=227058

The simple prototype allows you to define a perspective using _javascript_.

The angle I came from is being able to reuse existing extension points but use another language to define the actual extension implementation. This is just one approach to the problem of being able to define plug-ins in other languages, and I'm just looking to start the discussion. If you look at the example code, we're simply creating an IExecutableExtensionFactory/IExecutableExtension that takes a script (from metadata available in the 'class' attribute) and creates a Java Proxy to funnel method invocations if they exist in the _javascript_ file. So here's the workflow

a) modify the class attribute in the perspective extension to look like this
org.eclipse.pde.js.core._javascript_ExtensionFactory:org.eclipse.ui.IPerspectiveFactory/perspective.js

b) the _javascript_ExtensionFactory creates a Proxy/InvocationHandler based on IPerspectiveFactory

c) the _javascript_ExtensionFactory evaluates the _javascript_ file (perspective.js)
function createInitialLayout(layout)
{   
     // Print out to the java console
     Packages.java.lang.System.out.println("_javascript_ coding is crazy");
     layout.addStandaloneView(layout.ID_RES_NAV, true, layout.LEFT, 0.2, layout.ID_EDITOR_AREA);
}

d) the InvocationHandler funnels method invocations to _javascript_ if the method is available in the script (and passes arguments of course)

That's about it... the prototype is very simple and limited, but the pattern should be the same for other extensions. I haven't looked at using EclipseMonkey and its DOMs but I'd envision that would be possible with this method... but that's kind of orthogonal (but complimentary) to the discussion of defining plug-ins in other languages.

Thoughts? Are there better approaches? How much do people care about reusing existing extension points with new languages?

2) I have a dream that one day we'll be able to write these "multi-lingual" plug-ins in a seamless manner, transparent for end users.

If we are going to open up plug-in development to other languages, we're going to have to improve the user experience. I have one idea on how to do this. I envision opening up the schema model in PDE (https://bugs.eclipse.org/bugs/show_bug.cgi?id=227055) to allow the definition of custom attribute types. Currently, you're limited to simple attribute types like java, string, boolean etc.... For example, imagine defining a new attribute type called 'color' via an extension point... in the PDE schema editors, this would show up as an attribute for you to define and give you maybe a cool color palette to help choose a color for the extension definition. The more relevant example here is defining attribute types like '_javascript_', 'groovy' 'jruby' etc... that allow you to mask any complexity in defining extensions using other languages.

See bug 227055 for some more analysis on the idea.

With that said, I'm willing to contribute my crappy simple prototype to e4 as a starting point for the 'multi-lingual plug-ins' work area. Hopefully other people are interested and willing to help flesh some ideas out before the e4 summit. I'd like to have a good idea what is needed from people so it will be easier to plan PDE in the 3.5/4.0 timeframe.

Enough rambling, what are people's thoughts here expanding the lingua franca of plug-ins outside of Java ;)?

--
Cheers,

~ Chris Aniszczyk

_______________________________________________
eclipse-incubator-e4-dev mailing list
eclipse-incubator-e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipse-incubator-e4-dev




--
致敬
向雅

Back to the top