public void fileClose() { _closeFile(true); }
public void fileNew() { fileClose(); }
public void fileOpen(File f) { fileOpen(f, false); }
private void _closeFile(boolean clearEditor) { if (unsavedEdits) { showConfirmSaveDialog(); } if (clearEditor) { setEntireSQLScript(""); } getActiveSessionTabWidget().setSqlFile(null); fileOpened = false; fileSaved = false; unsavedEdits = false; ActionCollection actions = getSession().getApplication().getActionCollection(); actions.enableAction(FileSaveAction.class, true); _fileManager.clearCurrentFile(); }
public void fileSaveAs() { if (_fileManager.saveAs()) { fileSaved = true; unsavedEdits = false; getActiveSessionTabWidget().setUnsavedEdits(false); ActionCollection actions = getSession().getApplication().getActionCollection(); actions.enableAction(FileSaveAction.class, false); } }
public void fileOpen(File f, boolean append){ if (unsavedEdits) { showConfirmSaveDialog(); } if (_fileManager.open(f, append)) { fileOpened = true; fileSaved = false; unsavedEdits = false; ActionCollection actions = getSession().getApplication().getActionCollection(); actions.enableAction(FileSaveAction.class, false); } }
private SessionTabWidget getActiveSessionTabWidget() { return (SessionTabWidget) getSession().getActiveSessionWindow(); }
private void createStandardEntryAreaMenuItems() { JMenuItem item; SquirrelResources resources = getSession().getApplication().getResources(); Action toolsPopupAction = _panel.getSession().getApplication().getActionCollection().get(ToolsPopupAction.class); item = getSQLEntryPanel().addToSQLEntryAreaMenu(toolsPopupAction); resources.configureMenuItem(toolsPopupAction, item); if(_panel.isInMainSessionWindow()) { Action vioAction = _panel.getSession().getApplication().getActionCollection().get(ViewObjectAtCursorInObjectTreeAction.class); item = getSQLEntryPanel().addToSQLEntryAreaMenu(vioAction); resources.configureMenuItem(vioAction, item); } Action formatSqlAction = _panel.getSession().getApplication().getActionCollection().get(FormatSQLAction.class); item = getSQLEntryPanel().addToSQLEntryAreaMenu(formatSqlAction); resources.configureMenuItem(formatSqlAction, item); }
/** * Ctor specifying the panel. * * @param panel <TT>SQLPanel</TT> is the SQL Panel. * * @throws IllegalArgumentException * Thrown if <T>null</TT> <TT>SQLPanel</TT> passed. */ public SQLPanelAPI(SQLPanel panel) { super(); if (panel == null) { throw new IllegalArgumentException("SQLPanel == null"); } _panel = panel; _panel.getSQLEntryPanel().addUndoableEditListener(new SQLEntryUndoListener()); initToolsPopUp(); createStandardEntryAreaMenuItems(); }
/** * Ctor. * * @param session Current session. * * @throws IllegalArgumentException * Thrown if a <TT>null</TT> <TT>ISession</TT> passed. */ public SQLPanel(ISession session, boolean isInMainSessionWindow) { super(); _inMainSessionWindow = isInMainSessionWindow; setSession(session); createGUI(); propertiesHaveChanged(null); _sqlExecPanel = new SQLResultExecuterPanel(session); _sqlExecPanel.addSQLExecutionListener(_sqlExecutorHistoryListener); addExecutor(_sqlExecPanel); _panelAPI = new SQLPanelAPI(this); _resultLimitAndReadOnPanelSmallPanel.loadData(session.getProperties()); }
private boolean showConfirmSaveDialog() { File file = _fileManager.getFile(); // i18n[SQLPanelAPI.untitledLabel=Untitled] String filename = s_stringMgr.getString("SQLPanelAPI.untitledLabel"); if (file != null) { filename = file.getAbsolutePath(); } String msg = s_stringMgr.getString("SQLPanelAPI.unsavedchanges", filename); String title = s_stringMgr.getString("SQLPanelAPI.unsavedchangestitle", ": "+_panel.getSession().getAlias().getName()); JFrame f = (JFrame) SessionUtils.getOwningFrame(this); int option = JOptionPane.showConfirmDialog(f, msg, title, JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { return fileSave(); } return true; }
if (select) int entireLen = getEntireSQLScript().length(); if (selStart == -1)
private void _closeFile(boolean clearEditor) { if (unsavedEdits) { showConfirmSaveDialog(); } if (clearEditor) { setEntireSQLScript(""); } getActiveSessionTabWidget().setSqlFile(null); fileOpened = false; fileSaved = false; unsavedEdits = false; ActionCollection actions = getSession().getApplication().getActionCollection(); actions.enableAction(FileSaveAction.class, true); _fileManager.clearCurrentFile(); }
public void fileSaveAs() { if (_fileManager.saveAs()) { fileSaved = true; unsavedEdits = false; getActiveSessionTabWidget().setUnsavedEdits(false); ActionCollection actions = getSession().getApplication().getActionCollection(); actions.enableAction(FileSaveAction.class, false); } }
public void fileOpen(File f, boolean append){ if (unsavedEdits) { showConfirmSaveDialog(); } if (_fileManager.open(f, append)) { fileOpened = true; fileSaved = false; unsavedEdits = false; ActionCollection actions = getSession().getApplication().getActionCollection(); actions.enableAction(FileSaveAction.class, false); } }
private SessionTabWidget getActiveSessionTabWidget() { return (SessionTabWidget) getSession().getActiveSessionWindow(); }
private void createStandardEntryAreaMenuItems() { JMenuItem item; SquirrelResources resources = getSession().getApplication().getResources(); Action toolsPopupAction = _panel.getSession().getApplication().getActionCollection().get(ToolsPopupAction.class); item = getSQLEntryPanel().addToSQLEntryAreaMenu(toolsPopupAction); resources.configureMenuItem(toolsPopupAction, item); if(_panel.isInMainSessionWindow()) { Action vioAction = _panel.getSession().getApplication().getActionCollection().get(ViewObjectAtCursorInObjectTreeAction.class); item = getSQLEntryPanel().addToSQLEntryAreaMenu(vioAction); resources.configureMenuItem(vioAction, item); } Action formatSqlAction = _panel.getSession().getApplication().getActionCollection().get(FormatSQLAction.class); item = getSQLEntryPanel().addToSQLEntryAreaMenu(formatSqlAction); resources.configureMenuItem(formatSqlAction, item); }
/** * Ctor specifying the panel. * * @param panel <TT>SQLPanel</TT> is the SQL Panel. * * @throws IllegalArgumentException * Thrown if <T>null</TT> <TT>SQLPanel</TT> passed. */ public SQLPanelAPI(SQLPanel panel) { super(); if (panel == null) { throw new IllegalArgumentException("SQLPanel == null"); } _panel = panel; _panel.getSQLEntryPanel().addUndoableEditListener(new SQLEntryUndoListener()); initToolsPopUp(); createStandardEntryAreaMenuItems(); }
/** * Ctor. * * @param session Current session. * * @throws IllegalArgumentException * Thrown if a <TT>null</TT> <TT>ISession</TT> passed. */ public SQLPanel(ISession session, boolean isInMainSessionWindow) { super(); _inMainSessionWindow = isInMainSessionWindow; setSession(session); createGUI(); propertiesHaveChanged(null); _sqlExecPanel = new SQLResultExecuterPanel(session); _sqlExecPanel.addSQLExecutionListener(_sqlExecutorHistoryListener); addExecutor(_sqlExecPanel); _panelAPI = new SQLPanelAPI(this); _resultLimitAndReadOnPanelSmallPanel.loadData(session.getProperties()); }
private boolean showConfirmSaveDialog() { File file = _fileManager.getFile(); // i18n[SQLPanelAPI.untitledLabel=Untitled] String filename = s_stringMgr.getString("SQLPanelAPI.untitledLabel"); if (file != null) { filename = file.getAbsolutePath(); } String msg = s_stringMgr.getString("SQLPanelAPI.unsavedchanges", filename); String title = s_stringMgr.getString("SQLPanelAPI.unsavedchangestitle", ": "+_panel.getSession().getAlias().getName()); JFrame f = (JFrame) SessionUtils.getOwningFrame(this); int option = JOptionPane.showConfirmDialog(f, msg, title, JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { return fileSave(); } return true; }