Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » EmbeddedEditor has missing key bindings(find/replace is not working with the Xtext EmbeddedEditor)
icon5.gif  EmbeddedEditor has missing key bindings [message #1240011] Wed, 05 February 2014 14:19 Go to next message
Joel Thurlby is currently offline Joel ThurlbyFriend
Messages: 1
Registered: February 2014
Junior Member
I'm currently implementing an EditorPart which contains an Xtext EmbeddedEditor instance. Most features found within the standard editor are working, but some key bindings like for find/replace are not working.

The same behavior can be reproduced by creating the MyDsl demo project as well as a simple EditorPart for the mydsl file extension, which includes an EmbeddedEditor instance.

What could be the cause of the missing key bindings?






Re: EmbeddedEditor has missing key bindings [message #1240138 is a reply to message #1240011] Wed, 05 February 2014 19:48 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi what about filing an enhancement request. never the less ...

import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchCommandConstants;
import org.eclipse.ui.texteditor.FindReplaceAction;
import org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorActions;
import org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorMessages;

import com.google.inject.Inject;

public class MyDslEmbeddedEditorActions extends EmbeddedEditorActions {
	
public static class Factory extends EmbeddedEditorActions.Factory {
		
		@Inject(optional=true)
		protected IWorkbench workbench;
		
		protected EmbeddedEditorActions createActions(ISourceViewer viewer) {
			return new MyDslEmbeddedEditorActions(viewer, workbench);
		}
	}

	public MyDslEmbeddedEditorActions(ISourceViewer viewer, IWorkbench workbench) {
		super(viewer, workbench);
	}
	
	@Override
	protected void createActions() {
		super.createActions();
		FindReplaceAction action= new FindReplaceAction(EmbeddedEditorMessages.getBundleForConstructedKeys(), "DontCare.", workbench.getActiveWorkbenchWindow().getShell(), viewer.getFindReplaceTarget()); //$NON-NLS-1$
		//action.setHelpContextId(IAbstractTextEditorHelpContextIds.QUICK_ASSIST_ACTION);
		action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
		setAction(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE, action);
	}

}


// In the UI Module ...
public Class<? extends EmbeddedEditorActions.Factory> bindEmbeddedEditorActions$Factory() {
			return MyDslEmbeddedEditorActions.Factory.class;
		}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 05 February 2014 19:52]

Report message to a moderator

Previous Topic:maven build fails for to long names
Next Topic:Adding another file into the generated src-gen folder with Xtext-xtend compiler
Goto Forum:
  


Current Time: Tue Apr 23 12:33:19 GMT 2024

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

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

Back to the top