Package net.sourceforge.squirrel_sql.client.action

Examples of net.sourceforge.squirrel_sql.client.action.ActionCollection


        _pluginManager.loadPlugins();
      }
    }

    indicateNewStartupTask(splash, s_stringMgr.getString("Application.splash.loadingactions"));
    _actions = new ActionCollection(this);

    indicateNewStartupTask(splash, s_stringMgr.getString("Application.splash.loadinguseracc"));
    _actions.loadActionKeys(_prefs.getActionKeys());

    indicateNewStartupTask(splash, s_stringMgr.getString("Application.splash.createjdbcmgr"));


   private void initToolsPopUp()
   {
      _toolsPopupController = new ToolsPopupController(getSession(), _panel.getSQLEntryPanel());


      ActionCollection ac = getSession().getApplication().getActionCollection();

      _toolsPopupController.addAction("undo", _panel.getUndoAction());
      _toolsPopupController.addAction("redo", _panel.getRedoAction());
      _toolsPopupController.addAction("runsql", ac.get(ExecuteSqlAction.class));
      _toolsPopupController.addAction("fileopen", ac.get(FileOpenAction.class));
      _toolsPopupController.addAction("filesave", ac.get(FileSaveAction.class));
      _toolsPopupController.addAction("filesaveas", ac.get(FileSaveAsAction.class));
      _toolsPopupController.addAction("filenew", ac.get(FileNewAction.class));
      _toolsPopupController.addAction("fileappend", ac.get(FileAppendAction.class));
      _toolsPopupController.addAction("fileprint", ac.get(FilePrintAction.class));
      _toolsPopupController.addAction("fileclose", ac.get(FileCloseAction.class));

      _toolsPopupController.addAction("tabnext", ac.get(GotoNextResultsTabAction.class));
      _toolsPopupController.addAction("tabprevious", ac.get(GotoPreviousResultsTabAction.class));
      _toolsPopupController.addAction("tabcloseall", ac.get(CloseAllSQLResultTabsAction.class));
      _toolsPopupController.addAction("tabcloseallbutcur", ac.get(CloseAllSQLResultTabsButCurrentAction.class));
      _toolsPopupController.addAction("tabclosecur", ac.get(CloseCurrentSQLResultTabAction.class));
      _toolsPopupController.addAction("tabsticky", ac.get(ToggleCurrentSQLResultTabStickyAction.class));

      _toolsPopupController.addAction("sqlprevious", ac.get(PreviousSqlAction.class));
      _toolsPopupController.addAction("sqlnext", ac.get(NextSqlAction.class));
      _toolsPopupController.addAction("sqlselect", ac.get(SelectSqlAction.class));

      _toolsPopupController.addAction("sqlhist", ac.get(OpenSqlHistoryAction.class));

      if (_panel.isInMainSessionWindow())
      {
         _toolsPopupController.addAction("viewinobjecttree", ac.get(ViewObjectAtCursorInObjectTreeAction.class));
      }

   }

   {
      if (_fileManager.save()) {
          fileSaved = true;
          unsavedEdits = false;
          getActiveSessionTabWidget().setUnsavedEdits(false);
          ActionCollection actions =
              getSession().getApplication().getActionCollection();
          actions.enableAction(FileSaveAction.class, false);
          return true;
      } else {
          return false;
      }
   }

   public void fileAppend() {
       if (_fileManager.open(true)) {
           fileOpened = true;
           fileSaved = false;
           unsavedEdits = false;
           ActionCollection actions =
               getSession().getApplication().getActionCollection();
           actions.enableAction(FileSaveAction.class, true);          
       }
   }

       setEntireSQLScript("");
       getActiveSessionTabWidget().setSqlFile(null);
       fileOpened = false;
       fileSaved = false;
       unsavedEdits = false;
       ActionCollection actions =
           getSession().getApplication().getActionCollection();
       actions.enableAction(FileSaveAction.class, true);
       _fileManager.clearCurrentFile();
   }

   {
       if (_fileManager.saveAs()) {
           fileSaved = true;
           unsavedEdits = false;
           getActiveSessionTabWidget().setUnsavedEdits(false);
           ActionCollection actions =
               getSession().getApplication().getActionCollection();
           actions.enableAction(FileSaveAction.class, false);        
       }
   }

       }      
       if (_fileManager.open(false)) {
           fileOpened = true;
           fileSaved = false;
           unsavedEdits = false;
           ActionCollection actions =
               getSession().getApplication().getActionCollection();
           actions.enableAction(FileSaveAction.class, false);          
       }
   }

       }             
       if (_fileManager.open(f)) {
           fileOpened = true;
           fileSaved = false;
           unsavedEdits = false;
           ActionCollection actions =
               getSession().getApplication().getActionCollection();
           actions.enableAction(FileSaveAction.class, false);          
       }
      
   }

        if (fileOpened || fileSaved) {
            if (prefs.getWarnForUnsavedFileEdits()) {
                unsavedEdits = true;
            }
            getActiveSessionTabWidget().setUnsavedEdits(true);
            ActionCollection actions =
                getSession().getApplication().getActionCollection();
            actions.enableAction(FileSaveAction.class, true);
        } else if (prefs.getWarnForUnsavedBufferEdits()) {
            unsavedEdits = true;
        }
    }

      });

      setShowsRootHandles(true);

      // Add actions to the popup menu.
      final ActionCollection actions = session.getApplication().getActionCollection();

      // Options for global popup menu.
      addToPopup(actions.get(RefreshSchemaInfoAction.class));
      addToPopup(actions.get(RefreshObjectTreeItemAction.class));

      addToPopup(DatabaseObjectType.TABLE, actions.get(EditWhereColsAction.class));

      addToPopup(DatabaseObjectType.TABLE, actions.get(SQLFilterAction.class));
      addToPopup(DatabaseObjectType.VIEW, actions.get(SQLFilterAction.class));

      addToPopup(DatabaseObjectType.TABLE, actions.get(DeleteSelectedTablesAction.class));

      addToPopup(DatabaseObjectType.SESSION, actions.get(FilterObjectsAction.class));


      session.getApplication().getThreadPool().addTask(new Runnable() {
          public void run() {
            try
            {
                // Option to select default catalog only applies to sessions
                // that support catalogs.
                if (_session.getSQLConnection().getSQLMetaData().supportsCatalogs())
                {
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            addToPopup(DatabaseObjectType.CATALOG,
                                       actions.get(SetDefaultCatalogAction.class));
                        }

                    });
                }
            }
            catch (Throwable th)
            {
                // Assume DBMS doesn't support catalogs.
                s_log.debug(th);
            }

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    addToPopup(actions.get(CopySimpleObjectNameAction.class));
                    addToPopup(actions.get(CopyQualifiedObjectNameAction.class));


                  addMouseListener(new ObjectTreeMouseListener());
                  setCellRenderer(new ObjectTreeCellRenderer(_model, _session));
                  ObjectTree.this.refresh(false);

TOP

Related Classes of net.sourceforge.squirrel_sql.client.action.ActionCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.