IEditorInput fileEditorInput = camelEditorInput.getFileEditorInput();
if (fileEditorInput instanceof IRemoteCamelEditorInput) {
return (IRemoteCamelEditorInput) fileEditorInput;
}
} else if (input instanceof IURIEditorInput) {
final IURIEditorInput uriInput = (IURIEditorInput) input;
return new IRemoteCamelEditorInput() {
@Override
public String getUriText() {
return uriInput.getName();
}
@Override
public String getXml() throws IOException {
return IOUtils.loadText(uriInput.getURI().toURL().openStream(), "UTF-8");
}
};
} else if (input instanceof DiagramEditorInput) {
final DiagramEditorInput uriInput = (DiagramEditorInput) input;
return new IRemoteCamelEditorInput() {
@Override
public String getUriText() {
return uriInput.getName();
}
@Override
public String getXml() throws IOException {
try {
return IOUtils.loadText(new URI(uriInput.getUri().toString()).toURL().openStream(), "UTF-8");
} catch (URISyntaxException e) {
throw new IOException("Unable to resolve resource.", e);
}
}
};