use of org.eclipse.gef.EditPolicy in project Palladio-Editors-Sirius by PalladioSimulator.
the class AbstractRotatableImageEditPart method getPrimaryDragEditPolicy.
/**
* @generated
*/
public EditPolicy getPrimaryDragEditPolicy() {
EditPolicy result = super.getPrimaryDragEditPolicy();
if (result instanceof ResizableEditPolicy) {
ResizableEditPolicy ep = (ResizableEditPolicy) result;
ep.setResizeDirections(PositionConstants.NONE);
}
return result;
}
use of org.eclipse.gef.EditPolicy in project whole by wholeplatform.
the class TextualSelectionTool method mouseDown.
@Override
public void mouseDown(MouseEvent e, EditPartViewer viewer) {
super.mouseDown(e, viewer);
EditPart targetEditPart = getTargetEditPart();
if (targetEditPart == null || e.button != 1)
return;
EditPolicy editPolicy = targetEditPart.getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
if (editPolicy instanceof TextualHilightEditPolicy)
performSelectionLocationUpdate((TextualHilightEditPolicy) editPolicy);
}
use of org.eclipse.gef.EditPolicy in project whole by wholeplatform.
the class FreeformRootPart method createEditPolicies.
protected void createEditPolicies() {
installEditPolicy(EditPolicy.CONTAINER_ROLE, new WholeContainerEditPolicy(getCommandFactory()));
installEditPolicy(EditPolicy.COMPONENT_ROLE, new WholeComponentEditPolicy(getCommandFactory()));
installEditPolicy(EditPolicy.LAYOUT_ROLE, new WholeFreeformLayoutEditPolicy((XYLayout) getContentPane().getLayoutManager(), getCommandFactory()) {
@Override
protected EditPolicy createChildEditPolicy(EditPart child) {
return new WholeNonResizableEditPolicy();
}
@Override
protected Command getCreateCommand(CreateRequest request) {
// FIXME
return super.getCreateCommand(request);
}
});
installEditPolicy("Snap Feedback", new SnapFeedbackPolicy());
}
use of org.eclipse.gef.EditPolicy in project dbeaver by serge-rider.
the class ExtendedDirectEditManager method commit.
/**
* Commits the current value of the cell editor by getting a {@link Command}
* from the source edit part and executing it via the {@link CommandStack}.
* Finally, {@link #bringDown()}is called to perform and necessary cleanup.
*/
@Override
protected void commit() {
if (committing)
return;
committing = true;
try {
// we set the cell editor control to invisible to remove any
// possible flicker
getCellEditor().getControl().setVisible(false);
if (isDirty()) {
CommandStack stack = getEditPart().getViewer().getEditDomain().getCommandStack();
EditPolicy editPolicy = getEditPart().getEditPolicy(EditPolicy.DIRECT_EDIT_ROLE);
Command command;
if (editPolicy != null) {
command = editPolicy.getCommand(getDirectEditRequest());
} else {
command = getEditPart().getCommand(getDirectEditRequest());
}
if (command != null && command.canExecute()) {
stack.execute(command);
}
}
} finally {
bringDown();
committing = false;
}
}
use of org.eclipse.gef.EditPolicy in project yamcs-studio by yamcs.
the class WidgetConnectionEditPart method createEditPolicies.
@Override
protected void createEditPolicies() {
if (getExecutionMode() == ExecutionMode.EDIT_MODE && !getWidgetModel().isLoadedFromLinkedOpi()) {
// Selection handle edit policy.
// Makes the connection show a feedback, when selected by the user.
installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy() {
private ConnectionRouter originalRouter = null;
private Object originalConstraint = null;
@Override
protected void showConnectionMoveFeedback(ReconnectRequest request) {
EditPolicy connectionHandlesEditpolicy = getEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE);
if (connectionHandlesEditpolicy != null && connectionHandlesEditpolicy instanceof ManhattanBendpointEditPolicy) {
((ManhattanBendpointEditPolicy) connectionHandlesEditpolicy).removeSelectionHandles();
}
if (getConnection().getConnectionRouter() instanceof FixedPointsConnectionRouter) {
originalRouter = getConnection().getConnectionRouter();
originalConstraint = originalRouter.getConstraint(getConnection());
getConnection().setConnectionRouter(new ManhattanConnectionRouter());
}
super.showConnectionMoveFeedback(request);
}
@Override
protected void eraseConnectionMoveFeedback(ReconnectRequest request) {
if (originalRouter != null) {
originalRouter.setConstraint(getConnection(), originalConstraint);
getConnection().setConnectionRouter(originalRouter);
}
super.eraseConnectionMoveFeedback(request);
}
});
// Allows the removal of the connection model element
installEditPolicy(EditPolicy.CONNECTION_ROLE, new ConnectionEditPolicy() {
@Override
protected Command getDeleteCommand(GroupRequest request) {
return new ConnectionDeleteCommand(getWidgetModel());
}
});
}
}
Aggregations