private synchronized void popupImpl( boolean postRequest) { if (isPaneVisible()) { refreshImpl(postRequest); } else { timer.stop(); if (postRequest) { timer.setInitialDelay(autoPopupDelay); timer.setDelay(autoPopupDelay); timer.start(); } else { actionPerformed(null); } } }
public final CompletionQuery getQuery() { if (query == null) { query = createQuery(); } return query; }
public final CompletionView getView() { if (view == null) { view = createView(); } return view; }
public void caretUpdate(CaretEvent e) { if (!isPaneVisible()) { // cancel timer if caret moved cancelRequest(); } else { // refresh completion only if a pane is already visible refresh(true); } } };
public void completionCancel(){ trace("ENTRY completionCancel"); // NOI18N if (pane != null){ cancelRequestImpl(); invalidateLastResult(); caretPos=-1; } }
public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { Completion completion = ExtUtilities.getCompletion(target); if (completion != null && completion.isPaneVisible()) { if (completion.substituteText(true)) { // completion.setPaneVisible(false); } else { completion.refresh(false); } } } }
public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { Completion completion = ExtUtilities.getCompletion(target); if (completion != null && completion.isPaneVisible()) { if (completion.substituteText(false)) { completion.setPaneVisible(false); } else { completion.refresh(false); } } else { super.actionPerformed(evt, target); } } }
if( !completion.isPaneVisible() ) { if (completion.isAutoPopupEnabled()) { int result = extSup.checkCompletion( target, typedText, false ); if ( result == ExtSyntaxSupport.COMPLETION_POPUP ) { completion.popup(true); } else if ( result == ExtSyntaxSupport.COMPLETION_CANCEL ) { completion.cancelRequest(); switch( result ) { case ExtSyntaxSupport.COMPLETION_HIDE: completion.setPaneVisible(false); break; case ExtSyntaxSupport.COMPLETION_REFRESH: completion.refresh(false); break; case ExtSyntaxSupport.COMPLETION_POST_REFRESH: completion.refresh(true); break;
/** * 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); } } }
if((caretPos!=-1) && (Utilities.getRowStart(component,component.getCaret().getDot()) != Utilities.getRowStart(component,caretPos)) && ((component.getCaret().getDot()-caretPos)>0) ){ getJDCPopupPanel().setCompletionVisible(false); caretPos=-1; return; currentTask().cancel(); boolean reentrantProvider = getQuery() instanceof CompletionQuery.SupportsSpeculativeInvocation; if (reentrantProvider) { rp = RequestProcessor.getDefault(); } else { rp = getSerialiazingRequestProcessor(); CancelableRunnable task = new QueryTask(wait, getPane().isVisible()); currentTask(task); if (provokedByAutoPopup == false) { RequestProcessor.getDefault().post(wait, 100);
/** * Show wait completion result. Always called from AWT. */ private void performWait() { getPane().setTitle(NbBundle.getBundle(org.netbeans.editor.BaseKit.class).getString("ext.Completion.wait")); getView().setResult((CompletionQuery.Result)null); if (isPaneVisible()) { getJDCPopupPanel().refresh(); } else { getJDCPopupPanel().setCompletionVisible(true); } }
/** Set the visibility of the view. This method should * be used mainly for hiding the completion pane. If used * with visible set to true it calls the <tt>popup(false)</tt>. */ public void setPaneVisible(boolean visible) { trace("ENTRY setPaneVisible " + visible); // NOI18N if (visible) { if (extEditorUI.getComponent() != null) { popupImpl(false); } } else { if (pane != null) { cancelRequestImpl(); invalidateLastResult(); getJDCPopupPanel().setCompletionVisible(false); caretPos=-1; } } }
public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { Completion completion = ExtUtilities.getCompletion(target); if (completion != null && completion.isPaneVisible()) { if (select) { completion.setPaneVisible(false); } else { completion.getView().begin(); return; } } super.actionPerformed(evt, target); } } }
public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { Completion completion = ExtUtilities.getCompletion(target); if (completion != null && completion.isPaneVisible()) { completion.getView().up(); } else { super.actionPerformed(evt, target); } } } }
public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { Completion completion = ExtUtilities.getCompletion(target); if (completion != null && completion.isPaneVisible()) { completion.refresh(false); completion.substituteCommonText(); } else { super.actionPerformed(evt, target); } } }
/** * Get the help and show it in the view. If the view is already visible * perform the refresh of the view. * * @param postRequest * post the request instead of displaying the view immediately. * The <tt>ExtSettingsNames.COMPLETION_AUTO_POPUP_DELAY</tt> * setting stores the number of milliseconds before the view is * displayed. If the user presses a key until the delay expires * nothing is shown. This guarantees that the user which knows * what to write will not be annoyed with the unnecessary help. */ public synchronized void popup(boolean postRequest) { if (isPaneVisible()) { refresh(postRequest); } else { timer.stop(); if (postRequest) { timer.setInitialDelay(autoPopupDelay); timer.setDelay(autoPopupDelay); timer.start(); } else { actionPerformed(null); } } }
private CompletionView getCompletionView(){ Completion c = extEditorUI.getCompletion(); if (c!=null){ return c.getView(); } return null; }
/** 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; } }