public void execute(ICustomContext context, SelectionDispatchAction action) {
    PictogramElement pe = context.getInnerPictogramElement();
    final ContainerShape pict = ((Shape) pe).getContainer();
    final PersistentType jpt = (PersistentType) getBusinessObjectForPictogramElement(pict);
    ICompilationUnit cu = getFeatureProvider().getCompilationUnit(jpt);
    StructuredSelection sel = new StructuredSelection(cu);
    final Semaphore s = new Semaphore(0);
    ShowBusy showBusy = new ShowBusy(s);
    JPASolver.ignoreEvents = true;

    try {
      configureRefactoringDialogSettingsToRenameVariables();
      action.run(sel);
    } catch (Exception e) {
    }
    BusyIndicator.showWhile(Display.getCurrent(), showBusy);
    JPASolver.ignoreEvents = false;
  }
 private void measure(PerformanceMeter performanceMeter, int runs) throws Exception {
   IPackagesViewPart view =
       (IPackagesViewPart)
           EditorTestHelper.getActivePage()
               .findViewReference(EditorTestHelper.PACKAGE_EXPLORER_VIEW_ID)
               .getView(false);
   IAction action =
       ((IViewSite) view.getSite()).getActionBars().getGlobalActionHandler(FORMAT_ACTION_ID);
   boolean wasEnabled = EditorTestHelper.setDialogEnabled(FORMAT_DIALOG_ID, false);
   StructuredSelection selection =
       new StructuredSelection(
           JavaCore.create(ResourceTestHelper.getProject(TextPluginTestSetup.PROJECT)));
   for (int i = 0; i < runs; i++) {
     performanceMeter.start();
     ((SelectionDispatchAction) action).run(selection);
     performanceMeter.stop();
     TextPluginTestSetup.createProjectFromZip();
   }
   EditorTestHelper.setDialogEnabled(FORMAT_DIALOG_ID, wasEnabled);
 }