Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Rename element gives NPE(NPE for rename element)
Rename element gives NPE [message #1784162] Fri, 23 March 2018 06:10 Go to next message
Virag Purnam is currently offline Virag PurnamFriend
Messages: 56
Registered: June 2014
Member
Hello,

When I try to rename element, I get NPE.
I have mentioned sample grammar.
I am using XText 2.13

Workflow {
	
	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "org.xtext.example.mydsl"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				eclipsePlugin = {
					enabled = true
				}
				eclipsePluginTest = {
					enabled = true
				}
				createEclipseMetaData = true
			}
			code = {
				encoding = "windows-1252"
				lineDelimiter = "\r\n"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
			}
		}
		language = StandardLanguage {
			name = "org.xtext.example.mydsl.MyDsl"
			fileExtensions = "mydsl"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
			renameRefactoring = {
        		useChangeSerializer = true
       		}
        }
	}
}



Grammar:

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

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

Model:
	students+=Student*
	studentGroups+= Group*;
	
Student:
	name=ID seatNumber=INT 
;
	
Group:
	name=ID '{' members+=[Student|ID] (',' members+=[Student|ID])* '}' 
;



Virag 1
Peter 2
Sam 3
Dave 4

Group1 {
	Dave , Peter
}

Group2 {
	Sam, Virag
}



Log:
1    [main] ERROR org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler  - Error initializing refactoring
java.lang.NullPointerException
	at org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler.isRefactoringEnabled(DefaultRenameElementHandler.java:135)
	at org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler$1.exec(DefaultRenameElementHandler.java:83)
	at org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler$1.exec(DefaultRenameElementHandler.java:1)
	at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:91)
	at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.internalReadOnly(XtextDocument.java:520)
	at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.priorityReadOnly(XtextDocument.java:485)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.priorityReadOnly(XtextDocument.java:142)
	at org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler.execute(DefaultRenameElementHandler.java:74)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:291)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:92)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:305)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:239)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:431)
	at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:446)
	at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:472)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4238)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)


Need help.
Thanks in advance.

Best regards,
Virag Purnam

[Updated on: Fri, 23 March 2018 06:14]

Report message to a moderator

Re: Rename element gives NPE [message #1784163 is a reply to message #1784162] Fri, 23 March 2018 06:52 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 615
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Please file this as bug to https://github.com/eclipse/xtext-eclipse/issues
Re: Rename element gives NPE [message #1784174 is a reply to message #1784163] Fri, 23 March 2018 08:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
Hi,

i cannot reproduce this in the latest xtext 2.14 nightly.
can you please give it a try


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Rename element gives NPE [message #1784187 is a reply to message #1784174] Fri, 23 March 2018 10:18 Go to previous messageGo to next message
Virag Purnam is currently offline Virag PurnamFriend
Messages: 56
Registered: June 2014
Member
Hi Mr. Christian DietrichFriend.

I have used Xtext 2.13.
I will try with 2.14 nightly build as well.
Could you please help me with the path for the same?


Thanks and regards,
Virag Purnam
Re: Rename element gives NPE [message #1784188 is a reply to message #1784187] Fri, 23 March 2018 10:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
hi you can install xtext 2.14 nightly into your eclipse using this p2 repo: http://download.eclipse.org/modeling/tmf/xtext/updates/composite/latest/

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Rename element gives NPE [message #1784343 is a reply to message #1784188] Tue, 27 March 2018 07:00 Go to previous message
Virag Purnam is currently offline Virag PurnamFriend
Messages: 56
Registered: June 2014
Member
Hi, Thanks for the link.
Sorry, I was working on other module.
I will check with this and update here.
Previous Topic:HyperlinkHelper and proxy resolution
Next Topic:Auto edit DSL file on compile
Goto Forum:
  


Current Time: Tue Sep 25 04:44:53 GMT 2018

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

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

Back to the top