|
|
|
Re: Custom DirectEditManager [message #1097970 is a reply to message #1097962] |
Fri, 30 August 2013 12:15 |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.02874 seconds