Package net.sourceforge.squirrel_sql.client.preferences

Examples of net.sourceforge.squirrel_sql.client.preferences.SquirrelPreferences


  public void setUp() throws Exception
  {
    super.setUp();
    ObjectTreePanel localMockObjectTreePanel =
      localMockHelper.createMock("localMockObjectTreePanel", ObjectTreePanel.class);
    SquirrelPreferences localMockSquirrelPreferences =
      localMockHelper.createMock("mockSquirrelPreferences", SquirrelPreferences.class);
    ISession localMockSession = localMockHelper.createMock("localMockSession", ISession.class);
    IApplication localMockApplication =
      localMockHelper.createMock("localMockApplication", IApplication.class);
    Statement localMockStatement = localMockHelper.createMock("localMockStatement", Statement.class);
    ITableInfo localMockTableInfo = localMockHelper.createMock("localMockTableInfo", ITableInfo.class);
    ResultSet localMockResultSet = localMockHelper.createMock("localMockResultSet", ResultSet.class);
    ResultSetMetaData localMockResultSetMetaData =
      localMockHelper.createMock("localMockResultSetMetaData", ResultSetMetaData.class);

    expect(localMockObjectTreePanel.getSession()).andStubReturn(localMockSession);
    expect(localMockSession.getApplication()).andStubReturn(localMockApplication);
    expect(localMockApplication.getSquirrelPreferences()).andStubReturn(localMockSquirrelPreferences);
    expect(localMockSquirrelPreferences.getShowPleaseWaitDialog()).andStubReturn(false);
    expect(localMockTableInfo.getQualifiedName()).andStubReturn("Test Qualified TableName");

    localMockStatement.close();
    expect(localMockResultSet.getMetaData()).andStubReturn(localMockResultSetMetaData);
   
View Full Code Here


   }

   private void close()
   {
      _dlg.dispose();
      SquirrelPreferences squirrelPreferences = _session.getApplication().getSquirrelPreferences();
      squirrelPreferences.setShowSessionStartupTimeHint(false == _dlg.chkDontShowAgain.isSelected());
   }
View Full Code Here

    /* (non-Javadoc)
     * @see javax.swing.event.UndoableEditListener#undoableEditHappened(javax.swing.event.UndoableEditEvent)
     */
    public void undoableEditHappened(UndoableEditEvent e) {
        IApplication app = getSession().getApplication();
        SquirrelPreferences prefs = app.getSquirrelPreferences();
       
        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;
        }
    }
View Full Code Here

   {
       boolean result = false;
      JFileChooser chooser = getFileChooser();
      chooser.setAccessory(new ChooserPreviewer());

      SquirrelPreferences prefs = _sqlPanelAPI.getSession().getApplication().getSquirrelPreferences();
      MainFrame frame = _sqlPanelAPI.getSession().getApplication().getMainFrame();


      if (prefs.isFileOpenInPreviousDir())
      {
         String fileName = prefs.getFilePreviousDir();
         if (fileName != null)
         {
            chooser.setCurrentDirectory(new File(fileName));
         }
      }
      else
      {
         String dirName = prefs.getFileSpecifiedDir();
         if (dirName != null)
         {
            chooser.setCurrentDirectory(new File(dirName));
         }
      }
View Full Code Here

      return result;
   }

   private void loadScript(File file)
   {
       SquirrelPreferences prefs = _sqlPanelAPI.getSession().getApplication().getSquirrelPreferences();
      FileInputStream fis = null;
      BufferedInputStream bis = null;
      try
      {
         StringBuffer sb = new StringBuffer();
         fis = new FileInputStream(file);
         bis = new BufferedInputStream(fis);
         byte[] bytes = new byte[2048];
         int iRead = bis.read(bytes);
         while (iRead != -1)
         {
            sb.append(new String(bytes, 0, iRead));
            iRead = bis.read(bytes);
         }
         _sqlPanelAPI.appendSQLScript(convertPlatformEOLToLineFeed(sb.toString()), true);
         setFile(file);
         prefs.setFilePreviousDir(file.getAbsolutePath());
      }
      catch (java.io.IOException io)
      {
         _sqlPanelAPI.getSession().showErrorMessage(io);
      }
View Full Code Here

         _toSaveTo = null;
      }

      JFileChooser chooser = getFileChooser();

      SquirrelPreferences prefs = _sqlPanelAPI.getSession().getApplication().getSquirrelPreferences();
      MainFrame frame = _sqlPanelAPI.getSession().getApplication().getMainFrame();

      for (; ;)
      {
         if (null == _toSaveTo)
         {
            if (prefs.isFileOpenInPreviousDir())
            {
               String dirName = prefs.getFilePreviousDir();
               if (dirName != null)
               {
                  chooser.setCurrentDirectory(new File(dirName));
               }
            }
            else
            {
               String dirName = prefs.getFileSpecifiedDir();
               if (dirName != null)
               {
                  chooser.setCurrentDirectory(new File(dirName));
               }
            }
View Full Code Here

      {
         doSave = true;
      }


      SquirrelPreferences prefs = _sqlPanelAPI.getSession().getApplication().getSquirrelPreferences();

      if (doSave)
      {
         prefs.setFilePreviousDir(file.getParent());

         FileOutputStream fos = null;
         try
         {
            fos = new FileOutputStream(file);
View Full Code Here

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
        ApplicationArguments.initialize(new String[] {});
        SquirrelPreferences _prefs = SquirrelPreferences.load();
        SquirrelSplashScreen screen = new SquirrelSplashScreen(_prefs, 16);
        screen.indicateNewTask("task 1");
        Thread.sleep(2000);
        screen.indicateNewTask("task 2");
        Thread.sleep(2000);
View Full Code Here

     return result;
  }

  public static SquirrelPreferences getEasyMockSquirrelPreferences(
        SessionProperties props) {
     SquirrelPreferences prefs = createMock(SquirrelPreferences.class);
     expect(prefs.getShowColoriconsInToolbar()).andReturn(true).anyTimes();
     expect(prefs.getSessionProperties()).andReturn(props).anyTimes();
     expect(prefs.getWarnJreJdbcMismatch()).andReturn(false).anyTimes();
     replay(prefs);
     return prefs;
  }
View Full Code Here

     } else {
        result = createMock(IApplication.class);
     }
     SquirrelResources resoures = getEasyMockSquirrelResources();
     SessionProperties props = getEasyMockSessionProperties(";", "--", true);
     SquirrelPreferences prefs = getEasyMockSquirrelPreferences(props);
     expect(result.getMainFrame()).andReturn(null).anyTimes();
     expect(result.getResources()).andReturn(resoures).anyTimes();
     expect(result.getSquirrelPreferences()).andReturn(prefs).anyTimes();
     TaskThreadPool mockThreadPool = FwTestUtil.getEasyMockTaskThreadPool();
     expect(result.getThreadPool()).andReturn(mockThreadPool).anyTimes();
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.client.preferences.SquirrelPreferences

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.