本文整理汇总了Java中org.eclipse.gef.EditPartViewer.Conditional方法的典型用法代码示例。如果您正苦于以下问题:Java EditPartViewer.Conditional方法的具体用法?Java EditPartViewer.Conditional怎么用?Java EditPartViewer.Conditional使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.EditPartViewer
的用法示例。
在下文中一共展示了EditPartViewer.Conditional方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTargetingConditional
import org.eclipse.gef.EditPartViewer; //导入方法依赖的package包/类
/**
* @see org.eclipse.gef.tools.SelectionTool#getTargetingConditional()
*/
@Override
protected Conditional getTargetingConditional() {
return new EditPartViewer.Conditional() {
public boolean evaluate(EditPart editpart) {
if(editpart instanceof LifeLineEditPart) {
if(getLocation().y >= FigureConstant.FIGURE_LIFELINE_TOP_MARGIN + FigureConstant.FIGURE_LIFELINE_HEAD_HEIGHT) {
Rectangle bounds = ((LifeLineEditPart) editpart).getFigure().getBounds();
if(bounds.x + bounds.width/2 - LineEditPart.LINE_SELECTABLE_WIDTH/2 <= getLocation().x
&& bounds.x + bounds.width/2 + LineEditPart.LINE_SELECTABLE_WIDTH/2 >= getLocation().x) {
return editpart.isSelectable();
} else {
return false;
}
} else {
return editpart.isSelectable();
}
} else {
return editpart.isSelectable();
}
}
};
}
示例2: getTargetingConditional
import org.eclipse.gef.EditPartViewer; //导入方法依赖的package包/类
/**
* Returns a new Conditional that evaluates to <code>true</code> if the
* queried edit part's {@link EditPart#isSelectable()} method returns
* <code>true</code>.
*
* @see TargetingTool#getTargetingConditional()
*/
protected EditPartViewer.Conditional getTargetingConditional() {
return new EditPartViewer.Conditional() {
public boolean evaluate(EditPart editpart) {
EditPart targetEditPart = editpart
.getTargetEditPart(getTargetRequest());
return targetEditPart != null && targetEditPart.isSelectable();
}
};
}
示例3: getTargetingConditional
import org.eclipse.gef.EditPartViewer; //导入方法依赖的package包/类
/**
* Returns the conditional object used for obtaining the target editpart
* from the current viewer. By default, a conditional is returned that tests
* whether an editpart at the current mouse location indicates a target for
* the operation's request, using
* {@link EditPart#getTargetEditPart(Request)}. If <code>null</code> is
* returned, then the conditional fails, and the search continues.
*
* @see EditPartViewer#findObjectAtExcluding(Point, Collection,
* EditPartViewer.Conditional)
* @return the targeting conditional
*/
protected EditPartViewer.Conditional getTargetingConditional() {
return new EditPartViewer.Conditional() {
public boolean evaluate(EditPart editpart) {
return editpart.getTargetEditPart(getTargetRequest()) != null;
}
};
}