Revision: 3222
Author: [email protected]
Date: Tue Dec 22 07:34:32 2009
Log: Removed SQLObject Exception catch blocks from methods that no longer
throw exceptions.
Fixed instantiations of Columns.
http://code.google.com/p/power-architect/source/detail?r=3222
Modified:
/trunk/regress/ca/sqlpower/architect/diff/SQLIndexComparatorTest.java
/trunk/regress/ca/sqlpower/architect/swingui/IndexColumnTableTest.java
/trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
/trunk/src/ca/sqlpower/architect/CoreProject.java
/trunk/src/ca/sqlpower/architect/swingui/SQLTableListModel.java
/trunk/src/ca/sqlpower/architect/swingui/action/CreateTableAction.java
=======================================
--- /trunk/regress/ca/sqlpower/architect/diff/SQLIndexComparatorTest.java
Thu Jan 29 12:02:55 2009
+++ /trunk/regress/ca/sqlpower/architect/diff/SQLIndexComparatorTest.java
Tue Dec 22 07:34:32 2009
@@ -145,7 +145,7 @@
assertEquals("Should be same column list.", 0,
indComparator.compareColumns(list1, list2));
- list1.add(new SQLIndex().new Column("new_col",
AscendDescend.UNSPECIFIED));
+ list1.add(new Column("new_col", AscendDescend.UNSPECIFIED));
assertTrue(indComparator.compareColumns(list1, list2) > 0);
assertTrue(indComparator.compareColumns(list2, list1) < 0);
@@ -183,7 +183,7 @@
private SQLIndex makeIndex(int num) throws SQLObjectException {
SQLIndex ind = new SQLIndex();
for (int i = 0; i < num; i++) {
- ind.addChild(ind.new Column("col_" + i,
AscendDescend.UNSPECIFIED));
+ ind.addChild(new Column("col_" + i,
AscendDescend.UNSPECIFIED));
}
return ind;
}
@@ -197,7 +197,7 @@
Set<Column> colList = new TreeSet<Column>(comparator);
SQLIndex ind = new SQLIndex();
for (int i = 0; i < num; i++){
- colList.add(ind.new Column("col_" + i, ascDes));
+ colList.add(new Column("col_" + i, ascDes));
}
return colList;
}
=======================================
--- /trunk/regress/ca/sqlpower/architect/swingui/IndexColumnTableTest.java
Thu Jan 29 12:02:55 2009
+++ /trunk/regress/ca/sqlpower/architect/swingui/IndexColumnTableTest.java
Tue Dec 22 07:34:32 2009
@@ -37,7 +37,7 @@
SQLTable table = new SQLTable();
table.initFolders(true);
SQLIndex index = new SQLIndex();
- Column col = index.new Column("TestCol",
AscendDescend.UNSPECIFIED);
+ Column col = new Column("TestCol", AscendDescend.UNSPECIFIED);
index.addChild(col);
table.addIndex(index);
SQLIndex copyIndex = new SQLIndex(index);
=======================================
--- /trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
Mon Dec 21 08:27:43 2009
+++ /trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
Tue Dec 22 07:34:32 2009
@@ -73,6 +73,7 @@
import ca.sqlpower.sqlobject.SQLTable;
import ca.sqlpower.sqlobject.StubSQLObject;
import ca.sqlpower.sqlobject.SQLIndex.AscendDescend;
+import ca.sqlpower.sqlobject.SQLIndex.Column;
import ca.sqlpower.testutil.MockJDBCDriver;
/**
@@ -709,7 +710,7 @@
SQLColumn col = new SQLColumn(table, "first", Types.VARCHAR, 10,
0);
table.addColumn(col);
SQLIndex target = new SQLIndex("testy index", false, null, null,
null);
- target.addChild(target.new Column(col, AscendDescend.UNSPECIFIED));
+ target.addChild(new Column(col, AscendDescend.UNSPECIFIED));
ppdb.addChild(table);
table.addChild(target);
col.setPrimaryKeySeq(0);
@@ -769,7 +770,7 @@
SQLTable table = new SQLTable(ppdb, true);
table.setName(tableName);
SQLIndex index = new SQLIndex("tasty index", false, null, null,
null);
- SQLIndex.Column indexCol = index.new Column("phogna bologna",
AscendDescend.DESCENDING);
+ SQLIndex.Column indexCol = new Column("phogna bologna",
AscendDescend.DESCENDING);
ppdb.addChild(table);
table.addChild(index);
index.addChild(indexCol);
@@ -811,7 +812,7 @@
table.setName(tableName);
table.addColumn(col);
SQLIndex index = new SQLIndex("tasty index", false, null, null,
null);
- SQLIndex.Column indexCol = index.new Column(col,
AscendDescend.DESCENDING);
+ SQLIndex.Column indexCol = new Column(col,
AscendDescend.DESCENDING);
index.setPrimaryKeyIndex(true);
ppdb.addChild(table);
table.addChild(index);
=======================================
--- /trunk/src/ca/sqlpower/architect/CoreProject.java Mon Dec 21 08:27:43
2009
+++ /trunk/src/ca/sqlpower/architect/CoreProject.java Tue Dec 22 07:34:32
2009
@@ -558,11 +558,7 @@
String populated = attributes.getValue("populated");
if (populated != null && populated.equals("false")) {
- try {
- tab.initFolders(false);
- } catch (SQLObjectException e) {
- logger.error("Couldn't add folder to table
\""+tab.getName()+"\"", e);
- }
+ tab.initFolders(false);
}
currentTable = tab;
@@ -718,7 +714,7 @@
*/
private class SQLIndexColumnFactory extends
AbstractObjectCreationFactory {
public Object createObject(Attributes attributes) {
- Column col = currentIndex.new Column();
+ Column col = new Column();
String id = attributes.getValue("id");
if (id != null) {
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/SQLTableListModel.java Mon Dec
21 08:27:43 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/SQLTableListModel.java Tue Dec
22 07:34:32 2009
@@ -123,7 +123,7 @@
@Override
public void propertyChangeImpl(PropertyChangeEvent e) {
- if (e.getSource() == table.getColumnsFolder()) {
+ if (e.getSource() == table) {
// XXX: should group contiguous regions into one event!
int index = ((SPObject) e.getSource()).getChildren(((SPObject)
e.getSource()).getClass()).indexOf(e.getSource());
logger.debug("Firing contentsChanged event for index "+index);
//$NON-NLS-1$
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/action/CreateTableAction.java
Mon Dec 21 08:27:43 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/action/CreateTableAction.java
Tue Dec 22 07:34:32 2009
@@ -26,7 +26,6 @@
import org.apache.log4j.Logger;
-import ca.sqlpower.architect.swingui.ASUtils;
import ca.sqlpower.architect.swingui.AbstractPlacer;
import ca.sqlpower.architect.swingui.ArchitectSwingSession;
import ca.sqlpower.architect.swingui.PlayPen;
@@ -59,15 +58,8 @@
public void actionPerformed(ActionEvent evt) {
playpen.fireCancel();
SQLTable t = null;
- try {
- t = new SQLTable();
- t.initFolders(true);
- } catch (SQLObjectException e) {
- logger.error("Couldn't add folder to table \""+t.getName()+"\"", e);
//$NON-NLS-1$ //$NON-NLS-2$
- ASUtils.showExceptionDialog(
- session,
- Messages.getString("CreateTableAction.couldNotAddFolder"), e);
//$NON-NLS-1$
- }
+ t = new SQLTable();
+ t.initFolders(true);
t.setName("New_Table"); //$NON-NLS-1$
TablePane tp = new TablePane(t, playpen.getContentPane());