use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class EllipseBusinessItemNameEditPart method createDefaultEditPolicies.
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
protected List createSelectionHandles() {
List handles = new ArrayList();
NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
return handles;
}
public Command getCommand(Request request) {
return null;
}
public boolean understandsRequest(Request request) {
return false;
}
});
}
use of org.eclipse.gef.GraphicalEditPart in project Palladio-Editors-Sirius by PalladioSimulator.
the class AbstractRotatableImageEditPart method createNodeShape.
/**
* @generated
*/
protected IFigure createNodeShape() {
CustomStyle imageStyle = (CustomStyle) resolveSemanticElement();
NodeImageExtension imageExtension = ExtensionActivator.getDefault().getBestImageExtension(imageStyle.getId());
primaryShape = new RotatableSVGWorkspaceImageFigure(imageExtension.getMode(), imageExtension.getTopImage(), imageExtension.getLeftImage(), imageExtension.getBottomImage(), imageExtension.getRightImage());
listener = new RotatableEditPartListener(this);
primaryShape.addFigureListener(listener);
EditPart parentEditPart = getParent();
if (parentEditPart instanceof GraphicalEditPart) {
GraphicalEditPart parentGraphicalEditPart = (GraphicalEditPart) parentEditPart;
NodeListener dEdgeEditPartListener = new PropagateFigureListenerAtConnectionFigure(listener);
parentGraphicalEditPart.addNodeListener(dEdgeEditPartListener);
}
return primaryShape;
}
use of org.eclipse.gef.GraphicalEditPart in project knime-core by knime.
the class AnnotationEditManager method initCellEditor.
/**
* Initializes the cell editor.
*
* @see org.eclipse.gef.tools.DirectEditManager#initCellEditor()
*/
@Override
protected void initCellEditor() {
// de-select the underlying annotation to remove the selection handles
final GraphicalEditPart editPart = getEditPart();
editPart.getRoot().getViewer().deselectAll();
editPart.getFigure().setVisible(false);
StyledTextEditor stw = (StyledTextEditor) getCellEditor();
Annotation anno = ((AnnotationEditPart) editPart).getModel();
Font defaultFont;
if (editPart instanceof NodeAnnotationEditPart) {
defaultFont = AnnotationEditPart.getNodeAnnotationDefaultFont();
} else if (anno.getVersion() < AnnotationData.VERSION_20151012) {
defaultFont = FontStore.INSTANCE.getSystemDefaultFont();
} else {
defaultFont = AnnotationEditPart.getWorkflowAnnotationDefaultFont();
}
stw.setDefaultFont(defaultFont);
stw.setValue(anno);
// Hook the cell editor's copy/paste actions to the actionBars so that
// they can
// be invoked via keyboard shortcuts.
m_actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorSite().getActionBars();
saveCurrentActions(m_actionBars);
m_actionHandler = new CellEditorActionHandler(m_actionBars);
m_actionHandler.addCellEditor(getCellEditor());
m_actionBars.updateActionBars();
}
use of org.eclipse.gef.GraphicalEditPart in project knime-core by knime.
the class SnapIconToGrid method getReferencePart.
/**
* Returns the part the request started on (the part that was dragged to move all selected nodes).
* @param parts
* @param mouseLoc
* @param moveDelta
* @return
*/
private EditPart getReferencePart(@SuppressWarnings("rawtypes") final List parts, final Point mouseLoc, final Point moveDelta) {
int i = 0;
Point loc = mouseLoc.getCopy().translate(moveDelta.getCopy().negate());
makeRelative(m_container.getContentPane(), loc);
while (i < parts.size()) {
GraphicalEditPart result = (GraphicalEditPart) parts.get(i);
if (result.getFigure().containsPoint(loc)) {
return result;
}
if (result instanceof NodeContainerEditPart) {
NodeAnnotationEditPart annoPart = ((NodeContainerEditPart) result).getNodeAnnotationEditPart();
if (annoPart.getFigure().containsPoint(loc)) {
return annoPart;
}
}
i++;
}
return null;
}
use of org.eclipse.gef.GraphicalEditPart in project knime-core by knime.
the class SnapToPortGeometry method generateSnapPartsList.
/**
* Generates a list of parts which should be snapped to. The list is the
* original children, minus the given exclusions, minus and children whose
* figures are not visible.
*
* @since 3.0
* @param exclusions the children to exclude
* @return a list of parts which should be snapped to
*/
protected List generateSnapPartsList(final List exclusions) {
// Don't snap to any figure that is being dragged
List<Object> children = new ArrayList<Object>(m_container.getChildren());
children.removeAll(exclusions);
// Don't snap to hidden figures
List hiddenChildren = new ArrayList();
for (Iterator iter = children.iterator(); iter.hasNext(); ) {
GraphicalEditPart child = (GraphicalEditPart) iter.next();
if (!child.getFigure().isVisible()) {
hiddenChildren.add(child);
}
}
children.removeAll(hiddenChildren);
return children;
}
Aggregations