public void drop(JTextComponent target) { // if (target == null) { // String msg = NbBundle.getMessage(CodeClipItemNode.class, "MSG_ErrorNoFocusedDocument"); // DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); // return; // } ActiveEditorDrop drop = (ActiveEditorDrop) getLookup().lookup(ActiveEditorDrop.class); drop.handleTransfer(target); }
@Override public boolean importData(JComponent comp, Transferable t) { try { if (t.isDataFlavorSupported(ActiveEditorDrop.FLAVOR)){ Object obj = t.getTransferData(ActiveEditorDrop.FLAVOR); if (obj instanceof ActiveEditorDrop && comp instanceof JTextComponent){ boolean success = false; try { success = ((ActiveEditorDrop)obj).handleTransfer((JTextComponent)comp); } finally { requestFocus(comp); } return success; } } } catch (Exception exc){ exc.printStackTrace(); } return delegator.importData(comp, t); }
@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); } } }
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 } } }
JTextComponent editor = ((CloneableEditor) comp).getEditorPane(); if (aed != null && editor != null) { aed.handleTransfer(editor); } else { SceneManager.log(Level.SEVERE, "Paletter drop failed - could not obtain context."); //NOI18N