/** * Used for optimizations; answers whether a mof context for this nature has exists yet * * @deprecated use hasResourceSet(); * @since 1.0.0 */ public boolean hasContext() { return hasResourceSet(); }
/** * @deprecated use getResourceSet() */ public ResourceSet getXmiResourceSet() { return getResourceSet(); }
/** * Returns the EMF root folder for the project. Defaults to the project. Subclasses can override. * * @return EMF root folder for the project. * * @since 1.0.0 */ public IContainer getEMFRoot() { return getProject(); }
/** * Configures the project with this nature. This is called by <code>IProject.addNature</code> and should not be called directly by clients. The * nature extension id is added to the list of natures on the project by <code>IProject.addNature</code>, and need not be added here. * * <p> * All subtypes must call super. The better way for subtypes is to override primConfigure instead. * </p> * * @throws CoreException * @since 1.0.0 */ public void configure() throws org.eclipse.core.runtime.CoreException { if (!hasConfigured) { hasConfigured = true; primConfigure(); } }
/** * Return if the project has any one of the possible given nature ids. * * @param project * @param possibleNatureIds * @return <code>true</code> if at least one of the possible natures id is configured for the project. * * @since 1.0.0 */ public static boolean hasRuntime(IProject project, String[] possibleNatureIds) { if (project != null) { for (int i = 0; i < possibleNatureIds.length; i++) { if (hasRuntime(project, possibleNatureIds[i])) return true; } } return false; }
/** * @deprecated use getResource(URI) */ public Resource getXmiResource(String uri) { return getResource(URI.createURI(uri)); }
/** * @deprecated use createResource(URI) */ public Resource makeXmiResource(String uri) { return createResource(URI.createURI(uri)); }
/** * Create a folder relative to the project based on aProjectRelativePathString. * * @param aProjectRelativePathString * @return * @throws CoreException * * @since 1.0.0 */ public IFolder createFolder(String aProjectRelativePathString) throws CoreException { if (aProjectRelativePathString != null && aProjectRelativePathString.length() > 0) return createFolder(new Path(aProjectRelativePathString)); return null; }
/** * Get the resource set for the project * * @return * * @since 1.0.0 */ public ResourceSet getResourceSet() { return getEmfContextBase().getResourceSet(); }
/** * Get the IFile with the given name if it is in this project. * * @param aFileName * filename can be relative to one of the input file paths for the WorkbenchURIConverter. * @return file it it is in this project, or <code>null</code> if it doesn't. * * @since 1.0.0 */ public IFile getFile(String aFileName) { return getWorkbenchURIConverter().getFile(aFileName); }
private QualifiedName qualifiedKey(String key) { return new QualifiedName(getPluginID(), key); }
/** * @deprecated use createResource(URI) */ public Resource makeXmiResource(String uri, EList anExtent) { Resource res = makeXmiResource(uri); if (res != null) res.getContents().addAll(anExtent); return res; }
/** * Lazy initializer; for migration of existing workspaces where configure will never get called. * * @return context base for the project. * * @since 1.0.0 */ protected EMFWorkbenchContextBase getEmfContextBase() { if (emfContext == null) { try { createEmfContext(); } catch (CoreException ex) { Logger.getLogger().logError(ex); } } return emfContext; }
/** * Shutdown the EMF nature * * * @since 1.0.0 */ public void shutdown() { if (getResourceSet() != null) ((ProjectResourceSet) getResourceSet()).release(); }
/** * Create an EMF context for the project. * * @throws CoreException * * @since 1.0.0 */ protected void createEmfContext() throws CoreException { WorkbenchResourceHelperBase.createEMFContext(getProject(), this); }
/** * Create the resource for this uri. It will use the resource set of the project to create it. * * @param uri * @return resource * * @since 1.0.0 */ public Resource createResource(URI uri) { return getResourceSet().createResource(uri); }
/** * Return the full path of the project. * * @return full project path (relative to workspace) * @since 1.0.0 */ public IPath getProjectPath() { return getProject().getFullPath(); }
/** * Get WorkbenchURIConverter for this project. * <p> * This method assumes the URIConverter on the ResourceSet is the one that was created for the ResourceSet on behalf of this nature runtime. * </p> * * @return * * @since 1.0.0 */ protected WorkbenchURIConverter getWorkbenchURIConverter() { return (WorkbenchURIConverter) getResourceSet().getURIConverter(); }
public IWorkspace getWorkspace() { return getProject().getWorkspace(); }
/** * Get the resource for this uri. It will use the resource set of the project to find it. It will load if not already loaded. * * @param uri * @return resource or <code>null</code> if resource is not found. * * @since 1.0.0 */ public Resource getResource(URI uri) { try { return getResourceSet().getResource(uri, true); } catch (WrappedException ex) { if (!WorkbenchResourceHelperBase.isResourceNotFound(ex)) throw ex; } return null; }