public void execute() { final String sqlSep = _session.getQueryTokenizer().getSQLStatementSeparator(); final StringBuffer buf = new StringBuffer(); buf.append("USE "); buf.append(_catalogName); buf.append(sqlSep + "\n"); buf.append("DBCC SHRINKFILE ("); buf.append(_databaseFileName); buf.append(", TRUNCATEONLY)\n"); buf.append(sqlSep); buf.append("\n"); _session.getSessionInternalFrame().getSQLPanelAPI().appendSQLScript(buf.toString(), true); _session.getSessionInternalFrame().getSQLPanelAPI().executeCurrentSQL(); _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB); } }
public void actionPerformed(ActionEvent e) { _panel.getSQLEntryPanel().moveCaretToNextSQLBegin(); }
public RecentFilesController(ISQLPanelAPI panel) { Frame parent = GUIUtils.getOwningFrame(panel.getSQLEntryPanel().getTextComponent()); init(panel.getSession().getApplication(), parent, panel.getSession().getAlias(), false); }
public void actionPerformed(ActionEvent e) { new SQLHistoryController(_panel.getSession(), _panel, _panel.getSQLHistoryItems()); }
public boolean open(File f, boolean appendToExisting) { boolean result = false; _sqlPanelAPI.getSession().selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB); result = true; if (!appendToExisting) { _sqlPanelAPI.setEntireSQLScript(""); } loadScript(f); return result; }
public void execute() { final ISession session = _panel.getSession(); final Connection conn = session.getSQLConnection().getConnection(); try { final String sql = conn.nativeSQL(_panel.getSQLScriptToBeExecuted()); if (sql.length() > 0) { _panel.appendSQLScript("\n" + sql, true); } } catch (SQLException ex) { session.showErrorMessage(ex); } } }
/** * If no SQLPanel is active, disable this one. * @see net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction#setSQLPanel(net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI) */ public void setSQLPanel(ISQLPanelAPI panel) { if (null != panel) { session = panel.getSession(); } else { session = null; } setEnabled(null != session); }
public void run() { hideAbortFrame(); if (scriptOnly && 0 < sbScript.toString().trim().length()) { FrameWorkAcessor.getSQLPanelAPI(_session, _plugin).appendSQLScript(sbScript.toString(), true); _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB); } } });
public void run() { CodeCompletionInfoCollection c = new CodeCompletionInfoCollection(session, CodeCompletionPlugin.this, true); CompleteCodeAction cca = new CompleteCodeAction(session.getApplication(), CodeCompletionPlugin.this, sqlPaneAPI.getSQLEntryPanel(), session, c, null); JMenuItem item = sqlPaneAPI.addToSQLEntryAreaMenu(cca); _resources.configureMenuItem(cca, item); JComponent comp = sqlPaneAPI.getSQLEntryPanel().getTextComponent(); comp.registerKeyboardAction(cca, _resources.getKeyStroke(cca), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); sqlPaneAPI.addToToolsPopUp("completecode", cca); }
private void completeSqlPanelEntryAreaMenu(ActionCollection coll, ISQLPanelAPI sqlPanelAPI) JMenuItem mnuUnmark = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UnmarkAction.class)); _resources.configureMenuItem(coll.get(UnmarkAction.class), mnuUnmark); JMenuItem mnuComment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(CommentAction.class)); _resources.configureMenuItem(coll.get(CommentAction.class), mnuComment); JMenuItem mnuUncomment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UncommentAction.class)); _resources.configureMenuItem(coll.get(UncommentAction.class), mnuUncomment); if (sqlPanelAPI.getSQLEntryPanel().getTextComponent() instanceof SquirrelRSyntaxTextArea) JMenuItem mnuCopyToRtf = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(SquirrelCopyAsRtfAction.class)); _resources.configureMenuItem(coll.get(SquirrelCopyAsRtfAction.class), mnuCopyToRtf); SquirrelRSyntaxTextArea rsEdit = (SquirrelRSyntaxTextArea) sqlPanelAPI.getSQLEntryPanel().getTextComponent(); toUpperAction.putValue(Action.ACCELERATOR_KEY, SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_KEY_STROKE_TO_UPPER_CASE); JMenuItem mnuToUpper = sqlPanelAPI.addToSQLEntryAreaMenu(toUpperAction); mnuToUpper.setText((String) toUpperAction.getValue(Action.SHORT_DESCRIPTION)); _resources.configureMenuItem(toUpperAction, mnuToUpper); toLowerAction.putValue(Action.ACCELERATOR_KEY, SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_KEY_STROKE_TO_LOWER_CASE); JMenuItem mnuToLower = sqlPanelAPI.addToSQLEntryAreaMenu(toLowerAction); mnuToLower.setText((String) toLowerAction.getValue(Action.SHORT_DESCRIPTION)); _resources.configureMenuItem(toLowerAction, mnuToLower);
private void loadScript(File file) SquirrelPreferences prefs = _sqlPanelAPI.getSession().getApplication().getSquirrelPreferences(); FileInputStream fis = null; BufferedInputStream bis = null; iRead = bis.read(bytes); _sqlPanelAPI.appendSQLScript(convertPlatformEOLToLineFeed(sb.toString()), true); setFile(file); memorizeFile(file, prefs); _sqlPanelAPI.getSession().showErrorMessage(io);
sqlPanelAPI.addToToolsPopUp("addtograph", coll.get(AddTableAtQursorToGraph.class)); sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(AddTableAtQursorToGraph.class));
public void addToToolsPopUp(String selectionString, Action action) { getSQLPaneAPI().addToToolsPopUp(selectionString, action); }
FrameWorkAcessor.getSQLPanelAPI(_session, _plugin); String script = api.getSQLScriptToBeExecuted();
private void setupSQLEntryArea(ISession session) { final ISQLPanelAPI api = session.getSessionInternalFrame().getSQLPanelAPI(); final ActionCollection coll = getApplication().getActionCollection(); api.addToSQLEntryAreaMenu(coll.get(ValidateSQLAction.class)); }
public void actionPerformed(ActionEvent evt) { if (_panel != null) { CursorChanger cursorChg = new CursorChanger(getApplication().getMainFrame()); cursorChg.show(); try { _panel.executeCurrentSQL(); } finally { cursorChg.restore(); } } } }
public void setSQLPanel(ISQLPanelAPI panel) { _panel = panel; setEnabled(null != _panel && _panel.isInMainSessionWindow()); }
private SessionTabWidget getActiveSessionTabWidget() { return (SessionTabWidget)_sqlPanelAPI.getSession().getActiveSessionWindow(); }
public void execute() { final ISession session = _panel.getSession(); final Connection conn = session.getSQLConnection().getConnection(); try { final String sql = conn.nativeSQL(_panel.getSQLScriptToBeExecuted()); if (sql.length() > 0) { _panel.appendSQLScript("\n" + sql, true); } } catch (SQLException ex) { session.showErrorMessage(ex); } } }
public void run() { if (_parentDialog != null) { _parentDialog.dispose(); } _session.getSQLPanelAPIOfActiveSessionWindow().appendSQLScript(script, true); _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB); } });