本文整理汇总了Java中org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart类的典型用法代码示例。如果您正苦于以下问题:Java GraphicalEditPart类的具体用法?Java GraphicalEditPart怎么用?Java GraphicalEditPart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphicalEditPart类属于org.eclipse.gmf.runtime.diagram.ui.editparts包,在下文中一共展示了GraphicalEditPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCompositeStateLayoutConstraint
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* Iterates through all {@link StateEditPart}s of the current selection and
* computes layout constraints for the composite node.
*
* @param compositeStateNode
* node of the composite state
*/
protected void setCompositeStateLayoutConstraint(Node compositeStateNode) {
Rectangle newbounds = null;
for (GraphicalEditPart editPart : getContextObjects()) {
Rectangle childBounds = editPart.getFigure().getBounds();
if (newbounds == null)
newbounds = childBounds.getCopy();
newbounds.union(childBounds);
}
newbounds.expand(new Insets(PADDING, PADDING, PADDING, PADDING));
Bounds bounds = NotationFactory.eINSTANCE.createBounds();
bounds.setX(newbounds.x);
bounds.setY(newbounds.y);
bounds.setWidth(newbounds.width);
bounds.setHeight(newbounds.height);
compositeStateNode.setLayoutConstraint(bounds);
}
示例2: hideConnectionLabelsForEditParts
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* Hides the labels on the connections of the given elements
*
* @param elements
* - The EditParts which's connection labels is to be hidden
* @param excluding
* - The types of connection labels which are not wanted to be
* hidden
*/
public static void hideConnectionLabelsForEditParts(List<GraphicalEditPart> elements,
List<java.lang.Class<?>> excluding) {
for (EditPart editpart : elements) {
GraphicalEditPart ep = ((GraphicalEditPart) editpart);
@SuppressWarnings("unchecked")
List<ConnectionNodeEditPart> connections = ep.getSourceConnections();
for (ConnectionNodeEditPart connection : connections) {
@SuppressWarnings("unchecked")
List<ConnectionNodeEditPart> labels = connection.getChildren();
for (EditPart label : labels) {
if (!isInstanceOfAny(label, excluding)) {
ShowHideLabelsRequest request = new ShowHideLabelsRequest(false, ((View) label.getModel()));
Command com = connection.getCommand(request);
if (com != null && com.canExecute())
com.execute();
}
}
}
}
}
示例3: arrangeChildren
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
@Override
protected void arrangeChildren(GraphicalEditPart state, IProgressMonitor monitor) throws ArrangeException{
assert state instanceof RoundedCompartmentEditPart;
boolean isCompositeState = false;
RegionCompartmentEditPart regionCompartement = getRegionCompatementEditPart((RoundedCompartmentEditPart)state);
if(regionCompartement != null){
@SuppressWarnings("unchecked")
List<GraphicalEditPart> editparts = regionCompartement.getChildren();
for(GraphicalEditPart ep : editparts){
if(isValidStateClass(ep)){
isCompositeState = true;
this.arrangeChildren(ep, monitor);
}
}
if(isCompositeState){
super.arrangeChildren(regionCompartement, monitor);
Dimension d = calculatePreferredSize(editparts);
DiagramElementsModifier.resizeGraphicalEditPart(state, d.width, d.height);
}
}
}
示例4: calculatePreferredSize
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
private Dimension calculatePreferredSize(List<? extends GraphicalEditPart> editparts){
FreeFormLayoutEx manager = (FreeFormLayoutEx) editparts.get(0).getFigure().getParent().getLayoutManager();
Point topLeft = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
Point bottomRight = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
for(GraphicalEditPart ep : editparts){
Rectangle constraint = (Rectangle) manager.getConstraint(ep.getFigure());
Dimension preferredSize = ep.getFigure().getPreferredSize();
constraint.width = constraint.width < preferredSize.width ? preferredSize.width : constraint.width;
constraint.height = constraint.height < preferredSize.height ? preferredSize.height : constraint.height;
topLeft.x = constraint.x < topLeft.x ? constraint.x : topLeft.x;
topLeft.y = constraint.y < topLeft.y ? constraint.y : topLeft.y;
bottomRight.x = constraint.getBottomRight().x > bottomRight.x ? constraint.getBottomRight().x : bottomRight.x;
bottomRight.y = constraint.getBottomRight().y > bottomRight.y ? constraint.getBottomRight().y : bottomRight.y;
}
return new Dimension(bottomRight.x-topLeft.x, bottomRight.y-topLeft.y);
}
示例5: createObjectRectangleMappingFromObjectsAndEditParts
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
private Map<GraphicalEditPart, hu.elte.txtuml.utils.diagrams.Rectangle> createObjectRectangleMappingFromObjectsAndEditParts(Set<RectangleObject> objects,
List<GraphicalEditPart> editParts) {
Map<GraphicalEditPart, hu.elte.txtuml.utils.diagrams.Rectangle> result = new HashMap<>();
for(RectangleObject obj : objects){
Optional<Element> e = txtUmlRegistry.findElement(obj.getName());
if(e.isPresent()){
GraphicalEditPart ep = (GraphicalEditPart) getEditPartOfModelElement(editParts, e.get());
if(ep != null){
hu.elte.txtuml.utils.diagrams.Rectangle rect = new hu.elte.txtuml.utils.diagrams.Rectangle(obj.getPosition().getX(), obj.getPosition().getY(),
obj.getPixelWidth(), obj.getPixelHeight());
result.put(ep, rect);
}
}
}
return result;
}
示例6: modifyConnectionEditParts
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
private void modifyConnectionEditParts(
Map<ConnectionNodeEditPart, List<hu.elte.txtuml.utils.diagrams.Point>> linksTransform,
Map<GraphicalEditPart, hu.elte.txtuml.utils.diagrams.Rectangle> objectTransform) {
linksTransform.forEach((ConnectionNodeEditPart connection, List<hu.elte.txtuml.utils.diagrams.Point> route) ->{
if(connection != null && route.size() >= 2){
hu.elte.txtuml.utils.diagrams.Rectangle source = objectTransform.get(connection.getSource());
hu.elte.txtuml.utils.diagrams.Rectangle target = objectTransform.get(connection.getTarget());
String anchor_start = getAnchor(source.getTopLeft(), route.get(0), source.width(), source.height());
String anchor_end = getAnchor(target.getTopLeft(), route.get(route.size()-1), target.width(), target.height());
DiagramElementsModifier.setConnectionAnchors(connection, anchor_start, anchor_end);
List<Point> gmfRoute = route.stream().map(p -> new Point(p.x(), p.y())).collect(Collectors.toList());
DiagramElementsModifier.setConnectionPoints(connection, gmfRoute);
}
});
}
示例7: calculatePreferredSize
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
private Dimension calculatePreferredSize(List<? extends GraphicalEditPart> editparts){
FreeFormLayoutEx manager = (FreeFormLayoutEx) editparts.get(0).getFigure().getParent().getLayoutManager();
Point topLeft = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
Point bottomRight = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
for(GraphicalEditPart ep : editparts){
Rectangle constraint = (Rectangle) manager.getConstraint(ep.getFigure());
Dimension preferredSize = ep.getFigure().getPreferredSize();
constraint.width = constraint.width < preferredSize.width ? preferredSize.width : constraint.width;
constraint.height = constraint.height < preferredSize.height ? preferredSize.height : constraint.height;
topLeft.x = constraint.x < topLeft.x ? constraint.x : topLeft.x;
topLeft.y = constraint.y < topLeft.y ? constraint.y : topLeft.y;
bottomRight.x = constraint.getBottomRight().x > bottomRight.x ? constraint.getBottomRight().x : bottomRight.x;
bottomRight.y = constraint.getBottomRight().y > bottomRight.y ? constraint.getBottomRight().y : bottomRight.y;
}
return new Dimension(bottomRight.x, bottomRight.y);
}
示例8: arrange_and_resize_recursively
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* Calls an {@link AbstractDiagramElementsGmfArranger#autoresizeGraphicalEditPart(GraphicalEditPart) autosize}
* and {@link AbstractDiagramElementsGmfArranger#arrangeChildren(EditPart) arrangeChildren}
* on the given statemachine.
* The method is called recursively for all children which are {@link StateEditPart}s
* @param stateEP - The StateEditPart
*/
private void arrange_and_resize_recursively(GraphicalEditPart stateEP) {
@SuppressWarnings("unchecked")
List<GraphicalEditPart> stateCompartements = stateEP.getChildren();
@SuppressWarnings("unchecked")
List<GraphicalEditPart> regions = ((EditPart) stateCompartements.get(1)).getChildren();
for(GraphicalEditPart region: regions){
GraphicalEditPart regioncompartement = (GraphicalEditPart) region.getChildren().get(0);
@SuppressWarnings("unchecked")
List<EditPart> listEp = regioncompartement.getChildren();
for(EditPart Ep : listEp){
if(Ep instanceof StateEditPart){
arrange_and_resize_recursively((StateEditPart) Ep);
}
}
super.autoresizeGraphicalEditPart(stateEP);
super.arrangeChildren(regioncompartement);
}
}
示例9: arrange_recurively
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* Calls an {@link AbstractDiagramElementsGmfArranger#arrangeChildren(EditPart) arrangeChildren}
* and a hideConnectionLabels on the children of the given GraphicalEditPart
* @param stateEP - The GraphicalEditPart
*/
private void arrange_recurively(GraphicalEditPart stateEP) {
@SuppressWarnings("unchecked")
List<GraphicalEditPart> stateCompartements = stateEP.getChildren();
@SuppressWarnings("unchecked")
List<GraphicalEditPart> regions = ((EditPart) stateCompartements.get(1)).getChildren();
for(GraphicalEditPart region: regions){
GraphicalEditPart regioncompartement = (GraphicalEditPart) region.getChildren().get(0);
@SuppressWarnings("unchecked")
List<GraphicalEditPart> listEp = regioncompartement.getChildren();
for(GraphicalEditPart Ep : listEp){
if(Ep instanceof StateEditPart){
arrange_recurively(Ep);
}
}
super.arrangeChildren(regioncompartement);
DiagramElementsModifier.hideConnectionLabelsForEditParts(listEp, Arrays.asList(CustomTransitionGuardEditPart.class));
}
}
示例10: createDecorators
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget
.getAdapter(EditPart.class);
if (editPart instanceof GraphicalEditPart
|| editPart instanceof AbstractConnectionEditPart) {
Object model = editPart.getModel();
if ((model instanceof View)) {
View view = (View) model;
if (!(view instanceof Edge) && !view.isSetElement()) {
return;
}
}
EditDomain ed = editPart.getViewer().getEditDomain();
if (!(ed instanceof DiagramEditDomain)) {
return;
}
if (((DiagramEditDomain) ed).getEditorPart() instanceof SimpleBPMN.diagram.part.SimpleBPMNDiagramEditor) {
decoratorTarget.installDecorator(KEY, new StatusDecorator(
decoratorTarget));
}
}
}
示例11: createDecorators
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
Object model = editPart.getModel();
if ((model instanceof View)) {
View view = (View) model;
if (!(view instanceof Edge) && !view.isSetElement()) {
return;
}
}
EditDomain ed = editPart.getViewer().getEditDomain();
if (!(ed instanceof DiagramEditDomain)) {
return;
}
if (((DiagramEditDomain) ed)
.getEditorPart() instanceof edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.part.ICSE15_SequenceDiagram_MAVODiagramEditor) {
decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
}
}
}
示例12: createDecorators
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget
.getAdapter(EditPart.class);
if (editPart instanceof GraphicalEditPart
|| editPart instanceof AbstractConnectionEditPart) {
Object model = editPart.getModel();
if ((model instanceof View)) {
View view = (View) model;
if (!(view instanceof Edge) && !view.isSetElement()) {
return;
}
}
EditDomain ed = editPart.getViewer().getEditDomain();
if (!(ed instanceof DiagramEditDomain)) {
return;
}
if (((DiagramEditDomain) ed).getEditorPart() instanceof edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part.NECSIS14_ClassDiagramDiagramEditor) {
decoratorTarget.installDecorator(KEY, new StatusDecorator(
decoratorTarget));
}
}
}
示例13: createDecorators
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget
.getAdapter(EditPart.class);
if (editPart instanceof GraphicalEditPart
|| editPart instanceof AbstractConnectionEditPart) {
Object model = editPart.getModel();
if ((model instanceof View)) {
View view = (View) model;
if (!(view instanceof Edge) && !view.isSetElement()) {
return;
}
}
EditDomain ed = editPart.getViewer().getEditDomain();
if (!(ed instanceof DiagramEditDomain)) {
return;
}
if (((DiagramEditDomain) ed).getEditorPart() instanceof edu.toronto.cs.se.modelepedia.necsis14_databaseschema.diagram.part.NECSIS14_DatabaseSchemaDiagramEditor) {
decoratorTarget.installDecorator(KEY, new StatusDecorator(
decoratorTarget));
}
}
}
示例14: createDecorators
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
Object model = editPart.getModel();
if ((model instanceof View)) {
View view = (View) model;
if (!(view instanceof Edge) && !view.isSetElement()) {
return;
}
}
EditDomain ed = editPart.getViewer().getEditDomain();
if (!(ed instanceof DiagramEditDomain)) {
return;
}
if (((DiagramEditDomain) ed).getEditorPart() instanceof MIDDiagramEditor) {
decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
}
}
}
示例15: createDecorators
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; //导入依赖的package包/类
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
Object model = editPart.getModel();
if ((model instanceof View)) {
View view = (View) model;
if (!(view instanceof Edge) && !view.isSetElement()) {
return;
}
}
EditDomain ed = editPart.getViewer().getEditDomain();
if (!(ed instanceof DiagramEditDomain)) {
return;
}
if (((DiagramEditDomain) ed).getEditorPart() instanceof MIDDiagramEditor) {
decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
}
}
}