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


Java UMLResource类代码示例

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


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

示例1: getSaveOptions

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
     * 저장시 사용하는 옵션 반환
     * 
     * @return Map<Object,Object>
     */
    public static Map<Object, Object> getSaveOptions() {
        Map<Object, Object> saveOptions = new HashMap<Object, Object>();

        saveOptions.put(XMIResource.OPTION_ENCODING, UMLResource.DEFAULT_ENCODING);
        saveOptions.put(XMIResource.OPTION_USE_XMI_TYPE, true);
        saveOptions.put(XMLResource.OPTION_CONFIGURATION_CACHE, Boolean.TRUE);
        saveOptions.put(XMLResource.OPTION_USE_DEPRECATED_METHODS, lookupTable);
        saveOptions.put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true);
        saveOptions.put(XMLResource.OPTION_SAVE_ONLY_IF_CHANGED, true);
        saveOptions.put(XMLResource.OPTION_PROCESS_DANGLING_HREF, XMLResource.OPTION_PROCESS_DANGLING_HREF_RECORD);
        saveOptions.put(XMLResource.OPTION_SCHEMA_LOCATION, true);
//        saveOptions.put(XMLResource.OPTION_FLUSH_THRESHOLD, true);

        return saveOptions;
    }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:21,代码来源:DomainModelHandlerUtil.java

示例2: registerDefaultPathmaps

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
     * 기본 경로 맵 등록
     * 
     * void
     */
    public static void registerDefaultPathmaps() {
        Map<URI, URI> uriMap;
        
        // org.eclipse.uml2.uml.resources 버전 변경으로 해당 버전의 리소스에서 찾도록 변경.
//        URI uri = URI.createURI("jar:platform:/base/plugins/org.eclipse.uml2.uml.resources_2.2.0.v200805131030.jar!/"); //$NON-NLS-1$
        URI uri = URI.createURI(Platform.getBundle("org.eclipse.uml2.uml.resources").getLocation()); //$NON-NLS-1$

        if (domainModelHandler != null) {
            uriMap = domainModelHandler.getResourceSet().getURIConverter().getURIMap();
        } else {
            uriMap = getHandlerInstance().getResourceSet().getURIConverter().getURIMap();
        }

        uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
            uri.appendSegment("libraries").appendSegment(ManagerConstant.EMPTY_STRING)); //$NON-NLS-1$
        uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
            uri.appendSegment("metamodels").appendSegment(ManagerConstant.EMPTY_STRING)); //$NON-NLS-1$
        uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
            uri.appendSegment("profiles").appendSegment(ManagerConstant.EMPTY_STRING)); //$NON-NLS-1$
    }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:26,代码来源:DomainModelHandlerUtil.java

示例3: getRMProfile

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
 * RM 프로파일 반환
 * 
 * @return Profile
 */
public static Profile getRMProfile() {
    Resource resource = null;
    URI profileURI = null;
    Profile profile = null;

    // RM 프로파일 로딩
    profileURI = URI.createURI(ManagerConstant.NEXCORE_UML_PROFILES_PATHMAP + ManagerConstant.RM_PROFILE_NAME
        + ManagerConstant.DOT + UMLResource.PROFILE_FILE_EXTENSION);
    if (domainModelHandler != null) {
        resource = domainModelHandler.getResourceSet().getResource(profileURI, true);
    } else {
        resource = getHandlerInstance().getResourceSet().getResource(profileURI, true);
    }

    if (!resource.isLoaded()) {
        try {
            resource.load(getLoadOptions());
        } catch (IOException e) {}
    }

    profile = getUMLProfileRoot(resource);

    return profile;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:30,代码来源:DomainModelHandlerUtil.java

示例4: createUMLModelRoot

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
 * 최상위 UML 모델 생성
 * 
 * @param uri
 * @return Resource
 */
public Resource createUMLModelRoot(URI uri, final String modelName) {
    final Resource resource = transactionEditingDomain.getResourceSet().createResource(uri);
    DomainUtil.registerDefaultPathmaps();

    transactionEditingDomain.getCommandStack().execute(new RecordingCommand(transactionEditingDomain) {
        /**
         * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
         */
        @Override
        protected void doExecute() {
            Model umlModelRoot = UMLFactory.eINSTANCE.createModel();
            umlModelRoot.setName(modelName);

            Model umlLibrary = (Model) DomainUtil.load(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI));
            umlModelRoot.createPackageImport(umlLibrary);

            resource.getContents().add(umlModelRoot);
        }
    });

    return resource;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:29,代码来源:UMLDomainTest.java

示例5: getApplicableLibraryList

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
 * getApplicableLibraryList
 *  
 * @return List<Object>
 */
private List<Object> getApplicableLibraryList() {
    Resource resource = null;
    URI libraryURI = null;
    Package library = null;
    List<Object> applicableLibraryList = new ArrayList<Object>();
    
    for (String libraryName : UICoreConstant.PROJECT_CONSTANTS__CORE_LIBRARY_NAMES) {
        // UML 기본 라이브러리 로딩
        libraryURI = URI.createURI(UMLResource.LIBRARIES_PATHMAP + libraryName + ManagerConstant.DOT
            + UMLResource.LIBRARY_FILE_EXTENSION);
        resource = DomainRegistry.getEditingDomain().getResourceSet().getResource(libraryURI, true);

        if (!resource.isLoaded()) {
            try {
                resource.load(DomainUtil.getLoadOptions());
            } catch (IOException ioe) {
                Log.error(ioe);
            }
        }

        library = DomainUtil.getUMLModelRoot(resource);
        applicableLibraryList.add(library);
    }
    
    return applicableLibraryList;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:32,代码来源:LibraryChooseDialog.java

示例6: validateLinkedResource

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
   * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validateLinkedResource()
   */
  protected IStatus validateLinkedResource() {
  	
  	String filename = getFileName();
  	if (filename != null) {
   	if (filename.endsWith(UICoreConstant.PROJECT_CONSTANTS__DOT + UICoreConstant.RSA_PROFILE_FILE_EXTENSION)
   			|| filename.endsWith(UICoreConstant.PROJECT_CONSTANTS__DOT + UMLResource.PROFILE_FILE_EXTENSION)) {
   		if (isSourceExist) {
   			return new Status(IStatus.OK, ProjectExplorerPlugin.PLUGIN_ID, 
   					IStatus.OK, UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING, null);
   		}
   	}
  	}
  	
setErrorMessage(UMLMessage.MESSAGE_NOT_VALID_PROFILE_NAME);
return new Status(IStatus.ERROR, ProjectExplorerPlugin.PLUGIN_ID,
		UMLMessage.MESSAGE_NOT_VALID_PROFILE_NAME);
  	
  }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:22,代码来源:ProfileImportWizardPage.java

示例7: getStaticMetamodels

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
@Override
public Set<IHawkMetaModelResource> getStaticMetamodels() {
	Set<IHawkMetaModelResource> resources = new HashSet<>();
	resources.add(new EMFMetaModelResource(EcorePackage.eINSTANCE.eResource(), emfWFactory, this));
	resources.add(new EMFMetaModelResource(TypesPackage.eINSTANCE.eResource(), emfWFactory, this));
	resources.add(new EMFMetaModelResource(XMLTypePackage.eINSTANCE.eResource(), emfWFactory, this));
	resources.add(new EMFMetaModelResource(UMLPackage.eINSTANCE.eResource(), emfWFactory, this));
	resources.add(new EMFMetaModelResource(StandardPackage.eINSTANCE.eResource(), umlWFactory, this));

	try {
		final Resource rEcoreProfile = resourceSet.createResource(URI.createURI(UMLResource.ECORE_PROFILE_URI));
		rEcoreProfile.load(null);
		final EMFMetaModelResource hrEcoreProfile = new EMFMetaModelResource(rEcoreProfile, umlWFactory, this);
		resources.add(hrEcoreProfile);

		final Resource rUMLProfile = resourceSet.createResource(URI.createURI(UMLResource.UML2_PROFILE_URI));
		rUMLProfile.load(null);
		final EMFMetaModelResource hrUMLProfile = new EMFMetaModelResource(rUMLProfile, umlWFactory, this);
		resources.add(hrUMLProfile);
	} catch (IOException e) {
		LOGGER.error("Error while loading predefined profiles", e);
	}

	return resources;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:26,代码来源:UMLMetaModelResourceFactory.java

示例8: createUMLFile

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
private void createUMLFile(URI uri, String modelname){
	Model model = UMLFactory.eINSTANCE.createModel();
       
	model.setName(modelname);

   	ResourceSet resourceSet = new ResourceSetImpl();
 		resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
       
       resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
 				UMLResource.FILE_EXTENSION,
 				UMLResource.Factory.INSTANCE
 			);
       
       Resource modelResource = resourceSet.createResource(uri);
       modelResource.getContents().add(model);
       try {
		modelResource.save(null);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:22,代码来源:PapyrusModelCreatorTest.java

示例9: testCreatePapyrusModel

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
@Test
public void testCreatePapyrusModel() {
	IFile UMLfile = project.getFile("test."+UMLResource.FILE_EXTENSION);
	IFile Difile = project.getFile("test."+"di");
	IFile Notationfile = project.getFile("test."+NotationModel.NOTATION_FILE_EXTENSION);
	
	assertFalse(UMLfile.exists());
	assertFalse(Difile.exists());
	assertFalse(Notationfile.exists());
	
	creator.createPapyrusModel();
	
	assertTrue(UMLfile.exists());
	assertTrue(Difile.exists());
	assertTrue(Notationfile.exists());
	assertEquals("test.uml", UMLfile.getName());
	assertEquals("test.di", Difile.getName());
	assertEquals("test.notation", Notationfile.getName());
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:20,代码来源:PapyrusModelCreatorTest.java

示例10: createAndInitResourceSet

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
 * Creates and initializes a resource set.
 * 
 * @return The created and initialized resource set.
 */
public ResourceSet createAndInitResourceSet() {
	ResourceSet resourceSet = new ResourceSetImpl();

	URI uml2ResourcesPluginURI = URI.createURI(ExporterConfiguration.UML2_RESOURCES_PLUGIN_PATH);
	resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
	resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION,
			UMLResource.Factory.INSTANCE);

	Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();

	uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
			uml2ResourcesPluginURI.appendSegment("libraries").appendSegment(""));

	uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
			uml2ResourcesPluginURI.appendSegment("metamodels").appendSegment(""));

	uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
			uml2ResourcesPluginURI.appendSegment("profiles").appendSegment(""));

	uriMap.put(URI.createURI("pathmap://TXTUML_STDLIB/"),
			URI.createURI("platform:/plugin/hu.elte.txtuml.stdlib/src/hu/elte/txtuml/stdlib/"));

	UMLResourcesUtil.init(resourceSet);
	return resourceSet;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:31,代码来源:ResourceSetFactory.java

示例11: serializeInstance

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void serializeInstance(String fileName, Map<String, Boolean> options) {
	ResourceSet rscSet = new ResourceSetImpl();
	UMLResourcesUtil.init(rscSet);
	fileName+=".uml";
	Resource resource = rscSet.createResource(URI.createURI(fileName).appendFileExtension(UMLResource.FILE_EXTENSION));
	Iterator<EObject> objIt = objList.iterator();
	EObject model = UMLFactory.eINSTANCE.createModel();
	resource.getContents().add(model);
	while (objIt.hasNext()) {
		EObject obj = objIt.next();
		if (isRoot(obj))
		resource.getContents().add(obj);
		((List<EObject>) model.eGet(UMLPackage.eINSTANCE.getPackage_PackagedElement())).add(obj);				
	}
	try{			
		resource.save(options);
	}catch (IOException e) {
		e.printStackTrace();
	}
	
}
 
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:23,代码来源:UmlModelBuilder.java

示例12: registerResourceFactories

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的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(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:29,代码来源:SDD.java

示例13: registerResourceFactories

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的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);
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION,
                                                                            UMLResource.Factory.INSTANCE);
}
 
开发者ID:ualegre,项目名称:cmd2acl,代码行数:15,代码来源:Main.java

示例14: getSaveOptions

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
 * 저장시 사용하는 옵션 반환
 * 
 * @return Map<Object,Object>
 */
public static Map<Object, Object> getSaveOptions() {
    Map<Object, Object> saveOptions = new HashMap<Object, Object>();

    saveOptions.put(XMIResource.OPTION_ENCODING, UMLResource.DEFAULT_ENCODING);
    saveOptions.put(XMIResource.OPTION_USE_XMI_TYPE, true);
    saveOptions.put(XMLResource.OPTION_CONFIGURATION_CACHE, Boolean.TRUE);
    saveOptions.put(XMLResource.OPTION_USE_DEPRECATED_METHODS, new ArrayList());
    saveOptions.put(XMLResource.OPTION_SAVE_ONLY_IF_CHANGED, true);

    return saveOptions;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:17,代码来源:DomainUtil.java

示例15: registerPathmaps

import org.eclipse.uml2.uml.resource.UMLResource; //导入依赖的package包/类
/**
 * URI를 경로 맵에 등록
 * 
 * @param uri
 *            void
 */
public static void registerPathmaps(URI uri) {
    URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
        uri.appendSegment("libraries").appendSegment("")); //$NON-NLS-1$ //$NON-NLS-2$
    URIConverter.URI_MAP.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
        uri.appendSegment("metamodels").appendSegment("")); //$NON-NLS-1$ //$NON-NLS-2$
    URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
        uri.appendSegment("profiles").appendSegment("")); //$NON-NLS-1$ //$NON-NLS-2$
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:15,代码来源:DomainModelHandlerUtil.java


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