Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Extending Xtext editor (XtextEditor)(What the steps needed to extend XText editor )
Extending Xtext editor (XtextEditor) [message #1701901] Thu, 16 July 2015 14:41 Go to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
What the steps needed to extend XText editor?
I have extended XTextEditor

public class mydslXtextEditor extends XtextEditor{
@Override
public void doSave(IProgressMonitor progressMonitor) {
}
}

And this work correctly as long as the class location is in "myDsl.ui"
By moving the class to any other plugin and add those lines in the new plugin.xml

<editor class="xtext.myDsl.ui.myDslExecutableExtensionFactory:xtext.myDsl.ui.mydslXtextEditor" contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
default="true"
extensions="dsl"
id="com.mentor.svassist.xtext.dsl.Dsl"
name="DSL Editor">
</editor>

and adding xtext to required bundle, i got this error


Could not open the editor: The editor class could not be instantiated. This usually indicates a missing no-arg constructor or that the editor's class name was mistyped in plugin.xml.

java.lang.ClassNotFoundException: editors.mydsl.mydslXtextEditor
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)

what do you think?
Re: Extending Xtext editor (XtextEditor) [message #1701906 is a reply to message #1701901] Thu, 16 July 2015 15:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
are you sure your other plugin exports the editor package? and your dsl has a dep to that other plugin

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Extending Xtext editor (XtextEditor) [message #1701908 is a reply to message #1701906] Thu, 16 July 2015 15:18 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
The answer of first question is Yes.
But what do you mean by the second question (your dsl has a dep to that other plugin)
Re: Extending Xtext editor (XtextEditor) [message #1701910 is a reply to message #1701908] Thu, 16 July 2015 15:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
How does the complete/exact java code of the editor java file look like (incl. package delaration)
and how does the extension line exactly look like

(editors.mydsl.mydslXtextEditor != xtext.myDsl.ui.mydslXtextEditor)

if the editor class is in plugin a your mydsl.ui plugin needs a dependency to a (manifest)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Extending Xtext editor (XtextEditor) [message #1701912 is a reply to message #1701910] Thu, 16 July 2015 15:43 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
This is import part of my plugin manifest file

Export-Package: myapp.editors,
Import-Package: org.eclipse.ui.views.navigator,
org.eclipse.xtext.ui.editor,
xtext.dsl.ui

This is my editor class

package myapp.editors;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.xtext.ui.editor.XtextEditor;

public class mydslXtextEditor extends XtextEditor{
@Override
public void doSave(IProgressMonitor progressMonitor) {
super.doSave(progressMonitor);
}
}

In my new plugin i have add this extension in plugin.xml
<editor
class="xtext.mydsl.ui.DslExecutableExtensionFactory:myapp.editors.mydslXtextEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
default="true"
extensions="dsl"
icon="platform:/plugin/editor.ui/images/img_dsl_file.gif"
id="xtext.dsl.Dsl"
name="Dsl Editor">
</editor>

And finally i removed editor extension part from xtext.dsl.ui plugin.xml
and did not made any other modification in it

[Updated on: Thu, 16 July 2015 15:48]

Report message to a moderator

Re: Extending Xtext editor (XtextEditor) [message #1701913 is a reply to message #1701912] Thu, 16 July 2015 15:45 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
I noticed that i dont see DslExecutableExtensionFactory visible in plugin.xml while selecting the class of the editor, do think this could be the reason ?
Re: Extending Xtext editor (XtextEditor) [message #1701915 is a reply to message #1701910] Thu, 16 July 2015 15:52 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
Do you mean that i need to add my new plugin to the required bundle in the manifest of the dsl.ui ?!!!!!!!
Re: Extending Xtext editor (XtextEditor) [message #1701916 is a reply to message #1701915] Thu, 16 July 2015 15:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
yes

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Extending Xtext editor (XtextEditor) [message #1701917 is a reply to message #1701916] Thu, 16 July 2015 15:54 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
?
in which plugin is the extension?
in the dsl.ui?

or the new one. if the new one this makes no sense.

the you need your own factory in + activator etc in the plugin


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

[Updated on: Thu, 16 July 2015 15:55]

Report message to a moderator

Previous Topic:Generate Source Code in ObjC (iOS), Java (Android), C# (Unity), ActionScript (Adobe AIR)
Next Topic:How to represent EBNF rule A - B (matches any string that matches A but does not match B)
Goto Forum:
  


Current Time: Tue Mar 19 07:38:31 GMT 2024

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

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

Back to the top