com.intellij.openapi.editor.Editor.getComponent()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中com.intellij.openapi.editor.Editor.getComponent()方法的一些代码示例,展示了Editor.getComponent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Editor.getComponent()方法的具体详情如下:
包路径:com.intellij.openapi.editor.Editor
类名称:Editor
方法名:getComponent

Editor.getComponent介绍

暂无

代码示例

代码示例来源:origin: JetBrains/ideavim

public void unregisterShortcutKeys(@NotNull Editor editor) {
 EventFacade.getInstance().unregisterCustomShortcutSet(VimShortcutKeyAction.getInstance(), editor.getComponent());
}

代码示例来源:origin: hsz/idea-gitignore

/**
 * Factory method. It creates panel with dialog options. Options panel is located at the
 * center of the dialog's content pane. The implementation can return <code>null</code>
 * value. In this case there will be no options panel.
 *
 * @return center panel
 */
@Nullable
@Override
protected JComponent createCenterPanel() {
  final JPanel centerPanel = new JPanel(new BorderLayout());
  centerPanel.setPreferredSize(new Dimension(600, 300));
  previewDocument = EditorFactory.getInstance().createDocument(content);
  preview = Utils.createPreviewEditor(previewDocument, project, false);
  name = new JBTextField(IgnoreBundle.message("dialog.userTemplate.name.value"));
  JLabel nameLabel = new JLabel(IgnoreBundle.message("dialog.userTemplate.name"));
  nameLabel.setBorder(JBUI.Borders.emptyRight(10));
  JPanel namePanel = new JPanel(new BorderLayout());
  namePanel.add(nameLabel, BorderLayout.WEST);
  namePanel.add(name, BorderLayout.CENTER);
  JComponent previewComponent = preview.getComponent();
  previewComponent.setBorder(JBUI.Borders.emptyTop(10));
  centerPanel.add(namePanel, BorderLayout.NORTH);
  centerPanel.add(previewComponent, BorderLayout.CENTER);
  return centerPanel;
}

代码示例来源:origin: JetBrains/ideavim

public void registerRequiredShortcutKeys(@NotNull Editor editor) {
 final Set<KeyStroke> requiredKeys = VimPlugin.getKey().requiredShortcutKeys;
 EventFacade.getInstance().registerCustomShortcutSet(VimShortcutKeyAction.getInstance(),
                           toShortcutSet(requiredKeys), editor.getComponent());
}

代码示例来源:origin: JetBrains/ideavim

public void postKey(@NotNull KeyStroke stroke, @NotNull Editor editor) {
 final Component component = SwingUtilities.getAncestorOfClass(Window.class, editor.getComponent());
 final KeyEvent event = createKeyEvent(stroke, component);
 ApplicationManager.getApplication().invokeLater(() -> {
  if (logger.isDebugEnabled()) {
   logger.debug("posting " + event);
  }
  Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event);
 });
}

代码示例来源:origin: hsz/idea-gitignore

commandsPanel.add(commandsLabel, BorderLayout.NORTH);
JComponent commandsComponent = commands.getComponent();
commandsComponent.setPreferredSize(new Dimension(0, 200));
commandsPanel.add(commandsComponent, BorderLayout.CENTER);

代码示例来源:origin: hsz/idea-gitignore

/**
 * Shows or hides label and editor.
 *
 * @param enabled if true shows editor, else shows label
 */
public void setEnabled(boolean enabled) {
  if (enabled) {
    remove(this.label);
    add(this.preview.getComponent());
  } else {
    add(this.label);
    remove(this.preview.getComponent());
  }
  revalidate();
  repaint();
}

代码示例来源:origin: hsz/idea-gitignore

splitter.setSecondComponent(preview.getComponent());

代码示例来源:origin: JetBrains/ideavim

/**
 * Processes the Enter key by running the first successful action registered for "ENTER" keystroke.
 * <p>
 * If this is REPLACE mode we need to turn off OVERWRITE before and then turn OVERWRITE back on after sending the
 * "ENTER" key.
 *
 * @param editor  The editor to press "Enter" in
 * @param context The data context
 */
public void processEnter(@NotNull Editor editor, @NotNull DataContext context) {
 if (CommandState.getInstance(editor).getMode() == CommandState.Mode.REPLACE) {
  setInsertEditorState(editor, true);
 }
 final KeyStroke enterKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
 final List<AnAction> actions = VimPlugin.getKey().getActions(editor.getComponent(), enterKeyStroke);
 for (AnAction action : actions) {
  if (KeyHandler.executeAction(action, context)) {
   break;
  }
 }
 if (CommandState.getInstance(editor).getMode() == CommandState.Mode.REPLACE) {
  setInsertEditorState(editor, false);
 }
}

代码示例来源:origin: hsz/idea-gitignore

final JScrollPane scrollPanel = ScrollPaneFactory.createScrollPane(outerEditor.getComponent());
scrollPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
scrollPanel.setPreferredSize(new Dimension(0, settings.getOuterIgnoreWrapperHeight()));

代码示例来源:origin: JetBrains/ideavim

handleKey(editor, keyStroke, new EditorDataContext(editor), false);
}, ModalityState.stateForComponent(editor.getComponent())));

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public static void invokeServiceGenerator(@NotNull Project project, @NotNull PsiFile file, @NotNull PhpClass phpClass, @Nullable Editor editor) {
  if(editor != null) {
    SymfonyCreateService.create(editor.getComponent(), project, file, phpClass, editor);
  }
}

代码示例来源:origin: dboissier/mongo4idea

private JPanel createSubOperatorPanel(String title, Editor subOperatorEditor) {
    JPanel selectPanel = new JPanel();
    selectPanel.setLayout(new BorderLayout());
    NonOpaquePanel headPanel = new NonOpaquePanel();
    JLabel operatorLabel = new JLabel(title);
    headPanel.add(operatorLabel, BorderLayout.WEST);
    selectPanel.add(headPanel, BorderLayout.NORTH);
    selectPanel.add(subOperatorEditor.getComponent(), BorderLayout.CENTER);
    myUpdateAlarm.setActivationComponent(subOperatorEditor.getComponent());
    return selectPanel;
  }
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

private boolean invokeFile(Project project, Editor editor) {
  PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);
  if(file == null) {
    return false;
  }
  SymfonyCreateService.create(editor.getComponent(), project, file, editor);
  return true;
}

代码示例来源:origin: dboissier/mongo4idea

@Override
public void validateQuery() {
  try {
    String query = getQuery();
    if (StringUtils.isEmpty(query)) {
      return;
    }
    JSON.parse(query);
  } catch (JSONParseException | NumberFormatException ex) {
    notifyOnErrorForOperator(editor.getComponent(), ex);
  }
}

代码示例来源:origin: dboissier/mongo4idea

private void validateEditorQuery(Editor editor) {
  try {
    String query = getQueryFrom(editor);
    if (StringUtils.isEmpty(query)) {
      return;
    }
    JSON.parse(query);
  } catch (JSONParseException | NumberFormatException ex) {
    notifyOnErrorForOperator(editor.getComponent(), ex);
  }
}

代码示例来源:origin: dboissier/mongo4idea

private AggregatorPanel() {
  this.editor = createEditor();
  setLayout(new BorderLayout());
  NonOpaquePanel headPanel = new NonOpaquePanel();
  JLabel operatorLabel = new JLabel("Aggregation");
  headPanel.add(operatorLabel, BorderLayout.WEST);
  add(headPanel, BorderLayout.NORTH);
  add(this.editor.getComponent(), BorderLayout.CENTER);
  this.operatorCompletionAction = new OperatorCompletionAction(project, editor);
  myUpdateAlarm.setActivationComponent(this.editor.getComponent());
}

代码示例来源:origin: dboissier/mongo4idea

@Override
public MongoQueryOptions buildQueryOptions(String rowLimit) {
  MongoQueryOptions mongoQueryOptions = new MongoQueryOptions();
  try {
    mongoQueryOptions.setOperations(getQuery());
  } catch (JSONParseException ex) {
    notifyOnErrorForOperator(editor.getComponent(), ex);
  }
  if (StringUtils.isNotBlank(rowLimit)) {
    mongoQueryOptions.setResultLimit(Integer.parseInt(rowLimit));
  }
  return mongoQueryOptions;
}

代码示例来源:origin: dboissier/mongo4idea

@Override
public MongoQueryOptions buildQueryOptions(String rowLimit) {
  MongoQueryOptions mongoQueryOptions = new MongoQueryOptions();
  try {
    mongoQueryOptions.setFilter(getQueryFrom(selectEditor));
    mongoQueryOptions.setProjection(getQueryFrom(projectionEditor));
    mongoQueryOptions.setSort(getQueryFrom(sortEditor));
  } catch (JSONParseException ex) {
    notifyOnErrorForOperator(selectEditor.getComponent(), ex);
  }
  if (StringUtils.isNotBlank(rowLimit)) {
    mongoQueryOptions.setResultLimit(Integer.parseInt(rowLimit));
  } else {
    mongoQueryOptions.setResultLimit(MongoQueryOptions.NO_LIMIT);
  }
  return mongoQueryOptions;
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

extractorDialog.setMinimumSize(new Dimension(600, 200));
extractorDialog.pack();
extractorDialog.setLocationRelativeTo(editor.getComponent());
extractorDialog.setVisible(true);
extractorDialog.setIconImage(Symfony2Icons.getImage(Symfony2Icons.SYMFONY));

代码示例来源:origin: neueda/jetbrains-plugin-graph-database-support

private void releaseFileSpecificEditor(VirtualFile oldFile) {
  if (fileSpecificParamEditor != null) {
    // set params in fileSpecificParamDocument.addDocumentListener() listener is a more universal but worse solution:
    // gets triggered immediately, debounce required
    FileUtil.setParams(oldFile, fileSpecificParamEditor.getDocument().getText());
    graphConsoleView.getFileSpecificParametersTab().remove(fileSpecificParamEditor.getComponent());
    if (!fileSpecificParamEditor.isDisposed()) {
      EditorFactory.getInstance().releaseEditor(fileSpecificParamEditor);
    }
  }
  fileSpecificParamEditor = null;
}

相关文章