Java Code Examples for org.eclipse.gef.EditPartViewer#select()

The following examples show how to use org.eclipse.gef.EditPartViewer#select() . 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: ConnectionCreation.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected boolean handleButtonDown( int button )
{
	if ( this.isInState( STATE_INITIAL ) && button == 1 )
	{
		//Select the ColumnEditPart
		EditPartViewer viewer = this.getCurrentViewer( );
		viewer.select( getSourceEditPart( ) );

		this.updateTargetRequest( );
		this.updateTargetUnderMouse( );
		super.handleButtonDown( button );
		this.handleDrag( );
		return true;
	}
	return super.handleButtonDown( button );
}
 
Example 2
Source File: DeleteTableGroupAction.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void run( )
{
	if ( Policy.TRACING_ACTIONS )
	{
		System.out.println( "Delete table action >> Run ..." ); //$NON-NLS-1$
	}
	if ( getTableGroup( ) != null && getTableEditPart( ) != null )
	{
		TableEditPart part = getTableEditPart( );
		EditPartViewer viewer = part.getViewer( );
		part.removeGroup( getTableGroup( ) );
		viewer.select( part );
	}
}
 
Example 3
Source File: DeleteRowHandler.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object execute( ExecutionEvent event ) throws ExecutionException
{
	super.execute( event );

	TableEditPart part = getTableEditPart( );
	if ( part != null )
	{
		EditPartViewer viewer = part.getViewer( );
		part.deleteRow( getRowNumbers( ) );
		viewer.select( part );
	}

	return Boolean.TRUE;
}
 
Example 4
Source File: DeleteColumnHandler.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object execute( ExecutionEvent event ) throws ExecutionException
{
	super.execute( event );

	TableEditPart part = getTableEditPart( );
	if ( part != null )
	{
		EditPartViewer viewer = part.getViewer( );
		part.deleteColumn( getColumnNumbers( ) );
		viewer.select( part );
	}
	return Boolean.TRUE;
}
 
Example 5
Source File: ConnectionCreation.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void performSelection( )
{
	EditPartViewer viewer = this.getCurrentViewer( );
	viewer.select( getSourceEditPart( ) );
}
 
Example 6
Source File: CellDragTracker.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void performSelection( )
{
	if ( hasSelectionOccurred( ) )
		return;

	/**
	 * Hacks the old selection algorithm, checks the consistency of parents
	 * of selected objects.
	 */
	if ( getCurrentInput( ).isControlKeyDown( )
			|| getCurrentInput( ).isShiftKeyDown( ) )
	{
		setFlag( FLAG_SELECTION_PERFORMED, true );
		EditPartViewer viewer = getCurrentViewer( );
		List selectedObjects = viewer.getSelectedEditParts( );

		boolean consist = true;

		EditPart sourceParent = getSourceEditPart( ).getParent( );

		for ( Iterator itr = selectedObjects.iterator( ); itr.hasNext( ); )
		{
			EditPart part = (EditPart) itr.next( );

			if ( part.getParent( ) != sourceParent )
			{
				consist = false;
				break;
			}
		}

		if ( consist )
		{
			if ( getCurrentInput( ).isControlKeyDown( ) )
			{
				/**
				 * Does nothing, leaves it to performCtrlSelect().
				 */
				return;
			}
			else if ( getCurrentInput( ).isShiftKeyDown( ) )
			{
				/**
				 * Does nothing, leaves it to performShiftSelect().
				 */
				return;
			}
		}

		viewer.select( getSourceEditPart( ) );

		return;
	}

	super.performSelection( );
}
 
Example 7
Source File: DeleteGrouphandler.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Object execute( ExecutionEvent event ) throws ExecutionException
{
	super.execute( event );

	GroupHandle handle = null;

	ReportElementEditPart editPart = null;

	IEvaluationContext context = (IEvaluationContext) event.getApplicationContext( );
	Object obj =UIUtil.getVariableFromContext( context, ICommandParameterNameContants.DELETE_GROUP_HANDLE );
	if ( ( obj == null ) || ( !( obj instanceof GroupHandle ) ) )
	{
		return Boolean.FALSE;
	}
	handle = (GroupHandle) obj;

	obj = UIUtil.getVariableFromContext( context, ICommandParameterNameContants.DELETE_GROUP_EDIT_PART );
	if ( ( obj == null ) || ( !( obj instanceof ReportElementEditPart ) ) )
	{
		return Boolean.FALSE;
	}
	editPart = (ReportElementEditPart) obj;

	CommandStack stack = getActiveCommandStack( );
	stack.startTrans( STACK_MSG_DELETE_GROUP );

	if ( handle.canDrop( ) )
	{
		EditPartViewer viewer = editPart.getViewer( );
		try
		{
			handle.drop( );
			stack.commit( );
		}
		catch ( SemanticException e )
		{
			stack.rollbackAll( );
			ExceptionHandler.handle( e );
		}
		viewer.select( editPart );
	}

	return Boolean.TRUE;
}