本文整理汇总了Java中org.eclipse.uml2.uml.Property.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getType方法的具体用法?Java Property.getType怎么用?Java Property.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.uml2.uml.Property
的用法示例。
在下文中一共展示了Property.getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshChildren
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* @see nexcore.tool.uml.ui.property.section.TemplateTextSection#refreshChildren()
*/
@Override
public void refreshChildren() {
if (null == this.text || this.text.isDisposed()) {
return;
}
String str = this.get();
if (null != str && !str.equals(this.text.getText())) {
this.text.setText(str);
} else if (str == null) {
this.text.setText("");
}
Property property = (Property) getData();
Type type = property.getType();
if(type instanceof org.eclipse.uml2.uml.Class) {
this.text.setEnabled(false);
} else {
this.text.setEnabled(true);
}
}
示例2: settingTypeToLabelOfType
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* 유형을 표시하는 레이블에 해당 속성 모델의 유형을 세팅함.
*
* @param selectedType
* void
*/
private void settingTypeToLabelOfType() {
ConnectableElement represents = getData().getRepresents();
String name = UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING;
Image image = null;
if (represents != null && represents instanceof Property) {
Property property = (Property) represents;
Type type = property.getType();
if (type != null) {
name = type.getName();
image = UICoreConstant.UMLSECTION_CONSTANTS__ADAPTER_FACTORY_LABEL_PROVIDER.getImage(type);
}
}
if (!typeNameLabel.isDisposed()) {
typeNameLabel.setImage(image);
typeNameLabel.setText(name);
typeNameLabel.getParent().pack();
}
}
示例3: ClassAttributeLink
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* Creates a ClassAttributeLink based on the EMF-UML model-elements and
* layout information provided
*
* @param layout
* the layout informations of this link
* @param assoc
* the EMF-UML model-element which holds informations of this
* diagram element
* @param fromClass
* the EMF-UML model Class belonging to the from end of this
* association
* @param toClass
* the EMF-UML model Class belonging to the to end of this
* association
* @throws UnexpectedEndException
* Exception is thrown if an association's end could not be
* linked to the EMF-UML model
*/
public ClassAttributeLink(LineAssociation layout, Association assoc, Classifier fromClass, Classifier toClass)
throws UnexpectedEndException {
super(layout);
name = assoc.getLabel();
from = null;
to = null;
for (Property end : assoc.getMemberEnds()) {
Class endClass = (Class) end.getType();
// when handling reflexive links then first add the to end's, then
// the from end's model information (to match the Papyrus exporter
// behavior)
if (endClass == toClass && to == null) {
to = new AssociationEnd(end);
} else if (endClass == fromClass && from == null) {
from = new AssociationEnd(end);
} else {
throw new UnexpectedEndException(end.getName());
}
}
}
示例4: addPortToComposite
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addPortToComposite(RoundedCompartmentEditPart compartment) {
Element elem = (Element) ((View)compartment.getModel()).getElement();
List<Port> ports = Collections.emptyList();
if(elem instanceof Property){
Property prop = (Property) elem;
Object clazz = prop.getType();
if(clazz instanceof Classifier){
ports = (List<Port>) (Object) ((Classifier)clazz).getAttributes().stream().filter(p-> p instanceof Port).collect(Collectors.toList());
}
}else if(elem instanceof org.eclipse.uml2.uml.Class){
ports = (List<Port>) (Object) ((org.eclipse.uml2.uml.Class) elem).getAttributes().stream().filter(p-> p instanceof Port).collect(Collectors.toList());
}
for(Port p : ports){
CompositeDiagramElementsController.addPortToCompartmentEditPart(compartment, p);
}
}
示例5: createAttributes
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
private String createAttributes(VisibilityKind modifyer) {
StringBuilder source = new StringBuilder("");
for (Property attribute : structuredElement.getOwnedAttributes()) {
if (attribute.getVisibility().equals(modifyer)) {
String type = UKNOWN_TYPE;
if (attribute.getType() != null) {
type = attribute.getType().getName();
}
if (isSimpleAttribute(attribute)) {
source.append(VariableTemplates.propertyDecl(type, attribute.getName(), attribute.getDefault()));
} else {
dependencyExporter.addDependency(type);
}
}
}
return source.toString();
}
示例6: getSubSystem
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
static public List<NamedElement> getSubSystem(Classifier c){
LinkedList<NamedElement> sub_syst_found = new LinkedList<NamedElement>();
for(Property prop : c.getAllAttributes()){
if((prop.getType() instanceof Classifier) && !(prop instanceof Port) && !( prop.getType() instanceof DataType)){
sub_syst_found.add((NamedElement)prop);
}
}
return sub_syst_found;
}
示例7: getParts
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
static public List<NamedElement> getParts(Classifier c){
LinkedList<NamedElement> sub_syst_found = new LinkedList<NamedElement>();
for(Property prop : c.getAllAttributes()){
if(prop.getType() instanceof org.eclipse.uml2.uml.Class){
sub_syst_found.add((NamedElement)prop);
}
}
return sub_syst_found;
}
示例8: getAttributs
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
static public List<NamedElement> getAttributs(Classifier c){
LinkedList<NamedElement> sub_syst_found = new LinkedList<NamedElement>();
for(Property prop : c.getAllAttributes()){
if(!(prop instanceof Port) && !(prop.getType() instanceof org.eclipse.uml2.uml.Class)){
sub_syst_found.add((NamedElement)prop);
}
}
return sub_syst_found;
}
示例9: 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);
}
}
示例10: 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;
}
示例11: transformAttributes
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* transform attributes for target class or interface
*
* @param sourceType
* @param targetType
* @param targetStructureTransformationData
*/
private static void transformAttributes(Type sourceType, Type targetType,
TargetStructureTransformationData targetStructureTransformationData) {
EList<Property> sourceProperties = null;
Property sourceProperty = null;
Property targetProperty = null;
boolean isNewlyCreated = false;
// Source(분석 모델)요소가 Class인 경우
if (sourceType instanceof Class) {
sourceProperties = ((Class) sourceType).getOwnedAttributes();
// Source(분석 모델)요소가 Interface인 경우
} else if (sourceType instanceof Interface) {
sourceProperties = ((Interface) sourceType).getOwnedAttributes();
}
for (Iterator<Property> propertyIterator = sourceProperties.iterator(); propertyIterator.hasNext();) {
sourceProperty = propertyIterator.next();
if (targetType instanceof Interface) {
targetProperty = ((Interface) targetType).getOwnedAttribute(sourceProperty.getName(), null);
if (targetProperty == null) {
/**
* 2011.03.09 조승현 원래는 모든 property 의 Type을 다 복사해야 맞지만,
* Primitive 타입이 아닐 경우에는 아직 만들어 지지 않은 Type(Class) 일 수도 있어서,
* 현재는 Primitive 타입일 경우에만 Type을 복사 함. 전개 순서를 패키지 -> Type ->
* Attribute -> Operation... 으로 바꾸는 작업이 선행 되어야 함.
*/
if (sourceProperty.getType() instanceof PrimitiveType) {
targetProperty = ((Class) targetType).createOwnedAttribute(sourceProperty.getName(),
sourceProperty.getType());
} else {
targetProperty = ((Class) targetType).createOwnedAttribute(sourceProperty.getName(), null);
}
isNewlyCreated = true;
}
} else if (targetType instanceof Class) {
targetProperty = ((Class) targetType).getOwnedAttribute(sourceProperty.getName(), null);
/**
* 2011.03.09 조승현 원래는 모든 property 의 Type을 다 복사해야 맞지만, Primitive
* 타입이 아닐 경우에는 아직 만들어 지지 않은 Type(Class) 일 수도 있어서, 현재는 Primitive
* 타입일 경우에만 Type을 복사 함. 전개 순서를 패키지 -> Type -> Attribute ->
* Operation... 으로 바꾸는 작업이 선행 되어야 함.
*/
if (targetProperty == null) {
if (sourceProperty.getType() instanceof PrimitiveType) {
targetProperty = ((Class) targetType).createOwnedAttribute(sourceProperty.getName(),
sourceProperty.getType());
} else {
targetProperty = ((Class) targetType).createOwnedAttribute(sourceProperty.getName(), null);
}
isNewlyCreated = true;
}
}
if (targetStructureTransformationData != null
&& targetStructureTransformationData.getPropertyApplicableStereotype() != null
&& targetProperty != null) {
applyStereotype(sourceProperty, targetProperty, targetStructureTransformationData.getPropertyApplicableStereotype());
}
// 신규 생성인 경우
if (isNewlyCreated) {
// 코멘트를 복사한다
copyComment(sourceProperty, targetProperty);
}
targetProperty.setVisibility(sourceProperty.getVisibility());
}
}
示例12: createAttributeDataModelList
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* Attribute 데이터 모델 리스트를 생성합니다.
*
* @param cls
* @return List<DataModel>
*/
private List<DataModel> createAttributeDataModelList(Class cls) {
List<DataModel> attributeModelList = new ArrayList<DataModel>();
DataModel attributeModel;
String qualifiedTypeName = UICoreConstant.EMPTY_STRING;
if (!cls.getAttributes().isEmpty()) {
for (Property property : cls.getAttributes()) {
attributeModel = new DataModel();
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_NAME, property.getName());
setDataModel(attributeModel,
UICoreConstant.REPORT__ATTRIBUTE_DOCUMENTATION,
getCommentToString(property.getOwnedComments()));
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_VISIBILITY, property.getVisibility()
.toString());
if (property.getType() != null) {
StringBuffer stringBuffer = new StringBuffer();
boolean isPrimitives = false;
qualifiedTypeName = property.getType().getQualifiedName();
for (int i = 0; i < UICoreConstant.PROJECT_CONSTANTS__CORE_LIBRARY_NAMES.length; i++) {
if (qualifiedTypeName.startsWith(UICoreConstant.PROJECT_CONSTANTS__CORE_LIBRARY_NAMES[i])) {
isPrimitives = true;
stringBuffer.append(property.getType().getName());
break;
}
}
if (!isPrimitives) {
stringBuffer.append(MDDCommonUtil.getMappedName(qualifiedTypeName));
}
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_TYPE, stringBuffer.toString());
} else {
setDataModel(attributeModel,
UICoreConstant.REPORT__ATTRIBUTE_TYPE,
UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING);
}
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_DEFAULT_VALUE, property.getDefault());
attributeModelList.add(attributeModel);
}
} else {
attributeModel = new DataModel();
// setDataModel(attributeModel,
// UICoreConstant.REPORT__ATTRIBUTE_NAME,
// UMLMessage.LABEL_NO_APPLICABLE);
attributeModelList.add(attributeModel);
}
return attributeModelList;
}
示例13: createAttributeDataModelList
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
* 1) Attribute 데이터 모델 리스트를 생성합니다.
*
* @param cls
* @return List<DataModel>
*/
public List<DataModel> createAttributeDataModelList(Classifier cls) {
List<DataModel> attributeModelList = new ArrayList<DataModel>();
DataModel attributeModel;
String qualifiedTypeName = UICoreConstant.EMPTY_STRING;
if (!cls.getAttributes().isEmpty()) {
for (Property property : cls.getAttributes()) {
attributeModel = new DataModel();
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_NAME, property.getName());
setDataModel(attributeModel,
UICoreConstant.REPORT__ATTRIBUTE_DOCUMENTATION,
getCommentToString(property.getOwnedComments()));
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_VISIBILITY, property.getVisibility()
.toString());
if (property.getType() != null) {
StringBuffer stringBuffer = new StringBuffer();
boolean isPrimitives = false;
qualifiedTypeName = property.getType().getQualifiedName();
if (null != qualifiedTypeName) {
for (int i = 0; i < UICoreConstant.PROJECT_CONSTANTS__CORE_LIBRARY_NAMES.length; i++) {
if (qualifiedTypeName.startsWith(UICoreConstant.PROJECT_CONSTANTS__CORE_LIBRARY_NAMES[i])) {
isPrimitives = true;
stringBuffer.append(property.getType().getName());
break;
}
}
if (!isPrimitives) {
// stringBuffer.append(UICoreConstant.REPORT__OPEN_PARENTHESIS);
stringBuffer.append(MDDCommonUtil.getMappedName(qualifiedTypeName));
// stringBuffer.append(UICoreConstant.REPORT__CLOSE_PARENTHESIS);
}
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_TYPE, stringBuffer.toString());
} else {
setDataModel(attributeModel,
UICoreConstant.REPORT__ATTRIBUTE_TYPE,
UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING);
}
} else {
setDataModel(attributeModel,
UICoreConstant.REPORT__ATTRIBUTE_TYPE,
UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING);
}
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_DEFAULT_VALUE, property.getDefault());
attributeModelList.add(attributeModel);
}
}
// else {
// attributeModel = new DataModel();
// setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_NAME,
// UMLMessage.LABEL_NO_APPLICABLE);
//
// attributeModelList.add(attributeModel);
// }
return attributeModelList;
}
示例14: createAttributeDataModelList
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
*
*
* @param objClassifier
* @return Object
*/
private Object createAttributeDataModelList(Classifier objClassifier) {
List<DataModel> attributeModelList = new ArrayList<DataModel>();
DataModel attributeModel;
String qualifiedTypeName = UICoreConstant.EMPTY_STRING;
if (!objClassifier.getAttributes().isEmpty()) {
for (Property property : objClassifier.getAttributes()) {
attributeModel = new DataModel();
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_NAME, property.getName());
setDataModel(attributeModel,
UICoreConstant.REPORT__ATTRIBUTE_DOCUMENTATION,
applyPreference(getCommentToString(property.getOwnedComments())));
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_VISIBILITY, property.getVisibility()
.toString());
if (property.getType() != null) {
StringBuffer stringBuffer = new StringBuffer();
boolean isPrimitives = false;
qualifiedTypeName = property.getType().getQualifiedName();
if (null == qualifiedTypeName) {
stringBuffer.append(UICoreConstant.EMPTY_STRING);
} else {
for (int i = 0; i < UICoreConstant.PROJECT_CONSTANTS__CORE_LIBRARY_NAMES.length; i++) {
if (qualifiedTypeName.startsWith(UICoreConstant.PROJECT_CONSTANTS__CORE_LIBRARY_NAMES[i])) {
isPrimitives = true;
stringBuffer.append(property.getType().getName());
break;
}
}
if (!isPrimitives) {
// stringBuffer.append(UICoreConstant.REPORT__OPEN_PARENTHESIS);
stringBuffer.append(MDDCommonUtil.getMappedName(qualifiedTypeName));
// stringBuffer.append(UICoreConstant.REPORT__CLOSE_PARENTHESIS);
}
}
setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_TYPE, stringBuffer.toString());
} else {
setDataModel(attributeModel,
UICoreConstant.REPORT__ATTRIBUTE_TYPE,
UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING);
}
// 속성의 초기값이 없으면 'N/A' 출력
String defaultValue = property.getDefault();
if (defaultValue == null) {
defaultValue = UICoreConstant.EMPTY_STRING;
} else {
defaultValue = defaultValue.trim();
}
setDataModel(attributeModel,
UICoreConstant.REPORT__ATTRIBUTE_DEFAULT_VALUE,
applyPreferenceNA(defaultValue));
attributeModelList.add(attributeModel);
}
}
// else {
// attributeModel = new DataModel();
// setDataModel(attributeModel, UICoreConstant.REPORT__ATTRIBUTE_NAME,
// UMLMessage.LABEL_NO_APPLICABLE);
//
// attributeModelList.add(attributeModel);
// }
return attributeModelList;
}
示例15: setRelationType
import org.eclipse.uml2.uml.Property; //导入方法依赖的package包/类
/**
*
* void
*/
private void setRelationType() {
if (this.relation == null) {
return;
}
EList<Property> properties = this.association.getMemberEnds();
Property source = properties.get(0);
Property target = properties.get(1);
boolean bNavigable = true;
if (source.getType() instanceof Actor || source.getType() instanceof UseCase) {
if (0 == this.association.getNavigableOwnedEnds().size()
|| 2 == this.association.getNavigableOwnedEnds().size()) {
bNavigable = false;
}
} else {
if ((source.getType().equals(source.getOwner()) && target.getType().equals(target.getOwner()))
|| (!source.getType().equals(source.getOwner()) && !target.getType().equals(target.getOwner()))) {
bNavigable = false;
}
}
if (source.getAggregation().equals(AggregationKind.SHARED_LITERAL)
|| target.getAggregation().equals(AggregationKind.SHARED_LITERAL)) {
if (bNavigable) {
this.relation.setRelationType(RelationType.DIRECTED_AGGREGATION);
} else {
this.relation.setRelationType(RelationType.AGGREGATION);
}
} else if (source.getAggregation().equals(AggregationKind.NONE_LITERAL)
|| target.getAggregation().equals(AggregationKind.NONE_LITERAL)) {
if (bNavigable) {
this.relation.setRelationType(RelationType.DIRECTED_ASSOCIATION);
} else {
this.relation.setRelationType(RelationType.ASSOCIATION);
}
} else if (source.getAggregation().equals(AggregationKind.COMPOSITE_LITERAL)
|| target.getAggregation().equals(AggregationKind.COMPOSITE_LITERAL)) {
if (bNavigable) {
this.relation.setRelationType(RelationType.DIRECTED_COMPOSITION);
} else {
this.relation.setRelationType(RelationType.COMPOSITION);
}
}
}