@Override public void doCancelAction(final AWTEvent source) { if (source instanceof KeyEvent || source instanceof ActionEvent) { if (myEditor.getContext().isHoldingFilter()) { myEditor.clearFilter(); return; } } super.doCancelAction(source); }
@Override public void doOKAction() { myEditor.flushModifications(); if (myEditor.canApply()) { myEditor.apply(); if (!updateStatus()) return; } saveCurrentConfigurable(); ApplicationManager.getApplication().saveAll(); super.doOKAction(); }
@Override protected void doHelpAction() { final String topic = myEditor.getHelpTopic(); if (topic != null) { HelpManager.getInstance().invokeHelp(topic); } }
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; }
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; }
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 Object getData(@NonNls String dataId) { if (OptionsEditor.KEY.is(dataId)) { return myEditor; } return myEditor == null ? null : myEditor.getData(dataId); }
@Override public JComponent getPreferredFocusedComponent() { return myEditor.getPreferredFocusedComponent(); }