Java Code Examples for org.eclipse.gef.Request#getType()

The following examples show how to use org.eclipse.gef.Request#getType() . 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: CrosstabCellEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void showTargetFeedback( Request request )
{
	if ( this.getSelected( ) == 0
			&& isActive( )
			&& request.getType( ) == RequestConstants.REQ_SELECTION )
	{

		if ( isFigureLeft( request ) )
		{
			this.getViewer( ).setCursor( ReportPlugin.getDefault( )
					.getLeftCellCursor( ) );
		}
		else
		{
			this.getViewer( ).setCursor( ReportPlugin.getDefault( )
					.getRightCellCursor( ) );
		}
	}
	super.showTargetFeedback( request );
}
 
Example 2
Source File: EditorDragGuidePolicy.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * When drag the margin guide, the attache editparts move with the guide.
 * Now do nothing
 * 
 * @param request
 */
private void eraseAttachedPartsFeedback( Request request )
{
	if ( attachedEditParts != null )
	{
		ChangeBoundsRequest req = new ChangeBoundsRequest( request
				.getType( ) );
		req.setEditParts( attachedEditParts );

		Iterator i = attachedEditParts.iterator( );

		while ( i.hasNext( ) )
			( (EditPart) i.next( ) ).eraseSourceFeedback( req );
		attachedEditParts = null;
	}
}
 
Example 3
Source File: TableEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void showTargetFeedback( Request request )
{
	if ( this.getSelected( ) == 0
			&& isActive( )
			&& request.getType( ) == RequestConstants.REQ_SELECTION )
	{

		// if ( isFigureLeft( request ) )
		// {
		// this.getViewer( ).setCursor( ReportPlugin.getDefault( )
		// .getLeftCellCursor( ) );
		// }
		// else
		// {
		// this.getViewer( ).setCursor( ReportPlugin.getDefault( )
		// .getRightCellCursor( ) );
		// }
	}
	super.showTargetFeedback( request );
}
 
Example 4
Source File: ListEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void showTargetFeedback( Request request )
{
	if ( this.getSelected( ) == 0
			&& isActive( )
			&& request.getType( ) == RequestConstants.REQ_SELECTION )
	{
		if ( isFigureLeft( request ) )
		{
			this.getViewer( ).setCursor( ReportPlugin.getDefault( )
					.getLeftCellCursor( ) );
		}
		else
		{
			this.getViewer( ).setCursor( ReportPlugin.getDefault( )
					.getRightCellCursor( ) );
		}
	}
	super.showTargetFeedback( request );
}
 
Example 5
Source File: TableCellEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void showTargetFeedback( Request request )
{
	if ( this.getSelected( ) == 0 && isActive( )
			&& request.getType( ) == RequestConstants.REQ_SELECTION )
	{

		if ( isFigureLeft( request ) )
		{
			this.getViewer( ).setCursor(
					ReportPlugin.getDefault( ).getLeftCellCursor( ) );
		}
		else
		{
			this.getViewer( ).setCursor(
					ReportPlugin.getDefault( ).getRightCellCursor( ) );
		}
	}
	super.showTargetFeedback( request );
}
 
Example 6
Source File: StateEditPart.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Delegates all {@link CreateViewAndElementRequest}s to the figure compartment.
 */
@Override
public EditPart getTargetEditPart(Request request) {
	if (request instanceof CreateViewAndElementRequest) {
		return figureCompartmentEditPart;
	}
	if (request instanceof GroupRequest && request.getType() == RequestConstants.REQ_DROP) {
		GroupRequest req = (GroupRequest) request;
		if (areInsertableChildren(req.getEditParts())) {
			return figureCompartmentEditPart;
		}
	}

	return super.getTargetEditPart(request);
}
 
Example 7
Source File: CompartmentEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Command getCommand(Request request) {

	if(request.getType() == RequestConstants.REQ_RESIZE_CHILDREN
			&& request instanceof ChangeBoundsRequest){
		ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
		EditPart ep = (EditPart) changeBoundsRequest.getEditParts().get(0);
		if(ep instanceof IGraphicalEditPart){
			Node node = (Node)((IGraphicalEditPart)ep).getModel() ;
			Size size =(Size)node.getLayoutConstraint() ;
			Dimension s = new Dimension(size.getWidth(),size.getHeight());
			if(ep instanceof CustomPoolEditPart){
				if(s.height < 0){
					s.height = ((CustomPoolEditPart)ep).getDefaultHeight();
				}

				if(s.width < 0){
					s.width = ((CustomPoolEditPart)ep).getDefaultWidth();
				}
			}

			Location loc =(Location)node.getLayoutConstraint() ;
			Dimension delta = changeBoundsRequest.getSizeDelta();
			Rectangle constraint = new Rectangle(loc.getX(), loc.getY(), s.width + delta.width, s.height + delta.height);
			return createChangeConstraintCommand((ChangeBoundsRequest) request,ep,constraint);
		}
	}

	return super.getCommand(request);
}