本文整理汇总了Java中org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart类的典型用法代码示例。如果您正苦于以下问题:Java ClassEditPart类的具体用法?Java ClassEditPart怎么用?Java ClassEditPart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassEditPart类属于org.eclipse.papyrus.uml.diagram.clazz.edit.parts包,在下文中一共展示了ClassEditPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: moveGraphicalEditPartTest
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* Test for moveGraphicalEditPart
*/
@Test
public void moveGraphicalEditPartTest() {
List<Pair<String, Class<?>>> objects = Arrays
.asList(new Pair<String, Class<?>>("ClassA",
org.eclipse.uml2.uml.Class.class));
init(objects, Arrays.asList());
@SuppressWarnings("unchecked")
List<EditPart> eps = getDiagramEditPart().getChildren();
ClassEditPart classEp = (ClassEditPart) eps.get(0);
int new_x = 250;
int new_y = 150;
DiagramElementsModifier.moveGraphicalEditPart(classEp, new Point(new_x,
new_y));
Assert.assertTrue(classEp.getModel() instanceof CSSShapeImpl);
LayoutConstraint layoutConstraint = ((CSSShapeImpl) classEp.getModel())
.getLayoutConstraint();
Assert.assertTrue(layoutConstraint instanceof BoundsImpl);
Assert.assertEquals(new_x, ((BoundsImpl) layoutConstraint).getX());
Assert.assertEquals(new_y, ((BoundsImpl) layoutConstraint).getY());
}
示例2: setConnectionBendpointsTest
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* Test for setConnectionBendpoints
*/
@Test
public void setConnectionBendpointsTest() {
Pair<String, Class<?>> A = new Pair<String, Class<?>>("ClassA",
org.eclipse.uml2.uml.Class.class);
Pair<String, Class<?>> B = new Pair<String, Class<?>>("ClassB",
org.eclipse.uml2.uml.Class.class);
List<Pair<String, Class<?>>> objects = Arrays.asList(A, B);
List<Pair<Pair<String, Class<?>>, Pair<String, Class<?>>>> associations = Arrays
.asList(new Pair<Pair<String, Class<?>>, Pair<String, Class<?>>>(
A, B));
init(objects, associations);
@SuppressWarnings("unchecked")
List<EditPart> eps = getDiagramEditPart().getChildren();
ClassEditPart classAEp = (ClassEditPart) eps.get(0);
@SuppressWarnings("unchecked")
List<ConnectionEditPart> conns = classAEp.getTargetConnections();
ConnectionEditPart assoc = conns.get(0);
List<Point> bendpointslist = Arrays.asList(new Point(10, 10),
new Point(150, 200), new Point(400, 300));
DiagramElementsModifier.setConnectionPoints(assoc, bendpointslist);
}
示例3: addElementsToDiagram
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
@Override
public void addElementsToDiagram(List<Element> elements){
List<Element> diagramelements = UMLModelManager.getElementsOfTypesFromList(elements, elementsToBeAdded);
List<Element> diagramconnections = UMLModelManager.getElementsOfTypesFromList(elements, connectorsToBeAdded);
ClassDiagramElementsController.addElementsToClassDiagram((ModelEditPart) diagramEditPart, diagramelements);
ClassDiagramElementsController.addElementsToClassDiagram((ModelEditPart) diagramEditPart, diagramconnections);
@SuppressWarnings("unchecked")
List<EditPart> editParts = diagramEditPart.getChildren();
for(EditPart editPart : editParts){
if(editPart instanceof ClassEditPart || editPart instanceof InterfaceEditPart){
addSubElements(editPart);
}
}
}
示例4: resizeGraphicalEditPartTest
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* Test for resizeGraphicalEditPart
*/
@Test
public void resizeGraphicalEditPartTest() {
List<Pair<String, Class<?>>> objects = Arrays
.asList(new Pair<String, Class<?>>("ClassB",
org.eclipse.uml2.uml.Class.class));
init(objects, Arrays.asList());
@SuppressWarnings("unchecked")
List<EditPart> eps = getDiagramEditPart().getChildren();
ClassEditPart classEp = (ClassEditPart) eps.get(0);
int new_width = 200;
int new_height = 600;
DiagramElementsModifier.resizeGraphicalEditPart(classEp, new_width,
new_height);
Assert.assertTrue(classEp.getModel() instanceof CSSShapeImpl);
LayoutConstraint layoutConstraint = ((CSSShapeImpl) classEp.getModel())
.getLayoutConstraint();
Assert.assertTrue(layoutConstraint instanceof BoundsImpl);
Assert.assertEquals(new_width,
((BoundsImpl) layoutConstraint).getWidth());
Assert.assertEquals(new_height,
((BoundsImpl) layoutConstraint).getHeight());
}
示例5: setConnectionAnchorsTest
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* Test for setConnectionAnchors
*/
@Test
public void setConnectionAnchorsTest() {
Pair<String, Class<?>> A = new Pair<String, Class<?>>("ClassA",
org.eclipse.uml2.uml.Class.class);
Pair<String, Class<?>> B = new Pair<String, Class<?>>("ClassB",
org.eclipse.uml2.uml.Class.class);
List<Pair<String, Class<?>>> objects = Arrays.asList(A, B);
List<Pair<Pair<String, Class<?>>, Pair<String, Class<?>>>> associations = Arrays
.asList(new Pair<Pair<String, Class<?>>, Pair<String, Class<?>>>(
A, B));
init(objects, associations);
@SuppressWarnings("unchecked")
List<EditPart> eps = getDiagramEditPart().getChildren();
ClassEditPart classAEp = (ClassEditPart) eps.get(0);
ClassEditPart classBEp = (ClassEditPart) eps.get(1);
@SuppressWarnings("unchecked")
List<ConnectionEditPart> conns = classBEp.getSourceConnections();
ConnectionEditPart assoc = conns.get(0);
DiagramElementsModifier.setConnectionAnchors(assoc, "(1, 0.5)",
"(0, 0.5)");
ConnectionAnchor source = classAEp.getSourceConnectionAnchor(assoc);
ConnectionAnchor target = classBEp.getTargetConnectionAnchor(assoc);
Point sourceReferencePoint = ((SlidableAnchor) source)
.getReferencePoint();
Point targetReferencePoint = ((SlidableAnchor) target)
.getReferencePoint();
PrecisionPoint sourceAnchor = SlidableAnchor.getAnchorRelativeLocation(
sourceReferencePoint, source.getOwner().getBounds());
PrecisionPoint targetAnchor = SlidableAnchor.getAnchorRelativeLocation(
targetReferencePoint, target.getOwner().getBounds());
Assert.assertEquals(new PrecisionPoint(1, 0.5), sourceAnchor);
Assert.assertEquals(new PrecisionPoint(0, 0.5), targetAnchor);
}
示例6: addPropertyToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param property
*/
public static void addPropertyToClass(ClassEditPart classEditPart, Property property){
EditPart ep = getClassAttributeEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementToEditPart(ep, property);
}
}
示例7: addPropertiesToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param properties
*/
public static void addPropertiesToClass(ClassEditPart classEditPart,Collection<Property> properties){
EditPart ep = getClassAttributeEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementsToEditPart(ep, properties);
}
}
示例8: addPortToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param port
*/
public static void addPortToClass(ClassEditPart classEditPart, Port port){
EditPart ep = getClassAttributeEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementToEditPart(ep, port);
}
}
示例9: addPortsToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param ports
*/
public static void addPortsToClass(ClassEditPart classEditPart,Collection<Port> ports){
EditPart ep = getClassAttributeEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementsToEditPart(ep, ports);
}
}
示例10: addExtensionEndToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param extensionEnd
*/
public static void addExtensionEndToClass(ClassEditPart classEditPart, ExtensionEnd extensionEnd){
EditPart ep = getClassAttributeEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementToEditPart(ep, extensionEnd);
}
}
示例11: addExtensionEndsToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param extensionEnds
*/
public static void addExtensionEndsToClass(ClassEditPart classEditPart,Collection<ExtensionEnd> extensionEnds){
EditPart ep = getClassAttributeEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementsToEditPart(ep, extensionEnds);
}
}
示例12: addOperationToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param operation
*/
public static void addOperationToClass(ClassEditPart classEditPart, Operation operation){
EditPart ep = getClassOperationEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementToEditPart(ep, operation);
}
}
示例13: addOperationsToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param operations
*/
public static void addOperationsToClass(ClassEditPart classEditPart, Collection<Operation> operations){
EditPart ep = getClassOperationEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementsToEditPart(ep, operations);
}
}
示例14: addReceptionToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param reception
*/
public static void addReceptionToClass(ClassEditPart classEditPart, Reception reception){
EditPart ep = getClassOperationEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementToEditPart(ep, reception);
}
}
示例15: addReceptionsToClass
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; //导入依赖的package包/类
/**
* @param classEditPart
* @param receptions
*/
public static void addReceptionsToClass(ClassEditPart classEditPart, Collection<Reception> receptions){
EditPart ep = getClassOperationEditPart(classEditPart);
if(ep != null) {
ElementsManagerUtils.addElementsToEditPart(ep, receptions);
}
}