/** * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Resource createResource ( final URI uri ) { final XMLResource result = new ProfileResourceImpl ( uri ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE ); result.getDefaultLoadOptions ().put ( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE ); result.getDefaultLoadOptions ().put ( XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE ); result.getDefaultLoadOptions ().put ( XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware () ); return result; }
/** * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Resource createResource ( final URI uri ) { final ComponentResourceImpl result = new ComponentResourceImpl ( uri ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware () ); return result; }
/** * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Resource createResource ( final URI uri ) { final InfrastructureResourceImpl result = new InfrastructureResourceImpl ( uri ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware () ); return result; }
/** * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Resource createResource ( final URI uri ) { final XMLResource result = new DeploymentResourceImpl ( uri ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware () ); return result; }
/** * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Resource createResource ( final URI uri ) { final XMIResource result = new WorldResourceImpl ( uri ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware () ); return result; }
/** * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Resource createResource ( final URI uri ) { final GlobalizeResourceImpl result = new GlobalizeResourceImpl ( uri ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware () ); return result; }
/** * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Resource createResource ( final URI uri ) { final XMLResource result = new RecipeResourceImpl ( uri ); result.getDefaultSaveOptions ().put ( XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware () ); return result; }
@Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { try { //System.out.println("doSaveDocument "); ResourceSet resourceSet = createResourceSet(); XtextResource xtextResource = (XtextResource) resourceSet.createResource(URI.createURI("temp.occi")); InputStream is = new ByteArrayInputStream(document.get().getBytes()); xtextResource.load(is, Collections.EMPTY_MAP); is.close(); URI uri = URI.createPlatformResourceURI( ((org.eclipse.ui.part.FileEditorInput) element).getFile().getFullPath().toString(), true); //resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); //System.out.println("uriii "+uri); Resource xmiResource = resourceSet.getResource(uri, true); ((XMLResource) xmiResource).getDefaultSaveOptions().put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware()); xmiResource.getContents().clear(); xmiResource.getContents().addAll(xtextResource.getContents()); // SUPER IMPORTANT to avoid to have references to temp.occi EcoreUtil.resolveAll(xmiResource); xmiResource.save(Collections.EMPTY_MAP); } catch (IOException e) { throw new CoreException( new Status(IStatus.ERROR, "org.occiware.clouddesigner.occi.xtext.ui", "Failed to save", e)); } }
public FragmentFakingEcoreResource(URI uri, ResourceSaveIndicator isSaving) { super(uri); this.isSaving = isSaving; setEncoding("UTF-8"); getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); getDefaultSaveOptions().put(XMLResource.OPTION_LINE_WIDTH, 80); getDefaultSaveOptions().put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware()); }
public FragmentFakingEcoreResource(final URI uri, final Wrapper<Boolean> isSaving) { super(uri); this.isSaving = isSaving; this.encoding = "UTF-8"; this.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.valueOf(true)); this.getDefaultSaveOptions().put(XMLResource.OPTION_LINE_WIDTH, Integer.valueOf(80)); Map<Object, Object> _defaultSaveOptions = this.getDefaultSaveOptions(); URIHandlerImpl.PlatformSchemeAware _platformSchemeAware = new URIHandlerImpl.PlatformSchemeAware(); _defaultSaveOptions.put(XMLResource.OPTION_URI_HANDLER, _platformSchemeAware); }
private void saveResource(final Resource resource) { try { final HashMap<String, Object> saveOptions = CollectionLiterals.<String, Object>newHashMap(); saveOptions.put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.AbsoluteCrossBundleAware() { @Override public URI deresolve(final URI uri) { boolean _isPlatform = uri.isPlatform(); boolean _not = (!_isPlatform); if (_not) { Set<Map.Entry<String, URI>> _entrySet = EcorePlugin.getPlatformResourceMap().entrySet(); for (final Map.Entry<String, URI> entry : _entrySet) { { String _key = entry.getKey(); String _plus = ("platform:/resource/" + _key); String _plus_1 = (_plus + "/"); final URI newPrefix = URI.createURI(_plus_1); final URI uri2 = uri.replacePrefix(entry.getValue(), newPrefix); if ((uri2 != null)) { return super.deresolve(uri2); } } } } return super.deresolve(uri); } }); saveOptions.put(Resource.OPTION_LINE_DELIMITER, this.codeConfig.getLineDelimiter()); resource.save(saveOptions); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }