Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [bpel-dev] Simplify expression editors?

Dear Vincent

We successfully managed to embed an Xtext based StyledText (please
note, NOT an Xtext editor) which relies on a XtextSourceViewer, so
that you can have error markers, syntax highlighting and code
completion in a text widget embedded in the property view of the Bpel
designer. This mechanism makes use of one of the recently added
features in Xtext: EmbeddedEditor which, again, is not an editor, but
provides an XtextSourceViewer configured with all the functionalities
of the Xtext editor of your DSL, so that you can enjoy basically the
same functionalities of an Xtext editor but in a StyledText.  From
what we understand, the main problems in the Bpel designer so far were
due to trying to put an Editor (not a StyledText) in a Composite.

You can have an idea from this screenshot

http://img812.imageshack.us/img812/9185/bpelembeddededitor.png

For the moment, we put the code at this git repository (in the branch
embedd_xtext)

https://github.com/LorenzoBettini/org.eclipse.bpel/tree/embedd_xtext

which is a clone of the original org.eclipse.bpel repository.

We opened in our workspace these alternative plugins (besides all the
other ones)

/org.eclipse.bpel.ui.noEmbeddedEditors
/org.eclipse.bpel.examples.extensionPoints.noEmbeddedEditors

In that branch we also added (in the xtext subdirectory) 3 DSL
examples in Xtext.

We added a package org.eclipse.bpel.ui.properties.xtext with the
utility classes to embedd your Xtext DSL, here are some details:

- XtextEmbeddedEditorProvider should be instantiated using the
Injector of your specific Xtext DSL (the Injector can be obtained
shown later); this provider can then be used to get the Xtext
EmbeddedEditor, using getXtextEmbeddedEditor

- abstract class AbstractXtextExpressionAssignCategory extends
ExpressionSection implements
		IAssignCategory

this is a custom ExpressionSection with an abstract method

public abstract Injector getInjector();

which should be implemented by subclasses for a specific Xtext DSL

using that abstract method,
AbstractXtextExpressionAssignCategory.createClient uses an
XtextEmbeddedEditorProvider to create an EmbeddedEditor and to get the
XtextSourceViewer for the ISourceViewer.

- you find 3 examples of concrete classes that redefine the
getInjector for the 3 Xtext DSL examples, for instance

public class ArithmeticsXtextExpressionAssignCategory extends
		AbstractXtextExpressionAssignCategory {

	@Override
	public String getName() {
		return "Xtext Arithmetics Editor";
	}

	public Injector getInjector() {
		return ArithmeticsActivator
				.getInstance()
				.getInjector(
						ArithmeticsActivator.ORG_ECLIPSE_XTEXT_EXAMPLE_ARITHMETICS_ARITHMETICS);
	}
}

so the idea is that you just have to derive from
AbstractXtextExpressionAssignCategory, implement getInjector and then
everything works fine automatically

- we modified AssignImplSection.java in order to add also these assign
categories (to check whether it worked):

		fToSection.fAllowed = new IAssignCategory[] {
				new VariablePartAssignCategory(this),
				new ExpressionAssignCategory(this),
				// Xtext
				new GreetingsXtextExpressionAssignCategory(this),
				new ArithmeticsXtextExpressionAssignCategory(this),
				new FowlerDslXtextExpressionAssignCategory(this),
				// end Xtext
				new VariablePropertyAssignCategory(this),
				new PartnerRoleAssignCategory(this, false) };

		fFromSection.fAllowed = new IAssignCategory[] {
				new VariablePartAssignCategory(this),
				new ExpressionAssignCategory(this),
				// Xtext
				new GreetingsXtextExpressionAssignCategory(this),
				new ArithmeticsXtextExpressionAssignCategory(this),
				new FowlerDslXtextExpressionAssignCategory(this),
				// end Xtext
				new LiteralAssignCategory(this),
				new VariablePropertyAssignCategory(this),
				new PartnerRoleAssignCategory(this, true),
				new EndpointReferenceAssignCategory(this),
				new OpaqueAssignCategory(this) };
				
Now, if the extension points to embedd an Expression language text
widget (NOT an editor anymore) were put back in bpel designer one
could extend the details property view with custom text widget for his
own languages.  We think that the old extensions could be adapted in
order to deal NOT with editors, but with text widgets.

We hope to hear from you soon, and we'd be happy to provide help! :)

cheers
  Lorenzo and Francesco




On Tue, May 22, 2012 at 1:12 PM, Vincent Zurczak
<vincent.zurczak@xxxxxxxxxxxxxx> wrote:
>
> Hi,
>
> I changed my mind, again.
> I got back to my first idea, that is to say, rely on the XPath editor. But we must definitely drop the idea of embedding editors in a composite. This is a dead end. It is not intended for that.
> To avoid spending too much time on it, I used a styled text with the XPath source viewer configuration. It means we won't have auto-completion and so on for the moment. But we have syntax highlighting, which is a poor first step.
>
> As a user (I'm using this tool too), this is not good at all.
> However, it should be possible to add context assistance in a second step. The reason why I can't do it right now is that it requires to refactor the XPath editor and externalize some internal classes (and I don't have time for this).
> In a more general matter, I think all the XPath stuff should be externalized in a distinct plugin. It is not the first time I use the XPath source configuration, it goes beyond the scope of BPEL.
>
> Then, we could have an extensibility mechanism based on source viewer configurations instead of editors.
> I have no idea how this would impact XText editors.
> I will push it in a distinct branch this afternoon.
>
>           Vincent.
>
>
>
> Le 21/05/2012 20:39, Bob Brodt a écrit :
>
> Hi Vincent,
>
> Thanks for working on this. Before you leave, please drop me a quick email and let me know where we are with this - I can continue working on it and hopefully get a successful build again.
>
> Bob
>
>
> --
> Vincent Zurczak
>
> RCP Developer & ESB Consultant
> Petals Link: http://www.petalslink.com
> My Blog: http://vzurczak.wordpress.com
> +33 (0) 4 76 96 15 16
>
> _______________________________________________
> bpel-dev mailing list
> bpel-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/bpel-dev
>


Back to the top