@Override
  public void keyPressed(final KeyEvent e) {
    if (!(e.isAltDown() || e.isMetaDown() || e.isControlDown() || myPanel.isNodePopupActive())) {
      if (!Character.isLetter(e.getKeyChar())) {
        return;
      }

      final IdeFocusManager focusManager = IdeFocusManager.getInstance(myPanel.getProject());
      final ActionCallback firstCharTyped = new ActionCallback();
      focusManager.typeAheadUntil(firstCharTyped);
      myPanel.moveDown();
      //noinspection SSBasedInspection
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              try {
                final Robot robot = new Robot();
                final boolean shiftOn = e.isShiftDown();
                final int code = e.getKeyCode();
                if (shiftOn) {
                  robot.keyPress(KeyEvent.VK_SHIFT);
                }
                robot.keyPress(code);
                robot.keyRelease(code);

                // don't release Shift
                firstCharTyped.setDone();
              } catch (AWTException ignored) {
              }
            }
          });
    }
  }
  public void focusLost(final FocusEvent e) {
    if (myPanel.getProject().isDisposed()) {
      myPanel.setContextComponent(null);
      myPanel.hideHint();
      return;
    }
    final DialogWrapper dialog = DialogWrapper.findInstance(e.getOppositeComponent());
    shouldFocusEditor = dialog != null;
    if (dialog != null) {
      Disposer.register(
          dialog.getDisposable(),
          new Disposable() {
            @Override
            public void dispose() {
              if (dialog.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
                shouldFocusEditor = false;
              }
            }
          });
    }

    // required invokeLater since in current call sequence KeyboardFocusManager is not initialized
    // yet
    // but future focused component
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            processFocusLost(e);
          }
        });
  }
  private void setDataInternal(
      SmartPsiElementPointer element, String text, final Rectangle viewRect, boolean skip) {
    boolean justShown = false;

    myElement = element;

    if (!myIsShown && myHint != null) {
      myEditorPane.setText(text);
      applyFontSize();
      myManager.showHint(myHint);
      myIsShown = justShown = true;
    }

    if (!justShown) {
      myEditorPane.setText(text);
      applyFontSize();
    }

    if (!skip) {
      myText = text;
    }

    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            myEditorPane.scrollRectToVisible(viewRect);
          }
        });
  }
 public final void update() {
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           doUpdate();
         }
       });
 }
 public static void enableAction(final AnActionEvent event, final boolean enable) {
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           event.getPresentation().setEnabled(enable);
           event.getPresentation().setVisible(true);
         }
       });
 }
  void buildFinished(
      boolean isProgressAborted,
      long buildTimeInMilliseconds,
      @NotNull final AntBuildListener antBuildListener,
      OutputPacketProcessor dispatcher) {
    final boolean aborted = isProgressAborted || myIsAborted;
    final String message = getFinishStatusText(aborted, buildTimeInMilliseconds);

    dispatcher.processOutput(
        new Printable() {
          @Override
          public void printOn(Printer printer) {
            if (!myProject.isDisposed()) { // if not disposed
              addCommand(new FinishBuildCommand(message));
              final StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
              if (statusBar != null) {
                statusBar.setInfo(message);
              }
            }
          }
        });
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            if (!myIsOutputPaused) {
              new OutputFlusher().doFlush();
            }
            final AntBuildFileBase buildFile = myBuildFile;
            if (buildFile != null) {
              if (getErrorCount() == 0 && buildFile.isViewClosedWhenNoErrors()) {
                close();
              } else if (getErrorCount() > 0) {
                myTreeView.scrollToFirstError();
              } else {
                myTreeView.scrollToStatus();
              }
            } else {
              myTreeView.scrollToLastMessage();
            }
            VirtualFileManager.getInstance()
                .asyncRefresh(
                    new Runnable() {
                      public void run() {
                        antBuildListener.buildFinished(
                            aborted
                                ? AntBuildListener.ABORTED
                                : AntBuildListener.FINISHED_SUCCESSFULLY,
                            getErrorCount());
                      }
                    });
          }
        });
  }
Esempio n. 7
0
 private void startEditingAtSelection() {
   myTable.editCellAt(myTable.getSelectedRow(), 2);
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           if (myTable.isEditing()) {
             myTable.getEditorComponent().requestFocus();
           }
         }
       });
 }
 public void removeProgressPanel() {
   if (myProgressPanel != null) {
     myMessagePanel.remove(myProgressPanel);
     // fix of 9377
     SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
             myMessagePanel.validate();
           }
         });
     myProgressPanel = null;
   }
 }
 private void treeSelectionChanged() {
   SwingUtilities.invokeLater(
       new Runnable() {
         @Override
         public void run() {
           if (isDisposed) return;
           List<UsageInfo> infos = getSelectedUsageInfos();
           if (infos != null && myUsagePreviewPanel != null) {
             myUsagePreviewPanel.updateLayout(infos);
           }
         }
       });
 }
 private void setToComponent(final JComponent cmp, final boolean requestFocus) {
   myMatchingCountPanel.removeAll();
   myMatchingCountPanel.add(cmp, BorderLayout.CENTER);
   myMatchingCountPanel.revalidate();
   myMatchingCountPanel.repaint();
   if (requestFocus) {
     SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
             myPatternField.getTextField().requestFocusInWindow();
           }
         });
   }
 }
Esempio n. 11
0
      @Override
      public void windowActivated(final WindowEvent e) {
        SwingUtilities.invokeLater(
            new Runnable() {
              @Override
              public void run() {
                final DialogWrapper wrapper = getActiveWrapper();
                if (wrapper == null && !myFocusedCallback.isProcessed()) {
                  myFocusedCallback.setRejected();
                  myTypeAheadDone.setRejected();
                  return;
                }

                if (myActivated) {
                  return;
                }
                myActivated = true;
                JComponent toFocus =
                    wrapper == null ? null : wrapper.getPreferredFocusedComponent();
                if (toFocus == null) {
                  toFocus = getRootPane().getDefaultButton();
                }

                moveMousePointerOnButton(getRootPane().getDefaultButton());
                setupSelectionOnPreferredComponent(toFocus);

                if (toFocus != null) {
                  final JComponent toRequest = toFocus;
                  SwingUtilities.invokeLater(
                      new Runnable() {
                        @Override
                        public void run() {
                          if (isShowing() && isActive()) {
                            getFocusManager().requestFocus(toRequest, true);
                            notifyFocused(wrapper);
                          }
                        }
                      });
                } else {
                  if (isShowing()) {
                    notifyFocused(wrapper);
                  }
                }
                if (myTypeAheadCallback != null) {
                  myTypeAheadCallback.setDone();
                }
              }
            });
      }
Esempio n. 12
0
 @Override
 public void windowOpened(WindowEvent e) {
   SwingUtilities.invokeLater(
       new Runnable() {
         @Override
         public void run() {
           myOpened = true;
           final DialogWrapper activeWrapper = getActiveWrapper();
           if (activeWrapper == null) {
             myFocusedCallback.setRejected();
             myTypeAheadDone.setRejected();
           }
         }
       });
 }
    @Override
    public void propertyChange(PropertyChangeEvent e) {
      boolean queueForDispose = getParent() == null;

      String name = e.getPropertyName();
      if (mySynchronized.contains(name)) return;

      mySynchronized.add(name);

      try {
        if (Presentation.PROP_VISIBLE.equals(name)) {
          final boolean visible = myPresentation.isVisible();
          if (!visible && SystemInfo.isMacSystemMenu && myPlace.equals(ActionPlaces.MAIN_MENU)) {
            setEnabled(false);
          } else {
            setVisible(visible);
          }
        } else if (Presentation.PROP_ENABLED.equals(name)) {
          setEnabled(myPresentation.isEnabled());
          updateIcon(myAction.getAction());
        } else if (Presentation.PROP_MNEMONIC_KEY.equals(name)) {
          setMnemonic(myPresentation.getMnemonic());
        } else if (Presentation.PROP_MNEMONIC_INDEX.equals(name)) {
          setDisplayedMnemonicIndex(myPresentation.getDisplayedMnemonicIndex());
        } else if (Presentation.PROP_TEXT.equals(name)) {
          setText(myPresentation.getText());
        } else if (Presentation.PROP_ICON.equals(name)
            || Presentation.PROP_DISABLED_ICON.equals(name)
            || SELECTED.equals(name)) {
          updateIcon(myAction.getAction());
        }
      } finally {
        mySynchronized.remove(name);
        if (queueForDispose) {
          // later since we cannot remove property listeners inside event processing
          //noinspection SSBasedInspection
          SwingUtilities.invokeLater(
              new Runnable() {
                @Override
                public void run() {
                  if (getParent() == null) {
                    uninstallSynchronizer();
                  }
                }
              });
        }
      }
    }
    public void run(@NotNull final ProgressIndicator indicator) {
      final SvnVcs17 vcs = SvnVcs17.getInstance(myProject);
      final SVNWCClient client = vcs.createWCClient();

      try {
        myBeforeRevisionValue = getBeforeRevisionValue(myChange, vcs);
        myAfterRevision = getAfterRevisionValue(myChange, vcs);

        myBeforeContent =
            getPropertyList(myChange.getBeforeRevision(), myBeforeRevisionValue, client);
        indicator.checkCanceled();
        // gets exactly WORKING revision property
        myAfterContent = getPropertyList(myChange.getAfterRevision(), myAfterRevision, client);
      } catch (SVNException exc) {
        myException = exc;
      }

      // since sometimes called from modal dialog (commit changes dialog)
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              if (myException != null) {
                Messages.showErrorDialog(myException.getMessage(), myErrorTitle);
                return;
              }
              if (myBeforeContent != null
                  && myAfterContent != null
                  && myBeforeRevisionValue != null
                  && myAfterRevision != null) {
                final SimpleDiffRequest diffRequest =
                    new SimpleDiffRequest(myProject, getDiffWindowTitle(myChange));
                if (compareRevisions(myBeforeRevisionValue, myAfterRevision) >= 0) {
                  // before ahead
                  diffRequest.setContents(
                      new SimpleContent(myAfterContent), new SimpleContent(myBeforeContent));
                  diffRequest.setContentTitles(
                      revisionToString(myAfterRevision), revisionToString(myBeforeRevisionValue));
                } else {
                  diffRequest.setContents(
                      new SimpleContent(myBeforeContent), new SimpleContent(myAfterContent));
                  diffRequest.setContentTitles(
                      revisionToString(myBeforeRevisionValue), revisionToString(myAfterRevision));
                }
                DiffManager.getInstance().getDiffTool().show(diffRequest);
              }
            }
          });
    }
  private void reset() {
    ApplicationManager.getApplication().assertIsDispatchThread();

    myUsageNodes.clear();
    myIsFirstVisibleUsageFound = false;

    myModel.reset();
    if (!myPresentation.isDetachedMode()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            @Override
            public void run() {
              if (isDisposed) return;
              TreeUtil.expand(myTree, 2);
            }
          });
    }
  }
Esempio n. 16
0
  @Override
  public void apply() throws ConfigurationException {
    for (Configurable each : myName2Config) {
      if (each instanceof BaseStructureConfigurable && each.isModified()) {
        ((BaseStructureConfigurable) each).checkCanApply();
      }
    }
    for (Configurable each : myName2Config) {
      if (each.isModified()) {
        each.apply();
      }
    }

    myContext.getDaemonAnalyzer().clearCaches();
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            BuildManager.getInstance().scheduleAutoMake();
          }
        });
  }
  private void selectInTree(VirtualFile[] array, boolean requestFocus, boolean updatePathNeeded) {
    myTreeIsUpdating = true;
    final List<VirtualFile> fileList = Arrays.asList(array);
    if (!Arrays.asList(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
      myFileSystemTree.select(
          array,
          () -> {
            if (!myFileSystemTree.areHiddensShown()
                && !Arrays.asList(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
              // try to select files in hidden folders
              myFileSystemTree.showHiddens(true);
              selectInTree(array, requestFocus, updatePathNeeded);
              return;
            }
            if (array.length == 1
                && !Arrays.asList(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
              // try to select a parent of a missed file
              VirtualFile parent = array[0].getParent();
              if (parent != null && parent.isValid()) {
                selectInTree(new VirtualFile[] {parent}, requestFocus, updatePathNeeded);
                return;
              }
            }

            reportFileNotFound();
            if (updatePathNeeded) {
              updatePathFromTree(fileList, true);
            }
            if (requestFocus) {
              //noinspection SSBasedInspection
              SwingUtilities.invokeLater(() -> myFileSystemTree.getTree().requestFocus());
            }
          });
    } else {
      reportFileNotFound();
      if (updatePathNeeded) {
        updatePathFromTree(fileList, true);
      }
    }
  }
 private void rulesChanged() {
   ApplicationManager.getApplication().assertIsDispatchThread();
   final ArrayList<UsageState> states = new ArrayList<UsageState>();
   captureUsagesExpandState(new TreePath(myTree.getModel().getRoot()), states);
   final List<Usage> allUsages = new ArrayList<Usage>(myUsageNodes.keySet());
   Collections.sort(allUsages, USAGE_COMPARATOR);
   final Set<Usage> excludedUsages = getExcludedUsages();
   reset();
   myBuilder.setGroupingRules(getActiveGroupingRules(myProject));
   myBuilder.setFilteringRules(getActiveFilteringRules(myProject));
   ApplicationManager.getApplication()
       .runReadAction(
           new Runnable() {
             @Override
             public void run() {
               for (Usage usage : allUsages) {
                 if (!usage.isValid()) {
                   continue;
                 }
                 if (usage instanceof MergeableUsage) {
                   ((MergeableUsage) usage).reset();
                 }
                 appendUsage(usage);
               }
             }
           });
   excludeUsages(excludedUsages.toArray(new Usage[excludedUsages.size()]));
   if (myCentralPanel != null) {
     setupCentralPanel();
   }
   SwingUtilities.invokeLater(
       new Runnable() {
         @Override
         public void run() {
           if (isDisposed) return;
           restoreUsageExpandState(states);
           updateImmediately();
         }
       });
 }
 public void actionPerformed(AnActionEvent e) {
   DependenciesToolWindow.getInstance(myProject).closeContent(myContent);
   mySettings.copyToApplicationDependencySettings();
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           final List<AnalysisScope> scopes = new ArrayList<AnalysisScope>();
           for (DependenciesBuilder builder : myBuilders) {
             final AnalysisScope scope = builder.getScope();
             scope.invalidate();
             scopes.add(scope);
           }
           if (!myForward) {
             new BackwardDependenciesHandler(myProject, scopes, myScopeOfInterest, myExcluded)
                 .analyze();
           } else {
             new AnalyzeDependenciesHandler(myProject, scopes, myTransitiveBorder, myExcluded)
                 .analyze();
           }
         }
       });
 }
Esempio n. 20
0
  @Override
  @SuppressWarnings("SSBasedInspection")
  protected void dispose() {
    LOG.assertTrue(
        EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only");
    for (Runnable runnable : myDisposeActions) {
      runnable.run();
    }
    myDisposeActions.clear();
    final JRootPane root = myDialog.getRootPane();

    Runnable disposer =
        new Runnable() {
          @Override
          public void run() {
            myDialog.dispose();
            myProject = null;

            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    if (myDialog != null && root != null) {
                      myDialog.remove(root);
                    }
                  }
                });
          }
        };

    if (EventQueue.isDispatchThread()) {
      disposer.run();
    } else {
      SwingUtilities.invokeLater(disposer);
    }
  }
  protected ActionCallback _execute(final PlaybackContext context) {
    final String actionName = getText().substring(PREFIX.length()).trim();

    final ActionManager am = ActionManager.getInstance();
    final AnAction targetAction = am.getAction(actionName);
    if (targetAction == null) {
      dumpError(context, "Unknown action: " + actionName);
      return new ActionCallback.Rejected();
    }

    if (!context.isUseDirectActionCall()) {
      final Shortcut[] sc = KeymapManager.getInstance().getActiveKeymap().getShortcuts(actionName);
      KeyStroke stroke = null;
      for (Shortcut each : sc) {
        if (each instanceof KeyboardShortcut) {
          final KeyboardShortcut ks = (KeyboardShortcut) each;
          final KeyStroke first = ks.getFirstKeyStroke();
          final KeyStroke second = ks.getSecondKeyStroke();
          if (first != null && second == null) {
            stroke = KeyStroke.getKeyStroke(first.getKeyCode(), first.getModifiers(), false);
            break;
          }
        }
      }

      if (stroke != null) {
        final ActionCallback result =
            new TimedOutCallback(
                Registry.intValue("actionSystem.commandProcessingTimeout"),
                "Timed out calling action id=" + actionName,
                new Throwable(),
                true) {
              @Override
              protected void dumpError() {
                context.error(getMessage(), getLine());
              }
            };
        context.message("Invoking action via shortcut: " + stroke.toString(), getLine());

        final KeyStroke finalStroke = stroke;

        IdeFocusManager.getGlobalInstance()
            .doWhenFocusSettlesDown(
                new Runnable() {
                  @Override
                  public void run() {
                    final Ref<AnActionListener> listener = new Ref<AnActionListener>();
                    listener.set(
                        new AnActionListener.Adapter() {

                          @Override
                          public void beforeActionPerformed(
                              final AnAction action, DataContext dataContext, AnActionEvent event) {
                            SwingUtilities.invokeLater(
                                new Runnable() {
                                  @Override
                                  public void run() {
                                    if (context.isDisposed()) {
                                      am.removeAnActionListener(listener.get());
                                      return;
                                    }

                                    if (targetAction.equals(action)) {
                                      context.message(
                                          "Performed action: " + actionName,
                                          context.getCurrentLine());
                                      am.removeAnActionListener(listener.get());
                                      result.setDone();
                                    }
                                  }
                                });
                          }
                        });
                    am.addAnActionListener(listener.get());

                    context.runPooledThread(
                        new Runnable() {
                          @Override
                          public void run() {
                            type(context.getRobot(), finalStroke);
                          }
                        });
                  }
                });

        return result;
      }
    }

    final InputEvent input = getInputEvent(actionName);

    final ActionCallback result = new ActionCallback();

    context.getRobot().delay(Registry.intValue("actionSystem.playback.delay"));
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            am.tryToExecute(targetAction, input, null, null, false)
                .doWhenProcessed(result.createSetDoneRunnable());
          }
        });

    return result;
  }
  @Override
  public void actionPerformed(AnActionEvent event) {
    final Project project = event.getData(CommonDataKeys.PROJECT);

    LOG.assertTrue(project != null);

    final FileChooserDescriptor descriptor =
        new FileChooserDescriptor(false, true, false, false, false, false) {
          @Override
          public Icon getIcon(VirtualFile file) {
            if (file.isDirectory()) {
              if (file.findChild(
                      InspectionApplication.DESCRIPTIONS
                          + "."
                          + StdFileTypes.XML.getDefaultExtension())
                  != null) {
                return AllIcons.Nodes.InspectionResults;
              }
            }
            return super.getIcon(file);
          }
        };
    descriptor.setTitle("Select Path");
    descriptor.setDescription("Select directory which contains exported inspections results");
    final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, null);
    if (virtualFile == null || !virtualFile.isDirectory()) return;

    final Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap = new HashMap<>();
    final String[] profileName = new String[1];
    final Runnable process =
        () -> {
          final VirtualFile[] files = virtualFile.getChildren();
          try {
            for (final VirtualFile inspectionFile : files) {
              if (inspectionFile.isDirectory()) continue;
              final String shortName = inspectionFile.getNameWithoutExtension();
              final String extension = inspectionFile.getExtension();
              if (shortName.equals(InspectionApplication.DESCRIPTIONS)) {
                profileName[0] =
                    ApplicationManager.getApplication()
                        .runReadAction(
                            (Computable<String>)
                                () ->
                                    OfflineViewParseUtil.parseProfileName(
                                        LoadTextUtil.loadText(inspectionFile).toString()));
              } else if (XML_EXTENSION.equals(extension)) {
                resMap.put(
                    shortName,
                    ApplicationManager.getApplication()
                        .runReadAction(
                            new Computable<Map<String, Set<OfflineProblemDescriptor>>>() {
                              @Override
                              public Map<String, Set<OfflineProblemDescriptor>> compute() {
                                return OfflineViewParseUtil.parse(
                                    LoadTextUtil.loadText(inspectionFile).toString());
                              }
                            }));
              }
            }
          } catch (final Exception e) { // all parse exceptions
            SwingUtilities.invokeLater(
                () ->
                    Messages.showInfoMessage(
                        e.getMessage(),
                        InspectionsBundle.message("offline.view.parse.exception.title")));
            throw new ProcessCanceledException(); // cancel process
          }
        };
    ProgressManager.getInstance()
        .runProcessWithProgressAsynchronously(
            project,
            InspectionsBundle.message("parsing.inspections.dump.progress.title"),
            process,
            () ->
                SwingUtilities.invokeLater(
                    () -> {
                      final String name = profileName[0];
                      showOfflineView(
                          project,
                          name,
                          resMap,
                          InspectionsBundle.message("offline.view.title")
                              + " ("
                              + (name != null
                                  ? name
                                  : InspectionsBundle.message("offline.view.editor.settings.title"))
                              + ")");
                    }),
            null,
            new PerformAnalysisInBackgroundOption(project));
  }
Esempio n. 23
0
  @SuppressWarnings({"SSBasedInspection"})
  public void applyFix(
      @NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
    Runnable fix =
        new Runnable() {
          public void run() {
            DictionarySuggestionProvider provider = findProvider();
            if (provider != null) {
              provider.setActive(true);
            }

            Editor editor = getEditorFromFocus();
            HashMap<String, Object> map = new HashMap<String, Object>();
            PsiElement psiElement = descriptor.getPsiElement();
            if (psiElement == null) return;
            PsiFile containingFile = psiElement.getContainingFile();
            if (editor == null) {
              editor = InjectedLanguageUtil.openEditorFor(containingFile, project);
            }

            if (editor == null) return;

            if (editor instanceof EditorWindow) {
              map.put(CommonDataKeys.EDITOR.getName(), editor);
              map.put(CommonDataKeys.PSI_ELEMENT.getName(), psiElement);
            } else if (ApplicationManager.getApplication()
                .isUnitTestMode()) { // TextEditorComponent / FiledEditorManagerImpl give away the
                                     // data in real life
              map.put(
                  CommonDataKeys.PSI_ELEMENT.getName(),
                  new TextEditorPsiDataProvider()
                      .getData(
                          CommonDataKeys.PSI_ELEMENT.getName(),
                          editor,
                          containingFile.getVirtualFile()));
            }

            final Boolean selectAll = editor.getUserData(RenameHandlerRegistry.SELECT_ALL);
            try {
              editor.putUserData(RenameHandlerRegistry.SELECT_ALL, true);
              DataContext dataContext =
                  SimpleDataContext.getSimpleContext(
                      map, DataManager.getInstance().getDataContext(editor.getComponent()));
              AnAction action = new RenameElementAction();
              AnActionEvent event =
                  new AnActionEvent(
                      null,
                      dataContext,
                      "",
                      action.getTemplatePresentation(),
                      ActionManager.getInstance(),
                      0);
              action.actionPerformed(event);
              if (provider != null) {
                provider.setActive(false);
              }
            } finally {
              editor.putUserData(RenameHandlerRegistry.SELECT_ALL, selectAll);
            }
          }
        };

    if (ApplicationManager.getApplication().isUnitTestMode()) fix.run();
    else SwingUtilities.invokeLater(fix); // TODO [shkate] this is hard to test!
  }