|
Re: Annyoing XText model (hyper)linking [message #1312712 is a reply to message #1295558] |
Thu, 24 April 2014 13:02 |
|
You can do the following:
use your own Matcher that extends from JavaEditorInputMatcher.
public class MyMatcher extends JavaEditorInputMatcher {
private static final Logger logger = Logger.getLogger(MyMatcher.class);
@Inject
private XtextEditorInfo editorInfo;
@Inject
private XbaseEditorInputRedirector editorInputRedirector;
@Override
public boolean matches(IEditorReference editorRef, IEditorInput
inputToCheck) {
try {
if (!editorInfo.getEditorId().equals(editorRef.getId())) {
return false;
}
IEditorInput newInput =
editorInputRedirector.findOriginalSourceForOuputFolderCopy(inputToCheck);
IEditorInput currentInput = editorRef.getEditorInput();
if (newInput.equals(currentInput)) {
return true;
}
return false;
} catch(Exception e) {
logger.error(e.getMessage(), e);
}
return false;
}
}
The use it in the plugin.xml of your UI bundle of your language:
<extension
point="org.eclipse.ui.editors">
<editor
class="org.eclipse.xtext.example.domainmodel.ui.DomainmodelExecutableExtensionFactory:org.eclipse.xtext.ui.editor.XtextEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
default="true"
extensions="dmodel"
id="org.eclipse.xtext.example.domainmodel.Domainmodel"
matchingStrategy="org.eclipse.xtext.example.domainmodel.ui.DomainmodelExecutableExtensionFactory:org.eclipse.xtext.example.domainmodel.ui.MyMatcher"
name="Domainmodel Editor">
</editor>
</extension>
That's it.
On 14.04.14 13:20, Michel de Blok wrote:
> Hi all,
>
> I generate JUnit test skeletons from my XText model using a JvmBuilder.
>
> If I run these generated unit tests in Eclipse and I double-click a test
> in Eclipse's "JUnit View" then it opens the XText model instead of the
> generated Java source of the unit test.
>
> Same applies to parent classes that are generated by XText: if I'm in
> the Java source of a class that extends a generated parent and I use
> "control-click" to open the parent in Eclipse, it jumps to the model
> instead of the Java source.
>
> I find this default behavior of XText very annoying and like to disable
> it completely: If I click a class in the Java editor or JUnit view in
> Eclipse, I always want to jump to the Java source and never to the model.
>
> How can I easily do this?
>
> Regards,
> Michel de Blok
>
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
|
Powered by
FUDForum. Page generated in 0.02812 seconds