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


Java Element.getEAnnotation方法代码示例

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


在下文中一共展示了Element.getEAnnotation方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDiagramList

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * 특정 엘리먼트 하위의 다이어그램 목록 반환하는 메소드
 * 
 * @param element
 * @param diagramType
 * @return List<Diagram>
 */
public static List<Diagram> getDiagramList(Element element, DiagramType diagramType) {
    List<Diagram> list = new ArrayList<Diagram>();

    EAnnotation annotation = element.getEAnnotation(ManagerConstant.UMLDOMAIN_CONSTANT__DIAGRAM_ANNOTATION_NAME);

    if (annotation == null) {
        return null;
    }

    EList<EObject> contents = annotation.getContents();
    EObject object;
    for (int i = 0; i < contents.size(); i++) {
        object = contents.get(i);
        if (object instanceof Diagram) {
            if (diagramType.equals(((Diagram) object).getType())) {
                list.add((Diagram) object);
            }
        }
    }

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

示例2: getUniqueIndex

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * 
 * 
 * @param uniqueIndex
 * @param diagramName
 * @param parent
 * @return int
 */
private static int getUniqueIndex(int uniqueIndex, String diagramName, Element parent) {

    EAnnotation diagramAnnotation = parent.getEAnnotation(ManagerConstant.UMLDOMAIN_CONSTANT__DIAGRAM_ANNOTATION_NAME);
    if (diagramAnnotation == null) {
        return 0;
    }
    for (EObject child : diagramAnnotation.getContents()) {
        if (child instanceof Diagram) {

            Diagram diagram = (Diagram) child;
            if (uniqueIndex == 0) {
                if (diagram.getName().equals(diagramName)) {
                    uniqueIndex++;
                    uniqueIndex = getUniqueIndex(uniqueIndex, diagramName, parent);
                }
            } else {
                if (diagram.getName().equals(diagramName + uniqueIndex)) {
                    uniqueIndex++;
                    uniqueIndex = getUniqueIndex(uniqueIndex, diagramName, parent);
                }
            }
        }
    }
    return uniqueIndex;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:34,代码来源:UMLManager.java

示例3: createDiagram

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * 선택된 UML모델 요소의 다이어그램 모델 생성
 * 
 * @param parentUMLModel
 * @param diagramType
 * @param diagramName
 * @return Diagram
 */
public Diagram createDiagram(Element parentUMLModel, DiagramType diagramType, String diagramName) {
    EAnnotation diagramAnnotation = parentUMLModel.getEAnnotation(ManagerConstant.UMLDOMAIN_CONSTANT__DIAGRAM_ANNOTATION_NAME); //$NON-NLS-1$

    if (diagramAnnotation == null) {
        diagramAnnotation = parentUMLModel.createEAnnotation(ManagerConstant.UMLDOMAIN_CONSTANT__DIAGRAM_ANNOTATION_NAME); //$NON-NLS-1$
    }
    parentUMLModel.getEAnnotations().add(diagramAnnotation);

    Diagram diagram = UMLDiagramFactory.eINSTANCE.createDiagram();
    diagram.setType(diagramType);
    diagram.setName(diagramName);
    diagram.setParent(parentUMLModel);

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

示例4: getCopiedElement

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * 복사된 요소를 반환한다.
 * 
 * @param eObject
 *            원 요소
 * @param copiedEObjs
 *            복사된 요소가 담겨진 콜렉션
 * @return EObject 복사된 요소
 */
private EObject getCopiedElement(EObject eObject, Collection<EObject> copiedEObjs) {
    if (!(eObject instanceof Element))
        return null;

    EAnnotation eAnnoOrg = ((Element) eObject).getEAnnotation(EANNO_PASTE);
    if (eAnnoOrg == null)
        return null;

    String id = eAnnoOrg.getDetails().get(EANNO_PASTE);
    Iterator<EObject> iter = copiedEObjs.iterator();
    while (iter.hasNext()) {
        EObject eObj = (EObject) iter.next();
        if (eObj instanceof Element) {
            Element elm = (Element) eObj;
            EAnnotation eAnno = elm.getEAnnotation(EANNO_PASTE);
            if (eAnno != null && id.equals(eAnno.getDetails().get(EANNO_PASTE))) {
                elm.getEAnnotations().remove(eAnno);
                ((Element) eObject).getEAnnotations().remove(eAnnoOrg);
                copiedEObjs.remove(eObj);
                return eObj;
            }
        }
    }
    return null;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:35,代码来源:ElementPaster.java

示例5: getDiagrams

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * 해당 Element 하위에 있는 타입별 다이어그램을 리스트로 반환.
 * 
 * @param eobject
 * @param diagramType
 * @return List<Diagram>
 */
public static List<Diagram> getDiagrams(Element element, DiagramType diagramType) {

    List<Diagram> list = new ArrayList<Diagram>();
    EAnnotation annotation = element.getEAnnotation(UICoreConstant.PROJECT_CONSTANTS__DIAGRAM);

    if (annotation != null) {

        EList<EObject> contents = annotation.getContents();
        Diagram diagram;
        for (EObject eobject : contents) {
            if (eobject instanceof Diagram) {
                diagram = (Diagram) eobject;
                if (diagramType.equals(diagram.getType())) {
                    list.add(diagram);
                }
            }
        }

    }

    return list;

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:31,代码来源:ProjectUtil.java

示例6: get

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
     * @see nexcore.tool.uml.ui.property.section.TemplateTextSection#get()
     */
    @Override
    protected String get() {
        Element element = this.getData();
        EAnnotation eAnnotation = element.getEAnnotation(ManagerConstant.USECASE_DISPLAY_ID_EANNOTATION_SOURCE_NAME);
        UseCaseDisplayId displayId = null;

        if (eAnnotation != null) {
            displayId = (UseCaseDisplayId) eAnnotation;
        } else {
            return "";
//            displayId = UsecasedisplayIdFactory.eINSTANCE.createUseCaseDisplayId();
//            displayId.setSource(ManagerConstant.USECASE_DISPLAY_ID_EANNOTATION_SOURCE_NAME);
//            setElementInfo(element, displayId);
        }

        String usecaseId = displayId.getDisplayId();
        return usecaseId;
    }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:22,代码来源:UsecaseDisplayIdSection.java

示例7: set

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.property.section.TemplateTextSection#set(java.lang.String)
 */
@Override
protected void set(final String value) {
    Element element = this.getData();
    EAnnotation eAnnotation = element.getEAnnotation(ManagerConstant.USECASE_DISPLAY_ID_EANNOTATION_SOURCE_NAME);
    UseCaseDisplayId displayId = null;

    if (eAnnotation != null) {
        displayId = (UseCaseDisplayId) eAnnotation;
        displayId.setDisplayId(value);
    } else {
        displayId = UsecasedisplayIdFactory.eINSTANCE.createUseCaseDisplayId();
        displayId.setSource(ManagerConstant.USECASE_DISPLAY_ID_EANNOTATION_SOURCE_NAME);
        displayId.setDisplayId(value);
        setElementInfo(element, displayId);
    }

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

示例8: findSpecificAnnotation

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * 해당 Element에서 특정 Annotation 반환
 * 
 * @param element
 * @param annotationName
 * @return EAnnotation
 */
public static EAnnotation findSpecificAnnotation(Element element, String annotationName) {
    if (annotationName != null) {
        if (element.getEAnnotation(annotationName) != null) {
            return element.getEAnnotation(annotationName);
        } else {
            return element.createEAnnotation(annotationName);
        }
    }

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

示例9: unmark

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * Annotation을 이용하여 마킹 한 것을 제거한다.
 * 
 * @param elements
 *            언마킹하려는 요소
 */
private void unmark(Set<EObject> elements) {
    Iterator<EObject> iter = elements.iterator();
    while (iter.hasNext()) {
        EObject eObj = (EObject) iter.next();
        if (eObj instanceof Element) {
            Element elm = (Element) eObj;
            EAnnotation eAnno = elm.getEAnnotation(EANNO_PASTE);
            if (eAnno != null)
                elm.getEAnnotations().remove(eAnno);
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:ElementPaster.java

示例10: mark

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * 복사하려는 요소에 Annotation을 이용하여 마킹을 해 둔다.
 * 
 * @param collectedEObjs
 *            복사하려는 요소
 */
private void mark(Collection<EObject> elements) {
    int uniqId = 0;
    Iterator<EObject> iter = elements.iterator();
    while (iter.hasNext()) {
        EObject eObj = (EObject) iter.next();
        if (eObj instanceof Element) {
            Element elm = (Element) eObj;
            EAnnotation eAnno = elm.getEAnnotation(EANNO_PASTE);
            if (eAnno == null)
                eAnno = elm.createEAnnotation(EANNO_PASTE);
            eAnno.getDetails().put(EANNO_PASTE, String.valueOf(uniqId++));
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:21,代码来源:ElementPaster.java

示例11: getUseCaseDisplayId

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * getUseCaseDisplayId
 *  
 * @param useCase
 * @return String
 */
public static String getUseCaseDisplayId(UseCase useCase) {
    Element element = useCase;
    EAnnotation eAnnotation = element.getEAnnotation(ManagerConstant.USECASE_DISPLAY_ID_EANNOTATION_SOURCE_NAME);
    UseCaseDisplayId displayId = null;

    if (eAnnotation != null) {
        displayId = (UseCaseDisplayId) eAnnotation;
        String usecaseId = displayId.getDisplayId();
        return usecaseId;
    } else {
        return UICoreConstant.EMPTY_STRING;
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:20,代码来源:ProjectUtil.java

示例12: moveClassDiagram

import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
 * 
 * 
 * 
 * @param diagramList
 * @param target
 * @return IStatus
 */
private static IStatus moveClassDiagram(final List<Diagram> diagramList, final EObject target) {
    for (Diagram source : diagramList) {
        EObject parent = ((Diagram) source).getParent();
        if (!(target instanceof Diagram)) {
            source.setParent(target);
        } else {
            System.err.println(target);
            return new Status(Status.ERROR, IRuntimeConstants.PI_RUNTIME, Status.ERROR, "", null);
        }

        TreeIterator<EObject> allContents = source.eAllContents();

        while (allContents.hasNext()) {
            EObject eObj = allContents.next();
            if (eObj instanceof AbstractView) {
                if (((AbstractView) eObj).getParent() == parent) {
                    ((AbstractView) eObj).setParent(target);
                }
            } else {
                // System.err.println(eObj);
            }
        }

        if (target instanceof Element) {
            Element targetElement = (Element) target;

            EAnnotation eAnnotation = targetElement.getEAnnotation(UMLHelper.DIAGRAM_SOURCE_NAME);
            if (null == eAnnotation) {
                eAnnotation = targetElement.createEAnnotation(UMLHelper.DIAGRAM_SOURCE_NAME);
                targetElement.getEAnnotations().add(eAnnotation);
            }

            eAnnotation.getContents().add(source);
        } else {
            // System.err.println(target);
        }
    }

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


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