use of org.knime.workbench.editor2.figures.WorkflowInPortFigure in project knime-core by knime.
the class WorkflowInPortEditPart method createFigure.
/**
* Creates {@link WorkflowInPortFigure}, sets the tooltip and adds a
* {@link MouseListener} to the figure in order to detect if the figure was
* clicked and a context menu entry should be provided to open the port
* view.
*
* @see WorkflowContextMenuProvider#buildContextMenu(
* org.eclipse.jface.action.IMenuManager)
* @see WorkflowInPortFigure
*
* {@inheritDoc}
*/
@Override
protected IFigure createFigure() {
NodeOutPortUI port = getManager().getInPort(getIndex()).getUnderlyingPort();
String tooltip = getTooltipText(PORT_NAME + ": " + getIndex(), port);
WorkflowInPortFigure f = new WorkflowInPortFigure(getType(), getManager().getNrInPorts(), getIndex(), tooltip);
f.addMouseListener(new MouseListener() {
@Override
public void mouseDoubleClicked(final MouseEvent me) {
}
/**
* Set the selection state of the figure to true. This is
* evaluated in the context menu. If it is selected a context menu
* entry is provided to open the port view.
*
* @see WorkflowContextMenuProvider#buildContextMenu(
* org.eclipse.jface.action.IMenuManager)
*
* {@inheritDoc}
*/
@Override
public void mousePressed(final MouseEvent me) {
setSelected(true);
}
/**
* Set the selection state of the figure to true. This is
* evaluated in the context menu. If it is selected a context menu
* entry is provided to open the port view.
*
* @see WorkflowContextMenuProvider#buildContextMenu(
* org.eclipse.jface.action.IMenuManager)
*
* {@inheritDoc}
*/
@Override
public void mouseReleased(final MouseEvent me) {
setSelected(false);
}
});
return f;
}
Aggregations