当前位置: 首页>>代码示例>>Java>>正文


Java ResourceSet类代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.resource.ResourceSet的典型用法代码示例。如果您正苦于以下问题:Java ResourceSet类的具体用法?Java ResourceSet怎么用?Java ResourceSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceSet类属于org.eclipse.emf.ecore.resource包,在下文中一共展示了ResourceSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerResourceFactories

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * This can be used to update the resource set's resource factory registry with all needed factories.
 * 
 * @param resourceSet
 *            The resource set which registry has to be updated.
 * @generated NOT
 */
@Override
public void registerResourceFactories(ResourceSet resourceSet) {
    super.registerResourceFactories(resourceSet);
    /*
     * If you want to change the content of this method, do NOT forget to change the "@generated"
     * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
     * of the Acceleo module with the main template that has caused the creation of this class will
     * revert your modifications.
     */
    
    /*
     * TODO If you need additional resource factories registrations, you can register them here. the following line
     * (in comment) is an example of the resource factory registration for UML.
     *
     * If you want to use the generator in stand alone, the resource factory registration will be required.
     *  
     * To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents). 
     */ 
    
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*.xmi", new XMIResourceFactoryImpl());
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:29,代码来源:Generate.java

示例2: initPart

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, 
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 * 
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
	setInitializing(true);
	if (editingPart != null && key == partKey) {
		editingPart.setContext(elt, allResource);
		
		final SoftwareInterface softwareInterface = (SoftwareInterface)elt;
		final GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart;
		// init values
		if (isAccessible(SrmViewsRepository.General.Properties.name))
			generalPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, softwareInterface.getName()));
		
		// init filters
		
		// init values for referenced views
		
		// init filters for referenced views
		
	}
	setInitializing(false);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:28,代码来源:SoftwareInterfaceGeneralPropertiesEditionComponent.java

示例3: initPart

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, 
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 * 
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
	setInitializing(true);
	if (editingPart != null && key == partKey) {
		editingPart.setContext(elt, allResource);
		
		final HardwareBus hardwareBus = (HardwareBus)elt;
		final TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart;
		// init values
		// init filters
		// init values for referenced views
		
		// init filters for referenced views
		
	}
	setInitializing(false);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:24,代码来源:HardwareBusTimingPropertiesEditionComponent.java

示例4: load

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
public T load ( final URI uri, final String contentTypeId ) throws IOException
{
    final ResourceSet rs = new ResourceSetImpl ();
    final Resource r = rs.createResource ( uri, contentTypeId );
    r.load ( null );

    for ( final Object o : r.getContents () )
    {
        if ( this.clazz.isAssignableFrom ( o.getClass () ) )
        {
            return this.clazz.cast ( o );
        }
    }

    throw new IllegalStateException ( String.format ( "Model %s does not contain an object of type %s", uri, this.clazz ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:ModelLoader.java

示例5: registerResourceFactories

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * This can be used to update the resource set's resource factory registry with all needed factories.
 * 
 * @param resourceSet
 *            The resource set which registry has to be updated.
 * @generated
 */
@Override
public void registerResourceFactories(ResourceSet resourceSet) {
    super.registerResourceFactories(resourceSet);
    /*
     * If you want to change the content of this method, do NOT forget to change the "@generated"
     * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
     * of the Acceleo module with the main template that has caused the creation of this class will
     * revert your modifications.
     */
    
    /*
     * TODO If you need additional resource factories registrations, you can register them here. the following line
     * (in comment) is an example of the resource factory registration for UML.
     *
     * If you want to use the generator in stand alone, the resource factory registration will be required.
     *  
     * To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents). 
     */ 
    
    // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:29,代码来源:Main.java

示例6: SelectAnyEObjectDialog

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
public SelectAnyEObjectDialog(Shell parent, ResourceSet resourceSet, ILabelProvider renderer) {
	super(parent, renderer);
	_searchedResourceSet = resourceSet;
	ArrayList<EObject> all = new ArrayList<EObject>();
	EcoreUtil.resolveAll(resourceSet);
	for (Resource r : _searchedResourceSet.getResources())
	{
		for (TreeIterator<EObject> iterator = r.getAllContents(); iterator.hasNext();) {
			EObject o =  iterator.next();
			if(select(o)) all.add(o);
		}
	}
	
	Object[] elements = all.toArray();
	this.setElements(elements);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:17,代码来源:SelectAnyEObjectDialog.java

示例7: initPart

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, 
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 * @generated
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
	setInitializing(true);
	if (editingPart != null && key == partKey) {
		editingPart.setContext(elt, allResource);
		
		final ResourceProtectionParameterValue resourceProtectionParameterValue = (ResourceProtectionParameterValue)elt;
		final ResourceProtectionParameterValuePropertiesEditionPart basePart = (ResourceProtectionParameterValuePropertiesEditionPart)editingPart;
		// init values
		if (isAccessible(AnalysisViewsRepository.ResourceProtectionParameterValue.Properties.name))
			basePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, resourceProtectionParameterValue.getName()));
		
		if (isAccessible(AnalysisViewsRepository.ResourceProtectionParameterValue.Properties.value))
			basePart.setValue(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, resourceProtectionParameterValue.getValue()));
		
		// init filters
		
		
		// init values for referenced views
		
		// init filters for referenced views
		
	}
	setInitializing(false);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:32,代码来源:ResourceProtectionParameterValuePropertiesEditionComponent.java

示例8: createResourceSet

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * Creates the common resource set to use during compilation. Installs a light weight index.
 *
 * @return the resource set
 */
private ResourceSet createResourceSet() {
	// TODO try to reuse code from IN4JSCore.createResourceSet

	XtextResourceSet resourceSet = xtextResourceSetProvider.get();
	resourceSet.setClasspathURIContext(classLoader);

	// Install containerState as adapter.
	resourceSet.eAdapters().add(new DelegatingIAllContainerAdapter(rsbAcs));

	// Install a lightweight index.
	OrderedResourceDescriptionsData index = new OrderedResourceDescriptionsData(Collections.emptyList());
	ResourceDescriptionsData.ResourceSetAdapter.installResourceDescriptionsData(resourceSet, index);

	return resourceSet;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:N4HeadlessCompiler.java

示例9: run

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * @see IActionDelegate#run(IAction)
 */
public void run(IAction action) {
	if (selection != null) {
		IFile selectedFile = (IFile) ((IStructuredSelection) selection)
				.getFirstElement();

		// Use a platform:/resource/ URI
		URI uri = URI.createPlatformResourceURI(selectedFile.getFullPath().toString(), true);

		ResourceSet rs = new ResourceSetImpl();
		Resource r = rs.getResource(uri, true);

		Extension extension = (Extension) r.getContents().get(0);
		OcciRegistry.getInstance().registerExtension(extension.getScheme(),
				uri.toString());
		closeOtherSessions(selectedFile.getProject());
		MessageDialog.openInformation(shell,
				Messages.RegisterExtensionAction_ExtRegistration,
				Messages.RegisterExtensionAction_RegisteredExtension
						+ extension.getScheme());
	}
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:25,代码来源:RegisterOCCIExtensionAction.java

示例10: initPart

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, 
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 * 
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
	setInitializing(true);
	if (editingPart != null && key == partKey) {
		editingPart.setContext(elt, allResource);
		
		final ProtectionParameter protectionParameter = (ProtectionParameter)elt;
		final GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart;
		// init values
		if (isAccessible(GrmViewsRepository.General.Properties.name))
			generalPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, protectionParameter.getName()));
		
		// init filters
		
		// init values for referenced views
		
		// init filters for referenced views
		
	}
	setInitializing(false);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:28,代码来源:ProtectionParameterGeneralPropertiesEditionComponent.java

示例11: loadManifest

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
ProjectDescription loadManifest(URI manifest) {
	try {
		ProjectDescription result = null;
		ResourceSet resourceSet = resourceSetProvider.get(null /* we don't care about the project right now */);
		String platformPath = manifest.toPlatformString(true);
		if (manifest.isArchive() || platformPath != null) {
			if (manifest.isArchive() || workspace.getFile(new Path(platformPath)).exists()) {
				Resource resource = resourceSet.getResource(manifest, true);
				if (resource != null) {
					List<EObject> contents = resource.getContents();
					if (contents.isEmpty() || !(contents.get(0) instanceof ProjectDescription)) {
						return null;
					}
					result = (ProjectDescription) contents.get(0);
					contents.clear();
				}
			}
		}
		return result;
	} catch (WrappedException e) {
		throw new IllegalStateException("Unexpected manifest URI: " + manifest, e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:EclipseBasedN4JSWorkspace.java

示例12: initPart

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, 
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 * 
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
	setInitializing(true);
	if (editingPart != null && key == partKey) {
		editingPart.setContext(elt, allResource);
		
		final TimerResource timerResource = (TimerResource)elt;
		final TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart;
		// init values
		if (isAccessible(GrmViewsRepository.Timing.TimingProperties.duration)) {
			timingPart.setDuration(EEFConverterUtil.convertToString(EcorePackage.Literals.EFLOAT, timerResource.getDuration()));
		}
		
		// init filters
		
		// init values for referenced views
		
		// init filters for referenced views
		
	}
	setInitializing(false);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:29,代码来源:TimerResourceTimingPropertiesEditionComponent.java

示例13: getProfile

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * @generated NOT
 */
@Override
public Profile getProfile ()
{
    if ( this.profile == null )
    {
        final ResourceSet rs = new ResourceSetImpl ();
        final Resource r = rs.createResource ( URI.createURI ( DEFAULT_URI ), "org.eclipse.scada.configuration.world.osgi.profile" );
        try
        {
            r.load ( null );
        }
        catch ( final IOException e )
        {
            throw new RuntimeException ( e );
        }
        this.profile = (Profile)EcoreUtil.getObjectByType ( r.getContents (), ProfilePackage.Literals.PROFILE );
        if ( this.profile == null )
        {
            throw new IllegalStateException ( String.format ( "Resource loaded from %s does not contain an object of type %s", DEFAULT_URI, Profile.class.getName () ) );
        }
    }

    return this.profile;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:28,代码来源:DaveDriverImpl.java

示例14: patchProfile

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
/**
 * Inject the CA bootstrap property to the profile
 *
 * @param file
 *            the profile.xml file in the package target
 * @throws IOException
 */
protected void patchProfile ( final String appName, final File file ) throws IOException
{
    final ResourceSet rs = new ResourceSetImpl ();
    final Resource r = rs.createResource ( URI.createFileURI ( file.toString () ) );
    r.load ( null );

    final Profile profile = (Profile)EcoreUtil.getObjectByType ( r.getContents (), ProfilePackage.Literals.PROFILE );
    Profiles.addSystemProperty ( profile, "org.eclipse.scada.ca.file.provisionJsonUrl", "file:///usr/share/eclipsescada/ca.bootstrap/bootstrap." + appName + ".json" );
    r.save ( null );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:CommonPackageHandler.java

示例15: createToggleBreakpointsUtils

import org.eclipse.emf.ecore.resource.ResourceSet; //导入依赖的package包/类
@Override
protected DSLToggleBreakpointsUtils createToggleBreakpointsUtils() {
	return new DSLToggleBreakpointsUtils(getModelIdentifier()){
		
		@Override
		protected DSLBreakpoint createBreakpoint(Object selected,
				EObject instruction) throws CoreException {
			final Resource res = ((EObject)instruction).eResource();
			final ResourceSet resSet = res.getResourceSet();
			final MelangeResource mr = resSet.getResources().stream().filter(r -> {
				return r instanceof MelangeResource;
			}).map(r -> (MelangeResource)r).findFirst().orElse(null);
			if (mr != null) {
				final String fragmentURI = res.getURIFragment(instruction);
				instruction = mr.getWrappedResource().getEObject(fragmentURI);
			}
			return new GemocBreakpoint(identifier, instruction, true);
		}
		
	};
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:22,代码来源:GemocToggleBreakpointAction.java


注:本文中的org.eclipse.emf.ecore.resource.ResourceSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。