public void selectBookmark(ISQLEntryPanel entryPanel) { ActionEvent event = new ActionEvent(entryPanel, -230366, "bookmarkselect"); new CompleteBookmarkAction(entryPanel.getSession().getApplication(), _plugin.getResources(), entryPanel, _plugin).actionPerformed(event); } }
public static void selectBookmark(ISQLEntryPanel entryPanel) { getService(entryPanel.getSession().getApplication()).selectBookmark(entryPanel); } }
String startOfLineComment = sqlEntryPanel.getSession().getProperties().getStartOfLineComment();
public CompleteBookmarkAction(IApplication app, IResources resources, ISQLEntryPanel sqlEntryPanel, SQLBookmarkPlugin plugin) { super(app, resources); _sqlEntryPanel = sqlEntryPanel; _plugin = plugin; CompletorListener completorListener = new CompletorListener() { public void completionSelected(CompletionInfo completion, int replaceBegin, int keyCode, int modifiers) { performCompletionSelected(completion); } }; _cc = new Completor(_sqlEntryPanel.getTextComponent(), plugin.getBookmarkManager(), completorListener, new Color(204,255,255), true); sqlEntryPanel.getSession().addSimpleSessionListener(new SimpleSessionListener() { public void sessionClosed() { _cc.disposePopup(); } }); }
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); }
public ToolsPopupController(ISession session, ISQLEntryPanel sqlEntryPanel) { _sqlEntryPanel = sqlEntryPanel; _session = session; _toolsPopupCompletorModel = new ToolsPopupCompletorModel(); CompletorListener completorListener = new CompletorListener() { public void completionSelected(CompletionInfo completion, int replaceBegin, int keyCode, int modifiers) { onToolsPopupActionSelected(completion); } }; _toolsCompletor = new Completor(_sqlEntryPanel.getTextComponent(), _toolsPopupCompletorModel, completorListener, new Color(255,204,204), true); sqlEntryPanel.getSession().addSimpleSessionListener(new SimpleSessionListener() { public void sessionClosed() { _toolsCompletor.disposePopup(); } }); _ctrlTCount = Preferences.userRoot().getInt(PREFS_KEY_CTRL_T_COUNT, 0); if(3 > _ctrlTCount) { // i18n[ToolsPopupController.toolspopupmsg=Please try out the Tools popup by hitting ctrl+t in the SQL Editor. Do it three times to stop this message.] _session.showMessage(s_stringMgr.getString("ToolsPopupController.toolspopupmsg")); } }
private void performCompletionSelected(CompletionInfo completion) { Bookmark bm = ((BookmarkCompletionInfo)completion).getBookmark(); new RunBookmarkCommand(getApplication().getMainFrame(), _sqlEntryPanel.getSession(), bm, _plugin, _sqlEntryPanel).execute(); } }
public ToolsPopupController(ISession session, ISQLEntryPanel sqlEntryPanel) { _sqlEntryPanel = sqlEntryPanel; _session = session; _toolsPopupCompletorModel = new ToolsPopupCompletorModel(); CompletorListener completorListener = new CompletorListener() { public void completionSelected(CompletionInfo completion, int replaceBegin, int keyCode, int modifiers) { onToolsPopupActionSelected(completion); } }; _toolsCompletor = new Completor(_sqlEntryPanel.getTextComponent(), _toolsPopupCompletorModel, completorListener, new Color(255,204,204), true); sqlEntryPanel.getSession().addSimpleSessionListener(new SimpleSessionListener() { public void sessionClosed() { _toolsCompletor.disposePopup(); } }); _ctrlTCount = Preferences.userRoot().getInt(PREFS_KEY_CTRL_T_COUNT, 0); if(3 > _ctrlTCount) { // i18n[ToolsPopupController.toolspopupmsg=Please try out the Tools popup by hitting ctrl+t in the SQL Editor. Do it three times to stop this message.] _session.showMessage(s_stringMgr.getString("ToolsPopupController.toolspopupmsg")); } }