org.eclipse.gef.requests.SelectionRequest Java Examples

The following examples show how to use org.eclipse.gef.requests.SelectionRequest. 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: CustomLaneCompartmentEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public DragTracker getDragTracker(Request req) {
	if (!supportsDragSelection())
		return super.getDragTracker(req);

	if (req instanceof SelectionRequest
		&& ((SelectionRequest) req).getLastButtonPressed() == 3)
		return new DeselectAllTracker(this) {

			protected boolean handleButtonDown(int button) {
				getCurrentViewer().select(CustomLaneCompartmentEditPart.this);
				return true;
			}
		};
	return new CustomRubberbandDragTracker() {

		protected void handleFinished() {
			if (getViewer().getSelectedEditParts().isEmpty())
				getViewer().select(CustomLaneCompartmentEditPart.this);
		}
	};
}
 
Example #2
Source File: XtextLabelEditPart.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Performs direct edit on double click
 */
@Override
public DragTracker getDragTracker(final Request request) {
	if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3)
		return null;
	IDoubleClickCallback callback = new IDoubleClickCallback() {

		@Override
		public void handleDoubleClick(int btn) {
			performDirectEditRequest(request);
		}
	};
	return new DoubleClickDirectEditDragTracker(this, getTopGraphicEditPart(), callback);
}
 
Example #3
Source File: StatechartDescriptionCompartmentEditPart.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public DragTracker getDragTracker(final Request request) {
	if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3)
		return null;
	IDoubleClickCallback callback = new IDoubleClickCallback() {
		public void handleDoubleClick(int btn) {
			performDirectEditRequest(request);
		}
	};
	return new DoubleClickDirectEditDragTracker(this, getTopGraphicEditPart(), callback);
}
 
Example #4
Source File: TextAwareLabelEditPart.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Performs direct edit on double click
 */
@Override
public DragTracker getDragTracker(final Request request) {
	if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3)
		return null;
	IDoubleClickCallback callback = new IDoubleClickCallback() {

		@Override
		public void handleDoubleClick(int btn) {
			performDirectEditRequest(request);
		}
	};
	return new DoubleClickDirectEditDragTracker(this, getTopGraphicEditPart(), callback);
}
 
Example #5
Source File: ReportElementEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected boolean isFigureLeft( Request request )
{
	if ( !( request instanceof SelectionRequest ) )
	{
		return true;
	}
	SelectionRequest selctionRequest = (SelectionRequest) request;
	Point p = selctionRequest.getLocation( );
	// getFigure().translateToAbsolute(p);
	getFigure( ).translateToRelative( p );
	Point center = getFigure( ).getBounds( ).getCenter( );
	return center.x >= p.x;
}
 
Example #6
Source File: ReportDesignEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public DragTracker getDragTracker( Request req )
{
	if ( req instanceof SelectionRequest
			&& ( (SelectionRequest) req ).getLastButtonPressed( ) == 3 )
		return new DeselectAllTracker( this );
	return new RootDragTracker( );
}
 
Example #7
Source File: RowTracker.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void performOpen( )
{
	SelectionRequest request = new SelectionRequest( );
	request.setLocation( getLocation( ) );
	request.setType( RequestConstants.REQ_OPEN );
	request.getExtendedData( ).put( DesignerConstants.TABLE_ROW_NUMBER,
			Integer.valueOf( getNumber( ) ) );
	if ( getSourceEditPart( ).understandsRequest( request ) )
	{
		getSourceEditPart( ).performRequest( request );
	}
}
 
Example #8
Source File: CellEditPart.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This method returns a dragTracker to use for multi-selection of
 * EditParts.
 */
@Override
public DragTracker getDragTracker(Request req) {
	// XXX Important notes here!
	//
	// The dragTracker is created from the very first EditPart that is
	// clicked during a selection. We can use this method to notify the
	// corresponding model for this EditPart that it was the first component
	// selected.
	//
	// Left mouse button = 1
	// Middle mouse button = 2
	// Right mouse button = 3
	//
	// The current behavior here:
	//
	// If the user left-clicks, return a marquee (drag) selection. The
	// marquee actually toggles everything inside its bounds, so
	// previously-selected nodes will be de-selected.
	//
	// If the user middle-clicks, nothing happens.
	//
	// If the user right-clicks, all nodes are deselected.

	// Process right-clicks differently.
	if (req instanceof SelectionRequest
			&& ((SelectionRequest) req).getLastButtonPressed() == 3) {
		return new DeselectAllTracker(this);
	}
	// Return a custom marquee tracker here for left clicks.
	return marquee;
}
 
Example #9
Source File: CustomPoolCompartmentEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DragTracker getDragTracker(final Request req) {
    if (!supportsDragSelection()) {
        return super.getDragTracker(req);
    }

    if (req instanceof SelectionRequest
            && ((SelectionRequest) req).getLastButtonPressed() == 3) {
        return new DeselectAllTracker(this) {

            @Override
            protected boolean handleButtonDown(final int button) {
                getCurrentViewer().select(CustomPoolCompartmentEditPart.this);
                return true;
            }
        };
    }
    return new CustomRubberbandDragTracker() {

        @Override
        protected void handleFinished() {
            if (getViewer().getSelectedEditParts().isEmpty()) {
                getViewer().select(CustomPoolCompartmentEditPart.this);
            }
        }
    };
}
 
Example #10
Source File: CustomSubprocessEventCompartmentEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DragTracker getDragTracker(Request req) {
    if (!supportsDragSelection()) {
        return super.getDragTracker(req);
    }

    if (req instanceof SelectionRequest
            && ((SelectionRequest) req).getLastButtonPressed() == 3) {
        return new DeselectAllTracker(this) {

            @Override
            protected boolean handleButtonDown(int button) {
                getCurrentViewer().select(CustomSubprocessEventCompartmentEditPart.this);
                return true;
            }
        };
    }
    return new CustomRubberbandDragTracker() {

        @Override
        protected void handleFinished() {
            if (getViewer().getSelectedEditParts().isEmpty()) {
                getViewer().select(CustomSubprocessEventCompartmentEditPart.this);
            }
        }
    };
}