Examples of ISQLPanelAPI


Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

    expect(session.getMetaData()).andReturn(md).anyTimes();
    expect(session.getApplication()).andReturn(AppTestUtil.getEasyMockApplication()).anyTimes();
    expect(session.getQueryTokenizer()).andReturn(tokenizer).anyTimes();
    session.setQueryTokenizer(isA(QueryTokenizer.class));
    ISQLPanelAPI api = AppTestUtil.getEasyMockSqlPanelApi();
    expect(session.getSQLPanelAPIOfActiveSessionWindow()).andReturn(api).anyTimes();
    // expect(session.getMessageHandler()).andReturn(messageHandler).anyTimes();
    expect(session.getAlias()).andStubReturn(AppTestUtil.getEasyMockSqlAliasExt());
    expect(session.getIdentifier()).andReturn(FwTestUtil.getEasyMockIdentifier()).anyTimes();
    expect(session.getSQLConnection()).andReturn(con).anyTimes();
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

  }

  public static SessionPanel getEasyMockSessionPanel()
  {
    SessionPanel result = createMock(SessionPanel.class);
    ISQLPanelAPI api = AppTestUtil.getEasyMockSqlPanelApi();
    expect(result.getSQLPaneAPI()).andReturn(api);
    ObjectTreePanel mockObjTreePanel = createMock(ObjectTreePanel.class);
    expect(result.getObjectTreePanel()).andStubReturn(mockObjTreePanel);
    mockObjTreePanel.addExpander(isA(DatabaseObjectType.class), isA(INodeExpander.class));
    expectLastCall().anyTimes();
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

    return result;
  }

  public static ISQLPanelAPI getEasyMockSqlPanelApi()
  {
    ISQLPanelAPI result = createMock(ISQLPanelAPI.class);
    ISQLEntryPanel panel = AppTestUtil.getEasyMockSqlEntryPanel();
    expect(result.getSQLEntryPanel()).andReturn(panel).anyTimes();
    result.addExecuterTabListener(isA(ISQLResultExecuterTabListener.class));
    expectLastCall().anyTimes();
    result.addExecutor(isA(ISQLResultExecuter.class));
    expectLastCall().anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

   {

      final StringBuffer sbScript = new StringBuffer();
      try
      {
          ISQLPanelAPI api =
              FrameWorkAcessor.getSQLPanelAPI(_session, _plugin);
         
          String script = api.getSQLScriptToBeExecuted();
         
         IQueryTokenizer qt = _session.getQueryTokenizer();
         qt.setScriptToTokenize(script);
        
         if(false == qt.hasQuery())
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

  @Test
  public void testMultipleSessionEndings() {
   
    ISession mockSession = mockHelper.createMock("mockSession", ISession.class);
    SessionPanel mockSessionPanel = mockHelper.createMock("mockSessionPanel", SessionPanel.class);
    ISQLPanelAPI mockSQLPanelAPI = mockHelper.createMock("mockSQLPanelAPI", ISQLPanelAPI.class);
    EasyMock.makeThreadSafe(mockSQLPanelAPI, true);
   
    expect(mockSession.getSessionSheet()).andStubReturn(mockSessionPanel);
    expect(mockSessionPanel.getSQLPaneAPI()).andStubReturn(mockSQLPanelAPI);
    mockSQLPanelAPI.addSQLExecutionListener(isA(ISQLExecutionListener.class));
    expectLastCall().anyTimes();
    mockSQLPanelAPI.removeSQLExecutionListener(isA(ISQLExecutionListener.class));
    expectLastCall().anyTimes();
   
    mockHelper.replayAll();
   
    ((ISessionPlugin)classUnderTest).sessionCreated(mockSession);
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        ISQLPanelAPI sqlPaneAPI = session.getSessionSheet().getSQLPaneAPI();
        sqlPaneAPI.addExecutor(new ExplainPlanExecuter(session, sqlPaneAPI));
        updateObjectTree(session.getSessionSheet().getObjectTreePanel());
      }
    });

    setTimezoneForSession(session, prefs);
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

  }

  private void onSQLInternaFrameOpened(SQLInternalFrame sqlInternalFrame, final ISession session)
  {
    final ISQLPanelAPI panel = sqlInternalFrame.getSQLPanelAPI();
    panel.addExecutor(new ExplainPlanExecuter(session, panel));
  }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

        return true;
    }
   
    private String getCurrentSql() {
        String result = null;
        ISQLPanelAPI api = _session.getSQLPanelAPIOfActiveSessionWindow();
        result = api.getSQLEntryPanel().getSQLToBeExecuted();
        return result;
    }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

    {
      final String sql = script.getSQL();
      if (sql != null && sql.length() > 0)
      {
        rc = true;
        final ISQLPanelAPI api = session.getSessionInternalFrame().getSQLPanelAPI();
        GUIUtils.processOnSwingEventThread(new Runnable()
        {
          public void run()
          {
            api.setEntireSQLScript(sql);
            session.getApplication().getThreadPool().addTask(new Runnable()
            {
              public void run()
              {
                api.executeCurrentSQL();
              }
            });
          }
        });
      }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI

    _plugin = plugin;
  }

  public void execute() throws BaseException
  {
    ISQLPanelAPI api = FrameWorkAcessor.getSQLPanelAPI(_session, _plugin);
     
      int[] bounds = api.getSQLEntryPanel().getBoundsOfSQLToBeExecuted();

      if(bounds[0] == bounds[1])
      {
         return;
      }

      String textToReformat = api.getSQLEntryPanel().getSQLToBeExecuted();

    if (null == textToReformat)
    {
      return;
    }

    CommentSpec[] commentSpecs =
      new CommentSpec[]
      {
        new CommentSpec("/*", "*/"),
        new CommentSpec("--", StringUtilities.getEolStr())
      };

    String statementSep = _session.getQueryTokenizer().getSQLStatementSeparator();
   
    CodeReformator cr = new CodeReformator(statementSep, commentSpecs);

    String reformatedText = cr.reformat(textToReformat);

      api.getSQLEntryPanel().setSelectionStart(bounds[0]);
      api.getSQLEntryPanel().setSelectionEnd(bounds[1]);
      api.getSQLEntryPanel().replaceSelection(reformatedText);

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.