private void addVisibleLabel(IFigure figure) { visibleLabel = new Label(); visibleLabel.setBorder(new SimpleRaisedBorder()); visibleLabel.addMouseListener(new MouseListener.Stub() { @Override public void mousePressed(MouseEvent me) { EPlanElement node = getModel(); TriState oldValue = SpifePlanUtils.getVisible(node); if (!PlanEditApproverRegistry.getInstance().canModify(node)) { return; } try { VisibleOperation op = new VisibleOperation(node, oldValue == TriState.FALSE); op.addContext(TransactionUtils.getUndoContext(node)); IOperationHistory history = OperationHistoryFactory.getOperationHistory(); history.execute(op, null, null); } catch (Exception e) { trace.error(e.getMessage(), e); } } }); updateVisibleVisual(); figure.add(visibleLabel); }
RotatedTextFigure( RotatedTextItem textItem ) { super( ); this.textItem = textItem; addMouseListener( new MouseListener.Stub( ) { public void mousePressed( MouseEvent me ) { if ( me.button == 2 ) { try { RotatedTextFigure.this.textItem.setRotationAngle( normalize( RotatedTextFigure.this.textItem.getRotationAngle( ) + 45 ) ); } catch ( SemanticException e ) { e.printStackTrace( ); } } } } ); }
private void activate ( final String tag, final Shape shape ) { shape.addMouseListener ( new MouseListener.Stub () { @Override public void mouseReleased ( final MouseEvent me ) { GenericLevelPresets.this.triggerAction ( tag ); } } ); }
private void addScheduledLabel(IFigure figure) { scheduledLabel = new Label(); scheduledLabel.setBorder(new SimpleRaisedBorder()); scheduledLabel.addMouseListener(new MouseListener.Stub() { @Override public void mousePressed(MouseEvent me) { EPlanElement node = getModel(); ScheduledOperation.toggleScheduledness(node); } }); updateScheduledVisual(); figure.add(scheduledLabel); }
public InteractionFigure(IEnterExitListener enterExitL, MouseMotionListener motionL, MouseListener clickL, Cursor figureCursor) { enterExitListener = enterExitL; motionListener = motionL; clickListener = clickL; setLayoutManager(new XYLayout()); setCursor(figureCursor); }
/** * Constructor. */ public PossibleStepFigure() { final LineLayout layout = new LineLayout(); layout.setHorizontal(true); layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT); layout.setMinorAlignment(FlowLayout.ALIGN_CENTER); layout.setMinorSpacing(SPACING); setLayoutManager(layout); toolTip = new Label(); toolTip.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); toolTip.setBackgroundColor(ColorConstants.tooltipBackground); toolTip.setForegroundColor(ColorConstants.tooltipForeground); ellipse = createEllipse(); add(ellipse); label = new Label(); if (withLabel) { add(label); hasLabel = true; } else { ellipse.setToolTip(toolTip); hasLabel = false; } addMouseListener(new MouseListener.Stub() { /** * {@inheritDoc} * * @see org.eclipse.draw2d.MouseListener.Stub#mouseReleased(org.eclipse.draw2d.MouseEvent) */ @Override public void mousePressed(MouseEvent me) { if (me.button == 1) { final EditPartViewer viewer = getViewer(); viewer.getSelectionManager().deselectAll(); viewer.getSelectionManager().appendSelection(PossibleStepEditPart.this); } } }); }
public MouseListener getClickListener() { return clickListener; }
public void setClickListener(MouseListener clickL) { if (clickListener != clickL) { clickListener = clickL; } }