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;
}
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();
}
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();
}
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;
}
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;
}
Aggregations