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

Bug 365848

Summary: [xtext] validate context menu action chokes on editor for non-workspace resource
Product: [Modeling] TMF Reporter: Johan Wannheden <johan.wannheden>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: christian.dietrich.opensource
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Johan Wannheden CLA 2011-12-07 04:33:41 EST
Build Identifier: I20110613-1736

Given an open Xtext editor for a resource not in the workspace, executing the _Validate_ context menu action will cause current resource to be validated and an attempt to create markers will fail: the MarkerIssueProcessor seems to be instantiated with a null resource, this leading to an NPE in org.eclipse.xtext.ui.editor.validation.AddMarkersOperation#execute(IProgressMonitor).

Also, the _Rename Element_ context menu action should probably be disabled in a read-only editor.

Reproducible: Always
Comment 1 Christian Dietrich CLA 2017-04-28 14:31:21 EDT
https://bugs.eclipse.org/bugs/show_bug.cgi?id=283086 solves the validation part of the problem.

rename fails with

java.lang.IllegalStateException: Could not determine project for context resource file:/Users/dietrich/demo.xtext
	at org.eclipse.xtext.ui.refactoring.ui.DefaultLinkedPositionGroupCalculator.getLinkedPositionGroup(DefaultLinkedPositionGroupCalculator.java:107)
	at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController$1.run(RenameRefactoringController.java:145)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

i think there should be no validation or rename available at all