Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328016

Summary: XtextHyperlink not working with file-uris and platform-plugin-uris and ImportURIScopingFragment
Product: [Modeling] TMF Reporter: Eckle <xx.eckle>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: r.zozmann, sebastian.zarnekow
Version: 1.0.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Eckle CLA 2010-10-18 04:54:41 EDT
Using the ImportURIScopingFragment, file-uris and platform:/plugin-uris won't work in the XtextHyperlink. (while platform:/resource and relative-paths are working).

The linking accross file-boundaries do work with every kind of uri, but one cannot STRG-Click references to a imported file. The imported file is then not opened.

Sample DSL with mew-setting is given below:

--mydsl.xtext-------------------------------------------
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Root :
(includeFiles+=Include)*
( fragments+=Fragment | templates+=Template)*
;

Include :
'include' importURI=STRING;

Template :
'template' name =ID
(fragments += FragmentRef)*
;

Fragment :
'fragment' name=ID;

FragmentRef :
'link fragment' fragment=[Fragment]
;


--mydsl.mwe2--------------------------------------------

module org.xtext.example.mydsl.MyDsl

import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

var grammarURI = "classpath:/org/xtext/example/mydsl/MyDsl.xtext"
var file.extensions = "mydsl"
var projectName = "org.xtext.example.mydsl"
var runtimeProject = "../${projectName}"

Workflow {
bean = StandaloneSetup {
platformUri = "${runtimeProject}/.."
}

component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}

component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}

component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
language = {
uri = grammarURI
fileExtensions = file.extensions

// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment {}

// generates Java API for the generated EPackages
fragment = ecore.EcoreGeneratorFragment {
// referencedGenModels = "uri to genmodel, uri to next genmodel"
}

// the serialization component
fragment = parseTreeConstructor.ParseTreeConstructorFragment {}

// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment {
fileExtensions = file.extensions
}

// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment {
// options = {
// backtrack = true
// }
}

// java-based API for validation
fragment = validation.JavaValidatorFragment {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
//composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
// registerForImportedPackages = true
}

// scoping and exporting API
// fragment = scoping.ImportURIScopingFragment {}
// fragment = exporting.SimpleNamesFragment {}

// scoping and exporting API
//fragment = scoping.ImportNamespacesScopingFragment {}
//fragment = exporting.QualifiedNamesFragment {}
//fragment = builder.BuilderIntegrationFragment {}
fragment = scoping.ImportURIScopingFragment {}
fragment = exporting.SimpleNamesFragment {}

// formatter API
fragment = formatting.FormatterFragment {}

// labeling API
fragment = labeling.LabelProviderFragment {}

// outline API
fragment = outline.TransformerFragment {}
fragment = outline.OutlineNodeAdapterFactoryFragment {}
//fragment = outline.QuickOutlineFragment {}

// quickfix API
//fragment = quickfix.QuickfixProviderFragment {}

// content assist API
fragment = contentAssist.JavaBasedContentAssistFragment {}

// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}

// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment {
// generatorProjectName = "${projectName}.generator"
// modelFileExtension = file.extensions
// }
}
}
}

------------------------------------------------------------------

And here are my samle-files:
--test.mydsl------------------------------------------------------
fragment External1
fragment External2

--test2.mydsl-----------------------------------------------------

//include 'file:/E:/sample/file/test.mydsl' //DOESN'T WORK
//include 'platform:/plugin/x.y.z/test.mydsl' //DOESN'T WORK
//include 'test.mydsl' //WORKS
//include 'platform:/resource/testProject/test.mydsl' //WORKS

template x
link fragment External2
Comment 1 Ralf Zozmann CLA 2010-11-11 02:20:34 EST
Any progress?
Comment 2 Sebastian Zarnekow CLA 2010-11-12 04:07:34 EST
(In reply to comment #1)
> Any progress?

The ticket has not been scheduled we do not plan to work on this one in the near future. Note that you are always free to use your own implementation of the hyperlink helper.
Comment 3 Sebastian Zarnekow CLA 2011-01-10 10:49:59 EST
See also bug 326506
Comment 4 Sven Efftinge CLA 2012-11-19 08:31:50 EST
We won't enhance the ImportURI mechanism in this way, since it has been superseded by the namespace based scoping approach.