1

I have a Viewpart in Eclipse RCP which I am detaching using inbuild method. Now I have a button on that Detached ViewPart and Upon Clicking it window Size of Windows (in Which detached Viewpart is there) should increase but I can't find any API for the Same. Can Anyone Please Help ?

There is this one Question I found but still don't know how to do this Resize Eclipse RCP Part

Community
  • 1
  • 1
spt025
  • 2,134
  • 2
  • 20
  • 26

1 Answers1

2

You just need to set the size of the Shell containing the part.

For example, this command handler increases the size of the shell containing the active part by 100 pixels in each direction:

public class ResizeHandler extends AbstractHandler
{
  @Override
  public Object execute(final ExecutionEvent event) throws ExecutionException
  {
    // Get the active part

    IWorkbenchPart part = HandlerUtil.getActivePart(event);

    // Get the shell from the part site

    Shell shell = part.getSite().getShell();

    Point size = shell.getSize();

    // Set new size

    shell.setSize(size.x + 100, size.y + 100);

    return null;
  }  
}

Note: The question you linked to is talking about the new 'e4' API. Since you are asking about ViewPart you are using the 3.x compatibility API.

greg-449
  • 109,219
  • 232
  • 102
  • 145