public void unregisterShortcutKeys(@NotNull Editor editor) { EventFacade.getInstance().unregisterCustomShortcutSet(VimShortcutKeyAction.getInstance(), editor.getComponent()); }
/** * 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; }
public void registerRequiredShortcutKeys(@NotNull Editor editor) { final Set<KeyStroke> requiredKeys = VimPlugin.getKey().requiredShortcutKeys; EventFacade.getInstance().registerCustomShortcutSet(VimShortcutKeyAction.getInstance(), toShortcutSet(requiredKeys), editor.getComponent()); }
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); }); }
commandsPanel.add(commandsLabel, BorderLayout.NORTH); JComponent commandsComponent = commands.getComponent(); commandsComponent.setPreferredSize(new Dimension(0, 200)); commandsPanel.add(commandsComponent, BorderLayout.CENTER);
/** * 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(); }
splitter.setSecondComponent(preview.getComponent());
/** * 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); } }
final JScrollPane scrollPanel = ScrollPaneFactory.createScrollPane(outerEditor.getComponent()); scrollPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); scrollPanel.setPreferredSize(new Dimension(0, settings.getOuterIgnoreWrapperHeight()));
handleKey(editor, keyStroke, new EditorDataContext(editor), false); }, ModalityState.stateForComponent(editor.getComponent())));
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); } }
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; } }
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; }
@Override public void validateQuery() { try { String query = getQuery(); if (StringUtils.isEmpty(query)) { return; } JSON.parse(query); } catch (JSONParseException | NumberFormatException ex) { notifyOnErrorForOperator(editor.getComponent(), ex); } }
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); } }
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()); }
@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; }
@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; }
extractorDialog.setMinimumSize(new Dimension(600, 200)); extractorDialog.pack(); extractorDialog.setLocationRelativeTo(editor.getComponent()); extractorDialog.setVisible(true); extractorDialog.setIconImage(Symfony2Icons.getImage(Symfony2Icons.SYMFONY));
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; }