org.eclipse.gef.DragTracker Java Examples

The following examples show how to use org.eclipse.gef.DragTracker. 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: ReportNonResizableHandleKit.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Fills the given List with handles at each corner of a figure.
 * 
 * @param part
 *            the handles' GraphicalEditPart
 * @param handles
 *            the List to add the four corner handles to
 * @param tracker
 *            the handles' DragTracker
 * @param cursor
 *            the handles' Cursor
 */
public static void addCornerHandles( GraphicalEditPart part, List handles,
		DragTracker tracker, Cursor cursor )
{
	handles.add( createHandle( part,
			PositionConstants.SOUTH_EAST,
			tracker,
			cursor ) );
	handles.add( createHandle( part,
			PositionConstants.SOUTH_WEST,
			tracker,
			cursor ) );
	handles.add( createHandle( part,
			PositionConstants.NORTH_WEST,
			tracker,
			cursor ) );
	handles.add( createHandle( part,
			PositionConstants.NORTH_EAST,
			tracker,
			cursor ) );
}
 
Example #3
Source File: ExternalXtextLabelEditPart.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) {
	return new DragEditPartsTrackerEx(this) {
		protected boolean isMove() {
			return true;
		}

		protected boolean handleDoubleClick(int button) {
			performDirectEditRequest(request);
			return super.handleDoubleClick(button);
		}
	};
}
 
Example #4
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 #5
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 #6
Source File: FirstLevelHandleDataItemEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public DragTracker getDragTracker( Request req )
{
	DragEditPartsTracker track = new ReportElementDragTracker( this ) {

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.gef.tools.SelectEditPartTracker#handleButtonDown(int)
		 */
		protected boolean handleButtonDown( int button )
		{
			if ( getCurrentViewer( ) instanceof DeferredGraphicalViewer )
			{
				( (DeferredGraphicalViewer) getCurrentViewer( ) ).initStepDat( );
			}
			boolean bool = super.handleButtonDown( button );

			if ( ( button == 3 || button == 1 ) )
			// && isInState(STATE_INITIAL))
			{
				if ( getSourceEditPart( ) instanceof FirstLevelHandleDataItemEditPart )
				{
					FirstLevelHandleDataItemEditPart first = (FirstLevelHandleDataItemEditPart) getSourceEditPart( );
					if ( first.contains( getLocation( ) ) )
					{
						//MenuManager manager = new LevelCrosstabPopMenuProvider( getViewer( ) );
						manager.createContextMenu( getViewer( ).getControl( ) );
						Menu menu = manager.getMenu( );
						
						menu.setVisible( true );
						return true;
					}
				}
			}
			return bool;
		}
	};
	return track;
}
 
Example #7
Source File: CrosstavCellDragHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected DragTracker createDragTracker( )
{
	CrosstabHandleAdapter adapter = ((CrosstabTableEditPart)getOwner( ).getParent( )).getCrosstabHandleAdapter( );
	if (cursorDirection == PositionConstants.EAST && 
			(adapter.getColumnOprationCell( start )!=null||adapter.getColumnOprationCell( end )!=null))
	{
		return new CrosstabColumnDragTracker(getOwner( ), start, end);
	}
	if (cursorDirection == PositionConstants.SOUTH && adapter.getRowOprationCell( start ) != null)
	{
		return new CrosstabRowDragTracker(getOwner( ), start, end);
	}
	//return null;
	return new ResizeTracker( getOwner( ), cursorDirection )
	{
		protected void showTargetFeedback() 
		{
			
		}
		protected void eraseTargetFeedback() 
		{
		
		}
		
		protected void showSourceFeedback( )
		{
		}
		
		protected void eraseSourceFeedback( )
		{
		}
		
		protected Command getCommand( )
		{
			return UnexecutableCommand.INSTANCE;
		}
	};
}
 
Example #8
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 #9
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 #10
Source File: CustomPoolResizeHandle.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected DragTracker createDragTracker() {
	if (getOwner() instanceof CustomPoolEditPart){
		GraphicalEditPart target = getOwner();
	    CustomPoolEditPart pool = (CustomPoolEditPart)getOwner();
		for (Object o:pool.getChildren()){
			if (o instanceof CustomPoolCompartmentEditPart){
				for (Object o2:((CustomPoolCompartmentEditPart)o).getChildren()){
					if (o2 instanceof CustomLaneEditPart){
					    target = (CustomLaneEditPart)o2;
					}
				}
			}
		}
		
		return new ResizeTracker(target, cursorDirection){
			@Override
			protected GraphicalEditPart getTargetEditPart() {
				return getOwner();
			}
			
			@Override
			protected List getOperationSet() {
				List operationSet = new ArrayList();
				operationSet.add(getOwner());
				return operationSet;
			}
		};
	}
	return new ResizeTracker(getOwner(),cursorDirection);


}
 
Example #11
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 #12
Source File: ListBandEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public DragTracker getDragTracker( Request req )
{

	return new DragEditPartsTracker( this ) {

		protected boolean handleDragInProgress( )
		{
			return true;
		}
	};
}
 
Example #13
Source File: TableCellDragHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected DragTracker createDragTracker( )
{
	
	if (cursorDirection == PositionConstants.EAST )
	{
		return new ColumnDragTracker(getOwner( ).getParent( ), start, end);
	}
	if (cursorDirection == PositionConstants.SOUTH)
	{
		return new RowDragTracker(getOwner( ).getParent( ), start, end);
	}
	//return null;
	return new ResizeTracker( getOwner( ), cursorDirection )
	{
		protected void showTargetFeedback() 
		{
			
		}
		protected void eraseTargetFeedback() 
		{
		
		}
		
		protected void showSourceFeedback( )
		{
		}
		
		protected void eraseSourceFeedback( )
		{
		}
		
		protected Command getCommand( )
		{
			return UnexecutableCommand.INSTANCE;
		}
	};
}
 
Example #14
Source File: ReportResizeHandle.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected DragTracker createDragTracker( )
{
	return tracker;
}
 
Example #15
Source File: TextAnnotation2EditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #16
Source File: IntermediateErrorCatchEvent6EditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #17
Source File: IntermediateErrorCatchEvent5EditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #18
Source File: EndEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #19
Source File: ColumnHandle.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected DragTracker createDragTracker( )
{
	return new ColumnTracker( (TableEditPart) getOwner( ),
			columnNumber,
			this );
}
 
Example #20
Source File: IntermediateThrowSignalEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #21
Source File: IntermediateCatchTimerEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #22
Source File: IntermediateErrorCatchEventEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #23
Source File: StartMessageEventEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #24
Source File: IntermediateCatchMessageEventEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #25
Source File: SendTaskEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #26
Source File: ServiceTask2EditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #27
Source File: StartErrorEventEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragTracker getDragTracker(Request request) {
	return new DragEditPartsTrackerExWithoutCopyWithModKeyPressed(this);
}
 
Example #28
Source File: GroupOutlineEditPart.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DragTracker getDragTracker(Request req) {
	return new SelectEditPartTracker(this);
}
 
Example #29
Source File: TableSelectionHandle.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected DragTracker createDragTracker( )
{
	return null;
}
 
Example #30
Source File: RowHandle.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected DragTracker createDragTracker( )
{
	return new RowTracker( (TableEditPart) getOwner( ), rowNumber, this );
}