Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Custom DirectEditManager
Custom DirectEditManager [message #1097875] Fri, 30 August 2013 09:20 Go to next message
Andreas Muelder is currently offline Andreas MuelderFriend
Messages: 71
Registered: July 2011
Member
Hi all,

how is it possible to change the GFDirectEditManager with a custom implementation?

Best regards,

Andreas
Re: Custom DirectEditManager [message #1097948 is a reply to message #1097875] Fri, 30 August 2013 11:32 Go to previous messageGo to next message
Felix Velasco is currently offline Felix VelascoFriend
Messages: 43
Registered: July 2009
Member
Without using a locally patched version of graphiti, I'd say it's not possible.

However, the current implementation is customizable via the associated IDirectEditingFeature. What are you trying to achieve?
Re: Custom DirectEditManager [message #1097962 is a reply to message #1097948] Fri, 30 August 2013 11:57 Go to previous messageGo to next message
Andreas Muelder is currently offline Andreas MuelderFriend
Messages: 71
Registered: July 2011
Member
Hi Felix,

thanks for the quick reply.

I created a Xtext Integration for graphical editors some time ago, see http://muelder.blogspot.de/2011/04/xtext-celleditor-integration.html for an example.

This integration adds code completion, syntax higlighting, validation etc. to the direct editor. Technically, it is implemented as a custom implementation of GEFs DirectEditManager and works well with GEF & GMF. For a new project I am evaluating Graphiti as a replacement of GMF and Xtext integration is a major requirement.

No chance to hook into an editpart factory to replace ShapeEditPart#bringUpDirectEditField without patching graphiti?

Best regards,

Andreas




Re: Custom DirectEditManager [message #1097970 is a reply to message #1097962] Fri, 30 August 2013 12:15 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Le 30/08/13 13:57, Andreas Muelder a écrit :> Hi Felix,
> thanks for the quick reply.
> I created a Xtext Integration for graphical editors some time ago, see
> http://muelder.blogspot.de/2011/04/xtext-celleditor-integration.html for
> an example.
> This integration adds code completion, syntax higlighting, validation
> etc. to the direct editor. Technically, it is implemented as a custom
> implementation of GEFs DirectEditManager and works well with GEF & GMF.
> For a new project I am evaluating Graphiti as a replacement of GMF and
> Xtext integration is a major requirement.
> No chance to hook into an editpart factory to replace
> ShapeEditPart#bringUpDirectEditField without patching graphiti?
>
> Best regards,
>
> Andreas
>
>
>
>
>

I saw your post a month ago and also wanted to integrate XtexCellEditor
in my Graphiti Editor. It works well with the XtextCellEditor from the
Yakindu Project.

Here is my code for my DirectEditingFeature :

// some imports...
import de.itemis.utils.jface.viewers.StyledTextCellEditor;
import de.itemis.xtext.utils.jface.viewers.XtextStyledTextCellEditor;
// other imports...

public class MyDirectEditFeature extends
		AbstractDirectEditingFeature implements ICellEditorProvider {

Rectangle rectangle = null; // initialized in my canDirectEdit Method

/* ... */
@Override
public int getEditingType() {
	return TYPE_CUSTOM;
}
/* ... */

@Override
public CellEditor createCellEditor(Composite parent) {

	StyledTextCellEditor cellEditor;
	Injector myInjector = MyDslActivator.getInstance().getInjector("myDSL")
	cellEditor = new XtextStyledTextCellEditor(SWT.SINGLE, myInjector);
	cellEditor.create(parent);
	
	StyledText text = (StyledText) cellEditor.getControl();
	text.setBounds(rectangle);
	return cellEditor;
}

@Override
public void relocate(CellEditor cellEditor, IFigure figure) {
	// Nothing
}

/* ... */
}



Regards

--
Nicolas H
Re: Custom DirectEditManager [message #1097987 is a reply to message #1097970] Fri, 30 August 2013 12:37 Go to previous message
Andreas Muelder is currently offline Andreas MuelderFriend
Messages: 71
Registered: July 2011
Member
Hi Nicolas,

thank you very much for the snippet, I will give it a try. You are right, it should be sufficient to replace the CellEditor instead of the DirectEditManager.

Best regards,

Andreas
Previous Topic:Zoom
Next Topic:Restrain features in the Diagram View Example
Goto Forum:
  


Current Time: Sun Nov 23 12:19:18 GMT 2014

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

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