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

Bug 365019

Summary: SapphireDiagramEditor does not work on non-workspace files
Product: z_Archived Reporter: Greg Amerson <gregory.amerson>
Component: SapphireAssignee: Shenxue Zhou <shenxue.zhou>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: konstantin
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Greg Amerson CLA 2011-11-29 00:55:28 EST
SapphireDiagramEditor only takes input that is an IFile.  If a user opens an external file with File > Open file..., the diagram editor input factory will return null, so the diagram editor can't be created.
Comment 1 Konstantin Komissarchik CLA 2012-02-09 12:43:55 EST
Please take a look. The diagram editor should work with any editor input (whether in workspace or not). I am guessing that we need to devise a strategy for storing the geometry information for files outside of projects.
Comment 2 Greg Amerson CLA 2012-02-14 02:28:18 EST
I also have a scenario in my product where I want to be able to open an editor on a input that the contents are loaded from a URL connection, so the editor input is not store on any file whatsoever, whether in workspace or outside.  

In my case I could actually see a need to serialize geometry information in the XML content itself, so it would be great if the diagram editor had API for letting adopters provider and store geometry information inside the "editor file" instead of outside, but I guess this should be a separate bug?
Comment 3 Shenxue Zhou CLA 2012-02-14 11:39:45 EST
(In reply to comment #2)
> I also have a scenario in my product where I want to be able to open an editor
> on a input that the contents are loaded from a URL connection, so the editor
> input is not store on any file whatsoever, whether in workspace or outside.  
> In my case I could actually see a need to serialize geometry information in the
> XML content itself, so it would be great if the diagram editor had API for
> letting adopters provider and store geometry information inside the "editor
> file" instead of outside, but I guess this should be a separate bug?

Diagram page def has a property "SideBySideLayoutStorage" which I interpreted as putting the layout file at the same directory as the editor xml file. Now I think about it, it should be interpreted as saving the diagram geometry info in the same editor content xml file.

Could you open a new bug for that? Thanks!
Comment 4 Shenxue Zhou CLA 2012-02-14 12:59:58 EST
Now the diagram editor should be able to handle external files. See the updated MapEditor.java, where the diagram editor input is created by using a new API on SapphireDiagramEditorFactory: 

public static SapphireDiagramEditorInput createEditorInput(IEditorInput input)
Comment 5 Greg Amerson CLA 2012-02-14 19:48:31 EST
Thanks, I'll test this out today.  FYI, I entered bug 371558 for the storing geometry in same XML as the source.
Comment 6 Greg Amerson CLA 2012-02-15 02:42:19 EST
FYI, I've added bug 371576 to track that enhancement to allow non-local files to be opened.

Also I can  verify that this now works with local files that are not in the workspace.
Comment 7 Shenxue Zhou CLA 2012-02-15 16:18:14 EST
Closing based on Greg's verification.