use of org.eclipse.gef.Handle in project yamcs-studio by yamcs.
the class GraphicalFeedbackChildEditPolicy method createSelectionHandles.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
protected List<?> createSelectionHandles() {
// get default handles
List<Handle> handleList = super.createSelectionHandles();
// add contributed handles
GraphicalEditPart hostEP = (GraphicalEditPart) getHost();
List<Handle> contributedHandles = feedbackFactory.createCustomHandles(hostEP);
if (contributedHandles != null) {
handleList.addAll(contributedHandles);
}
if (hostEP.getModel() instanceof IPVWidgetModel && ((AbstractWidgetModel) (hostEP.getModel())).getProperty(IPVWidgetModel.PROP_PVNAME).isVisibleInPropSheet()) {
handleList.add(new PVWidgetSelectionHandle((GraphicalEditPart) hostEP));
}
return handleList;
}
use of org.eclipse.gef.Handle in project yamcs-studio by yamcs.
the class AbstractPolyFeedbackFactory method createCustomHandles.
/**
* {@inheritDoc}
*/
@Override
public final List<Handle> createCustomHandles(final GraphicalEditPart hostEP) {
assert hostEP != null;
// $NON-NLS-1$
assert hostEP.getModel() instanceof AbstractPolyModel : "hostEP.getModel() instanceof AbstractPolyModel";
// create some custom handles, which enable the user to drag arround
// single points of the polyline
List<Handle> handles = new ArrayList<Handle>();
AbstractPolyModel abstractPolyElement = (AbstractPolyModel) hostEP.getModel();
int pointCount = abstractPolyElement.getPoints().size();
for (int i = 0; i < pointCount; i++) {
PolyPointHandle myHandle = new PolyPointHandle(hostEP, i);
handles.add(myHandle);
}
return handles;
}
use of org.eclipse.gef.Handle in project whole by wholeplatform.
the class WholeNonResizableEditPolicy method createSelectionHandles.
@Override
protected List<?> createSelectionHandles() {
final GraphicalEditPart host = (GraphicalEditPart) getHost();
final DragTracker tracker = new SelectEditPartTracker(host);
final Cursor cursor = SharedCursors.ARROW;
final MoveHandle moveHandle = new MoveHandle(host) {
@Override
protected void initialize() {
setOpaque(false);
setBorder(new LineBorder(ColorConstants.gray, 1));
setCursor(cursor);
setDragTracker(tracker);
}
};
final List<Handle> handles = new ArrayList<Handle>(5);
handles.add(moveHandle);
if (isDragAllowed()) {
handles.add(createHandle(host, PositionConstants.SOUTH_EAST, tracker, cursor));
handles.add(createHandle(host, PositionConstants.SOUTH_WEST, tracker, cursor));
handles.add(createHandle(host, PositionConstants.NORTH_WEST, tracker, cursor));
handles.add(createHandle(host, PositionConstants.NORTH_EAST, tracker, cursor));
}
return handles;
}
use of org.eclipse.gef.Handle in project statecharts by Yakindu.
the class TransitionExpressionEditPart method createDefaultEditPolicies.
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.COMPONENT_ROLE, new TransitionExpressionComponentEditPolicy());
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ContextSensitiveHelpPolicy(HelpContextIds.SC_PROPERTIES_TRANSITION_EXPRESSION));
// BUGFIX:
// https://code.google.com/a/eclipselabs.org/p/yakindu/issues/detail?id=26
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableLabelEditPolicy() {
@Override
protected void replaceHandleDragEditPartsTracker(Handle handle) {
if (handle instanceof AbstractHandle) {
AbstractHandle h = (AbstractHandle) handle;
h.setDragTracker(new DragEditPartsTrackerEx(getHost()) {
protected boolean isMove() {
return true;
}
});
}
}
});
}
use of org.eclipse.gef.Handle in project whole by wholeplatform.
the class WholeResizableEditPolicy method createSelectionHandles.
protected List<?> createSelectionHandles() {
final GraphicalEditPart host = (GraphicalEditPart) getHost();
final int directions = getResizeDirections() != -1 ? getResizeDirections() : PositionConstants.EAST + PositionConstants.SOUTH + PositionConstants.WEST + PositionConstants.NORTH;
final MoveHandle moveHandle = new MoveHandle(host) {
@Override
protected void initialize() {
setOpaque(false);
setBorder(new LineBorder(ColorConstants.gray, 1));
setCursor(Cursors.SIZEALL);
}
};
final List<Handle> handles = new ArrayList<Handle>(9);
handles.add(moveHandle);
handles.add(createHandle(host, PositionConstants.EAST, (directions & PositionConstants.EAST) != 0));
handles.add(createHandle(host, PositionConstants.SOUTH_EAST, (directions & PositionConstants.SOUTH_EAST) != 0));
handles.add(createHandle(host, PositionConstants.SOUTH, (directions & PositionConstants.SOUTH) != 0));
handles.add(createHandle(host, PositionConstants.SOUTH_WEST, (directions & PositionConstants.SOUTH_WEST) != 0));
handles.add(createHandle(host, PositionConstants.WEST, (directions & PositionConstants.WEST) != 0));
handles.add(createHandle(host, PositionConstants.NORTH_WEST, (directions & PositionConstants.NORTH_WEST) != 0));
handles.add(createHandle(host, PositionConstants.NORTH, (directions & PositionConstants.NORTH) != 0));
handles.add(createHandle(host, PositionConstants.NORTH_EAST, (directions & PositionConstants.NORTH_EAST) != 0));
return handles;
}
Aggregations