protected JComponent createCenterPanel() { myEditor = new OptionsEditor(myProject, myGroups, myPreselected); myEditor .getContext() .addColleague( new OptionsEditorColleague.Adapter() { @Override public ActionCallback onModifiedAdded(final Configurable configurable) { updateStatus(); return new ActionCallback.Done(); } @Override public ActionCallback onModifiedRemoved(final Configurable configurable) { updateStatus(); return new ActionCallback.Done(); } @Override public ActionCallback onErrorsChanged() { updateStatus(); return new ActionCallback.Done(); } }); Disposer.register(myDisposable, myEditor); return myEditor; }
@Override public void doCancelAction(final AWTEvent source) { if (source instanceof KeyEvent || source instanceof ActionEvent) { if (myEditor.getContext().isHoldingFilter()) { myEditor.clearFilter(); return; } } super.doCancelAction(source); }
private void saveCurrentConfigurable() { final Configurable current = myEditor.getContext().getCurrentConfigurable(); if (current == null) return; final PropertiesComponent props = PropertiesComponent.getInstance(myProject); if (current instanceof SearchableConfigurable) { props.setValue(LAST_SELECTED_CONFIGURABLE, ((SearchableConfigurable) current).getId()); } else { props.setValue(LAST_SELECTED_CONFIGURABLE, current.getClass().getName()); } }
public boolean updateStatus() { myApplyAction.setEnabled(myEditor.canApply()); final Map<Configurable, ConfigurationException> errors = myEditor.getContext().getErrors(); if (errors.size() == 0) { setErrorText(null); } else { String text = "Changes were not applied because of an error"; final String errorMessage = getErrorMessage(errors); if (errorMessage != null) { text += "<br>" + errorMessage; } setErrorText(text); } return errors.size() == 0; }