use of org.eclipse.draw2d.MouseEvent in project cubrid-manager by CUBRID.
the class RelationshipPart method addHoverListener.
/**
* Add hovering listener for the figure
*/
protected void addHoverListener() {
final IFigure figure = this.getFigure();
hoverListener = new MouseMotionListener() {
public void mouseEntered(MouseEvent me) {
setHoverState(true);
setRelationLinesFocus(true);
}
public void mouseExited(MouseEvent me) {
setHoverState(false);
setRelationLinesFocus(false);
setSelectedTableColor();
}
public void mouseHover(MouseEvent me) {
}
public void mouseDragged(MouseEvent me) {
}
public void mouseMoved(MouseEvent me) {
}
};
figure.addMouseMotionListener(hoverListener);
}
use of org.eclipse.draw2d.MouseEvent in project cubrid-manager by CUBRID.
the class TablePart method addHoverListener.
/**
* Add hovering listener for the figure
*/
protected void addHoverListener() {
final TablePart tablePart = this;
final IFigure figure = this.getFigure();
hoverListener = new MouseMotionListener() {
public void mouseEntered(MouseEvent me) {
if (hasChildPartSelected(tablePart) || tablePart.isDisableState()) {
return;
}
setHoverState(true);
setRelationLinesFocus(true);
setRelationLinesSyncColor(false);
figure.revalidate();
}
public void mouseExited(MouseEvent me) {
if (hasChildPartSelected(tablePart) || tablePart.isDisableState()) {
return;
}
setHoverState(false);
setRelationLinesFocus(false);
setRelationLinesSyncColor(true);
figure.revalidate();
}
public void mouseHover(MouseEvent me) {
}
public void mouseDragged(MouseEvent me) {
}
public void mouseMoved(MouseEvent me) {
}
};
figure.addMouseMotionListener(hoverListener);
}
use of org.eclipse.draw2d.MouseEvent 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;
}
use of org.eclipse.draw2d.MouseEvent in project hale by halestudio.
the class CellFigureTaskLabelContribution method contribute.
// private TaskServiceListener taskServiceListener;
@Override
public void contribute(CellFigure figure, Cell cell) {
TaskService taskService = HaleUI.getServiceProvider().getService(TaskService.class);
Collection<ResolvedTask<Cell>> tasks = taskService.getTasks(cell).stream().map(t -> taskService.resolveTask(t)).collect(Collectors.toList());
tasks = tasks.stream().filter(t -> t.isOpen()).collect(Collectors.toList());
if (tasks.isEmpty()) {
return;
}
Label tasksLabel = new Label();
Image tasksImage = null;
tasksImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_TASKS);
tasksLabel.setIcon(tasksImage);
tasksLabel.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent me) {
try {
IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(TaskTreeView.ID);
// the alignment/mapping view
if (part instanceof TaskTreeView) {
((TaskTreeView) part).update(new StructuredSelection(cell));
}
me.consume();
} catch (PartInitException e) {
log.error("Error creating task view", e);
}
}
@Override
public void mousePressed(MouseEvent me) {
// ignore
}
@Override
public void mouseDoubleClicked(MouseEvent me) {
// ignore
}
});
if (tasksImage != null) {
Label priorityTip = new Label(MessageFormat.format("There {0} {1} open tasks for this cell. Please refer to the Tasks view for details.", (tasks.size() == 1) ? "is" : "are", tasks.size()));
tasksLabel.setToolTip(priorityTip);
}
GridData tasksLabelGD = new GridData(GridData.CENTER, GridData.FILL, false, true);
figure.add(tasksLabel, tasksLabelGD);
}
use of org.eclipse.draw2d.MouseEvent in project yamcs-studio by yamcs.
the class TabFigure method createTabLabel.
private Label createTabLabel(String title, int index) {
Label tabLabel = new Label(title) {
@Override
protected void paintFigure(Graphics graphics) {
graphics.pushState();
graphics.setForegroundColor(TAB_3D_COLOR);
graphics.fillGradient(getClientArea(), horizontal);
graphics.popState();
super.paintFigure(graphics);
}
};
tabLabel.setLabelAlignment(PositionConstants.CENTER);
tabLabel.setOpaque(false);
tabLabel.setBorder(new LineBorder(BORDER_COLOR));
tabLabel.setBackgroundColor(getDarkColor(DEFAULT_TABCOLOR));
// tabLabel.setCursor(Cursors.HAND);
tabLabel.addMouseListener(new MouseListener.Stub() {
@Override
public void mousePressed(MouseEvent me) {
if (me.button != 1) {
return;
}
setActiveTabIndex(tabLabelList.indexOf(tabLabel));
}
});
return tabLabel;
}
Aggregations