コード例 #1
0
  private void initEditor() {
    myEditor =
        new EditorComboBoxEditor(getProject(), getEditorsProvider().getFileType()) {
          @Override
          public void setItem(Object anObject) {
            if (anObject == null) {
              anObject = XExpressionImpl.EMPTY_EXPRESSION;
            }
            XExpression expression = (XExpression) anObject;
            getEditorComponent()
                .setNewDocumentAndFileType(getFileType(expression), createDocument(expression));
          }

          @Override
          protected void onEditorCreate(EditorEx editor) {
            editor.putUserData(DebuggerCopyPastePreprocessor.REMOVE_NEWLINES_ON_PASTE, true);
            editor.getColorsScheme().setEditorFontSize(myComboBox.getFont().getSize());
          }
        };
    myEditor.getEditorComponent().setFontInheritedFromLAF(false);
    myComboBox.setEditor(myEditor);
    // myEditor.setItem(myExpression);
    myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));
    myComboBox.setMaximumRowCount(XDebuggerHistoryManager.MAX_RECENT_EXPRESSIONS);
  }
コード例 #2
0
  @Override
  protected void doSetText(XExpression text) {
    if (myComboBox.getItemCount() > 0) {
      myComboBox.setSelectedIndex(0);
    }

    // if (myComboBox.isEditable()) {
    myEditor.setItem(text);
    // }
    myExpression = text;
  }
コード例 #3
0
 @Override
 public XExpression getExpression() {
   Object document = myEditor.getItem();
   if (document instanceof Document) { // sometimes null on Mac
     return getEditorsProvider()
         .createExpression(
             getProject(),
             (Document) document,
             myExpression.getLanguage(),
             myExpression.getMode());
   }
   return myExpression;
 }
コード例 #4
0
 public JComponent getEditorComponent() {
   return myEditor.getEditorComponent();
 }
コード例 #5
0
 @Nullable
 public Editor getEditor() {
   return myEditor.getEditor();
 }