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

Bug 327374

Summary: Add support for external open/save/saveAs
Product: [Modeling] TMF Reporter: Henrik Lindberg <henrik.lindberg>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: moritz.eysholdt
Version: 1.0.1Flags: moritz.eysholdt: kepler+
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Henrik Lindberg CLA 2010-10-08 22:20:18 EDT
Supporting editing of external files (files not stored in the Eclipse workspace) is an important feature in many RCP applications when the user may not be exposed to the notion of projects and workspace. It is also a useful feature when opening a file from some source (like email) without first having to figure out where the file is and how to add a link.

Currently, when external files are opened with an XtextEditor the result is that the editor is put in read only mode. 

In the Eclipse b3 project an extension to XtextEditor have been implemented that supports automatic linking of external files to a workspace project. This editor also supports handling of untitled temporary files.

Sebastian asked me to log this issue with a reference to the implementation. It should be possible to integrate it into the XtextEditor with little effort.

The implementation is somewhat specific to b3 (should be clearly marked in the code), but is otherwise quite generic.

The main class is the ExtLinkedXtextEditor, but all of the classes in the org.eclipse.b3.beelang.ui.xtext.linked package are used. 

The code can be found at: svn+ssh://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.b3/trunk/org.eclipse.b3.beelang.ui

A problem regarding SaveAs and outline refresh is fixed in the class org.eclipse.b3.ui.outline.RefreshableXtextContentOutlinePage which implements the externalRefresh method used by the editor code. (Most of the code is a copy of the original class - changes are clearly marked in comments).

There is currently an open Xtext issue with opening linked files if the project the links are in is hidden - the ExtLinkedXtextEditor should use a hidden project when that issue is fixed.
Comment 1 Sven Efftinge CLA 2012-11-16 05:34:17 EST
solved in the meantime.
Comment 2 Eclipse Webmaster CLA 2017-10-31 11:06:02 EDT
Requested via bug 522520.

-M.
Comment 3 Eclipse Webmaster CLA 2017-10-31 11:17:16 EDT
Requested via bug 522520.

-M.