本文整理汇总了Java中org.eclipse.gef.requests.DropRequest类的典型用法代码示例。如果您正苦于以下问题:Java DropRequest类的具体用法?Java DropRequest怎么用?Java DropRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DropRequest类属于org.eclipse.gef.requests包,在下文中一共展示了DropRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAddCommand
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected Command getAddCommand(Request generic) {
ChangeBoundsRequest request = (ChangeBoundsRequest) generic;
if (acceptReorder(request)){
List<EditPart> editParts = request.getEditParts();
ElementEditPart movedElement = (ElementEditPart)editParts.get(0);
Container parent = (Container) getHost().getParent().getModel();
int siblingIndex = parent.getChildren().indexOf(getHost().getModel());
int currentIndex = parent.getChildren().indexOf(movedElement.getModel());
if (siblingIndex >= 0){
if (isInsertAfter((DropRequest) request)) siblingIndex++;
if (currentIndex <= siblingIndex) siblingIndex--;
/*MoveChildCommand command = new MoveChildCommand(
movedElement.getModel(), siblingIndex);*/
AddCommand command = new AddCommand();
command.setParent(parent);
command.setChild(movedElement.getModel());
command.setIndex(siblingIndex);
return command;
}
}
return super.getAddCommand(generic);
}
示例2: showLayoutTargetFeedback
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@Override
protected void showLayoutTargetFeedback(Request request) {
eraseLayoutTargetFeedback(request);
if (request instanceof ChangeBoundsRequest || (request instanceof CreateRequest
&& acceptCreate((CreateRequest) request))){
targetFeedback = new RectangleFigure();
Rectangle parentBounds = ((ElementEditPart)getHost()).getBounds();
translateToAbsolute(getContainerFigure(), parentBounds);
Rectangle lineBounds = parentBounds.getCopy();
lineBounds.height = 4;
lineBounds.y--;
targetFeedback.setForegroundColor(ColorConstants.green);
targetFeedback.setBackgroundColor(ColorConstants.green);
if (isInsertAfter((DropRequest) request)){
lineBounds.y += parentBounds.height;
}
targetFeedback.setBounds(lineBounds);
addFeedback(targetFeedback);
} else if (request instanceof ChangeBoundsRequest){
}
}
示例3: getTargetEditPart
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
/**
* Returns the host EditPart when appropriate. Targeting is done by checking
* if the mouse is clearly over the host's TreeItem.
*
* @see org.eclipse.gef.EditPolicy#getTargetEditPart(Request)
*/
public EditPart getTargetEditPart(Request req) {
if (req.getType().equals(REQ_ADD) || req.getType().equals(REQ_MOVE)
|| req.getType().equals(REQ_CREATE)) {
DropRequest drop = (DropRequest) req;
Point where = new Point(drop.getLocation().x, drop.getLocation().y);
Widget widget = ((TreeEditPart) getHost()).getWidget();
if (widget instanceof Tree)
return getHost();
TreeItem treeitem = (TreeItem) widget;
Rectangle bounds = treeitem.getBounds();
int fudge = bounds.height / 5;
Rectangle inner = new Rectangle(bounds.x, bounds.y + fudge,
bounds.width, bounds.height
- (treeitem.getExpanded() ? 0 : fudge * 2));
// Point is either outside the Treeitem, or inside the inner Rect.
if (!bounds.contains(where) || inner.contains(where))
return getHost();
}
return null;
}
示例4: showDropFeedback
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
private void showDropFeedback(DropRequest request) {
Widget hostWidget = ((TreeEditPart) getHost()).getWidget();
Tree tree = getTree();
org.eclipse.draw2d.geometry.Point pt = request.getLocation();
TreeItem item = findTreeItemAt(pt);
if (item == null) {
if (hostWidget == tree) {
insertMarkAfterLastChild(tree.getItems());
}
} else if (item == hostWidget) {
tree.setInsertMark(null, true);
} else {
boolean before = isInUpperHalf(item.getBounds(), pt);
tree.setInsertMark(item, before);
}
}
示例5: eraseTargetConnectionFeedback
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@Override
protected void eraseTargetConnectionFeedback(DropRequest request) {
EditPart part = (EditPart)getHost();
if(part instanceof DwParentChildConnectionEditPart){
}
}
示例6: getDropLocation
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
private Point getDropLocation(DropRequest request){
Point where = request.getLocation().getCopy();
IFigure figure = getLayoutContainer();
figure.translateToRelative(where);
figure.translateFromParent(where);
where.translate(getLayoutOrigin().getNegated());
return where;
}
示例7: eraseTargetFeedback
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
/**
* Calls {@link #eraseTargetConnectionFeedback(DropRequest)} when
* appropriate.
*
* @see org.eclipse.gef.EditPolicy#eraseTargetFeedback(Request)
*/
public void eraseTargetFeedback(Request request) {
if (REQ_CONNECTION_START.equals(request.getType())
|| REQ_CONNECTION_END.equals(request.getType())
|| REQ_RECONNECT_SOURCE.equals(request.getType())
|| REQ_RECONNECT_TARGET.equals(request.getType()))
eraseTargetConnectionFeedback((DropRequest) request);
}
示例8: showTargetFeedback
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
/**
* Calls {@link #showTargetConnectionFeedback(DropRequest)} when
* appropriate.
*
* @see org.eclipse.gef.EditPolicy#showTargetFeedback(Request)
*/
public void showTargetFeedback(Request request) {
if (REQ_CONNECTION_START.equals(request.getType())
|| REQ_CONNECTION_END.equals(request.getType())
|| REQ_RECONNECT_SOURCE.equals(request.getType())
|| REQ_RECONNECT_TARGET.equals(request.getType()))
showTargetConnectionFeedback((DropRequest) request);
}
示例9: getSourceConnectionAnchor
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
Point pt = new Point(((DropRequest) request).getLocation());
return getComponentFigure().getSourceConnectionAnchorAt(pt);
}
示例10: getTargetConnectionAnchor
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
Point pt = new Point(((DropRequest) request).getLocation());
return getComponentFigure().getTargetConnectionAnchorAt(pt);
}
示例11: isInsertAfter
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
private boolean isInsertAfter(DropRequest request) {
ElementEditPart ep = (ElementEditPart) getHost();
Point where = getDropLocation(request);
Rectangle parentBounds = ep.getBounds();
return (parentBounds.height / 2) < where.y;
}
示例12: getLocationFromRequest
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
private Point getLocationFromRequest(Request request) {
return ((DropRequest) request).getLocation();
}
示例13: showTargetFeedback
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
/**
* @see org.eclipse.gef.EditPolicy#showTargetFeedback(Request)
*/
public void showTargetFeedback(Request req) {
if (req.getType().equals(REQ_MOVE) || req.getType().equals(REQ_ADD)
|| req.getType().equals(REQ_CREATE))
showDropFeedback((DropRequest) req);
}
示例14: eraseTargetConnectionFeedback
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
protected void eraseTargetConnectionFeedback( DropRequest request )
{
// TODO Auto-generated method stub
super.eraseTargetConnectionFeedback( request );
}
示例15: showTargetConnectionFeedback
import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
protected void showTargetConnectionFeedback( DropRequest request )
{
// TODO Auto-generated method stub
super.showTargetConnectionFeedback( request );
}