本文整理汇总了Java中org.eclipse.uml2.uml.Property.getAssociation方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getAssociation方法的具体用法?Java Property.getAssociation怎么用?Java Property.getAssociation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.uml2.uml.Property
的用法示例。
在下文中一共展示了Property.getAssociation方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DeleteUMLPropertyCommand
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* DeleteUMLPropertyCommand
* @param property
*/
public DeleteUMLPropertyCommand(Property property) {
super(property.getAssociation());
this.property = property;
if (null == property.getAssociation()) {
this.parentElement = (org.eclipse.uml2.uml.PackageableElement) this.property.getOwner();
}
}
示例2: copyElement
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* UML 요소를 복사한다. (ProjectUtil의 기존 코드)
*
* @param original
* 복사하려는 UML 요소
* @return EObject 복사된 UML 요소
*/
private EObject copyElement(EObject original) {
EObject copied = null;
// //////////////////////////////////////////////////////
// Association 연결에 따라 생성된 Property는 복사하지 않는다.
// 추후에 연결선 복사 기능은 완성 시 삭제하도록 한다.
List<Property> tempProperty = new ArrayList<Property>();
if (original instanceof Class) {
Class clazz = (Class) original;
for (Property childProperty : clazz.getOwnedAttributes()) {
if (childProperty.getAssociation() != null) {
tempProperty.add(childProperty);
}
}
clazz.getOwnedAttributes().removeAll(tempProperty);
}
// ///////////////////////////////////////////////////////
copied = EcoreUtil.copy(original);
// //////////////////////////////////////////////////////
// 노드 복사가 끝난 후엔 다시 Property를 추가해 준다.
if (original instanceof Class) {
((Class) original).getOwnedAttributes().addAll(tempProperty);
}
return copied;
}
示例3: refreshVisuals
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
try {
NotationNode propertyModel = (NotationNode) getModel();
Property property = (Property) propertyModel.getUmlModel();
Image image = UiCorePlugin.getDefault().getImageForUMLElement(property);
String propertyName = property.getName();
String propertyType = UICoreConstant.EMPTY_STRING;
if( PreferenceUtil.INSTANCE.getPreferenceStore().getBoolean(ManagerConstant.PREFERENCE_CONSTANT_KEY__NEXCORE_TOOL_UML_COMPARTMENT_VISIBILITY_SHOW_TYPE) ){
if(null != property.getType()){
propertyType = STRING_COLON + property.getType().getName();
propertyName = propertyName + propertyType;
}
}
if (property.getAssociation() == null) {
Label label = (Label) getFigure();
label.setIcon(image);
label.setText(propertyName);
}
label.setToolTip(new Label(propertyName));
} catch (Exception e) {
Log.error("AttributeEditPart refreshVisuals() Error " + e);
}
}
示例4: getModelChildren
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
*/
@SuppressWarnings("unchecked")
@Override
protected List getModelChildren() {
NotationNode propertiesModel = (NotationNode) this.getModel();
Element element = propertiesModel.getUmlModel();
if (element == null) {
element = ((AbstractNode) propertiesModel.getParent()).getUmlModel();
}
EList<Property> propertyList;
if (element instanceof StructuredClassifier) {
propertyList = ((StructuredClassifier) element).getOwnedAttributes();
} else if (element instanceof Interface) {
propertyList = ((Interface) element).getOwnedAttributes();
} else if (element instanceof DataType) {
propertyList = ((DataType) element).getOwnedAttributes();
} else if (element instanceof Signal) {
propertyList = ((Signal) element).getOwnedAttributes();
} else {
return null;
}
List<NotationNode> list = new ArrayList<NotationNode>();
for (Property property : propertyList) {
if (null == property.getAssociation()) {
NotationNode propertyModel = UMLDiagramFactory.eINSTANCE.createNotationNode();
propertyModel.setNodeType(NodeType.ATTRIBUTE);
propertyModel.setParent(propertiesModel);
propertyModel.setUmlModel(property);
list.add(propertyModel);
}
}
return list;
}
示例5: ClassNode
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* Creates a ClassNode based on the EMF-UML model-element and layout
* information provided
*
*
* @param clazz
* the EMF-UML model-element which holds informations of this
* diagram element
* @param id
* the layout id of this element
*/
public ClassNode(Classifier clazz, String id) {
/*
* position = layout.getPosition(); width = layout.getWidth(); height =
* layout.getHeight(); id = layout.getName();
*/
this.id = id;
name = clazz.getName();
attributes = new ArrayList<Attribute>();
// creating attributes
for (Property attr : clazz.getAttributes()) {
if (attr.getAssociation() == null) {
attributes.add(new Attribute(attr));
}
}
operations = new ArrayList<MemberOperation>();
// creating operations
for (Operation op : clazz.getOperations()) {
operations.add(new MemberOperation(op));
}
if (clazz.isAbstract()) {
type = CDNodeType.ABSTRACT_CLASS;
} else {
type = CDNodeType.CLASS;
}
}
示例6: removeAssociationProperties
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* Removes the {@link Property Properties} that have {@link Association Associations} from the given list
* @param properties - the list
*/
private void removeAssociationProperties(List<Property> properties){
List<Element> propertiesToRemove = new LinkedList<Element>();
for(Element property : properties){
if(property instanceof Property){
Property prop = (Property) property;
if(prop.getAssociation() != null){
propertiesToRemove.add(property);
}
}
}
properties.removeAll(propertiesToRemove);
}
示例7: exportAssociations
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
void exportAssociations(EList<Property> properites) {
for (Property prop : properites) {
if (prop.getAssociation() != null) {
associationMembers.add(prop);
ownAssociations = true;
}
}
}
示例8: createPropertiesDefinition
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
public static String createPropertiesDefinition(Classifier classifier) throws Exception {
EPackage _package = EcoreFactory.eINSTANCE.createEPackage();
EClass propertyDefinition = EcoreFactory.eINSTANCE.createEClass();
GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
ExtendedMetaData extendedMetaData = genModel.getExtendedMetaData();
List<EStructuralFeature> features = new ArrayList<EStructuralFeature>();
String propertiesDefinition = "";
for(Property property : classifier.getAttributes()) {
// consider attributes only if they aren't members of an association
if(property.getAssociation() == null) {
EAttribute attribute = EcoreFactory.eINSTANCE.createEAttribute();
attribute.setName(property.getName());
attribute.setUnsettable(true);
// create an EEnum in case of enumeration
if(property.getType() instanceof Enumeration) {
Enumeration enumeration = (Enumeration) property.getType();
EEnum eenumeration = EcoreFactory.eINSTANCE.createEEnum();
eenumeration.setName(enumeration.getName());
int literalValue = 0;
for(EnumerationLiteral literal : enumeration.getOwnedLiterals()) {
EEnumLiteral eliteral = EcoreFactory.eINSTANCE.createEEnumLiteral();
eliteral.setName(literal.getName());
eliteral.setValue(literalValue);
literalValue++;
eenumeration.getELiterals().add(eliteral);
}
_package.getEClassifiers().add(eenumeration);
attribute.setEType(eenumeration);
}
else {
attribute.setEType(XMLTypePackage.eINSTANCE.getString());
}
propertyDefinition.getEStructuralFeatures().add(attribute);
extendedMetaData.setFeatureKind(attribute, ExtendedMetaData.ELEMENT_FEATURE);
features.add(attribute);
}
}
if(!features.isEmpty()) {
// first step: create an Ecore metamodel
URI uri = URI.createFileURI(new File(Path + classifier.getName() + Ecore_Model_Fragment).getAbsolutePath());
Resource resource = Resource_Set.createResource(uri);
_package.setName(classifier.getName() + "Properties");
_package.setNsPrefix(classifier.getName() + "Properties");
_package.setNsURI("http://" + classifier.getName() + "Properties");
resource.getContents().add(_package);
propertyDefinition.setName("Properties");
_package.getEClassifiers().add(propertyDefinition);
// second step: derive the GenModel from the metamodel
genModel.setComplianceLevel(GenJDKLevel.JDK70_LITERAL);
genModel.setModelDirectory("");
genModel.setModelName(_package.getName());
genModel.initialize(Collections.singleton(_package));
// third step: export the XSD from the GenModel
XSDExporter modelExporter = new XSDExporter();
modelExporter.setGenModel(genModel);
modelExporter.getEPackages().add(_package);
EPackageConvertInfo convertInfo = modelExporter.getEPackageConvertInfo(_package);
convertInfo.setConvert(true);
EPackageExportInfo exportInfo = modelExporter.getEPackageExportInfo(_package);
exportInfo.setArtifactLocation(Path + classifier.getName() + Xsd_Model_Fragment);
modelExporter.export(null);
// the name of the properties definition; it allows node types to reference it
propertiesDefinition = classifier.getName() + "Properties";
}
return propertiesDefinition;
}
示例9: isSimpleAttribute
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
private boolean isSimpleAttribute(Property property) {
return property.getAssociation() == null;
}