|
|
|
|
|
|
|
|
|
|
Re: Xtext: How to active hyperlink? [message #1741068 is a reply to message #1741040] |
Mon, 22 August 2016 16:03 |
Sachin Samaram Messages: 271 Registered: April 2016 |
Senior Member |
|
|
I just copied it from google.
Now all after I am getting error when I clicking on hyperlink
java.lang.NullPointerException
at org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink.open(XtextHyperlink.java:27)
at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseUp(HyperlinkManager.java:436)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:220)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
why this error?
[Updated on: Mon, 22 August 2016 16:03] Report message to a moderator
|
|
|
|
|
Re: Xtext: How to active hyperlink? [message #1741463 is a reply to message #1741127] |
Thu, 25 August 2016 11:12 |
Sachin Samaram Messages: 271 Registered: April 2016 |
Senior Member |
|
|
Hi,
Why this code is not going to its reference?
class JPLLinkHelper extends HyperlinkHelper {
@Inject
private Provider<XtextHyperlink> hyperlinkProvider;
override public void createHyperlinksByOffset(XtextResource resource, int offset,IHyperlinkAcceptor acceptor) {
val EObjectAtOffsetHelper eObjectAtOffsetHelper = new EObjectAtOffsetHelper()
val EObject eObject = eObjectAtOffsetHelper.resolveElementAt(resource, offset)
if (eObject instanceof JPLIDImpl) {
val JPLIDImpl variableName = eObject as JPLIDImpl;
val CompositeNode adapter = NodeModelUtils.getNode(variableName) as CompositeNode;
val Region region = new Region(adapter.getOffset(), adapter.getLength());
val URIConverter uriConverter = resource.getResourceSet().getURIConverter();
val String hyperlinkText = "ID";
val URI uri = EcoreUtil.getURI(eObject)
var URI normalized
if(uri.isPlatformResource()) {
normalized = uri
} else {
normalized = uriConverter.normalize(uri)
}
val XtextHyperlink result = hyperlinkProvider.get();
result.setHyperlinkRegion(region);
result.setURI(normalized);
result.setHyperlinkText(hyperlinkText);
acceptor.accept(result);
}
}
}
It is showing hyperlinks but not moving to its reference.
[Updated on: Thu, 25 August 2016 11:15] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Xtext: How to active hyperlink? [message #1741545 is a reply to message #1741540] |
Thu, 25 August 2016 17:54 |
|
I don't see in your big grammar how that model fits to the grammar.
This is once more caused by you always posting that big grammar instead of creating a small example reproducing the Problem
This helps neither me Nor you to Unterstand and solve the Problem
I would inspect a grammar like
Thing: "vars" name=ID "=" value=Expression;
Assignment : left=[Thing] "=" right=Expression
What does happen if you simply use the default impl?
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09230 seconds