public final class ViewModelHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ViewModelHelper.ViewLoader
Helper class for encapsulating view loading functionality.
|
Modifier and Type | Method and Description |
---|---|
static VView |
createViewModel(org.eclipse.core.resources.IFile modelFile,
org.eclipse.emf.ecore.EClass selectedEClass,
org.eclipse.core.resources.IFile selectedEcore)
Creates a new view model file.
|
static List<String> |
getEcorePaths(org.eclipse.emf.ecore.resource.Resource resource)
Extract the list of Ecore paths from a view model resource.
|
static VView |
loadView(org.eclipse.core.resources.IFile file,
Collection<String> registeredEcores)
Tries to load a view from the given file.
|
static boolean |
viewIsResolved(VView view)
Check whether the given view has been resolved, i.e.
|
public static VView createViewModel(org.eclipse.core.resources.IFile modelFile, org.eclipse.emf.ecore.EClass selectedEClass, org.eclipse.core.resources.IFile selectedEcore) throws IOException
modelFile
- the file in which the view should be savedselectedEClass
- the Root EClass for the new VView
selectedEcore
- the ecore containing the selectedEClass. If the selectedEcore is null,
then the selectedEClass must come from an EPackage which is registered by default in
the
package registry.VView
IOException
- when something goes wrong while loading or saving the resourcepublic static VView loadView(org.eclipse.core.resources.IFile file, Collection<String> registeredEcores) throws IOException
file
- the IFile
that contains the view model to be loadedregisteredEcores
- a Collection
that will contain the paths of all
Ecores that are necessary to load the view. callVView
. Note that view resolution may fail, so callers should check
whether the view has been resolved successfullyIOException
- in case an error occurs while loading the viewpublic static boolean viewIsResolved(VView view)
view
- the VView
to be checkedtrue
, if the view is not a proxy, false
otherwiseCopyright © 2019. All rights reserved.