| Summary: | [ImageSupport] GMF fails export to image of any file:// or relative URL | ||
|---|---|---|---|
| Product: | [Modeling] GMF-Runtime | Reporter: | Anthony Hunter <ahunter.eclipse> |
| Component: | General | Assignee: | Anthony Hunter <ahunter.eclipse> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | cbmcgee |
| Version: | 2.3 | ||
| Target Milestone: | 2.3 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
I applied the requested change and ran the JUnit tests in diagram.ui and the changes seem fine. Committing to HEAD. [target cleanup] 2.3 M6 was the original target milestone for this bug [GMF Restructure] Bug 319140 : product GMF and component Runtime was the original product and component for this bug |
From Chris McGee: In our application the way that we integrate the input stream opening logic is through the EMF editing domain's URI Converter. However, the URLImageEditPart in GMF uses the java.net.URL mechanism which is much more difficult to integrate our specific logic in a thread-safe way. Note that EMF will delegate to java.net.URL.openConnection() as a fall-back. Without the necessary change then user's diagrams do not appear. Here is a patch that I applied to the URLImageEditPart to get images to be rendered inline in our application: final protected RenderedImage regenerateImageFromSource() { URL url = getURL(); if (url != null) { URI uri = URI.createURI(url.toString()); try { InputStream is = getEditingDomain().getResourceSet().getURIConverter().createInputStream(uri); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int b = is.read(); while (b != -1) { baos.write(b); b = is.read(); } // read in the file source specified by the URI, otherwise return null; return RenderedImageFactory.getInstance(baos.toByteArray()); } catch (IOException e) { // Ignore and return null; } } return null; } If this patch cannot be applied at the GMF level then perhaps this method could be made non-final so we could apply the necessary changes on their end.