Search in sources :

Example 1 with CodeFragmentInputComponent

use of com.intellij.xdebugger.impl.evaluate.CodeFragmentInputComponent in project intellij-community by JetBrains.

the class XDebuggerEditorBase method showCodeFragmentEditor.

private void showCodeFragmentEditor(Component parent, XDebuggerEditorBase baseEditor) {
    DialogWrapper dialog = new DialogWrapper(parent, true) {

        CodeFragmentInputComponent inputComponent = new CodeFragmentInputComponent(baseEditor.getProject(), baseEditor.getEditorsProvider(), mySourcePosition, XExpressionImpl.changeMode(baseEditor.getExpression(), EvaluationMode.CODE_FRAGMENT), null, null);

        {
            setTitle("Edit");
            init();
        }

        @Nullable
        @Override
        protected String getDimensionServiceKey() {
            return "#xdebugger.code.fragment.editor";
        }

        @Nullable
        @Override
        protected JComponent createCenterPanel() {
            JPanel component = inputComponent.getMainComponent();
            component.setPreferredSize(JBUI.size(300, 200));
            return component;
        }

        @Override
        protected void doOKAction() {
            super.doOKAction();
            baseEditor.setExpression(inputComponent.getInputEditor().getExpression());
            JComponent component = baseEditor.getPreferredFocusedComponent();
            if (component != null) {
                IdeFocusManager.findInstance().requestFocus(component, false);
            }
        }

        @Nullable
        @Override
        public JComponent getPreferredFocusedComponent() {
            return inputComponent.getInputEditor().getPreferredFocusedComponent();
        }
    };
    dialog.show();
}
Also used : CodeFragmentInputComponent(com.intellij.xdebugger.impl.evaluate.CodeFragmentInputComponent) DialogWrapper(com.intellij.openapi.ui.DialogWrapper)

Aggregations

DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 CodeFragmentInputComponent (com.intellij.xdebugger.impl.evaluate.CodeFragmentInputComponent)1