本文整理汇总了Java中org.eclipse.uml2.uml.Generalization类的典型用法代码示例。如果您正苦于以下问题:Java Generalization类的具体用法?Java Generalization怎么用?Java Generalization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Generalization类属于org.eclipse.uml2.uml包,在下文中一共展示了Generalization类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectionChanged
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
* org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
objList.clear();
objList = ProjectUtil.getSelectedEObjects(selection);
if (objList == null || objList.size() < 1) {
return;
}
for (EObject eobject : objList) {
if (eobject instanceof Lifeline || eobject instanceof Abstraction || eobject instanceof Association
|| eobject instanceof BehaviorExecutionSpecification || eobject instanceof CombinedFragment
|| eobject instanceof Comment || eobject instanceof Connector || eobject instanceof ControlFlow
|| eobject instanceof Dependency || eobject instanceof ExecutionEvent
|| eobject instanceof ExecutionOccurrenceSpecification || eobject instanceof Extend
|| eobject instanceof Generalization || eobject instanceof Include
|| eobject instanceof InteractionOperand || eobject instanceof InterfaceRealization
|| eobject instanceof Message || eobject instanceof MessageOccurrenceSpecification
|| eobject instanceof ObjectFlow || eobject instanceof Realization
|| eobject instanceof ReceiveOperationEvent || eobject instanceof SendOperationEvent
|| eobject instanceof Usage) {
objList.clear();
return;
}
}
}
示例2: createClass
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
private Class createClass(Package pkg, FHIMInformationModel.Class classModel) {
Class clazz = modelClassMap.get(classModel);
LOG.debug("Class: " + clazz.getName());
// Attributes.
for (Attribute attributeModel : classModel.getAttributes()) {
getProperty(clazz, attributeModel);
}
// Generalizations.
for (FHIMInformationModel.Generalization generalizationModel : classModel.getGeneralizations()) {
createGeneralization(clazz, generalizationModel);
}
return clazz;
}
示例3: createGeneralization
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
private Generalization createGeneralization(Class clazz,
FHIMInformationModel.Generalization generalizationModel) {
FHIMInformationModel.Type typeModel = generalizationModel.getTarget();
Type type = getTypeForModel(typeModel);
// Expect type to be an instance of Class.
if (type instanceof Class) {
Class general = (Class) type;
LOG.debug("Generalization: " + general.getName());
return clazz.createGeneralization(general);
}
// Something wrong!
throw new IllegalArgumentException("Unexpected type: " + type);
}
示例4: buildClassModel
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
private FHIMInformationModel.Class buildClassModel(Class clazz) {
String name = clazz.getName();
LOG.debug("Class: " + name);
FHIMInformationModel.Class classModel = nameClassMap.get(name);
// Generalizations.
EList<Generalization> generalizations = clazz.getGeneralizations();
for (Generalization generalization : generalizations) {
FHIMInformationModel.Generalization generalizationModel = createGeneralizationModel(generalization);
classModel.addGeneralization(generalizationModel);
}
// Attributes.
EList<Property> attributes = clazz.getOwnedAttributes();
for (Property attribute : attributes) {
FHIMInformationModel.Attribute attributeModel = getAttributeModel(attribute);
classModel.addAttribute(attributeModel);
}
return classModel;
}
示例5: basicRenderObject
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
@Override
protected boolean basicRenderObject(Generalization element, IndentedPrintWriter pw, IRenderingSession context) {
if (!shouldRender(context, element.getSpecific(), element.getGeneral()))
return true;
context.render(element.getGeneral(), element.getGeneral().eResource() != element.eResource());
pw.print("edge ");
// if (element.getName() != null)
// pw.print("\"" + element.getName() + "\" ");
pw.println("[");
pw.enterLevel();
pw.println("arrowtail = \"empty\"");
pw.println("arrowhead = \"none\"");
pw.println("taillabel = \"\"");
pw.println("headlabel = \"\"");
DOTRenderingUtils.addAttribute(pw, "constraint", "true");
DOTRenderingUtils.addAttribute(pw, "style", "none");
pw.exitLevel();
pw.println("]");
pw.println("\"" + element.getGeneral().getName() + "\":port" + " -- \"" + element.getSpecific().getName()
+ "\":port");
return true;
}
示例6: renderObject
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
public boolean renderObject(DataType dataType, IndentedPrintWriter writer, IRenderingSession context) {
RenderingUtils.renderAll(context, ElementUtils.getComments(dataType));
TextUMLRenderingUtils.renderStereotypeApplications(writer, dataType);
if (dataType.isAbstract())
writer.print("abstract ");
writer.print("datatype " + name(dataType));
List<Generalization> generalizations = dataType.getGeneralizations();
StringBuilder specializationList = new StringBuilder();
for (Generalization generalization : generalizations)
specializationList.append(TextUMLRenderingUtils.getQualifiedNameIfNeeded(generalization.getGeneral(),
dataType.getNamespace()) + ", ");
if (specializationList.length() > 0) {
specializationList.delete(specializationList.length() - 2, specializationList.length());
writer.print(" specializes ");
writer.print(specializationList);
}
writer.println();
writer.enterLevel();
RenderingUtils.renderAll(context, dataType.getOwnedAttributes());
RenderingUtils.renderAll(context, dataType.getOwnedOperations());
writer.exitLevel();
writer.println("end;");
writer.println();
return true;
}
示例7: renderObject
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
public boolean renderObject(Interface interface_, IndentedPrintWriter writer, IRenderingSession context) {
RenderingUtils.renderAll(context, ElementUtils.getComments(interface_));
TextUMLRenderingUtils.renderStereotypeApplications(writer, interface_);
writer.print("interface " + name(interface_));
List<Generalization> generalizations = interface_.getGeneralizations();
StringBuilder specializationList = new StringBuilder();
for (Generalization generalization : generalizations)
specializationList.append(TextUMLRenderingUtils.getQualifiedNameIfNeeded(generalization.getGeneral(),
interface_.getNamespace()) + ", ");
if (specializationList.length() > 0) {
specializationList.delete(specializationList.length() - 2, specializationList.length());
writer.print(" specializes ");
writer.print(specializationList);
}
writer.println();
writer.enterLevel();
RenderingUtils.renderAll(context, interface_.getOwnedAttributes());
RenderingUtils.renderAll(context, interface_.getOwnedOperations());
RenderingUtils.renderAll(context, interface_.getClientDependencies());
writer.exitLevel();
writer.println("end;");
writer.println();
return true;
}
示例8: findProperty
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
public static Property findProperty(Classifier classifier, String attributeIdentifier, boolean ignoreCase,
boolean recurse, EClass propertyClass) {
Property found = classifier.getAttribute(attributeIdentifier, null, ignoreCase, propertyClass);
if (found != null || !recurse)
return found;
final EList<TemplateBinding> templateBindings = classifier.getTemplateBindings();
if (!templateBindings.isEmpty()) {
for (TemplateBinding templateBinding : templateBindings) {
TemplateSignature signature = templateBinding.getSignature();
found = findProperty((Classifier) signature.getTemplate(), attributeIdentifier, ignoreCase, true,
propertyClass);
if (found != null)
return found;
}
}
for (Generalization generalization : classifier.getGeneralizations())
if ((found = findProperty(generalization.getGeneral(), attributeIdentifier, ignoreCase, true, propertyClass)) != null)
return found;
return null;
}
示例9: createContentsIfNecessary
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
private void createContentsIfNecessary(final View theElementView) {
final EObject theElement = theElementView.getElement();
final EList<Property> ownedAttributes = asEList(getOwnedAttributes(theElement));
if (!ownedAttributes.isEmpty()) {
final View theOwnedAttributeCompartment = getTheAttributeCompartment(theElementView);
for (final Property p : ownedAttributes) {
getOrCreateTheView(p, theOwnedAttributeCompartment);
}
@SuppressWarnings("unchecked")
final EList<View> attributeViews = theOwnedAttributeCompartment.getPersistedChildren();
ECollections.sort(attributeViews, new Comparator<View>() {
@Override
public int compare(final View left, final View right) {
return Integer.compare(indexOf(ownedAttributes, left.getElement(), 0),
indexOf(ownedAttributes, right.getElement(), 0));
}
});
}
for (final Generalization g : getGeneralizations(theElement)) {
getOrCreateTheView(g, theElementView.getDiagram());
}
}
示例10: longTest
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
@Test
public void longTest() {
Model model = UMLFactory.eINSTANCE.createModel();
model.setName("myUmlModel");
Interface it1 = UMLFactory.eINSTANCE.createInterface();
it1.setName("it1");
model.getPackagedElements().add(it1);
Interface it2 = UMLFactory.eINSTANCE.createInterface();
it2.setName("it2");
model.getPackagedElements().add(it2);
Generalization gen = UMLFactory.eINSTANCE.createGeneralization();
gen.setGeneral(it2);
it2.getGeneralizations().add(gen);
Interface it3 = UMLFactory.eINSTANCE.createInterface();
it3.setName("it3");
model.getPackagedElements().add(it3);
gen.setGeneral(it3);
Operation op = UMLFactory.eINSTANCE.createOperation();
op.setName("op1");
it3.getOwnedOperations().add(op);
Parameter parameter = UMLFactory.eINSTANCE.createParameter();
parameter.setName("par1");
parameter.setDirection(ParameterDirectionKind.RETURN_LITERAL);
parameter.setType(it1);
op.getOwnedParameters().add(parameter);
assertEquals(1, it2.getAllOperations().size());
}
示例11: checkRelationTarget
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
* relation의 source와 target이 같은지 검사
*
* @param relationship
* @param sourceElement
* @param targetElement
* @return boolean
*/
private static boolean checkRelationTarget(Relationship relationship, NamedElement targetElement) {
if (relationship instanceof Dependency) {
Dependency dependency = (Dependency) relationship;
EList<NamedElement> suppliers = dependency.getSuppliers();
for (NamedElement element : suppliers) {
if (targetElement.equals(element)) {
return true;
}
}
} else if (relationship instanceof Generalization) {
Generalization generalization = (Generalization) relationship;
if (targetElement.equals(generalization.getGeneral())) {
return true;
}
} else if (relationship instanceof Association) {
Association association = (Association) relationship;
EList<Type> endTypes = association.getEndTypes();
for (Type type : endTypes) {
if (targetElement.equals(type)) {
return true;
}
}
}
return false;
}
示例12: deleteDirectedAttributes
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.manager.command.DeleteUMLDirectedRelationshipCommand#deleteDirectedAttributes()
*/
@Override
protected void deleteDirectedAttributes() {
Generalization generalization = (Generalization) this.targetElement;
this.source = generalization.getSources().get(0);
((Classifier) this.source).getGeneralizations().remove(generalization);
}
示例13: restoreDirectedAttributes
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.manager.command.DeleteUMLDirectedRelationshipCommand#restoreDirectedAttributes()
*/
@Override
protected void restoreDirectedAttributes() {
Generalization generalization = (Generalization) this.targetElement;
this.source = generalization.getSources().get(0);
((Classifier) this.source).getGeneralizations().add(generalization);
}
示例14: getCommand
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
* getCommand
*
* @param selectedElement
* @return Command
*/
public static Command getCommand(Element selectedElement) {
if (null == selectedElement.eContainer()) {
return null;
}
Command deleteCommand = null;
if (selectedElement instanceof Diagram) {
deleteCommand = new DeleteUMLDiagramCommand((Diagram) selectedElement);
} else if (selectedElement instanceof Association) {
deleteCommand = new DeleteUMLAssociationCommand((Association) selectedElement);
} else if (selectedElement instanceof Dependency) {
deleteCommand = new DeleteUMLDependencyCommand(selectedElement);
} else if (selectedElement instanceof Include) {
deleteCommand = new DeleteUMLIncludeCommand(selectedElement);
} else if (selectedElement instanceof Extend) {
deleteCommand = new DeleteUMLExtendCommand(selectedElement);
} else if (selectedElement instanceof Generalization) {
deleteCommand = new DeleteUMLGeneralizationCommand(selectedElement);
} else if (selectedElement instanceof InterfaceRealization) {
deleteCommand = new DeleteUMLInterfaceRealizationCommand(selectedElement);
} else if (selectedElement instanceof Realization) {
deleteCommand = new DeleteUMLRealizationCommand(selectedElement);
} else if (selectedElement instanceof Property) {
deleteCommand = new DeleteUMLPropertyCommand((Property) selectedElement);
} else if (selectedElement instanceof ActivityEdge) {
deleteCommand = new DeleteUMLActivityEdgeCommand((ActivityEdge) selectedElement);
} else if (selectedElement instanceof ActivityNode) {
deleteCommand = new DeleteUMLActivityNodeCommand((ActivityNode) selectedElement);
} else if ((selectedElement instanceof Lifeline) || (selectedElement instanceof Message)) {
deleteCommand = new DeleteUMLSequenceElementCommand((NamedElement)selectedElement);
} else if (selectedElement instanceof NamedElement) {
deleteCommand = new DeleteUMLPackageableElementCommand((NamedElement) selectedElement);
}//
return deleteCommand;
}
示例15: getModelChildren
import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
*/
@Override
public List<EObject> getModelChildren() {
List<EObject> list = new ArrayList<EObject>();
list.addAll(((Diagram) getModel()).getNodeList());
List<AbstractConnection> connectionList = new ArrayList<AbstractConnection>();
connectionList = ((Diagram) getModel()).getConnectionList();
if (connectionList.size() != 0) {
for (AbstractConnection connection : connectionList) {
if ((connection).getUmlModel() instanceof Association) {
list.addAll(connection.getLabels());
}
// else if( (connection).getUmlModel() instanceof Generalization
// || (connection).getUmlModel() instanceof Message
// || (connection).getUmlModel() instanceof ControlFlow ||
// (connection).getUmlModel() instanceof ObjectFlow ||
// connection instanceof Attachement){
// continue;
// }
else if ((connection).getUmlModel() instanceof Generalization
|| (connection).getUmlModel() instanceof Message || connection instanceof Attachement) {
continue;
} else
list.addAll(connection.getLabels());
}
}
return list;
}