org.eclipse.emf.compare.util
Class EclipseModelUtils

java.lang.Object
  extended by org.eclipse.emf.compare.util.EclipseModelUtils

public final class EclipseModelUtils
extends java.lang.Object

Utility class for model loading/saving and serialization within Eclipse.

Since:
0.8

Method Summary
static org.eclipse.emf.common.util.Monitor createProgressMonitor(java.lang.Object delegate)
          This will create an EMF progress monitor that can be used standalone to display comparison progress to the user.
static org.eclipse.emf.ecore.resource.Resource createResource(org.eclipse.emf.common.util.URI modelURI, java.lang.String contentType, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          This will create a Resource given the model extension it is intended for and a ResourceSet.
static java.lang.String getCommonContentType(org.eclipse.emf.common.util.URI... uris)
          This will try and find the common content-type of the given resources.
static org.eclipse.emf.ecore.EObject load(org.eclipse.core.resources.IFile file, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Loads a model from an IFile in a given ResourceSet.
static org.eclipse.emf.ecore.EObject load(org.eclipse.core.runtime.IPath path, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Loads a model from an IPath in a given ResourceSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createProgressMonitor

public static org.eclipse.emf.common.util.Monitor createProgressMonitor(java.lang.Object delegate)
This will create an EMF progress monitor that can be used standalone to display comparison progress to the user. If delegate isn't null, the created monitor will delegate all calls to it.

Parameters:
delegate - The delegate progress monitor. Can be null or Eclipse specific monitors.
Returns:
The created progress monitor.
Since:
1.0

createResource

public static org.eclipse.emf.ecore.resource.Resource createResource(org.eclipse.emf.common.util.URI modelURI,
                                                                     java.lang.String contentType,
                                                                     org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
This will create a Resource given the model extension it is intended for and a ResourceSet.

Parameters:
modelURI - URI where the model is stored.
contentType - Content type of this file.
resourceSet - The ResourceSet to load the model in.
Returns:
The Resource given the model extension it is intended for.
Since:
1.1

getCommonContentType

public static java.lang.String getCommonContentType(org.eclipse.emf.common.util.URI... uris)
This will try and find the common content-type of the given resources.

Parameters:
uris - The resource URIs that will be compared.
Returns:
The content-type to consider when searching for a match engine or null if content-types are distinct.
Since:
1.1

load

public static org.eclipse.emf.ecore.EObject load(org.eclipse.core.resources.IFile file,
                                                 org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
                                          throws java.io.IOException
Loads a model from an IFile in a given ResourceSet.

This will return the first root of the loaded model, other roots can be accessed via the resource's content.

Parameters:
file - IFile containing the model to be loaded.
resourceSet - The ResourceSet to load the model in.
Returns:
The model loaded from the file.
Throws:
java.io.IOException - If the given file does not exist.

load

public static org.eclipse.emf.ecore.EObject load(org.eclipse.core.runtime.IPath path,
                                                 org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
                                          throws java.io.IOException
Loads a model from an IPath in a given ResourceSet.

This will return the first root of the loaded model, other roots can be accessed via the resource's content.

Parameters:
path - IPath where the model lies.
resourceSet - The ResourceSet to load the model in.
Returns:
The model loaded from the path.
Throws:
java.io.IOException - If the given file does not exist.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.