org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl Java Examples

The following examples show how to use org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProfileResourceFactoryImpl.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: ComponentResourceFactoryImpl.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: InfrastructureResourceFactoryImpl.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: DeploymentResourceFactoryImpl.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #5
Source File: WorldResourceFactoryImpl.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source File: GlobalizeResourceFactoryImpl.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #7
Source File: RecipeResourceFactoryImpl.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #8
Source File: FragmentFakingEcoreResource.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
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());
}
 
Example #9
Source File: FragmentFakingEcoreResource.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public FragmentFakingEcoreResource(URI uri, Wrapper<Boolean> isSaving) {
	super(uri);
	this.isSaving = isSaving;
	this.encoding = "UTF-8";
	this.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, true);
	this.getDefaultSaveOptions().put(XMLResource.OPTION_LINE_WIDTH, 80);
	getDefaultSaveOptions().put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware());
}
 
Example #10
Source File: EMFGeneratorFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.14
 */
protected 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);
  }
}