Open a Eclipse View zoomed

by Jay Jonas

public class MyOpenViewZoomedCmdHandler extends AbstractHandler {

    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {

        IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

        IWorkbenchPage page = window.getActivePage();

        try {

            // any view in your application
            IViewPart view = page.showView(MyView.VIEW_ID);

            if (!page.isPageZoomed()) {
                IWorkbenchPartReference ref = page.getReference(view);
                page.toggleZoom(ref);
            }
         } catch (PartInitException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return null;
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: