• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UMLUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: isAllowed

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
/**
 *
 * @see org.eclipse.papyrus.infra.nattable.tester.ITableTester#isAllowed(java.lang.Object)
 *
 * @param context
 * @return
 */
@Override
public IStatus isAllowed(Object context) {	
	if (context instanceof Element) {
		Element el = (Element) context;
		ISpecializationType type = (ISpecializationType) ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.training.library.profile.extlibrary.Book");
		IElementMatcher matcher = type.getMatcher();
		if (context instanceof Package || matcher.matches(el)) {
			Profile profile = UMLUtil.getProfile(LibraryPackage.eINSTANCE, el);
			if (profile != null){
				final String packageQN = profile.getQualifiedName();
				if (el.getNearestPackage().getAppliedProfile(packageQN, true) != null) {
					return new Status(IStatus.OK, Activator.PLUGIN_ID, "The context allowed to create a Book Table"); //$NON-NLS-1$
				} else {
					return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The profile "+packageQN+" is not applied on the model"); //$NON-NLS-1$ //$NON-NLS-2$
				}					
			}

		}
	}
	return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The context is not an UML Element"); //$NON-NLS-1$
}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:29,代码来源:BookTableTester.java


示例2: getHyperlinks

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
/**
 * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
 *
 * @param object
 * @return
 */
@Override
public List<HyperLinkObject> getHyperlinks(Object object) {
	List<HyperLinkObject> hyperlinks = new ArrayList<>();
	if (object instanceof Class) {
		Class clazz = (Class) object;
		if (UMLUtil.getStereotypeApplication(clazz, Book.class) != null) {
			// TODO: extract a method to get the borrower from a book in the
			// java implementation of the profile
			EList<DirectedRelationship> targetDirectedRelationships = clazz.getTargetDirectedRelationships();
			for (DirectedRelationship dependency : targetDirectedRelationships) {
				if (UMLUtil.getStereotypeApplication(dependency, Borrows.class) != null) {
					EList<Element> targets = dependency.getSources();
					for (Element element : targets) {
						Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(element,null);
						// we take the first available view
						Object firstView = crossReferencingViews.toArray()[0];
						HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) firstView);
						hyperlinks.add(hyperlink);
					}
				}
			}
		}
	}
	return hyperlinks;
}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:32,代码来源:BookToBorrowerHyperlinkContributor.java


示例3: getNavigableElements

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
@Override
public List<NavigableElement> getNavigableElements(Object fromElement) {
	List<NavigableElement> result = new LinkedList<>();
	Element element = org.eclipse.papyrus.uml.tools.utils.UMLUtil.resolveUMLElement(fromElement);
	if (element instanceof Class){
		final Book book = UMLUtil.getStereotypeApplication(element, Book.class);
		if (book != null) {
			final BookCategory category = book.getCategory();
			Resource eResource = book.eResource();
			EList<EObject> contents = eResource.getContents();
			result = 
					contents.stream()
					.filter(l -> !l.equals(book))		
					.filter(l -> l instanceof Book)
					.map(l -> (Book) l)
					.filter(l -> category.equals(l.getCategory()))
					.map(l -> l.getBase_Class())
					.map(clazz -> new SameCategoryNavigableElement(clazz))
					.collect(Collectors.toList());
		}
	}
	return result;
}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:24,代码来源:SameCategoryNavigationContributor.java


示例4: updateParentInExplorer

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
/**
 * updateParentInExplorer
 *  
 * @param target void
 */
public static void updateParentInExplorer(EObject target) {
    if (null == target) {
        return;
    }
    CommonViewer commonViewer = ViewerRegistry.getViewer();
    if (commonViewer.getControl().isDisposed()) {
        return;
    }
    if (target instanceof DynamicEObjectImpl) {
        target = UMLUtil.getBaseElement(target);
    }
    ITreeNode targetNode = null;
    EObject parent = UMLManager.getParent((Element) target);
    targetNode = UMLTreeNodeRegistry.getTreeNode(parent);
    String[] flags = null;
    flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT,
        IBasicPropertyConstants.P_CHILDREN };
    commonViewer.update(targetNode, flags);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:ProjectUtil.java


示例5: doFullCheckout

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
private void doFullCheckout() throws CoreException {
    CDOView view = getRepositoryFolder().cdoView();
    try {
        CDOTransferSystem target = new PathmapFilteringTransferSystem(WorkspaceTransferSystem.INSTANCE);
        RepositoryTransferSystem source = new RepositoryTransferSystem(view);

        cleanUpFolder(workspaceFolder);

        CDOTransfer transfer = new CDOTransferUMLFirst(source, target);
        transfer.setTargetPath(workspaceFolder.getFullPath());
        getRepositoryFolder().getNodes().forEach(n -> transfer.map(n.getPath(), new NullProgressMonitor()));

        // no default factory is registered in the CDO utilities
        transfer.getModelTransferContext().registerTargetExtension("*", new XMIResourceFactoryImpl());
        UMLUtil.init(transfer.getModelTransferContext().getTargetResourceSet());
        transfer.getModelTransferContext().getTargetResourceSet().getResource(UML_PRIMITIVE_TYPES_URI, true);

        transfer.perform();

        refreshFolder(workspaceFolder);
    } catch (RuntimeException e) {
        throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to transfer models", e));
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:25,代码来源:ModelGenCheckoutTask.java


示例6: getAllSuperTypes

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
@Override
public Set<IHawkClass> getAllSuperTypes() {
	final Set<IHawkClass> ret = super.getAllSuperTypes();

	for (ProfileApplication app : umlPackage.getProfileApplications()) {
		final EAnnotation ann = app.getEAnnotation(UMLUtil.UML2_UML_PACKAGE_2_0_NS_URI);
		if (ann != null) {
			for (EObject ref : ann.getReferences()) {
				if (ref instanceof EPackage) {
					final EPackage appEPackage = (EPackage) ref;
					final UMLProfile umlProfile = new UMLProfile(appEPackage, wf, null);
					ret.add(umlProfile.getVirtualProfileClass());
				}
			}
		}
	}

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


示例7: countBooks

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
private int countBooks(EList<Element> elementList) {
	int numberOfBooks = 0;
	for (Element element : elementList) {
		if (UMLUtil.getStereotypeApplication(element, Book.class) != null) {
			numberOfBooks++;
		}
	}
	return numberOfBooks;
}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:10,代码来源:MinimumBooksInLibraryModelConstraint.java


示例8: isInputPort

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
static public boolean isInputPort(NamedElement e){
	boolean isInput=false;
	//flow port in
	if(!e.getAppliedStereotypes().isEmpty()){
		FlowPort f = UMLUtil.getStereotypeApplication(e, FlowPort.class);
		isInput=f.getDirection().equals(FlowDirection.IN);
	}
	return isInput;
}
 
开发者ID:bmaggi,项目名称:Eclipse-Gendoc-Templates,代码行数:10,代码来源:SysML_Queries.java


示例9: isOutputPort

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
static public boolean isOutputPort(NamedElement e){
	boolean isOutput=false;
	//flow port in
	if(!e.getAppliedStereotypes().isEmpty()){
		FlowPort f = UMLUtil.getStereotypeApplication(e, FlowPort.class);
		isOutput=f.getDirection().equals(FlowDirection.OUT);
	}
	return isOutput;
}
 
开发者ID:bmaggi,项目名称:Eclipse-Gendoc-Templates,代码行数:10,代码来源:SysML_Queries.java


示例10: isInOutPort

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
static public boolean isInOutPort(NamedElement e){
	boolean isInOut=false;
	//flow port in
	if(!e.getAppliedStereotypes().isEmpty()){
		FlowPort f = UMLUtil.getStereotypeApplication(e, FlowPort.class);
		isInOut=f.getDirection().equals(FlowDirection.INOUT);
	}
	return isInOut;
}
 
开发者ID:bmaggi,项目名称:Eclipse-Gendoc-Templates,代码行数:10,代码来源:SysML_Queries.java


示例11: getComponentId

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
/**
 * component 요소로부터 id 가져오기
 * 
 * @param componentElement
 * @return String
 */
public static String getComponentId(Element componentElement) {
    // 참조할 스테레오타입 정보 가져오기
    Stereotype sourceStereotype = null;

    for (Stereotype appliedStereotype : componentElement
            .getAppliedStereotypes()) {
        if (appliedStereotype.getLabel().equals(
                MDDCoreConstant.COMPONENT_METADATA_STEREOTYPE_NAME)) {
            sourceStereotype = appliedStereotype;
            break;
        }
    }

    String taggedValue = MDDCoreConstant.EMPTY_STRING;

    // fqId 값 가져오기
    taggedValue = (String) UMLUtil.getTaggedValue(componentElement,
            sourceStereotype.getQualifiedName(),
            MDDCoreConstant.FQ_ID_KEY_IN_COMPONENT_STEREOTYPE);
    
    // 스테레오타입 속성에 값이 없을 때는 만들어서 리턴한다.
    if (taggedValue == null || taggedValue.length() == 0) {
        return createComponentFqId(componentElement);
    }

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


示例12: refreshNodeInExplorer

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
/**
 * refreshNodeInExplorer
 *  
 * @param target void
 */
public static void refreshNodeInExplorer(EObject target) {
    if (target instanceof EAnnotation) {
        return;
    }
    if (null == target) {
        return;
    }
    CommonViewer commonViewer = ViewerRegistry.getViewer();
    if (commonViewer.getControl().isDisposed()) {
        return;
    }

    ISelection selection = commonViewer.getSelection();
    TreePath[] expanedTreePaths = TreeItemUtil.getExpandTreePaths(commonViewer.getTree()).clone();

    /*
     * stereotype인 경우 전달 객체가 DynamicEobjectImpl이므로 할당된 클래스를 계산하여 처리해야 함.
     */
    if (target instanceof DynamicEObjectImpl) {
        target = UMLUtil.getBaseElement(target);
    }
    ITreeNode targetNode = null;
    targetNode = UMLTreeNodeRegistry.getTreeNode(target);

    if (null != targetNode) {
        commonViewer.refresh(targetNode);
        TreeItemUtil.expandTreePath(expanedTreePaths, selection);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:35,代码来源:ProjectUtil.java


示例13: updateExplorer

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
/**
 * updateExplorer
 *  
 * @param target
 * @param childIncluded void
 */
public static void updateExplorer(EObject target, boolean childIncluded) {
    if (null == target) {
        return;
    }
    if (target instanceof EAnnotation) {
        return;
    }
    CommonViewer commonViewer = ViewerRegistry.getViewer();
    if (commonViewer.getControl().isDisposed()) {
        return;
    }
    if (target instanceof DynamicEObjectImpl) {
        target = UMLUtil.getBaseElement(target);
    }
    ITreeNode targetNode = null;
    targetNode = UMLTreeNodeRegistry.getTreeNode(target);
    if (null == targetNode) {
        return;
    }
    String[] flags = null;
    if (childIncluded) {
        flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT,
            IBasicPropertyConstants.P_CHILDREN };
    } else {
        flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT };
    }
    try {
        commonViewer.update(targetNode, flags);
        commonViewer.refresh(targetNode);
    } catch (Exception ex) {
        Log.error(ex);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:40,代码来源:ProjectUtil.java


示例14: setLanguageInformation

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
/**
 * 스테레오타입의 언어정보 설정
 * 
 * @param appliedStereotype
 * @param element
 * @param koreanPropertyName
 * @param englishPropertyName
 * @param englishName
 * @param firstCharacterCaseType 첫글자의 대소문자 설정
 */
public static void setLanguageInformation(Stereotype appliedStereotype, Element element, String koreanPropertyName,
                                    String englishPropertyName, String englishName, String firstCharacterCaseType) {
    if (koreanPropertyName != null && koreanPropertyName.length() > 0) {
        UMLUtil.setTaggedValue(element, appliedStereotype, koreanPropertyName, ((NamedElement) element).getName());
    }

    if (englishPropertyName != null && englishPropertyName.length() > 0 && englishName != null
        && englishName.length() > 0) {
        UMLUtil.setTaggedValue(element, appliedStereotype, englishPropertyName, getProperName(englishName,
            firstCharacterCaseType));
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:ProfileUtil.java


示例15: UMLMetaModelResourceFactory

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
public UMLMetaModelResourceFactory() {
	resourceSet = new ResourceSetImpl();
	UMLUtil.init(resourceSet);

	resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
		.put("uml", new UMLResourceFactoryImpl());
	resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
		.put("ecore", new EcoreResourceFactoryImpl());
	resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
		.put("*", new XMIResourceFactoryImpl());
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:12,代码来源:UMLMetaModelResourceFactory.java


示例16: parse

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
@Override
public IHawkModelResource parse(IFileImporter importer, File changedFile) throws Exception {
	ResourceSet rset = new ResourceSetImpl();
	UMLUtil.init(rset);
	Resource r = rset.createResource(URI.createFileURI(changedFile.getAbsolutePath()));
	r.load(null);

	return new EMFModelResource(r, new UMLWrapperFactory(), this);
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:10,代码来源:UMLModelResourceFactory.java


示例17: testDebugInfo

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
public void testDebugInfo() throws CoreException {
    String source;
    source = "model simple;\n";
    source += "import base;\n";
    source += "class MyClass\n";
    source += "operation foo() : Integer;\n";
    source += "begin\n";
    source += "return 1;\n";
    source += "end;\n";
    source += "end;\n";
    source += "end.";
    parseAndCheck(source);
    Operation operation = (Operation) getRepository().findNamedElement("simple::MyClass::foo",
            IRepository.PACKAGE.getOperation(), null);
    assertNotNull(operation);
    StructuredActivityNode rootNode = ActivityUtils.getRootAction(operation);
    ValueSpecificationAction found = null;
    for (TreeIterator<Element> i = UMLUtil.getAllContents(rootNode, false, false); i.hasNext();) {
        Element next = i.next();
        if (next instanceof ValueSpecificationAction)
            found = (ValueSpecificationAction) next;
    }
    assertNotNull(found);
    assertTrue(MDDExtensionUtils.isDebuggable(found));
    Integer lineNumber = MDDExtensionUtils.getLineNumber(found);
    assertNotNull(lineNumber);
    assertEquals(6, lineNumber.intValue());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:29,代码来源:ActivityTests.java


示例18: getCurrentModelRoot

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
static public Model getCurrentModelRoot(IFile modelFile){
	String pathName=modelFile.getFullPath().toString();
	org.eclipse.emf.common.util.URI uri=org.eclipse.emf.common.util.URI.createPlatformResourceURI(pathName, true);
	ResourceSet resourceSet=new ResourceSetImpl();
	UMLUtil.init(resourceSet);
	LOG.info("Get resource at "+uri);
	Resource resource=resourceSet.getResource(uri, true);
	LOG.info("Got resource "+resource);
	for(EObject test:resource.getContents()){
		if(test instanceof Model)return (Model)test;
	}
    return null;
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:14,代码来源:GraCommonAction.java


示例19: getCurrentModelRootX

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
public Model getCurrentModelRootX(IFile modelFile){
	String pathName=modelFile.getFullPath().toString();
	org.eclipse.emf.common.util.URI uri=org.eclipse.emf.common.util.URI.createPlatformResourceURI(pathName, true);
	ResourceSet resourceSet=new ResourceSetImpl();
	UMLUtil.init(resourceSet);
	LOG.info("Get resource at "+uri);
	Resource resource=resourceSet.getResource(uri, true);
	LOG.info("Got resource "+resource);
	for(EObject test:resource.getContents()){
		if(test instanceof Model)return (Model)test;
	}
    return null;
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:14,代码来源:SDDAction.java


示例20: PathmapResourceCollection

import org.eclipse.uml2.uml.util.UMLUtil; //导入依赖的package包/类
public PathmapResourceCollection(String baseURI) {
	this.baseURI = baseURI;
	UMLUtil.init(rs);
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:5,代码来源:PathmapResourceCollection.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Clock类代码示例发布时间:2022-05-23
下一篇:
Java PsiImplUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap