org.eclipse.emf.emfstore.internal.client.model.util
Class ResourceHelper

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.client.model.util.ResourceHelper

public final class ResourceHelper
extends Object

Helper for resource operations.

Author:
wesendon

Method Summary
static
<T extends org.eclipse.emf.ecore.EObject>
T
getElementFromResource(String absoluteFileName, Class<T> type, int index)
          Gets an element from a resource.
static
<T extends org.eclipse.emf.ecore.EObject>
T
getElementFromResource(String absoluteFileName, Class<T> type, Map<?,?> options, int index)
          Gets an element from a resource.
static
<T extends org.eclipse.emf.ecore.EObject>
void
putElementIntoNewResource(String absoluteFileName, T element)
          Puts an element into a new resource.
static
<T extends org.eclipse.emf.ecore.EObject>
void
putElementIntoNewResourceWithProject(String absoluteFileName, T element, Project project)
          Puts an element into a new resource.
static
<T extends org.eclipse.emf.ecore.EObject>
void
putWorkspaceIntoNewResource(String absoluteFileName, Workspace workSpace)
          Puts an element into a new resource.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getElementFromResource

public static <T extends org.eclipse.emf.ecore.EObject> T getElementFromResource(String absoluteFileName,
                                                                                 Class<T> type,
                                                                                 Map<?,?> options,
                                                                                 int index)
                                                                      throws IOException
Gets an element from a resource.

Type Parameters:
T - type of element
Parameters:
absoluteFileName - filepath of resource
type - .class from type
options - resource options
index - index of element in resource
Returns:
selected element
Throws:
IOException - in case of failure

getElementFromResource

public static <T extends org.eclipse.emf.ecore.EObject> T getElementFromResource(String absoluteFileName,
                                                                                 Class<T> type,
                                                                                 int index)
                                                                      throws IOException
Gets an element from a resource.

Type Parameters:
T - type of element
Parameters:
absoluteFileName - filepath of resource
type - .class from type
index - index of element in resource
Returns:
selected element
Throws:
IOException - in case of failure

putElementIntoNewResource

public static <T extends org.eclipse.emf.ecore.EObject> void putElementIntoNewResource(String absoluteFileName,
                                                                                       T element)
                                      throws IOException
Puts an element into a new resource.

Type Parameters:
T - element type
Parameters:
element - The element to be put
absoluteFileName - filepath of resource
Throws:
IOException - in case of failure

putElementIntoNewResourceWithProject

public static <T extends org.eclipse.emf.ecore.EObject> void putElementIntoNewResourceWithProject(String absoluteFileName,
                                                                                                  T element,
                                                                                                  Project project)
                                                 throws IOException
Puts an element into a new resource.

Type Parameters:
T - element type
Parameters:
element - The element to be put
absoluteFileName - filepath of resource
project - the associated project
Throws:
IOException - in case of failure

putWorkspaceIntoNewResource

public static <T extends org.eclipse.emf.ecore.EObject> void putWorkspaceIntoNewResource(String absoluteFileName,
                                                                                         Workspace workSpace)
                                        throws IOException
Puts an element into a new resource.

Type Parameters:
T - element type
Parameters:
workSpace - the workspace to be put
absoluteFileName - filepath of resource
Throws:
IOException - in case of failure


Copyright © 2015. All Rights Reserved.