org.eclipse.gef.SharedCursors Java Examples

The following examples show how to use org.eclipse.gef.SharedCursors. 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: ReportElementNonResizablePolicy.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected List createSelectionHandles( )
{
	List list = new ArrayList( );
	if ( isDragAllowed( ) )
	{
		ReportNonResizableHandleKit.addHandles( (GraphicalEditPart) getHost( ),
				list );
	}
	else
	{
		ReportNonResizableHandleKit.addHandles( (GraphicalEditPart) getHost( ),
				list,
				new SelectEditPartTracker( getHost( ) ),
				SharedCursors.ARROW );
	}
	return list;
}
 
Example #2
Source File: LabelEditManager.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the cell editor on the given composite. The cell editor is
 * created by instantiating the cell editor type passed into this
 * DirectEditManager's constuctor.
 * 
 * @param composite
 *            the composite to create the cell editor on
 * @return the newly created cell editor
 */
protected CellEditor createCellEditorOn( Composite composite )
{
	int style = this.applyBidiStyle( SWT.MULTI | SWT.WRAP ); // bidi_hcg

	LabelCellEditor editor = new LabelCellEditor( composite, style );
		//new LabelCellEditor( composite, SWT.MULTI | SWT.WRAP );
	final Control c = editor.getControl( );
	c.addMouseTrackListener( new MouseTrackAdapter( )
	{

		public void mouseEnter( MouseEvent e )
		{
			c.setCursor( SharedCursors.IBEAM );
		}

	} );
	return editor;
}
 
Example #3
Source File: MultipleShapesVerticalMoveTool.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * if the drag is permitted, show the cursor.
 * 
 * Else if a drag is occuring show it too, or show the 
 * no cursor.
 */
protected Cursor getDefaultCursor() {
	if (isMoveValid()) {
		return SharedCursors.SIZENS;
	} else {
		if (getState() == STATE_DRAG_IN_PROGRESS) {
			return SharedCursors.SIZENS;
		} 
		return SharedCursors.ARROW;
	}
}
 
Example #4
Source File: CrosstabHandleKit.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @param owner
 * @return
 */
static Handle createHandle( CrosstabCellEditPart owner )
{

	CrosstabTableEditPart part = (CrosstabTableEditPart) owner.getParent( );
	Rectangle rect = part.getSelectBounds( );

	TableSelectionHandle handle = new TableSelectionHandle( owner, rect );
	handle.setCursor( SharedCursors.SIZEALL );

	return handle;
}
 
Example #5
Source File: MultipleShapesHorizontalMoveTool.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * if the drag is permitted, show the cursor.
 * 
 * Else if a drag is occuring show it too, or show the 
 * no cursor.
 */
protected Cursor getDefaultCursor() {
	if (isMoveValid()) {
		return SharedCursors.SIZEWE;
	} else {
		if (getState() == STATE_DRAG_IN_PROGRESS) {
			return SharedCursors.SIZEWE;
		} 
		return SharedCursors.ARROW;
	}
}
 
Example #6
Source File: EditorGuideFigure.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public EditorGuideFigure( boolean isHorizontal )
{
	horizontal = isHorizontal;
	setBackgroundColor( ColorConstants.button );
	if ( horizontal )
	{
		setCursor( SharedCursors.SIZENS );
	}
	else
	{
		setCursor( SharedCursors.SIZEWE );
	}
}
 
Example #7
Source File: TableHandleKit.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
static Handle createHandle( TableCellEditPart owner )
{

	TableEditPart part = (TableEditPart) owner.getParent( );
	Rectangle rect = part.getSelectBounds( );

	TableSelectionHandle handle = new TableSelectionHandle( owner, rect );
	handle.setCursor( SharedCursors.SIZEALL );

	return handle;
}
 
Example #8
Source File: ReportNonResizableHandleKit.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
static Handle createHandle( GraphicalEditPart owner, int direction )
{
	ReportResizeHandle handle = new ReportResizeHandle( owner, direction );
	handle.setCursor( SharedCursors.SIZEALL );
	handle.setDragTracker( new DragEditPartsTracker( owner ) );
	return handle;
}
 
Example #9
Source File: TableSelectionGuideTracker.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor
 * @param sourceEditPart
 */
public TableSelectionGuideTracker( TableEditPart sourceEditPart, int number )
{
	super( sourceEditPart );
	this.number = number;
	setDefaultCursor( SharedCursors.ARROW );
	setUnloadWhenFinished( false );
}
 
Example #10
Source File: CellDragTracker.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new CellTracker, with the CROSS cursor
 * 
 * @param sourceEditPart
 */
public CellDragTracker( EditPart sourceEditPart )
{
	super( sourceEditPart );
	setDefaultCursor( SharedCursors.CROSS );
	setUnloadWhenFinished( false );
}
 
Example #11
Source File: CellDragTracker.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @see org.eclipse.gef.Tool#setViewer(org.eclipse.gef.EditPartViewer)
 */
public void setViewer( EditPartViewer viewer )
{
	if ( viewer == getCurrentViewer( ) )
		return;
	super.setViewer( viewer );
	if ( viewer instanceof GraphicalViewer )
		setDefaultCursor( SharedCursors.CROSS );
	else
		setDefaultCursor( SharedCursors.NO );
}
 
Example #12
Source File: RootDragTracker.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @see org.eclipse.gef.Tool#setViewer(org.eclipse.gef.EditPartViewer)
 */
public void setViewer( EditPartViewer viewer )
{
	if ( viewer == getCurrentViewer( ) )
		return;
	super.setViewer( viewer );
	if ( viewer instanceof GraphicalViewer )
		setDefaultCursor( SharedCursors.CROSS );
	else
		setDefaultCursor( SharedCursors.NO );
}
 
Example #13
Source File: BonitaUnspecifiedTypeConnectionTool.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public BonitaUnspecifiedTypeConnectionTool(List connectionTypes) {
	super(connectionTypes);
	setDefaultCursor(SharedCursors.HAND);
       setDisabledCursor(SharedCursors.CROSS);
}
 
Example #14
Source File: RootDragTracker.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates a new MarqueeSelectionTool.
 */
public RootDragTracker( )
{
	setDefaultCursor( SharedCursors.CROSS );
	setUnloadWhenFinished( false );
}
 
Example #15
Source File: EditorDragGuidePolicy.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void showSourceFeedback( Request request )
	{
		ChangeBoundsRequest req = (ChangeBoundsRequest) request;

		// add the placeholder guide figure to the ruler
		getHostFigure( ).getParent( ).add( getDummyGuideFigure( ), 0 );
		( (GraphicalEditPart) getHost( ).getParent( ) ).setLayoutConstraint(
				getHost( ), getDummyGuideFigure( ), Integer.valueOf(
						getGuideEditPart( ).getZoomedPosition( ) ) );
		getDummyGuideFigure( ).setBounds( getHostFigure( ).getBounds( ) );
		// add the invisible placeholder line figure to the primary viewer
		getGuideEditPart( ).getGuideLayer( ).add( getDummyLineFigure( ), 0 );
		getGuideEditPart( ).getGuideLayer( ).setConstraint(
				getDummyLineFigure( ),
				Boolean.valueOf( getGuideEditPart( ).isHorizontal( ) ) );
		//			getDummyLineFigure( ).setBounds(
		//					getGuideEditPart( ).getGuideLineFigure( ).getBounds( ) );
		getDummyLineFigure( ).setBounds( getDummyLineFigureBounds( req ) );
		//add the info label
		getGuideEditPart( ).getGuideLayer( ).add( getInfoLabel( ), 0 );
//		getGuideEditPart( ).getGuideLayer( ).setConstraint(
//				getInfoLabel( ),
//				Boolean.valueOf( getGuideEditPart( ).isHorizontal( ) ) );
		
		updateInfomation( getShowLable( req ) );
		
		// move the guide being dragged to the last index so that it's drawn
		// on
		// top of other guides
		List children = getHostFigure( ).getParent( ).getChildren( );
		children.remove( getHostFigure( ) );
		children.add( getHostFigure( ) );

		if ( isDeleteRequest( req ) )
		{
			getHostFigure( ).setVisible( false );
			getGuideEditPart( ).getGuideLineFigure( ).setVisible( false );
			getGuideEditPart( ).setCurrentCursor( SharedCursors.ARROW );
			eraseAttachedPartsFeedback( request );
		}
		else
		{
			int newPosition;
			if ( getGuideEditPart( ).isHorizontal( ) )
			{
				newPosition = getGuideEditPart( ).getZoomedPosition( )
						+ req.getMoveDelta( ).y;
			}
			else
			{
				newPosition = getGuideEditPart( ).getZoomedPosition( )
						+ req.getMoveDelta( ).x;
			}
			getHostFigure( ).setVisible( true );
			getGuideEditPart( ).getGuideLineFigure( ).setVisible( true );
			if ( isMoveValid( newPosition ) )
			{
				getGuideEditPart( ).setCurrentCursor( null );
				getGuideEditPart( ).updateLocationOfFigures( newPosition );
				showAttachedPartsFeedback( req );
			}
			else
			{
				getGuideEditPart( ).setCurrentCursor( SharedCursors.NO );
				getGuideEditPart( ).updateLocationOfFigures(
						getGuideEditPart( ).getZoomedPosition( ) );
				eraseAttachedPartsFeedback( request );
			}
		}
	}
 
Example #16
Source File: ResizeTracker.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @see org.eclipse.gef.tools.AbstractTool#getDefaultCursor()
 */
protected Cursor getDefaultCursor() {
	return SharedCursors.getDirectionalCursor(direction,
			getTargetEditPart().getFigure().isMirrored());
}
 
Example #17
Source File: ResizeTracker.java    From statecharts with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Constructs a resize tracker that resizes in the specified direction. The
 * direction is specified using {@link PositionConstants#NORTH},
 * {@link PositionConstants#NORTH_EAST}, etc.
 * 
 * @param owner
 *            of the resize handle which returned this tracker
 * @param direction
 *            the direction
 */
public ResizeTracker(GraphicalEditPart owner, int direction) {
	super(owner, direction);
	this.owner = owner;
	this.direction = direction;
	setDisabledCursor(SharedCursors.NO);
}