本文整理汇总了Java中org.eclipse.uml2.uml.Element.createEAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java Element.createEAnnotation方法的具体用法?Java Element.createEAnnotation怎么用?Java Element.createEAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.uml2.uml.Element
的用法示例。
在下文中一共展示了Element.createEAnnotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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++));
}
}
}
示例4: 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;
}