本文整理汇总了Java中org.eclipse.uml2.uml.PackageableElement类的典型用法代码示例。如果您正苦于以下问题:Java PackageableElement类的具体用法?Java PackageableElement怎么用?Java PackageableElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PackageableElement类属于org.eclipse.uml2.uml包,在下文中一共展示了PackageableElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCollaboration
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* Collaboration 생성
*
* @param realizePkg
* @param useCase
* @return Collaboration
*/
private Collaboration createCollaboration(Package realizePkg, UseCase useCase) {
Package ucPackage = realizePkg.getNestedPackage(useCase.getName());
if (ucPackage == null) {
ucPackage = realizePkg.createNestedPackage(useCase.getName());
}
PackageableElement packagedElement = ucPackage.getPackagedElement(useCase.getName());
Collaboration collabo = null;
if (packagedElement instanceof Collaboration) {
collabo = (Collaboration) packagedElement;
} else {
EClass eClass = UMLFactory.eINSTANCE.getUMLPackage().getCollaboration();
collabo = (Collaboration) ucPackage.createPackagedElement(useCase.getName(), eClass);
}
ModelUtility.copyDocumentation(collabo, useCase);
ModelUtility.copyKeywords(useCase, collabo);
return collabo;
}
示例2: getSortedAllPackageChildrenList
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* getSortedAllPackageChildrenList
*
* @param parent
* @return List<T>
*/
@SuppressWarnings("unchecked")
public List<T> getSortedAllPackageChildrenList(Package parent) {
List<PackageableElement> packagedElements = parent.getPackagedElements();
List<T> list = new ArrayList<T>();
for (PackageableElement packagedElement : packagedElements) {
if (packagedElement.eClass().equals(UMLPackage.Literals.PACKAGE)) {
list.add((T) packagedElement);
}
}
sorting(list);
if (list.size() > 0) {
Object arrayList[] = list.toArray();
for (int i = 0; i < arrayList.length; i++) {
Package packageElement = (Package) arrayList[i];
List<T> childrenList = getSortedAllPackageChildrenList(packageElement);
if (childrenList.size() > 0) {
list.addAll(childrenList);
}
}
}
return list;
}
示例3: redo
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* @see org.eclipse.gef.commands.Command#redo()
*/
@Override
public void redo() {
this.parentElement = (org.eclipse.uml2.uml.PackageableElement) this.targetElement.getOwner();
this.appliedStereotypeList = this.targetElement.getAppliedStereotypes();
this.compoundCommand = new ArrayList<DeleteUMLStereotypeCommand>();
this.init();
for (Iterator<DeleteUMLStereotypeCommand> iter = this.compoundCommand.iterator(); iter.hasNext();) {
iter.next().redo();
}
Stereotype stereotype;
for (Iterator<Stereotype> iter = appliedStereotypeList.iterator(); iter.hasNext();) {
stereotype = iter.next();
this.targetElement.unapplyStereotype(stereotype);
this.delete(stereotype);
}
this.redoOwnElement();
}
示例4: parentIsPackageAndDo
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* 상위 부모가 Package 요소이고 자식 요소가 PackageableElement라면
* 붙이기를 수행한다.
* @param parent UML 요소를 붙여 넣을 부모
* @param copied 복사된 UML 요소
* @param original 원본 UML 요소
* @param something 복사할 것인지 복사 가능여부만 체크할 것인지 결정하는 플래그
* @return boolean 부모로 복사 성공 여부
*/
private static boolean parentIsPackageAndDo(EObject parent, EObject copied, EObject original, int something) {
boolean result = false;
Package _package = (Package)parent;
if (copied instanceof Interaction) {
result = false;
} else if (copied instanceof PackageableElement) {
if (something == COPY) _package.getPackagedElements().add((PackageableElement) copied);
result = true;
} else if (copied instanceof Diagram && something == CHECK_COPYABLE) {
result = true;
}
if (result && something == COPY) applyStereotypes(parent, copied, original);
return result;
}
示例5: redo
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* @see org.eclipse.gef.commands.Command#redo()
*/
@Override
public void redo() {
Element umlModel = notationNode.getUmlModel();
PackageableElement parentElement = null;
if (false == request.getNewObjectType().equals(NodeType.TEXT)
&& false == request.getNewObjectType().equals(NodeType.NOTE) && null != request.getNewObjectType()) {
parentElement = UMLManager.getParentPackage(this.parentNodeModel);
if (parentElement instanceof org.eclipse.uml2.uml.Component) {
((org.eclipse.uml2.uml.Component) parentElement).getPackagedElements()
.add((PackageableElement) umlModel);
} else {
((org.eclipse.uml2.uml.Package) parentElement).getPackagedElements().add((PackageableElement) umlModel);
}
}
if( parentElement != null ) {
notationNode.setParent(parentElement);
}
if (parentNodeModel instanceof Diagram) {
((Diagram) parentNodeModel).getNodeList().add(notationNode);
} else if (parentNodeModel instanceof ContainerNode) {
((ContainerNode) parentNodeModel).getNodeList().add(notationNode);
}
}
示例6: undo
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* @see org.eclipse.gef.commands.Command#undo()
*/
@Override
public void undo() {
Element umlModel = notationNode.getUmlModel();
if (umlModel instanceof Lifeline) {
Interaction interaction = (Interaction) notationNode.getParent();
interaction.getLifelines().remove((Lifeline) umlModel);
} else if (false == request.getNewObjectType().equals(NodeType.TEXT)
&& false == request.getNewObjectType().equals(NodeType.NOTE) && null != request.getNewObjectType()) {
org.eclipse.uml2.uml.PackageableElement parentElement = (org.eclipse.uml2.uml.PackageableElement) notationNode.getParent();
if (parentElement instanceof org.eclipse.uml2.uml.Component) {
((org.eclipse.uml2.uml.Component) parentElement).getPackagedElements().remove(umlModel);
} else {
((org.eclipse.uml2.uml.Package) parentElement).getPackagedElements().remove(umlModel);
}
}
if (parentNodeModel instanceof Diagram) {
((Diagram) parentNodeModel).getNodeList().remove(notationNode);
} else if (parentNodeModel instanceof ContainerNode) {
((ContainerNode) parentNodeModel).getNodeList().remove(notationNode);
}
}
示例7: equals
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* @see org.eclipse.emf.common.ui.URIEditorInput#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (!super.equals(o)) {
return false;
}
Diagram selectedDiagram = ((DiagramEditorInput) o).getDiagram();
PackageableElement selectedParent = UMLManager.getParent(selectedDiagram);
PackageableElement parent = UMLManager.getParent(this.diagram);
if (selectedParent != null && parent != null) {
if (this.diagram.getId().equals(selectedDiagram.getId()) && parent.equals(selectedParent)) {
return true;
}
}
return false;
}
示例8: hasComponentChild
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
*
* SelectedElement 하위에 컴포넌트가 있는지 검사.
*
* @param parentElement
* @return
*/
private boolean hasComponentChild(Element parentElement) {
for( Element child : parentElement.getOwnedElements() ) {
if( child instanceof org.eclipse.uml2.uml.Class ) {
if( COMPONENT_STEREOTYPE.equals( ProjectUtil.getStereotypeLabel(child).trim() ) ) {
return true;
}
}
if (child instanceof PackageableElement) {
if(hasComponentChild( child )){
return true;
}
}
}
return false;
}
示例9: createDiagramDataModelList
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* Diagram 데이터 모델 리스트를 생성합니다.
*
* @param pkg
* @return List<DataModel>
*/
private List<DataModel> createDiagramDataModelList(Package pack) throws Exception {
List<DataModel> diagramModelList = new ArrayList<DataModel>();
EAnnotation annotation = null;
Diagram diagram;
for (PackageableElement element : pack.getPackagedElements()) {
if (element.eClass() == UMLPackage.Literals.COLLABORATION) {
annotation = element.getEAnnotation(UICoreConstant.PROJECT_CONSTANTS__DIAGRAM);
if (annotation != null) {
for (EObject eobj : annotation.getContents()) {
if (eobj.eClass() == UMLDiagramPackage.Literals.DIAGRAM) {
diagram = (Diagram) eobj;
if (diagram.getType() == DiagramType.CLASS_DIAGRAM) {
diagramModelList.add(createDiagramModel(diagram));
}
}
}
}
}
}
// if (eObject.eClass() == UMLPackage.Literals.PACKAGE
// || eObject.eClass() == UMLPackage.Literals.MODEL) {
// Package pkg = (Package) eObject;
// for (PackageableElement element : pkg.getPackagedElements()) {
// diagramModelList.addAll(createDiagramDataModelList(element));
// }
// }
return diagramModelList;
}
示例10: createClassDataModelList
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* Class 데이터 모델 리스트를 생성합니다.
*
* @param pkg
* @return List<DataModel>
*/
private List<DataModel> createClassDataModelList(Package pkg) {
List<DataModel> classModelList = new ArrayList<DataModel>();
DataModel classModel;
List<PackageableElement> list = pkg.getPackagedElements();
List<Class> classes = new ArrayList<Class>();
for (PackageableElement packageableElement : list) {
if (packageableElement.eClass() == UMLPackage.Literals.CLASS) {
classes.add((Class) packageableElement);
}
}
ProjectUtil.getSortedList(classes);
if (!classes.isEmpty()) {
for (Class clazz : classes) {
classModel = new DataModel();
setDataModel(classModel, UICoreConstant.REPORT__CLASS_NAME, clazz.getName());
setDataModel(classModel, UICoreConstant.REPORT__CLASS_STEREOTYPE, ProjectUtil.getStereotypeLabel(clazz));
setDataModel(classModel,
UICoreConstant.REPORT__CLASS_DOCUMENTATION,
getCommentToString(clazz.getOwnedComments()));
setDataModel(classModel, UICoreConstant.REPORT__ATTRIBUTE_LIST, createAttributeDataModelList(clazz));
setDataModel(classModel, UICoreConstant.REPORT__OPERATION_LIST, createOperationDataModelList(clazz));
classModelList.add(classModel);
}
}
return classModelList;
}
示例11: createClass
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* Lifeline의 Type에 새 클래스 생성. (생성된 클래스를 Type에 붙이는 것은 transaction 때문에
* execute()에서 처리) void
*
* @param parentNodeModel
*/
public static org.eclipse.uml2.uml.Class createClass(AbstractNode parentNodeModel) {
PackageableElement parentElement = UMLManager.getParentPackage(parentNodeModel);
org.eclipse.uml2.uml.Class umlClass = null;
CreateClassDialog dialog = new CreateClassDialog(RealizationPlugin.getShell());
if (dialog.open() == Window.OK) {
String className = dialog.getClassName();
umlClass = UMLHelper.createClass();
if (className.equals(UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING)) {
umlClass.setName(UMLManager.getPackagedUniqueName((Namespace) parentElement, umlClass.getName()));
} else {
umlClass.setName(className);
}
}
return umlClass;
}
示例12: redo
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
/**
* @see org.eclipse.gef.commands.Command#redo()
*/
@Override
public void redo() {
// Element diagramModel = this.parentNodeModel.getUmlModel();
Element umlModel = notationNode.getUmlModel();
PackageableElement parentElement = null;
if (umlModel instanceof Lifeline) {
parentElement = UMLManager.getParent(this.parentNodeModel);
Interaction interaction = (Interaction) parentElement;
interaction.getLifelines().add((Lifeline) umlModel);
} else if (false == request.getNewObjectType().equals(NodeType.TEXT)
&& false == request.getNewObjectType().equals(NodeType.NOTE) && null != request.getNewObjectType()) {
parentElement = UMLManager.getParentPackage(this.parentNodeModel);
((org.eclipse.uml2.uml.Package) parentElement).getPackagedElements().add((PackageableElement) umlModel);
}
notationNode.setParent(parentElement);
if (parentNodeModel instanceof Diagram) {
((Diagram) parentNodeModel).getNodeList().add(notationNode);
} else if (parentNodeModel instanceof ContainerNode) {
((ContainerNode) parentNodeModel).getNodeList().add(notationNode);
}
}
示例13: findMPD
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
private static Element findMPD(final Package theParent) {
if (theParent == null) {
LOG.error("Failed to find PSM package");// tjd message
return null;
}
for (final Package p : theParent.getNestedPackages()) {
if (isMPD(p)) {
for (final PackageableElement e : p.getPackagedElements()) {
if (getAppliedMpdStereotype(e) != null) {
return e;
}
}
LOG.error("Failed to find MPD in package "+p.getQualifiedName());
}
}
LOG.error("Failed to find an MPD in subpackages of "+theParent.getQualifiedName());
return null;
}
示例14: doExecute
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
@Override
protected void doExecute() {
final PackageableElement thePIM = root.getPackagedElements().get(0);
setTargetNamespace(thePIM.getOwnedElements().get(1), modelValues.extensionModelTargetNamespace);
setTargetNamespace(thePIM.getOwnedElements().get(2), modelValues.exchangeModelTargetNamespace);
final Element theMPD = root.getPackagedElements().get(1).getOwnedElements().get(0);
setMPDBaseURI(theMPD, modelValues.mpdBaseURI);
setMPDVersionID(theMPD, modelValues.mpdVersionID);
setMPDDescription(theMPD, modelValues.description);
setMPDPurpose(theMPD, modelValues.purpose);
setMPDSecurityMarking(theMPD, modelValues.securityMarking);
setMPDDomains(theMPD, modelMultiValues.domains);
setMPDKeywords(theMPD, modelMultiValues.keywords);
setMPDAuthoritativeSourceName(theMPD, modelMultiValues.authoritativeSourceName);
setMPDAuthoritativeSourceAddress(theMPD, modelMultiValues.authoritativeSourceAddress);
setMPDAuthoritativeSourceWebsiteURL(theMPD, modelMultiValues.authoritativeSourceWebsiteURL);
setMPDPointsOfContact(theMPD, toEObjects(pointsOfContact, theMPD));
setMPDCreationDate(theMPD, new Date());
}
示例15: validate
import org.eclipse.uml2.uml.PackageableElement; //导入依赖的package包/类
@Override
public boolean validate(Model model) {
BinaryModelRel deplRel = (BinaryModelRel) model;
org.eclipse.uml2.uml.Model srcUmlModel;
try {
srcUmlModel = (org.eclipse.uml2.uml.Model) deplRel.getSourceModel().getEMFInstanceRoot();
}
catch (MMINTException e) {
MMINTException.print(IStatus.ERROR, "Can't get model root, skipping validation", e);
return false;
}
for (PackageableElement umlModelObj : srcUmlModel.getPackagedElements()) {
if (!(umlModelObj instanceof Component)) {
continue;
}
ModelElementReference modelElemRef = MIDRegistry.getModelElementReference(deplRel.getModelEndpointRefs().get(0), umlModelObj);
if (modelElemRef == null || modelElemRef.getModelElemEndpointRefs().isEmpty()) {
return false;
}
}
return true;
}