com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider Java Examples

The following examples show how to use com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CppDebugProcess.java    From CppTools with Apache License 2.0 6 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider() {
  return new XDebuggerEditorsProvider() {
    @NotNull
    @Override
    public FileType getFileType() {
      return CppSupportLoader.CPP_FILETYPE;
    }

    @NotNull
    @Override
    public Document createDocument(@NotNull Project project, @NotNull String s, @Nullable XSourcePosition xSourcePosition, @NotNull EvaluationMode evaluationMode) {
      VirtualFile virtualFile = new LightVirtualFile("dummy.cpp", s);
      ICppCodeFragment file = new CppCodeFragment(new SingleRootFileViewProvider(PsiManager.getInstance(project), virtualFile, true));
      return PsiDocumentManager.getInstance(project).getDocument(file);
    }
  };
}
 
Example #2
Source File: CodeFragmentInputComponent.java    From consulo with Apache License 2.0 6 votes vote down vote up
public CodeFragmentInputComponent(final @Nonnull Project project,
                                  @Nonnull XDebuggerEditorsProvider editorsProvider,
                                  final @Nullable XSourcePosition sourcePosition,
                                  @Nullable XExpression statements,
                                  String splitterProportionKey,
                                  Disposable parentDisposable) {
  super(XDebuggerBundle.message("dialog.title.evaluate.code.fragment"));
  myMultilineEditor = new XDebuggerExpressionEditor(project, editorsProvider, "evaluateCodeFragment", sourcePosition,
                                                    statements != null ? statements : XExpressionImpl.EMPTY_CODE_FRAGMENT, true, true, false);
  myMainPanel = new JPanel(new BorderLayout());
  JPanel editorPanel = new JPanel(new BorderLayout());
  editorPanel.add(myMultilineEditor.getComponent(), BorderLayout.CENTER);
  DefaultActionGroup group = new DefaultActionGroup();
  group.add(new HistoryNavigationAction(false, IdeActions.ACTION_PREVIOUS_OCCURENCE, parentDisposable));
  group.add(new HistoryNavigationAction(true, IdeActions.ACTION_NEXT_OCCURENCE, parentDisposable));
  editorPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false).getComponent(), BorderLayout.EAST);
  //myMainPanel.add(new JLabel(XDebuggerBundle.message("xdebugger.label.text.code.fragment")), BorderLayout.NORTH);
  myMainPanel.add(editorPanel, BorderLayout.CENTER);
  if (statements != null) {
    myMultilineEditor.setExpression(statements);
  }
  mySplitterProportionKey = splitterProportionKey;
}
 
Example #3
Source File: MuleBreakpointType.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project)
{
    final XSourcePosition position = breakpoint.getSourcePosition();
    if (position == null)
    {
        return null;
    }

    final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
    if (file == null)
    {
        return null;
    }

    return new MuleDebuggerEditorsProvider();
}
 
Example #4
Source File: XDebuggerEvaluateActionHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void showDialog(@Nonnull XDebugSession session,
                               VirtualFile file,
                               XDebuggerEditorsProvider editorsProvider,
                               XStackFrame stackFrame,
                               XDebuggerEvaluator evaluator,
                               @Nonnull XExpression expression) {
  if (expression.getLanguage() == null) {
    Language language = null;
    if (stackFrame != null) {
      XSourcePosition position = stackFrame.getSourcePosition();
      if (position != null) {
        language = LanguageUtil.getFileLanguage(position.getFile());
      }
    }
    if (language == null && file != null) {
      language = LanguageUtil.getFileTypeLanguage(file.getFileType());
    }
    expression = new XExpressionImpl(expression.getExpression(), language, expression.getCustomInfo(), expression.getMode());
  }
  new XDebuggerEvaluationDialog(session, editorsProvider, evaluator, expression, stackFrame == null ? null : stackFrame.getSourcePosition()).show();
}
 
Example #5
Source File: XInspectDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
public XInspectDialog(@Nonnull Project project,
                      XDebuggerEditorsProvider editorsProvider,
                      XSourcePosition sourcePosition,
                      @Nonnull String name,
                      @Nonnull XValue value,
                      XValueMarkers<?, ?> markers) {
  super(project, false);

  setTitle(XDebuggerBundle.message("inspect.value.dialog.title", name));
  setModal(false);

  Pair<XValue, String> initialItem = Pair.create(value, name);
  XDebuggerTreeCreator creator = new XDebuggerTreeCreator(project, editorsProvider, sourcePosition, markers);
  myDebuggerTreePanel = new DebuggerTreeWithHistoryPanel<Pair<XValue, String>>(initialItem, creator, project);
  init();
}
 
Example #6
Source File: XBreakpointActionsPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void init(Project project, XBreakpointManager breakpointManager, @Nonnull XBreakpointBase breakpoint, @Nullable XDebuggerEditorsProvider debuggerEditorsProvider) {
  init(project, breakpointManager, breakpoint);
  if (debuggerEditorsProvider != null) {
    ActionListener listener = new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        onCheckboxChanged();
      }
    };
    myLogExpressionComboBox = new XDebuggerExpressionComboBox(project, debuggerEditorsProvider, LOG_EXPRESSION_HISTORY_ID, myBreakpoint.getSourcePosition(), true);
    JComponent logExpressionComponent = myLogExpressionComboBox.getComponent();
    myLogExpressionPanel.add(logExpressionComponent, BorderLayout.CENTER);
    myLogExpressionComboBox.setEnabled(false);
    myTemporaryCheckBox.setVisible(breakpoint instanceof XLineBreakpoint);
    myLogExpressionCheckBox.addActionListener(listener);
    DebuggerUIUtil.focusEditorOnCheck(myLogExpressionCheckBox, myLogExpressionComboBox.getEditorComponent());
  }
  else {
    myExpressionPanel.getParent().remove(myExpressionPanel);
  }
}
 
Example #7
Source File: WeaveBreakpointType.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project)
{
    final XSourcePosition position = breakpoint.getSourcePosition();
    if (position == null)
    {
        return null;
    }

    final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
    if (file == null)
    {
        return null;
    }

    return new WeaveDebuggerEditorsProvider();
}
 
Example #8
Source File: XDebuggerEditorBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected Document createDocument(final XExpression text) {
  XDebuggerEditorsProvider provider = getEditorsProvider();
  if (myContext != null && provider instanceof XDebuggerEditorsProviderBase) {
    return ((XDebuggerEditorsProviderBase)provider).createDocument(getProject(), text, myContext, myMode);
  }
  else {
    return provider.createDocument(getProject(), text, mySourcePosition, myMode);
  }
}
 
Example #9
Source File: XDebuggerTreeCreator.java    From consulo with Apache License 2.0 5 votes vote down vote up
public XDebuggerTreeCreator(@Nonnull Project project, XDebuggerEditorsProvider editorsProvider, XSourcePosition sourcePosition,
                            XValueMarkers<?, ?> markers) {
  myProject = project;
  myProvider = editorsProvider;
  myPosition = sourcePosition;
  myMarkers = markers;
}
 
Example #10
Source File: XVariablesViewBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected XVariablesViewBase(@Nonnull Project project, @Nonnull XDebuggerEditorsProvider editorsProvider, @Nullable XValueMarkers<?, ?> markers) {
  myTreePanel = new XDebuggerTreePanel(project, editorsProvider, this, null,
                                       this instanceof XWatchesView ? XDebuggerActions.WATCHES_TREE_POPUP_GROUP : XDebuggerActions.VARIABLES_TREE_POPUP_GROUP,
                                       markers);
  getTree().getEmptyText().setText(XDebuggerBundle.message("debugger.variables.not.available"));
  DnDManager.getInstance().registerSource(myTreePanel, getTree());
}
 
Example #11
Source File: XDebuggerTreePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public XDebuggerTreePanel(final @Nonnull Project project,
                          final @Nonnull XDebuggerEditorsProvider editorsProvider,
                          @Nonnull Disposable parentDisposable,
                          final @Nullable XSourcePosition sourcePosition,
                          @Nonnull @NonNls final String popupActionGroupId,
                          @Nullable XValueMarkers<?, ?> markers) {
  myTree = new XDebuggerTree(project, editorsProvider, sourcePosition, popupActionGroupId, markers);
  myMainPanel = new JPanel(new BorderLayout());
  myMainPanel.add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER);
  Disposer.register(parentDisposable, myTree);
  Disposer.register(parentDisposable, myMainPanel::removeAll);
}
 
Example #12
Source File: XQueryBreakpointType.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project) {
    final XSourcePosition position = breakpoint.getSourcePosition();
    if (position == null) {
        return null;
    }
    final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
    if (file == null) {
        return null;
    }
    return new XQueryEditorsProvider();
}
 
Example #13
Source File: XDebuggerExpressionEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public XDebuggerExpressionEditor(Project project,
                                 @Nonnull XDebuggerEditorsProvider debuggerEditorsProvider,
                                 @Nullable @NonNls String historyId,
                                 @Nullable XSourcePosition sourcePosition,
                                 @Nonnull XExpression text,
                                 final boolean multiline,
                                 boolean editorFont,
                                 boolean showEditor) {
  super(project, debuggerEditorsProvider, multiline ? EvaluationMode.CODE_FRAGMENT : EvaluationMode.EXPRESSION, historyId, sourcePosition);
  myExpression = XExpressionImpl.changeMode(text, getMode());
  myEditorTextField =
          new EditorTextField(createDocument(myExpression), project, debuggerEditorsProvider.getFileType(), false, !multiline) {
            @Override
            protected EditorEx createEditor() {
              final EditorEx editor = super.createEditor();
              editor.setVerticalScrollbarVisible(multiline);
              editor.getColorsScheme().setEditorFontName(getFont().getFontName());
              editor.getColorsScheme().setEditorFontSize(getFont().getSize());
              return editor;
            }

            @Override
            public Object getData(@Nonnull Key dataId) {
              if (LangDataKeys.CONTEXT_LANGUAGES == dataId) {
                return new Language[]{myExpression.getLanguage()};
              } else if (CommonDataKeys.PSI_FILE == dataId) {
                return PsiDocumentManager.getInstance(getProject()).getPsiFile(getDocument());
              }
              return super.getData(dataId);
            }
          };
  if (editorFont) {
    myEditorTextField.setFontInheritedFromLAF(false);
    myEditorTextField.setFont(EditorUtil.getEditorFont());
  }
  myComponent = decorate(myEditorTextField, multiline, showEditor);
}
 
Example #14
Source File: XDebuggerExpressionComboBox.java    From consulo with Apache License 2.0 5 votes vote down vote up
public XDebuggerExpressionComboBox(@Nonnull Project project, @Nonnull XDebuggerEditorsProvider debuggerEditorsProvider, @Nullable @NonNls String historyId,
                                   @Nullable XSourcePosition sourcePosition, boolean showEditor) {
  super(project, debuggerEditorsProvider, EvaluationMode.EXPRESSION, historyId, sourcePosition);
  myComboBox = new ComboBox<>(100);
  myComboBox.setEditable(true);
  myExpression = XExpressionImpl.EMPTY_EXPRESSION;
  Dimension minimumSize = new Dimension(myComboBox.getMinimumSize());
  minimumSize.width = 100;
  myComboBox.setMinimumSize(minimumSize);
  initEditor();
  fillComboBox();
  myComponent = showEditor ? addMultilineButton(myComboBox) : myComboBox;
}
 
Example #15
Source File: XDebuggerEditorBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected XDebuggerEditorBase(final Project project,
                              @Nonnull XDebuggerEditorsProvider debuggerEditorsProvider,
                              @Nonnull EvaluationMode mode,
                              @Nullable @NonNls String historyId,
                              final @Nullable XSourcePosition sourcePosition) {
  myProject = project;
  myDebuggerEditorsProvider = debuggerEditorsProvider;
  myMode = mode;
  myHistoryId = historyId;
  mySourcePosition = sourcePosition;

  myChooseFactory.setToolTipText(XDebuggerBundle.message("xdebugger.evaluate.language.hint"));
  myChooseFactory.setBorder(JBUI.Borders.empty(0, 3, 0, 3));
  new ClickListener() {
    @Override
    public boolean onClick(@Nonnull MouseEvent e, int clickCount) {
      if (myChooseFactory.isEnabled()) {
        ListPopup oldPopup = SoftReference.dereference(myPopup);
        if (oldPopup != null && !oldPopup.isDisposed()) {
          oldPopup.cancel();
          myPopup = null;
          return true;
        }
        ListPopup popup = createLanguagePopup();
        popup.showUnderneathOf(myChooseFactory);
        myPopup = new WeakReference<>(popup);
        return true;
      }
      return false;
    }
  }.installOn(myChooseFactory);
}
 
Example #16
Source File: BlazeCidrDebuggerSupportFactory.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public XDebuggerEditorsProvider createEditor(RunProfile profile) {
  if (profile instanceof BlazeCommandRunConfiguration
      && RunConfigurationUtils.canUseClionRunner((BlazeCommandRunConfiguration) profile)) {
    return createEditorProvider();
  }
  return null;
}
 
Example #17
Source File: BlazeAndroidNativeDebuggerLanguageSupport.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public XDebuggerEditorsProvider createEditor(RunProfile profile) {
  if (profile == null) {
    return new DebuggerEditorsProvider();
  }
  BlazeAndroidRunConfigurationHandler handler =
      BlazeAndroidRunConfigurationHandler.getHandlerFrom(profile);
  if (handler != null && handler.getCommonState().isNativeDebuggingEnabled()) {
    return new DebuggerEditorsProvider();
  }
  return null;
}
 
Example #18
Source File: XDebuggerEditorBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private Collection<Language> getSupportedLanguages() {
  XDebuggerEditorsProvider editorsProvider = getEditorsProvider();
  if (myContext != null && editorsProvider instanceof XDebuggerEditorsProviderBase) {
    return ((XDebuggerEditorsProviderBase)editorsProvider).getSupportedLanguages(myContext);
  }
  else {
    return editorsProvider.getSupportedLanguages(myProject, mySourcePosition);
  }
}
 
Example #19
Source File: XStandaloneVariablesView.java    From consulo with Apache License 2.0 4 votes vote down vote up
public XStandaloneVariablesView(@Nonnull Project project, @Nonnull XDebuggerEditorsProvider editorsProvider, @Nonnull XStackFrame stackFrame) {
  super(project, editorsProvider, null);
  myStackFrame = stackFrame;
  buildTreeAndRestoreState(stackFrame);
}
 
Example #20
Source File: XDebuggerTree.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public XDebuggerEditorsProvider getEditorsProvider() {
  return myEditorsProvider;
}
 
Example #21
Source File: XDebuggerEditorBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
public XDebuggerEditorsProvider getEditorsProvider() {
  return myDebuggerEditorsProvider;
}
 
Example #22
Source File: XLineBreakpointTypeBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
@javax.annotation.Nullable
@Override
public XDebuggerEditorsProvider getEditorsProvider(@Nonnull XLineBreakpoint<XBreakpointProperties> breakpoint, @Nonnull Project project) {
  return myEditorsProvider;
}
 
Example #23
Source File: XBreakpointType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public XDebuggerEditorsProvider getEditorsProvider(@Nonnull B breakpoint, @Nonnull Project project) {
  return getEditorsProvider();
}
 
Example #24
Source File: XBreakpointType.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated override {@link #getEditorsProvider(B, Project)} instead
 */
@Nullable
public XDebuggerEditorsProvider getEditorsProvider() {
  return null;
}
 
Example #25
Source File: XLineBreakpointTypeBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected XLineBreakpointTypeBase(@NonNls @Nonnull final String id, @Nls @Nonnull final String title, @Nullable XDebuggerEditorsProvider editorsProvider) {
  super(id, title);

  myEditorsProvider = editorsProvider;
}
 
Example #26
Source File: XQueryDebugProcess.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public XDebuggerEditorsProvider getEditorsProvider() {
    return new XQueryEditorsProvider();
}
 
Example #27
Source File: HaxeDebugProcess.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public XDebuggerEditorsProvider getEditorsProvider() {
  return new HaxeDebuggerEditorsProvider();
}
 
Example #28
Source File: HaxeDebugRunner.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
@NotNull
public XDebuggerEditorsProvider getEditorsProvider() {
  return new HaxeDebuggerEditorsProvider();
}
 
Example #29
Source File: HaxeBreakpointType.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider() {
  return myEditorProvider;
}
 
Example #30
Source File: SkylarkDebugProcess.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider() {
  return new SkylarkDebuggerEditorsProvider();
}