Revision: 3764
Author: [email protected]
Date: Tue Jul 20 14:05:52 2010
Log: Removed the method getPrimaryKeyName() from SQLTable as it is
deprecated. The only places it was being used was in EditTableAction in
Architect, and various test classes.
http://code.google.com/p/power-architect/source/detail?r=3764
Modified:
/trunk/regress/ca/sqlpower/architect/swingui/TestTableEditPane.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/TableEditPanel.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/action/EditTableAction.java
=======================================
--- /trunk/regress/ca/sqlpower/architect/swingui/TestTableEditPane.java Mon
Feb 8 10:12:47 2010
+++ /trunk/regress/ca/sqlpower/architect/swingui/TestTableEditPane.java Tue
Jul 20 14:05:52 2010
@@ -57,24 +57,24 @@
}
public void testPrimaryNameChangeUpdatesPk() throws Exception {
- assertEquals("Test_Table_1_pk", t.getPrimaryKeyName());
+ assertEquals("Test_Table_1_pk", t.getPrimaryKeyIndex().getName());
tep.setPhysicalNameText("New Name");
tep.applyChanges();
- assertEquals ("New Name_pk", t.getPrimaryKeyName());
+ assertEquals ("New Name_pk", t.getPrimaryKeyIndex().getName());
}
public void testNameChangeDoesNotUpdatePK() throws Exception {
tep.setNameText("New Table Name");
tep.applyChanges();
- assertEquals("Test_Table_1_pk", t.getPrimaryKeyName());
+ assertEquals("Test_Table_1_pk", t.getPrimaryKeyIndex().getName());
}
public void
testPhysicalNameChangeDoesNotUpdatePkWhenPkNameAlsoChanged() throws
Exception {
- assertEquals("Test_Table_1_pk", t.getPrimaryKeyName());
+ assertEquals("Test_Table_1_pk", t.getPrimaryKeyIndex().getName());
tep.setPhysicalNameText("New Name");
tep.setPkNameText("New PK Name");
tep.applyChanges();
- assertEquals ("New PK Name", t.getPrimaryKeyName());
+ assertEquals ("New PK Name", t.getPrimaryKeyIndex().getName());
assertEquals ("New PK Name",
t.getPrimaryKeyIndex().getPhysicalName());
}
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/TableEditPanel.java
Tue Jul 6 15:49:24 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/swingui/TableEditPanel.java
Tue Jul 20 14:05:52 2010
@@ -37,6 +37,7 @@
import ca.sqlpower.object.SPChildEvent;
import ca.sqlpower.object.SPListener;
+import ca.sqlpower.sqlobject.SQLIndex;
import ca.sqlpower.sqlobject.SQLObjectException;
import ca.sqlpower.sqlobject.SQLObjectRuntimeException;
import ca.sqlpower.sqlobject.SQLTable;
@@ -116,10 +117,11 @@
logicalName.setText(t.getName());
physicalName.setText(t.getPhysicalName());
try {
- if (t.getPrimaryKeyIndex() == null) {
+ SQLIndex primaryKeyIndex = t.getPrimaryKeyIndex();
+ if (primaryKeyIndex == null) {
pkName.setEnabled(false);
} else {
- pkName.setText(t.getPrimaryKeyName());
+ pkName.setText(primaryKeyIndex.getName());
pkName.setEnabled(true);
}
SQLPowerUtils.listenToHierarchy(session.getRootObject(), this);
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/swingui/action/EditTableAction.java
Mon Jul 12 08:21:11 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/swingui/action/EditTableAction.java
Tue Jul 20 14:05:52 2010
@@ -31,6 +31,7 @@
import ca.sqlpower.architect.swingui.ArchitectFrame;
import ca.sqlpower.architect.swingui.DBTree;
import ca.sqlpower.architect.swingui.PlayPen;
+import ca.sqlpower.architect.swingui.PlayPenComponent;
import ca.sqlpower.architect.swingui.TableEditPanel;
import ca.sqlpower.architect.swingui.TablePane;
import ca.sqlpower.sqlobject.SQLColumn;
@@ -47,7 +48,7 @@
public void actionPerformed(ActionEvent evt) {
if
(evt.getActionCommand().equals(PlayPen.ACTION_COMMAND_SRC_PLAYPEN)) {
- List selection = getPlaypen().getSelectedItems();
+ List<PlayPenComponent> selection =
getPlaypen().getSelectedItems();
if (selection.size() < 1) {
JOptionPane.showMessageDialog(getPlaypen(),
Messages.getString("EditTableAction.noTablesSelected")); //$NON-NLS-1$
} else if (selection.size() > 1) {