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

Bug 336075

Summary: Let accept DiagramEditor a URIEditorInput
Product: [Modeling] Graphiti Reporter: Klaus S. <christian.stein2>
Component: CoreAssignee: Project Inbox <graphiti-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: michael.wenz, tim.kaiser
Version: 0.7.0Flags: michael.wenz: indigo+
Target Milestone: 0.8.0   
Hardware: All   
OS: All   
Whiteboard: Indigo M6 theme_round_offs
Attachments:
Description Flags
Modified DiagramEditorFactory class which creates an DiagramEditorInput from URIEditorInput michael.wenz: iplog+

Description Klaus S. CLA 2011-02-02 10:07:51 EST
Build Identifier: 

Currently the DiagramEditor accepts as input "DiagramEditorInput" and "IFileEditorInput". It might be useful to enable the DiagramEditor accepting an URIEditorInput which enables open diagram files which are located outside the current workspace. "IFileEditorInput" cannot handle files which are not inside the current workspace (unless the file is linked into the workspace).

Suggestion: adding the following easy snipped into DiagramEditorFactory.createEditorInput(IEditorInput otherInput) which creates the DiagramEditorInput from a URIEditorInput

if (otherInput instanceof URIEditorInput){
final URIEditorInput fileInput = (URIEditorInput) otherInput;
final TransactionalEditingDomain domain = createResourceSetAndEditingDomain();
URI diagramFileUri = fileInput.getURI();
if (diagramFileUri != null) {
// the file has to contain one base node which has to be a diagram
diagramFileUri = GraphitiUiInternal.getEmfService().mapDiagramFileUriToDiagramUri(diagramFileUri);
return new DiagramEditorInput(diagramFileUri, domain, null, true);
}
}

Reproducible: Always
Comment 1 Klaus S. CLA 2011-02-02 10:11:07 EST
Created attachment 188150 [details]
Modified DiagramEditorFactory class which creates an DiagramEditorInput from URIEditorInput
Comment 2 Michael Wenz CLA 2011-02-04 08:46:06 EST
I have taken over the suggested patch and added the corresponding checks in the DiagramEditorMatchingStrategy; besides I added an context menu action that enables opening an arbitrary Graphiti Diagram file into to examples common plugin (context menu of a Graphiti sample project).
Comment 3 Michael Wenz CLA 2011-06-24 09:10:19 EDT
Part of Graphiti Indigo 0.8.0