void () { myForm.getIcon().setText(null); myForm.getIcon().setIcon(Messages.getQuestionIcon()); myForm.getEditContextButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final HistoryElement selectedItem = myModel.getSelectedItem(); final Collection<Namespace> n; final Collection<Variable> v; if (selectedItem != null) { n = selectedItem.namespaces; v = selectedItem.variables; } else { n = Collections.emptySet(); v = Collections.emptySet(); } // FIXME final Collection<Namespace> namespaces = myNamespaceCache != null ? merge(myNamespaceCache, n, false) : n; final Set<String> unresolvedPrefixes = findUnresolvedPrefixes(); final EditContextDialog dialog = new EditContextDialog(myProject, unresolvedPrefixes, namespaces, v, myContextProvider); if (dialog.showAndGet()) { final Pair<Collection<Namespace>, Collection<Variable>> context = dialog.getContext(); final Collection<Namespace> newNamespaces = context.getFirst(); final Collection<Variable> newVariables = context.getSecond(); updateContext(newNamespaces, newVariables); SwingUtilities.invokeLater(() -> { final Editor editor = getEditor(); if (editor != null) { editor.getContentComponent().grabFocus(); } }); } } }); updateOkAction(); super.init(); }