Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2019-07-12 09:44:56 -0400
committerJuergen Haug2019-07-12 09:44:56 -0400
commita80dc281a8ed60ede81911e927e0c05973881de9 (patch)
treedaa4fda6c13eb61a53aacec133118f6ad0188f09
parent76b8609dc25774b804addfbe13be96065d0e15a6 (diff)
downloadorg.eclipse.etrice-a80dc281a8ed60ede81911e927e0c05973881de9.tar.gz
org.eclipse.etrice-a80dc281a8ed60ede81911e927e0c05973881de9.tar.xz
org.eclipse.etrice-a80dc281a8ed60ede81911e927e0c05973881de9.zip
fixed NPEv_2.0.0-RC11
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/linking/ImportAwareHyperlinkHelper.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/linking/ImportAwareHyperlinkHelper.java b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/linking/ImportAwareHyperlinkHelper.java
index c349db409..df7195a19 100644
--- a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/linking/ImportAwareHyperlinkHelper.java
+++ b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/linking/ImportAwareHyperlinkHelper.java
@@ -58,29 +58,29 @@ public class ImportAwareHyperlinkHelper extends HyperlinkHelper {
}
// FQN and ImportedFQN => create link on fqn
- if (parentRule.getName().equals("FQN") || parentRule.getName().equals("ImportedFQN")) {
+ if (parentRule != null && (parentRule.getName().equals("FQN") || parentRule.getName().equals("ImportedFQN"))) {
QualifiedName fqn = importHelpers.toFQN(leaf.getParent().getText().trim());
// query global scope, that is how elements are actually resolved
IScope scope = importHelpers.getVisibleScope(resource, null);
IEObjectDescription candidate = scope.getSingleElement(fqn); // take first
- if(candidate != null) {
+ if (candidate != null) {
createHyperlinksTo(resource, region, candidate.getEObjectOrProxy(), acceptor);
}
}
// Import-importURI => create link on uri text
- else if(parentRule.getName().equals("Import") && leafRule.getName().equals("STRING")) {
+ else if (parentRule != null && leafRule != null && parentRule.getName().equals("Import")
+ && leafRule.getName().equals("STRING")) {
String text = leaf.getText().substring(1, leaf.getText().length() - 1);
String uritext = importHelpers.getUriResolver().resolve(text, resource);
- if(uritext != null) {
+ if (uritext != null) {
try {
XtextHyperlink result = hyperlinkProvider.get();
result.setHyperlinkText(uritext);
- result.setHyperlinkRegion(region); // ignore: deprecated since Xtext 2.18
+ result.setHyperlinkRegion(region); // ignore: deprecated since Xtext 2.18
result.setURI(URI.createURI(uritext));
acceptor.accept(result);
- }
- catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
}
}
}

Back to the top