Posts tagged ‘snippet’

January 13, 2011

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