if (c!=null){ CompletionQuery.Result result = c.getLastResult(); int resultSize = (result == null) ? -1 : result.getData().size(); if (lastSize!=resultSize || !isVisible() || docv){ extEditorUI.getPopupManager().install(this);
if (c!=null){ CompletionQuery.Result result = c.getLastResult(); int resultSize = (result == null) ? -1 : result.getData().size(); if (lastSize!=resultSize || !isVisible() || docv){ extEditorUI.getPopupManager().install(this);
/** * Show result popup. Always called from AWT. */ protected void performResults() { // sample CompletionQuery.Result res = lastResult; if (res != null) { if (instantSubstitution && res.getData().size() == 1 && !isPaneVisible() && instantSubstitutionImpl(caretPos)) return; getPane().setTitle(res.getTitle()); getView().setResult(res); if (isPaneVisible()) { getJDCPopupPanel().refresh(); } else { getJDCPopupPanel().setCompletionVisible(true); } } else { getJDCPopupPanel().setCompletionVisible(false); if (!isKeyPressed()) { caretPos=-1; } else { setKeyPressed(false); } } }
/** * Show result popup. Always called from AWT. */ protected void performResults() { // sample CompletionQuery.Result res = lastResult; if (res != null) { if (instantSubstitution && res.getData().size() == 1 && !isPaneVisible() && instantSubstitution(caretPos)) return; getPane().setTitle(res.getTitle()); getView().setResult(res); if (isPaneVisible()) { getJDCPopupPanel().refresh(); } else { getJDCPopupPanel().setCompletionVisible(true); } } else { getJDCPopupPanel().setCompletionVisible(false); if (!isKeyPressed()) { caretPos=-1; } else { setKeyPressed(false); } } }
/** Substitute the document's text with the text * that is appopriate for the selection * in the view. This function is usually triggered * upon pressing the Enter key. * @return true if the substitution was performed * false if not. */ public synchronized boolean substituteText( boolean shift ) { trace("ENTRY substituteText " + shift); // NOI18N if (lastResult != null) { int index = getView().getSelectedIndex(); if (index >= 0) { lastResult.substituteText(index, shift ); } return true; } else { return false; } }
/** Substitute the document's text with the text * that is appopriate for the selection * in the view. This function is usually triggered * upon pressing the Enter key. * @return true if the substitution was performed * false if not. */ public synchronized boolean substituteText( boolean shift ) { trace("ENTRY substituteText " + shift); // NOI18N if (lastResult != null) { int index = getView().getSelectedIndex(); if (index >= 0) { lastResult.substituteText(index, shift ); } return true; } else { return false; } }
/** * Substitute the document's text with the text that is appopriate for the * selection in the view. This function is usually triggered upon pressing * the Enter key. * * @return true if the substitution was performed false if not. */ public synchronized boolean substituteText(boolean shift) { if (lastResult != null) { int index = getView().getSelectedIndex(); if (index >= 0) { lastResult.substituteText(index, shift); } return true; } else { return false; } }
/** * Substitute the document's text with the text that is appopriate for the * selection in the view. This function is usually triggered upon pressing * the Enter key. * * @return true if the substitution was performed false if not. */ public synchronized boolean substituteText(boolean flag) { if (getLastResult() != null) { int index = getView().getSelectedIndex(); if (index >= 0) { getLastResult().substituteText(index, flag); } return true; } else { return false; } }
/** Substitute the text with the longest common * part of all the entries appearing in the view. * This function is usually triggered * upon pressing the Tab key. * @return true if the substitution was performed * false if not. */ public synchronized boolean substituteCommonText() { trace("ENTRY substituteCommonText"); // NOI18N if (lastResult != null) { int index = getView().getSelectedIndex(); if (index >= 0) { lastResult.substituteCommonText(index); } return true; } else { return false; } }
/** Substitute the document's text with the text * that is appopriate for the selection * in the view. This function is usually triggered * upon pressing the Enter key. * @return true if the substitution was performed * false if not. */ public synchronized boolean substituteText( boolean flag ) { if( getLastResult() != null ) { int index = getView().getSelectedIndex(); if (index >= 0) { getLastResult().substituteText( index, flag ); } return true; } else { return false; } }
public void run() { CompletionQuery.Result res = lastResult; if (res != null) { getPane().setTitle(res.getTitle()); getView().setResult(res); if (isPaneVisible()) { getPane().refresh(); } else { getPane().setVisible(true); } } else { getPane().setVisible(false); caretPos = -1; } } });
/** Substitute the text with the longest common * part of all the entries appearing in the view. * This function is usually triggered * upon pressing the Tab key. * @return true if the substitution was performed * false if not. */ public synchronized boolean substituteCommonText() { trace("ENTRY substituteCommonText"); // NOI18N if (lastResult != null) { int index = getView().getSelectedIndex(); if (index >= 0) { lastResult.substituteCommonText(index); } return true; } else { return false; } }
/** * Substitute the text with the longest common part of all the entries * appearing in the view. This function is usually triggered upon pressing * the Tab key. * * @return true if the substitution was performed false if not. */ public synchronized boolean substituteCommonText() { if (lastResult != null) { int index = getView().getSelectedIndex(); if (index >= 0) { lastResult.substituteCommonText(index); } return true; } else { return false; } }
private synchronized boolean instantSubstitutionImpl(int caretPos){ if (getLastResult() == null) return false; JTextComponent comp = extEditorUI.getComponent(); try{ if (comp != null) { int[] block = Utilities.getIdentifierBlock(comp,caretPos); if (block == null || block[1] == caretPos) return getLastResult().substituteText(0, false); } }catch(BadLocationException ble){ } return false; }
/** Populate the view with the result from a query. */ public void setResult(CompletionQuery.Result result) { if (result != null) { setResult(result.getData()); } else { setResult(Collections.EMPTY_LIST); } }
/** Populate the view with the result from a query. */ public void setResult(CompletionQuery.Result result) { if (result != null) { setResult(result.getData()); } else { setResult(Collections.EMPTY_LIST); } }
/** Populate the view with the result from a query. */ public void setResult(CompletionQuery.Result result) { if (result != null) { setResult(result.getData()); } }
private synchronized boolean instantSubstitutionImpl(int caretPos){ if (getLastResult() == null) return false; JTextComponent comp = extEditorUI.getComponent(); try{ if ((comp == null) || Utilities.getWordEnd(comp,caretPos) > caretPos) return false; return getLastResult().substituteText(0, false); }catch(BadLocationException ble){ return false; } }