Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336075 - Let accept DiagramEditor a URIEditorInput
Summary: Let accept DiagramEditor a URIEditorInput
Status: CLOSED FIXED
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.7.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 0.8.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: Indigo M6 theme_round_offs
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-02 10:07 EST by Klaus S. CLA
Modified: 2011-06-24 09:10 EDT (History)
2 users (show)

See Also:
michael.wenz: indigo+


Attachments
Modified DiagramEditorFactory class which creates an DiagramEditorInput from URIEditorInput (7.29 KB, text/x-java)
2011-02-02 10:11 EST, Klaus S. CLA
michael.wenz: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
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