/** * Creates a new instance of ActivatedDocumentListener */ private ActivatedDocumentListener() { EditorRegistry.addPropertyChangeListener(this); }
/** Collapse all existing folds in the document. */ @EditorActionRegistration(name = BaseKit.collapseAllFoldsAction, menuText = "#" + BaseKit.collapseAllFoldsAction + "_menu_text") public static class CollapseAllFolds extends LocalBaseAction { public CollapseAllFolds(){ } public void actionPerformed(ActionEvent evt, JTextComponent target) { FoldHierarchy hierarchy = FoldHierarchy.get(target); // Hierarchy locking done in the utility method FoldUtilities.collapseAll(hierarchy); } }
public int[] getHyperlinkSpan(Document doc, int offset) { JTextComponent target = EditorRegistry.lastFocusedComponent(); final StyledDocument styledDoc = (StyledDocument) target.getDocument(); if (styledDoc == null) { return null; } // Return the position, which was set in the isHyperlink method: return new int[]{startOffset, endOffset}; }
public static JTextComponent findEditor(Document doc) { JTextComponent comp = EditorRegistry.lastFocusedComponent(); if (comp.getDocument() == doc) { return comp; } List<? extends JTextComponent> componentList = EditorRegistry.componentList(); for (JTextComponent component : componentList) { if (comp.getDocument() == doc) { return comp; } } return null; }
@Override public Component getEditorComponent() { FileObject file = EditorContextDispatcher.getDefault().getMostRecentFile(); int line = EditorContextDispatcher.getDefault().getMostRecentLineNumber(); if (file != null && line != -1) { DialogBinding.bindComponentToFile(file, line, 0, 0, pane); } return pane; }
@Override public void run() { JTextComponent component = EditorRegistry.focusedComponent(); if (component != null) { DocumentPreprocessor.updateBlockChain((NbEditorDocument) component.getDocument()); } } });
/** TODO - MOVE TO UTILITTY LIBRARY */ private static JTextComponent findEditor(Document doc) { JTextComponent comp = EditorRegistry.lastFocusedComponent(); if (comp.getDocument() == doc) { return comp; } List<? extends JTextComponent> componentList = EditorRegistry.componentList(); for (JTextComponent component : componentList) { if (comp.getDocument() == doc) { return comp; } } return null; }
private void insertLinkToEditor() { if (EditorRegistry.lastFocusedComponent() != null) { new InsertLinkAction(EditorRegistry.lastFocusedComponent(), outbox, true, false).actionPerformed(null); } }
private OpenedEditors() { EditorRegistry.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { stateChanged(); } }); }
@NbBundle.Messages("complete-line-newline=Complete Line and Create New Line") @EditorActionRegistration( name = CompleteLineNewLine.ACTION_NAME, mimeType = FileUtils.PHP_MIME_TYPE, shortDescription = "#complete-line-newline" ) public static class CompleteLineNewLine extends InsertSemicolonAction { static final String ACTION_NAME = "complete-line-newline"; //NOI18N public CompleteLineNewLine() { super(NewLineProcessor.WITH_NEW_LINE); } }
static CompletionTask createDocTask(ElementHandle element, CompilationInfo info) { // TODO - use ComObjectHandle ?? JavaCompletionQuery query = new JavaCompletionQuery(DOCUMENTATION_QUERY_TYPE, -1); query.element = element; //return new AsyncCompletionTask(query, Registry.getMostActiveComponent()); return new AsyncCompletionTask(query, EditorRegistry.lastFocusedComponent()); }
public FakeHighlightsFactory() { EditorRegistry.addPropertyChangeListener(this); }
/** Expand all existing folds in the document. */ @EditorActionRegistration(name = BaseKit.expandAllFoldsAction, menuText = "#" + BaseKit.expandAllFoldsAction + "_menu_text") public static class ExpandAllFolds extends LocalBaseAction { public ExpandAllFolds(){ } public void actionPerformed(ActionEvent evt, JTextComponent target) { FoldHierarchy hierarchy = FoldHierarchy.get(target); // Hierarchy locking done in the utility method FoldUtilities.expandAll(hierarchy); } }
@Override public CompletionTask createDocumentationTask() { return new AsyncCompletionTask(new JavaElementDocQuery(elemHandle), EditorRegistry.lastFocusedComponent()); } }
private EditorRegistryListener () { EditorRegistry.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { editorRegistryChanged(); } }); editorRegistryChanged(); }
@NbBundle.Messages("complete-line=Complete Line") @EditorActionRegistration( name = CompleteLine.ACTION_NAME, mimeType = FileUtils.PHP_MIME_TYPE, shortDescription = "#complete-line" ) public static class CompleteLine extends InsertSemicolonAction { static final String ACTION_NAME = "complete-line"; //NOI18N public CompleteLine() { super(NewLineProcessor.WITHOUT_NEW_LINE); } } }
public EditorRegistryListener() { EditorRegistry.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { editorRegistryChanged(); } }); editorRegistryChanged(); }
@EditorActionRegistration(name = "toggle-outline-view", menuPath = "View", menuPosition = 1000, preferencesKey = Options.KEY_OUTLINE, preferencesDefault = Options.DEFAULT_OUTLINE ) @NbBundle.Messages("toggle-outline-view=Show O&utline") public class MenuAction extends javax.swing.AbstractAction { @Override public void actionPerformed(ActionEvent e) { } }
private void attachListener() { if (listens.compareAndSet(false, true)) { EditorRegistry.addPropertyChangeListener(WeakListeners.propertyChange(this, EditorRegistry.class)); } }
@EditorActionRegistration(name = ExtKit.toggleCommentAction, mimeType = PHP_MIME_TYPE) public static ToggleBlockCommentAction create(Map<String, ?> attrs) { return new ToggleBlockCommentAction(attrs); }