Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Code Mining with Embedded Editor(How to enable code mining in an embedded editor in a dialog.)
Code Mining with Embedded Editor [message #1807485] Fri, 31 May 2019 01:04 Go to next message
John Milligan is currently offline John MilliganFriend
Messages: 8
Registered: March 2016
Junior Member
Hi. I am trying to introduce some data into my code mining via a variable in my custom XtextDocument in a dialog. I am using an embedded editor for my language in the dialog. My problem is that code mining is not working in the dialog. I assume it is not enabled for my embedded editor.

Any ideas how I can do this? thanks, John

Here is my code mining extension:

	<!-- code mining -->
	<extension point="org.eclipse.ui.workbench.texteditor.codeMiningProviders">
		<codeMiningProvider
			class="com.bsb.xtext.idl.ui.IdlExecutableExtensionFactory:org.eclipse.jface.text.codemining.ICodeMiningProvider"
			id="com.bsb.xtext.idl.Idl.CodeMiningProvider"
			label="Idl Codemining">
			<enabledWhen>	 
        		 <with variable="editorInput">
					<adapt type="org.eclipse.core.resources.IFile">
						<test
							property="org.eclipse.core.resources.contentTypeId"
							value="com.bsb.xtext.idl.Idl.contenttype">
						</test>
					</adapt>
				</with>
			</enabledWhen>
		</codeMiningProvider>
	</extension> 

     <extension point="org.eclipse.core.contenttype.contentTypes">
		<content-type
			base-type="org.eclipse.core.runtime.text"
			file-extensions="idl"
			id="com.bsb.xtext.idl.Idl.contenttype"
			name="Idl File"
			priority="normal">
		</content-type>
	</extension>



Re: Code Mining with Embedded Editor [message #1807495 is a reply to message #1807485] Fri, 31 May 2019 07:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
(1) the enable expression does not make sense
(2) xtext embedded editor does not support code minings
(2a) org.eclipse.jface.text.source.SourceViewerConfiguration.getCodeMiningProviders(ISourceViewer) is not customized
(2b) there is no equivalent to org.eclipse.ui.texteditor.AbstractTextEditor.installCodeMiningProviders()
(3) org.eclipse.ui.internal.texteditor.codemining.CodeMiningProviderRegistry.getProviders(ISourceViewer, ITextEditor) does require a real editor - so this might be a general platform problem
feel free to file an enhancement request at https://github.com/eclipse/xtext-eclipse
(if you come up with a solution or an idea how to solve this or even can come up with a pull request
that would be nice - i dont know if there are other place in eclipse that we could take as inspiration )


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

[Updated on: Fri, 31 May 2019 07:53]

Report message to a moderator

Re: Code Mining with Embedded Editor [message #1807516 is a reply to message #1807495] Fri, 31 May 2019 16:35 Go to previous messageGo to next message
John Milligan is currently offline John MilliganFriend
Messages: 8
Registered: March 2016
Junior Member
Christian,

Thanks for your detailed reply. I may look into the CodeMining API to see if it make sense to request an enhancement, but for now I think I will try another approach to annotating my text.

John
Re: Code Mining with Embedded Editor [message #1807523 is a reply to message #1807516] Fri, 31 May 2019 19:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i created https://github.com/eclipse/xtext-eclipse/issues/1085
it also contains a possible workaround


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Code Mining with Embedded Editor [message #1807524 is a reply to message #1807523] Fri, 31 May 2019 19:17 Go to previous messageGo to next message
John Milligan is currently offline John MilliganFriend
Messages: 8
Registered: March 2016
Junior Member
Thanks! I'll give it a try.
Re: Code Mining with Embedded Editor [message #1807525 is a reply to message #1807524] Fri, 31 May 2019 19:48 Go to previous message
John Milligan is currently offline John MilliganFriend
Messages: 8
Registered: March 2016
Junior Member
The workaround did the trick. Thanks for your help. John
Previous Topic:how to check the condition for instance of class had been created in xtext editor
Next Topic:infer jvmType from referenced Objects
Goto Forum:
  


Current Time: Tue Apr 16 20:12:07 GMT 2024

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

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

Back to the top