/** * Set the offset into the SQL entry area where the current select * starts. * * param start the new selections start position. */ public synchronized void setSQLScriptSelectionStart(int start) { _panel.getSQLEntryPanel().setSelectionStart(start); }
/** * Set the offset into the SQL entry area where the current select * starts. * * param start the new selections start position. */ public synchronized void setSQLScriptSelectionStart(int start) { _panel.getSQLEntryPanel().setSelectionStart(start); }
private void duplicateLineAction(ISQLEntryPanel sqlEntryPanel) { try { String selectedText = sqlEntryPanel.getSelectedText(); if(null != selectedText && 0 < selectedText.length()) { JTextComponent txtComp = sqlEntryPanel.getTextComponent(); int selectionEnd = sqlEntryPanel.getSelectionEnd(); txtComp.getDocument().insertString(selectionEnd, selectedText, null); sqlEntryPanel.setSelectionStart(selectionEnd); sqlEntryPanel.setSelectionEnd(selectionEnd + selectedText.length()); } else { duplicateCurrentLine(sqlEntryPanel); } } catch (BadLocationException e) { throw new RuntimeException(e); } }
sqlEntryPanel.setSelectionStart(bounds[0]); sqlEntryPanel.setSelectionEnd(bounds[1]);
private void comment(ISQLEntryPanel sqlEntryPanel) { int[] bounds = sqlEntryPanel.getBoundsOfSQLToBeExecuted(); if (bounds[0] == bounds[1]) { return; } int caretPosition = sqlEntryPanel.getCaretPosition(); String textToComment = sqlEntryPanel.getText().substring(bounds[0], bounds[1]); String[] lines = textToComment.split("\n"); StringBuffer commentedLines = new StringBuffer(); String startOfLineComment = sqlEntryPanel.getSession().getProperties().getStartOfLineComment(); for (int i = 0; i < lines.length; i++) { if(bounds[0] + commentedLines.length() <= caretPosition) { caretPosition += startOfLineComment.length(); } commentedLines.append(startOfLineComment).append(lines[i]); if(i < lines.length - 1 || textToComment.endsWith("\n")) { commentedLines.append("\n"); } } sqlEntryPanel.setSelectionStart(bounds[0]); sqlEntryPanel.setSelectionEnd(bounds[1]); sqlEntryPanel.replaceSelection(commentedLines.toString()); sqlEntryPanel.setCaretPosition(caretPosition); }
pnl.setSelectionStart(selStart); pnl.setSelectionEnd(selEnd);
pnl.setSelectionStart(selStart); pnl.setSelectionEnd(selEnd);
private void performCompletionSelected(CompletionInfo completion, int replaceBegin, int keyCode, int modifiers) { if(KeyEvent.VK_SPACE == keyCode && modifiers == KeyEvent.CTRL_MASK) { // Code Completion has been done within Code Completion. Now just replace what all candidates have in common. CompletionCandidates completionCandidates = _model.getCompletionCandidates(_cc.getTextTillCarret()); _hqlEntryPanel.setSelectionStart(replaceBegin); _hqlEntryPanel.setSelectionEnd(_hqlEntryPanel.getCaretPosition()); _hqlEntryPanel.replaceSelection(completionCandidates.getAllCandidatesPrefix(true)); SwingUtilities.invokeLater(new Runnable() { public void run() { _cc.show(); } }); } else if(KeyEvent.VK_TAB == keyCode) { _hqlEntryPanel.setSelectionStart(replaceBegin); _hqlEntryPanel.setSelectionEnd(getNextWhiteSpacePos(_hqlEntryPanel.getCaretPosition())); _hqlEntryPanel.replaceSelection(completion.getCompletionString()); } else { _hqlEntryPanel.setSelectionStart(replaceBegin); _hqlEntryPanel.setSelectionEnd(_hqlEntryPanel.getCaretPosition()); _hqlEntryPanel.replaceSelection(completion.getCompletionString()); } }
_sqlEntryPanel.setSelectionStart(replaceBegin); _sqlEntryPanel.setSelectionEnd(_sqlEntryPanel.getCaretPosition()); _sqlEntryPanel.replaceSelection(completionCandidates.getAllCandidatesPrefix(false)); _sqlEntryPanel.setSelectionStart(replaceBegin); _sqlEntryPanel.setSelectionEnd(getNextStopCharPos(_sqlEntryPanel.getCaretPosition())); _sqlEntryPanel.replaceSelection(completion.getCompletionString()); _sqlEntryPanel.setSelectionStart(replaceBegin); _sqlEntryPanel.setSelectionEnd(_sqlEntryPanel.getCaretPosition()); _sqlEntryPanel.replaceSelection(completion.getCompletionString());
_panel.getSQLEntryPanel().setSelectionStart(bounds[0]); _panel.getSQLEntryPanel().setSelectionEnd(bounds[1]); _panel.getSQLEntryPanel().replaceSelection(reformatedText);
_panel.getSQLEntryPanel().setSelectionStart(bounds[0]); _panel.getSQLEntryPanel().setSelectionEnd(bounds[1]); _panel.getSQLEntryPanel().replaceSelection(reformatedText);