Search in sources :

Example 1 with SingleConfigurableEditor

use of com.intellij.openapi.options.ex.SingleConfigurableEditor in project intellij-community by JetBrains.

the class CreateRendererAction method actionPerformed.

public void actionPerformed(@NotNull final AnActionEvent event) {
    final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(event.getDataContext());
    final List<JavaValue> values = ViewAsGroup.getSelectedValues(event);
    if (values.size() != 1) {
        return;
    }
    final JavaValue javaValue = values.get(0);
    final DebugProcessImpl process = debuggerContext.getDebugProcess();
    if (process == null) {
        return;
    }
    final Project project = event.getProject();
    process.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {

        public void threadAction() {
            Type type = javaValue.getDescriptor().getType();
            final String name = type != null ? type.name() : null;
            DebuggerUIUtil.invokeLater(() -> {
                final UserRenderersConfigurable ui = new UserRenderersConfigurable();
                ConfigurableBase<UserRenderersConfigurable, NodeRendererSettings> configurable = new ConfigurableBase<UserRenderersConfigurable, NodeRendererSettings>("reference.idesettings.debugger.typerenderers", DebuggerBundle.message("user.renderers.configurable.display.name"), "reference.idesettings.debugger.typerenderers") {

                    @NotNull
                    @Override
                    protected NodeRendererSettings getSettings() {
                        return NodeRendererSettings.getInstance();
                    }

                    @Override
                    protected UserRenderersConfigurable createUi() {
                        return ui;
                    }
                };
                SingleConfigurableEditor editor = new SingleConfigurableEditor(project, configurable);
                if (name != null) {
                    NodeRenderer renderer = NodeRendererSettings.getInstance().createCompoundTypeRenderer(name, name, null, null);
                    renderer.setEnabled(true);
                    ui.addRenderer(renderer);
                }
                editor.show();
            });
        }
    });
}
Also used : ConfigurableBase(com.intellij.openapi.options.ConfigurableBase) SingleConfigurableEditor(com.intellij.openapi.options.ex.SingleConfigurableEditor) JavaValue(com.intellij.debugger.engine.JavaValue) NotNull(org.jetbrains.annotations.NotNull) NodeRenderer(com.intellij.debugger.ui.tree.render.NodeRenderer) Project(com.intellij.openapi.project.Project) Type(com.sun.jdi.Type) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) NodeRendererSettings(com.intellij.debugger.settings.NodeRendererSettings) UserRenderersConfigurable(com.intellij.debugger.settings.UserRenderersConfigurable) DebuggerContextCommandImpl(com.intellij.debugger.engine.events.DebuggerContextCommandImpl)

Example 2 with SingleConfigurableEditor

use of com.intellij.openapi.options.ex.SingleConfigurableEditor in project intellij-community by JetBrains.

the class CloudAccountSelectionEditor method createAccount.

private void createAccount(ServerType<?> cloudType) {
    RemoteServer<?> newAccount = RemoteServersManager.getInstance().createServer(cloudType, generateServerName(cloudType));
    final Ref<Consumer<String>> errorConsumerRef = new Ref<>();
    SingleRemoteServerConfigurable configurable = new SingleRemoteServerConfigurable(newAccount, null, true) {

        @Override
        protected void setConnectionStatusText(boolean error, String text) {
            super.setConnectionStatusText(error, error ? "" : text);
            errorConsumerRef.get().consume(error ? text : null);
        }
    };
    if (!new SingleConfigurableEditor(myMainPanel, configurable, ShowSettingsUtilImpl.createDimensionKey(configurable), false) {

        {
            errorConsumerRef.set(s -> setErrorText(s, myMainPanel));
        }
    }.showAndGet()) {
        return;
    }
    newAccount.setName(configurable.getDisplayName());
    RemoteServersManager.getInstance().addServer(newAccount);
    AccountItem newAccountItem = new AccountItem(newAccount);
    myAccountComboBox.addItem(newAccountItem);
    myAccountComboBox.setSelectedItem(newAccountItem);
}
Also used : Ref(com.intellij.openapi.util.Ref) Consumer(com.intellij.util.Consumer) SingleConfigurableEditor(com.intellij.openapi.options.ex.SingleConfigurableEditor) SingleRemoteServerConfigurable(com.intellij.remoteServer.impl.configuration.SingleRemoteServerConfigurable)

Example 3 with SingleConfigurableEditor

use of com.intellij.openapi.options.ex.SingleConfigurableEditor in project intellij-community by JetBrains.

the class CustomizeContextViewAction method perform.

@Override
protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
    final Project project = e.getProject();
    final MyTabbedConfigurable configurable = new MyTabbedConfigurable();
    SingleConfigurableEditor editor = new SingleConfigurableEditor(project, configurable) {

        @Override
        protected void doOKAction() {
            //noinspection AssignmentToStaticFieldFromInstanceMethod
            ourLastSelectedTabIndex = configurable.getSelectedIndex();
            super.doOKAction();
        }

        @Override
        public void doCancelAction() {
            //noinspection AssignmentToStaticFieldFromInstanceMethod
            ourLastSelectedTabIndex = configurable.getSelectedIndex();
            super.doCancelAction();
        }
    };
    editor.show();
}
Also used : Project(com.intellij.openapi.project.Project) SingleConfigurableEditor(com.intellij.openapi.options.ex.SingleConfigurableEditor)

Example 4 with SingleConfigurableEditor

use of com.intellij.openapi.options.ex.SingleConfigurableEditor in project intellij-community by JetBrains.

the class RunDialog method editConfiguration.

public static boolean editConfiguration(final Project project, final RunnerAndConfigurationSettings configuration, final String title, @Nullable final Executor executor) {
    final SingleConfigurationConfigurable<RunConfiguration> configurable = SingleConfigurationConfigurable.editSettings(configuration, executor);
    final SingleConfigurableEditor dialog = new SingleConfigurableEditor(project, configurable, IdeModalityType.IDE) {

        {
            if (executor != null)
                setOKButtonText(executor.getActionName());
            if (executor != null)
                setOKButtonIcon(executor.getIcon());
        }
    };
    dialog.setTitle(title);
    return dialog.showAndGet();
}
Also used : RunConfiguration(com.intellij.execution.configurations.RunConfiguration) SingleConfigurableEditor(com.intellij.openapi.options.ex.SingleConfigurableEditor)

Example 5 with SingleConfigurableEditor

use of com.intellij.openapi.options.ex.SingleConfigurableEditor in project intellij-plugins by JetBrains.

the class KarmaRunConfigurationEditor method updatePreferredWidth.

private void updatePreferredWidth() {
    DialogWrapper dialogWrapper = DialogWrapper.findInstance(myRootComponent);
    if (dialogWrapper instanceof SingleConfigurableEditor) {
        // dialog for single run configuration
        myNodeInterpreterField.setPreferredWidthToFitText();
        myKarmaPackageField.setPreferredWidthToFitText();
        SwingHelper.setPreferredWidthToFitText(myConfigPathField);
        ApplicationManager.getApplication().invokeLater(() -> SwingHelper.adjustDialogSizeToFitPreferredSize(dialogWrapper), ModalityState.any());
    }
}
Also used : SingleConfigurableEditor(com.intellij.openapi.options.ex.SingleConfigurableEditor) DialogWrapper(com.intellij.openapi.ui.DialogWrapper)

Aggregations

SingleConfigurableEditor (com.intellij.openapi.options.ex.SingleConfigurableEditor)6 Project (com.intellij.openapi.project.Project)2 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 JavaValue (com.intellij.debugger.engine.JavaValue)1 DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1 NodeRendererSettings (com.intellij.debugger.settings.NodeRendererSettings)1 UserRenderersConfigurable (com.intellij.debugger.settings.UserRenderersConfigurable)1 NodeRenderer (com.intellij.debugger.ui.tree.render.NodeRenderer)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 ConfigurableBase (com.intellij.openapi.options.ConfigurableBase)1 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 Ref (com.intellij.openapi.util.Ref)1 SingleRemoteServerConfigurable (com.intellij.remoteServer.impl.configuration.SingleRemoteServerConfigurable)1 Consumer (com.intellij.util.Consumer)1 Type (com.sun.jdi.Type)1 NotNull (org.jetbrains.annotations.NotNull)1