Update of /cvsroot/squirrel-sql/sql12/plugins/hibernate/src/net/sourceforge/squirrel_sql/plugins/hibernate/configuration
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv22336/plugins/hibernate/src/net/sourceforge/squirrel_sql/plugins/hibernate/configuration
Modified Files:
HibernateConfigPanel.java HibernateConfigController.java
I18NStrings.properties
Log Message:
Hibernate Plugin: The Classpath configuration now allows to move entries up or down.
Index: HibernateConfigController.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/hibernate/src/net/sourceforge/squirrel_sql/plugins/hibernate/configuration/HibernateConfigController.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** HibernateConfigController.java 6 Oct 2007 03:38:29 -0000 1.3
--- HibernateConfigController.java 7 Jan 2010 22:20:00 -0000 1.4
***************
*** 76,79 ****
--- 76,95 ----
});
+ _panel.btnClassPathMoveUp.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ onMoveUpClasspathEntries();
+ }
+ });
+
+ _panel.btnClassPathMoveDown.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ onMoveDownClasspathEntries();
+ }
+ });
+
***************
*** 118,121 ****
--- 134,138 ----
}
+
private void onObtainSessFactChanged()
{
***************
*** 336,339 ****
--- 353,424 ----
}
+
+ private void onMoveUpClasspathEntries()
+ {
+ int[] selIx = _panel.lstClassPath.getSelectedIndices();
+
+ if(null == selIx|| 0 == selIx.length)
+ {
+ return;
+ }
+
+ DefaultListModel listModel = (DefaultListModel) _panel.lstClassPath.getModel();
+
+ for (int i : selIx)
+ {
+ if(0 == i)
+ {
+ return;
+ }
+ }
+
+ int[] newSelIx = new int[selIx.length];
+ for (int i =0; i < selIx.length; ++i)
+ {
+ String file = (String) listModel.remove(selIx[i]);
+ newSelIx[i] = selIx[i] - 1;
+ listModel.insertElementAt(file, newSelIx[i]);
+ }
+
+ _panel.lstClassPath.setSelectedIndices(newSelIx);
+
+ _panel.lstClassPath.ensureIndexIsVisible(newSelIx[0]);
+
+ }
+
+ private void onMoveDownClasspathEntries()
+ {
+ int[] selIx = _panel.lstClassPath.getSelectedIndices();
+
+ if(null == selIx|| 0 == selIx.length)
+ {
+ return;
+ }
+
+ DefaultListModel listModel = (DefaultListModel) _panel.lstClassPath.getModel();
+
+ for (int i : selIx)
+ {
+ if(listModel.getSize() - 1 == i)
+ {
+ return;
+ }
+ }
+
+ int[] newSelIx = new int[selIx.length];
+ for (int i = selIx.length - 1; i >= 0 ; --i)
+ {
+ String file = (String) listModel.remove(selIx[i]);
+ newSelIx[i] = selIx[i] + 1;
+ listModel.insertElementAt(file, newSelIx[i]);
+ }
+
+ _panel.lstClassPath.setSelectedIndices(newSelIx);
+
+ _panel.lstClassPath.ensureIndexIsVisible(newSelIx[newSelIx.length - 1]);
+
+ }
+
+
private void onNewConfig()
{
Index: HibernateConfigPanel.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/hibernate/src/net/sourceforge/squirrel_sql/plugins/hibernate/configuration/HibernateConfigPanel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HibernateConfigPanel.java 30 Aug 2007 23:13:07 -0000 1.1
--- HibernateConfigPanel.java 7 Jan 2010 22:20:00 -0000 1.2
***************
*** 21,24 ****
--- 21,26 ----
JButton btnClassPathAdd;
JButton btnClassPathRemove;
+ JButton btnClassPathMoveUp;
+ JButton btnClassPathMoveDown;
JTextField txtConfigName;
JButton btnApplyConfigChanges;
***************
*** 141,144 ****
--- 143,153 ----
ret.add(btnClassPathRemove, gbc);
+ gbc = new GridBagConstraints(2,0,1,1,0,0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,5,5,5), 0,0);
+ btnClassPathMoveUp = new JButton(s_stringMgr.getString("HibernatePanel.moveUp"));
+ ret.add(btnClassPathMoveUp, gbc);
+
+ gbc = new GridBagConstraints(3,0,1,1,0,0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,5,5,5), 0,0);
+ btnClassPathMoveDown = new JButton(s_stringMgr.getString("HibernatePanel.moveDown"));
+ ret.add(btnClassPathMoveDown, gbc);
return ret;
Index: I18NStrings.properties
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/plugins/hibernate/src/net/sourceforge/squirrel_sql/plugins/hibernate/configuration/I18NStrings.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** I18NStrings.properties 30 Aug 2007 23:13:07 -0000 1.4
--- I18NStrings.properties 7 Jan 2010 22:20:00 -0000 1.5
***************
*** 55,56 ****
--- 55,60 ----
HibernatePanel.toObtainSessionFactJPA=Call "javax.persistence.Persistence.createEntityManagerFactory("<persitence-unit name>");"
HibernatePanel.toObtainSessionFactPersUnit=persitence-unit name:
+
+ HibernatePanel.moveUp=Move up
+ HibernatePanel.moveDown=Move down
+
|