Search in sources :

Example 6 with IGraphicalEntityPart

use of org.whole.lang.ui.editparts.IGraphicalEntityPart in project whole by wholeplatform.

the class HandlersBehavior method canCopyAsImage.

public static boolean canCopyAsImage(IBindingManager bm) {
    if (!isValidFocusEntityPart(bm))
        return false;
    IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
    IEntity focusEntity = bm.wGet("focusEntity");
    return viewer.getEditPartRegistry().get(focusEntity) instanceof IGraphicalEntityPart;
}
Also used : IEntity(org.whole.lang.model.IEntity) IGraphicalEntityPart(org.whole.lang.ui.editparts.IGraphicalEntityPart) IEntityPartViewer(org.whole.lang.ui.viewers.IEntityPartViewer)

Example 7 with IGraphicalEntityPart

use of org.whole.lang.ui.editparts.IGraphicalEntityPart in project whole by wholeplatform.

the class HandlersBehavior method canSelectAll.

public static boolean canSelectAll(IBindingManager bm) {
    IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
    IEntity entityContents = viewer.getEntityContents();
    IGraphicalEntityPart contents = (IGraphicalEntityPart) viewer.getEditPartRegistry().get(entityContents);
    return ((IEntityFigure) contents.getFigure()).isInteractiveEdit();
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) IEntity(org.whole.lang.model.IEntity) IGraphicalEntityPart(org.whole.lang.ui.editparts.IGraphicalEntityPart) IEntityPartViewer(org.whole.lang.ui.viewers.IEntityPartViewer)

Example 8 with IGraphicalEntityPart

use of org.whole.lang.ui.editparts.IGraphicalEntityPart in project whole by wholeplatform.

the class WholeFreeformLayoutEditPolicy method getCompoundConstrainedCompositeAddCommand.

protected Command getCompoundConstrainedCompositeAddCommand(ChangeBoundsRequest request) {
    CompoundCommand command = new CompoundCommand();
    for (Object editPart : request.getEditParts()) {
        Rectangle constraint = (Rectangle) getConstraintFor(request);
        IGraphicalEntityPart entityPart = (IGraphicalEntityPart) editPart;
        IEntity newEntity = EntityUtils.clone(entityPart.getModelEntity());
        command.add(getConstrainedCompositeAddCommand(newEntity, constraint));
    }
    return command.unwrap();
}
Also used : IEntity(org.whole.lang.model.IEntity) Rectangle(org.eclipse.draw2d.geometry.Rectangle) IGraphicalEntityPart(org.whole.lang.ui.editparts.IGraphicalEntityPart) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Example 9 with IGraphicalEntityPart

use of org.whole.lang.ui.editparts.IGraphicalEntityPart in project whole by wholeplatform.

the class WholeNonResizableEditPolicy method createDragSourceFeedbackFigure.

@Override
protected IFigure createDragSourceFeedbackFigure() {
    IFigure figure = new FeedbackImageFigure(createFeedbackImage((IGraphicalEntityPart) getHost(), FeedbackImageFigure.ALPHA, true, FitToScreenStrategy.instance()));
    figure.setBounds(getInitialFeedbackBounds());
    addFeedback(figure);
    return figure;
}
Also used : IGraphicalEntityPart(org.whole.lang.ui.editparts.IGraphicalEntityPart) IFigure(org.eclipse.draw2d.IFigure)

Example 10 with IGraphicalEntityPart

use of org.whole.lang.ui.editparts.IGraphicalEntityPart in project whole by wholeplatform.

the class WholeResizableEditPolicy method createDragSourceFeedbackFigure.

@Override
protected IFigure createDragSourceFeedbackFigure() {
    IFigure figure = new FeedbackImageFigure(WholeNonResizableEditPolicy.createFeedbackImage((IGraphicalEntityPart) getHost(), FeedbackImageFigure.ALPHA, true, FitToScreenStrategy.instance())) {

        @Override
        protected void paintFigure(Graphics graphics) {
            Rectangle area = getClientArea();
            org.eclipse.swt.graphics.Rectangle imageBounds = getImage().getBounds();
            // graphics.drawImage(getImage(), area.x + ix, area.y + iy);
            graphics.drawImage(getImage(), 0, 0, imageBounds.width, imageBounds.height, area.x, area.y, Math.max(0, area.width), Math.max(0, area.height));
        }
    };
    figure.setBounds(getInitialFeedbackBounds());
    addFeedback(figure);
    return figure;
}
Also used : Graphics(org.eclipse.draw2d.Graphics) FeedbackImageFigure(org.whole.lang.ui.editpolicies.WholeNonResizableEditPolicy.FeedbackImageFigure) IGraphicalEntityPart(org.whole.lang.ui.editparts.IGraphicalEntityPart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IGraphicalEntityPart (org.whole.lang.ui.editparts.IGraphicalEntityPart)14 IFigure (org.eclipse.draw2d.IFigure)5 Rectangle (org.eclipse.draw2d.geometry.Rectangle)5 LinkedList (java.util.LinkedList)4 IEntity (org.whole.lang.model.IEntity)4 Point (org.eclipse.draw2d.geometry.Point)3 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)3 EditPart (org.eclipse.gef.EditPart)2 ITextualEntityPart (org.whole.lang.ui.editparts.ITextualEntityPart)2 IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)2 EditPoint (org.whole.lang.ui.tools.EditPoint)2 List (java.util.List)1 ListIterator (java.util.ListIterator)1 Collectors (java.util.stream.Collectors)1 Graphics (org.eclipse.draw2d.Graphics)1 PositionConstants (org.eclipse.draw2d.PositionConstants)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 ConnectionEditPart (org.eclipse.gef.ConnectionEditPart)1 EditPartViewer (org.eclipse.gef.EditPartViewer)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1