Java Code Examples for org.eclipse.emf.ecore.plugin.EcorePlugin#getWorkspaceRoot()
The following examples show how to use
org.eclipse.emf.ecore.plugin.EcorePlugin#getWorkspaceRoot() .
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: CheckGenModelUtil.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Given a base URI, figure out which {@link IFolder}, if any, it refers to. * * @param baseURI * to find the folder(s) for; must not be {@code null} * @return an array of all folders mapping to that URI, or an empty array if none do. */ private static IContainer[] determineContainersToCheck(final URI baseURI) { Preconditions.checkNotNull(baseURI); IContainer[] result = {}; if (baseURI.isPlatformResource() || baseURI.isFile()) { IWorkspaceRoot workspace = EcorePlugin.getWorkspaceRoot(); if (workspace != null) { if (baseURI.isFile()) { result = workspace.findContainersForLocationURI(java.net.URI.create(baseURI.toString())); } else { // Must be a platform/resource URI IPath platformPath = new Path(baseURI.toPlatformString(true)); IFolder folder = workspace.getFolder(platformPath); if (folder != null) { result = new IContainer[] {folder}; } } } } return result; }
Example 2
Source File: CheckJavaValidatorUtil.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Gets the workspace member. * * @param name * the name * @return the workspace member */ private IResource getWorkspaceMember(final String name) { IWorkspaceRoot workspaceRoot = EcorePlugin.getWorkspaceRoot(); if (workspaceRoot == null) { return null; } return workspaceRoot.findMember(new Path(name)); }
Example 3
Source File: AbstractCheckTestCase.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Gets the project or creates and returns it if it is <code>null</code>. * * @return the project * @throws CoreException * the core exception */ protected IProject getOrCreatePluginProject() throws CoreException { IWorkspaceRoot workspaceRoot = EcorePlugin.getWorkspaceRoot(); assertNotNull("No workspace; project cannot be created or found", workspaceRoot); IProject project = workspaceRoot.getProject(PluginTestProjectManager.TEST_PROJECT_NAME); if (!project.exists()) { try { project = PluginTestProjectManager.createPluginProject(getInjector(), PluginTestProjectManager.TEST_PROJECT_NAME); } catch (CoreException e) { fail(e.getMessage()); } } return project; }