1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Changeset 6127

Show
Ignore:
Timestamp:
01/02/11 22:35:07 (3 years ago)
Author:
manningr
Message:

Allow PluginResources? implementation to be injected. Modifed test to support new plugin tests.

Location:
trunk/sql12/plugins/sqlscript/src
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/sql12/plugins/sqlscript/src/main/java/net/sourceforge/squirrel_sql/plugins/sqlscript/SQLScriptPlugin.java

    r5820 r6127  
    2626import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame; 
    2727import net.sourceforge.squirrel_sql.client.plugin.DefaultSessionPlugin; 
     28import net.sourceforge.squirrel_sql.client.plugin.IPluginResourcesFactory; 
    2829import net.sourceforge.squirrel_sql.client.plugin.PluginException; 
    29 import net.sourceforge.squirrel_sql.client.plugin.PluginResources; 
     30import net.sourceforge.squirrel_sql.client.plugin.PluginResourcesFactory; 
    3031import net.sourceforge.squirrel_sql.client.plugin.PluginSessionCallback; 
    3132import net.sourceforge.squirrel_sql.client.preferences.IGlobalPreferencesPanel; 
     
    3435import net.sourceforge.squirrel_sql.fw.gui.GUIUtils; 
    3536import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType; 
     37import net.sourceforge.squirrel_sql.fw.util.IResources; 
    3638import net.sourceforge.squirrel_sql.plugins.sqlscript.prefs.SQLScriptPreferencesManager; 
    3739import net.sourceforge.squirrel_sql.plugins.sqlscript.prefs.SQLScriptPreferencesTab; 
     
    5658        } 
    5759 
    58         private PluginResources _resources; 
     60        private IResources _resources; 
     61 
     62        private IPluginResourcesFactory _resourcesFactory = new PluginResourcesFactory(); 
     63        /** 
     64         * @param resourcesFactory the resourcesFactory to set 
     65         */ 
     66        public void setResourcesFactory(IPluginResourcesFactory resourcesFactory) 
     67        { 
     68                _resourcesFactory = resourcesFactory; 
     69        } 
    5970 
    6071        /** 
     
    159170                IApplication app = getApplication(); 
    160171 
    161                 _resources = new SQLPluginResources(BUNDLE_BASE_NAME, this); 
     172                _resources = _resourcesFactory.createResource(BUNDLE_BASE_NAME, this); 
    162173 
    163174                ActionCollection coll = app.getActionCollection(); 
  • trunk/sql12/plugins/sqlscript/src/main/java/net/sourceforge/squirrel_sql/plugins/sqlscript/table_script/CreateDataScriptAction.java

    r5820 r6127  
    2020import java.awt.event.ActionEvent; 
    2121 
    22 import net.sourceforge.squirrel_sql.fw.util.Resources; 
    23 import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    24  
    2522import net.sourceforge.squirrel_sql.client.IApplication; 
    2623import net.sourceforge.squirrel_sql.client.action.SquirrelAction; 
     24import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI; 
    2725import net.sourceforge.squirrel_sql.client.session.ISession; 
    28 import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI; 
    29 import net.sourceforge.squirrel_sql.client.session.action.ISessionAction; 
    3026import net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction; 
     27import net.sourceforge.squirrel_sql.fw.util.IResources; 
     28import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    3129 
    3230public class CreateDataScriptAction extends SquirrelAction implements IObjectTreeAction { 
     
    3836        private final SQLScriptPlugin _plugin; 
    3937 
    40     public CreateDataScriptAction(IApplication app, Resources rsrc, SQLScriptPlugin plugin) { 
    41         super(app, rsrc); 
     38    public CreateDataScriptAction(IApplication app, IResources resources, SQLScriptPlugin plugin) { 
     39        super(app, resources); 
    4240        _plugin = plugin; 
    4341    } 
  • trunk/sql12/plugins/sqlscript/src/main/java/net/sourceforge/squirrel_sql/plugins/sqlscript/table_script/CreateDataScriptOfCurrentSQLAction.java

    r5820 r6127  
    2525import net.sourceforge.squirrel_sql.client.session.ISession; 
    2626import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction; 
    27 import net.sourceforge.squirrel_sql.fw.util.Resources; 
     27import net.sourceforge.squirrel_sql.fw.util.IResources; 
    2828import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    2929 
     
    3838        private final SQLScriptPlugin _plugin; 
    3939 
    40     public CreateDataScriptOfCurrentSQLAction(IApplication app, Resources rsrc, 
     40    public CreateDataScriptOfCurrentSQLAction(IApplication app, IResources resources, 
    4141                                                                                        SQLScriptPlugin plugin) { 
    42         super(app, rsrc); 
     42        super(app, resources); 
    4343        _plugin = plugin; 
    4444    } 
  • trunk/sql12/plugins/sqlscript/src/main/java/net/sourceforge/squirrel_sql/plugins/sqlscript/table_script/CreateSelectScriptAction.java

    r5820 r6127  
    11package net.sourceforge.squirrel_sql.plugins.sqlscript.table_script; 
    22 
     3import java.awt.event.ActionEvent; 
     4 
     5import net.sourceforge.squirrel_sql.client.IApplication; 
    36import net.sourceforge.squirrel_sql.client.action.SquirrelAction; 
     7import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI; 
     8import net.sourceforge.squirrel_sql.client.session.ISession; 
    49import net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction; 
    5 import net.sourceforge.squirrel_sql.client.session.ISession; 
    6 import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI; 
    7 import net.sourceforge.squirrel_sql.client.IApplication; 
     10import net.sourceforge.squirrel_sql.fw.util.IResources; 
    811import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    9 import net.sourceforge.squirrel_sql.fw.util.Resources; 
    10  
    11 import java.awt.event.ActionEvent; 
    1212 
    1313public class CreateSelectScriptAction extends SquirrelAction  implements IObjectTreeAction 
     
    2424   private final SQLScriptPlugin _plugin; 
    2525 
    26    public CreateSelectScriptAction(IApplication app, Resources rsrc, SQLScriptPlugin plugin) 
     26   public CreateSelectScriptAction(IApplication app, IResources resources, SQLScriptPlugin plugin) 
    2727   { 
    28       super(app, rsrc); 
     28      super(app, resources); 
    2929      _plugin = plugin; 
    3030   } 
  • trunk/sql12/plugins/sqlscript/src/main/java/net/sourceforge/squirrel_sql/plugins/sqlscript/table_script/CreateTableOfCurrentSQLAction.java

    r5820 r6127  
    2222import java.awt.event.ActionEvent; 
    2323 
    24 import net.sourceforge.squirrel_sql.fw.util.Resources; 
    25 import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    26  
    2724import net.sourceforge.squirrel_sql.client.IApplication; 
    2825import net.sourceforge.squirrel_sql.client.action.SquirrelAction; 
     26import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI; 
    2927import net.sourceforge.squirrel_sql.client.session.ISession; 
    30 import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI; 
    31 import net.sourceforge.squirrel_sql.client.session.action.ISessionAction; 
    3228import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction; 
     29import net.sourceforge.squirrel_sql.fw.util.IResources; 
     30import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    3331 
    3432public class CreateTableOfCurrentSQLAction extends SquirrelAction implements ISQLPanelAction 
     
    4543   private final SQLScriptPlugin _plugin; 
    4644 
    47    public CreateTableOfCurrentSQLAction(IApplication app, Resources rsrc, 
     45   public CreateTableOfCurrentSQLAction(IApplication app, IResources resources, 
    4846                                        SQLScriptPlugin plugin) 
    4947   { 
    50       super(app, rsrc); 
     48      super(app, resources); 
    5149      _plugin = plugin; 
    5250   } 
  • trunk/sql12/plugins/sqlscript/src/main/java/net/sourceforge/squirrel_sql/plugins/sqlscript/table_script/CreateTableScriptAction.java

    r5820 r6127  
    2020import java.awt.event.ActionEvent; 
    2121 
    22 import net.sourceforge.squirrel_sql.fw.util.Resources; 
    23 import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    24  
    2522import net.sourceforge.squirrel_sql.client.IApplication; 
    2623import net.sourceforge.squirrel_sql.client.action.SquirrelAction; 
     24import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI; 
    2725import net.sourceforge.squirrel_sql.client.session.ISession; 
    28 import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI; 
    29 import net.sourceforge.squirrel_sql.client.session.action.ISessionAction; 
    3026import net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction; 
     27import net.sourceforge.squirrel_sql.fw.util.IResources; 
     28import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    3129 
    3230public class CreateTableScriptAction  
     
    4038        private final SQLScriptPlugin _plugin; 
    4139 
    42     public CreateTableScriptAction(IApplication app, Resources rsrc, 
     40    public CreateTableScriptAction(IApplication app, IResources resources, 
    4341                                                                        SQLScriptPlugin plugin) { 
    44         super(app, rsrc); 
     42        super(app, resources); 
    4543        _plugin = plugin; 
    4644    } 
  • trunk/sql12/plugins/sqlscript/src/main/java/net/sourceforge/squirrel_sql/plugins/sqlscript/table_script/CreateTemplateDataScriptAction.java

    r5820 r6127  
    2020import java.awt.event.ActionEvent; 
    2121 
    22 import net.sourceforge.squirrel_sql.fw.util.Resources; 
    23 import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    24  
    2522import net.sourceforge.squirrel_sql.client.IApplication; 
    2623import net.sourceforge.squirrel_sql.client.action.SquirrelAction; 
     24import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI; 
    2725import net.sourceforge.squirrel_sql.client.session.ISession; 
    28 import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI; 
    29 import net.sourceforge.squirrel_sql.client.session.action.ISessionAction; 
    3026import net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction; 
     27import net.sourceforge.squirrel_sql.fw.util.IResources; 
     28import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    3129 
    3230public class CreateTemplateDataScriptAction extends SquirrelAction implements IObjectTreeAction { 
     
    3836        private final SQLScriptPlugin _plugin; 
    3937 
    40     public CreateTemplateDataScriptAction(IApplication app, Resources rsrc, SQLScriptPlugin plugin) { 
    41         super(app, rsrc); 
     38    public CreateTemplateDataScriptAction(IApplication app, IResources resources, SQLScriptPlugin plugin) { 
     39        super(app, resources); 
    4240        _plugin = plugin; 
    4341    } 
  • trunk/sql12/plugins/sqlscript/src/main/java/net/sourceforge/squirrel_sql/plugins/sqlscript/table_script/DropTableScriptAction.java

    r5820 r6127  
    2525import net.sourceforge.squirrel_sql.client.session.ISession; 
    2626import net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction; 
    27 import net.sourceforge.squirrel_sql.fw.util.Resources; 
     27import net.sourceforge.squirrel_sql.fw.util.IResources; 
    2828import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin; 
    2929 
     
    3737        private final SQLScriptPlugin _plugin; 
    3838 
    39     public DropTableScriptAction(IApplication app, Resources rsrc, 
     39    public DropTableScriptAction(IApplication app, IResources resources, 
    4040                                                                        SQLScriptPlugin plugin) { 
    41         super(app, rsrc); 
     41        super(app, resources); 
    4242        _plugin = plugin; 
    4343    } 
  • trunk/sql12/plugins/sqlscript/src/test/java/net/sourceforge/squirrel_sql/plugins/sqlscript/SQLScriptPluginTest.java

    r5820 r6127  
    1919package net.sourceforge.squirrel_sql.plugins.sqlscript; 
    2020 
    21 import net.sourceforge.squirrel_sql.client.plugin.AbstractPluginTest; 
     21import net.sourceforge.squirrel_sql.client.plugin.AbstractSessionPluginTest; 
    2222import net.sourceforge.squirrel_sql.client.plugin.DatabaseProductVersionData; 
    23  
    24 import org.junit.After; 
    25 import org.junit.Before; 
     23import net.sourceforge.squirrel_sql.client.plugin.IPlugin; 
    2624 
    2725 
    28 public class SQLScriptPluginTest extends AbstractPluginTest implements DatabaseProductVersionData 
    29 {        
    30         @Before 
    31         public void setUp() throws Exception 
     26public class SQLScriptPluginTest extends AbstractSessionPluginTest implements DatabaseProductVersionData 
     27{ 
     28 
     29        @Override 
     30        protected IPlugin getPluginToTest() throws Exception 
    3231        { 
    33                 classUnderTest = new SQLScriptPlugin(); 
    34         } 
    35  
    36         @After 
    37         public void tearDown() throws Exception 
    38         { 
    39                 classUnderTest = null; 
    40         }                
     32                SQLScriptPlugin result = new SQLScriptPlugin(); 
     33                result.setResourcesFactory(mockIPluginResourcesFactory); 
     34                return result; 
     35        }        
    4136 
    4237}