org.eclipse.gef.Handle Java Examples

The following examples show how to use org.eclipse.gef.Handle. 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: TransitionExpressionEditPart.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createDefaultEditPolicies() {
	super.createDefaultEditPolicies();
	installEditPolicy(EditPolicy.COMPONENT_ROLE, new TransitionExpressionComponentEditPolicy());
	installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ContextSensitiveHelpPolicy(
			HelpContextIds.SC_PROPERTIES_TRANSITION_EXPRESSION));
	// BUGFIX:
	// https://code.google.com/a/eclipselabs.org/p/yakindu/issues/detail?id=26
	installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableLabelEditPolicy() {
		@Override
		protected void replaceHandleDragEditPartsTracker(Handle handle) {
			if (handle instanceof AbstractHandle) {
				AbstractHandle h = (AbstractHandle) handle;
				h.setDragTracker(new DragEditPartsTrackerEx(getHost()) {
					protected boolean isMove() {
						return true;
					};
				});
			}
		}
	});
}
 
Example #2
Source File: TableSelectionGuideTracker.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
	 * Updates the target editpart and returns <code>true</code> if the target changes.  The
	 * target is updated by using the target conditional and the target request.  If the
	 * target has been locked, this method does nothing and returns <code>false</code>.
	 * @return <code>true</code> if the target was changed
	 */
//	protected EditPart getEditPartUnderMouse() {
//		
//			Collection exclude = getExclusionSet();
//			EditPart editPart = getCurrentViewer().findObjectAtExcluding(
//				getLocation(),
//				exclude,
//				getTargetingConditional());
//			if (editPart != null)
//				return editPart.getTargetEditPart(getTargetRequest());
//			return null;
//			
//	}
	protected Handle getHandleUnderMouse()
	{
		return ((DeferredGraphicalViewer)(getSourceEditPart().getViewer())).findHandleAt(getLocation());
	}
 
Example #3
Source File: DeferredGraphicalViewer.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see GraphicalViewer#findHandleAt(org.eclipse.draw2d.geometry.Point)
 */
public Handle findHandleAt( Point p )
{
	LayerManager layermanager = (LayerManager) getEditPartRegistry( ).get( LayerManager.ID );
	if ( layermanager == null )
		return null;
	List list = new ArrayList( 3 );
	// list.add(layermanager.getLayer(LayerConstants.PRIMARY_LAYER));
	list.add( layermanager.getLayer( LayerConstants.CONNECTION_LAYER ) );
	list.add( layermanager.getLayer( LayerConstants.FEEDBACK_LAYER ) );
	IFigure handle = getLightweightSystem( ).getRootFigure( )
			.findFigureAtExcluding( p.x, p.y, list );
	if ( handle instanceof Handle )
		return (Handle) handle;
	return null;
}
 
Example #4
Source File: ReportResizableHandleKit.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
static Handle createHandle( GraphicalEditPart owner, int direction,
		DragTracker tracker, Cursor cursor )
{
	ReportResizeHandle handle = new ReportResizeHandle( owner, direction );
	handle.setDragTracker( tracker );
	handle.setCursor( cursor );
	return handle;
}
 
Example #5
Source File: RowTracker.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public boolean isDealwithDrag( )
{
	Handle handle = getHandleUnderMouse( );
	if ( handle instanceof RowHandle )
	{
		return ( (RowHandle) handle ).getOwner( ) == getSourceEditPart( );
	}
	return false;
	// EditPart part = getEditPartUnderMouse();
	// return part instanceof TableEditPart.DummyColumnEditPart ||
	// isSameTable();
}
 
Example #6
Source File: ColumnTracker.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public boolean isDealwithDrag( )
{
	Handle handle = getHandleUnderMouse( );
	if ( handle instanceof ColumnHandle )
	{
		return ( (ColumnHandle) handle ).getOwner( ) == getSourceEditPart( );
	}
	return false;
	// EditPart part = getEditPartUnderMouse();
	// return part instanceof TableEditPart.DummyColumnEditPart ||
	// isSameTable();
}
 
Example #7
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,
		DragTracker tracker, Cursor cursor )
{
	ReportResizeHandle handle = new ReportResizeHandle( owner, direction );
	handle.setCursor( cursor );
	handle.setDragTracker( tracker );
	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: 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 #10
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 #11
Source File: ReportResizableHandleKit.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
static Handle createHandle( GraphicalEditPart owner, int direction )
{
	ReportResizeHandle handle = new ReportResizeHandle( owner, direction );
	// handle.setDragTracker(new ResizeTracker(direction));
	return handle;
}
 
Example #12
Source File: NodeElementSelectionEditPolicy.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
static Handle createHandle(final GraphicalEditPart owner, final int direction) {
    final ResizeHandle handle = new ERDiagramResizeHandle(owner, direction);
    return handle;
}
 
Example #13
Source File: TableHandleKit.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
static Handle createRowHandle( TableEditPart owner )
{
	TableRowHandle handle = new TableRowHandle( owner );
	return handle;

}
 
Example #14
Source File: TableHandleKit.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
static Handle createColumnHandle( TableEditPart owner )
{
	TableColumnHandle handle = new TableColumnHandle( owner );
	return handle;

}
 
Example #15
Source File: DiagramWalkerSelectionEditPolicy.java    From erflute with Apache License 2.0 4 votes vote down vote up
static Handle createHandle(GraphicalEditPart owner, int direction) {
    final ResizeHandle handle = new ERDiagramResizeHandle(owner, direction);
    return handle;
}
 
Example #16
Source File: NodeElementSelectionEditPolicy.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
static Handle createHandle(GraphicalEditPart owner, int direction) {
	ResizeHandle handle = new ERDiagramResizeHandle(owner, direction);
	return handle;
}
 
Example #17
Source File: ReportResizableHandleKit.java    From birt with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns a new {@link MoveHandle} with the given owner.
 * 
 * @param owner
 *            the GraphicalEditPart that is the owner of the new MoveHandle
 * @return the new MoveHandle
 */
public static Handle moveHandle( GraphicalEditPart owner )
{
	return new ReportMoveHandle( owner );
}
 
Example #18
Source File: ReportNonResizableHandleKit.java    From birt with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns a new {@link MoveHandle} with the given owner.
 * 
 * @param owner
 *            the GraphicalEditPart that is the owner of the new MoveHandle
 * @return the new MoveHandle
 */
public static Handle moveHandle( GraphicalEditPart owner )
{
	return new ReportMoveHandle( owner );
}