org.eclipse.draw2d.MouseListener Java Examples

The following examples show how to use org.eclipse.draw2d.MouseListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RotatedTextFigure.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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( );
				}
			}
		}
	} );
}
 
Example #2
Source File: GenericLevelPresets.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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 );
        }
    } );
}
 
Example #3
Source File: BoundaryEventSwitchEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected List<Pair<IFigure, MouseListener>> getItems(
		IGraphicalEditPart host2) {
	final List<Pair<IFigure, MouseListener>> clickableItems = new ArrayList<Pair<IFigure, MouseListener>>();
	if(host2.getAdapter(NonInterruptingBoundaryTimerEvent.class) != null ){
		 clickableItems.add(createClickableItem(new Point(0, 0),host2, ProcessElementTypes.BoundaryTimerEvent_3043));
	}else  if(host2.getAdapter(BoundaryTimerEvent.class) != null ){
		 clickableItems.add(createClickableItem(new Point(0, 0),host2, ProcessElementTypes.NonInterruptingBoundaryTimerEvent_3064));
	}
	return clickableItems;
}
 
Example #4
Source File: DropDownMenuFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void addElements() {
	if(!isPaint){
		paintElements();
	}
	for(IFigure elem : getAllFigures()){
		elem.setVisible(true);
	}
	for (Pair<IFigure, MouseListener> pair : elements) {
		if(allElements.contains(pair.getFirst())){
			if(pair.getSecond() != null){
				pair.getFirst().addMouseListener(pair.getSecond());
			}
		}
	}
}
 
Example #5
Source File: DropDownMenuFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 */
protected void removeElements() {
	for (Pair<IFigure, MouseListener> elem : elements) {
		if(allElements.contains(elem.getFirst())){
			elem.getFirst().setLocation(zero );
			layer.remove(elem.getFirst());
			if(elem.getSecond() != null)
				elem.getFirst().removeMouseListener(elem.getSecond());
		}
	}
	allElements.clear();
}
 
Example #6
Source File: DropDownMenuFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void paintElements(){
	if (elements != null) {
		for(Pair<IFigure, MouseListener> pair : elements){
			IFigure elem = pair.getFirst();
			if (elem != null && !(elem instanceof Polyline)) {
				elem.setSize(new Dimension(20,20));
				elem.setLocation(new Point(location.x +elem.getSize().width*elements.indexOf(pair),location.y+20/*+elem.getSize().height*elements.indexOf(elem)*/));
				elem.setVisible(false);
				layer.add(elem);
				addElementsToShow(elem);
			}
		}
	}
}
 
Example #7
Source File: LinkFigure.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @param mouseListener
 */
public void addMouseListener(MouseListener mouseListener) {
	leftLine.addMouseListener(mouseListener);
	rightLine.addMouseListener(mouseListener);
}
 
Example #8
Source File: PlotArea.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void removeAuxilliaryClickListener(MouseListener auxilliaryClickListener) {
	if (this.auxilliaryClickListeners == null)
		return;
	auxilliaryClickListeners.remove(auxilliaryClickListener);
}
 
Example #9
Source File: PlotArea.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void addAuxilliaryClickListener(MouseListener auxilliaryClickListener) {
	if (this.auxilliaryClickListeners == null)
		auxilliaryClickListeners = new HashSet<MouseListener>();
	auxilliaryClickListeners.add(auxilliaryClickListener);
}
 
Example #10
Source File: PlotArea.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void fireMouseReleased(MouseEvent me) {
	if (this.auxilliaryClickListeners == null)
		return;
	for (MouseListener l : auxilliaryClickListeners)
		l.mouseReleased(me);
}
 
Example #11
Source File: PlotArea.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void fireMouseDoubleClicked(MouseEvent me) {
	if (this.auxilliaryClickListeners == null)
		return;
	for (MouseListener l : auxilliaryClickListeners)
		l.mouseDoubleClicked(me);
}
 
Example #12
Source File: PlotArea.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void fireMousePressed(MouseEvent me) {
	if (this.auxilliaryClickListeners == null)
		return;
	for (MouseListener l : auxilliaryClickListeners)
		l.mousePressed(me);
}
 
Example #13
Source File: ActivitySwitchEditPolicy.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private IFigure createClickableFigure(final Point location, final IGraphicalEditPart host, final IElementType type) {
    final Pair<IFigure, MouseListener> item = createClickableItem(location, host, type);
    item.getFirst().addMouseListener(item.getSecond());
    return item.getFirst();
}
 
Example #14
Source File: DropDownMenuFigure.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public void addToMenu(IFigure menuEntry, MouseListener mouseListener){
	elements.add(new Pair<IFigure, MouseListener>(menuEntry, mouseListener));
}