Java Code Examples for org.netbeans.editor.Utilities#requestFocus()
The following examples show how to use
org.netbeans.editor.Utilities#requestFocus() .
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: JspPaletteActions.java From netbeans with Apache License 2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { ActiveEditorDrop drop = (ActiveEditorDrop) item.lookup(ActiveEditorDrop.class); JTextComponent target = Utilities.getFocusedComponent(); if (target == null) { String msg = NbBundle.getMessage(JspPaletteActions.class, "MSG_ErrorNoFocusedDocument"); DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); return; } try { drop.handleTransfer(target); } finally { Utilities.requestFocus(target); } try { PaletteController pc = JspPaletteFactory.getPalette(); pc.clearSelection(); } catch (IOException ioe) { //should not occur } }
Example 2
Source File: PHPPaletteActions.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent event) { ActiveEditorDrop drop = (ActiveEditorDrop) item.lookup(ActiveEditorDrop.class); JTextComponent target = Utilities.getFocusedComponent(); if (target == null) { String msg = NbBundle.getMessage(PHPPaletteActions.class, "MSG_ErrorNoFocusedDocument"); DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); return; } if (drop == null) { Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.INFO, "{0} doesn''t provide {1}", new Object[]{item.getClass(), ActiveEditorDrop.class}); //NOI18N return; } try { drop.handleTransfer(target); } finally { Utilities.requestFocus(target); } try { PaletteController paletteController = PHPPaletteFactory.getPalette(); paletteController.clearSelection(); } catch (IOException ioe) { Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.INFO, null, ioe); } }
Example 3
Source File: TwigPaletteFactory.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages("TwigPaletteInsertAction.ErrorNoFocusedDocument=No document selected. Please select a document to insert the item into.") @Override public void actionPerformed(ActionEvent event) { ActiveEditorDrop drop = item.lookup(ActiveEditorDrop.class); JTextComponent target = Utilities.getFocusedComponent(); if (target == null) { String msg = Bundle.TwigPaletteInsertAction_ErrorNoFocusedDocument(); DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); return; } if (drop == null) { Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.INFO, "{0} doesn''t provide {1}", new Object[]{item.getClass(), ActiveEditorDrop.class}); //NOI18N return; } try { drop.handleTransfer(target); } finally { Utilities.requestFocus(target); } try { PaletteController paletteController = TwigPaletteFactory.createPalette(); paletteController.clearSelection(); } catch (IOException ioe) { Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.INFO, null, ioe); } }
Example 4
Source File: ToolTipSupport.java From netbeans with Apache License 2.0 | 5 votes |
public @Override void actionPerformed(ActionEvent e) { ToolTipSupport.this.setToolTipVisible(false); JTextComponent jtc = extEditorUI.getComponent(); if (jtc != null) { Utilities.requestFocus(jtc); } }
Example 5
Source File: HtmlPaletteActions.java From netbeans with Apache License 2.0 | 5 votes |
public void actionPerformed(ActionEvent e) { ActiveEditorDrop drop = (ActiveEditorDrop) item.lookup(ActiveEditorDrop.class); JTextComponent target = Utilities.getFocusedComponent(); if (target == null) { String msg = NbBundle.getMessage(HtmlPaletteActions.class, "MSG_ErrorNoFocusedDocument"); //NOI18N DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); return; } try { drop.handleTransfer(target); } finally { Utilities.requestFocus(target); } try { FileObject fo = DataLoadersBridge.getDefault().getFileObject(target); if(fo != null) { PaletteController pc = HtmlPaletteFactory.getPalette(fo.getMIMEType()); pc.clearSelection(); } } catch (IOException ignored) { } }